Skip to content
This repository has been archived by the owner on Nov 22, 2022. It is now read-only.

Commit

Permalink
Merge pull request #743 from profclems/fix-merge-detached-branch
Browse files Browse the repository at this point in the history
fix `mr merge` failing on detached branch
  • Loading branch information
profclems authored May 27, 2021
2 parents cd37ff9 + 2900bc4 commit be2dec0
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions commands/mr/mrutils/mrutils.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,10 +139,7 @@ func MRFromArgsWithOpts(
return nil, nil, err
}

branch, err := f.Branch()
if err != nil {
return nil, nil, err
}
var branch string

if len(args) > 0 {
mrID, err = strconv.Atoi(args[0])
Expand All @@ -153,6 +150,13 @@ func MRFromArgsWithOpts(
}
}

if branch == "" {
branch, err = f.Branch()
if err != nil {
return nil, nil, err
}
}

if mrID == 0 {
mr, err = getMRForBranch(apiClient, baseRepo, branch, state)
if err != nil {
Expand Down

0 comments on commit be2dec0

Please sign in to comment.