From 60c8c90d353a20f49a9d250c5f2402d2138aee87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Llu=C3=ADs=20Batlle=20i=20Rossell?= Date: Mon, 9 May 2016 12:42:12 +0200 Subject: [PATCH 1/2] Better backup parent snapshot search. Part of #513 I look for the newest snapshot that contains all supplied paths to backup. --- src/cmds/restic/cmd_backup.go | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/cmds/restic/cmd_backup.go b/src/cmds/restic/cmd_backup.go index b32e7af59..99fdfb15d 100644 --- a/src/cmds/restic/cmd_backup.go +++ b/src/cmds/restic/cmd_backup.go @@ -180,11 +180,15 @@ func samePaths(expected, actual []string) bool { return true } - if len(expected) != len(actual) { - return false - } for i := range expected { - if expected[i] != actual[i] { + found := false + for j := range actual { + if expected[i] == actual[j] { + found = true + break + } + } + if !found { return false } } From 4818a8e3563b01cd16789463eacb8402d77a4cc2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Llu=C3=ADs=20Batlle=20i=20Rossell?= Date: Mon, 9 May 2016 16:31:59 +0200 Subject: [PATCH 2/2] Fix gofmt --- src/cmds/restic/cmd_backup.go | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/cmds/restic/cmd_backup.go b/src/cmds/restic/cmd_backup.go index 99fdfb15d..48e8f2d31 100644 --- a/src/cmds/restic/cmd_backup.go +++ b/src/cmds/restic/cmd_backup.go @@ -181,14 +181,14 @@ func samePaths(expected, actual []string) bool { } for i := range expected { - found := false - for j := range actual { - if expected[i] == actual[j] { - found = true - break - } - } - if !found { + found := false + for j := range actual { + if expected[i] == actual[j] { + found = true + break + } + } + if !found { return false } }