@@ -82,6 +82,10 @@ var CmdDump = &cli.Command{
8282 Name : "skip-package-data" ,
8383 Usage : "Skip package data" ,
8484 },
85+ & cli.BoolFlag {
86+ Name : "skip-repo-archive" ,
87+ Usage : "Skip repo archive data" ,
88+ },
8589 & cli.BoolFlag {
8690 Name : "skip-index" ,
8791 Usage : "Skip bleve index data" ,
@@ -265,6 +269,7 @@ func runDump(ctx context.Context, cmd *cli.Command) error {
265269 excludes = append (excludes , setting .LFS .Storage .Path )
266270 excludes = append (excludes , setting .Attachment .Storage .Path )
267271 excludes = append (excludes , setting .Packages .Storage .Path )
272+ excludes = append (excludes , setting .RepoArchive .Storage .Path )
268273 excludes = append (excludes , setting .Log .RootPath )
269274 if err := dumper .AddRecursiveExclude ("data" , setting .AppDataPath , excludes ); err != nil {
270275 fatal ("Failed to include data directory: %v" , err )
@@ -297,6 +302,18 @@ func runDump(ctx context.Context, cmd *cli.Command) error {
297302 fatal ("Failed to dump packages: %v" , err )
298303 }
299304
305+ if cmd .IsSet ("skip-repo-archive" ) && cmd .Bool ("skip-repo-archive" ) {
306+ log .Info ("Skip dumping repository archives" )
307+ } else if err := storage .RepoArchives .IterateObjects ("" , func (objPath string , object storage.Object ) error {
308+ info , err := object .Stat ()
309+ if err != nil {
310+ return err
311+ }
312+ return dumper .AddFileByReader (object , info , path .Join ("data" , "repo-archive" , objPath ))
313+ }); err != nil {
314+ fatal ("Failed to dump repository archives: %v" , err )
315+ }
316+
300317 // Doesn't check if LogRootPath exists before processing --skip-log intentionally,
301318 // ensuring that it's clear the dump is skipped whether the directory's initialized
302319 // yet or not.
0 commit comments