@@ -211,6 +211,11 @@ func runDump(ctx *cli.Context) error {
211211 }
212212 defer file .Close ()
213213
214+ absFileName , err := filepath .Abs (fileName )
215+ if err != nil {
216+ return err
217+ }
218+
214219 verbose := ctx .Bool ("verbose" )
215220 outType := ctx .String ("type" )
216221 var iface interface {}
@@ -233,7 +238,7 @@ func runDump(ctx *cli.Context) error {
233238 log .Info ("Skip dumping local repositories" )
234239 } else {
235240 log .Info ("Dumping local repositories... %s" , setting .RepoRootPath )
236- if err := addRecursive (w , "repos" , setting .RepoRootPath , verbose ); err != nil {
241+ if err := addRecursiveExclude (w , "repos" , setting .RepoRootPath , [] string { absFileName } , verbose ); err != nil {
237242 fatal ("Failed to include repositories: %v" , err )
238243 }
239244
@@ -295,7 +300,7 @@ func runDump(ctx *cli.Context) error {
295300 customDir , err := os .Stat (setting .CustomPath )
296301 if err == nil && customDir .IsDir () {
297302 if is , _ := isSubdir (setting .AppDataPath , setting .CustomPath ); ! is {
298- if err := addRecursive (w , "custom" , setting .CustomPath , verbose ); err != nil {
303+ if err := addRecursiveExclude (w , "custom" , setting .CustomPath , [] string { absFileName } , verbose ); err != nil {
299304 fatal ("Failed to include custom: %v" , err )
300305 }
301306 } else {
@@ -325,6 +330,7 @@ func runDump(ctx *cli.Context) error {
325330 excludes = append (excludes , setting .LFS .Path )
326331 excludes = append (excludes , setting .Attachment .Path )
327332 excludes = append (excludes , setting .LogRootPath )
333+ excludes = append (excludes , absFileName )
328334 if err := addRecursiveExclude (w , "data" , setting .AppDataPath , excludes , verbose ); err != nil {
329335 fatal ("Failed to include data directory: %v" , err )
330336 }
@@ -358,7 +364,7 @@ func runDump(ctx *cli.Context) error {
358364 log .Error ("Unable to check if %s exists. Error: %v" , setting .LogRootPath , err )
359365 }
360366 if isExist {
361- if err := addRecursive (w , "log" , setting .LogRootPath , verbose ); err != nil {
367+ if err := addRecursiveExclude (w , "log" , setting .LogRootPath , [] string { absFileName } , verbose ); err != nil {
362368 fatal ("Failed to include log: %v" , err )
363369 }
364370 }
0 commit comments