Skip to content

Commit af55ace

Browse files
committed
Remove named return values from prSelectorForCurrentBranch
1 parent 95580a4 commit af55ace

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

pkg/cmd/pr/status/status.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -184,17 +184,17 @@ func statusRun(opts *StatusOptions) error {
184184
return nil
185185
}
186186

187-
func prSelectorForCurrentBranch(gitClient *git.Client, baseRepo ghrepo.Interface, prHeadRef string, rem ghContext.Remotes) (prNumber int, selector string, err error) {
188-
selector = prHeadRef
187+
func prSelectorForCurrentBranch(gitClient *git.Client, baseRepo ghrepo.Interface, prHeadRef string, rem ghContext.Remotes) (int, string, error) {
189188
branchConfig, _ := gitClient.ReadBranchConfig(context.Background(), prHeadRef)
190189

191190
// the branch is configured to merge a special PR head ref
192191
prHeadRE := regexp.MustCompile(`^refs/pull/(\d+)/head$`)
193192
if m := prHeadRE.FindStringSubmatch(branchConfig.MergeRef); m != nil {
194-
prNumber, _ = strconv.Atoi(m[1])
195-
return
193+
prNumber, err := strconv.Atoi(m[1])
194+
return prNumber, prHeadRef, err
196195
}
197196

197+
var err error
198198
var branchOwner string
199199
if branchConfig.RemoteURL != nil {
200200
// the branch merges from a remote specified by URL
@@ -208,6 +208,7 @@ func prSelectorForCurrentBranch(gitClient *git.Client, baseRepo ghrepo.Interface
208208
}
209209
}
210210

211+
selector := prHeadRef
211212
if branchOwner != "" {
212213
if strings.HasPrefix(branchConfig.MergeRef, "refs/heads/") {
213214
selector = strings.TrimPrefix(branchConfig.MergeRef, "refs/heads/")
@@ -218,7 +219,7 @@ func prSelectorForCurrentBranch(gitClient *git.Client, baseRepo ghrepo.Interface
218219
}
219220
}
220221

221-
return
222+
return 0, selector, err
222223
}
223224

224225
func totalApprovals(pr *api.PullRequest) int {

0 commit comments

Comments
 (0)