mirror of
https://github.com/octoleo/restic.git
synced 2024-12-22 10:58:55 +00:00
restore: correctly count hardlinks in progress bar
For hardlinked files, only the first instance of that file increases the amount of bytes to restore. All later instances only increase the file count but not the restore size.
This commit is contained in:
parent
ee3c55ea3d
commit
e77002f841
@ -257,21 +257,28 @@ func (res *Restorer) RestoreTo(ctx context.Context, dst string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
if res.progress != nil {
|
||||
res.progress.AddFile(node.Size)
|
||||
}
|
||||
|
||||
if node.Size == 0 {
|
||||
if res.progress != nil {
|
||||
res.progress.AddFile(node.Size)
|
||||
}
|
||||
return nil // deal with empty files later
|
||||
}
|
||||
|
||||
if node.Links > 1 {
|
||||
if idx.Has(node.Inode, node.DeviceID) {
|
||||
if res.progress != nil {
|
||||
// a hardlinked file does not increase the restore size
|
||||
res.progress.AddFile(0)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
idx.Add(node.Inode, node.DeviceID, location)
|
||||
}
|
||||
|
||||
if res.progress != nil {
|
||||
res.progress.AddFile(node.Size)
|
||||
}
|
||||
|
||||
filerestorer.addFile(location, node.Content, int64(node.Size))
|
||||
|
||||
return nil
|
||||
|
Loading…
Reference in New Issue
Block a user