From da9a48a0120bbaa82b4fd91d0e778dcb7a8cbe20 Mon Sep 17 00:00:00 2001 From: Steve Streeting Date: Mon, 27 Jul 2015 11:15:04 +0100 Subject: [PATCH] Defer the wait.Done() for greater resilience --- commands/command_checkout.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/commands/command_checkout.go b/commands/command_checkout.go index 5d192dcd..183c1f88 100644 --- a/commands/command_checkout.go +++ b/commands/command_checkout.go @@ -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() }() }