bisect--helper: identify as bisect when report error

In a later change, we will convert the bisect--helper to be builtin bisect. Let's start by self-identifying it's the real bisect when reporting error. This change is safe since 'git bisect--helper' is an implementation detail, users aren't expected to call 'git bisect--helper'. Signed-off-by: Đoàn Trần Công Danh <congdanhqx@gmail.com> Signed-off-by: Taylor Blau <me@ttaylorr.com>

Đoàn Trần Công Danh committed Nov 10, 2022 at 23:36 UTC 252060be77f1d9ba7696bb3540f61451e147bf8b
1 file changed +8 -5
builtin/bisect--helper.c
+8 -5
@@ -1282,7 +1282,8 @@ static int bisect_run(struct bisect_terms *terms, const char **argv, int argc)
1282 static int cmd_bisect__reset(int argc, const char **argv, const char *prefix UNUSED)
1283 {
1284 if (argc > 1)
1285 - return error(_("--bisect-reset requires either no argument or a commit"));
1285 + return error(_("'%s' requires either no argument or a commit"),
1286 + "git bisect reset");
1287 return bisect_reset(argc ? argv[0] : NULL);
1288 }
1289
@@ -1292,7 +1293,8 @@ static int cmd_bisect__terms(int argc, const char **argv, const char *prefix UNU
1293 struct bisect_terms terms = { 0 };
1294
1295 if (argc > 1)
1295 - return error(_("--bisect-terms requires 0 or 1 argument"));
1296 + return error(_("'%s' requires 0 or 1 argument"),
1297 + "git bisect terms");
1298 res = bisect_terms(&terms, argc == 1 ? argv[0] : NULL);
1299 free_terms(&terms);
1300 return res;
@@ -1315,7 +1317,8 @@ static int cmd_bisect__next(int argc, const char **argv UNUSED, const char *pref
1317 struct bisect_terms terms = { 0 };
1318
1319 if (argc)
1318 - return error(_("--bisect-next requires 0 arguments"));
1320 + return error(_("'%s' requires 0 arguments"),
1321 + "git bisect next");
1322 get_terms(&terms);
1323 res = bisect_next(&terms, prefix);
1324 free_terms(&terms);
@@ -1337,7 +1340,7 @@ static int cmd_bisect__state(int argc, const char **argv, const char *prefix UNU
1340 static int cmd_bisect__log(int argc, const char **argv UNUSED, const char *prefix UNUSED)
1341 {
1342 if (argc)
1340 - return error(_("--bisect-log requires 0 arguments"));
1343 + return error(_("'%s' requires 0 arguments"), "git bisect log");
1344 return bisect_log();
1345 }
1346
@@ -1383,7 +1386,7 @@ static int cmd_bisect__run(int argc, const char **argv, const char *prefix UNUSE
1386 struct bisect_terms terms = { 0 };
1387
1388 if (!argc)
1386 - return error(_("bisect run failed: no command provided."));
1389 + return error(_("'%s' failed: no command provided."), "git bisect run");
1390 get_terms(&terms);
1391 res = bisect_run(&terms, argv, argc);
1392 free_terms(&terms);