Use PushRemoteURL instead of RemoteURL in prSelectorForCurrentBranch

This commit is contained in:
Tyler McGoffin 2025-01-15 16:21:06 -08:00
parent 4a9fd9508f
commit d289ddd617
3 changed files with 8 additions and 8 deletions

View file

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

View file

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

View file

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