mirror of
https://github.com/git/git.git
synced 2025-12-12 20:36:24 +01:00
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 <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
committed by
Junio C Hamano
parent
b198ee0b3d
commit
2e5c4758b7
29
reset.c
29
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",
|
||||
|
||||
Reference in New Issue
Block a user