From 16cef3b4c6b5db5270a57b2e0588e2a5120a4514 Mon Sep 17 00:00:00 2001 From: Alexander Neumann Date: Tue, 15 Nov 2016 21:04:08 +0100 Subject: [PATCH] Use the hostname filter to find a parent snasphot Closes #674 --- src/cmds/restic/cmd_backup.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/cmds/restic/cmd_backup.go b/src/cmds/restic/cmd_backup.go index 9622b15da..3f532464d 100644 --- a/src/cmds/restic/cmd_backup.go +++ b/src/cmds/restic/cmd_backup.go @@ -354,7 +354,13 @@ func runBackup(opts BackupOptions, gopts GlobalOptions, args []string) error { // Find last snapshot to set it as parent, if not already set if !opts.Force && parentSnapshotID == nil { - id, err := restic.FindLatestSnapshot(repo, target, "") + hostname, err := os.Hostname() + if err != nil { + debug.Log("os.Hostname() returned err: %v", err) + hostname = "" + } + + id, err := restic.FindLatestSnapshot(repo, target, hostname) if err == nil { parentSnapshotID = &id } else if err != restic.ErrNoSnapshotFound {