@@ -243,7 +243,7 @@ static int bisect_reset(const char *commit)
243243 strbuf_addstr (& branch , commit );
244244 }
245245
246- if (branch .len && !ref_exists ( "BISECT_HEAD" )) {
246+ if (branch .len && !refs_ref_exists ( get_main_ref_store ( the_repository ), "BISECT_HEAD" )) {
247247 struct child_process cmd = CHILD_PROCESS_INIT ;
248248
249249 cmd .git_cmd = 1 ;
@@ -302,8 +302,8 @@ static int bisect_write(const char *state, const char *rev,
302302 goto finish ;
303303 }
304304
305- if (update_ref ( NULL , tag .buf , & oid , NULL , 0 ,
306- UPDATE_REFS_MSG_ON_ERR )) {
305+ if (refs_update_ref ( get_main_ref_store ( the_repository ), NULL , tag .buf , & oid , NULL , 0 ,
306+ UPDATE_REFS_MSG_ON_ERR )) {
307307 res = -1 ;
308308 goto finish ;
309309 }
@@ -416,11 +416,12 @@ static void bisect_status(struct bisect_state *state,
416416 char * bad_ref = xstrfmt ("refs/bisect/%s" , terms -> term_bad );
417417 char * good_glob = xstrfmt ("%s-*" , terms -> term_good );
418418
419- if (ref_exists ( bad_ref ))
419+ if (refs_ref_exists ( get_main_ref_store ( the_repository ), bad_ref ))
420420 state -> nr_bad = 1 ;
421421
422- for_each_glob_ref_in (inc_nr , good_glob , "refs/bisect/" ,
423- (void * ) & state -> nr_good );
422+ refs_for_each_glob_ref_in (get_main_ref_store (the_repository ), inc_nr ,
423+ good_glob , "refs/bisect/" ,
424+ (void * ) & state -> nr_good );
424425
425426 free (good_glob );
426427 free (bad_ref );
@@ -574,9 +575,11 @@ static int prepare_revs(struct bisect_terms *terms, struct rev_info *revs)
574575 reset_revision_walk ();
575576 repo_init_revisions (the_repository , revs , NULL );
576577 setup_revisions (0 , NULL , revs , NULL );
577- for_each_glob_ref_in (add_bisect_ref , bad , "refs/bisect/" , & cb );
578+ refs_for_each_glob_ref_in (get_main_ref_store (the_repository ),
579+ add_bisect_ref , bad , "refs/bisect/" , & cb );
578580 cb .object_flags = UNINTERESTING ;
579- for_each_glob_ref_in (add_bisect_ref , good , "refs/bisect/" , & cb );
581+ refs_for_each_glob_ref_in (get_main_ref_store (the_repository ),
582+ add_bisect_ref , good , "refs/bisect/" , & cb );
580583 if (prepare_revision_walk (revs ))
581584 res = error (_ ("revision walk setup failed\n" ));
582585
@@ -636,7 +639,7 @@ static int bisect_successful(struct bisect_terms *terms)
636639 char * bad_ref = xstrfmt ("refs/bisect/%s" ,terms -> term_bad );
637640 int res ;
638641
639- read_ref ( bad_ref , & oid );
642+ refs_read_ref ( get_main_ref_store ( the_repository ), bad_ref , & oid );
640643 commit = lookup_commit_reference_by_name (bad_ref );
641644 repo_format_commit_message (the_repository , commit , "%s" , & commit_name ,
642645 & pp );
@@ -779,7 +782,8 @@ static enum bisect_error bisect_start(struct bisect_terms *terms, int argc,
779782 /*
780783 * Verify HEAD
781784 */
782- head = resolve_ref_unsafe ("HEAD" , 0 , & head_oid , & flags );
785+ head = refs_resolve_ref_unsafe (get_main_ref_store (the_repository ),
786+ "HEAD" , 0 , & head_oid , & flags );
783787 if (!head )
784788 if (repo_get_oid (the_repository , "HEAD" , & head_oid ))
785789 return error (_ ("bad HEAD - I need a HEAD" ));
@@ -838,8 +842,8 @@ static enum bisect_error bisect_start(struct bisect_terms *terms, int argc,
838842 res = error (_ ("invalid ref: '%s'" ), start_head .buf );
839843 goto finish ;
840844 }
841- if (update_ref ( NULL , "BISECT_HEAD" , & oid , NULL , 0 ,
842- UPDATE_REFS_MSG_ON_ERR )) {
845+ if (refs_update_ref ( get_main_ref_store ( the_repository ), NULL , "BISECT_HEAD" , & oid , NULL , 0 ,
846+ UPDATE_REFS_MSG_ON_ERR )) {
843847 res = BISECT_FAILED ;
844848 goto finish ;
845849 }
@@ -972,7 +976,7 @@ static enum bisect_error bisect_state(struct bisect_terms *terms, int argc,
972976 oid_array_append (& revs , & commit -> object .oid );
973977 }
974978
975- if (read_ref ( "BISECT_EXPECTED_REV" , & expected ))
979+ if (refs_read_ref ( get_main_ref_store ( the_repository ), "BISECT_EXPECTED_REV" , & expected ))
976980 verify_expected = 0 ; /* Ignore invalid file contents */
977981
978982 for (i = 0 ; i < revs .nr ; i ++ ) {
@@ -982,7 +986,9 @@ static enum bisect_error bisect_state(struct bisect_terms *terms, int argc,
982986 }
983987 if (verify_expected && !oideq (& revs .oid [i ], & expected )) {
984988 unlink_or_warn (git_path_bisect_ancestors_ok ());
985- delete_ref (NULL , "BISECT_EXPECTED_REV" , NULL , REF_NO_DEREF );
989+ refs_delete_ref (get_main_ref_store (the_repository ),
990+ NULL , "BISECT_EXPECTED_REV" , NULL ,
991+ REF_NO_DEREF );
986992 verify_expected = 0 ;
987993 }
988994 }
@@ -1179,13 +1185,15 @@ static int verify_good(const struct bisect_terms *terms, const char *command)
11791185 struct object_id good_rev ;
11801186 struct object_id current_rev ;
11811187 char * good_glob = xstrfmt ("%s-*" , terms -> term_good );
1182- int no_checkout = ref_exists ("BISECT_HEAD" );
1188+ int no_checkout = refs_ref_exists (get_main_ref_store (the_repository ),
1189+ "BISECT_HEAD" );
11831190
1184- for_each_glob_ref_in (get_first_good , good_glob , "refs/bisect/" ,
1185- & good_rev );
1191+ refs_for_each_glob_ref_in (get_main_ref_store (the_repository ),
1192+ get_first_good , good_glob , "refs/bisect/" ,
1193+ & good_rev );
11861194 free (good_glob );
11871195
1188- if (read_ref ( no_checkout ? "BISECT_HEAD" : "HEAD" , & current_rev ))
1196+ if (refs_read_ref ( get_main_ref_store ( the_repository ), no_checkout ? "BISECT_HEAD" : "HEAD" , & current_rev ))
11891197 return -1 ;
11901198
11911199 res = bisect_checkout (& good_rev , no_checkout );
0 commit comments