2
2
mirror of https://github.com/octoleo/restic.git synced 2024-05-30 23:50:48 +00:00

Restore timestamps for directories earlier

This commit is contained in:
Alexander Neumann 2015-05-14 15:58:26 +02:00
parent aa5fd9e9bc
commit 1fb8e332ce

View File

@ -61,18 +61,12 @@ func (res *Restorer) restoreTo(dst string, dir string, treeID backend.ID) error
return err
}
}
}
}
// Restore directory timestamps at the end. If we would do it earlier, restoring files within
// those directories would overwrite the timestamp of the directories they are in.
for _, node := range tree.Nodes {
if node.Type != "dir" {
continue
}
if err := node.RestoreTimestamps(filepath.Join(dst, dir, node.Name)); err != nil {
return err
// Restore directory timestamp at the end. If we would do it earlier, restoring files within
// the directory would overwrite the timestamp of the directory they are in.
if err := node.RestoreTimestamps(filepath.Join(dst, dir, node.Name)); err != nil {
return err
}
}
}