Skip to content

Commit 349c294

Browse files
committed
Merge branch 'master' into feature/dismissing_reviews
* master: (22 commits) Add support for ref parameter to get raw file API (go-gitea#14602) Fixed irritating error message related to go version (go-gitea#14611) Use OldRef instead of CommitSHA for DeleteBranch comments (go-gitea#14604) Add information on how to build statically (go-gitea#14594) [skip ci] Updated translations via Crowdin Exclude the current dump file from the dump (go-gitea#14606) Remove spurious DataAsync Error logging (go-gitea#14599) [API] Add delete release by tag & fix unreleased inconsistency (go-gitea#14563) Fix rate limit bug when downloading assets on migrating from github (go-gitea#14564) [API] Add affected files of commits to commit struct (go-gitea#14579) [skip ci] Updated licenses and gitignores Fix locale init (go-gitea#14582) Add Content-Length header to HEAD requests (go-gitea#14542) Honor REGISTER_MANUAL_CONFIRM when doing openid registration (go-gitea#14548) Fix lfs file viewer (go-gitea#14568) Fix typo in generate-emoji.go (go-gitea#14570) Fix bug about ListOptions and stars/watchers pagnation (go-gitea#14556) Fix gpg key deletion (go-gitea#14561) [API] GetRelease by tag only return release (go-gitea#14397) Reduce data races (go-gitea#14549) ...
2 parents 28a7f96 + b337c60 commit 349c294

Some content is hidden

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

55 files changed

+1019
-256
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ help:
190190
go-check:
191191
$(eval GO_VERSION := $(shell printf "%03d%03d%03d" $(shell $(GO) version | grep -Eo '[0-9]+\.[0-9.]+' | tr '.' ' ');))
192192
@if [ "$(GO_VERSION)" -lt "$(MIN_GO_VERSION)" ]; then \
193-
echo "Gitea requires Go 1.13 or greater to build. You can get it at https://golang.org/dl/"; \
193+
echo "Gitea requires Go 1.14 or greater to build. You can get it at https://golang.org/dl/"; \
194194
exit 1; \
195195
fi
196196

build/generate-emoji.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ func generate() ([]byte, error) {
174174
s = append(s, k)
175175
} else {
176176
// insert into slice after first element because all emoji that support skin tones
177-
// have that modifer placed at this spot
177+
// have that modifier placed at this spot
178178
s = append(s, "")
179179
copy(s[2:], s[1:])
180180
s[1] = k

cmd/dump.go

Lines changed: 24 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -49,38 +49,6 @@ func addFile(w archiver.Writer, filePath string, absPath string, verbose bool) e
4949
})
5050
}
5151

