Skip to content

Commit 8e731a4

Browse files
committed
Merge branch 'master' of https://github.com/go-gitea/gitea into milestones
2 parents e1bc0f3 + c34fdf7 commit 8e731a4

File tree

20 files changed

+475
-398
lines changed

20 files changed

+475
-398
lines changed

.drone.yml

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,6 @@ steps:
8989
commands:
9090
- curl -sL https://deb.nodesource.com/setup_12.x | bash - && apt -y install nodejs
9191
- make clean
92-
- make generate
9392
- make golangci-lint
9493
- make revive
9594
- make swagger-check
@@ -389,12 +388,18 @@ steps:
389388
commands:
390389
- git fetch --tags --force
391390

391+
- name: build
392+
pull: always
393+
image: node:10 # this step is kept at the lowest version of node that we support
394+
commands:
395+
- make css
396+
- make js
397+
392398
- name: static
393399
pull: always
394400
image: techknowlogick/xgo:latest
395401
commands:
396402
- export PATH=$PATH:$GOPATH/bin
397-
- make generate
398403
- make release
399404
environment:
400405
GOPROXY: off
@@ -491,12 +496,18 @@ steps:
491496
commands:
492497
- git fetch --tags --force
493498

499+
- name: build
500+
pull: always
501+
image: node:10 # this step is kept at the lowest version of node that we support
502+
commands:
503+
- make css
504+
- make js
505+
494506
- name: static
495507
pull: always
496508
image: techknowlogick/xgo:latest
497509
commands:
498510
- export PATH=$PATH:$GOPATH/bin
499-
- make generate
500511
- make release
501512
environment:
502513
GOPROXY: off
@@ -650,8 +661,6 @@ steps:
650661
exclude:
651662
- pull_request
652663

653-
654-
655664
---
656665
kind: pipeline
657666
name: docker-linux-arm64
@@ -757,6 +766,9 @@ workspace:
757766
base: /go
758767
path: src/code.gitea.io/gitea
759768

769+
clone:
770+
disable: true
771+
760772
when:
761773
status:
762774
- success

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,7 @@ $(EXECUTABLE): $(GO_SOURCES)
397397
GO111MODULE=on $(GO) build -mod=vendor $(GOFLAGS) $(EXTRA_GOFLAGS) -tags '$(TAGS)' -ldflags '-s -w $(LDFLAGS)' -o $@
398398

399399
.PHONY: release
400-
release: release-dirs release-windows release-linux release-darwin release-copy release-compress release-check
400+
release: generate release-dirs release-windows release-linux release-darwin release-copy release-compress release-check
401401

402402
.PHONY: release-dirs
403403
release-dirs:

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ This project has been
3131

3232
From the root of the source tree, run:
3333

34-
TAGS="bindata" make generate all
34+
TAGS="bindata" make build
3535

3636
More info: https://docs.gitea.io/en-us/install-from-source/
3737

docs/content/doc/installation/from-source.en-us.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,6 @@ To include assets, add the `bindata` tag:
106106
TAGS="bindata" make build
107107
```
108108

109-
WARNING: `generate` method is deprecated and using it may cause build to miss some static files.
110-
111109
In the default release build of our continuous integration system, the build
112110
tags are: `TAGS="bindata sqlite sqlite_unlock_notify"`. The simplest
113111
recommended way to build from source is therefore:

docs/content/doc/installation/from-source.fr-fr.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,10 @@ Comme nous regroupons déjà toutes les bibliothèques requises pour compiler Gi
6060
* `sqlite sqlite_unlock_notify`: Active la prise en charge d'une base de données [SQLite3](https://sqlite.org/), ceci n'est recommandé que pour les petites installations de Gitea.
6161
* `pam`: Active la prise en charge de PAM (mLinux Pluggable Authentication Modules), très utile si vos utilisateurs doivent être authentifiés avec les comptes du système.
6262

63-
Il est temps de compiler le binaire, nous suggérons d'intégrer les ressources avec l'option de compilation `bindata`. Pour inclure les ressources, vous devrez également exécuter la tâche Make `generate`. Dans le cas échéant, les ressources ne pourront pas être intégrées:
63+
Il est temps de compiler le binaire, nous suggérons d'intégrer les ressources avec l'option de compilation `bindata`:
6464

6565
```
66-
TAGS="bindata" make generate build
66+
TAGS="bindata" make build
6767
```
6868

6969
## Test

docs/content/doc/installation/from-source.zh-cn.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,6 @@ git checkout v{{< version >}}
6666
TAGS="bindata" make build
6767
```
6868

