Internal support for ignoring permissions

This commit is contained in:
Jakob Borg
2014-05-23 13:10:26 +02:00
parent bcdc3ecdae
commit 303ce02271
2 changed files with 25 additions and 6 deletions

View File

@@ -538,7 +538,7 @@ func (p *puller) handleEmptyBlock(b bqBlock) {
delete(p.openFiles, f.Name)
return
}
if os.Chmod(of.temp, os.FileMode(f.Flags&0777)) != nil {
if protocol.HasPermissionBits(f.Flags) && os.Chmod(of.temp, os.FileMode(f.Flags&0777)) != nil {
delete(p.openFiles, f.Name)
return
}
@@ -607,7 +607,9 @@ func (p *puller) closeFile(f scanner.File) {
t := time.Unix(f.Modified, 0)
os.Chtimes(of.temp, t, t)
os.Chmod(of.temp, os.FileMode(f.Flags&0777))
if protocol.HasPermissionBits(f.Flags) {
os.Chmod(of.temp, os.FileMode(f.Flags&0777))
}
defTempNamer.Show(of.temp)
if debug {
l.Debugf("pull: rename %q / %q: %q", p.repo, f.Name, of.filepath)