Skip to content

Commit 4efb03a

Browse files
committed
checkpoint for microsoft/vscode#252632
1 parent 09435d2 commit 4efb03a

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

src/github/copilotRemoteAgent.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -310,8 +310,8 @@ export class CopilotRemoteAgentManager extends Disposable {
310310
// This could be improved if we add lower-level APIs to our git extension (e.g. in-memory temp git index).
311311

312312
let ref = baseRef;
313-
const hasChanges = repository.state.workingTreeChanges.length > 0 || repository.state.indexChanges.length > 0;
314-
if (hasChanges && autoPushAndCommit) {
313+
const hasChanges = autoPushAndCommit && (repository.state.workingTreeChanges.length > 0 || repository.state.indexChanges.length > 0);
314+
if (hasChanges) {
315315
if (!this.autoCommitAndPushEnabled()) {
316316
return { error: vscode.l10n.t('Uncommitted changes detected. Please commit or stash your changes before starting the remote agent. Enable \'{0}\' to push your changes automatically.', CODING_AGENT_AUTO_COMMIT_AND_PUSH), state: 'error' };
317317
}
@@ -349,6 +349,10 @@ export class CopilotRemoteAgentManager extends Disposable {
349349
}
350350
}
351351

352+
const base_ref = hasChanges ? baseRef : ref;
353+
// Confirm that the remote has base_ref, otherwise server will 500
354+
// TODOs
355+
352356
let title = prompt;
353357
const titleMatch = problemContext.match(/TITLE: \s*(.*)/i);
354358
if (titleMatch && titleMatch[1]) {
@@ -361,8 +365,8 @@ export class CopilotRemoteAgentManager extends Disposable {
361365
pull_request: {
362366
title,
363367
body_placeholder: problemContext,
364-
base_ref: hasChanges && autoPushAndCommit ? baseRef : ref,
365-
...(hasChanges && autoPushAndCommit && { head_ref: ref })
368+
base_ref,
369+
...(hasChanges && { head_ref: ref })
366370
}
367371
};
368372

0 commit comments

Comments
 (0)