Skip to content

Commit 769bf00

Browse files
committed
Improves rebase editor openning in correct window
Fixes not handling an empty rebase HEAD correctly
1 parent 061c1dc commit 769bf00

File tree

3 files changed

+16
-10
lines changed

3 files changed

+16
-10
lines changed

src/env/node/git/sub-providers/operations.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ export class OperationsGitSubProvider implements GitOperationsSubProvider {
308308
if (options?.interactive) {
309309
args.push('--interactive');
310310

311-
const editor = await getHostEditorCommand();
311+
const editor = await getHostEditorCommand(true);
312312
configs = ['-c', `sequence.editor=${editor}`];
313313
}
314314

src/env/node/git/sub-providers/pausedOperations.ts

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ export class PausedOperationsGitSubProvider implements GitPausedOperationsSubPro
256256
}
257257

258258
const [mergeBaseResult, branchTipsResult, tagTipsResult] = await Promise.allSettled([
259-
rebaseHead != null
259+
rebaseHead
260260
? this.provider.refs.getMergeBase(repoPath, rebaseHead, 'HEAD', undefined, cancellation)
261261
: this.provider.refs.getMergeBase(repoPath, onto, origHead, undefined, cancellation),
262262
this.provider.branches.getBranchesWithCommits(
@@ -318,13 +318,12 @@ export class PausedOperationsGitSubProvider implements GitPausedOperationsSubPro
318318
steps: {
319319
current: {
320320
number: getSettledValue(stepsNumberResult) ?? 0,
321-
commit:
322-
rebaseHead != null
323-
? createReference(rebaseHead, repoPath, {
324-
refType: 'revision',
325-
message: getSettledValue(stepsMessageResult),
326-
})
327-
: undefined,
321+
commit: rebaseHead
322+
? createReference(rebaseHead, repoPath, {
323+
refType: 'revision',
324+
message: getSettledValue(stepsMessageResult),
325+
})
326+
: undefined,
328327
},
329328
total: getSettledValue(stepsTotalResult) ?? 0,
330329
},

src/system/-webview/vscode.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,15 @@ export async function getHostExecutablePath(): Promise<string> {
101101
return _hostExecutablePath;
102102
}
103103

104-
export async function getHostEditorCommand(): Promise<string> {
104+
export async function getHostEditorCommand(includeWorkspaceUri: boolean = false): Promise<string> {
105105
const path = normalizePath(await getHostExecutablePath()).replace(/ /g, '\\ ');
106+
if (includeWorkspaceUri) {
107+
const uri = workspace.workspaceFile ?? workspace.workspaceFolders?.[0]?.uri;
108+
if (uri != null) {
109+
return `${path} --wait --reuse-window --folder-uri="${uri.toString()}"`;
110+
}
111+
}
112+
106113
return `${path} --wait --reuse-window`;
107114
}
108115

0 commit comments

Comments
 (0)