[PATCH/RFC] Add diff tests for trailing-space and now newline
From: Thell Fowler <hidden>
Date: 2016-06-15 22:47:13
Subsystem:
the rest · Maintainer:
Linus Torvalds
- Test each diff whitespace ignore option on trailing-space at eof Signed-off-by: Thell Fowler <redacted> --- Johannes Schindelin (Johannes.Schindelin@gmx.de) wrote on Aug 5, 2009:
On Tue, 4 Aug 2009, Thell Fowler wrote:quoted
mkdir test_ws_eof cd test_ws_eof git init echo -n "Test" > test.txt git add . git commit -m'test' git symbolic-ref HEAD refs/heads/with_space rm .git/index git clean -f echo -n "Test ">test.txt git add . git commit -m'test' # Ignoring all whitespace there shouldn't be a diff. git diff -w master -- test.txt # Ignoring space at eol there shouldn't be a diff git diff --ignore-space-at-eol master -- test.txt # Ignoring with -b might have a case for a diff showing. git diff -b master -- test.txtIf you turn that into a patch to, say, t/t4015-diff-whitespace.sh (adding a test_expect_failure for a known bug), it is much easier to convince developers to work on the issue.
Is this more along the right line? Thell t/t4015-diff-whitespace.sh | 23 +++++++++++++++++++++++ 1 files changed, 23 insertions(+), 0 deletions(-)
diff --git a/t/t4015-diff-whitespace.sh b/t/t4015-diff-whitespace.sh
index 6d13da3..fddbf20 100755
--- a/t/t4015-diff-whitespace.sh
+++ b/t/t4015-diff-whitespace.sh@@ -395,4 +395,27 @@ test_expect_success 'combined diff with autocrlf conversion' ' ' +test_expect_failure 'diff -w on trailing-space with no newline' ' + + git reset --hard && + printf "foo " >x && + git commit -m "trailing-space @ eof test" x && + printf "foo" >x && + git commit -m "trailing-space @ eof test" x && + test_must_pass git diff -w HEAD^ -- x | grep "foo " + +' + +test_expect_failure 'diff -b on trailing-space with no newline' ' + + test_must_pass git diff -b HEAD^ -- x | grep "foo " + +' + +test_expect_failure 'diff --ignore-space-at-eol on trailing-space with no newline' ' + + test_must_pass git diff -ignore-space-at-eol HEAD^ -- x | grep "foo " + +' + test_done
--
1.6.4.240.g4cd31