Skip to content

Commit 3a7e26e

Browse files
committed
Merge remote-tracking branch 'origin/main' into move-login-out-of-models
2 parents f387862 + 28f6f7b commit 3a7e26e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+310
-114
lines changed

.drone.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,17 @@ steps:
217217
GITHUB_READ_TOKEN:
218218
from_secret: github_read_token
219219

220+
- name: unit-test-race
221+
image: golang:1.16
222+
commands:
223+
- make test-backend
224+
environment:
225+
GOPROXY: off
226+
TAGS: sqlite sqlite_unlock_notify
227+
RACE_ENABLED: true
228+
GITHUB_READ_TOKEN:
229+
from_secret: github_read_token
230+
220231
- name: unit-test-gogit
221232
pull: always
222233
image: golang:1.16

docs/content/doc/advanced/config-cheat-sheet.en-us.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -527,12 +527,11 @@ relation to port exhaustion.
527527
- `USER_DELETE_WITH_COMMENTS_MAX_TIME`: **0** Minimum amount of time a user must exist before comments are kept when the user is deleted.
528528
- `VALID_SITE_URL_SCHEMES`: **http, https**: Valid site url schemes for user profiles
529529

530-
### Service - Expore (`service.explore`)
530+
### Service - Explore (`service.explore`)
531531

532532
- `REQUIRE_SIGNIN_VIEW`: **false**: Only allow signed in users to view the explore pages.
533533
- `DISABLE_USERS_PAGE`: **false**: Disable the users explore page.
534534

535-
536535
## SSH Minimum Key Sizes (`ssh.minimum_key_sizes`)
537536

538537
Define allowed algorithms and their minimum key length (use -1 to disable a type):

docs/content/doc/advanced/customizing-gitea.en-us.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ to the file `templates/custom/footer.tmpl`
200200

