diff options
| author | Rubén Justo <rjusto@gmail.com> | 2024-04-29 20:37:03 +0200 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2024-04-30 12:02:39 -0700 |
| commit | 9d225b025d96d37e8c914646c54cfa9fb5f52b80 (patch) | |
| tree | 78395771246090b927a3f66553cf0c88d9d68faa /add-patch.c | |
| parent | ae3196a5ea84a9e88991d576020cf66512487088 (diff) | |
| download | git-9d225b025d96d37e8c914646c54cfa9fb5f52b80.tar.xz | |
add-patch: do not show UI messages on stderr
There is no need to show some UI messages on stderr, and yet doing so
may produce some undesirable results, such as messages appearing in an
unexpected order.
Let's use stdout for all UI messages, and adjusts the tests accordingly.
Signed-off-by: Rubén Justo <rjusto@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'add-patch.c')
| -rw-r--r-- | add-patch.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/add-patch.c b/add-patch.c index a06dd18985..43abd57ef6 100644 --- a/add-patch.c +++ b/add-patch.c @@ -293,10 +293,9 @@ static void err(struct add_p_state *s, const char *fmt, ...) va_list args; va_start(args, fmt); - fputs(s->s.error_color, stderr); - vfprintf(stderr, fmt, args); - fputs(s->s.reset_color, stderr); - fputc('\n', stderr); + fputs(s->s.error_color, stdout); + vprintf(fmt, args); + puts(s->s.reset_color); va_end(args); } @@ -1326,7 +1325,7 @@ static int apply_for_checkout(struct add_p_state *s, struct strbuf *diff, err(s, _("Nothing was applied.\n")); } else /* As a last resort, show the diff to the user */ - fwrite(diff->buf, diff->len, 1, stderr); + fwrite(diff->buf, diff->len, 1, stdout); return 0; } @@ -1777,9 +1776,9 @@ int run_add_p(struct repository *r, enum add_p_mode mode, break; if (s.file_diff_nr == 0) - fprintf(stderr, _("No changes.\n")); + err(&s, _("No changes.")); else if (binary_count == s.file_diff_nr) - fprintf(stderr, _("Only binary files changed.\n")); + err(&s, _("Only binary files changed.")); add_p_state_clear(&s); return 0; |
