2
2
mirror of https://github.com/octoleo/restic.git synced 2024-11-21 20:35:12 +00:00

diff: copy nodes before modifying them for bitrot detection

This commit is contained in:
Michael Eischer 2024-01-06 20:07:46 +01:00
parent a7dc18e697
commit 3549635243

View File

@ -274,11 +274,13 @@ func (c *Comparer) diffTree(ctx context.Context, stats *DiffStatsContainer, pref
mod += "M"
stats.ChangedFiles++
node1NilContent := node1
node2NilContent := node2
node1NilContent := *node1
node2NilContent := *node2
node1NilContent.Content = nil
node2NilContent.Content = nil
if node1NilContent.Equals(*node2NilContent) {
// the bitrot detection may not work if `backup --ignore-inode` or `--ignore-ctime` were used
if node1NilContent.Equals(node2NilContent) {
// probable bitrot detected
mod += "?"
}
} else if c.opts.ShowMetadata && !node1.Equals(*node2) {