Skip to content

Commit 52d1177

Browse files
committed
Updates path from gitdir lookup to open rebase editor
1 parent 87a2a22 commit 52d1177

File tree

2 files changed

+40
-16
lines changed

2 files changed

+40
-16
lines changed

src/views/viewCommands.ts

Lines changed: 37 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -715,32 +715,56 @@ export class ViewCommands implements Disposable {
715715
}
716716

717717
@log()
718-
private abortPausedOperation(node: PausedOperationStatusNode) {
719-
if (!node.is('paused-operation-status')) return Promise.resolve();
718+
private async abortPausedOperation(node: PausedOperationStatusNode) {
719+
if (!node.is('paused-operation-status')) return;
720720

721-
return this.container.git.status(node.pausedOpStatus.repoPath).abortPausedOperation?.();
721+
const abortPausedOperation = this.container.git.status(node.pausedOpStatus.repoPath).abortPausedOperation;
722+
if (abortPausedOperation == null) return;
723+
724+
try {
725+
await abortPausedOperation();
726+
} catch (ex) {
727+
void window.showErrorMessage(ex.message);
728+
}
722729
}
723730

724731
@log()
725-
private continuePausedOperation(node: PausedOperationStatusNode) {
726-
if (!node.is('paused-operation-status')) return Promise.resolve();
732+
private async continuePausedOperation(node: PausedOperationStatusNode) {
733+
if (!node.is('paused-operation-status')) return;
727734

728-
return this.container.git.status(node.pausedOpStatus.repoPath).continuePausedOperation?.();
735+
const continuePausedOperation = this.container.git.status(node.pausedOpStatus.repoPath).continuePausedOperation;
736+
if (continuePausedOperation == null) return;
737+
738+
try {
739+
await continuePausedOperation();
740+
} catch (ex) {
741+
void window.showErrorMessage(ex.message);
742+
}
729743
}
730744

731745
@log()
732-
private skipPausedOperation(node: PausedOperationStatusNode) {
733-
if (!node.is('paused-operation-status')) return Promise.resolve();
746+
private async skipPausedOperation(node: PausedOperationStatusNode) {
747+
if (!node.is('paused-operation-status')) return;
734748

735-
return this.container.git.status(node.pausedOpStatus.repoPath).continuePausedOperation?.({ skip: true });
749+
const continuePausedOperation = this.container.git.status(node.pausedOpStatus.repoPath).continuePausedOperation;
750+
if (continuePausedOperation == null) return;
751+
752+
try {
753+
await continuePausedOperation({ skip: true });
754+
} catch (ex) {
755+
void window.showErrorMessage(ex.message);
756+
}
736757
}
737758

738759
@log()
739-
private openPausedOperationInRebaseEditor(node: PausedOperationStatusNode) {
740-
if (!node.is('paused-operation-status') || node.pausedOpStatus.type !== 'rebase') return Promise.resolve();
760+
private async openPausedOperationInRebaseEditor(node: PausedOperationStatusNode) {
761+
if (!node.is('paused-operation-status') || node.pausedOpStatus.type !== 'rebase') return;
762+
763+
const gitDir = await this.container.git.getGitDir(node.repoPath);
764+
if (gitDir == null) return;
741765

742-
const rebaseTodoUri = Uri.joinPath(node.uri, '.git', 'rebase-merge', 'git-rebase-todo');
743-
return executeCoreCommand('vscode.openWith', rebaseTodoUri, 'gitlens.rebase', {
766+
const rebaseTodoUri = Uri.joinPath(gitDir.uri, 'rebase-merge', 'git-rebase-todo');
767+
void executeCoreCommand('vscode.openWith', rebaseTodoUri, 'gitlens.rebase', {
744768
preview: false,
745769
});
746770
}

src/webviews/home/homeWebview.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -491,10 +491,10 @@ export class HomeWebviewProvider implements WebviewProvider<State, State, HomeWe
491491
private async openRebaseEditor(pausedOpArgs: GitPausedOperationCommandArgs) {
492492
if (pausedOpArgs.operation.type !== 'rebase') return;
493493

494-
const repo = this._repositoryBranches.get(pausedOpArgs.operation.repoPath)?.repo;
495-
if (repo == null) return;
494+
const gitDir = await this.container.git.getGitDir(pausedOpArgs.operation.repoPath);
495+
if (gitDir == null) return;
496496

497-
const rebaseTodoUri = Uri.joinPath(repo.uri, '.git', 'rebase-merge', 'git-rebase-todo');
497+
const rebaseTodoUri = Uri.joinPath(gitDir.uri, 'rebase-merge', 'git-rebase-todo');
498498
await executeCoreCommand('vscode.openWith', rebaseTodoUri, 'gitlens.rebase', {
499499
preview: false,
500500
});

0 commit comments

Comments
 (0)