From 2e5c4758b75f7cbae612c89b177aa045fa4f9c68 Mon Sep 17 00:00:00 2001 From: Patrick Steinhardt Date: Tue, 7 May 2024 09:11:53 +0200 Subject: cocci: apply rules to rewrite callers of "refs" interfaces Apply the rules that rewrite callers of "refs" interfaces to explicitly pass `struct ref_store`. The resulting patch has been applied with the `--whitespace=fix` option. Signed-off-by: Patrick Steinhardt Signed-off-by: Junio C Hamano --- reset.c | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) (limited to 'reset.c') diff --git a/reset.c b/reset.c index d619cb7115..59ebb1f842 100644 --- a/reset.c +++ b/reset.c @@ -47,11 +47,13 @@ static int update_refs(const struct reset_head_opts *opts, strbuf_addstr(&msg, "updating ORIG_HEAD"); reflog_orig_head = msg.buf; } - update_ref(reflog_orig_head, "ORIG_HEAD", - orig_head ? orig_head : head, - old_orig, 0, UPDATE_REFS_MSG_ON_ERR); + refs_update_ref(get_main_ref_store(the_repository), + reflog_orig_head, "ORIG_HEAD", + orig_head ? orig_head : head, + old_orig, 0, UPDATE_REFS_MSG_ON_ERR); } else if (old_orig) - delete_ref(NULL, "ORIG_HEAD", old_orig, 0); + refs_delete_ref(get_main_ref_store(the_repository), + NULL, "ORIG_HEAD", old_orig, 0); } if (!reflog_head) { @@ -60,16 +62,19 @@ static int update_refs(const struct reset_head_opts *opts, reflog_head = msg.buf; } if (!switch_to_branch) - ret = update_ref(reflog_head, "HEAD", oid, head, - detach_head ? REF_NO_DEREF : 0, - UPDATE_REFS_MSG_ON_ERR); + ret = refs_update_ref(get_main_ref_store(the_repository), + reflog_head, "HEAD", oid, head, + detach_head ? REF_NO_DEREF : 0, + UPDATE_REFS_MSG_ON_ERR); else { - ret = update_ref(reflog_branch ? reflog_branch : reflog_head, - switch_to_branch, oid, NULL, 0, - UPDATE_REFS_MSG_ON_ERR); + ret = refs_update_ref(get_main_ref_store(the_repository), + reflog_branch ? reflog_branch : reflog_head, + switch_to_branch, oid, NULL, 0, + UPDATE_REFS_MSG_ON_ERR); if (!ret) - ret = create_symref("HEAD", switch_to_branch, - reflog_head); + ret = refs_create_symref(get_main_ref_store(the_repository), + "HEAD", switch_to_branch, + reflog_head); } if (!ret && run_hook) run_hooks_l("post-checkout", -- cgit v1.2.3