Skip to content

Commit

Permalink
Skip creating snaphots if there was no change. WARNING: ONLY FOR TEST…
Browse files Browse the repository at this point in the history
…ING, POSSIBLE LOSS OF DATA, YOU HAVE BEEN WARNED!
  • Loading branch information
ignus2 committed Oct 12, 2017
1 parent 9ce2a73 commit 7ebee9d
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions internal/archiver/archiver.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 7ebee9d

Please sign in to comment.