git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Ramsay Jones <ramsay@ramsayjones.plus.com>
Cc: Stefan Beller <stefanbeller@gmail.com>,
	git@vger.kernel.org, jnareb@gmail.com, jacob.keller@gmail.com,
	Stefan Beller <sbeller@google.com>
Subject: Re: [PATCHv4] diff.c: emit moved lines with a different color
Date: Wed, 07 Sep 2016 11:52:19 -0700	[thread overview]
Message-ID: <xmqqvay7lezg.fsf@gitster.mtv.corp.google.com> (raw)
In-Reply-To: <87a1ddbf-2499-d5b4-55c4-aeed2b72acce@ramsayjones.plus.com> (Ramsay Jones's message of "Tue, 6 Sep 2016 14:37:41 +0100")

Ramsay Jones <ramsay@ramsayjones.plus.com> writes:

>> +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.


  reply	other threads:[~2016-09-07 18:52 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-06  7:01 [PATCHv4] diff.c: emit moved lines with a different color Stefan Beller
2016-09-06 13:37 ` Ramsay Jones
2016-09-07 18:52   ` Junio C Hamano [this message]
2016-09-06 14:05 ` Jakub Narębski
2016-09-06 17:03   ` Stefan Beller
2016-09-06 17:51     ` Jakub Narębski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqqvay7lezg.fsf@gitster.mtv.corp.google.com \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=jacob.keller@gmail.com \
    --cc=jnareb@gmail.com \
    --cc=ramsay@ramsayjones.plus.com \
    --cc=sbeller@google.com \
    --cc=stefanbeller@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).