MCPcopy Create free account
hub / github.com/git/git / bisect_run

Function bisect_run

builtin/bisect.c:1236–1333  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1234}
1235
1236static int bisect_run(struct bisect_terms *terms, int argc, const char **argv)
1237{
1238 int res = BISECT_OK;
1239 struct strbuf command = STRBUF_INIT;
1240 const char *new_state;
1241 int temporary_stdout_fd, saved_stdout;
1242 int is_first_run = 1;
1243
1244 if (bisect_next_check(terms, NULL))
1245 return BISECT_FAILED;
1246
1247 if (!argc) {
1248 error(_("bisect run failed: no command provided."));
1249 return BISECT_FAILED;
1250 }
1251
1252 sq_quote_argv(&command, argv);
1253 strbuf_ltrim(&command);
1254 while (1) {
1255 res = do_bisect_run(command.buf);
1256
1257 /*
1258 * Exit code 126 and 127 can either come from the shell
1259 * if it was unable to execute or even find the script,
1260 * or from the script itself. Check with a known-good
1261 * revision to avoid trashing the bisect run due to a
1262 * missing or non-executable script.
1263 */
1264 if (is_first_run && (res == 126 || res == 127)) {
1265 int rc = verify_good(terms, command.buf);
1266 is_first_run = 0;
1267 if (rc < 0 || 128 <= rc) {
1268 error(_("unable to verify %s on '%s' revision"),
1269 command.buf, terms->term_good);
1270 res = BISECT_FAILED;
1271 break;
1272 }
1273 if (rc == res) {
1274 error(_("bogus exit code %d for '%s' revision"),
1275 rc, terms->term_good);
1276 res = BISECT_FAILED;
1277 break;
1278 }
1279 }
1280
1281 if (res < 0 || 128 <= res) {
1282 error(_("bisect run failed: exit code %d from"
1283 " %s is < 0 or >= 128"), res, command.buf);
1284 break;
1285 }
1286
1287 if (res == 125)
1288 new_state = "skip";
1289 else if (!res)
1290 new_state = terms->term_good;
1291 else
1292 new_state = terms->term_bad;
1293

Callers 1

cmd_bisect__runFunction · 0.85

Calls 10

bisect_next_checkFunction · 0.85
errorFunction · 0.85
sq_quote_argvFunction · 0.85
strbuf_ltrimFunction · 0.85
do_bisect_runFunction · 0.85
verify_goodFunction · 0.85
error_errnoFunction · 0.85
print_file_to_stdoutFunction · 0.85
strbuf_releaseFunction · 0.85
bisect_stateFunction · 0.70

Tested by

no test coverage detected