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>
This commit is contained in:
parent
87b3c0117a
commit
727c3718a5
6
ws.c
6
ws.c
@ -10,7 +10,8 @@
|
|||||||
static struct whitespace_rule {
|
static struct whitespace_rule {
|
||||||
const char *rule_name;
|
const char *rule_name;
|
||||||
unsigned rule_bits;
|
unsigned rule_bits;
|
||||||
unsigned loosens_error;
|
unsigned loosens_error:1,
|
||||||
|
exclude_default:1;
|
||||||
} whitespace_rule_names[] = {
|
} whitespace_rule_names[] = {
|
||||||
{ "trailing-space", WS_TRAILING_SPACE, 0 },
|
{ "trailing-space", WS_TRAILING_SPACE, 0 },
|
||||||
{ "space-before-tab", WS_SPACE_BEFORE_TAB, 0 },
|
{ "space-before-tab", WS_SPACE_BEFORE_TAB, 0 },
|
||||||
@ -82,7 +83,8 @@ unsigned whitespace_rule(const char *pathname)
|
|||||||
unsigned all_rule = 0;
|
unsigned all_rule = 0;
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < ARRAY_SIZE(whitespace_rule_names); i++)
|
for (i = 0; i < ARRAY_SIZE(whitespace_rule_names); i++)
|
||||||
if (!whitespace_rule_names[i].loosens_error)
|
if (!whitespace_rule_names[i].loosens_error &&
|
||||||
|
!whitespace_rule_names[i].exclude_default)
|
||||||
all_rule |= whitespace_rule_names[i].rule_bits;
|
all_rule |= whitespace_rule_names[i].rule_bits;
|
||||||
return all_rule;
|
return all_rule;
|
||||||
} else if (ATTR_FALSE(value)) {
|
} else if (ATTR_FALSE(value)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user