aboutsummaryrefslogtreecommitdiff
path: root/t/t0003-attributes.sh
diff options
context:
space:
mode:
authorHenrik Grubbström <grubba@grubba.org>2010-04-06 14:46:44 +0200
committerJunio C Hamano <gitster@pobox.com>2010-04-10 18:36:00 -0700
commitec775c41dc4bb7382ebbbb61ede59e63846b3644 (patch)
tree0a9084ef6cdf11d8a3b627d07b2aeb934ab61984 /t/t0003-attributes.sh
parent969f9d73228f233aff071a0d07ba28afdb79dbc4 (diff)
downloadgit-ec775c41dc4bb7382ebbbb61ede59e63846b3644.tar.gz
git-ec775c41dc4bb7382ebbbb61ede59e63846b3644.tar.xz
attr: Expand macros immediately when encountered.
When using macros it is otherwise hard to know whether an attribute set by the macro should override an already set attribute. Consider the following .gitattributes file: [attr]mybinary binary -ident * ident foo.bin mybinary bar.bin mybinary ident Without this patch both foo.bin and bar.bin will have the ident attribute set, which is probably not what the user expects. With this patch foo.bin will have an unset ident attribute, while bar.bin will have it set. Signed-off-by: Henrik Grubbström <grubba@grubba.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t0003-attributes.sh')
-rwxr-xr-xt/t0003-attributes.sh9
1 files changed, 9 insertions, 0 deletions
diff --git a/t/t0003-attributes.sh b/t/t0003-attributes.sh
index bd9c8deb4..53bd7fcc4 100755
--- a/t/t0003-attributes.sh
+++ b/t/t0003-attributes.sh
@@ -20,10 +20,12 @@ test_expect_success 'setup' '
mkdir -p a/b/d a/c &&
(
+ echo "[attr]notest !test"
echo "f test=f"
echo "a/i test=a/i"
echo "onoff test -test"
echo "offon -test test"
+ echo "no notest"
) >.gitattributes &&
(
echo "g test=a/g" &&
@@ -32,6 +34,7 @@ test_expect_success 'setup' '
(
echo "h test=a/b/h" &&
echo "d/* test=a/b/d/*"
+ echo "d/yes notest"
) >a/b/.gitattributes
'
@@ -48,6 +51,9 @@ test_expect_success 'attribute test' '
attr_check a/b/d/g "a/b/d/*"
attr_check onoff unset
attr_check offon set
+ attr_check no unspecified
+ attr_check a/b/d/no "a/b/d/*"
+ attr_check a/b/d/yes unspecified
'
@@ -64,6 +70,9 @@ a/b/h: test: a/b/h
a/b/d/g: test: a/b/d/*
onoff: test: unset
offon: test: set
+no: test: unspecified
+a/b/d/no: test: a/b/d/*
+a/b/d/yes: test: unspecified
EOF
sed -e "s/:.*//" < expect | git check-attr --stdin test > actual &&