Correct #2537 (cmd_stats file counting issue)

This commit is contained in:
David Potter 2020-01-07 10:33:58 -08:00 committed by Leo R. Lundgren
parent 8bf6a3af97
commit 23055aaadf
2 changed files with 11 additions and 1 deletions

View File

@ -0,0 +1,5 @@
Bugfix: Fix incorrect file counts in `stats --mode restore-size`
The restore-size mode of stats was failing to count empty directories and some files with hard links.
https://github.com/restic/restic/issues/2537

View File

@ -247,8 +247,13 @@ func statsWalkTree(repo restic.Repository, stats *statsContainer) walker.WalkFun
// as this is a file in the snapshot, we can simply count its
// size without worrying about uniqueness, since duplicate files
// will still be restored
stats.TotalSize += node.Size
stats.TotalFileCount++
// TODO - Issue #2531 Handle hard links by identifying duplicate inodes.
// (Duplicates should appear in the file count, but not the size count)
stats.TotalSize += node.Size
return false, nil
}
return true, nil