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
25
bisect.c
25
bisect.c
@@ -469,7 +469,8 @@ static int register_ref(const char *refname, const struct object_id *oid,
|
||||
|
||||
static int read_bisect_refs(void)
|
||||
{
|
||||
return for_each_ref_in("refs/bisect/", register_ref, NULL);
|
||||
return refs_for_each_ref_in(get_main_ref_store(the_repository),
|
||||
"refs/bisect/", register_ref, NULL);
|
||||
}
|
||||
|
||||
static GIT_PATH_FUNC(git_path_bisect_names, "BISECT_NAMES")
|
||||
@@ -709,7 +710,7 @@ static enum bisect_error error_if_skipped_commits(struct commit_list *tried,
|
||||
static int is_expected_rev(const struct object_id *oid)
|
||||
{
|
||||
struct object_id expected_oid;
|
||||
if (read_ref("BISECT_EXPECTED_REV", &expected_oid))
|
||||
if (refs_read_ref(get_main_ref_store(the_repository), "BISECT_EXPECTED_REV", &expected_oid))
|
||||
return 0;
|
||||
return oideq(oid, &expected_oid);
|
||||
}
|
||||
@@ -721,11 +722,14 @@ enum bisect_error bisect_checkout(const struct object_id *bisect_rev,
|
||||
struct pretty_print_context pp = {0};
|
||||
struct strbuf commit_msg = STRBUF_INIT;
|
||||
|
||||
update_ref(NULL, "BISECT_EXPECTED_REV", bisect_rev, NULL, 0, UPDATE_REFS_DIE_ON_ERR);
|
||||
refs_update_ref(get_main_ref_store(the_repository), NULL,
|
||||
"BISECT_EXPECTED_REV", bisect_rev, NULL, 0,
|
||||
UPDATE_REFS_DIE_ON_ERR);
|
||||
|
||||
if (no_checkout) {
|
||||
update_ref(NULL, "BISECT_HEAD", bisect_rev, NULL, 0,
|
||||
UPDATE_REFS_DIE_ON_ERR);
|
||||
refs_update_ref(get_main_ref_store(the_repository), NULL,
|
||||
"BISECT_HEAD", bisect_rev, NULL, 0,
|
||||
UPDATE_REFS_DIE_ON_ERR);
|
||||
} else {
|
||||
struct child_process cmd = CHILD_PROCESS_INIT;
|
||||
|
||||
@@ -1027,7 +1031,8 @@ enum bisect_error bisect_next_all(struct repository *r, const char *prefix)
|
||||
* If no_checkout is non-zero, the bisection process does not
|
||||
* checkout the trial commit but instead simply updates BISECT_HEAD.
|
||||
*/
|
||||
int no_checkout = ref_exists("BISECT_HEAD");
|
||||
int no_checkout = refs_ref_exists(get_main_ref_store(the_repository),
|
||||
"BISECT_HEAD");
|
||||
unsigned bisect_flags = 0;
|
||||
|
||||
read_bisect_terms(&term_bad, &term_good);
|
||||
@@ -1178,10 +1183,14 @@ int bisect_clean_state(void)
|
||||
|
||||
/* There may be some refs packed during bisection */
|
||||
struct string_list refs_for_removal = STRING_LIST_INIT_NODUP;
|
||||
for_each_ref_in("refs/bisect", mark_for_removal, (void *) &refs_for_removal);
|
||||
refs_for_each_ref_in(get_main_ref_store(the_repository),
|
||||
"refs/bisect", mark_for_removal,
|
||||
(void *) &refs_for_removal);
|
||||
string_list_append(&refs_for_removal, xstrdup("BISECT_HEAD"));
|
||||
string_list_append(&refs_for_removal, xstrdup("BISECT_EXPECTED_REV"));
|
||||
result = delete_refs("bisect: remove", &refs_for_removal, REF_NO_DEREF);
|
||||
result = refs_delete_refs(get_main_ref_store(the_repository),
|
||||
"bisect: remove", &refs_for_removal,
|
||||
REF_NO_DEREF);
|
||||
refs_for_removal.strdup_strings = 1;
|
||||
string_list_clear(&refs_for_removal, 0);
|
||||
unlink_or_warn(git_path_bisect_ancestors_ok());
|
||||
|
||||
Reference in New Issue
Block a user