[PATCH v3 07/11] add -p (built-in): do not color the progress indicator separately
- From
Johannes Schindelin via GitGitGadget <gitgitgadget@gmail.com>
- Date
- Nov 16, 2020, 16:08 UTC
- Message-ID
- <6a68bc5511a72d25b84a243dd5d8019f81cee610.1605542912.git.gitgitgadget@gmail.com>
- In-Reply-To
- <pull.785.v3.git.1605542912.gitgitgadget@gmail.com>
From: Johannes Schindelin <johannes.schindelin@gmx.de>
The Perl version of this command colors the progress indicator and the prompt message in one go.
Let's do the same in the built-in version so that the same upcoming test (which will compare the output of `git add -p` against a known-good version) will pass both for the Perl version as well as for the built-in version.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> --- add-patch.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/add-patch.c b/add-patch.c index bf89c43145..2fad92ca37 100644 --- a/add-patch.c +++ b/add-patch.c @@ -1461,15 +1461,15 @@ static int patch_update_file(struct add_p_state *s, else prompt_mode_type = PROMPT_HUNK; - color_fprintf(stdout, s->s.prompt_color, - "(%"PRIuMAX"/%"PRIuMAX") ", + printf("%s(%"PRIuMAX"/%"PRIuMAX") ", s->s.prompt_color, (uintmax_t)hunk_index + 1, (uintmax_t)(file_diff->hunk_nr ? file_diff->hunk_nr : 1)); - color_fprintf(stdout, s->s.prompt_color, - _(s->mode->prompt_mode[prompt_mode_type]), - s->buf.buf); + printf(_(s->mode->prompt_mode[prompt_mode_type]), + s->buf.buf); + if (*s->s.reset_color) + fputs(s->s.reset_color, stdout); fflush(stdout); if (read_single_character(s) == EOF) break;
-- gitgitgadget