Re: A better git diff --word-diff (--word-diff-regex) ?

2 messages, 2 authors, 2016-06-15 · open the first message on its own page

Re: A better git diff --word-diff (--word-diff-regex) ?

From: Thomas Rast <hidden>
Date: 2016-06-15 22:53:20

Piotr Krukowiecki [off-list ref] 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

Re: A better git diff --word-diff (--word-diff-regex) ?

From: Piotr Krukowiecki <hidden>
Date: 2016-06-15 22:53:20

On Mon, Mar 19, 2012 at 10:50 AM, Thomas Rast [off-list ref] wrote:
Piotr Krukowiecki [off-list ref] writes:
quoted
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.
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.
Thanks, that's very good! I've missed it reading the git-diff man page.

-- 
Piotr Krukowiecki
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help