From d289ddd6178aa177f9c564dfc9b299c642b50cff Mon Sep 17 00:00:00 2001 From: Tyler McGoffin Date: Wed, 15 Jan 2025 16:21:06 -0800 Subject: [PATCH] Use PushRemoteURL instead of RemoteURL in prSelectorForCurrentBranch --- git/client.go | 1 + pkg/cmd/pr/status/status.go | 5 ++--- pkg/cmd/pr/status/status_test.go | 10 +++++----- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/git/client.go b/git/client.go index 956d13671..5e47098c2 100644 --- a/git/client.go +++ b/git/client.go @@ -456,6 +456,7 @@ func parseBranchConfig(branchConfigLines []string, remotePushDefault string, rev // push remote ref is the same as the remote ref. This is likely // a "centralized" workflow. cfg.PushRemoteName = cfg.RemoteName + cfg.PushRemoteURL = cfg.RemoteURL } } diff --git a/pkg/cmd/pr/status/status.go b/pkg/cmd/pr/status/status.go index fe674ad6e..89926bfa2 100644 --- a/pkg/cmd/pr/status/status.go +++ b/pkg/cmd/pr/status/status.go @@ -199,11 +199,10 @@ func prSelectorForCurrentBranch(branchConfig git.BranchConfig, baseRepo ghrepo.I } return prNumber, prHeadRef, nil } - var branchOwner string - if branchConfig.RemoteURL != nil { + if branchConfig.PushRemoteURL != nil { // the branch merges from a remote specified by URL - r, err := ghrepo.FromURL(branchConfig.RemoteURL) + r, err := ghrepo.FromURL(branchConfig.PushRemoteURL) if err != nil { // TODO: We aren't returning the error because we discovered that it was shadowed // before refactoring to its current return pattern. Thus, we aren't confident diff --git a/pkg/cmd/pr/status/status_test.go b/pkg/cmd/pr/status/status_test.go index 586e22183..4e9ca19b0 100644 --- a/pkg/cmd/pr/status/status_test.go +++ b/pkg/cmd/pr/status/status_test.go @@ -494,7 +494,7 @@ func Test_prSelectorForCurrentBranch(t *testing.T) { { name: "Branch merges from a remote specified by URL", branchConfig: git.BranchConfig{ - RemoteURL: &url.URL{ + PushRemoteURL: &url.URL{ Scheme: "ssh", User: url.User("git"), Host: "github.com", @@ -537,7 +537,7 @@ func Test_prSelectorForCurrentBranch(t *testing.T) { { name: "Branch is a fork and merges from a remote specified by URL", branchConfig: git.BranchConfig{ - RemoteURL: &url.URL{ + PushRemoteURL: &url.URL{ Scheme: "ssh", User: url.User("git"), Host: "github.com", @@ -625,7 +625,7 @@ func Test_prSelectorForCurrentBranch(t *testing.T) { { name: "Remote URL errors", branchConfig: git.BranchConfig{ - RemoteURL: &url.URL{ + PushRemoteURL: &url.URL{ Scheme: "ssh", User: url.User("git"), Host: "github.com", @@ -660,7 +660,7 @@ func Test_prSelectorForCurrentBranch(t *testing.T) { { name: "Current branch pushes to default upstream", branchConfig: git.BranchConfig{ - RemoteURL: &url.URL{ + PushRemoteURL: &url.URL{ Scheme: "ssh", User: url.User("git"), Host: "github.com", @@ -684,7 +684,7 @@ func Test_prSelectorForCurrentBranch(t *testing.T) { { name: "Current branch pushes to default tracking", branchConfig: git.BranchConfig{ - RemoteURL: &url.URL{ + PushRemoteURL: &url.URL{ Scheme: "ssh", User: url.User("git"), Host: "github.com",