Defer the wait.Done() for greater resilience

This commit is contained in:
Steve Streeting 2015-07-27 11:15:04 +01:00
parent 096b6da385
commit da9a48a012

@ -52,6 +52,7 @@ func init() {
// calls wait.Done() when the final item after the channel is closed is done
func checkoutWithChan(in <-chan *lfs.WrappedPointer, wait *sync.WaitGroup) {
go func() {
defer wait.Done()
// Fire up the update-index command
cmd := exec.Command("git", "update-index", "-q", "--refresh", "--stdin")
updateIdxStdin, err := cmd.StdinPipe()
@ -98,7 +99,6 @@ func checkoutWithChan(in <-chan *lfs.WrappedPointer, wait *sync.WaitGroup) {
if err := cmd.Wait(); err != nil {
Panic(err, "Error updating the git index")
}
wait.Done()
}()
}