201201
You also need to download the content of the library [Madeleine.js](https://jinjunho.github.io/Madeleine.js/) and place it under `$GITEA_CUSTOM/public/` folder.
202202

203-
You should end-up with a folder structucture similar to:
203+
You should end-up with a folder structure similar to:
204204

205205
```
206206
$GITEA_CUSTOM/templates

docs/content/doc/advanced/make.fr-fr.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ sudo yum install make
3737

3838
Si vous utilisez Windows, vous pouvez télécharger une des versions suivantes de Make:
3939

40-
- [Simple binaire](http://www.equation.com/servlet/equation.cmd?fa=make). Copiez le quelque part et mettez à jour `PATH`.
40+
- [Simple binaire](http://www.equation.com/servlet/equation.cmd?fa=make). Copiez-le quelque part et mettez à jour `PATH`.
4141
- [32-bits version](ftp://ftp.equation.com/make/32/make.exe)
4242
- [64-bits version](ftp://ftp.equation.com/make/64/make.exe)
43-
- [MinGW](http://www.mingw.org/) includes a build. The binary is called `mingw32-make.exe` instead of `make.exe`. Add the `bin` folder to your `PATH`.
44-
- [Chocolatey package](https://chocolatey.org/packages/make). Run `choco install make`
43+
- [MinGW](http://www.mingw.org/) inclut un _build_. Le fichier binaire est nommé `mingw32-make.exe` plutôt que `make.exe`. Ajoutez le dossier `bin` à votre `PATH`.
44+
- [Chocolatey package](https://chocolatey.org/packages/make). Exécutez `choco install make`.

docs/content/doc/installation/windows-service.fr-fr.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ Pour activer le service Windows Gitea, ouvrez une `cmd` en tant qu'Administrateu
2121
sc create gitea start= auto binPath= "\"C:\gitea\gitea.exe\" web --config \"C:\gitea\custom\conf\app.ini\""
2222
```
2323

24-
N'oubliez pas de remplacer `C:\gitea` par le chemin que vous avez utilisez pour votre installation.
24+
N'oubliez pas de remplacer `C:\gitea` par le chemin que vous avez utilisé pour votre installation.
2525

26-
Ensuite, ouvrez "Services Windows", puis recherchez le service `gitea`, faites un clique droit et selectionnez "Run". Si tout fonctionne, vous devriez être capable d'accèder à Gitea à l'URL `http://localhost:3000` (ou sur le port configuré si différent de 3000).
26+
Ensuite, ouvrez "Services Windows", puis recherchez le service `gitea`, faites un clic droit et selectionnez "Run". Si tout fonctionne, vous devriez être capable d'accèder à Gitea à l'URL `http://localhost:3000` (ou sur le port configuré si différent de 3000).
2727

2828
## Désactiver un service Windows
2929

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
423313fbd38093bb10d0c8387db9105409c6f196
1+
0dca5bd9b5d7ef937710e056f575e86c0184ba85

modules/git/batch_reader.go

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ package git
77
import (
88
"bufio"
99
"bytes"
10+
"context"
1011
"io"
1112
"math"
1213
"strconv"
@@ -28,23 +29,28 @@ type WriteCloserError interface {
2829
func CatFileBatchCheck(repoPath string) (WriteCloserError, *bufio.Reader, func()) {
2930
batchStdinReader, batchStdinWriter := io.Pipe()
3031
batchStdoutReader, batchStdoutWriter := io.Pipe()
32+
ctx, ctxCancel := context.WithCancel(DefaultContext)
33+
closed := make(chan struct{})
3134
cancel := func() {
3235
_ = batchStdinReader.Close()
3336
_ = batchStdinWriter.Close()
3437
_ = batchStdoutReader.Close()
3538
_ = batchStdoutWriter.Close()
39+
ctxCancel()
40+
<-closed
3641
}
3742

3843
go func() {
3944
stderr := strings.Builder{}
40-
err := NewCommand("cat-file", "--batch-check").RunInDirFullPipeline(repoPath, batchStdoutWriter, &stderr, batchStdinReader)
45+
err := NewCommandContext(ctx, "cat-file", "--batch-check").RunInDirFullPipeline(repoPath, batchStdoutWriter, &stderr, batchStdinReader)
4146
if err != nil {
4247
_ = batchStdoutWriter.CloseWithError(ConcatenateError(err, (&stderr).String()))
4348
_ = batchStdinReader.CloseWithError(ConcatenateError(err, (&stderr).String()))
4449
} else {
4550
_ = batchStdoutWriter.Close()
4651
_ = batchStdinReader.Close()
4752
}
53+
close(closed)
4854
}()
4955

5056
// For simplicities sake we'll use a buffered reader to read from the cat-file --batch-check
@@ -59,23 +65,28 @@ func CatFileBatch(repoPath string) (WriteCloserError, *bufio.Reader, func()) {
5965
// so let's create a batch stdin and stdout
6066
batchStdinReader, batchStdinWriter := io.Pipe()
6167
batchStdoutReader, batchStdoutWriter := nio.Pipe(buffer.New(32 * 1024))
68+
ctx, ctxCancel := context.WithCancel(DefaultContext)
69+
closed := make(chan struct{})
6270
cancel := func() {
6371
_ = batchStdinReader.Close()
6472
_ = batchStdinWriter.Close()
6573
_ = batchStdoutReader.Close()
6674
_ = batchStdoutWriter.Close()
75+
ctxCancel()
76+
<-closed
6777
}
6878

6979
go func() {
7080
stderr := strings.Builder{}
71-
err := NewCommand("cat-file", "--batch").RunInDirFullPipeline(repoPath, batchStdoutWriter, &stderr, batchStdinReader)
81+
err := NewCommandContext(ctx, "cat-file", "--batch").RunInDirFullPipeline(repoPath, batchStdoutWriter, &stderr, batchStdinReader)
7282
if err != nil {
7383
_ = batchStdoutWriter.CloseWithError(ConcatenateError(err, (&stderr).String()))
7484
_ = batchStdinReader.CloseWithError(ConcatenateError(err, (&stderr).String()))
7585
} else {
7686
_ = batchStdoutWriter.Close()
7787
_ = batchStdinReader.Close()
7888
}
89+
close(closed)
7990
}()
8091

8192
// For simplicities sake we'll us a buffered reader to read from the cat-file --batch

modules/git/tree.go

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
package git
77

88
import (
9+
"bytes"
910
"strings"
1011
)
1112

@@ -45,3 +46,23 @@ func (t *Tree) SubTree(rpath string) (*Tree, error) {
4546
}
4647
return g, nil
4748
}
49+
50+
// LsTree checks if the given filenames are in the tree
51+
func (repo *Repository) LsTree(ref string, filenames ...string) ([]string, error) {
52+
cmd := NewCommand("ls-tree", "-z", "--name-only", "--", ref)
53+
for _, arg := range filenames {
54+
if arg != "" {
55+
cmd.AddArguments(arg)
56+
}
57+
}
58+
res, err := cmd.RunInDirBytes(repo.Path)
59+
if err != nil {
60+
return nil, err
61+
}
62+
filelist := make([]string, 0, len(filenames))
63+
for _, line := range bytes.Split(res, []byte{'\000'}) {
64+
filelist = append(filelist, string(line))
65+
}
66+
67+
return filelist, err
68+
}

0 commit comments

Comments
 (0)