diff options
| author | Chris Down <chris@chrisdown.name> | 2022-05-11 19:00:14 +0100 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2022-05-11 12:35:13 -0700 |
| commit | f11046e6def11a281a371918793226f30e3f8c12 (patch) | |
| tree | 482e78b9f499078fefee280857b994d5f5ccea33 /builtin | |
| parent | 0cf1defa5a6764b8a0fd956ff4d114cb014cb8a4 (diff) | |
| download | git-f11046e6def11a281a371918793226f30e3f8c12.tar.gz | |
bisect: output bisect setup status in bisect log
This allows seeing the current intermediate status without adding a new
good or bad commit:
$ git bisect log | tail -1
# status: waiting for bad commit, 1 good commit known
Signed-off-by: Chris Down <chris@chrisdown.name>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin')
| -rw-r--r-- | builtin/bisect--helper.c | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/builtin/bisect--helper.c b/builtin/bisect--helper.c index fa8024a864..e358e3dd5b 100644 --- a/builtin/bisect--helper.c +++ b/builtin/bisect--helper.c @@ -400,6 +400,22 @@ static void bisect_status(struct bisect_state *state, free(bad_ref); } +__attribute__((format (printf, 1, 2))) +static void bisect_log_printf(const char *fmt, ...) +{ + struct strbuf buf = STRBUF_INIT; + va_list ap; + + va_start(ap, fmt); + strbuf_vaddf(&buf, fmt, ap); + va_end(ap); + + printf("%s", buf.buf); + append_to_file(git_path_bisect_log(), "# %s", buf.buf); + + strbuf_release(&buf); +} + static void bisect_print_status(const struct bisect_terms *terms) { struct bisect_state state = { 0 }; @@ -411,13 +427,13 @@ static void bisect_print_status(const struct bisect_terms *terms) return; if (!state.nr_good && !state.nr_bad) - printf(_("status: waiting for both good and bad commits\n")); + bisect_log_printf(_("status: waiting for both good and bad commits\n")); else if (state.nr_good) - printf(Q_("status: waiting for bad commit, %d good commit known\n", - "status: waiting for bad commit, %d good commits known\n", - state.nr_good), state.nr_good); + bisect_log_printf(Q_("status: waiting for bad commit, %d good commit known\n", + "status: waiting for bad commit, %d good commits known\n", + state.nr_good), state.nr_good); else - printf(_("status: waiting for good commit(s), bad commit known\n")); + bisect_log_printf(_("status: waiting for good commit(s), bad commit known\n")); } static int bisect_next_check(const struct bisect_terms *terms, |
