Skip to content

Commit f58afc9

Browse files
committed
explain where i'm going with this
Signed-off-by: Kipras Melnikovas <kipras@kipras.org>
1 parent 1bb3d7b commit f58afc9

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed

branchSequencer.ts

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,57 @@ export const branchSequencer: BranchSequencer = async ({
6969
callbackAfterDone = (): void => {},
7070
gitCmd,
7171
}) => {
72+
/**
73+
* TODO REMOVE / modify this logic (see next comment)
74+
*/
7275
if (!fs.existsSync(pathToStackedRebaseDirInsideDotGit)) {
7376
throw new Termination(`\n\nno stacked-rebase in progress? (nothing to ${rootLevelCommandName})\n\n`);
7477
}
78+
// const hasPostRewriteHookInstalledWithLatestVersion = false;
7579

80+
/**
81+
*
82+
* this is only needed to get the branch names.
83+
*
84+
* we should instead have this as a function in the options,
85+
* we should provide the default value,
86+
* but allow the higher level command to overwrite it.
87+
*
88+
* use case differences:
89+
*
90+
* a) apply:
91+
*
92+
* needs (always or no?) to parse the new good commands
93+
*
94+
* b) push:
95+
*
96+
* since is only allowed after apply has been done,
97+
* it doesn't actually care nor need to parse the new good commands,
98+
* and instead can be done by simply going thru the branches
99+
* that you would normally do with `getWantedCommitsWithBranchBoundaries`.
100+
*
101+
* and so it can be used even if the user has never previously used stacked rebase!
102+
* all is needed is the `initialBranch` and the current commit,
103+
* so that we find all the previous branches up until `initialBranch`
104+
* and just push them!
105+
*
106+
* and this is safe because again, if there's something that needs to be applied,
107+
* then before you can push, you'll need to apply first.
108+
*
109+
* otherwise, you can push w/o any need of apply,
110+
* or setting up the intial rebase todo, or whatever else,
111+
* because it's not needed!
112+
*
113+
* ---
114+
*
115+
* this is also good because we become less stateful / need less state
116+
* to function properly.
117+
*
118+
* it very well could get rid of some bugs / impossible states
119+
* that we'd sometimes end up in.
120+
* (and no longer need to manually rm -rf .git/stacked-rebase either)
121+
*
122+
*/
76123
const stackedRebaseCommandsNew: GoodCommand[] = parseNewGoodCommands(repo, pathToStackedRebaseTodoFile);
77124

78125
// const remotes: Git.Remote[] = await repo.getRemotes();

0 commit comments

Comments
 (0)