69-
警告: `generate` 已经废弃,使用 `generate` 会导致资源文件打包失败。
70-
7169
默认的发布版本中的编译选项是: `TAGS="bindata sqlite sqlite_unlock_notify"`。以下为推荐的编译方式:
7270

7371
```bash

docs/content/doc/installation/from-source.zh-tw.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,10 @@ git checkout v{{< version >}}
5050
* `sqlite sqlite_unlock_notify`: 使用此標籤來啟用 [SQLite3](https://sqlite.org/) 資料庫,建議只有少數人時才使用此模式。
5151
* `pam`: 使用此標籤來啟用 PAM (Linux Pluggable Authentication Modules) 認證,對於系統使用者來說,此方式最方便了。
5252

53-
現在您可以開始編譯執行檔了,我們建議使用 `bindata` 編譯選項,使用 `bindata` 選項前,您必須執行 `generate` 任務將所有資源都一起編譯進去,否則相關資源都不會被編譯進執行檔:
53+
現在您可以開始編譯執行檔了,我們建議使用 `bindata` 編譯選項:
5454

5555
```
56-
TAGS="bindata" make generate build
56+
TAGS="bindata" make build
5757
```
5858

5959
**注意**: 因為使用了套件管理工具,我們建議 Go 環境版本為 1.6 或者是更高,這樣不用在 Go 1.5 版本設定全域變數 `GO15VENDOREXPERIMENT`

integrations/repo_search_test.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import (
1010
"time"
1111

1212
"code.gitea.io/gitea/models"
13+
code_indexer "code.gitea.io/gitea/modules/indexer/code"
1314
"code.gitea.io/gitea/modules/setting"
1415

1516
"github.com/PuerkitoBio/goquery"
@@ -34,7 +35,7 @@ func TestSearchRepo(t *testing.T) {
3435
repo, err := models.GetRepositoryByOwnerAndName("user2", "repo1")
3536
assert.NoError(t, err)
3637

37-
executeIndexer(t, repo, models.UpdateRepoIndexer)
38+
executeIndexer(t, repo, code_indexer.UpdateRepoIndexer)
3839

3940
testSearch(t, "/user2/repo1/search?q=Description&page=1", []string{"README.md"})
4041

@@ -44,8 +45,8 @@ func TestSearchRepo(t *testing.T) {
4445
repo, err = models.GetRepositoryByOwnerAndName("user2", "glob")
4546
assert.NoError(t, err)
4647

47-
executeIndexer(t, repo, models.DeleteRepoFromIndexer)
48-
executeIndexer(t, repo, models.UpdateRepoIndexer)
48+
executeIndexer(t, repo, code_indexer.DeleteRepoFromIndexer)
49+
executeIndexer(t, repo, code_indexer.UpdateRepoIndexer)
4950

5051
testSearch(t, "/user2/glob/search?q=loren&page=1", []string{"a.txt"})
5152
testSearch(t, "/user2/glob/search?q=file3&page=1", []string{"x/b.txt"})

models/models.go

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,3 +254,28 @@ func MaxBatchInsertSize(bean interface{}) int {
254254
func Count(bean interface{}) (int64, error) {
255255
return x.Count(bean)
256256
}
257+
258+
// IsTableNotEmpty returns true if table has at least one record
259+
func IsTableNotEmpty(tableName string) (bool, error) {
260+
return x.Table(tableName).Exist()
261+
}
262+
263+
// DeleteAllRecords will delete all the records of this table
264+
func DeleteAllRecords(tableName string) error {
265+
_, err := x.Exec(fmt.Sprintf("DELETE FROM %s", tableName))
266+
return err
267+
}
268+
269+
// GetMaxID will return max id of the table
270+
func GetMaxID(beanOrTableName interface{}) (maxID int64, err error) {
271+
_, err = x.Select("MAX(id)").Table(beanOrTableName).Get(&maxID)
272+
return
273+
}
274+
275+
// FindByMaxID filled results as the condition from database
276+
func FindByMaxID(maxID int64, limit int, results interface{}) error {
277+
return x.Where("id <= ?", maxID).
278+
OrderBy("id DESC").
279+
Limit(limit).
280+
Find(results)
281+
}

models/repo.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1112,10 +1112,6 @@ func MigrateRepositoryGitData(doer, u *User, repo *Repository, opts api.MigrateR
11121112
repo, err = CleanUpMigrateInfo(repo)
11131113
}
11141114

1115-
if err != nil && !repo.IsEmpty {
1116-
UpdateRepoIndexer(repo)
1117-
}
1118-
11191115
return repo, err
11201116
}
11211117

0 commit comments

Comments
 (0)