git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* A better git diff --word-diff (--word-diff-regex) ?
@ 2012-03-19  9:44 Piotr Krukowiecki
  2012-03-19  9:47 ` Matthieu Moy
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Piotr Krukowiecki @ 2012-03-19  9:44 UTC (permalink / raw)
  To: Git Mailing List

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

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2012-03-19 17:06 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2012-03-19 15:10 ` Jeff King

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).