git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 3/6] whitespace: tests for git-diff --check with tab-in-indent error class

From
Chris Webb <chris@arachsys.com>
Date
Apr 2, 2010, 23:37 UTC
Message-ID
<7a8a7a4054abc1f478c1d0faf025b033c598e812.1270250437.git.chris@arachsys.com>
In-Reply-To
<cover.1270250437.git.chris@arachsys.com>
Signed-off-by: Chris Webb <chris@arachsys.com>
---
 t/t4015-diff-whitespace.sh |   42 ++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 42 insertions(+), 0 deletions(-)
diff --git a/t/t4015-diff-whitespace.sh b/t/t4015-diff-whitespace.sh
index 90f3342..9e57f80 100755
--- a/t/t4015-diff-whitespace.sh
+++ b/t/t4015-diff-whitespace.sh
@@ -352,6 +352,48 @@ test_expect_success 'check tabs and spaces as indentation (indent-with-non-tab:
 
 '
 
+test_expect_success 'check tabs as indentation (tab-in-indent: off)' '
+
+	git config core.whitespace "-tab-in-indent"
+	echo "	foo ();" > x &&
+	git diff --check
+
+'
+
+test_expect_success 'check tabs as indentation (tab-in-indent: on)' '
+
+	git config core.whitespace "tab-in-indent" &&
+	echo "	foo ();" > x &&
+	test_must_fail git diff --check
+
+'
+
+test_expect_success 'check tabs and spaces as indentation (tab-in-indent: on)' '
+
+	git config core.whitespace "tab-in-indent" &&
+	echo "	                foo ();" > x &&
+	test_must_fail git diff --check
+
+'
+
+test_expect_success 'check tab-in-indent and indent-with-non-tab conflict' '
+
+	git config core.whitespace "tab-in-indent,indent-with-non-tab"
+	echo "foo ();" > x &&
+	test_must_fail git diff --check
+
+'
+
+test_expect_success 'check tab-in-indent excluded from wildcard whitespace attribute' '
+
+	git config --unset core.whitespace
+	echo "x whitespace" > .gitattributes &&
+	echo "	  foo ();" > x &&
+	git diff --check &&
+	rm -f .gitattributes
+
+'
+
 test_expect_success 'line numbers in --check output are correct' '
 
 	echo "" > x &&
-- 
1.7.0.3
Previous: Martin MaresNext: Chris Webb
Message 5 of 8 in “Add tab-in-indent whitespace rule”
  1. 0/6 Add tab-in-indent whitespace ruleChris Webb, Apr 2, 2010
  2. 1/6 whitespace: we cannot "catch all errors known to git" anymoreChris Webb, Apr 2, 2010
  3. 2/6 whitespace: add tab-in-indent error classChris Webb, Apr 2, 2010
  4. Martin MaresApr 3, 2010
  5. 3/6 whitespace: tests for git-diff --check with tab-in-indent error classChris Webb, Apr 2, 2010
  6. 4/6 whitespace: replumb ws_fix_copy to take a strbuf *dst instead of char *dstChris Webb, Apr 2, 2010
  7. 5/6 whitespace: add tab-in-indent support for --whitespace=fixChris Webb, Apr 2, 2010
  8. 6/6 whitespace: tests for git-apply --whitespace=fix with tab-in-indentChris Webb, Apr 2, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.