{"thread":{"id":"23200","subject":"[RFC 0/1] diff --check for indent-with-spaces style","startedAt":"2010-03-27T14:08:00Z","lastAt":"2010-04-02T10:55:04Z","messageCount":6,"participants":["Chris Webb","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"137948","messageId":"1269698881-26443-1-git-send-email-chris@arachsys.com","threadId":"23200","inReplyTo":null,"subject":"[RFC 0/1] diff --check for indent-with-spaces style","fromName":"Chris Webb","fromEmail":"chris@arachsys.com","sentAt":"2010-03-27T14:08:00Z","receivedAt":"2010-03-27T14:08:00Z","isPatch":false,"sender":{"key":"chris@arachsys.com","avatar":"https://avatars.githubusercontent.com/u/299056?v=4"},"body":"I've been preparing some patches against a project (qemu) which has an indent\nstyle of only spaces, i.e. tabs forbidden. I usually use diff --check to make\nsure I catch stray spaces when I'm working on tab-indented code, and although\ncore.whitespace can be set to indent-with-non-tab to enforce the use of tabs,\nthere's no corresponding 'indent-with-tab' rule to forbid them. The asymmetry\nbothered me, so I've added support for this to ws.c in the following small\npatch.\n\nWould this rule be more clearly described as indent-with-non-space instead?\n\nFor completeness, I'd also like to support core.whitespace = indent-with-tab\nin git apply --whitespace=fix (although I don't use this myself). It's trivial\nto expand the tabs in ws_fix_copy(), but this would violate the assumption in\nthe calling code that whitespace cleanup doesn't result in a dst string longer\nthan src. I think the only sane way I can deal with this correctly is to\nproperly replumb ws_fix_copy() and its callers to use a strbuf instead of a\nchar *dst?\n\n cache.h |    1 +\n ws.c    |   26 ++++++++++++++++++++------\n 2 files changed, 21 insertions(+), 6 deletions(-)\n"},{"id":"137949","messageId":"1269698881-26443-2-git-send-email-chris@arachsys.com","threadId":"23200","inReplyTo":"1269698881-26443-1-git-send-email-chris@arachsys.com","subject":"[RFC 1/1] Add new indent-with-tab whitespace check","fromName":"Chris Webb","fromEmail":"chris@arachsys.com","sentAt":"2010-03-27T14:08:01Z","receivedAt":"2010-03-27T14:08:01Z","isPatch":false,"sender":{"key":"chris@arachsys.com","avatar":"https://avatars.githubusercontent.com/u/299056?v=4"},"body":"The indent-with-tab rule warns about any tab characters used in initial\nindent, and highlights them in git diff --check.\n\nSigned-off-by: Chris Webb <chris@arachsys.com>\n---\n cache.h |    1 +\n ws.c    |   26 ++++++++++++++++++++------\n 2 files changed, 21 insertions(+), 6 deletions(-)\n\ndiff --git a/cache.h b/cache.h\nindex 2928107..d87bd85 100644\n--- a/cache.h\n+++ b/cache.h\n@@ -1040,6 +1040,7 @@ void shift_tree_by(const unsigned char *, const unsigned char *, unsigned char *\n #define WS_INDENT_WITH_NON_TAB\t04\n #define WS_CR_AT_EOL           010\n #define WS_BLANK_AT_EOF        020\n+#define WS_INDENT_WITH_TAB     040\n #define WS_TRAILING_SPACE      (WS_BLANK_AT_EOL|WS_BLANK_AT_EOF)\n #define WS_DEFAULT_RULE (WS_TRAILING_SPACE|WS_SPACE_BEFORE_TAB)\n extern unsigned whitespace_rule_cfg;\ndiff --git a/ws.c b/ws.c\nindex c089338..e44a711 100644\n--- a/ws.c\n+++ b/ws.c\n@@ -18,6 +18,7 @@ static struct whitespace_rule {\n \t{ \"cr-at-eol\", WS_CR_AT_EOL, 1 },\n \t{ \"blank-at-eol\", WS_BLANK_AT_EOL, 0 },\n \t{ \"blank-at-eof\", WS_BLANK_AT_EOF, 0 },\n+\t{ \"indent-with-tab\", WS_INDENT_WITH_TAB, 0 },\n };\n \n unsigned parse_whitespace_rule(const char *string)\n@@ -125,6 +126,11 @@ char *whitespace_error_string(unsigned ws)\n \t\t\tstrbuf_addstr(&err, \", \");\n \t\tstrbuf_addstr(&err, \"indent with spaces\");\n \t}\n+\tif (ws & WS_INDENT_WITH_TAB) {\n+\t\tif (err.len)\n+\t\t\tstrbuf_addstr(&err, \", \");\n+\t\tstrbuf_addstr(&err, \"indent with tab\");\n+\t}\n \treturn strbuf_detach(&err, NULL);\n }\n \n@@ -163,23 +169,31 @@ static unsigned ws_check_emit_1(const char *line, int len, unsigned ws_rule,\n \t\t}\n \t}\n \n-\t/* Check for space before tab in initial indent. */\n+\t/* Check for indent using tab or space before tab in initial indent. */\n \tfor (i = 0; i < len; i++) {\n \t\tif (line[i] == ' ')\n \t\t\tcontinue;\n \t\tif (line[i] != '\\t')\n \t\t\tbreak;\n-\t\tif ((ws_rule & WS_SPACE_BEFORE_TAB) && written < i) {\n+\t\tif (ws_rule & WS_INDENT_WITH_TAB) {\n+\t\t\tresult |= WS_INDENT_WITH_TAB;\n+\t\t\tif (stream) {\n+\t\t\t\tfwrite(line + written, i - written, 1, stream);\n+\t\t\t\tfputs(ws, stream);\n+\t\t\t\tfwrite(line + i, 1, 1, stream);\n+\t\t\t\tfputs(reset, stream);\n+\t\t\t}\n+\t\t} else if ((ws_rule & WS_SPACE_BEFORE_TAB) && written < i) {\n \t\t\tresult |= WS_SPACE_BEFORE_TAB;\n \t\t\tif (stream) {\n \t\t\t\tfputs(ws, stream);\n \t\t\t\tfwrite(line + written, i - written, 1, stream);\n \t\t\t\tfputs(reset, stream);\n+\t\t\t\tfwrite(line + i, 1, 1, stream);\n \t\t\t}\n-\t\t} else if (stream)\n-\t\t\tfwrite(line + written, i - written, 1, stream);\n-\t\tif (stream)\n-\t\t\tfwrite(line + i, 1, 1, stream);\n+\t\t} else if (stream) {\n+\t\t\tfwrite(line + written, i - written + 1, 1, stream);\n+\t\t}\n \t\twritten = i + 1;\n \t}\n \n-- \n1.7.0.1\n"},{"id":"138295","messageId":"7vwrwstq8r.fsf@alter.siamese.dyndns.org","threadId":"23200","inReplyTo":"1269698881-26443-2-git-send-email-chris@arachsys.com","subject":"Re: [RFC 1/1] Add new indent-with-tab whitespace check","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2010-03-31T16:23:00Z","receivedAt":"2010-03-31T16:23:00Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Chris Webb <chris@arachsys.com> writes:\n\n> The indent-with-tab rule warns about any tab characters used in initial\n> indent, and highlights them in git diff --check.\n>\n> Signed-off-by: Chris Webb <chris@arachsys.com>\n> ---\n>  cache.h |    1 +\n>  ws.c    |   26 ++++++++++++++++++++------\n>  2 files changed, 21 insertions(+), 6 deletions(-)\n>\n> diff --git a/cache.h b/cache.h\n> index 2928107..d87bd85 100644\n> --- a/cache.h\n> +++ b/cache.h\n> @@ -1040,6 +1040,7 @@ void shift_tree_by(const unsigned char *, const unsigned char *, unsigned char *\n>  #define WS_INDENT_WITH_NON_TAB\t04\n>  #define WS_CR_AT_EOL           010\n>  #define WS_BLANK_AT_EOF        020\n> +#define WS_INDENT_WITH_TAB     040\n>  #define WS_TRAILING_SPACE      (WS_BLANK_AT_EOL|WS_BLANK_AT_EOF)\n>  #define WS_DEFAULT_RULE (WS_TRAILING_SPACE|WS_SPACE_BEFORE_TAB)\n>  extern unsigned whitespace_rule_cfg;\n> diff --git a/ws.c b/ws.c\n> index c089338..e44a711 100644\n> --- a/ws.c\n> +++ b/ws.c\n> @@ -18,6 +18,7 @@ static struct whitespace_rule {\n>  \t{ \"cr-at-eol\", WS_CR_AT_EOL, 1 },\n>  \t{ \"blank-at-eol\", WS_BLANK_AT_EOL, 0 },\n>  \t{ \"blank-at-eof\", WS_BLANK_AT_EOF, 0 },\n> +\t{ \"indent-with-tab\", WS_INDENT_WITH_TAB, 0 },\n\nUser's existing attribute setting that uses \"indent\" as an abbreviation\nfor \"indent-with-non-tab\" will probably be broken by this naming.\n\nThis sounds more like \"tab-in-indent\".  Naming the option that way would\ngive it an added benefit of allowing it to be abbreviated to \"tab\" by the\nparser.\n\nI think WS_TAB_IN_INDENT are incompatible with either WS_SPACE_BEFORE_TAB\nor WS_INDENT_WITH_TAB.  Don't we want to notice such a combination as an\nerror?\n\n> @@ -163,23 +169,31 @@ static unsigned ws_check_emit_1(const char *line, int len, unsigned ws_rule,\n>  \t\t}\n>  \t}\n>  \n> -\t/* Check for space before tab in initial indent. */\n> +\t/* Check for indent using tab or space before tab in initial indent. */\n>  \tfor (i = 0; i < len; i++) {\n>  \t\tif (line[i] == ' ')\n>  \t\t\tcontinue;\n>  \t\tif (line[i] != '\\t')\n>  \t\t\tbreak;\n\n> -\t\tif ((ws_rule & WS_SPACE_BEFORE_TAB) && written < i) {\n> +\t\tif (ws_rule & WS_INDENT_WITH_TAB) {\n> +\t\t\tresult |= WS_INDENT_WITH_TAB;\n> +\t\t\tif (stream) {\n> +\t\t\t\tfwrite(line + written, i - written, 1, stream);\n> +\t\t\t\tfputs(ws, stream);\n> +\t\t\t\tfwrite(line + i, 1, 1, stream);\n> +\t\t\t\tfputs(reset, stream);\n> +\t\t\t}\n> +\t\t} else if ((ws_rule & WS_SPACE_BEFORE_TAB) && written < i) {\n\nAdding this new code as a new second branch for if-elif-else chain would\nmatch the order of options better.\n\n>  \t\t\tresult |= WS_SPACE_BEFORE_TAB;\n>  \t\t\tif (stream) {\n>  \t\t\t\tfputs(ws, stream);\n>  \t\t\t\tfwrite(line + written, i - written, 1, stream);\n>  \t\t\t\tfputs(reset, stream);\n> +\t\t\t\tfwrite(line + i, 1, 1, stream);\n>  \t\t\t}\n> -\t\t} else if (stream)\n> -\t\t\tfwrite(line + written, i - written, 1, stream);\n> -\t\tif (stream)\n> -\t\t\tfwrite(line + i, 1, 1, stream);\n> +\t\t} else if (stream) {\n> +\t\t\tfwrite(line + written, i - written + 1, 1, stream);\n> +\t\t}\n\nI think it is a good change, and a necessary one for adding this new\nfeature.\n\nThe original code assumed that this loop always detected an after seeing a\n\"good\" letter (hence the writing of the current letter was unconditional),\nbut the patch makes it more clear what is being checked and what is being\nhighlighted by the logic between SPACE_BEFORE_TAB and TAB_IN_INDENT\ncodepaths.\n\nI'll queue this with s/indent-with-tab/tab-in-indent/ tweak to 'pu' but\nthe topic would need:\n\n - detecting incompatible settings;\n - tests;\n - docs;\n - matching change to apply --whitespace=fix;\n\nbefore moving to 'next', I think.  Here is what I tentatively will queue,\nwith an updated log message.\n\nThanks.\n\n-- >8 --\nFrom: Chris Webb <chris@arachsys.com>\nDate: Sat, 27 Mar 2010 14:08:01 +0000\nSubject: [PATCH] Add tab-in-indent whitespace error class\n\nSome projects and languages use coding style where no tab character\nis used to indent the lines.\n\nThis only adds support for \"apply --whitespace=warn\" and \"diff --check\";\nfollow-up patches need to add \"apply --whitespace=fix\", tests and docs.\n\nSigned-off-by: Chris Webb <chris@arachsys.com>\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\n cache.h |    1 +\n ws.c    |   24 +++++++++++++++++++-----\n 2 files changed, 20 insertions(+), 5 deletions(-)\n\ndiff --git a/cache.h b/cache.h\nindex 6dcb100..030af32 100644\n--- a/cache.h\n+++ b/cache.h\n@@ -1040,6 +1040,7 @@ void shift_tree_by(const unsigned char *, const unsigned char *, unsigned char *\n #define WS_INDENT_WITH_NON_TAB\t04\n #define WS_CR_AT_EOL           010\n #define WS_BLANK_AT_EOF        020\n+#define WS_TAB_IN_INDENT       040\n #define WS_TRAILING_SPACE      (WS_BLANK_AT_EOL|WS_BLANK_AT_EOF)\n #define WS_DEFAULT_RULE (WS_TRAILING_SPACE|WS_SPACE_BEFORE_TAB)\n extern unsigned whitespace_rule_cfg;\ndiff --git a/ws.c b/ws.c\nindex c089338..d0b6c54 100644\n--- a/ws.c\n+++ b/ws.c\n@@ -18,6 +18,7 @@ static struct whitespace_rule {\n \t{ \"cr-at-eol\", WS_CR_AT_EOL, 1 },\n \t{ \"blank-at-eol\", WS_BLANK_AT_EOL, 0 },\n \t{ \"blank-at-eof\", WS_BLANK_AT_EOF, 0 },\n+\t{ \"tab-in-indent\", WS_TAB_IN_INDENT, 0 },\n };\n \n unsigned parse_whitespace_rule(const char *string)\n@@ -125,6 +126,11 @@ char *whitespace_error_string(unsigned ws)\n \t\t\tstrbuf_addstr(&err, \", \");\n \t\tstrbuf_addstr(&err, \"indent with spaces\");\n \t}\n+\tif (ws & WS_TAB_IN_INDENT) {\n+\t\tif (err.len)\n+\t\t\tstrbuf_addstr(&err, \", \");\n+\t\tstrbuf_addstr(&err, \"tab in indent\");\n+\t}\n \treturn strbuf_detach(&err, NULL);\n }\n \n@@ -163,7 +169,7 @@ static unsigned ws_check_emit_1(const char *line, int len, unsigned ws_rule,\n \t\t}\n \t}\n \n-\t/* Check for space before tab in initial indent. */\n+\t/* Check indentation */\n \tfor (i = 0; i < len; i++) {\n \t\tif (line[i] == ' ')\n \t\t\tcontinue;\n@@ -175,11 +181,19 @@ static unsigned ws_check_emit_1(const char *line, int len, unsigned ws_rule,\n \t\t\t\tfputs(ws, stream);\n \t\t\t\tfwrite(line + written, i - written, 1, stream);\n \t\t\t\tfputs(reset, stream);\n+\t\t\t\tfwrite(line + i, 1, 1, stream);\n \t\t\t}\n-\t\t} else if (stream)\n-\t\t\tfwrite(line + written, i - written, 1, stream);\n-\t\tif (stream)\n-\t\t\tfwrite(line + i, 1, 1, stream);\n+\t\t} else if (ws_rule & WS_TAB_IN_INDENT) {\n+\t\t\tresult |= WS_TAB_IN_INDENT;\n+\t\t\tif (stream) {\n+\t\t\t\tfwrite(line + written, i - written, 1, stream);\n+\t\t\t\tfputs(ws, stream);\n+\t\t\t\tfwrite(line + i, 1, 1, stream);\n+\t\t\t\tfputs(reset, stream);\n+\t\t\t}\n+\t\t} else if (stream) {\n+\t\t\tfwrite(line + written, i - written + 1, 1, stream);\n+\t\t}\n \t\twritten = i + 1;\n \t}\n \n-- \n1.7.0.3.513.gc8ed0\n"},{"id":"138351","messageId":"7vsk7fovjx.fsf_-_@alter.siamese.dyndns.org","threadId":"23200","inReplyTo":"7vwrwstq8r.fsf@alter.siamese.dyndns.org","subject":"Re* [RFC 1/1] Add new indent-with-tab whitespace check","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2010-04-01T18:51:46Z","receivedAt":"2010-04-01T18:51:46Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n>> diff --git a/ws.c b/ws.c\n>> index c089338..e44a711 100644\n>> --- a/ws.c\n>> +++ b/ws.c\n>> @@ -18,6 +18,7 @@ static struct whitespace_rule {\n>>  \t{ \"cr-at-eol\", WS_CR_AT_EOL, 1 },\n>>  \t{ \"blank-at-eol\", WS_BLANK_AT_EOL, 0 },\n>>  \t{ \"blank-at-eof\", WS_BLANK_AT_EOF, 0 },\n>> +\t{ \"indent-with-tab\", WS_INDENT_WITH_TAB, 0 },\n>\n> User's existing attribute setting that uses \"indent\" as an abbreviation\n> for \"indent-with-non-tab\" will probably be broken by this naming.\n\nThere is another issue with this change.  Because \"whitespace\" without any\nstring in .gitattributes are defined to cause all the whitespace breakages\nknown to git to be caught, and tab-in-indent is inherently incompatible\nwith indent-with-non-tab, this cannot be supported without changing the\ndefinition of \"default set of whitespace breakage classes\".\n\nThe intention of allowing .gitattributes to say \"*.txt whitespace\" is to\nlet the users and projects say:\n\n    I trust the competence and good judgement made by git developers\n    regarding whitespace issues.  They may devise a new algorithm to catch\n    common whitespace errors that the current tool may not catch, and when\n    that happens, I'd like my project to take advantage of the new code\n    and catch the newly defined classes of errors.\n    \nand that is why we include all whitespace-rule except for the ones that\nloosens error conditions to the set of breakages we catch for such a\nspecification.\n\nSo on top of the replacement I sent earlier, I think we would need a patch\nlike the attached.  The topic still needs:\n\n>  - detecting incompatible settings;\n>  - tests;\n>  - docs;\n>  - matching change to apply --whitespace=fix;\n\nbut otherwise with this patch I think it is usable by me ;-)\n\nThanks.\n\n-- >8 --\nwhitespace: we cannot \"catch all errors known to git\" anymore\n\nTraditionally, \"*.txt whitespace\" in .gitattributes file has been an\ninstruction to catch _all_ classes of whitespace errors known to git.\n\nThis however has to change, as the recently introduced \"tab-in-indent\"\nis inherently incompatible with \"indent-with-non-tab\".  As we do not want\nto break configuration of existing users, add a mechanism to allow marking\nselected rules to be excluded from \"all rules known to git\".\n\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\n ws.c |    8 +++++---\n 1 files changed, 5 insertions(+), 3 deletions(-)\n\ndiff --git a/ws.c b/ws.c\nindex d0b6c54..c7b4f91 100644\n--- a/ws.c\n+++ b/ws.c\n@@ -10,7 +10,8 @@\n static struct whitespace_rule {\n \tconst char *rule_name;\n \tunsigned rule_bits;\n-\tunsigned loosens_error;\n+\tunsigned loosens_error:1,\n+\t\tnot_in_all:1;\n } whitespace_rule_names[] = {\n \t{ \"trailing-space\", WS_TRAILING_SPACE, 0 },\n \t{ \"space-before-tab\", WS_SPACE_BEFORE_TAB, 0 },\n@@ -18,7 +19,7 @@ static struct whitespace_rule {\n \t{ \"cr-at-eol\", WS_CR_AT_EOL, 1 },\n \t{ \"blank-at-eol\", WS_BLANK_AT_EOL, 0 },\n \t{ \"blank-at-eof\", WS_BLANK_AT_EOF, 0 },\n-\t{ \"tab-in-indent\", WS_TAB_IN_INDENT, 0 },\n+\t{ \"tab-in-indent\", WS_TAB_IN_INDENT, 0, 1 },\n };\n \n unsigned parse_whitespace_rule(const char *string)\n@@ -83,7 +84,8 @@ unsigned whitespace_rule(const char *pathname)\n \t\t\tunsigned all_rule = 0;\n \t\t\tint i;\n \t\t\tfor (i = 0; i < ARRAY_SIZE(whitespace_rule_names); i++)\n-\t\t\t\tif (!whitespace_rule_names[i].loosens_error)\n+\t\t\t\tif (!whitespace_rule_names[i].loosens_error &&\n+\t\t\t\t    !whitespace_rule_names[i].not_in_all)\n \t\t\t\t\tall_rule |= whitespace_rule_names[i].rule_bits;\n \t\t\treturn all_rule;\n \t\t} else if (ATTR_FALSE(value)) {\n"},{"id":"138352","messageId":"7voci3ov2k.fsf@alter.siamese.dyndns.org","threadId":"23200","inReplyTo":"7vsk7fovjx.fsf_-_@alter.siamese.dyndns.org","subject":"Re: Re* [RFC 1/1] Add new indent-with-tab whitespace check","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2010-04-01T19:02:11Z","receivedAt":"2010-04-01T19:02:11Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\nI need to make some clarification, as the following is misleading.  This\nclarification fortunately does not have to change the patch I sent\nearlier.\n\n> There is another issue with this change.  Because \"whitespace\" without any\n> string in .gitattributes are defined to cause all the whitespace breakages\n> known to git to be caught, and tab-in-indent is inherently incompatible\n> with indent-with-non-tab, this cannot be supported without changing the\n> definition of \"default set of whitespace breakage classes\".\n\nI said \"default\" but that is totally incorrect.  We catch \"trailing-space\"\nand \"space-before-tab\" by default (i.e. the user does not have any custom\n\"whitespace\" attribute), and that will not change.\n\n> The intention of allowing .gitattributes to say \"*.txt whitespace\" is to\n> let the users and projects say:\n>\n>     I trust the competence and good judgement made by git developers\n>     regarding whitespace issues.  They may devise a new algorithm to catch\n>     common whitespace errors that the current tool may not catch, and when\n>     that happens, I'd like my project to take advantage of the new code\n>     and catch the newly defined classes of errors.\n>\n> and that is why we include all whitespace-rule except for the ones that\n> loosens error conditions to the set of breakages we catch for such a\n> specification.\n\nA corollary to the above clarification on \"default\" is that people who do\nnot trust us but want to rely on the traditional \"Only trailing-space and\nspace-before-tab, nothing else\" need to do _nothing_.  If they do not have\n\"whitespace\" attribute defined for paths, the default is honored.  People\nwho want to catch the set of maximal whitespace breakage classes that is\ninternally consistent are the only ones that already have entries like\n\"*.txt whitespace\" in their attributes file, and we keep our promises to\nthem.  If we take the \"all errors known to git\" too literally to include\nincompatible rules in them, the end result would become useless to them,\nand that is what the earlier update fixes.\n"},{"id":"138416","messageId":"20100402105504.GO19047@arachsys.com","threadId":"23200","inReplyTo":"7vsk7fovjx.fsf_-_@alter.siamese.dyndns.org","subject":"Re: [RFC 1/1] Add new indent-with-tab whitespace check","fromName":"Chris Webb","fromEmail":"chris@arachsys.com","sentAt":"2010-04-02T10:55:04Z","receivedAt":"2010-04-02T10:55:04Z","isPatch":false,"sender":{"key":"chris@arachsys.com","avatar":"https://avatars.githubusercontent.com/u/299056?v=4"},"body":"Hi. Thanks for the detailed feedback.\n\nJunio C Hamano <gitster@pobox.com> writes:\n\n> This sounds more like \"tab-in-indent\".  Naming the option that way would\n> give it an added benefit of allowing it to be abbreviated to \"tab\" by the\n> parser.\n\nYes that's nice: much harder to confuse with indent-with-non-tab that way.\n\n> I think WS_TAB_IN_INDENT are incompatible with either WS_SPACE_BEFORE_TAB\n> or WS_INDENT_WITH_TAB.  Don't we want to notice such a combination as an\n> error?\n\nOh yes, that has to be the right behaviour for the finished feature here. (I\nguess strictly they could coexist with the meaning 'no indented lines\nallowed at all' but I don't think that's useful or sensible.)\n\n> I'll queue this with s/indent-with-tab/tab-in-indent/ tweak to 'pu' but\n> the topic would need:\n> \n>  - detecting incompatible settings;\n>  - tests;\n>  - docs;\n>  - matching change to apply --whitespace=fix;\n> \n> before moving to 'next', I think.\n\nAre you happy with my suggestion in [0/1] to replumb ws_fix_copy() to take a\nstrbuf as dst rather than a char *, to deal with the fact that whitespace\ncan grow with --whitespace=fix and WS_TAB_IN_INDENT?\n\nIf so, I'll polish up the existing patch as you suggest in your first three\npoints above, and then make this change to the way ws_fix_copy() works so I\ncan do the right thing in whitespace=fix.\n\n> There is another issue with this change.  Because \"whitespace\" without any\n> string in .gitattributes are defined to cause all the whitespace breakages\n> known to git to be caught, and tab-in-indent is inherently incompatible\n> with indent-with-non-tab, this cannot be supported without changing the\n> definition of \"default set of whitespace breakage classes\".\n\nAh, this was a behaviour I didn't know about. I should probably put your\npatch (without the WS_TAB_IN_INDENT line) as the first one in the series,\nbefore I introduce WS_TAB_IN_INDENT, so we don't break this wildcard\nwhitespace behaviour at any point in the series.\n\nCheers,\n\nChris.\n"}]}