From 79562cdcec247037d5e0fc90ee4298e074b71d02 Mon Sep 17 00:00:00 2001 From: Kipras Melnikovas Date: Tue, 25 Jan 2022 04:21:55 +0200 Subject: [PATCH] allow `--continue` without providing `initialBranch` Signed-off-by: Kipras Melnikovas --- git-stacked-rebase.ts | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/git-stacked-rebase.ts b/git-stacked-rebase.ts index 9c5b8360..b45901bb 100755 --- a/git-stacked-rebase.ts +++ b/git-stacked-rebase.ts @@ -1384,7 +1384,7 @@ git-stacked-rebase [-a|--apply] 2. but wil not push the partial branches to a remote until --push --force is used. -git-stacked-rebase [-c|--continue] +git-stacked-rebase [] (-c|--continue) (!) should be used instead of git-rebase's --continue @@ -1476,6 +1476,31 @@ git-stacked-rebase ${gitStackedRebaseVersionStr} __BUILD_DATE_REPLACEMENT_STR__ throw new Termination(helpMsg); } + if (["--continue", "-c"].includes(nameOfInitialBranch) && !process.argv.length) { + console.log("--continue without initialBranch"); + + /** + * TODO allow `null` / make optional + * + * both will need some intellisense to only allow + * in specific cases + * + * (unless we'll keep track of the + * current initial branch we're working with?) + * + */ + const initialBranch = ""; + + /** + * TODO call more appropraitely / extract default options + * so that it's less error-prone here + */ + return gitStackedRebase(initialBranch, { + gitDir, + continue: true, + }); + } + /** * TODO: improve arg parsing, lmao */