From 7ebee9de1838e3d3954ecd36d43db499dd508a17 Mon Sep 17 00:00:00 2001 From: Balazs OROSZI Date: Thu, 12 Oct 2017 20:42:34 +0200 Subject: [PATCH] Skip creating snaphots if there was no change. WARNING: ONLY FOR TESTING, POSSIBLE LOSS OF DATA, YOU HAVE BEEN WARNED! --- internal/archiver/archiver.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/internal/archiver/archiver.go b/internal/archiver/archiver.go index 055c4626d5f..9d304549cf6 100644 --- a/internal/archiver/archiver.go +++ b/internal/archiver/archiver.go @@ -766,6 +766,14 @@ func (arch *Archiver) Snapshot(ctx context.Context, p *restic.Progress, paths, t return nil, restic.ID{}, errors.Fatal("no files/dirs saved, refusing to create empty snapshot") } + psn, err := restic.LoadSnapshot(ctx, arch.repo, *sn.Parent) + if err != nil { + return nil, restic.ID{}, err + } + if root.Subtree.Equal(*psn.Tree) { + return nil, restic.ID{}, errors.Fatal("tree matches parent, not creating snapshot") + } + // save index err = arch.repo.SaveIndex(ctx) if err != nil {