Skip to content

Commit 6681e36

Browse files
dschogitster
authored andcommitted
add -p (built-in): do not color the progress indicator separately
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 25d9e5c commit 6681e36

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

add-patch.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1461,15 +1461,15 @@ static int patch_update_file(struct add_p_state *s,
14611461
else
14621462
prompt_mode_type = PROMPT_HUNK;
14631463

1464-
color_fprintf(stdout, s->s.prompt_color,
1465-
"(%"PRIuMAX"/%"PRIuMAX") ",
1464+
printf("%s(%"PRIuMAX"/%"PRIuMAX") ", s->s.prompt_color,
14661465
(uintmax_t)hunk_index + 1,
14671466
(uintmax_t)(file_diff->hunk_nr
14681467
? file_diff->hunk_nr
14691468
: 1));
1470-
color_fprintf(stdout, s->s.prompt_color,
1471-
_(s->mode->prompt_mode[prompt_mode_type]),
1472-
s->buf.buf);
1469+
printf(_(s->mode->prompt_mode[prompt_mode_type]),
1470+
s->buf.buf);
1471+
if (*s->s.reset_color)
1472+
fputs(s->s.reset_color, stdout);
14731473
fflush(stdout);
14741474
if (read_single_character(s) == EOF)
14751475
break;

0 commit comments

Comments
 (0)