From afad377c17a20b88e7ffec2dcd7092ec5d1725e5 Mon Sep 17 00:00:00 2001 From: risk danger olson Date: Tue, 15 Nov 2016 09:20:47 -0700 Subject: [PATCH] wait for remote ref commands to exit before returning --- git/git.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/git/git.go b/git/git.go index a01f66f1..99d536c8 100644 --- a/git/git.go +++ b/git/git.go @@ -912,7 +912,6 @@ func CloneWithoutFilters(flags CloneFlags, args []string) error { // CachedRemoteRefs returns the list of branches & tags for a remote which are // currently cached locally. No remote request is made to verify them. func CachedRemoteRefs(remoteName string) ([]*Ref, error) { - var ret []*Ref cmd := subprocess.ExecCommand("git", "show-ref") @@ -936,13 +935,12 @@ func CachedRemoteRefs(remoteName string) ([]*Ref, error) { ret = append(ret, &Ref{name, RefTypeRemoteBranch, sha}) } } - return ret, nil + return ret, cmd.Wait() } // RemoteRefs returns a list of branches & tags for a remote by actually // accessing the remote vir git ls-remote func RemoteRefs(remoteName string) ([]*Ref, error) { - var ret []*Ref cmd := subprocess.ExecCommand("git", "ls-remote", "--heads", "--tags", "-q", remoteName) @@ -970,7 +968,7 @@ func RemoteRefs(remoteName string) ([]*Ref, error) { } } } - return ret, nil + return ret, cmd.Wait() } // GetTrackedFiles returns a list of files which are tracked in Git which match