Browse Source

Fixes Git Commands back tracking in certain cases

main
Eric Amodio 4 years ago
parent
commit
5901c2db91
17 changed files with 102 additions and 18 deletions
  1. +6
    -1
      src/commands/git/branch.ts
  2. +6
    -1
      src/commands/git/cherry-pick.ts
  3. +6
    -1
      src/commands/git/coauthors.ts
  4. +6
    -1
      src/commands/git/fetch.ts
  5. +6
    -1
      src/commands/git/log.ts
  6. +6
    -1
      src/commands/git/merge.ts
  7. +6
    -1
      src/commands/git/pull.ts
  8. +6
    -1
      src/commands/git/push.ts
  9. +6
    -1
      src/commands/git/rebase.ts
  10. +6
    -1
      src/commands/git/reset.ts
  11. +6
    -1
      src/commands/git/revert.ts
  12. +6
    -2
      src/commands/git/search.ts
  13. +6
    -1
      src/commands/git/show.ts
  14. +6
    -1
      src/commands/git/stash.ts
  15. +6
    -1
      src/commands/git/status.ts
  16. +6
    -1
      src/commands/git/switch.ts
  17. +6
    -1
      src/commands/git/tag.ts

+ 6
- 1
src/commands/git/branch.ts View File

@ -152,6 +152,8 @@ export class BranchGitCommand extends QuickCommand {
title: this.title, title: this.title,
}; };
let skippedStepTwo = false;
while (this.canStepsContinue(state)) { while (this.canStepsContinue(state)) {
context.title = this.title; context.title = this.title;
@ -170,8 +172,10 @@ export class BranchGitCommand extends QuickCommand {
context.title = getTitle(state.subcommand === 'delete' ? 'Branches' : this.title, state.subcommand); context.title = getTitle(state.subcommand === 'delete' ? 'Branches' : this.title, state.subcommand);
if (state.counter < 2 || state.repo == null || typeof state.repo === 'string') { if (state.counter < 2 || state.repo == null || typeof state.repo === 'string') {
skippedStepTwo = false;
if (context.repos.length === 1) { if (context.repos.length === 1) {
if (state.repo == null) { if (state.repo == null) {
skippedStepTwo = true;
state.counter++; state.counter++;
} }
state.repo = context.repos[0]; state.repo = context.repos[0];
@ -203,7 +207,8 @@ export class BranchGitCommand extends QuickCommand {
} }
// If we skipped the previous step, make sure we back up past it // If we skipped the previous step, make sure we back up past it
if (context.repos.length === 1) {
if (skippedStepTwo) {
skippedStepTwo = false;
state.counter--; state.counter--;
} }
} }

+ 6
- 1
src/commands/git/cherry-pick.ts View File

@ -96,12 +96,16 @@ export class CherryPickGitCommand extends QuickCommand {
state.references = [state.references]; state.references = [state.references];
} }
let skippedStepOne = false;
while (this.canStepsContinue(state)) { while (this.canStepsContinue(state)) {
context.title = this.title; context.title = this.title;
if (state.counter < 1 || state.repo == null || typeof state.repo === 'string') { if (state.counter < 1 || state.repo == null || typeof state.repo === 'string') {
skippedStepOne = false;
if (context.repos.length === 1) { if (context.repos.length === 1) {
if (state.repo == null) { if (state.repo == null) {
skippedStepOne = true;
state.counter++; state.counter++;
} }
state.repo = context.repos[0]; state.repo = context.repos[0];
@ -137,7 +141,8 @@ export class CherryPickGitCommand extends QuickCommand {
); );
if (result === StepResult.Break) { if (result === StepResult.Break) {
// If we skipped the previous step, make sure we back up past it // If we skipped the previous step, make sure we back up past it
if (context.repos.length === 1) {
if (skippedStepOne) {
skippedStepOne = false;
state.counter--; state.counter--;
} }

+ 6
- 1
src/commands/git/coauthors.ts View File

@ -115,6 +115,8 @@ export class CoAuthorsGitCommand extends QuickCommand {
} }
} }
let skippedStepOne = false;
while (this.canStepsContinue(state)) { while (this.canStepsContinue(state)) {
context.title = this.title; context.title = this.title;
@ -124,8 +126,10 @@ export class CoAuthorsGitCommand extends QuickCommand {
typeof state.repo === 'string' || typeof state.repo === 'string' ||
!context.repos.includes(state.repo) !context.repos.includes(state.repo)
) { ) {
skippedStepOne = false;
if (context.repos.length === 1) { if (context.repos.length === 1) {
if (state.repo == null) { if (state.repo == null) {
skippedStepOne = true;
state.counter++; state.counter++;
} }
state.repo = context.repos[0]; state.repo = context.repos[0];
@ -146,7 +150,8 @@ export class CoAuthorsGitCommand extends QuickCommand {
); );
if (result === StepResult.Break) { if (result === StepResult.Break) {
// If we skipped the previous step, make sure we back up past it // If we skipped the previous step, make sure we back up past it
if (context.repos.length === 1) {
if (skippedStepOne) {
skippedStepOne = false;
state.counter--; state.counter--;
} }

+ 6
- 1
src/commands/git/fetch.ts View File

@ -74,6 +74,8 @@ export class FetchGitCommand extends QuickCommand {
state.repos = [state.repos as any]; state.repos = [state.repos as any];
} }
let skippedStepOne = false;
while (this.canStepsContinue(state)) { while (this.canStepsContinue(state)) {
context.title = this.title; context.title = this.title;
@ -83,8 +85,10 @@ export class FetchGitCommand extends QuickCommand {
state.repos.length === 0 || state.repos.length === 0 ||
Arrays.isStringArray(state.repos) Arrays.isStringArray(state.repos)
) { ) {
skippedStepOne = false;
if (context.repos.length === 1) { if (context.repos.length === 1) {
if (state.repos == null) { if (state.repos == null) {
skippedStepOne = true;
state.counter++; state.counter++;
} }
state.repos = [context.repos[0]]; state.repos = [context.repos[0]];
@ -105,7 +109,8 @@ export class FetchGitCommand extends QuickCommand {
const result = yield* this.confirmStep(state as FetchStepState, context); const result = yield* this.confirmStep(state as FetchStepState, context);
if (result === StepResult.Break) { if (result === StepResult.Break) {
// If we skipped the previous step, make sure we back up past it // If we skipped the previous step, make sure we back up past it
if (context.repos.length === 1) {
if (skippedStepOne) {
skippedStepOne = false;
state.counter--; state.counter--;
} }

+ 6
- 1
src/commands/git/log.ts View File

@ -82,12 +82,16 @@ export class LogGitCommand extends QuickCommand {
title: this.title, title: this.title,
}; };
let skippedStepOne = false;
while (this.canStepsContinue(state)) { while (this.canStepsContinue(state)) {
context.title = this.title; context.title = this.title;
if (state.counter < 1 || state.repo == null || typeof state.repo === 'string') { if (state.counter < 1 || state.repo == null || typeof state.repo === 'string') {
skippedStepOne = false;
if (context.repos.length === 1) { if (context.repos.length === 1) {
if (state.repo == null) { if (state.repo == null) {
skippedStepOne = true;
state.counter++; state.counter++;
} }
state.repo = context.repos[0]; state.repo = context.repos[0];
@ -113,7 +117,8 @@ export class LogGitCommand extends QuickCommand {
}); });
if (result === StepResult.Break) { if (result === StepResult.Break) {
// If we skipped the previous step, make sure we back up past it // If we skipped the previous step, make sure we back up past it
if (context.repos.length === 1) {
if (skippedStepOne) {
skippedStepOne = false;
state.counter--; state.counter--;
} }

+ 6
- 1
src/commands/git/merge.ts View File

@ -89,12 +89,16 @@ export class MergeGitCommand extends QuickCommand {
state.flags = []; state.flags = [];
} }
let skippedStepOne = false;
while (this.canStepsContinue(state)) { while (this.canStepsContinue(state)) {
context.title = this.title; context.title = this.title;
if (state.counter < 1 || state.repo == null || typeof state.repo === 'string') { if (state.counter < 1 || state.repo == null || typeof state.repo === 'string') {
skippedStepOne = false;
if (context.repos.length === 1) { if (context.repos.length === 1) {
if (state.repo == null) { if (state.repo == null) {
skippedStepOne = true;
state.counter++; state.counter++;
} }
state.repo = context.repos[0]; state.repo = context.repos[0];
@ -130,7 +134,8 @@ export class MergeGitCommand extends QuickCommand {
}); });
if (result === StepResult.Break) { if (result === StepResult.Break) {
// If we skipped the previous step, make sure we back up past it // If we skipped the previous step, make sure we back up past it
if (context.repos.length === 1) {
if (skippedStepOne) {
skippedStepOne = false;
state.counter--; state.counter--;
} }

+ 6
- 1
src/commands/git/pull.ts View File

@ -74,6 +74,8 @@ export class PullGitCommand extends QuickCommand {
state.repos = [state.repos as any]; state.repos = [state.repos as any];
} }
let skippedStepOne = false;
while (this.canStepsContinue(state)) { while (this.canStepsContinue(state)) {
context.title = this.title; context.title = this.title;
@ -83,8 +85,10 @@ export class PullGitCommand extends QuickCommand {
state.repos.length === 0 || state.repos.length === 0 ||
Arrays.isStringArray(state.repos) Arrays.isStringArray(state.repos)
) { ) {
skippedStepOne = false;
if (context.repos.length === 1) { if (context.repos.length === 1) {
if (state.repos == null) { if (state.repos == null) {
skippedStepOne = true;
state.counter++; state.counter++;
} }
state.repos = [context.repos[0]]; state.repos = [context.repos[0]];
@ -105,7 +109,8 @@ export class PullGitCommand extends QuickCommand {
const result = yield* this.confirmStep(state as PullStepState, context); const result = yield* this.confirmStep(state as PullStepState, context);
if (result === StepResult.Break) { if (result === StepResult.Break) {
// If we skipped the previous step, make sure we back up past it // If we skipped the previous step, make sure we back up past it
if (context.repos.length === 1) {
if (skippedStepOne) {
skippedStepOne = false;
state.counter--; state.counter--;
} }

+ 6
- 1
src/commands/git/push.ts View File

@ -87,6 +87,8 @@ export class PushGitCommand extends QuickCommand {
state.repos = [state.repos as any]; state.repos = [state.repos as any];
} }
let skippedStepOne = false;
while (this.canStepsContinue(state)) { while (this.canStepsContinue(state)) {
context.title = this.title; context.title = this.title;
@ -96,8 +98,10 @@ export class PushGitCommand extends QuickCommand {
state.repos.length === 0 || state.repos.length === 0 ||
Arrays.isStringArray(state.repos) Arrays.isStringArray(state.repos)
) { ) {
skippedStepOne = false;
if (context.repos.length === 1) { if (context.repos.length === 1) {
if (state.repos == null) { if (state.repos == null) {
skippedStepOne = true;
state.counter++; state.counter++;
} }
state.repos = [context.repos[0]]; state.repos = [context.repos[0]];
@ -127,7 +131,8 @@ export class PushGitCommand extends QuickCommand {
const result = yield* this.confirmStep(state as PushStepState, context); const result = yield* this.confirmStep(state as PushStepState, context);
if (result === StepResult.Break) { if (result === StepResult.Break) {
// If we skipped the previous step, make sure we back up past it // If we skipped the previous step, make sure we back up past it
if (context.repos.length === 1) {
if (skippedStepOne) {
skippedStepOne = false;
state.counter--; state.counter--;
} }

+ 6
- 1
src/commands/git/rebase.ts View File

@ -90,12 +90,16 @@ export class RebaseGitCommand extends QuickCommand {
state.flags = []; state.flags = [];
} }
let skippedStepOne = false;
while (this.canStepsContinue(state)) { while (this.canStepsContinue(state)) {
context.title = this.title; context.title = this.title;
if (state.counter < 1 || state.repo == null || typeof state.repo === 'string') { if (state.counter < 1 || state.repo == null || typeof state.repo === 'string') {
skippedStepOne = false;
if (context.repos.length === 1) { if (context.repos.length === 1) {
if (state.repo == null) { if (state.repo == null) {
skippedStepOne = true;
state.counter++; state.counter++;
} }
state.repo = context.repos[0]; state.repo = context.repos[0];
@ -131,7 +135,8 @@ export class RebaseGitCommand extends QuickCommand {
}); });
if (result === StepResult.Break) { if (result === StepResult.Break) {
// If we skipped the previous step, make sure we back up past it // If we skipped the previous step, make sure we back up past it
if (context.repos.length === 1) {
if (skippedStepOne) {
skippedStepOne = false;
state.counter--; state.counter--;
} }

+ 6
- 1
src/commands/git/reset.ts View File

@ -78,12 +78,16 @@ export class ResetGitCommand extends QuickCommand {
state.flags = []; state.flags = [];
} }
let skippedStepOne = false;
while (this.canStepsContinue(state)) { while (this.canStepsContinue(state)) {
context.title = this.title; context.title = this.title;
if (state.counter < 1 || state.repo == null || typeof state.repo === 'string') { if (state.counter < 1 || state.repo == null || typeof state.repo === 'string') {
skippedStepOne = false;
if (context.repos.length === 1) { if (context.repos.length === 1) {
if (state.repo == null) { if (state.repo == null) {
skippedStepOne = true;
state.counter++; state.counter++;
} }
state.repo = context.repos[0]; state.repo = context.repos[0];
@ -125,7 +129,8 @@ export class ResetGitCommand extends QuickCommand {
}); });
if (result === StepResult.Break) { if (result === StepResult.Break) {
// If we skipped the previous step, make sure we back up past it // If we skipped the previous step, make sure we back up past it
if (context.repos.length === 1) {
if (skippedStepOne) {
skippedStepOne = false;
state.counter--; state.counter--;
} }

+ 6
- 1
src/commands/git/revert.ts View File

@ -80,12 +80,16 @@ export class RevertGitCommand extends QuickCommand {
state.references = [state.references]; state.references = [state.references];
} }
let skippedStepOne = false;
while (this.canStepsContinue(state)) { while (this.canStepsContinue(state)) {
context.title = this.title; context.title = this.title;
if (state.counter < 1 || state.repo == null || typeof state.repo === 'string') { if (state.counter < 1 || state.repo == null || typeof state.repo === 'string') {
skippedStepOne = false;
if (context.repos.length === 1) { if (context.repos.length === 1) {
if (state.repo == null) { if (state.repo == null) {
skippedStepOne = true;
state.counter++; state.counter++;
} }
state.repo = context.repos[0]; state.repo = context.repos[0];
@ -127,7 +131,8 @@ export class RevertGitCommand extends QuickCommand {
); );
if (result === StepResult.Break) { if (result === StepResult.Break) {
// If we skipped the previous step, make sure we back up past it // If we skipped the previous step, make sure we back up past it
if (context.repos.length === 1) {
if (skippedStepOne) {
skippedStepOne = false;
state.counter--; state.counter--;
} }

+ 6
- 2
src/commands/git/search.ts View File

@ -107,6 +107,8 @@ export class SearchGitCommand extends QuickCommand {
state.showResultsInView = cfg.showResultsInView; state.showResultsInView = cfg.showResultsInView;
} }
let skippedStepOne = false;
while (this.canStepsContinue(state)) { while (this.canStepsContinue(state)) {
context.title = this.title; context.title = this.title;
@ -116,8 +118,10 @@ export class SearchGitCommand extends QuickCommand {
typeof state.repo === 'string' || typeof state.repo === 'string' ||
!context.repos.includes(state.repo) !context.repos.includes(state.repo)
) { ) {
skippedStepOne = false;
if (context.repos.length === 1) { if (context.repos.length === 1) {
if (state.repo == null) { if (state.repo == null) {
skippedStepOne = true;
state.counter++; state.counter++;
} }
state.repo = context.repos[0]; state.repo = context.repos[0];
@ -134,8 +138,8 @@ export class SearchGitCommand extends QuickCommand {
const result = yield* this.pickSearchOperatorStep(state as SearchStepState, context); const result = yield* this.pickSearchOperatorStep(state as SearchStepState, context);
if (result === StepResult.Break) { if (result === StepResult.Break) {
// If we skipped the previous step, make sure we back up past it // If we skipped the previous step, make sure we back up past it
if (context.repos.length === 1) {
state.counter--;
if (skippedStepOne) {
skippedStepOne = false;
} }
state.pattern = undefined; state.pattern = undefined;

+ 6
- 1
src/commands/git/show.ts View File

@ -80,6 +80,8 @@ export class ShowGitCommand extends QuickCommand {
title: this.title, title: this.title,
}; };
let skippedStepOne = false;
while (this.canStepsContinue(state)) { while (this.canStepsContinue(state)) {
context.title = this.title; context.title = this.title;
@ -89,8 +91,10 @@ export class ShowGitCommand extends QuickCommand {
typeof state.repo === 'string' || typeof state.repo === 'string' ||
!context.repos.includes(state.repo) !context.repos.includes(state.repo)
) { ) {
skippedStepOne = false;
if (context.repos.length === 1) { if (context.repos.length === 1) {
if (state.repo == null) { if (state.repo == null) {
skippedStepOne = true;
state.counter++; state.counter++;
} }
state.repo = context.repos[0]; state.repo = context.repos[0];
@ -125,7 +129,8 @@ export class ShowGitCommand extends QuickCommand {
}); });
if (result === StepResult.Break) { if (result === StepResult.Break) {
// If we skipped the previous step, make sure we back up past it // If we skipped the previous step, make sure we back up past it
if (context.repos.length === 1) {
if (skippedStepOne) {
skippedStepOne = false;
state.counter--; state.counter--;
} }

+ 6
- 1
src/commands/git/stash.ts View File

@ -147,6 +147,8 @@ export class StashGitCommand extends QuickCommand {
title: this.title, title: this.title,
}; };
let skippedStepTwo = false;
while (this.canStepsContinue(state)) { while (this.canStepsContinue(state)) {
context.title = this.title; context.title = this.title;
@ -165,8 +167,10 @@ export class StashGitCommand extends QuickCommand {
context.title = getTitle(this.title, state.subcommand); context.title = getTitle(this.title, state.subcommand);
if (state.counter < 2 || state.repo == null || typeof state.repo === 'string') { if (state.counter < 2 || state.repo == null || typeof state.repo === 'string') {
skippedStepTwo = false;
if (context.repos.length === 1) { if (context.repos.length === 1) {
if (state.repo == null) { if (state.repo == null) {
skippedStepTwo = true;
state.counter++; state.counter++;
} }
state.repo = context.repos[0]; state.repo = context.repos[0];
@ -198,7 +202,8 @@ export class StashGitCommand extends QuickCommand {
} }
// If we skipped the previous step, make sure we back up past it // If we skipped the previous step, make sure we back up past it
if (context.repos.length === 1) {
if (skippedStepTwo) {
skippedStepTwo = false;
state.counter--; state.counter--;
} }
} }

+ 6
- 1
src/commands/git/status.ts View File

@ -60,6 +60,8 @@ export class StatusGitCommand extends QuickCommand {
title: this.title, title: this.title,
}; };
let skippedStepOne = false;
while (this.canStepsContinue(state)) { while (this.canStepsContinue(state)) {
context.title = this.title; context.title = this.title;
@ -69,8 +71,10 @@ export class StatusGitCommand extends QuickCommand {
typeof state.repo === 'string' || typeof state.repo === 'string' ||
!context.repos.includes(state.repo) !context.repos.includes(state.repo)
) { ) {
skippedStepOne = false;
if (context.repos.length === 1) { if (context.repos.length === 1) {
if (state.repo == null) { if (state.repo == null) {
skippedStepOne = true;
state.counter++; state.counter++;
} }
state.repo = context.repos[0]; state.repo = context.repos[0];
@ -98,7 +102,8 @@ export class StatusGitCommand extends QuickCommand {
const result = yield* showRepositoryStatusStep(state as StatusStepState, context); const result = yield* showRepositoryStatusStep(state as StatusStepState, context);
if (result === StepResult.Break) { if (result === StepResult.Break) {
// If we skipped the previous step, make sure we back up past it // If we skipped the previous step, make sure we back up past it
if (context.repos.length === 1) {
if (skippedStepOne) {
skippedStepOne = false;
state.counter--; state.counter--;
} }

+ 6
- 1
src/commands/git/switch.ts View File

@ -92,6 +92,8 @@ export class SwitchGitCommand extends QuickCommand {
state.repos = [state.repos] as string[] | Repository[]; state.repos = [state.repos] as string[] | Repository[];
} }
let skippedStepOne = false;
while (this.canStepsContinue(state)) { while (this.canStepsContinue(state)) {
context.title = this.title; context.title = this.title;
@ -101,8 +103,10 @@ export class SwitchGitCommand extends QuickCommand {
state.repos.length === 0 || state.repos.length === 0 ||
Arrays.isStringArray(state.repos) Arrays.isStringArray(state.repos)
) { ) {
skippedStepOne = false;
if (context.repos.length === 1) { if (context.repos.length === 1) {
if (state.repos == null) { if (state.repos == null) {
skippedStepOne = true;
state.counter++; state.counter++;
} }
state.repos = [context.repos[0]]; state.repos = [context.repos[0]];
@ -125,7 +129,8 @@ export class SwitchGitCommand extends QuickCommand {
}); });
if (result === StepResult.Break) { if (result === StepResult.Break) {
// If we skipped the previous step, make sure we back up past it // If we skipped the previous step, make sure we back up past it
if (context.repos.length === 1) {
if (skippedStepOne) {
skippedStepOne = false;
state.counter--; state.counter--;
} }

+ 6
- 1
src/commands/git/tag.ts View File

@ -131,6 +131,8 @@ export class TagGitCommand extends QuickCommand {
title: this.title, title: this.title,
}; };
let skippedStepTwo = false;
while (this.canStepsContinue(state)) { while (this.canStepsContinue(state)) {
context.title = this.title; context.title = this.title;
@ -147,8 +149,10 @@ export class TagGitCommand extends QuickCommand {
this.subcommand = state.subcommand; this.subcommand = state.subcommand;
if (state.counter < 2 || state.repo == null || typeof state.repo === 'string') { if (state.counter < 2 || state.repo == null || typeof state.repo === 'string') {
skippedStepTwo = false;
if (context.repos.length === 1) { if (context.repos.length === 1) {
if (state.repo == null) { if (state.repo == null) {
skippedStepTwo = true;
state.counter++; state.counter++;
} }
state.repo = context.repos[0]; state.repo = context.repos[0];
@ -178,7 +182,8 @@ export class TagGitCommand extends QuickCommand {
} }
// If we skipped the previous step, make sure we back up past it // If we skipped the previous step, make sure we back up past it
if (context.repos.length === 1) {
if (skippedStepTwo) {
skippedStepTwo = false;
state.counter--; state.counter--;
} }
} }

Loading…
Cancel
Save