git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: Valentin Haenel <valentin@fsfe.org>
Cc: Git-List <git@vger.kernel.org>
Subject: Re: [QUESTION] '--color-words' for 'git add -p'?
Date: Fri, 29 Apr 2011 18:38:14 -0400	[thread overview]
Message-ID: <20110429223814.GB3434@sigill.intra.peff.net> (raw)
In-Reply-To: <20110429164210.GA14937@kudu.in-berlin.de>

On Fri, Apr 29, 2011 at 06:42:10PM +0200, Valentin Haenel wrote:

> is it possible to use some kind of magic to get 'git add -p' to display
> diff with '--color-words' option? I tried GIT_DIFF_OPTS but w/o success.

No, it's not currently. The output of --color-words cannot be applied as
a patch, so we would have to do something like diff an extra time, match
up the hunks, show the user one hunk, and then apply the other.

In fact, that is what we already do to get color at all. It works very
well there, since we know the hunks will match exactly. I'm not 100%
sure, though, that color-words will produce exactly the same set of
hunks that a regular line-oriented diff will. Which would be a problem.

-Peff

      reply	other threads:[~2011-04-29 22:38 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-29 16:42 [QUESTION] '--color-words' for 'git add -p'? Valentin Haenel
2011-04-29 22:38 ` Jeff King [this message]

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

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

  git send-email \
    --in-reply-to=20110429223814.GB3434@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    --cc=valentin@fsfe.org \
    /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.
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 NNTP newsgroup(s).