@matheusbsbs / matheus-bagliano / commits / 727c3718a5
Fork 0

whitespace: we cannot "catch all errors known to git" anymore

Traditionally, "*.txt whitespace" in .gitattributes file has been an instruction to catch _all_ classes of whitespace errors known to git. This has to change, however, in order to introduce "tab-in-indent" which is inherently incompatible with "indent-with-non-tab". As we do not want to break configuration of existing users, add a mechanism to allow marking selected rules to be excluded from "all rules known to git". Signed-off-by: Chris Webb <chris@arachsys.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Junio C Hamano committed Apr 3, 2010 at 00:37 UTC 727c3718a51605a2b93a7b2ac57e0175decc122a
1 file changed +4 -2
ws.c
+4 -2
@@ -10,7 +10,8 @@
10 static struct whitespace_rule {
11 const char *rule_name;
12 unsigned rule_bits;
13 - unsigned loosens_error;
13 + unsigned loosens_error:1,
14 + exclude_default:1;
15 } whitespace_rule_names[] = {
16 { "trailing-space", WS_TRAILING_SPACE, 0 },
17 { "space-before-tab", WS_SPACE_BEFORE_TAB, 0 },
@@ -82,7 +83,8 @@ unsigned whitespace_rule(const char *pathname)
83 unsigned all_rule = 0;
84 int i;
85 for (i = 0; i < ARRAY_SIZE(whitespace_rule_names); i++)
85 - if (!whitespace_rule_names[i].loosens_error)
86 + if (!whitespace_rule_names[i].loosens_error &&
87 + !whitespace_rule_names[i].exclude_default)
88 all_rule |= whitespace_rule_names[i].rule_bits;
89 return all_rule;
90 } else if (ATTR_FALSE(value)) {