Don't set a parent for --stdin backups

Loading any parent tree for these only wastes time and memory.
Fixes #3641, where it was shown that the most recent tree will get
picked.

--parent is now implicitly ignored when --stdin is given.
This commit is contained in:
greatroar
2022-02-19 10:41:33 +01:00
parent 58236ead12
commit 63f6a9b085
2 changed files with 25 additions and 9 deletions
+12 -9
View File
@@ -579,16 +579,19 @@ func runBackup(opts BackupOptions, gopts GlobalOptions, term *termstatus.Termina
return err
}
parentSnapshotID, err := findParentSnapshot(gopts.ctx, repo, opts, targets, timeStamp)
if err != nil {
return err
}
var parentSnapshotID *restic.ID
if !opts.Stdin {
parentSnapshotID, err = findParentSnapshot(gopts.ctx, repo, opts, targets, timeStamp)
if err != nil {
return err
}
if !gopts.JSON {
if parentSnapshotID != nil {
progressPrinter.P("using parent snapshot %v\n", parentSnapshotID.Str())
} else {
progressPrinter.P("no parent snapshot found, will read all files\n")
if !gopts.JSON {
if parentSnapshotID != nil {
progressPrinter.P("using parent snapshot %v\n", parentSnapshotID.Str())
} else {
progressPrinter.P("no parent snapshot found, will read all files\n")
}
}
}