-
-
Notifications
You must be signed in to change notification settings - Fork 89
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(move): Support on-disk rebases with --fixup #1022
base: master
Are you sure you want to change the base?
Conversation
97e0b25
to
ab7000d
Compare
The fiddly, hacky patch is in the last commit in this stack, and the test that it's patching is in its parent. To observe the issue: ❯ git switch move-fixup-on-disk
❯ cargo test test_move_fixup_multiple_disconnected_into_ancestor
# passes!
❯ git prev
❯ cargo test test_move_fixup_multiple_disconnected_into_ancestor
# fails with
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ Snapshot Summary ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Snapshot: move_fixup_multiple_disconnected_into_ancestor-4
Source: git-branchless/tests/test_move.rs:5740
─────────────────────────────────────────────────────────────────────────────────────────────────────────────
Expression: stdout
─────────────────────────────────────────────────────────────────────────────────────────────────────────────
-old snapshot
+new results
────────────┬────────────────────────────────────────────────────────────────────────────────────────────────
0 0 │ O f777ecc (master) create initial.txt␊
1 │+|\␊
2 │+| o 38caaaf create test.txt␊
3 │+| |␊
4 │+| o 6783c86 update 2 test.txt␊
5 │+| |␊
6 │+| o 7e2a64a update 4 test.txt␊
7 │+| |␊
8 │+| @ 472b70b update 6 test.txt␊
1 9 │ |␊
2 │-o 38caaaf (test) create test.txt␊
3 │-|␊
4 │-o 6783c86 update 2 test.txt␊
5 │-|␊
6 │-o 7e2a64a update 4 test.txt␊
7 │-|␊
8 │-@ 472b70b update 6 test.txt
10 │+x ea32d54 (rewritten as 00000000) (test) create test.txt␊
────────────┴──────────────────────────────────────────────────────────────────────────────────────────────── In that snapshot, you can see that branch |
ab7000d
to
2343055
Compare
If the issue does not regress existing functionality, then I would be okay to merge this anyways and resolve (or not resolve) the issue later. EDIT: oh, I see, #545 was already landed and this is not a replacement for it, which is what I thought when skimming over the PR title. |
@claytonrcarter I was going to release a new version of git-branchless hopefully sometime in the next week. Let me know if you want me to wait to get this PR in. |
I'm definitely not going to get to this in the next week, so please don't wait for it.
I could go either way. There are a few known issues w/ this patch, but I'm not able to test it more at this time, and releasing it may be the best way to get more feedback. I don't think this is wrong or that it introduces defects; just that the whole on-disk fixup story feels a bit shakey still, what with all of the "manually hide every commit we generate" stuff, and now this latest patch. The on disk implementation feels like I'm abusing the rebase Options, as I see them:
In case it's helpful, the current status:
Any input is welcome, of course! |
} else { | ||
vec![ | ||
// HACK force move branches that used to point at original_commit_oid to new HEAD | ||
// FIXME Yuck! The for loop works by word, not by line; will not work for branches w/ spaces ... is that a thing? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will not work for branches w/ spaces ... is that a thing?
No, it's not. At least not w/ git 2.41
:
❯ git br 'foo bar'
fatal: 'foo bar' is not a valid branch name
❯ git br foo\tbar
fatal: 'foo bar' is not a valid branch name
❯ git br foo\nbar
fatal: 'foo
bar' is not a valid branch name
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TIL
2343055
to
b59791a
Compare
e8096ce
to
92c2cf2
Compare
95aaba7
to
9eafe29
Compare
9eafe29
to
a97ca69
Compare
By adding the named branch, this change exposes a problem where - in some cases - branches are not moved to the rewritten commit. Other tests have plenty of branches that are correctly updated during rebase, both in-mem and on-disk. I suspect that, in this case, the issue is that branch is on the destination.
This is just a hack to fix one specific test failure. I haven't dug into it, but I assume there is something more interesting happening than the one case I'm patching with `branch -f ...`
a97ca69
to
998b746
Compare
Follow up to #545