Re: [PATCH 07/19] diff.c: convert fn_out_consume to use emit_line_*
- From
Junio C Hamano <gitster@pobox.com>
- Date
- May 16, 2017, 01:05 UTC
- Message-ID
- <xmqqpof94nn2.fsf@gitster.mtv.corp.google.com>
- In-Reply-To
- <xmqqtw4l4nuk.fsf@gitster.mtv.corp.google.com>
Junio C Hamano <gitster@pobox.com> writes:
Show 10 quoted lines
>> - fprintf(o->file, "%s%s--- %s%s%s\n", >> - line_prefix, meta, ecbdata->label_path[0], reset, name_a_tab); >> - fprintf(o->file, "%s%s+++ %s%s%s\n", >> - line_prefix, meta, ecbdata->label_path[1], reset, name_b_tab); >> + emit_line_fmt(o, meta, reset, "--- %s%s\n", >> + ecbdata->label_path[0], name_a_tab); >> + emit_line_fmt(o, meta, reset, "+++ %s%s\n", >> + ecbdata->label_path[1], name_b_tab); > > How is the loss of line_prefix from this call site compensated?
OK, emit_line_0() has already been aware of line_prefix, so that is how the loss of line_prefix in the above is accounted for. We are good here.
Show 9 quoted lines
>> ecbdata->label_path[0] = ecbdata->label_path[1] = NULL;
>> }
>>
>> @@ -1349,7 +1346,7 @@ static void fn_out_consume(void *priv, char *line, unsigned long len)
>> diff_words_flush(ecbdata);
>> if (ecbdata->diff_words->type == DIFF_WORDS_PORCELAIN) {
>> emit_line(o, context, reset, line, len);
>> - fputs("~\n", o->file);
>> + emit_line(o, NULL, NULL, "~\n", 2);So unless we have some magic here, we would see an extra line-prefix before that "~\n" thing, no?
>> } else {
>> /*
>> * Skip the prefix character, if any. With