52-
func addRecursive(w archiver.Writer, dirPath string, absPath string, verbose bool) error {
53-
if verbose {
54-
log.Info("Adding dir %s\n", dirPath)
55-
}
56-
dir, err := os.Open(absPath)
57-
if err != nil {
58-
return fmt.Errorf("Could not open directory %s: %s", absPath, err)
59-
}
60-
defer dir.Close()
61-
62-
files, err := dir.Readdir(0)
63-
if err != nil {
64-
return fmt.Errorf("Unable to list files in %s: %s", absPath, err)
65-
}
66-
67-
if err := addFile(w, dirPath, absPath, false); err != nil {
68-
return err
69-
}
70-
71-
for _, fileInfo := range files {
72-
if fileInfo.IsDir() {
73-
err = addRecursive(w, filepath.Join(dirPath, fileInfo.Name()), filepath.Join(absPath, fileInfo.Name()), verbose)
74-
} else {
75-
err = addFile(w, filepath.Join(dirPath, fileInfo.Name()), filepath.Join(absPath, fileInfo.Name()), verbose)
76-
}
77-
if err != nil {
78-
return err
79-
}
80-
}
81-
return nil
82-
}
83-
8452
func isSubdir(upper string, lower string) (bool, error) {
8553
if relPath, err := filepath.Rel(upper, lower); err != nil {
8654
return false, err
@@ -157,6 +125,10 @@ It can be used for backup and capture Gitea server image to send to maintainer`,
157125
Name: "skip-log, L",
158126
Usage: "Skip the log dumping",
159127
},
128+
cli.BoolFlag{
129+
Name: "skip-custom-dir",
130+
Usage: "Skip custom directory",
131+
},
160132
cli.GenericFlag{
161133
Name: "type",
162134
Value: outputTypeEnum,
@@ -211,6 +183,11 @@ func runDump(ctx *cli.Context) error {
211183
}
212184
defer file.Close()
213185

186+
absFileName, err := filepath.Abs(fileName)
187+
if err != nil {
188+
return err
189+
}
190+
214191
verbose := ctx.Bool("verbose")
215192
outType := ctx.String("type")
216193
var iface interface{}
@@ -233,7 +210,7 @@ func runDump(ctx *cli.Context) error {
233210
log.Info("Skip dumping local repositories")
234211
} else {
235212
log.Info("Dumping local repositories... %s", setting.RepoRootPath)
236-
if err := addRecursive(w, "repos", setting.RepoRootPath, verbose); err != nil {
213+
if err := addRecursiveExclude(w, "repos", setting.RepoRootPath, []string{absFileName}, verbose); err != nil {
237214
fatal("Failed to include repositories: %v", err)
238215
}
239216

@@ -292,17 +269,21 @@ func runDump(ctx *cli.Context) error {
292269
}
293270
}
294271

295-
customDir, err := os.Stat(setting.CustomPath)
296-
if err == nil && customDir.IsDir() {
297-
if is, _ := isSubdir(setting.AppDataPath, setting.CustomPath); !is {
298-
if err := addRecursive(w, "custom", setting.CustomPath, verbose); err != nil {
299-
fatal("Failed to include custom: %v", err)
272+
if ctx.IsSet("skip-custom-dir") && ctx.Bool("skip-custom-dir") {
273+
log.Info("Skiping custom directory")
274+
} else {
275+
customDir, err := os.Stat(setting.CustomPath)
276+
if err == nil && customDir.IsDir() {
277+
if is, _ := isSubdir(setting.AppDataPath, setting.CustomPath); !is {
278+
if err := addRecursiveExclude(w, "custom", setting.CustomPath, []string{absFileName}, verbose); err != nil {
279+
fatal("Failed to include custom: %v", err)
280+
}
281+
} else {
282+
log.Info("Custom dir %s is inside data dir %s, skipped", setting.CustomPath, setting.AppDataPath)
300283
}
301284
} else {
302-
log.Info("Custom dir %s is inside data dir %s, skipped", setting.CustomPath, setting.AppDataPath)
285+
log.Info("Custom dir %s doesn't exist, skipped", setting.CustomPath)
303286
}
304-
} else {
305-
log.Info("Custom dir %s doesn't exist, skipped", setting.CustomPath)
306287
}
307288

308289
isExist, err := util.IsExist(setting.AppDataPath)
@@ -325,6 +306,7 @@ func runDump(ctx *cli.Context) error {
325306
excludes = append(excludes, setting.LFS.Path)
326307
excludes = append(excludes, setting.Attachment.Path)
327308
excludes = append(excludes, setting.LogRootPath)
309+
excludes = append(excludes, absFileName)
328310
if err := addRecursiveExclude(w, "data", setting.AppDataPath, excludes, verbose); err != nil {
329311
fatal("Failed to include data directory: %v", err)
330312
}
@@ -358,7 +340,7 @@ func runDump(ctx *cli.Context) error {
358340
log.Error("Unable to check if %s exists. Error: %v", setting.LogRootPath, err)
359341
}
360342
if isExist {
361-
if err := addRecursive(w, "log", setting.LogRootPath, verbose); err != nil {
343+
if err := addRecursiveExclude(w, "log", setting.LogRootPath, []string{absFileName}, verbose); err != nil {
362344
fatal("Failed to include log: %v", err)
363345
}
364346
}

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,3 +186,11 @@ CC=aarch64-unknown-linux-gnu-gcc GOOS=linux GOARCH=arm64 TAGS="bindata sqlite sq
186186
```
187187

188188
Replace `CC`, `GOOS`, and `GOARCH` as appropriate for your architecture target.
189+
190+
You will sometimes need to build a static compiled image. To do this you will need to add:
191+
192+
```
193+
LDFLAGS="-linkmode external -extldflags '-static' $LDFLAGS" TAGS="netgo osusergo $TAGS" make build
194+
```
195+
196+
This can be combined with `CC`, `GOOS`, and `GOARCH` as above.

0 commit comments

Comments
 (0)