Skip to content

Commit 0d4132d

Browse files
committed
add some documentation for git-reconcile-rewritten-list
Signed-off-by: Kipras Melnikovas <kipras@kipras.org>
1 parent bae8258 commit 0d4132d

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# git-reconcile-rewritten-list
2+
3+
extracted from [git-stacked-rebase](../).
4+
5+
after `git rebase`, `git commit --amend`, etc., especially multiple ones, the rewritten-list will not tell the full story.
6+
7+
`git-reconcile-rewritten-list` currently provides 2 methods:
8+
9+
- [setupPostRewriteHookFor](./postRewriteHook.ts)
10+
- to setup custom `post-rewrite` hook(s), so that the full story gets captured
11+
- [combineRewrittenLists](./combineRewrittenLists.ts)
12+
- to "combine" the rewritten lists, or rather: for each rebase - to normalize it & it's amends
13+
14+
there's some logic in [git-stacked-rebase](../), specifically `parseNewGoodCommands` & friends, yet to be extracted.
15+
(if ever? since it's very related to git-stacked-rebase itself. not sure where the boundary is yet).
16+
17+
note that a proper solution for combining all rewritten lists is still yet to be implemented.
18+
- [git-stacked-rebase](../) uses the `combinedRewrittenList`, which currently works by taking the last rewritten list.
19+
- we might eventually discover that combining all rewritten lists as a single operation & only then processing them
20+
is actually not giving us the correct results: git-stacked-rebase needs to recover branches
21+
from the very first append into the `rewritten-list` file, up until it's called again to `--apply`.
22+
what could happen is that a user would make updates to branches in between their multiple regular rebases
23+
(without using git-stacked-rebase, which would itself `--apply` before doing a new rebase),
24+
- e.g. commit `A` gets rewritten to `A1` and later `A2`. branch `B` used to point to `A`,
25+
but gets changed by the user to `A1`.
26+
we'd need to point the branch to `A2`, but we have no knowledge of it being changed to `A1` --
27+
we only see that `A` went to `A2` when we combine the rewritten lists,
28+
but we don't pick up anything about `A1`, and thus `B` gets lost.
29+
(that's been the whole point of combining so far. well, not for rebases, but for amends).
30+
- to fix this problem, instead of fully normalizing & only then resolving the rebase events,
31+
which leaves us with only the 1st & last states,
32+
we'd need to do the resolving in between each step of normalization, to make sure that no history is lost.
33+
- but, again, we haven't tested yet if this problem actually occurs. though it probably does.
34+
my main testing ground is me myself dogfooding the tool, and i've never encountered such a situation
35+
(i'd have to intentionally try to get into it). so to test the hypothesis, need to create a test case for it first.
36+
- perhaps this is why i wanted to & indeed did name this sub-project `reconcile` instead of `combine`.

0 commit comments

Comments
 (0)