git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Jeff King <peff@peff.net>
To: Thomas Rast <trast@inf.ethz.ch>
Cc: Mark Abraham <mark.j.abraham@gmail.com>,
	git@vger.kernel.org, Junio C Hamano <gitster@pobox.com>
Subject: Re: [PATCH] git-add--interactive.perl: Permit word-based diff
Date: Tue, 18 Jun 2013 13:23:22 -0400	[thread overview]
Message-ID: <20130618172300.GA3557@sigill.intra.peff.net> (raw)
In-Reply-To: <87k3lrzxw7.fsf@hexa.v.cablecom.net>

On Tue, Jun 18, 2013 at 09:22:16AM +0200, Thomas Rast wrote:

> [I don't seem to have received a copy of the original mail, so I can
> only guess...]

Yes, the original doesn't seem to have made it to the list. Sorry, I
don't have a copy (I am in the habit of deleting direct mails that are
cc'd to the list, as I keep a separate list archive).

Mark, did you happen to send an HTML mail? The list will silently
reject such mail.

> > Note that the number of lines in your --word-diff=color hunk and the
> > actual diff will not necessarily be the same.  What happens if I split a
> > hunk with your patch?
> 
> If it's actually what you hint at, there's another problem: the word
> diff might not even have the same number of hunks.  For example, a
> long-standing bug (or feature, depending on POV) of word-diff is that it
> does not take opportunities to completely drop hunks that did not make
> any word-level changes.

Yeah, I didn't even think of that.

In general, I think one can assume 1-to-1 correspondence between whole
regular diffs and whole word-diffs, but not below that (i.e., neither a
correspondence between hunks nor between lines).

With something like contrib/diff-highlight, you get some decoration, and
can assume a 1-to-1 line correspondence.

However, I think that when reviewing text (especially re-wrapped
paragraphs) that word-diff can be much easier to read, _because_ it
throws away the line correspondence. To be correct, though, I think we
would have to simply show the whole word-diff for a file and say "is
this OK?". Which sort of defeats the purpose of "add -p" as a hunk
selector (you could just as easily run "git diff --color-words foo" and
"git add foo"). But it does save keystrokes if your workflow is to
simply "add -p" everything to double-check it before adding.

So I dunno. I could see myself using it, but I certainly wouldn't want a
config variable that turns it on all the time (which is what the
original patch did).

-Peff

  reply	other threads:[~2013-06-18 17:23 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CAMNuMARruu+1=kny=g5O1MoxCXuoT3BHdSEEPSqvyn2t2JsAYg@mail.gmail.com>
2013-06-18  6:31 ` [PATCH] git-add--interactive.perl: Permit word-based diff Jeff King
2013-06-18  7:22   ` Thomas Rast
2013-06-18 17:23     ` Jeff King [this message]
2013-06-18 21:12       ` Mark Abraham
2013-06-18 22:47         ` Jeff King

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=20130618172300.GA3557@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=mark.j.abraham@gmail.com \
    --cc=trast@inf.ethz.ch \
    /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).