File tree Expand file tree Collapse file tree
extensions/copilot/src/extension/chatSessions/vscode-node Expand file tree Collapse file tree Original file line number Diff line number Diff 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 }
You can’t perform that action at this time.
0 commit comments