{"thread":{"id":"14652","subject":"[PATCH] Document disabling core.whitespace values trailing-space and space-before-tab","startedAt":"2008-07-24T05:34:06Z","lastAt":"2008-07-25T08:49:43Z","messageCount":8,"participants":["Peter Valdemar Mørch (Lists)","Nanako Shiraishi","Junio C Hamano","Peter Valdemar Mørch"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"84672","messageId":"4888144E.8090300@sneakemail.com","threadId":"14652","inReplyTo":null,"subject":"[PATCH] Document disabling core.whitespace values trailing-space and space-before-tab","fromName":"Peter Valdemar Mørch (Lists)","fromEmail":"4ux6as402@sneakemail.com","sentAt":"2008-07-24T05:34:06Z","receivedAt":"2008-07-24T05:34:06Z","isPatch":true,"sender":{"key":"4ux6as402@sneakemail.com","avatar":null},"body":" From http://article.gmane.org/gmane.comp.version-control.git/68146 I got\nthe syntax that works:\n\ngit config core.whitespace \"-trailing-space\"\n\nIs it me, or is this not readable from git help config which says:\n\n> A comma separated list of common whitespace problems to notice.  git \n> diff will use color.diff.whitespace to highlight them, and git apply \n> --whitespace=error will consider them as errors:\n> \n> ·   trailing-space treats trailing whitespaces at the end of the line\n> as an error (enabled by default).\n\nThe '-trailing-space' syntax to disable the trailing-space setting is \nnot obvious and not documented as far as I can see. I would have assumed \na value of '' would disable it.\n\nIs there a documentation bug here? If so, I suggest this patch. I didn't \nfind anywhere else where the '-setting' syntax was used to disable \nsomething.\n\nMy first-ever git patch is attached, because Thunderbird messes up due \nto wrapping. I realize that SubmittingPatches has a mini-guide for \nreconfiguring Thunderbird (ver 1!), but I really prefer not to have to \nadd extensions and reconfigure Thunderbird to send patches. (Comments to \nthis and how the patch was made are welcome and encouraged)\n\nPeter\n\n\n-- \nPeter Valdemar Mørch\nhttp://www.morch.com\n\n\n>From 900455ce5a4e8bf771aea2e3dbdbab38e440cdf4 Mon Sep 17 00:00:00 2001\nFrom: =?utf-8?q?Peter=20Valdemar=20M=C3=B8rch?= <peter@morch.com>\nDate: Thu, 24 Jul 2008 07:18:48 +0200\nSubject: [PATCH] Document disabling core.whitespace values trailing-space and space-before-tab\nMIME-Version: 1.0\nContent-Type: text/plain; charset=utf-8\nContent-Transfer-Encoding: 8bit\n\n\nSigned-off-by: Peter Valdemar Mørch <peter@morch.com>\n---\n Documentation/config.txt |    6 ++++--\n 1 files changed, 4 insertions(+), 2 deletions(-)\n\ndiff --git a/Documentation/config.txt b/Documentation/config.txt\nindex e784805..a198b3c 100644\n--- a/Documentation/config.txt\n+++ b/Documentation/config.txt\n@@ -361,10 +361,12 @@ core.whitespace::\n \tconsider them as errors:\n +\n * `trailing-space` treats trailing whitespaces at the end of the line\n-  as an error (enabled by default).\n+  as an error (enabled by default - disable with 'git config core.whitespace\n+  \"-trailing-space\"').\n * `space-before-tab` treats a space character that appears immediately\n   before a tab character in the initial indent part of the line as an\n-  error (enabled by default).\n+  error (enabled by default - disable with 'git config core.whitespace\n+  \"-space-before-tab\"').\n * `indent-with-non-tab` treats a line that is indented with 8 or more\n   space characters as an error (not enabled by default).\n * `cr-at-eol` treats a carriage-return at the end of line as\n-- \n1.5.6\n\n"},{"id":"84686","messageId":"20080724172912.6117@nanako3.lavabit.com","threadId":"14652","inReplyTo":"4888144E.8090300@sneakemail.com","subject":"Re: [PATCH] Document disabling core.whitespace values trailing-space and space-before-tab","fromName":"Nanako Shiraishi","fromEmail":"nanako3@lavabit.com","sentAt":"2008-07-24T08:29:12Z","receivedAt":"2008-07-24T08:29:12Z","isPatch":true,"sender":{"key":"nanako3@lavabit.com","avatar":"https://gravatar.com/avatar/3777b9e201c5883a62b1a6fdf7c53f2d712d1d80989146063ea861e33aad72a8?d=mp&s=160"},"body":"Quoting \"Peter Valdemar Mrch (Lists)\"  <4ux6as402@sneakemail.com>:\n\n> The '-trailing-space' syntax to disable the trailing-space setting is\n> not obvious and not documented as far as I can see. I would have\n> assumed a value of '' would disable it.\n>\n> Is there a documentation bug here? If so, I suggest this patch. I\n> didn't find anywhere else where the '-setting' syntax was used to\n> disable something.\n\nDoesn't gitattributes(5) describe the overall syntax in detail?\n\n-- \nNanako Shiraishi\nhttp://ivory.ap.teacup.com/nanako3/\n"},{"id":"84694","messageId":"48884E56.6070801@sneakemail.com","threadId":"14652","inReplyTo":"20080724172912.6117@nanako3.lavabit.com","subject":"Re: [PATCH] Document disabling core.whitespace values trailing-space and space-before-tab","fromName":"Peter Valdemar Mørch (Lists)","fromEmail":"4ux6as402@sneakemail.com","sentAt":"2008-07-24T09:41:42Z","receivedAt":"2008-07-24T09:41:42Z","isPatch":true,"sender":{"key":"4ux6as402@sneakemail.com","avatar":null},"body":"Actually, it gets stranger and stranger!\n\nNanako Shiraishi nanako3-at-lavabit.com |Lists| wrote:\n>> The '-trailing-space' syntax to disable the trailing-space setting \n>> is not obvious and not documented as far as I can see. I would have\n>> assumed a value of '' would disable it.\n> \n> Doesn't gitattributes(5) describe the overall syntax in detail?\n\nFirst, git-config.1 does not mention gitattributes except for specific\nsettings. core.whitespace is not one of these.\n\ngitattributes.5 has:\n> Sometimes you would need to override an setting of an attribute for a\n>  path to unspecified state. This can be done by listing the name of \n> the attribute prefixed with an exclamation point !.\n\nnote that this is ! before the *name* of the attribute, and for \n\"Checking whitespace errors / whitespace\":\n\n> The core.whitespace configuration variable allows you to define what \n> diff and apply should consider whitespace errors for all paths in the\n>  project (See git-config(1)). This attribute gives you finer control \n> per path.\n...\n> Unspecified: Use the value of core.whitespace configuration variable\n>  to decide what to notice as error.\n> \n> String: Specify a comma separate list of common whitespace problems \n> to notice in the same format as core.whitespace configuration \n> variable.\n\nSo now, git attributes says to unspecify a setting with '!' in front of\nthe attribute *name*, which for core.whitespace means use the value from\ngit-config, which if not specified means to error on e.g. trailing-space.\n\nNow, I notice that git's own .gitattributes has this:\n> * whitespace=!indent,trail,space\n> *.[ch] whitespace\n\nWhich I assume actually works, but is invalid according to git-config.1 \nand gitattributes.5 because:\n\nFor the first line, neither of the values 'indent', 'trail' nor 'space'\nare valid for core.whitespace, and the '!' notation is not defined in\nneither gitattributes.5 nor in git-config.1 for *values*.\n\nFor the second line, gitattributes states generally about attributes that:\n> Set: The path has the attribute with special value \"true\"; this is \n> specified by listing only the name of the attribute in the attribute \n> list.\n\nA value of true (unspecified would have required:\"*.[ch] !whitespace\") \nis not valid for core.whitespace either.\n\nSo now (as I read it), neither git-config.1 nor gitattributes.5 specify \nhow to turn off core.whitespace \"elements\", but .gitattributes (from git \nitself) uses one notation (!) with settings that are invalid for other \nreaons, while \"grep core.whitespace t/*\" uses another notation (-) to \nturn off elements.\n\nAlso in t/* the elements have various different names, such as: \"trail\", \n\"trailing\", \"trailing-space\". t/t4019-diff-wserror.sh also uses this:\n> echo \"F whitespace=-trail\" >.gitattributes\njust to make things interesting!\n\nIt seems that there is some inconsistency about this. Perhaps \ndocumentation (and changing t/* and .gitattributes accordingly) isn't \nsuch a bad idea! :D\n\nPeter\n-- \nPeter Valdemar Mørch\nhttp://www.morch.com\n"},{"id":"84832","messageId":"7vbq0m608w.fsf@gitster.siamese.dyndns.org","threadId":"14652","inReplyTo":"20080724172912.6117@nanako3.lavabit.com","subject":"Re: [PATCH] Document disabling core.whitespace values trailing-space and space-before-tab","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-07-25T04:44:47Z","receivedAt":"2008-07-25T04:44:47Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Nanako Shiraishi <nanako3@lavabit.com> writes:\n\n> Quoting \"Peter Valdemar Mrch (Lists)\"  <4ux6as402@sneakemail.com>:\n>\n>> The '-trailing-space' syntax to disable the trailing-space setting is\n>> not obvious and not documented as far as I can see. I would have\n>> assumed a value of '' would disable it.\n>>\n>> Is there a documentation bug here? If so, I suggest this patch. I\n>> didn't find anywhere else where the '-setting' syntax was used to\n>> disable something.\n>\n> Doesn't gitattributes(5) describe the overall syntax in detail?\n\nYes, but as Peter says in his reply to you, it only talks about [-!]name\nsyntax to force the variable to unset (with '-' prefix) and to revert the\nvariable to the unspecified state (with '!' prefix).\n\nVarious \"values\" given to the whitespace attribute actually act as if they\nare sub-variables and obey the similar \"[-]name\" rule, but (1) that is\nleft unsaid, and (2) in that context '!' does not make sense so only '-'\nhas any meaning.  We would certainly need to clarify that.\n\nSo I think Peter's patch is going in the right direction.\n"},{"id":"84837","messageId":"48896EA5.1090608@morch.com","threadId":"14652","inReplyTo":"7vbq0m608w.fsf@gitster.siamese.dyndns.org","subject":"Re: [PATCH] Document disabling core.whitespace values trailing-space and space-before-tab","fromName":"Peter Valdemar Mørch","fromEmail":"lists@morch.com","sentAt":"2008-07-25T06:11:49Z","receivedAt":"2008-07-25T06:11:49Z","isPatch":true,"sender":{"key":"lists@morch.com","avatar":null},"body":"> So I think Peter's patch is going in the right direction.\n\nThus encouraged, I've created a file with two more patches like I \ndescribed in my previous mail: one that fixes up .gitattributes and one \nthat fixes up t/* to conform to documented syntax of core.whitespace.\n\n(For the future: Is it better to have one file with tree patches like I \nhave created with git format-patch -M -s --stdout, 3 individual numbered \nfiles, or one single patch created with git-merge --squash?)\n\nPeter\n-- \nPeter Valdemar Mørch\nhttp://www.morch.com\n"},{"id":"84838","messageId":"48896EFD.8010209@sneakemail.com","threadId":"14652","inReplyTo":"7vbq0m608w.fsf@gitster.siamese.dyndns.org","subject":"Re: [PATCH] Document disabling core.whitespace values trailing-space and space-before-tab","fromName":"Peter Valdemar Mørch (Lists)","fromEmail":"4ux6as402@sneakemail.com","sentAt":"2008-07-25T06:13:17Z","receivedAt":"2008-07-25T06:13:17Z","isPatch":true,"sender":{"key":"4ux6as402@sneakemail.com","avatar":null},"body":"> So I think Peter's patch is going in the right direction.\n\nThus encouraged, I've created a file with two more patches like I\ndescribed in my previous mail: one that fixes up .gitattributes and one\nthat fixes up t/* to conform to documented syntax of core.whitespace.\n\n(For the future: Is it better to have one file with tree patches like I\nhave created with \"git format-patch -M -s --stdout\", 3 individual \nnumbered files, or one single patch created with git-merge --squash?)\n\nPeter\n-- \nPeter Valdemar Mørch\nhttp://www.morch.com\n\n\n>From 900455ce5a4e8bf771aea2e3dbdbab38e440cdf4 Mon Sep 17 00:00:00 2001\nFrom: =?utf-8?q?Peter=20Valdemar=20M=C3=B8rch?= <peter@morch.com>\nDate: Thu, 24 Jul 2008 07:18:48 +0200\nSubject: [PATCH] Document disabling core.whitespace values trailing-space and space-before-tab\nMIME-Version: 1.0\nContent-Type: text/plain; charset=utf-8\nContent-Transfer-Encoding: 8bit\n\n\nSigned-off-by: Peter Valdemar Mørch <peter@morch.com>\n---\n Documentation/config.txt |    6 ++++--\n 1 files changed, 4 insertions(+), 2 deletions(-)\n\ndiff --git a/Documentation/config.txt b/Documentation/config.txt\nindex e784805..a198b3c 100644\n--- a/Documentation/config.txt\n+++ b/Documentation/config.txt\n@@ -361,10 +361,12 @@ core.whitespace::\n \tconsider them as errors:\n +\n * `trailing-space` treats trailing whitespaces at the end of the line\n-  as an error (enabled by default).\n+  as an error (enabled by default - disable with 'git config core.whitespace\n+  \"-trailing-space\"').\n * `space-before-tab` treats a space character that appears immediately\n   before a tab character in the initial indent part of the line as an\n-  error (enabled by default).\n+  error (enabled by default - disable with 'git config core.whitespace\n+  \"-space-before-tab\"').\n * `indent-with-non-tab` treats a line that is indented with 8 or more\n   space characters as an error (not enabled by default).\n * `cr-at-eol` treats a carriage-return at the end of line as\n-- \n1.5.6\n\n\n>From c73dd588bef2a56fc44af2ce10cedef1b779a510 Mon Sep 17 00:00:00 2001\nFrom: =?utf-8?q?Peter=20Valdemar=20M=C3=B8rch?= <peter@morch.com>\nDate: Fri, 25 Jul 2008 07:33:07 +0200\nSubject: [PATCH] Fixed up .gitattributes to allign with git-config.1\nMIME-Version: 1.0\nContent-Type: text/plain; charset=utf-8\nContent-Transfer-Encoding: 8bit\n\n\nSigned-off-by: Peter Valdemar Mørch <peter@morch.com>\n---\n .gitattributes |    4 ++--\n 1 files changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/.gitattributes b/.gitattributes\nindex 6b9c715..1a903b6 100644\n--- a/.gitattributes\n+++ b/.gitattributes\n@@ -1,2 +1,2 @@\n-* whitespace=!indent,trail,space\n-*.[ch] whitespace\n+* whitespace=-indent-with-non-tab,trailing-space,space-before-tab\n+*.[ch] !whitespace\n-- \n1.5.6\n\n\n>From 45889568fec2b952e10aef2fac78ba6dfda9f46d Mon Sep 17 00:00:00 2001\nFrom: =?utf-8?q?Peter=20Valdemar=20M=C3=B8rch?= <peter@morch.com>\nDate: Fri, 25 Jul 2008 07:59:24 +0200\nSubject: [PATCH] tests now use git-config's core.whitespace only with documented values\nMIME-Version: 1.0\nContent-Type: text/plain; charset=utf-8\nContent-Transfer-Encoding: 8bit\n\n\nSigned-off-by: Peter Valdemar Mørch <peter@morch.com>\n---\n t/t4019-diff-wserror.sh  |   14 +++++++-------\n t/t4124-apply-ws-rule.sh |    4 ++--\n 2 files changed, 9 insertions(+), 9 deletions(-)\n\ndiff --git a/t/t4019-diff-wserror.sh b/t/t4019-diff-wserror.sh\nindex 0d9cbb6..ecff30d 100755\n--- a/t/t4019-diff-wserror.sh\n+++ b/t/t4019-diff-wserror.sh\n@@ -33,9 +33,9 @@ test_expect_success default '\n \n '\n \n-test_expect_success 'without -trail' '\n+test_expect_success 'without -trailing-space' '\n \n-\tgit config core.whitespace -trail\n+\tgit config core.whitespace -trailing-space\n \tgit diff --color >output\n \tgrep \"$blue_grep\" output >error\n \tgrep -v \"$blue_grep\" output >normal\n@@ -48,10 +48,10 @@ test_expect_success 'without -trail' '\n \n '\n \n-test_expect_success 'without -trail (attribute)' '\n+test_expect_success 'without -trailing-space (attribute)' '\n \n \tgit config --unset core.whitespace\n-\techo \"F whitespace=-trail\" >.gitattributes\n+\techo \"F whitespace=-trailing-space\" >.gitattributes\n \tgit diff --color >output\n \tgrep \"$blue_grep\" output >error\n \tgrep -v \"$blue_grep\" output >normal\n@@ -99,7 +99,7 @@ test_expect_success 'without -space (attribute)' '\n test_expect_success 'with indent-non-tab only' '\n \n \trm -f .gitattributes\n-\tgit config core.whitespace indent,-trailing,-space\n+\tgit config core.whitespace indent-with-non-tab,-trailing-space,-space-before-tab\n \tgit diff --color >output\n \tgrep \"$blue_grep\" output >error\n \tgrep -v \"$blue_grep\" output >normal\n@@ -115,7 +115,7 @@ test_expect_success 'with indent-non-tab only' '\n test_expect_success 'with indent-non-tab only (attribute)' '\n \n \tgit config --unset core.whitespace\n-\techo \"F whitespace=indent,-trailing,-space\" >.gitattributes\n+\techo \"F whitespace=indent-with-non-tab,-trailing-space,-space-before-tab\" >.gitattributes\n \tgit diff --color >output\n \tgrep \"$blue_grep\" output >error\n \tgrep -v \"$blue_grep\" output >normal\n@@ -147,7 +147,7 @@ test_expect_success 'with cr-at-eol' '\n test_expect_success 'with cr-at-eol (attribute)' '\n \n \tgit config --unset core.whitespace\n-\techo \"F whitespace=trailing,cr-at-eol\" >.gitattributes\n+\techo \"F whitespace=trailing-space,cr-at-eol\" >.gitattributes\n \tgit diff --color >output\n \tgrep \"$blue_grep\" output >error\n \tgrep -v \"$blue_grep\" output >normal\ndiff --git a/t/t4124-apply-ws-rule.sh b/t/t4124-apply-ws-rule.sh\nindex 85f3da2..644aadc 100755\n--- a/t/t4124-apply-ws-rule.sh\n+++ b/t/t4124-apply-ws-rule.sh\n@@ -106,7 +106,7 @@ test_expect_success 'whitespace=error-all, default rule' '\n \n test_expect_success 'whitespace=error-all, no rule' '\n \n-\tgit config core.whitespace -trailing,-space-before,-indent &&\n+\tgit config core.whitespace -trailing-space,-space-before-tab,-indent-with-non-tab &&\n \tapply_patch --whitespace=error-all &&\n \tdiff file target\n \n@@ -130,7 +130,7 @@ do\n \t\tfor i in - ''\n \t\tdo\n \t\t\tcase \"$i\" in '') ti='#' ;; *) ti= ;; esac\n-\t\t\trule=${t}trailing,${s}space,${i}indent\n+\t\t\trule=${t}trailing-space,${s}space-before-tab,${i}indent-with-non-tab\n \n \t\t\trm -f .gitattributes\n \t\t\ttest_expect_success \"rule=$rule\" '\n-- \n1.5.6\n\n"},{"id":"84840","messageId":"7vy73qwhgt.fsf@gitster.siamese.dyndns.org","threadId":"14652","inReplyTo":"4888144E.8090300@sneakemail.com","subject":"Re: [PATCH] Document disabling core.whitespace values trailing-space and space-before-tab","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-07-25T07:28:18Z","receivedAt":"2008-07-25T07:28:18Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Peter Valdemar Mørch (Lists)\"  <4ux6as402@sneakemail.com> writes:\n\n> This is a multi-part message in MIME format.\n> --------------080005060106030305090009\n> Content-Type: text/plain; charset=ISO-8859-1; format=flowed\n> Content-Transfer-Encoding: 8bit\n> ...\n> --------------080005060106030305090009\n> Content-Type: text/x-patch;\n>  name=\"0001-Document-disabling-core.whitespace-values-trailing-s.patch\"\n> Content-Transfer-Encoding: 8bit\n\nPlease do not send patch as attachment.  It is very cumbersome to handle.\n"},{"id":"84850","messageId":"7v3alyuz4o.fsf@gitster.siamese.dyndns.org","threadId":"14652","inReplyTo":"7vbq0m608w.fsf@gitster.siamese.dyndns.org","subject":"Re: [PATCH] Document disabling core.whitespace values trailing-space and space-before-tab","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-07-25T08:49:43Z","receivedAt":"2008-07-25T08:49:43Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> Various \"values\" given to the whitespace attribute actually act as if they\n> are sub-variables and obey the similar \"[-]name\" rule, but (1) that is\n> left unsaid, and (2) in that context '!' does not make sense so only '-'\n> has any meaning.\n\nActually I take it back.  \"!name to revert to unspecified and -name to unset\"\nreally is about name; values to whitespace do not work like \"sub-variables\"\nat all.\n\n> So I think Peter's patch is going in the right direction.\n\nI've committed a much more simplified version.\n\n-- >8 --\n[PATCH] Documentation: clarify how to diable elements in core.whitespace\n\nNoticed by Peter Valdemar Mørch.\n\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n\ndiff --git a/Documentation/config.txt b/Documentation/config.txt\nindex e784805..798b551 100644\n--- a/Documentation/config.txt\n+++ b/Documentation/config.txt\n@@ -358,7 +358,8 @@ core.whitespace::\n \tA comma separated list of common whitespace problems to\n \tnotice.  'git-diff' will use `color.diff.whitespace` to\n \thighlight them, and 'git-apply --whitespace=error' will\n-\tconsider them as errors:\n+\tconsider them as errors.  You can prefix `-` to disable\n+\tany of them (e.g. `-trailing-space`):\n +\n * `trailing-space` treats trailing whitespaces at the end of the line\n   as an error (enabled by default).\n"}]}