소스 검색

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(() => '')

불러오는 중...
취소
저장