Skip to content

Commit b14cd9d

Browse files
committed
fix: create the .git/stacked-rebase/ dir only right before starting our rebase
Signed-off-by: Kipras Melnikovas <kipras@kipras.org>
1 parent f202ff4 commit b14cd9d

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

git-stacked-rebase.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -289,8 +289,6 @@ export const gitStackedRebase = async (
289289

290290
const checkIsRegularRebaseStillInProgress = (): boolean => fs.existsSync(pathToRegularRebaseDirInsideDotGit);
291291

292-
fs.mkdirSync(pathToStackedRebaseDirInsideDotGit, { recursive: true });
293-
294292
const initialBranch: Git.Reference | void = await Git.Branch.lookup(
295293
repo, //
296294
nameOfInitialBranch,
@@ -414,6 +412,14 @@ export const gitStackedRebase = async (
414412
throw new Termination("regular rebase already in progress");
415413
}
416414

415+
/**
416+
* only create the dir now, when it's needed.
417+
* otherwise, other commands can incorrectly infer
418+
* that our own stacked rebase is in progress,
419+
* when it's not, up until now.
420+
*/
421+
fs.mkdirSync(pathToStackedRebaseDirInsideDotGit, { recursive: true });
422+
417423
await createInitialEditTodoOfGitStackedRebase(
418424
repo, //
419425
initialBranch,

0 commit comments

Comments
 (0)