Re: [PATCH 11/26] diff.c: emit_diff_symbol learns DIFF_SYMBOL_FILEPAIR
- From
Stefan Beller <sbeller@google.com>
- Date
- Jun 22, 2017, 23:59 UTC
- Message-ID
- <CAGZ79kZPcQd8oy2Q23v3vN9h667fu+SYjQ8ttDxgoRmH80QQzg@mail.gmail.com>
- In-Reply-To
- <xmqqvanpnlva.fsf@gitster.mtv.corp.google.com>
On Wed, Jun 21, 2017 at 1:09 PM, Junio C Hamano <gitster@pobox.com> wrote:
Show 28 quoted lines
> Jonathan Tan <jonathantanmy@google.com> writes: > >> On Mon, 19 Jun 2017 19:48:01 -0700 >> Stefan Beller <sbeller@google.com> wrote: >> >>> @@ -676,6 +677,14 @@ static void emit_diff_symbol(struct diff_options *o, enum diff_symbol s, >>> } >>> emit_line(o, context, reset, line, len); >>> break; >>> + case DIFF_SYMBOL_FILEPAIR: >>> + meta = diff_get_color_opt(o, DIFF_METAINFO); >>> + reset = diff_get_color_opt(o, DIFF_RESET); >>> + fprintf(o->file, "%s%s%s%s%s%s\n", diff_line_prefix(o), meta, >>> + flags ? "+++ " : "--- ", >> >> I think that a constant should be defined for this flag, just like for >> content lines. If not it is not immediately obvious that a flag should >> be set for the +++ lines. > > True. > >>> + line, reset, >>> + strchr(line, ' ') ? "\t" : ""); >>> + break; > > Also this is somewhat misnamed in that a call to it only deals with > one half of a filepair, iow, the caller must call it twice to show a > single filepair.
Split into two and renamed to DIFF_SYMBOL_FILEPAIR_PLUS and DIFF_SYMBOL_FILEPAIR_MINUS.
Thanks, Stefan