This commit is contained in:
Jakob Borg 2013-12-29 19:20:36 -05:00
parent 704e0fa6b8
commit 24efbe7d33

View File

@ -146,31 +146,35 @@ func (m *Model) puller() {
for _, n := range ns { for _, n := range ns {
limiter <- true limiter <- true
f, ok := m.GlobalFile(n) go func(n string) {
if !ok { defer func() {
continue <-limiter
} }()
var err error f, ok := m.GlobalFile(n)
if f.Flags&FlagDeleted == 0 { if !ok {
if opts.Debug.TraceFile { return
debugf("FILE: Pull %q", n)
} }
err = m.pullFile(n)
} else {
if opts.Debug.TraceFile {
debugf("FILE: Remove %q", n)
}
// Cheerfully ignore errors here
_ = os.Remove(path.Join(m.dir, n))
}
if err == nil {
m.UpdateLocal(f)
} else {
warnln(err)
}
<-limiter var err error
if f.Flags&FlagDeleted == 0 {
if opts.Debug.TraceFile {
debugf("FILE: Pull %q", n)
}
err = m.pullFile(n)
} else {
if opts.Debug.TraceFile {
debugf("FILE: Remove %q", n)
}
// Cheerfully ignore errors here
_ = os.Remove(path.Join(m.dir, n))
}
if err == nil {
m.UpdateLocal(f)
} else {
warnln(err)
}
}(n)
} }
} }
} }