summaryrefslogtreecommitdiff
path: root/builtin/bisect--helper.c
diff options
context:
space:
mode:
authorĐoàn Trần Công Danh <congdanhqx@gmail.com>2022-11-10 16:36:39 (GMT)
committerTaylor Blau <me@ttaylorr.com>2022-11-11 22:05:52 (GMT)
commit461fec41fa79803c367ccaf11f713d6c67ba709f (patch)
treecce5cc40f4a1f727b0801941d1f2121b3f6cd2f5 /builtin/bisect--helper.c
parentf37d0bdd42d08602204760f42f48cb4d77b251bf (diff)
downloadgit-461fec41fa79803c367ccaf11f713d6c67ba709f.zip
git-461fec41fa79803c367ccaf11f713d6c67ba709f.tar.gz
git-461fec41fa79803c367ccaf11f713d6c67ba709f.tar.bz2
bisect run: keep some of the post-v2.30.0 output
Preceding commits fixed output and behavior regressions in d1bbbe45df8 (bisect--helper: reimplement `bisect_run` shell function in C, 2021-09-13), which did not claim to be changing the output of "git bisect run". But some of the output it emitted was subjectively better, so once we've asserted that we're back on v2.29.0 behavior, let's change some of it back: - We now quote the arguments again, but omit the first " " when printing the "running" line. - Ditto for other cases where we emitted the argument - We say "found first bad commit" again, not just "run success" Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Based-on-patch-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Đoàn Trần Công Danh <congdanhqx@gmail.com> Signed-off-by: Taylor Blau <me@ttaylorr.com>
Diffstat (limited to 'builtin/bisect--helper.c')
-rw-r--r--builtin/bisect--helper.c24
1 files changed, 11 insertions, 13 deletions
diff --git a/builtin/bisect--helper.c b/builtin/bisect--helper.c
index 05cab46..180c2fa 100644
--- a/builtin/bisect--helper.c
+++ b/builtin/bisect--helper.c
@@ -1141,17 +1141,17 @@ static int get_first_good(const char *refname UNUSED,
return 1;
}
-static int do_bisect_run(const char *command, const char *unquoted_cmd)
+static int do_bisect_run(const char *command)
{
struct child_process cmd = CHILD_PROCESS_INIT;
- printf(_("running %s\n"), unquoted_cmd);
+ printf(_("running %s\n"), command);
cmd.use_shell = 1;
strvec_push(&cmd.args, command);
return run_command(&cmd);
}
-static int verify_good(const struct bisect_terms *terms, const char *command, const char *unquoted_cmd)
+static int verify_good(const struct bisect_terms *terms, const char *command)
{
int rc;
enum bisect_error res;
@@ -1171,7 +1171,7 @@ static int verify_good(const struct bisect_terms *terms, const char *command, co
if (res != BISECT_OK)
return -1;
- rc = do_bisect_run(command, unquoted_cmd);
+ rc = do_bisect_run(command);
res = bisect_checkout(&current_rev, no_checkout);
if (res != BISECT_OK)
@@ -1184,7 +1184,6 @@ static int bisect_run(struct bisect_terms *terms, const char **argv, int argc)
{
int res = BISECT_OK;
struct strbuf command = STRBUF_INIT;
- struct strbuf unquoted = STRBUF_INIT;
const char *new_state;
int temporary_stdout_fd, saved_stdout;
int is_first_run = 1;
@@ -1198,9 +1197,9 @@ static int bisect_run(struct bisect_terms *terms, const char **argv, int argc)
}
sq_quote_argv(&command, argv);
- strbuf_join_argv(&unquoted, argc, argv,' ');
+ strbuf_ltrim(&command);
while (1) {
- res = do_bisect_run(command.buf, unquoted.buf);
+ res = do_bisect_run(command.buf);
/*
* Exit code 126 and 127 can either come from the shell
@@ -1210,11 +1209,11 @@ static int bisect_run(struct bisect_terms *terms, const char **argv, int argc)
* missing or non-executable script.
*/
if (is_first_run && (res == 126 || res == 127)) {
- int rc = verify_good(terms, command.buf, unquoted.buf);
+ int rc = verify_good(terms, command.buf);
is_first_run = 0;
if (rc < 0) {
- error(_("unable to verify '%s' on good"
- " revision"), unquoted.buf);
+ error(_("unable to verify %s on good"
+ " revision"), command.buf);
res = BISECT_FAILED;
break;
}
@@ -1228,7 +1227,7 @@ static int bisect_run(struct bisect_terms *terms, const char **argv, int argc)
if (res < 0 || 128 <= res) {
error(_("bisect run failed: exit code %d from"
- " '%s' is < 0 or >= 128"), res, unquoted.buf);
+ " %s is < 0 or >= 128"), res, command.buf);
break;
}
@@ -1265,7 +1264,7 @@ static int bisect_run(struct bisect_terms *terms, const char **argv, int argc)
puts(_("bisect run success"));
res = BISECT_OK;
} else if (res == BISECT_INTERNAL_SUCCESS_1ST_BAD_FOUND) {
- puts(_("bisect run success"));
+ puts(_("bisect found first bad commit"));
res = BISECT_OK;
} else if (res) {
error(_("bisect run failed: 'bisect-state %s'"
@@ -1276,7 +1275,6 @@ static int bisect_run(struct bisect_terms *terms, const char **argv, int argc)
break;
}
- strbuf_release(&unquoted);
strbuf_release(&command);
return res;
}