ソースを参照

Fixes issues with stash command errors

main
Eric Amodio 4年前
コミット
a182660a4d
2個のファイルの変更29行の追加14行の削除
  1. +11
    -7
      src/commands/git/stash.ts
  2. +18
    -7
      src/system/decorators/gate.ts

+ 11
- 7
src/commands/git/stash.ts ファイルの表示

@ -274,11 +274,15 @@ export class StashGitCommand extends QuickCommandBase {
)
) {
void window.showWarningMessage(
'Unable to apply stash. Your working tree changes would be overwritten'
'Unable to apply stash. Your working tree changes would be overwritten. Please commit or stash your changes before trying again'
);
return undefined;
} else if (ex.message.includes('Auto-merging') && ex.message.includes('CONFLICT')) {
} else if (
(ex.message.includes('Auto-merging') && ex.message.includes('CONFLICT')) ||
(ex.stdout?.includes('Auto-merging') && ex.stdout?.includes('CONFLICT')) ||
ex.stdout?.includes('needs merge')
) {
void window.showInformationMessage('Stash applied with conflicts');
return undefined;
@ -445,7 +449,7 @@ export class StashGitCommand extends QuickCommandBase {
state.subcommand = selection[0].command;
}
void state.repo.stashApply(state.stash!.stashName, { deleteAfter: state.subcommand === 'pop' });
void (await state.repo.stashApply(state.stash!.stashName, { deleteAfter: state.subcommand === 'pop' }));
throw new BreakQuickCommand();
}
@ -556,7 +560,7 @@ export class StashGitCommand extends QuickCommandBase {
break;
}
void state.repo.stashDelete(state.stash.stashName);
void (await state.repo.stashDelete(state.stash.stashName));
throw new BreakQuickCommand();
}
@ -653,7 +657,7 @@ export class StashGitCommand extends QuickCommandBase {
const command = selection[0];
if (command instanceof CommandQuickPickItem) {
command.execute();
void (await command.execute());
throw new BreakQuickCommand();
}
@ -743,10 +747,10 @@ export class StashGitCommand extends QuickCommandBase {
state.flags = selection[0].item;
}
void state.repo.stashSave(state.message, state.uris, {
void (await state.repo.stashSave(state.message, state.uris, {
includeUntracked: state.flags.includes('--include-untracked'),
keepIndex: state.flags.includes('--keep-index')
});
}));
throw new BreakQuickCommand();
}

+ 18
- 7
src/system/decorators/gate.ts ファイルの表示

@ -45,15 +45,26 @@ export function gate any>(resolver?: (...args: Parame
let promise = this[prop];
if (promise === undefined) {
const result = fn!.apply(this, args);
if (result == null || !Promises.is(result)) {
return result;
}
let result;
try {
result = fn!.apply(this, args);
if (result == null || !Promises.is(result)) {
return result;
}
this[prop] = promise = result.then((r: any) => {
this[prop] = promise = result
.then((r: any) => {
this[prop] = undefined;
return r;
})
.catch(ex => {
this[prop] = undefined;
throw ex;
});
} catch (ex) {
this[prop] = undefined;
return r;
});
throw ex;
}
}
return promise;

読み込み中…
キャンセル
保存