summaryrefslogtreecommitdiff
path: root/commit.c
diff options
context:
space:
mode:
authorVictoria Dye <vdye@github.com>2022-11-07 09:47:52 -0800
committerJunio C Hamano <gitster@pobox.com>2022-12-09 19:31:45 +0900
commit93a7bc8b285eaad24049bc862b4733d595a473f8 (patch)
tree5c7575b9bbc1e09acae98651c0af3919cb1cabe9 /commit.c
parente7e5c6f715b2de7bea0d39c7d2ba887335b40aa0 (diff)
rebase --update-refs: avoid unintended ref deletion
In b3b1a21d1a5 (sequencer: rewrite update-refs as user edits todo list, 2022-07-19), the 'todo_list_filter_update_refs()' step was added to handle the removal of 'update-ref' lines from a 'rebase-todo'. Specifically, it removes potential ref updates from the "update refs state" if a ref does not have a corresponding 'update-ref' line. However, because 'write_update_refs_state()' will not update the state if the 'refs_to_oids' list was empty, removing *all* 'update-ref' lines will result in the state remaining unchanged from how it was initialized (with all refs' "after" OID being null). Then, when the ref update is applied, all refs will be updated to null and consequently deleted. To fix this, delete the 'update-refs' state file when 'refs_to_oids' is empty. Additionally, add a tests covering "all update-ref lines removed" cases. Reported-by: herr.kaste <herr.kaste@gmail.com> Helped-by: Phillip Wood <phillip.wood@dunelm.org.uk> Helped-by: Derrick Stolee <derrickstolee@github.com> Signed-off-by: Victoria Dye <vdye@github.com> Signed-off-by: Taylor Blau <me@ttaylorr.com>
Diffstat (limited to 'commit.c')
0 files changed, 0 insertions, 0 deletions