diff: copy nodes before modifying them for bitrot detection
This commit is contained in:
parent
a7dc18e697
commit
3549635243
1 changed files with 5 additions and 3 deletions
|
@ -274,11 +274,13 @@ func (c *Comparer) diffTree(ctx context.Context, stats *DiffStatsContainer, pref
|
||||||
mod += "M"
|
mod += "M"
|
||||||
stats.ChangedFiles++
|
stats.ChangedFiles++
|
||||||
|
|
||||||
node1NilContent := node1
|
node1NilContent := *node1
|
||||||
node2NilContent := node2
|
node2NilContent := *node2
|
||||||
node1NilContent.Content = nil
|
node1NilContent.Content = nil
|
||||||
node2NilContent.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 += "?"
|
mod += "?"
|
||||||
}
|
}
|
||||||
} else if c.opts.ShowMetadata && !node1.Equals(*node2) {
|
} else if c.opts.ShowMetadata && !node1.Equals(*node2) {
|
||||||
|
|
Loading…
Reference in a new issue