@@ -192,29 +192,6 @@ export const gitStackedRebase = async (
192192 return ;
193193 }
194194
195- fs . mkdirSync ( pathToStackedRebaseDirInsideDotGit , { recursive : true } ) ;
196-
197- const initialBranch : Git . Reference | void = await Git . Branch . lookup (
198- repo , //
199- nameOfInitialBranch ,
200- Git . Branch . BRANCH . ALL
201- ) ;
202- const currentBranch : Git . Reference = await repo . getCurrentBranch ( ) ;
203-
204- const wasRegularRebaseInProgress : boolean = fs . existsSync ( pathToRegularRebaseDirInsideDotGit ) ;
205- // const
206-
207- console . log ( { wasRegularRebaseInProgress } ) ;
208-
209- if ( ! wasRegularRebaseInProgress ) {
210- await createInitialEditTodoOfGitStackedRebase (
211- repo , //
212- initialBranch ,
213- // __default__pathToStackedRebaseTodoFile
214- pathToStackedRebaseTodoFile
215- ) ;
216- }
217-
218195 if ( options . push ) {
219196 if ( ! options . forcePush ) {
220197 return fail ( "\npush without --force will fail (since git rebase overrides history).\n\n" ) ;
@@ -251,6 +228,29 @@ export const gitStackedRebase = async (
251228 }
252229 }
253230
231+ fs . mkdirSync ( pathToStackedRebaseDirInsideDotGit , { recursive : true } ) ;
232+
233+ const initialBranch : Git . Reference | void = await Git . Branch . lookup (
234+ repo , //
235+ nameOfInitialBranch ,
236+ Git . Branch . BRANCH . ALL
237+ ) ;
238+ const currentBranch : Git . Reference = await repo . getCurrentBranch ( ) ;
239+
240+ const wasRegularRebaseInProgress : boolean = fs . existsSync ( pathToRegularRebaseDirInsideDotGit ) ;
241+ // const
242+
243+ console . log ( { wasRegularRebaseInProgress } ) ;
244+
245+ if ( ! wasRegularRebaseInProgress ) {
246+ await createInitialEditTodoOfGitStackedRebase (
247+ repo , //
248+ initialBranch ,
249+ // __default__pathToStackedRebaseTodoFile
250+ pathToStackedRebaseTodoFile
251+ ) ;
252+ }
253+
254254 if ( ! wasRegularRebaseInProgress || options . viewTodoOnly ) {
255255 if ( options . editor instanceof Function ) {
256256 await options . editor ( { filePath : pathToStackedRebaseTodoFile } ) ;
0 commit comments