{"thread":{"id":"43510","subject":"Re: [PATCH] Document git-diff whitespace flags -b and -w","startedAt":"2006-12-03T16:24:41Z","lastAt":"2006-12-04T09:00:55Z","messageCount":6,"participants":["Johannes Schindelin","Jakub Narebski","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"297370","messageId":"11651630814064-git-send-email-jnareb@gmail.com","threadId":"43510","inReplyTo":null,"subject":"[PATCH] Document git-diff whitespace flags -b and -w","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2006-12-03T16:24:41Z","receivedAt":"2006-12-03T16:24:41Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Document git diff options -b / --ignore-space-change and\n-w / --ignore-all-space, introduced by Johannes Schindelin\nin commit 0d21efa51cc7de5250d5da46bceacda78ba35373:\n  \"Teach diff about -b and -w flags\".\n\nThe description of options is taken from GNU diff man page and\nGNU Diffutils info documentation.\n\nSigned-off-by: Jakub Narebski <jnareb@gmail.com>\n---\nInspired by kblin (Kai Blin) asking on #git about git-diff option to\nignore whitespace only change.\n\n Documentation/diff-options.txt |   16 ++++++++++++++++\n 1 files changed, 16 insertions(+), 0 deletions(-)\n\ndiff --git a/Documentation/diff-options.txt b/Documentation/diff-options.txt\nindex e112172..9cdd171 100644\n--- a/Documentation/diff-options.txt\n+++ b/Documentation/diff-options.txt\n@@ -129,5 +129,21 @@\n -a::\n \tShorthand for \"--text\".\n \n+--ignore-space-change::\n+\tIgnore changes in amount of white space.  This ignores white\n+\tspace at line end, and consider all other sequences of one or\n+\tmore white space characters to be equivalent.\n+\n+-b::\n+\tShorthand for \"--ignore-space-change\".\n+\n+--ignore-all-space::\n+\tIgnore white space when comparing lines.  This ignores\n+\tdifference even if one line has white space where the other\n+\tline has none.\n+\n+-w::\n+\tShorthand for \"--ignore-all-space\".\n+\n For more detailed explanation on these common options, see also\n link:diffcore.html[diffcore documentation].\n-- \n1.4.4.1\n"},{"id":"297098","messageId":"Pine.LNX.4.63.0612031908020.28348@wbgn013.biozentrum.uni-wuerzburg.de","threadId":"43510","inReplyTo":"11651630814064-git-send-email-jnareb@gmail.com","subject":"Re: [PATCH] Document git-diff whitespace flags -b and -w","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2006-12-03T18:25:34Z","receivedAt":"2006-12-03T18:25:34Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Sun, 3 Dec 2006, Jakub Narebski wrote:\n\n> +--ignore-space-change::\n> +\tIgnore changes in amount of white space.  This ignores white\n> +\tspace at line end, and consider all other sequences of one or\n> +\tmore white space characters to be equivalent.\n\nThank you for bringing this up. The latter part is correct, but the first \npart not yet. I asked at the time if somebody cares, but got no answer, so \n\"-b\" does _not_ ignore white space at the end of line ATM, but only white \nspace change. So here is a patch to fix that behaviour:\n\n-- snip --\ndiff -b: ignore whitespace at end of line\n\nThis is _not_ the same as \"treat eol as whitespace\", since that would mean \nthat multiple empty lines would be treated as equal to e.g. a space.\n\n---\ndiff --git a/xdiff/xutils.c b/xdiff/xutils.c\nindex 9e4bb47..1b899f3 100644\n--- a/xdiff/xutils.c\n+++ b/xdiff/xutils.c\n@@ -230,7 +230,8 @@ unsigned long xdl_hash_record(char const **data, char const *top, long flags) {\n \t\t\twhile (ptr + 1 < top && isspace(ptr[1])\n \t\t\t\t\t&& ptr[1] != '\\n')\n \t\t\t\tptr++;\n-\t\t\tif (flags & XDF_IGNORE_WHITESPACE_CHANGE) {\n+\t\t\tif (flags & XDF_IGNORE_WHITESPACE_CHANGE\n+\t\t\t\t\t&& ptr[1] != '\\n') {\n \t\t\t\tha += (ha << 5);\n \t\t\t\tha ^= (unsigned long) ' ';\n \t\t\t}\n\n"},{"id":"296472","messageId":"ekv5k6$1ih$1@sea.gmane.org","threadId":"43510","inReplyTo":"Pine.LNX.4.63.0612031908020.28348@wbgn013.biozentrum.uni-wuerzburg.de","subject":"Re: [PATCH] Document git-diff whitespace flags -b and -w","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2006-12-03T18:38:55Z","receivedAt":"2006-12-03T18:38:55Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Johannes Schindelin wrote:\n\n> On Sun, 3 Dec 2006, Jakub Narebski wrote:\n> \n>> +--ignore-space-change::\n>> +    Ignore changes in amount of white space.  This ignores white\n>> +    space at line end, and consider all other sequences of one or\n>> +    more white space characters to be equivalent.\n> \n> Thank you for bringing this up. The latter part is correct, but the first \n> part not yet. I asked at the time if somebody cares, but got no answer, so \n> \"-b\" does _not_ ignore white space at the end of line ATM, but only white \n> space change. So here is a patch to fix that behaviour:\n\nAlternate solution would be to fix documentation, to document existing code.\nI used GNU diff documentation, perhaps it is better if we are GNU diff\ncompatibile...\n-- \nJakub Narebski\nWarsaw, Poland\nShadeHawk on #git\n\n"},{"id":"295216","messageId":"Pine.LNX.4.63.0612032006580.28348@wbgn013.biozentrum.uni-wuerzburg.de","threadId":"43510","inReplyTo":"ekv5k6$1ih$1@sea.gmane.org","subject":"Re: [PATCH] Document git-diff whitespace flags -b and -w","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2006-12-03T19:10:10Z","receivedAt":"2006-12-03T19:10:10Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Sun, 3 Dec 2006, Jakub Narebski wrote:\n\n> Alternate solution would be to fix documentation, to document existing \n> code. I used GNU diff documentation, perhaps it is better if we are GNU \n> diff compatibile...\n\nSince the whole point of \"-w/-b\" is to steal the nice feature from GNU \ndiff, it does not make any sense breaking compatibility.\n\nBTW on top of my patch you need this, if you want the tests to pass \n(danger ahead: intentional white space at eol):\n\n-- snip --\nmake tests pass for recent \"diff -b\" change\n\n---\n\n\tAm I the only one finding it funny to read diffs of diffs, \n\tespecially when being used to combined diffs?\n\ndiff --git a/t/t4015-diff-whitespace.sh b/t/t4015-diff-whitespace.sh\nindex 1bc5b7a..adf4993 100755\n--- a/t/t4015-diff-whitespace.sh\n+++ b/t/t4015-diff-whitespace.sh\n@@ -109,12 +109,10 @@ index d99af23..8b32fb5 100644\n +\twhitespace at beginning\n  whitespace change\n -whitespace in the middle\n--whitespace at end\n +white space in the middle\n-+whitespace at end  \n+ whitespace at end\n  unchanged line\n--CR at endQ\n-+CR at end\n+ CR at endQ\n EOF\n git-diff -b > out\n"},{"id":"296771","messageId":"7vvekstn9t.fsf@assigned-by-dhcp.cox.net","threadId":"43510","inReplyTo":"Pine.LNX.4.63.0612032006580.28348@wbgn013.biozentrum.uni-wuerzburg.de","subject":"Re: [PATCH] Document git-diff whitespace flags -b and -w","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-12-04T02:20:30Z","receivedAt":"2006-12-04T02:20:30Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:\n\n> make tests pass for recent \"diff -b\" change\n\nBoth patches look sane.  Thanks.  Mind if I forge your\nsignature?\n\n> \tAm I the only one finding it funny to read diffs of diffs, \n> \tespecially when being used to combined diffs?\n\nI agree that it is very hard to get used to.\n"},{"id":"297789","messageId":"Pine.LNX.4.63.0612041000130.28348@wbgn013.biozentrum.uni-wuerzburg.de","threadId":"43510","inReplyTo":"7vvekstn9t.fsf@assigned-by-dhcp.cox.net","subject":"Re: [PATCH] Document git-diff whitespace flags -b and -w","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2006-12-04T09:00:55Z","receivedAt":"2006-12-04T09:00:55Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Sun, 3 Dec 2006, Junio C Hamano wrote:\n\n> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:\n> \n> > make tests pass for recent \"diff -b\" change\n> \n> Both patches look sane.  Thanks.  Mind if I forge your\n> signature?\n\nNot at all. I forget it, you forge it.\n\nCiao,\nDscho\n"}]}