diff --git a/pkg/cmd/repo/sync/git.go b/pkg/cmd/repo/sync/git.go index 54da42719..fb2a7fd27 100644 --- a/pkg/cmd/repo/sync/git.go +++ b/pkg/cmd/repo/sync/git.go @@ -22,7 +22,7 @@ type gitClient interface { type gitExecuter struct{} func (g *gitExecuter) BranchRemote(branch string) (string, error) { - args := append([]string{"rev-parse", "--symbolic-full-name", "--abbrev-ref", fmt.Sprintf("%s@{u}", branch)}) + args := []string{"rev-parse", "--symbolic-full-name", "--abbrev-ref", fmt.Sprintf("%s@{u}", branch)} cmd, err := git.GitCommand(args...) if err != nil { return "", err diff --git a/pkg/cmd/repo/sync/sync.go b/pkg/cmd/repo/sync/sync.go index 9178e2a69..b420886fc 100644 --- a/pkg/cmd/repo/sync/sync.go +++ b/pkg/cmd/repo/sync/sync.go @@ -249,6 +249,9 @@ func executeLocalRepoSync(srcRepo ghrepo.Interface, remote string, opts *SyncOpt hasLocalBranch := git.HasLocalBranch([]string{branch}) if hasLocalBranch { branchRemote, err := git.BranchRemote(branch) + if err != nil { + return err + } if branchRemote != remote { return mismatchRemotesError }