Skip to content

Commit d289ddd

Browse files
committed
Use PushRemoteURL instead of RemoteURL in prSelectorForCurrentBranch
1 parent 4a9fd95 commit d289ddd

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

git/client.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -456,6 +456,7 @@ func parseBranchConfig(branchConfigLines []string, remotePushDefault string, rev
456456
// push remote ref is the same as the remote ref. This is likely
457457
// a "centralized" workflow.
458458
cfg.PushRemoteName = cfg.RemoteName
459+
cfg.PushRemoteURL = cfg.RemoteURL
459460
}
460461
}
461462

pkg/cmd/pr/status/status.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -199,11 +199,10 @@ func prSelectorForCurrentBranch(branchConfig git.BranchConfig, baseRepo ghrepo.I
199199
}
200200
return prNumber, prHeadRef, nil
201201
}
202-
203202
var branchOwner string
204-
if branchConfig.RemoteURL != nil {
203+
if branchConfig.PushRemoteURL != nil {
205204
// the branch merges from a remote specified by URL
206-
r, err := ghrepo.FromURL(branchConfig.RemoteURL)
205+
r, err := ghrepo.FromURL(branchConfig.PushRemoteURL)
207206
if err != nil {
208207
// TODO: We aren't returning the error because we discovered that it was shadowed
209208
// before refactoring to its current return pattern. Thus, we aren't confident

pkg/cmd/pr/status/status_test.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -494,7 +494,7 @@ func Test_prSelectorForCurrentBranch(t *testing.T) {
494494
{
495495
name: "Branch merges from a remote specified by URL",
496496
branchConfig: git.BranchConfig{
497-
RemoteURL: &url.URL{
497+
PushRemoteURL: &url.URL{
498498
Scheme: "ssh",
499499
User: url.User("git"),
500500
Host: "github.com",
@@ -537,7 +537,7 @@ func Test_prSelectorForCurrentBranch(t *testing.T) {
537537
{
538538
name: "Branch is a fork and merges from a remote specified by URL",
539539
branchConfig: git.BranchConfig{
540-
RemoteURL: &url.URL{
540+
PushRemoteURL: &url.URL{
541541
Scheme: "ssh",
542542
User: url.User("git"),
543543
Host: "github.com",
@@ -625,7 +625,7 @@ func Test_prSelectorForCurrentBranch(t *testing.T) {
625625
{
626626
name: "Remote URL errors",
627627
branchConfig: git.BranchConfig{
628-
RemoteURL: &url.URL{
628+
PushRemoteURL: &url.URL{
629629
Scheme: "ssh",
630630
User: url.User("git"),
631631
Host: "github.com",
@@ -660,7 +660,7 @@ func Test_prSelectorForCurrentBranch(t *testing.T) {
660660
{
661661
name: "Current branch pushes to default upstream",
662662
branchConfig: git.BranchConfig{
663-
RemoteURL: &url.URL{
663+
PushRemoteURL: &url.URL{
664664
Scheme: "ssh",
665665
User: url.User("git"),
666666
Host: "github.com",
@@ -684,7 +684,7 @@ func Test_prSelectorForCurrentBranch(t *testing.T) {
684684
{
685685
name: "Current branch pushes to default tracking",
686686
branchConfig: git.BranchConfig{
687-
RemoteURL: &url.URL{
687+
PushRemoteURL: &url.URL{
688688
Scheme: "ssh",
689689
User: url.User("git"),
690690
Host: "github.com",

0 commit comments

Comments
 (0)