Skip to content

Commit 35fc3ac

Browse files
committed
Fixes GitHub createPR URL so the title does not disappear on redirects
(vscode-gitlens-private#43, #4177)
1 parent 7c2277d commit 35fc3ac

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/git/remotes/github.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ export class GitHubRemote extends RemoteProvider<GitHubRepositoryDescriptor> {
285285
head: { branch: string; remote: { path: string; url: string } },
286286
options?: { title?: string; description?: string },
287287
): string | undefined {
288-
const query = new URLSearchParams();
288+
const query = new URLSearchParams({ expand: '1' });
289289
if (options?.title) {
290290
query.set('title', options.title);
291291
}
@@ -294,14 +294,14 @@ export class GitHubRemote extends RemoteProvider<GitHubRepositoryDescriptor> {
294294
}
295295

296296
if (base.remote.url === head.remote.url) {
297-
return `${this.encodeUrl(
298-
`${this.baseUrl}/pull/new/${base.branch ?? 'HEAD'}...${head.branch}`,
299-
)}?${query.toString()}`;
297+
return base.branch
298+
? `${this.encodeUrl(`${this.baseUrl}/compare/${base.branch}...${head.branch}`)}?${query.toString()}`
299+
: `${this.encodeUrl(`${this.baseUrl}/compare/${head.branch}`)}?${query.toString()}`;
300300
}
301301

302302
const [owner] = head.remote.path.split('/', 1);
303303
return `${this.encodeUrl(
304-
`${this.baseUrl}/pull/new/${base.branch ?? 'HEAD'}...${owner}:${head.branch}`,
304+
`${this.baseUrl}/compare/${base.branch ?? 'HEAD'}...${owner}:${head.branch}`,
305305
)}?${query.toString()}`;
306306
}
307307

0 commit comments

Comments
 (0)