Skip to content

Commit de2ecc2

Browse files
committed
Avoids stash loop if confirmations are off
Refs: #3133
1 parent 48136f2 commit de2ecc2

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/commands/git/stash.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -515,6 +515,8 @@ export class StashGitCommand extends QuickCommand<State> {
515515
state.flags = [];
516516
}
517517

518+
let confirmOverride;
519+
518520
while (this.canStepsContinue(state)) {
519521
if (state.counter < 3 || state.message == null) {
520522
if (state.message == null) {
@@ -529,7 +531,7 @@ export class StashGitCommand extends QuickCommand<State> {
529531
state.message = result;
530532
}
531533

532-
if (this.confirm(state.confirm)) {
534+
if (this.confirm(confirmOverride ?? state.confirm)) {
533535
const result = yield* this.pushCommandConfirmStep(state, context);
534536
if (result === StepResultBreak) continue;
535537

@@ -554,6 +556,7 @@ export class StashGitCommand extends QuickCommand<State> {
554556
if (ex instanceof StashPushError) {
555557
if (ex.reason === StashPushErrorReason.NothingToSave) {
556558
if (!state.flags.includes('--include-untracked')) {
559+
confirmOverride = true;
557560
void window.showWarningMessage(
558561
'No changes to stash. Choose the "Push & Include Untracked" option, if you have untracked files.',
559562
);

0 commit comments

Comments
 (0)