浏览代码

Fixes #1163 - forces rebase ui when cmd invoked

main
Eric Amodio 4 年前
父节点
当前提交
8978d17b4e
共有 2 个文件被更改,包括 39 次插入5 次删除
  1. +34
    -3
      src/commands/git/rebase.ts
  2. +5
    -2
      src/git/models/repository.ts

+ 34
- 3
src/commands/git/rebase.ts 查看文件

@ -1,4 +1,5 @@
'use strict';
import { env } from 'vscode';
import { Container } from '../../container';
import { GitBranch, GitLog, GitReference, GitRevision, Repository } from '../../git/git';
import {
@ -71,8 +72,38 @@ export class RebaseGitCommand extends QuickCommand {
return false;
}
execute(state: RebaseStepState) {
return state.repo.rebase(...state.flags, state.reference.ref);
async execute(state: RebaseStepState) {
let configs: string[] | undefined;
if (state.flags.includes('--interactive')) {
await Container.rebaseEditor.enableForNextUse();
let editor;
if (env.remoteName) {
switch (env.appName) {
case 'Visual Studio Code - Insiders':
editor = 'code-insiders --wait --reuse-window';
break;
case 'Visual Studio Code - Exploration':
editor = 'code-exploration --wait --reuse-window';
break;
default:
editor = 'code --wait --reuse-window';
break;
}
} else {
let execPath = process.execPath.replace(/\\/g, '/');
if (process.platform === 'darwin') {
const index = execPath.indexOf('.app/Contents/');
if (index !== -1) {
execPath = `${execPath.substring(0, index)}.app/Contents/MacOS/Electron`;
}
}
editor = `'${execPath}' --wait --reuse-window`;
}
configs = ['-c', `sequence.editor="${editor}"`];
}
return state.repo.rebase(configs, ...state.flags, state.reference.ref);
}
protected async *steps(state: PartialStepState<State>): StepGenerator {
@ -189,7 +220,7 @@ export class RebaseGitCommand extends QuickCommand {
state.flags = result;
QuickCommand.endSteps(state);
this.execute(state as RebaseStepState);
void this.execute(state as RebaseStepState);
}
return state.counter < 0 ? StepResult.Break : undefined;

+ 5
- 2
src/git/models/repository.ts 查看文件

@ -607,8 +607,11 @@ export class Repository implements Disposable {
@gate(() => '')
@log()
rebase(...args: string[]) {
this.runTerminalCommand('rebase', ...args);
rebase(configs: string[] | undefined, ...args: string[]) {
this.runTerminalCommand(
configs != null && configs.length !== 0 ? `${configs.join(' ')} rebase` : 'rebase',
...args,
);
}
@gate(() => '')

正在加载...
取消
保存