3 test_description
=gitattributes
12 git check-attr
test -- "$path" >actual
&&
13 echo "$path: test: $2" >expect
&&
14 test_cmp expect actual
19 test_expect_success
'setup' '
23 echo "[attr]notest !test"
26 echo "onoff test -test"
27 echo "offon -test test"
33 ) >a/.gitattributes &&
35 echo "h test=a/b/h" &&
36 echo "d/* test=a/b/d/*"
40 echo "global test=global"
41 ) >"$HOME"/global-gitattributes
45 test_expect_success
'attribute test' '
51 attr_check a/b/g a/b/g &&
52 attr_check b/g unspecified &&
53 attr_check a/b/h a/b/h &&
54 attr_check a/b/d/g "a/b/d/*" &&
55 attr_check onoff unset &&
56 attr_check offon set &&
57 attr_check no unspecified &&
58 attr_check a/b/d/no "a/b/d/*" &&
59 attr_check a/b/d/yes unspecified
63 test_expect_success
'core.attributesfile' '
64 attr_check global unspecified &&
65 git config core.attributesfile "$HOME/global-gitattributes" &&
66 attr_check global global &&
67 git config core.attributesfile "~/global-gitattributes" &&
68 attr_check global global &&
69 echo "global test=precedence" >> .gitattributes &&
70 attr_check global precedence
73 test_expect_success
'attribute test: read paths from stdin' '
81 b/g: test: unspecified
83 a/b/d/g: test: a/b/d/*
87 a/b/d/no: test: a/b/d/*
88 a/b/d/yes: test: unspecified
91 sed -e "s/:.*//" < expect | git check-attr --stdin test > actual &&
92 test_cmp expect actual
95 test_expect_success
'root subdir attribute test' '
98 attr_check subdir/a/i unspecified
102 test_expect_success
'setup bare' '
104 git clone --bare . bare.git &&
109 test_expect_success
'bare repository: check that .gitattribute is ignored' '
115 attr_check f unspecified &&
116 attr_check a/f unspecified &&
117 attr_check a/c/f unspecified &&
118 attr_check a/i unspecified &&
119 attr_check subdir/a/i unspecified
123 test_expect_success
'bare repository: test info/attributes' '
128 ) >info/attributes &&
131 attr_check a/c/f f &&
132 attr_check a/i a/i &&
133 attr_check subdir/a/i unspecified