summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 426c27b)
raw | patch | inline | side by side (parent: 426c27b)
author | Henrik Grubbström <grubba@grubba.org> | |
Tue, 6 Apr 2010 12:46:43 +0000 (14:46 +0200) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Sun, 11 Apr 2010 01:36:00 +0000 (18:36 -0700) |
When using macros it isn't inconceivable to have an attribute
being set by a macro, and then being reset explicitly.
Signed-off-by: Henrik Grubbström <grubba@grubba.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
being set by a macro, and then being reset explicitly.
Signed-off-by: Henrik Grubbström <grubba@grubba.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
attr.c | patch | blob | history | |
t/t0003-attributes.sh | patch | blob | history |
index 7dc17b95056139dced5b4799d5c013fafce5d091..53cf07e91381416f288393cb2b6069254b67d81a 100644 (file)
--- a/attr.c
+++ b/attr.c
struct git_attr_check *check = check_all_attr;
int i;
- for (i = 0; 0 < rem && i < a->num_attr; i++) {
+ for (i = a->num_attr - 1; 0 < rem && 0 <= i; i--) {
struct git_attr *attr = a->state[i].attr;
const char **n = &(check[attr->attr_nr].value);
const char *v = a->state[i].setto;
diff --git a/t/t0003-attributes.sh b/t/t0003-attributes.sh
index 1c77192eb318d007689089eaf42f4f939c2f9ee4..bd9c8deb4c1fd4b8e664aee4f140fe2a9ee38927 100755 (executable)
--- a/t/t0003-attributes.sh
+++ b/t/t0003-attributes.sh
(
echo "f test=f"
echo "a/i test=a/i"
+ echo "onoff test -test"
+ echo "offon -test test"
) >.gitattributes &&
(
echo "g test=a/g" &&
attr_check b/g unspecified &&
attr_check a/b/h a/b/h &&
attr_check a/b/d/g "a/b/d/*"
+ attr_check onoff unset
+ attr_check offon set
'
b/g: test: unspecified
a/b/h: test: a/b/h
a/b/d/g: test: a/b/d/*
+onoff: test: unset
+offon: test: set
EOF
sed -e "s/:.*//" < expect | git check-attr --stdin test > actual &&