Re: Use a *real* built-in diff generator
From: Junio C Hamano <hidden>
Date: 2016-06-15 22:42:22
Linus Torvalds [off-list ref] writes:
This uses a simplified libxdiff setup to generate unified diffs _without_ doing fork/execve of GNU "diff".
Good stuff.
Now, in the interest of full disclosure, I should also point out a few downsides: - the libxdiff algorithm is different,... - GNU diff does some nice eye-candy, like trying to figure out what the last function was, and adding that information to the "@@ .." line. libxdiff doesn't do that.
That's kind of sad --- Documentation/SubmittingPatches request people to say "diff -u -p".
- The libxdiff thing has some known deficiencies. In particular, it gets the "\No newline at end of file" case wrong. So this is currently for the experimental branch only. I hope Davide will help fix it.
Another thing I noticed is that while libxdiff always shows full line counts "-n,m +l,k" GNU seems to omit them when it can (m,k <=1). I am not sure if apply.c is set up to grok what libxdiff emits correctly. Running t/t1200 shows some obvious examples.