Skip to content

Commit e84299e

Browse files
committed
Pull request feedback
1 parent 7aafa5c commit e84299e

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

extensions/copilot/src/extension/chatSessions/vscode-node/chatSessionWorktreeServiceImpl.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ export class ChatSessionWorktreeService extends Disposable implements IChatSessi
7272

7373
const autoCommit = this.configurationService.getConfig<boolean>(ConfigKey.Advanced.CLIAutoCommitEnabled);
7474

75+
let baseCommit: string | undefined = undefined;
7576
const branch = await this.generateBranchName(branchName, activeRepository);
7677

7778
// When a base branch is provided, we attempt to resolve it, to see whether it has an
@@ -89,6 +90,7 @@ export class ChatSessionWorktreeService extends Disposable implements IChatSessi
8990
const upstreamBranch = await this.gitService.getBranch(activeRepository.rootUri, upstreamBranchName);
9091
if (upstreamBranch) {
9192
baseBranch = upstreamBranchName;
93+
baseCommit = upstreamBranch.commit;
9294
}
9395
} catch (error) {
9496
const errorMessage = error instanceof Error ? error.message : String(error);
@@ -107,8 +109,7 @@ export class ChatSessionWorktreeService extends Disposable implements IChatSessi
107109
const baseBranchName = baseBranch ?? activeRepository.headBranchName;
108110
const baseBranchProtected = await this.gitService.isBranchProtected(activeRepository.rootUri, baseBranchName);
109111

110-
let baseCommit: string | undefined = undefined;
111-
if (baseBranch) {
112+
if (baseBranch && !baseCommit) {
112113
const refs = await this.gitService.getRefs(activeRepository.rootUri, { pattern: `refs/heads/${baseBranch}` });
113114
baseCommit = refs.length === 1 && refs[0].commit ? refs[0].commit : undefined;
114115
}

0 commit comments

Comments
 (0)