diff options
author | Patrick Steinhardt <ps@pks.im> | 2024-01-19 11:40:09 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2024-01-19 20:10:41 +0100 |
commit | fd7c6ffa9e118cdf18a3752ec456070ed0a22e3b (patch) | |
tree | 8ed2182341844aadbdcd481e396dbce854a2db02 /sequencer.c | |
parent | sequencer: delete REBASE_HEAD in correct repo when picking commits (diff) | |
download | git-fd7c6ffa9e118cdf18a3752ec456070ed0a22e3b.tar.xz git-fd7c6ffa9e118cdf18a3752ec456070ed0a22e3b.zip |
refs: convert AUTO_MERGE to become a normal pseudo-ref
In 70c70de616 (refs: complete list of special refs, 2023-12-14) we have
inrtoduced a new `is_special_ref()` function that classifies some refs
as being special. The rule is that special refs are exclusively read and
written via the filesystem directly, whereas normal refs exclucsively go
via the refs API.
The intent of that commit was to record the status quo so that we know
to route reads of such special refs consistently. Eventually, the list
should be reduced to its bare minimum of refs which really are special,
namely FETCH_HEAD and MERGE_HEAD.
Follow up on this promise and convert the AUTO_MERGE ref to become a
normal pseudo-ref by using the refs API to both read and write it
instead of accessing the filesystem directly.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'sequencer.c')
-rw-r--r-- | sequencer.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/sequencer.c b/sequencer.c index 6f620f5717..47c8d17cbb 100644 --- a/sequencer.c +++ b/sequencer.c @@ -2408,7 +2408,8 @@ static int do_pick_commit(struct repository *r, refs_delete_ref(get_main_ref_store(r), "", "CHERRY_PICK_HEAD", NULL, REF_NO_DEREF); unlink(git_path_merge_msg(r)); - unlink(git_path_auto_merge(r)); + refs_delete_ref(get_main_ref_store(r), "", "AUTO_MERGE", + NULL, REF_NO_DEREF); fprintf(stderr, _("dropping %s %s -- patch contents already upstream\n"), oid_to_hex(&commit->object.oid), msg.subject); @@ -2818,7 +2819,8 @@ void sequencer_post_commit_cleanup(struct repository *r, int verbose) need_cleanup = 1; } - unlink(git_path_auto_merge(r)); + refs_delete_ref(get_main_ref_store(r), "", "AUTO_MERGE", + NULL, REF_NO_DEREF); if (!need_cleanup) return; @@ -4766,7 +4768,8 @@ static int pick_commits(struct repository *r, } unlink(rebase_path_author_script()); unlink(git_path_merge_head(r)); - unlink(git_path_auto_merge(r)); + refs_delete_ref(get_main_ref_store(r), "", "AUTO_MERGE", + NULL, REF_NO_DEREF); refs_delete_ref(get_main_ref_store(r), "", "REBASE_HEAD", NULL, REF_NO_DEREF); @@ -5123,7 +5126,8 @@ static int commit_staged_changes(struct repository *r, return error(_("could not commit staged changes.")); unlink(rebase_path_amend()); unlink(git_path_merge_head(r)); - unlink(git_path_auto_merge(r)); + refs_delete_ref(get_main_ref_store(r), "", "AUTO_MERGE", + NULL, REF_NO_DEREF); if (final_fixup) { unlink(rebase_path_fixup_msg()); unlink(rebase_path_squash_msg()); |