Re: [PATCHv4] diff.c: emit moved lines with a different color
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Sep 7, 2016, 18:52 UTC
- Message-ID
- <xmqqvay7lezg.fsf@gitster.mtv.corp.google.com>
- In-Reply-To
- <87a1ddbf-2499-d5b4-55c4-aeed2b72acce@ramsayjones.plus.com>
Ramsay Jones <ramsay@ramsayjones.plus.com> writes:
Show 15 quoted lines
>> +static int diff_line_moved_entry_cmp(const struct diff_line_moved_entry *a,
>> + const struct diff_line_moved_entry *b,
>> + const void *unused)
>> +{
>> + return strcmp(a->line, b->line) &&
>> + a->hash_prev_line == b->hash_prev_line;
>
> I doubt it would make much difference, but my knee-jerk reaction to
> this was to suggest swapping the order of the expression, thus:
>
> return a->hash_prev_line == b->hash_prev_line &&
> strcmp(a->line, b->line);
>
> ... but perhaps it doesn't read quite so well, and probably wouldn't affect
> performance much (except in strange edge cases), so it may not be worth it.It would make very much sense to do so, as the final version will be a lot more involved than a mere strcmp() to make "git diff -w" to also work as expected with this new feature.