Fix "Continue in browser" for pr create coming from forks
Ensures that the `owner:` prefix is present when referencing the head branch
This commit is contained in:
parent
df2ca9c9f9
commit
be759785f0
2 changed files with 10 additions and 10 deletions
|
|
@ -684,7 +684,7 @@ func generateCompareURL(ctx CreateContext, state shared.IssueMetadataState) (str
|
|||
u := ghrepo.GenerateRepoURL(
|
||||
ctx.BaseRepo,
|
||||
"compare/%s...%s?expand=1",
|
||||
url.QueryEscape(ctx.BaseBranch), url.QueryEscape(ctx.HeadBranch))
|
||||
url.QueryEscape(ctx.BaseBranch), url.QueryEscape(ctx.HeadBranchLabel))
|
||||
url, err := shared.WithPrAndIssueQueryParams(u, state)
|
||||
if err != nil {
|
||||
return "", err
|
||||
|
|
|
|||
|
|
@ -827,9 +827,9 @@ func Test_generateCompareURL(t *testing.T) {
|
|||
{
|
||||
name: "basic",
|
||||
ctx: CreateContext{
|
||||
BaseRepo: ghrepo.New("OWNER", "REPO"),
|
||||
BaseBranch: "main",
|
||||
HeadBranch: "feature",
|
||||
BaseRepo: ghrepo.New("OWNER", "REPO"),
|
||||
BaseBranch: "main",
|
||||
HeadBranchLabel: "feature",
|
||||
},
|
||||
want: "https://github.com/OWNER/REPO/compare/main...feature?expand=1",
|
||||
wantErr: false,
|
||||
|
|
@ -837,9 +837,9 @@ func Test_generateCompareURL(t *testing.T) {
|
|||
{
|
||||
name: "with labels",
|
||||
ctx: CreateContext{
|
||||
BaseRepo: ghrepo.New("OWNER", "REPO"),
|
||||
BaseBranch: "a",
|
||||
HeadBranch: "b",
|
||||
BaseRepo: ghrepo.New("OWNER", "REPO"),
|
||||
BaseBranch: "a",
|
||||
HeadBranchLabel: "b",
|
||||
},
|
||||
state: prShared.IssueMetadataState{
|
||||
Labels: []string{"one", "two three"},
|
||||
|
|
@ -850,9 +850,9 @@ func Test_generateCompareURL(t *testing.T) {
|
|||
{
|
||||
name: "complex branch names",
|
||||
ctx: CreateContext{
|
||||
BaseRepo: ghrepo.New("OWNER", "REPO"),
|
||||
BaseBranch: "main/trunk",
|
||||
HeadBranch: "owner:feature",
|
||||
BaseRepo: ghrepo.New("OWNER", "REPO"),
|
||||
BaseBranch: "main/trunk",
|
||||
HeadBranchLabel: "owner:feature",
|
||||
},
|
||||
want: "https://github.com/OWNER/REPO/compare/main%2Ftrunk...owner%3Afeature?expand=1",
|
||||
wantErr: false,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue