This commit is contained in:
Sam Coe 2021-07-01 09:55:13 -07:00
parent a1e1842e6d
commit 63f7372b31
No known key found for this signature in database
GPG key ID: 8E322C20F811D086
2 changed files with 4 additions and 1 deletions

View file

@ -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

View file

@ -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
}