Re: [PATCH 06/10] diff.c: emit_line_0 can handle no color
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Sep 13, 2016, 00:11 UTC
- Message-ID
- <xmqqoa3swteo.fsf@gitster.mtv.corp.google.com>
- In-Reply-To
- <1473572530-25764-7-git-send-email-stefanbeller@gmail.com>
Stefan Beller <stefanbeller@gmail.com> writes:
> From: Stefan Beller <sbeller@google.com> > > ---
"X can do Y" can be taken as a statement of fact (to which "so what?" is an appropriate response), a desire (to which "then please say 'make X do Y' instead" is an appropriate response), or a report of a bug (to which "please explain why X should be forbidden from doing Y" is an appropriate response).
This is way under-explained. I think this is "make X do Y" kind, and if so, please say so and possibly why it is a good idea to teach X how to do Y.
Thanks.
Show 23 quoted lines
> diff.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/diff.c b/diff.c
> index 87b1bb2..2aefd0f 100644
> --- a/diff.c
> +++ b/diff.c
> @@ -473,11 +473,13 @@ static void emit_line_0(struct diff_options *o, const char *set, const char *res
> }
>
> if (len || !nofirst) {
> - fputs(set, file);
> + if (set)
> + fputs(set, file);
> if (!nofirst)
> fputc(first, file);
> fwrite(line, len, 1, file);
> - fputs(reset, file);
> + if (reset)
> + fputs(reset, file);
> }
> if (has_trailing_carriage_return)
> fputc('\r', file);