diff options
-rw-r--r-- | attr.c | 8 | ||||
-rwxr-xr-x | t/t0003-attributes.sh | 3 |
2 files changed, 7 insertions, 4 deletions
@@ -255,9 +255,11 @@ static struct match_attr *parse_attr_line(const char *line, const char *src, &res->u.pat.patternlen, &res->u.pat.flags, &res->u.pat.nowildcardlen); - if (res->u.pat.flags & EXC_FLAG_NEGATIVE) - die(_("Negative patterns are forbidden in git attributes\n" - "Use '\\!' for literal leading exclamation.")); + if (res->u.pat.flags & EXC_FLAG_NEGATIVE) { + warning(_("Negative patterns are ignored in git attributes\n" + "Use '\\!' for literal leading exclamation.")); + return NULL; + } } res->is_macro = is_macro; res->num_attr = num_attr; diff --git a/t/t0003-attributes.sh b/t/t0003-attributes.sh index 807b8b88e..1035a14b3 100755 --- a/t/t0003-attributes.sh +++ b/t/t0003-attributes.sh @@ -198,7 +198,8 @@ test_expect_success 'root subdir attribute test' ' test_expect_success 'negative patterns' ' echo "!f test=bar" >.gitattributes && - test_must_fail git check-attr test -- f + git check-attr test -- '"'"'!f'"'"' 2>errors && + test_i18ngrep "Negative patterns are ignored" errors ' test_expect_success 'patterns starting with exclamation' ' |