git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Rast <trast@student.ethz.ch>
To: Piotr Krukowiecki <piotr.krukowiecki@gmail.com>
Cc: Git Mailing List <git@vger.kernel.org>
Subject: Re: A better git diff --word-diff (--word-diff-regex) ?
Date: Mon, 19 Mar 2012 10:50:29 +0100	[thread overview]
Message-ID: <87ipi0vs0q.fsf@thomas.inf.ethz.ch> (raw)
In-Reply-To: <CAA01CsrJ12LmNYe6ujnDsZecJcGc8mFaB=1GC8-RZzvMYbYuUw@mail.gmail.com> (Piotr Krukowiecki's message of "Mon, 19 Mar 2012 10:44:31 +0100")

Piotr Krukowiecki <piotr.krukowiecki@gmail.com> writes:

> is there a way to configure --word-diff to be a more programming
> language friendly? For example if I add one parameter to a function
> declaration, I'd like to see only the addition of the parameter as the
> change. But currently it shows much more.
>
> For example if
>   void foo(int x);
> is changed to
>   void foo(int x, int y);
> I'd like to see only ",int y" as the change, not "x, int y);".
>
> I think I'd like to ignore all white spaces and tokenize text on word
> boundaries and see the diff between the tokens. This way if I e.g. add
> a missing ";" it'll be shown as the only change.

Umm, what's wrong with

  echo '*.cpp diff=cpp' >>.git/info/attributes

Ok, the funcname patterns aren't so good, but the word regex is designed
to "tokenize" as far as that is feasible.

-- 
Thomas Rast
trast@{inf,student}.ethz.ch

  parent reply	other threads:[~2012-03-19  9:50 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-19  9:44 A better git diff --word-diff (--word-diff-regex) ? Piotr Krukowiecki
2012-03-19  9:47 ` Matthieu Moy
2012-03-19 16:54   ` Piotr Krukowiecki
2012-03-19  9:50 ` Thomas Rast [this message]
2012-03-19 17:06   ` Piotr Krukowiecki
2012-03-19  9:58 ` Johannes Sixt
2012-03-19 15:10 ` 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

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

  git send-email \
    --in-reply-to=87ipi0vs0q.fsf@thomas.inf.ethz.ch \
    --to=trast@student.ethz.ch \
    --cc=git@vger.kernel.org \
    --cc=piotr.krukowiecki@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.
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).