@matheusbsbs / matheus-bagliano / commits / c7c24889bb
Fork 0

diff -b: ignore whitespace at end of line

This is _not_ the same as "treat eol as whitespace", since that would mean that multiple empty lines would be treated as equal to e.g. a space. Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de> Signed-off-by: Junio C Hamano <junkio@cox.net>

Johannes Schindelin committed Dec 3, 2006 at 19:25 UTC c7c24889bb694f93a12f41a28fab26d30e571c17
2 files changed +4 -5
t/t4015-diff-whitespace.sh
+2 -4
@@ -109,12 +109,10 @@ index d99af23..8b32fb5 100644
109 + whitespace at beginning
110 whitespace change
111 -whitespace in the middle
112 --whitespace at end
112 +white space in the middle
114 -+whitespace at end
113 + whitespace at end
114 unchanged line
116 --CR at endQ
117 -+CR at end
115 + CR at endQ
116 EOF
117 git-diff -b > out
118 test_expect_success 'another test, with -b' 'diff -u expect out'
xdiff/xutils.c
+2 -1
@@ -230,7 +230,8 @@ unsigned long xdl_hash_record(char const **data, char const *top, long flags) {
230 while (ptr + 1 < top && isspace(ptr[1])
231 && ptr[1] != '\n')
232 ptr++;
233 - if (flags & XDF_IGNORE_WHITESPACE_CHANGE) {
233 + if (flags & XDF_IGNORE_WHITESPACE_CHANGE
234 + && ptr[1] != '\n') {
235 ha += (ha << 5);
236 ha ^= (unsigned long) ' ';
237 }