Skip to content

Commit fb54d91

Browse files
committed
Merge remote-tracking branch 'giteaofficial/main'
* giteaofficial/main: [skip ci] Updated translations via Crowdin Use github.com/mholt/archives replace github.com/mholt/archiver (go-gitea#35390) Move some functions from package git to gitrepo (go-gitea#33910) Move git config/remote to gitrepo package and add global lock to resolve possible conflict when updating repository git config file (go-gitea#35151) Move HasWiki to repository service package (go-gitea#33912) Rename UpdateBranch API to RenameBranch API (go-gitea#35374)
2 parents 9bba399 + 8a53413 commit fb54d91

Some content is hidden

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

51 files changed

+949
-475
lines changed

assets/go-licenses.json

Lines changed: 44 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cmd/dump.go

Lines changed: 14 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import (
2020
"code.gitea.io/gitea/modules/util"
2121

2222
"gitea.com/go-chi/session"
23-
"github.com/mholt/archiver/v3"
2423
"github.com/urfave/cli/v3"
2524
)
2625

@@ -146,22 +145,18 @@ func runDump(ctx context.Context, cmd *cli.Command) error {
146145
return err
147146
}
148147

149-
archiverGeneric, err := archiver.ByExtension("." + outType)
148+
dumper, err := dump.NewDumper(ctx, outType, outFile)
150149
if err != nil {
151-
fatal("Unable to get archiver for extension: %v", err)
152-
}
153-
154-
archiverWriter := archiverGeneric.(archiver.Writer)
155-
if err := archiverWriter.Create(outFile); err != nil {
156-
fatal("Creating archiver.Writer failed: %v", err)
157-
}
158-
defer archiverWriter.Close()
159-
160-
dumper := &dump.Dumper{
161-
Writer: archiverWriter,
162-
Verbose: verbose,
150+
fatal("Failed to create archive %q: %v", outFile, err)
151+
return err
163152
}
153+
dumper.Verbose = verbose
164154
dumper.GlobalExcludeAbsPath(outFileName)
155+
defer func() {
156+
if err := dumper.Close(); err != nil {
157+
fatal("Failed to save archive %q: %v", outFileName, err)
158+
}
159+
}()
165160

166161
if cmd.IsSet("skip-repository") && cmd.Bool("skip-repository") {
167162
log.Info("Skip dumping local repositories")
@@ -180,7 +175,7 @@ func runDump(ctx context.Context, cmd *cli.Command) error {
180175
if err != nil {
181176
return err
182177
}
183-
return dumper.AddReader(object, info, path.Join("data", "lfs", objPath))
178+
return dumper.AddFileByReader(object, info, path.Join("data", "lfs", objPath))
184179
}); err != nil {
185180
fatal("Failed to dump LFS objects: %v", err)
186181
}
@@ -218,13 +213,13 @@ func runDump(ctx context.Context, cmd *cli.Command) error {
218213
fatal("Failed to dump database: %v", err)
219214
}
220215

221-
if err = dumper.AddFile("gitea-db.sql", dbDump.Name()); err != nil {
216+
if err = dumper.AddFileByPath("gitea-db.sql", dbDump.Name()); err != nil {
222217
fatal("Failed to include gitea-db.sql: %v", err)
223218
}
224219
}
225220

226221
log.Info("Adding custom configuration file from %s", setting.CustomConf)
227-
if err = dumper.AddFile("app.ini", setting.CustomConf); err != nil {
222+
if err = dumper.AddFileByPath("app.ini", setting.CustomConf); err != nil {
228223
fatal("Failed to include specified app.ini: %v", err)
229224
}
230225

@@ -283,7 +278,7 @@ func runDump(ctx context.Context, cmd *cli.Command) error {
283278
if err != nil {
284279
return err
285280
}
286-
return dumper.AddReader(object, info, path.Join("data", "attachments", objPath))
281+
return dumper.AddFileByReader(object, info, path.Join("data", "attachments", objPath))
287282
}); err != nil {
288283
fatal("Failed to dump attachments: %v", err)
289284
}
@@ -297,7 +292,7 @@ func runDump(ctx context.Context, cmd *cli.Command) error {
297292
if err != nil {
298293
return err
299294
}
300-
return dumper.AddReader(object, info, path.Join("data", "packages", objPath))
295+
return dumper.AddFileByReader(object, info, path.Join("data", "packages", objPath))
301296
}); err != nil {
302297
fatal("Failed to dump packages: %v", err)
303298
}
@@ -322,10 +317,6 @@ func runDump(ctx context.Context, cmd *cli.Command) error {
322317
if outFileName == "-" {
323318
log.Info("Finish dumping to stdout")
324319
} else {
325-
if err = archiverWriter.Close(); err != nil {
326-
_ = os.Remove(outFileName)
327-
fatal("Failed to save %q: %v", outFileName, err)
328-
}
329320
if err = os.Chmod(outFileName, 0o600); err != nil {
330321
log.Info("Can't change file access permissions mask to 0600: %v", err)
331322
}

go.mod

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ require (
4040
github.com/dimiro1/reply v0.0.0-20200315094148-d0136a4c9e21
4141
github.com/djherbis/buffer v1.2.0
4242
github.com/djherbis/nio/v3 v3.0.1
43-
github.com/dsnet/compress v0.0.2-0.20210315054119-f66993602bf5
43+
github.com/dsnet/compress v0.0.2-0.20230904184137-39efe44ab707
4444
github.com/dustin/go-humanize v1.0.1
4545
github.com/editorconfig/editorconfig-core-go/v2 v2.6.3
4646
github.com/emersion/go-imap v1.2.1
@@ -85,7 +85,7 @@ require (
8585
github.com/mattn/go-isatty v0.0.20
8686
github.com/mattn/go-sqlite3 v1.14.28
8787
github.com/meilisearch/meilisearch-go v0.31.0
88-
github.com/mholt/archiver/v3 v3.5.1
88+
github.com/mholt/archives v0.1.3
8989
github.com/microcosm-cc/bluemonday v1.0.27
9090
github.com/microsoft/go-mssqldb v1.8.0
9191
github.com/minio/minio-go/v7 v7.0.91
@@ -143,7 +143,8 @@ require (
143143
github.com/DataDog/zstd v1.5.7 // indirect
144144
github.com/Microsoft/go-winio v0.6.2 // indirect
145145
github.com/RoaringBitmap/roaring/v2 v2.4.5 // indirect
146-
github.com/andybalholm/brotli v1.1.1 // indirect
146+
github.com/STARRY-S/zip v0.2.1 // indirect
147+
github.com/andybalholm/brotli v1.1.2-0.20250424173009-453214e765f3 // indirect
147148
github.com/andybalholm/cascadia v1.3.3 // indirect
148149
github.com/anmitsu/go-shlex v0.0.0-20200514113438-38f4b401e2be // indirect
149150
github.com/aws/aws-sdk-go-v2 v1.36.3 // indirect
@@ -171,6 +172,9 @@ require (
171172
github.com/blevesearch/zapx/v15 v15.4.1 // indirect
172173
github.com/blevesearch/zapx/v16 v16.2.3 // indirect
173174
github.com/bmatcuk/doublestar/v4 v4.8.1 // indirect
175+
github.com/bodgit/plumbing v1.3.0 // indirect
176+
github.com/bodgit/sevenzip v1.6.0 // indirect
177+
github.com/bodgit/windows v1.0.1 // indirect
174178
github.com/boombuler/barcode v1.0.2 // indirect
175179
github.com/bradfitz/gomemcache v0.0.0-20250403215159-8d39553ac7cf // indirect
176180
github.com/caddyserver/zerossl v0.1.3 // indirect
@@ -227,15 +231,17 @@ require (
227231
github.com/mattn/go-shellwords v1.0.12 // indirect
228232
github.com/mholt/acmez/v3 v3.1.2 // indirect
229233
github.com/miekg/dns v1.1.65 // indirect
234+
github.com/mikelolasagasti/xz v1.0.1 // indirect
230235
github.com/minio/crc64nvme v1.0.1 // indirect
231236
github.com/minio/md5-simd v1.1.2 // indirect
237+
github.com/minio/minlz v1.0.0 // indirect
232238
github.com/mitchellh/mapstructure v1.5.0 // indirect
233239
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
234240
github.com/modern-go/reflect2 v1.0.2 // indirect
235241
github.com/mrjones/oauth v0.0.0-20190623134757-126b35219450 // indirect
236242
github.com/mschoch/smat v0.2.0 // indirect
237243
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
238-
github.com/nwaples/rardecode v1.1.3 // indirect
244+
github.com/nwaples/rardecode/v2 v2.1.0 // indirect
239245
github.com/olekukonko/tablewriter v0.0.5 // indirect
240246
github.com/onsi/ginkgo v1.16.5 // indirect
241247
github.com/pierrec/lz4/v4 v4.1.22 // indirect
@@ -250,6 +256,7 @@ require (
250256
github.com/russross/blackfriday/v2 v2.1.0 // indirect
251257
github.com/sirupsen/logrus v1.9.3 // indirect
252258
github.com/skeema/knownhosts v1.3.1 // indirect
259+
github.com/sorairolake/lzip-go v0.3.5 // indirect
253260
github.com/ssor/bom v0.0.0-20170718123548-6386211fdfcf // indirect
254261
github.com/unknwon/com v1.0.1 // indirect
255262
github.com/valyala/fastjson v1.6.4 // indirect
@@ -265,6 +272,7 @@ require (
265272
go.uber.org/multierr v1.11.0 // indirect
266273
go.uber.org/zap v1.27.0 // indirect
267274
go.uber.org/zap/exp v0.3.0 // indirect
275+
go4.org v0.0.0-20230225012048-214862532bf5 // indirect
268276
golang.org/x/exp v0.0.0-20250305212735-054e65f0b394 // indirect
269277
golang.org/x/mod v0.25.0 // indirect
270278
golang.org/x/time v0.11.0 // indirect
@@ -281,9 +289,6 @@ replace github.com/nektos/act => gitea.com/gitea/act v0.261.6
281289
// TODO: the only difference is in `PutObject`: the fork doesn't use `NewVerifyingReader(r, sha256.New(), oid, expectedSize)`, need to figure out why
282290
replace github.com/charmbracelet/git-lfs-transfer => gitea.com/gitea/git-lfs-transfer v0.2.0
283291

284-
// TODO: This could be removed after https://github.com/mholt/archiver/pull/396 merged
285-
replace github.com/mholt/archiver/v3 => github.com/anchore/archiver/v3 v3.5.2
286-
287292
replace git.sr.ht/~mariusor/go-xsd-duration => gitea.com/gitea/go-xsd-duration v0.0.0-20220703122237-02e73435a078
288293

289294
exclude github.com/gofrs/uuid v3.2.0+incompatible

0 commit comments

Comments
 (0)