@@ -626,14 +626,15 @@ static struct commit_list *managed_skipped(struct commit_list *list,
626
626
return skip_away (list , count );
627
627
}
628
628
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 ,
630
631
const char * bad_format , const char * good_format ,
631
632
int read_paths )
632
633
{
633
634
struct argv_array rev_argv = ARGV_ARRAY_INIT ;
634
635
int i ;
635
636
636
- repo_init_revisions (the_repository , revs , prefix );
637
+ repo_init_revisions (r , revs , prefix );
637
638
revs -> abbrev = 0 ;
638
639
revs -> commit_format = CMIT_FMT_UNSPECIFIED ;
639
640
@@ -723,23 +724,25 @@ static int bisect_checkout(const struct object_id *bisect_rev, int no_checkout)
723
724
return run_command_v_opt (argv_show_branch , RUN_GIT_CMD );
724
725
}
725
726
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 )
727
729
{
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 )
730
732
die (_ ("Not a valid commit name %s" ), oid_to_hex (oid ));
731
- return r ;
733
+ return c ;
732
734
}
733
735
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 )
735
738
{
736
739
struct commit * * rev ;
737
740
int i , n = 0 ;
738
741
739
742
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 );
741
744
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 );
743
746
* rev_nr = n ;
744
747
745
748
return rev ;
@@ -823,12 +826,13 @@ static void check_merge_bases(int rev_nr, struct commit **rev, int no_checkout)
823
826
free_commit_list (result );
824
827
}
825
828
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 )
827
831
{
828
832
struct rev_info revs ;
829
833
int res ;
830
834
831
- bisect_rev_setup (& revs , prefix , "^%s" , "%s" , 0 );
835
+ bisect_rev_setup (r , & revs , prefix , "^%s" , "%s" , 0 );
832
836
833
837
bisect_common (& revs );
834
838
res = (revs .commits != NULL );
@@ -847,7 +851,9 @@ static int check_ancestors(int rev_nr, struct commit **rev, const char *prefix)
847
851
* If a merge base must be tested by the user, its source code will be
848
852
* checked out to be tested by the user and we will exit.
849
853
*/
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 )
851
857
{
852
858
char * filename = git_pathdup ("BISECT_ANCESTORS_OK" );
853
859
struct stat st ;
@@ -866,8 +872,8 @@ static void check_good_are_ancestors_of_bad(const char *prefix, int no_checkout)
866
872
goto done ;
867
873
868
874
/* 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 ))
871
877
check_merge_bases (rev_nr , rev , no_checkout );
872
878
free (rev );
873
879
@@ -885,12 +891,14 @@ static void check_good_are_ancestors_of_bad(const char *prefix, int no_checkout)
885
891
/*
886
892
* This does "git diff-tree --pretty COMMIT" without one fork+exec.
887
893
*/
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 )
889
897
{
890
898
struct rev_info opt ;
891
899
892
900
/* diff-tree init */
893
- repo_init_revisions (the_repository , & opt , prefix );
901
+ repo_init_revisions (r , & opt , prefix );
894
902
git_config (git_diff_basic_config , NULL ); /* no "diff" UI options */
895
903
opt .abbrev = 0 ;
896
904
opt .diff = 1 ;
@@ -945,7 +953,7 @@ void read_bisect_terms(const char **read_bad, const char **read_good)
945
953
* If no_checkout is non-zero, the bisection process does not
946
954
* checkout the trial commit but instead simply updates BISECT_HEAD.
947
955
*/
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 )
949
957
{
950
958
struct rev_info revs ;
951
959
struct commit_list * tried ;
@@ -957,9 +965,9 @@ int bisect_next_all(const char *prefix, int no_checkout)
957
965
if (read_bisect_refs ())
958
966
die (_ ("reading bisect refs failed" ));
959
967
960
- check_good_are_ancestors_of_bad (prefix , no_checkout );
968
+ check_good_are_ancestors_of_bad (r , prefix , no_checkout );
961
969
962
- bisect_rev_setup (& revs , prefix , "%s" , "^%s" , 1 );
970
+ bisect_rev_setup (r , & revs , prefix , "%s" , "^%s" , 1 );
963
971
revs .limited = 1 ;
964
972
965
973
bisect_common (& revs );
@@ -993,7 +1001,7 @@ int bisect_next_all(const char *prefix, int no_checkout)
993
1001
exit_if_skipped_commits (tried , current_bad_oid );
994
1002
printf ("%s is the first %s commit\n" , oid_to_hex (bisect_rev ),
995
1003
term_bad );
996
- show_diff_tree (prefix , revs .commits -> item );
1004
+ show_diff_tree (r , prefix , revs .commits -> item );
997
1005
/* This means the bisection process succeeded. */
998
1006
exit (10 );
999
1007
}
0 commit comments