Subject: Re: [PATCH] Document disabling core.whitespace values trailing-space and space-before-tab

From: "Peter Valdemar Mørch (Lists)" <[email-masked]>
Date: Fri, 25 Jul 2008 08:13:17 +0200

> So I think Peter's patch is going in the right direction.

Thus encouraged, I've created a file with two more patches like I
described in my previous mail: one that fixes up .gitattributes and one
that fixes up t/* to conform to documented syntax of core.whitespace.

(For the future: Is it better to have one file with tree patches like I
have created with "git format-patch -M -s --stdout", 3 individual 
numbered files, or one single patch created with git-merge --squash?)

Peter
-- 
Peter Valdemar Mørch
http://www.morch.com
>>From 900455ce5a4e8bf771aea2e3dbdbab38e440cdf4 Mon Sep 17 00:00:00 2001
From: =?utf-8?q?Peter=20Valdemar=20M=C3=B8rch?= <[email-masked]>
Date: Thu, 24 Jul 2008 07:18:48 +0200
Subject: [PATCH] Document disabling core.whitespace values trailing-space and space-before-tab
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Peter Valdemar Mørch <[email-masked]>
---
 Documentation/config.txt |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/Documentation/config.txt b/Documentation/config.txt
index e784805..a198b3c 100644
--- a/Documentation/config.txt
+++ b/Documentation/config.txt
@@ -361,10 +361,12 @@ core.whitespace::
 	consider them as errors:
 +
 * `trailing-space` treats trailing whitespaces at the end of the line
-  as an error (enabled by default).
+  as an error (enabled by default - disable with 'git config core.whitespace
+  "-trailing-space"').
 * `space-before-tab` treats a space character that appears immediately
   before a tab character in the initial indent part of the line as an
-  error (enabled by default).
+  error (enabled by default - disable with 'git config core.whitespace
+  "-space-before-tab"').
 * `indent-with-non-tab` treats a line that is indented with 8 or more
   space characters as an error (not enabled by default).
 * `cr-at-eol` treats a carriage-return at the end of line as
-- 
1.5.6

>>From c73dd588bef2a56fc44af2ce10cedef1b779a510 Mon Sep 17 00:00:00 2001
From: =?utf-8?q?Peter=20Valdemar=20M=C3=B8rch?= <[email-masked]>
Date: Fri, 25 Jul 2008 07:33:07 +0200
Subject: [PATCH] Fixed up .gitattributes to allign with git-config.1
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Peter Valdemar Mørch <[email-masked]>
---
 .gitattributes |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/.gitattributes b/.gitattributes
index 6b9c715..1a903b6 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -1,2 +1,2 @@
-* whitespace=!indent,trail,space
-*.[ch] whitespace
+* whitespace=-indent-with-non-tab,trailing-space,space-before-tab
+*.[ch] !whitespace
-- 
1.5.6

>>From 45889568fec2b952e10aef2fac78ba6dfda9f46d Mon Sep 17 00:00:00 2001
From: =?utf-8?q?Peter=20Valdemar=20M=C3=B8rch?= <[email-masked]>
Date: Fri, 25 Jul 2008 07:59:24 +0200
Subject: [PATCH] tests now use git-config's core.whitespace only with documented values
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Peter Valdemar Mørch <[email-masked]>
---
 t/t4019-diff-wserror.sh  |   14 +++++++-------
 t/t4124-apply-ws-rule.sh |    4 ++--
 2 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/t/t4019-diff-wserror.sh b/t/t4019-diff-wserror.sh
index 0d9cbb6..ecff30d 100755
--- a/t/t4019-diff-wserror.sh
+++ b/t/t4019-diff-wserror.sh
@@ -33,9 +33,9 @@ test_expect_success default '
 
 '
 
-test_expect_success 'without -trail' '
+test_expect_success 'without -trailing-space' '
 
-	git config core.whitespace -trail
+	git config core.whitespace -trailing-space
 	git diff --color >output
 	grep "$blue_grep" output >error
 	grep -v "$blue_grep" output >normal
@@ -48,10 +48,10 @@ test_expect_success 'without -trail' '
 
 '
 
-test_expect_success 'without -trail (attribute)' '
+test_expect_success 'without -trailing-space (attribute)' '
 
 	git config --unset core.whitespace
-	echo "F whitespace=-trail" >.gitattributes
+	echo "F whitespace=-trailing-space" >.gitattributes
 	git diff --color >output
 	grep "$blue_grep" output >error
 	grep -v "$blue_grep" output >normal
@@ -99,7 +99,7 @@ test_expect_success 'without -space (attribute)' '
 test_expect_success 'with indent-non-tab only' '
 
 	rm -f .gitattributes
-	git config core.whitespace indent,-trailing,-space
+	git config core.whitespace indent-with-non-tab,-trailing-space,-space-before-tab
 	git diff --color >output
 	grep "$blue_grep" output >error
 	grep -v "$blue_grep" output >normal
@@ -115,7 +115,7 @@ test_expect_success 'with indent-non-tab only' '
 test_expect_success 'with indent-non-tab only (attribute)' '
 
 	git config --unset core.whitespace
-	echo "F whitespace=indent,-trailing,-space" >.gitattributes
+	echo "F whitespace=indent-with-non-tab,-trailing-space,-space-before-tab" >.gitattributes
 	git diff --color >output
 	grep "$blue_grep" output >error
 	grep -v "$blue_grep" output >normal
@@ -147,7 +147,7 @@ test_expect_success 'with cr-at-eol' '
 test_expect_success 'with cr-at-eol (attribute)' '
 
 	git config --unset core.whitespace
-	echo "F whitespace=trailing,cr-at-eol" >.gitattributes
+	echo "F whitespace=trailing-space,cr-at-eol" >.gitattributes
 	git diff --color >output
 	grep "$blue_grep" output >error
 	grep -v "$blue_grep" output >normal
diff --git a/t/t4124-apply-ws-rule.sh b/t/t4124-apply-ws-rule.sh
index 85f3da2..644aadc 100755
--- a/t/t4124-apply-ws-rule.sh
+++ b/t/t4124-apply-ws-rule.sh
@@ -106,7 +106,7 @@ test_expect_success 'whitespace=error-all, default rule' '
 
 test_expect_success 'whitespace=error-all, no rule' '
 
-	git config core.whitespace -trailing,-space-before,-indent &&
+	git config core.whitespace -trailing-space,-space-before-tab,-indent-with-non-tab &&
 	apply_patch --whitespace=error-all &&
 	diff file target
 
@@ -130,7 +130,7 @@ do
 		for i in - ''
 		do
 			case "$i" in '') ti='#' ;; *) ti= ;; esac
-			rule=${t}trailing,${s}space,${i}indent
+			rule=${t}trailing-space,${s}space-before-tab,${i}indent-with-non-tab
 
 			rm -f .gitattributes
 			test_expect_success "rule=$rule" '
-- 
1.5.6