git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johannes Sixt <j.sixt@viscovery.net>
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:58:19 +0100	[thread overview]
Message-ID: <4F67033B.2060904@viscovery.net> (raw)
In-Reply-To: <CAA01CsrJ12LmNYe6ujnDsZecJcGc8mFaB=1GC8-RZzvMYbYuUw@mail.gmail.com>

Am 3/19/2012 10:44, schrieb Piotr Krukowiecki:
> 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.

Start with

   git config diff.wordregex '[[:alnum:]]+|[^[:space:]]'

Adjust to your likings.

-- Hannes

  parent reply	other threads:[~2012-03-19  9:58 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
2012-03-19 17:06   ` Piotr Krukowiecki
2012-03-19  9:58 ` Johannes Sixt [this message]
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=4F67033B.2060904@viscovery.net \
    --to=j.sixt@viscovery.net \
    --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).