From: Piotr Krukowiecki <piotr.krukowiecki@gmail.com>
To: Git Mailing List <git@vger.kernel.org>
Subject: A better git diff --word-diff (--word-diff-regex) ?
Date: Mon, 19 Mar 2012 10:44:31 +0100 [thread overview]
Message-ID: <CAA01CsrJ12LmNYe6ujnDsZecJcGc8mFaB=1GC8-RZzvMYbYuUw@mail.gmail.com> (raw)
Hi,
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.
$ echo 'void foo(int x);' > foo.c && git add foo.c && git commit -m "foo"
[master (root-commit) 5af60cb2] foo
1 files changed, 1 insertions(+), 0 deletions(-)
create mode 100644 foo.c
$ echo 'void foo(int x, int y);' > foo.c && git diff --word-diff
diff --git a/foo.c b/foo.c
index 42a5d4e9..289eb233 100644
--- a/foo.c
+++ b/foo.c
@@ -1 +1 @@
void foo(int [-x);-]{+x, int y);+}
Thanks,
--
Piotr Krukowiecki
next reply other threads:[~2012-03-19 9:44 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-19 9:44 Piotr Krukowiecki [this message]
2012-03-19 9:47 ` A better git diff --word-diff (--word-diff-regex) ? 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
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='CAA01CsrJ12LmNYe6ujnDsZecJcGc8mFaB=1GC8-RZzvMYbYuUw@mail.gmail.com' \
--to=piotr.krukowiecki@gmail.com \
--cc=git@vger.kernel.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).