@@ -15,7 +15,6 @@ static GIT_PATH_FUNC(git_path_bisect_expected_rev, "BISECT_EXPECTED_REV")
15
15
static GIT_PATH_FUNC (git_path_bisect_ancestors_ok , "BISECT_ANCESTORS_OK ")
16
16
static GIT_PATH_FUNC (git_path_bisect_start , "BISECT_START ")
17
17
static GIT_PATH_FUNC (git_path_bisect_log , "BISECT_LOG ")
18
- static GIT_PATH_FUNC (git_path_head_name , "head - name ")
19
18
static GIT_PATH_FUNC (git_path_bisect_names , "BISECT_NAMES ")
20
19
static GIT_PATH_FUNC (git_path_bisect_first_parent , "BISECT_FIRST_PARENT ")
21
20
static 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
678
677
return bisect_next (terms , prefix );
679
678
}
680
679
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 )
682
682
{
683
683
int no_checkout = 0 ;
684
684
int first_parent_only = 0 ;
@@ -807,13 +807,6 @@ static enum bisect_error bisect_start(struct bisect_terms *terms, const char **a
807
807
strbuf_addstr (& start_head , oid_to_hex (& head_oid ));
808
808
} else if (!get_oid (head , & head_oid ) &&
809
809
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" ));
817
810
strbuf_addstr (& start_head , head );
818
811
} else {
819
812
return error (_ ("bad HEAD - strange symbolic ref" ));
@@ -908,13 +901,13 @@ static int bisect_autostart(struct bisect_terms *terms)
908
901
yesno = git_prompt (_ ("Do you want me to do it for you "
909
902
"[Y/n]? " ), PROMPT_ECHO );
910
903
res = tolower (* yesno ) == 'n' ?
911
- -1 : bisect_start (terms , empty_strvec , 0 );
904
+ -1 : bisect_start (terms , 0 , empty_strvec );
912
905
913
906
return res ;
914
907
}
915
908
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 )
918
911
{
919
912
const char * state ;
920
913
int i , verify_expected = 1 ;
@@ -1033,7 +1026,7 @@ static int process_replay_line(struct bisect_terms *terms, struct strbuf *line)
1033
1026
struct strvec argv = STRVEC_INIT ;
1034
1027
int res ;
1035
1028
sq_dequote_to_strvec (rev , & argv );
1036
- res = bisect_start (terms , argv .v , argv .nr );
1029
+ res = bisect_start (terms , argv .nr , argv .v );
1037
1030
strvec_clear (& argv );
1038
1031
return res ;
1039
1032
}
@@ -1083,7 +1076,8 @@ static enum bisect_error bisect_replay(struct bisect_terms *terms, const char *f
1083
1076
return bisect_auto_next (terms , NULL );
1084
1077
}
1085
1078
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 )
1087
1081
{
1088
1082
int i ;
1089
1083
enum bisect_error res ;
@@ -1113,13 +1107,14 @@ static enum bisect_error bisect_skip(struct bisect_terms *terms, const char **ar
1113
1107
strvec_push (& argv_state , argv [i ]);
1114
1108
}
1115
1109
}
1116
- res = bisect_state (terms , argv_state .v , argv_state .nr );
1110
+ res = bisect_state (terms , argv_state .nr , argv_state .v );
1117
1111
1118
1112
strvec_clear (& argv_state );
1119
1113
return res ;
1120
1114
}
1121
1115
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 )
1123
1118
{
1124
1119
struct child_process cmd = CHILD_PROCESS_INIT ;
1125
1120
struct strbuf sb = STRBUF_INIT ;
@@ -1202,7 +1197,7 @@ static int verify_good(const struct bisect_terms *terms, const char *command)
1202
1197
return rc ;
1203
1198
}
1204
1199
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 )
1206
1201
{
1207
1202
int res = BISECT_OK ;
1208
1203
struct strbuf command = STRBUF_INIT ;
@@ -1271,7 +1266,7 @@ static int bisect_run(struct bisect_terms *terms, const char **argv, int argc)
1271
1266
saved_stdout = dup (1 );
1272
1267
dup2 (temporary_stdout_fd , 1 );
1273
1268
1274
- res = bisect_state (terms , & new_state , 1 );
1269
+ res = bisect_state (terms , 1 , & new_state );
1275
1270
1276
1271
fflush (stdout );
1277
1272
dup2 (saved_stdout , 1 );
@@ -1289,7 +1284,7 @@ static int bisect_run(struct bisect_terms *terms, const char **argv, int argc)
1289
1284
puts (_ ("bisect found first bad commit" ));
1290
1285
res = BISECT_OK ;
1291
1286
} else if (res ) {
1292
- error (_ ("bisect run failed: 'bisect-state %s'"
1287
+ error (_ ("bisect run failed: 'git bisect %s'"
1293
1288
" exited with error code %d" ), new_state , res );
1294
1289
} else {
1295
1290
continue ;
@@ -1328,7 +1323,7 @@ static int cmd_bisect__start(int argc, const char **argv, const char *prefix UNU
1328
1323
struct bisect_terms terms = { 0 };
1329
1324
1330
1325
set_terms (& terms , "bad" , "good" );
1331
- res = bisect_start (& terms , argv , argc );
1326
+ res = bisect_start (& terms , argc , argv );
1332
1327
free_terms (& terms );
1333
1328
return res ;
1334
1329
}
@@ -1372,7 +1367,7 @@ static int cmd_bisect__skip(int argc, const char **argv, const char *prefix UNUS
1372
1367
1373
1368
set_terms (& terms , "bad" , "good" );
1374
1369
get_terms (& terms );
1375
- res = bisect_skip (& terms , argv , argc );
1370
+ res = bisect_skip (& terms , argc , argv );
1376
1371
free_terms (& terms );
1377
1372
return res ;
1378
1373
}
@@ -1383,7 +1378,7 @@ static int cmd_bisect__visualize(int argc, const char **argv, const char *prefix
1383
1378
struct bisect_terms terms = { 0 };
1384
1379
1385
1380
get_terms (& terms );
1386
- res = bisect_visualize (& terms , argv , argc );
1381
+ res = bisect_visualize (& terms , argc , argv );
1387
1382
free_terms (& terms );
1388
1383
return res ;
1389
1384
}
@@ -1396,7 +1391,7 @@ static int cmd_bisect__run(int argc, const char **argv, const char *prefix UNUSE
1396
1391
if (!argc )
1397
1392
return error (_ ("'%s' failed: no command provided." ), "git bisect run" );
1398
1393
get_terms (& terms );
1399
- res = bisect_run (& terms , argv , argc );
1394
+ res = bisect_run (& terms , argc , argv );
1400
1395
free_terms (& terms );
1401
1396
return res ;
1402
1397
}
@@ -1432,20 +1427,13 @@ int cmd_bisect(int argc, const char **argv, const char *prefix)
1432
1427
if (check_and_set_terms (& terms , argv [0 ]))
1433
1428
usage_msg_optf (_ ("unknown command: '%s'" ), git_bisect_usage ,
1434
1429
options , argv [0 ]);
1435
- res = bisect_state (& terms , argv , argc );
1430
+ res = bisect_state (& terms , argc , argv );
1436
1431
free_terms (& terms );
1437
1432
} else {
1438
1433
argc -- ;
1439
1434
argv ++ ;
1440
1435
res = fn (argc , argv , prefix );
1441
1436
}
1442
1437
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 ;
1451
1439
}
0 commit comments