Skip to content

Commit 77e5e21

Browse files
Copilotalexr00
andauthored
Fix PR description to match GitHub.com behavior for multiple commits
When creating a PR with multiple commits, GitHub.com leaves the description empty but the extension was filling it with the last commit's body. Only use the commit body in the description when there is a single commit (useBranchName is false). Agent-Logs-Url: https://github.com/microsoft/vscode-pull-request-github/sessions/a47447af-78f0-4107-a46c-7750c8449c28 Co-authored-by: alexr00 <38270282+alexr00@users.noreply.github.com>
1 parent 5613b37 commit 77e5e21

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/github/createPRViewProvider.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -809,11 +809,12 @@ export class CreatePullRequestViewProvider extends BaseCreatePullRequestViewProv
809809
}
810810

811811
// Set description
812-
if (pullRequestTemplate && lastCommit?.body) {
812+
// Match GitHub.com behavior: only use the commit body when there is a single commit.
813+
if (pullRequestTemplate && lastCommit?.body && !useBranchName) {
813814
description = `${lastCommit.body}\n\n${pullRequestTemplate}`;
814815
} else if (pullRequestTemplate) {
815816
description = pullRequestTemplate;
816-
} else if (lastCommit?.body && (this._pullRequestDefaults.base !== compareBranch.name)) {
817+
} else if (lastCommit?.body && !useBranchName && (this._pullRequestDefaults.base !== compareBranch.name)) {
817818
description = lastCommit.body;
818819
}
819820

0 commit comments

Comments
 (0)