@@ -15,7 +15,6 @@ static GIT_PATH_FUNC(git_path_bisect_expected_rev, "BISECT_EXPECTED_REV")
1515static GIT_PATH_FUNC (git_path_bisect_ancestors_ok , "BISECT_ANCESTORS_OK ")
1616static GIT_PATH_FUNC (git_path_bisect_start , "BISECT_START ")
1717static GIT_PATH_FUNC (git_path_bisect_log , "BISECT_LOG ")
18- static GIT_PATH_FUNC (git_path_head_name , "head - name ")
1918static GIT_PATH_FUNC (git_path_bisect_names , "BISECT_NAMES ")
2019static GIT_PATH_FUNC (git_path_bisect_first_parent , "BISECT_FIRST_PARENT ")
2120static GIT_PATH_FUNC (git_path_bisect_run , "BISECT_RUN ")
@@ -678,7 +677,8 @@ static enum bisect_error bisect_auto_next(struct bisect_terms *terms, const char
678677 return bisect_next (terms , prefix );
679678}
680679
681- static enum bisect_error bisect_start (struct bisect_terms * terms , const char * * argv , int argc )
680+ static enum bisect_error bisect_start (struct bisect_terms * terms , int argc ,
681+ const char * * argv )
682682{
683683 int no_checkout = 0 ;
684684 int first_parent_only = 0 ;
@@ -807,13 +807,6 @@ static enum bisect_error bisect_start(struct bisect_terms *terms, const char **a
807807 strbuf_addstr (& start_head , oid_to_hex (& head_oid ));
808808 } else if (!get_oid (head , & head_oid ) &&
809809 skip_prefix (head , "refs/heads/" , & head )) {
810- /*
811- * This error message should only be triggered by
812- * cogito usage, and cogito users should understand
813- * it relates to cg-seek.
814- */
815- if (!is_empty_or_missing_file (git_path_head_name ()))
816- return error (_ ("won't bisect on cg-seek'ed tree" ));
817810 strbuf_addstr (& start_head , head );
818811 } else {
819812 return error (_ ("bad HEAD - strange symbolic ref" ));
@@ -908,13 +901,13 @@ static int bisect_autostart(struct bisect_terms *terms)
908901 yesno = git_prompt (_ ("Do you want me to do it for you "
909902 "[Y/n]? " ), PROMPT_ECHO );
910903 res = tolower (* yesno ) == 'n' ?
911- -1 : bisect_start (terms , empty_strvec , 0 );
904+ -1 : bisect_start (terms , 0 , empty_strvec );
912905
913906 return res ;
914907}
915908
916- static enum bisect_error bisect_state (struct bisect_terms * terms , const char * * argv ,
917- int argc )
909+ static enum bisect_error bisect_state (struct bisect_terms * terms , int argc ,
910+ const char * * argv )
918911{
919912 const char * state ;
920913 int i , verify_expected = 1 ;
@@ -1033,7 +1026,7 @@ static int process_replay_line(struct bisect_terms *terms, struct strbuf *line)
10331026 struct strvec argv = STRVEC_INIT ;
10341027 int res ;
10351028 sq_dequote_to_strvec (rev , & argv );
1036- res = bisect_start (terms , argv .v , argv .nr );
1029+ res = bisect_start (terms , argv .nr , argv .v );
10371030 strvec_clear (& argv );
10381031 return res ;
10391032 }
@@ -1083,7 +1076,8 @@ static enum bisect_error bisect_replay(struct bisect_terms *terms, const char *f
10831076 return bisect_auto_next (terms , NULL );
10841077}
10851078
1086- static enum bisect_error bisect_skip (struct bisect_terms * terms , const char * * argv , int argc )
1079+ static enum bisect_error bisect_skip (struct bisect_terms * terms , int argc ,
1080+ const char * * argv )
10871081{
10881082 int i ;
10891083 enum bisect_error res ;
@@ -1113,13 +1107,14 @@ static enum bisect_error bisect_skip(struct bisect_terms *terms, const char **ar
11131107 strvec_push (& argv_state , argv [i ]);
11141108 }
11151109 }
1116- res = bisect_state (terms , argv_state .v , argv_state .nr );
1110+ res = bisect_state (terms , argv_state .nr , argv_state .v );
11171111
11181112 strvec_clear (& argv_state );
11191113 return res ;
11201114}
11211115
1122- static int bisect_visualize (struct bisect_terms * terms , const char * * argv , int argc )
1116+ static int bisect_visualize (struct bisect_terms * terms , int argc ,
1117+ const char * * argv )
11231118{
11241119 struct child_process cmd = CHILD_PROCESS_INIT ;
11251120 struct strbuf sb = STRBUF_INIT ;
@@ -1202,7 +1197,7 @@ static int verify_good(const struct bisect_terms *terms, const char *command)
12021197 return rc ;
12031198}
12041199
1205- static int bisect_run (struct bisect_terms * terms , const char * * argv , int argc )
1200+ static int bisect_run (struct bisect_terms * terms , int argc , const char * * argv )
12061201{
12071202 int res = BISECT_OK ;
12081203 struct strbuf command = STRBUF_INIT ;
@@ -1271,7 +1266,7 @@ static int bisect_run(struct bisect_terms *terms, const char **argv, int argc)
12711266 saved_stdout = dup (1 );
12721267 dup2 (temporary_stdout_fd , 1 );
12731268
1274- res = bisect_state (terms , & new_state , 1 );
1269+ res = bisect_state (terms , 1 , & new_state );
12751270
12761271 fflush (stdout );
12771272 dup2 (saved_stdout , 1 );
@@ -1289,7 +1284,7 @@ static int bisect_run(struct bisect_terms *terms, const char **argv, int argc)
12891284 puts (_ ("bisect found first bad commit" ));
12901285 res = BISECT_OK ;
12911286 } else if (res ) {
1292- error (_ ("bisect run failed: 'bisect-state %s'"
1287+ error (_ ("bisect run failed: 'git bisect %s'"
12931288 " exited with error code %d" ), new_state , res );
12941289 } else {
12951290 continue ;
@@ -1328,7 +1323,7 @@ static int cmd_bisect__start(int argc, const char **argv, const char *prefix UNU
13281323 struct bisect_terms terms = { 0 };
13291324
13301325 set_terms (& terms , "bad" , "good" );
1331- res = bisect_start (& terms , argv , argc );
1326+ res = bisect_start (& terms , argc , argv );
13321327 free_terms (& terms );
13331328 return res ;
13341329}
@@ -1372,7 +1367,7 @@ static int cmd_bisect__skip(int argc, const char **argv, const char *prefix UNUS
13721367
13731368 set_terms (& terms , "bad" , "good" );
13741369 get_terms (& terms );
1375- res = bisect_skip (& terms , argv , argc );
1370+ res = bisect_skip (& terms , argc , argv );
13761371 free_terms (& terms );
13771372 return res ;
13781373}
@@ -1383,7 +1378,7 @@ static int cmd_bisect__visualize(int argc, const char **argv, const char *prefix
13831378 struct bisect_terms terms = { 0 };
13841379
13851380 get_terms (& terms );
1386- res = bisect_visualize (& terms , argv , argc );
1381+ res = bisect_visualize (& terms , argc , argv );
13871382 free_terms (& terms );
13881383 return res ;
13891384}
@@ -1396,7 +1391,7 @@ static int cmd_bisect__run(int argc, const char **argv, const char *prefix UNUSE
13961391 if (!argc )
13971392 return error (_ ("'%s' failed: no command provided." ), "git bisect run" );
13981393 get_terms (& terms );
1399- res = bisect_run (& terms , argv , argc );
1394+ res = bisect_run (& terms , argc , argv );
14001395 free_terms (& terms );
14011396 return res ;
14021397}
@@ -1432,20 +1427,13 @@ int cmd_bisect(int argc, const char **argv, const char *prefix)
14321427 if (check_and_set_terms (& terms , argv [0 ]))
14331428 usage_msg_optf (_ ("unknown command: '%s'" ), git_bisect_usage ,
14341429 options , argv [0 ]);
1435- res = bisect_state (& terms , argv , argc );
1430+ res = bisect_state (& terms , argc , argv );
14361431 free_terms (& terms );
14371432 } else {
14381433 argc -- ;
14391434 argv ++ ;
14401435 res = fn (argc , argv , prefix );
14411436 }
14421437
1443- /*
1444- * Handle early success
1445- * From check_merge_bases > check_good_are_ancestors_of_bad > bisect_next_all
1446- */
1447- if ((res == BISECT_INTERNAL_SUCCESS_MERGE_BASE ) || (res == BISECT_INTERNAL_SUCCESS_1ST_BAD_FOUND ))
1448- res = BISECT_OK ;
1449-
1450- return - res ;
1438+ return is_bisect_success (res ) ? 0 : - res ;
14511439}
0 commit comments