1
0
Fork 0
mirror of https://github.com/restic/restic.git synced 2025-03-09 00:00:02 +01:00

restore: add --reflinks flag to clone identical files

Passing `restic restore --reflinks` will cause restic to keep track of
duplicate files and locally clone subsequent duplicates from the first
extracted one.
This commit is contained in:
Ivan Shapovalov 2024-11-30 14:38:51 +04:00
parent a323580cb6
commit c4a432a4d1
2 changed files with 4 additions and 0 deletions

View file

@ -59,6 +59,7 @@ type RestoreOptions struct {
Verify bool
Overwrite restorer.OverwriteBehavior
Delete bool
Reflinks bool
ExcludeXattrPattern []string
IncludeXattrPattern []string
}
@ -83,6 +84,7 @@ func init() {
flags.BoolVar(&restoreOptions.Verify, "verify", false, "verify restored files content")
flags.Var(&restoreOptions.Overwrite, "overwrite", "overwrite behavior, one of (always|if-changed|if-newer|never) (default: always)")
flags.BoolVar(&restoreOptions.Delete, "delete", false, "delete files from target directory if they do not exist in snapshot. Use '--dry-run -vv' to check what would be deleted")
flags.BoolVar(&restoreOptions.Reflinks, "reflinks", false, "use reflinks to restore identical files")
}
func runRestore(ctx context.Context, opts RestoreOptions, gopts GlobalOptions,
@ -169,6 +171,7 @@ func runRestore(ctx context.Context, opts RestoreOptions, gopts GlobalOptions,
Progress: progress,
Overwrite: opts.Overwrite,
Delete: opts.Delete,
Reflinks: opts.Reflinks,
})
totalErrors := 0

View file

@ -44,6 +44,7 @@ type Options struct {
Progress *restoreui.Progress
Overwrite OverwriteBehavior
Delete bool
Reflinks bool
}
type OverwriteBehavior int