Conversation
| let mut head_ref = repo.head()?; | ||
| head_ref.set_target(head_commit.id(), "absorb: adding fixup commits")?; | ||
| // If you don't like the fancy custom reflog message above and want to stick to Git's own | ||
| // messages, this would also work: | ||
| // repo.reset(head_commit.as_object(), ResetType::Soft, None)?; |
There was a problem hiding this comment.
If everything else is fine, an opinion would be needed here.
| if config.one_reflog_entry && !config.dry_run { | ||
| let mut head_ref = repo.head()?; | ||
| head_ref.set_target(head_commit.id(), "absorb: adding fixup commits")?; | ||
| // If you don't like the fancy custom reflog message above and want to stick to Git's own | ||
| // messages, this would also work: | ||
| // repo.reset(head_commit.as_object(), ResetType::Soft, None)?; | ||
| } | ||
|
|
There was a problem hiding this comment.
TODO: This almost definitely doesn't work in combination with --and-rebase, which I forgot to consider => fix & add test.
Or would it be fine to just make --one-reflog-entry mutually exclusive with --and-rebase? 🤔 Because I think making these work together could become quite involved...
There was a problem hiding this comment.
Or, another idea: Call the option --one-reflog-entry-for-commits or something like that, which makes it clear that this applies to the commits only and not to the subsequent rebase of --and-rebase. Thoughts?
| // sanity checks: all is as usual when it comes to commits and index: | ||
| let mut revwalk = ctx.repo.revwalk().unwrap(); | ||
| revwalk.push_head().unwrap(); | ||
| assert_eq!(revwalk.count(), 3); | ||
| assert!(nothing_left_in_index(&ctx.repo).unwrap()); |
There was a problem hiding this comment.
I just copied this from the --one-fixup-per-commit test, but should anything else be checked to ensure this doesn't accidentally alter the behavior in other ways?
|
Drive-by comment: if the new flag is accepted, it should be documented in Documentation/git-absorb.adoc. |
|
so as a baseline: the way git-rebase handles reflog entries is it makes several of them for HEAD, but only one of them for the branch being modified (assuming that HEAD is not detached, of course). if i was going to accept this feature, i would expect it to work the same way: leave the full trail of reflog entries in HEAD, but have one entry on the branch. this also means you don't have to clean up the HEAD reflog entries generated by the rebase. ie:
also, i wouldn't bother gating this behind a flag, it should just be always-on |
|
Closing because this wouldn't play nicely with |
This implements option (4) from #157, adding a command-line flag to make git-absorb create only a single reflog entry (instead of one per commit as it normally does).
This change would allow users to easily "undo" all of git-absorb's commits at once by doing
git reset HEAD@{1}.Fixes #157.