allow skip setting uid/gid on restored files

This commit is contained in:
Mark Lowne
2017-10-30 20:16:28 +01:00
parent 7e1fb6130a
commit 57edf5823d
3 changed files with 19 additions and 8 deletions

View File

@@ -286,7 +286,7 @@ func (entry *Entry) String(maxSizeDigits int) string {
return fmt.Sprintf("%*d %s %64s %s", maxSizeDigits, entry.Size, modifiedTime, entry.Hash, entry.Path)
}
func (entry *Entry) RestoreMetadata(fullPath string, fileInfo *os.FileInfo) bool {
func (entry *Entry) RestoreMetadata(fullPath string, fileInfo *os.FileInfo, setOwner bool) bool {
if fileInfo == nil {
stat, err := os.Stat(fullPath)
@@ -318,7 +318,11 @@ func (entry *Entry) RestoreMetadata(fullPath string, fileInfo *os.FileInfo) bool
entry.SetAttributesToFile(fullPath)
}
return SetOwner(fullPath, entry, fileInfo)
if setOwner {
return SetOwner(fullPath, entry, fileInfo)
} else {
return true
}
}
// Return -1 if 'left' should appear before 'right', 1 if opposite, and 0 if they are the same.