@@ -626,14 +626,15 @@ static struct commit_list *managed_skipped(struct commit_list *list,
626626 return skip_away (list , count );
627627}
628628
629- static void bisect_rev_setup (struct rev_info * revs , const char * prefix ,
629+ static void bisect_rev_setup (struct repository * r , struct rev_info * revs ,
630+ const char * prefix ,
630631 const char * bad_format , const char * good_format ,
631632 int read_paths )
632633{
633634 struct argv_array rev_argv = ARGV_ARRAY_INIT ;
634635 int i ;
635636
636- repo_init_revisions (the_repository , revs , prefix );
637+ repo_init_revisions (r , revs , prefix );
637638 revs -> abbrev = 0 ;
638639 revs -> commit_format = CMIT_FMT_UNSPECIFIED ;
639640
@@ -723,23 +724,25 @@ static int bisect_checkout(const struct object_id *bisect_rev, int no_checkout)
723724 return run_command_v_opt (argv_show_branch , RUN_GIT_CMD );
724725}
725726
726- static struct commit * get_commit_reference (const struct object_id * oid )
727+ static struct commit * get_commit_reference (struct repository * r ,
728+ const struct object_id * oid )
727729{
728- struct commit * r = lookup_commit_reference (the_repository , oid );
729- if (!r )
730+ struct commit * c = lookup_commit_reference (r , oid );
731+ if (!c )
730732 die (_ ("Not a valid commit name %s" ), oid_to_hex (oid ));
731- return r ;
733+ return c ;
732734}
733735
734- static struct commit * * get_bad_and_good_commits (int * rev_nr )
736+ static struct commit * * get_bad_and_good_commits (struct repository * r ,
737+ int * rev_nr )
735738{
736739 struct commit * * rev ;
737740 int i , n = 0 ;
738741
739742 ALLOC_ARRAY (rev , 1 + good_revs .nr );
740- rev [n ++ ] = get_commit_reference (current_bad_oid );
743+ rev [n ++ ] = get_commit_reference (r , current_bad_oid );
741744 for (i = 0 ; i < good_revs .nr ; i ++ )
742- rev [n ++ ] = get_commit_reference (good_revs .oid + i );
745+ rev [n ++ ] = get_commit_reference (r , good_revs .oid + i );
743746 * rev_nr = n ;
744747
745748 return rev ;
@@ -823,12 +826,13 @@ static void check_merge_bases(int rev_nr, struct commit **rev, int no_checkout)
823826 free_commit_list (result );
824827}
825828
826- static int check_ancestors (int rev_nr , struct commit * * rev , const char * prefix )
829+ static int check_ancestors (struct repository * r , int rev_nr ,
830+ struct commit * * rev , const char * prefix )
827831{
828832 struct rev_info revs ;
829833 int res ;
830834
831- bisect_rev_setup (& revs , prefix , "^%s" , "%s" , 0 );
835+ bisect_rev_setup (r , & revs , prefix , "^%s" , "%s" , 0 );
832836
833837 bisect_common (& revs );
834838 res = (revs .commits != NULL );
@@ -847,7 +851,9 @@ static int check_ancestors(int rev_nr, struct commit **rev, const char *prefix)
847851 * If a merge base must be tested by the user, its source code will be
848852 * checked out to be tested by the user and we will exit.
849853 */
850- static void check_good_are_ancestors_of_bad (const char * prefix , int no_checkout )
854+ static void check_good_are_ancestors_of_bad (struct repository * r ,
855+ const char * prefix ,
856+ int no_checkout )
851857{
852858 char * filename = git_pathdup ("BISECT_ANCESTORS_OK" );
853859 struct stat st ;
@@ -866,8 +872,8 @@ static void check_good_are_ancestors_of_bad(const char *prefix, int no_checkout)
866872 goto done ;
867873
868874 /* Check if all good revs are ancestor of the bad rev. */
869- rev = get_bad_and_good_commits (& rev_nr );
870- if (check_ancestors (rev_nr , rev , prefix ))
875+ rev = get_bad_and_good_commits (r , & rev_nr );
876+ if (check_ancestors (r , rev_nr , rev , prefix ))
871877 check_merge_bases (rev_nr , rev , no_checkout );
872878 free (rev );
873879
@@ -885,12 +891,14 @@ static void check_good_are_ancestors_of_bad(const char *prefix, int no_checkout)
885891/*
886892 * This does "git diff-tree --pretty COMMIT" without one fork+exec.
887893 */
888- static void show_diff_tree (const char * prefix , struct commit * commit )
894+ static void show_diff_tree (struct repository * r ,
895+ const char * prefix ,
896+ struct commit * commit )
889897{
890898 struct rev_info opt ;
891899
892900 /* diff-tree init */
893- repo_init_revisions (the_repository , & opt , prefix );
901+ repo_init_revisions (r , & opt , prefix );
894902 git_config (git_diff_basic_config , NULL ); /* no "diff" UI options */
895903 opt .abbrev = 0 ;
896904 opt .diff = 1 ;
@@ -945,7 +953,7 @@ void read_bisect_terms(const char **read_bad, const char **read_good)
945953 * If no_checkout is non-zero, the bisection process does not
946954 * checkout the trial commit but instead simply updates BISECT_HEAD.
947955 */
948- int bisect_next_all (const char * prefix , int no_checkout )
956+ int bisect_next_all (struct repository * r , const char * prefix , int no_checkout )
949957{
950958 struct rev_info revs ;
951959 struct commit_list * tried ;
@@ -957,9 +965,9 @@ int bisect_next_all(const char *prefix, int no_checkout)
957965 if (read_bisect_refs ())
958966 die (_ ("reading bisect refs failed" ));
959967
960- check_good_are_ancestors_of_bad (prefix , no_checkout );
968+ check_good_are_ancestors_of_bad (r , prefix , no_checkout );
961969
962- bisect_rev_setup (& revs , prefix , "%s" , "^%s" , 1 );
970+ bisect_rev_setup (r , & revs , prefix , "%s" , "^%s" , 1 );
963971 revs .limited = 1 ;
964972
965973 bisect_common (& revs );
@@ -993,7 +1001,7 @@ int bisect_next_all(const char *prefix, int no_checkout)
9931001 exit_if_skipped_commits (tried , current_bad_oid );
9941002 printf ("%s is the first %s commit\n" , oid_to_hex (bisect_rev ),
9951003 term_bad );
996- show_diff_tree (prefix , revs .commits -> item );
1004+ show_diff_tree (r , prefix , revs .commits -> item );
9971005 /* This means the bisection process succeeded. */
9981006 exit (10 );
9991007 }
0 commit comments