Open mlcui-corp opened 1 year ago
Oof, it looks like it might be hard to fix this one. I don't really understand why git undo
thought it was appropriate to delete the main branch in this case.
I saw that commits created during a reverted rebase remain in the smartlog. This is very minor - users can git hide them, although they aren't marked as successors of the rewritten commits so users will need to resolve the same merge conflict again. This is more of a feature request than a bug report, but can these be marked as a rewrite of the previous commit - so users can continue the sync / restack at a later time?
Re this point, the issue is similar to https://github.com/arxanas/git-branchless/issues/316. There's no post-abort
hook, so it would be hard to run any action when a git rebase
is aborted, and we don't know what commits have been rewritten into until the end of the rebase when it calls the post-rewrite
hook. It would probably be better if we could at least abort the transaction/not register the newly created commits unless the git rebase
completes, which would at least ensure that there's only one copy of the same commit in the smartlog as a result.
Description of the bug
See command log below:
Command log
``` $ git init sync-abort $ cd sync-abort $ git commit --allow-empty -m "Initial commit" [main (root-commit) 6dfb64b] Initial commit git branchless init Created config file at ~/git/branchless-testing/sync-abort/.git/branchless/config Auto-detected your main branch as: main If this is incorrect, run: git branchless init --main-branchI saw that commits created during a reverted rebase remain in the smartlog. This is very minor - users can
git hide
them, although they aren't marked as successors of the rewritten commits so users will need to resolve the same merge conflict again. This is more of a feature request than a bug report, but can these be marked as a rewrite of the previous commit - so users can continue the sync / restack at a later time?Expected behavior
Aborting a rebase started by
git sync --merge
, then doinggit undo -i
, undos correctly.Actual behavior
Aborting a rebase started by
git sync --merge
, then doinggit undo -i
, deletes the main branch.Version of
rustc
No response
Automated bug report
Software version
git-branchless 0.7.0-pre.1 (v0.3.6-nixos.0-655-gf698e09)
Operating system
Linux 5.19.11-1rodete1-amd64
Command-line
Environment variables
Git version
Hooks
Show 6 hooks
##### Hook `post-commit` ``` #!/bin/sh ## START BRANCHLESS CONFIG git branchless hook-post-commit "$@" ## END BRANCHLESS CONFIG ``` ##### Hook `post-merge` ``` #!/bin/sh ## START BRANCHLESS CONFIG git branchless hook-post-merge "$@" ## END BRANCHLESS CONFIG ``` ##### Hook `post-rewrite` ``` #!/bin/sh ## START BRANCHLESS CONFIG git branchless hook-post-rewrite "$@" ## END BRANCHLESS CONFIG ``` ##### Hook `post-checkout` ``` #!/bin/sh ## START BRANCHLESS CONFIG git branchless hook-post-checkout "$@" ## END BRANCHLESS CONFIG ``` ##### Hook `pre-auto-gc` ``` #!/bin/sh ## START BRANCHLESS CONFIG git branchless hook-pre-auto-gc "$@" ## END BRANCHLESS CONFIG ``` ##### Hook `reference-transaction` ``` #!/bin/sh ## START BRANCHLESS CONFIG # Avoid canceling the reference transaction in the case that `branchless` fails # for whatever reason. git branchless hook-reference-transaction "$@" || ( echo 'branchless: Failed to process reference transaction!' echo 'branchless: Some events (e.g. branch updates) may have been lost.' echo 'branchless: This is a bug. Please report it.' ) ## END BRANCHLESS CONFIG ```Events
Show 5 events
##### Event ID: 18, transaction ID: 25 (message: hook-post-checkout) 1. `RefUpdateEvent { timestamp: 1670821239.7127469, event_tx_id: EventTransactionId(25), ref_name: ReferenceName("HEAD"), old_oid: f9f3612960af426ced33ab2eeb2d70124cbceaff, new_oid: f9f3612960af426ced33ab2eeb2d70124cbceaff, message: None }` ``` O 6dfb64b 17m xxxxxxx xxxxxx |\ | o e2880de 11m xx xxxxxx xxxxxx | | | o 5d269df 10m xx xxxxxx xxxxxx | @ f9f3612 8m (> main) xx xx xxxxx xxxxx ``` ##### Event ID: 17, transaction ID: 24 (message: reference-transaction) 1. `RefUpdateEvent { timestamp: 1670821239.6613429, event_tx_id: EventTransactionId(24), ref_name: ReferenceName("refs/heads/main"), old_oid: 0000000000000000000000000000000000000000, new_oid: f9f3612960af426ced33ab2eeb2d70124cbceaff, message: None }` ``` O 6dfb64b 17m xxxxxxx xxxxxx |\ | o e2880de 11m xx xxxxxx xxxxxx | | | o 5d269df 10m xx xxxxxx xxxxxx | @ f9f3612 8m (> main) xx xx xxxxx xxxxx ``` ##### Event ID: 15, transaction ID: 23 (message: undo) 1. `ObsoleteEvent { timestamp: 1670821189.692501, event_tx_id: EventTransactionId(23), commit_oid: NonZeroOid(ac04bfeed238699fa257406f0d91ecf35186e0f5) }` 1. `WorkingCopySnapshot { timestamp: 1670821196.9232357, event_tx_id: EventTransactionId(23), head_oid: f9f3612960af426ced33ab2eeb2d70124cbceaff, commit_oid: NonZeroOid(2f7257f1b9370abf7ee2857fc5b2138fdee14fb7), ref_name: None }` ``` O 6dfb64b 17m xxxxxxx xxxxxx |\ | o e2880de 11m xx xxxxxx xxxxxx | | | o 5d269df 10m xx xxxxxx xxxxxx | @ f9f3612 8m (> main) xx xx xxxxx xxxxx ``` ##### Event ID: 14, transaction ID: 21 (message: reference-transaction) 1. `RefUpdateEvent { timestamp: 1670821073.873817, event_tx_id: EventTransactionId(21), ref_name: ReferenceName("refs/heads/main"), old_oid: 0000000000000000000000000000000000000000, new_oid: f9f3612960af426ced33ab2eeb2d70124cbceaff, message: None }` ``` O 6dfb64b 17m xxxxxxx xxxxxx |\ | o e2880de 11m xx xxxxxx xxxxxx | | | o 5d269df 10m xx xxxxxx xxxxxx | @ f9f3612 8m (> main) xx xx xxxxx xxxxx ``` ##### Event ID: 13, transaction ID: 15 (message: post-commit) 1. `CommitEvent { timestamp: 1670821047.0, event_tx_id: EventTransactionId(15), commit_oid: NonZeroOid(ac04bfeed238699fa257406f0d91ecf35186e0f5) }` ``` O 6dfb64b 17m xxxxxxx xxxxxx |\ | o e2880de 11m xx xxxxxx xxxxxx | | | o 5d269df 10m xx xxxxxx xxxxxx | @ f9f3612 8m (> main) xx xx xxxxx xxxxx ```Version of
git-branchless
5c13964
Version of
git
No response