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/*"
42 test_expect_success 'attribute test' '
48 attr_check a/b/g a/b/g &&
49 attr_check b/g unspecified &&
50 attr_check a/b/h a/b/h &&
51 attr_check a/b/d/g "a/b/d/*" &&
52 attr_check onoff unset &&
53 attr_check offon set &&
54 attr_check no unspecified &&
55 attr_check a/b/d/no "a/b/d/*" &&
56 attr_check a/b/d/yes unspecified
60 test_expect_success 'attribute test: read paths from stdin' '
68 b/g: test: unspecified
70 a/b/d/g: test: a/b/d/*
74 a/b/d/no: test: a/b/d/*
75 a/b/d/yes: test: unspecified
78 sed -e "s/:.*//" < expect | git check-attr --stdin test > actual &&
79 test_cmp expect actual
82 test_expect_success 'root subdir attribute test' '
85 attr_check subdir/a/i unspecified
89 test_expect_success 'setup bare' '
91 git clone --bare . bare.git &&
96 test_expect_success 'bare repository: check that .gitattribute is ignored' '
102 attr_check f unspecified &&
103 attr_check a/f unspecified &&
104 attr_check a/c/f unspecified &&
105 attr_check a/i unspecified &&
106 attr_check subdir/a/i unspecified
110 test_expect_success 'bare repository: test info/attributes' '
115 ) >info/attributes &&
118 attr_check a/c/f f &&
119 attr_check a/i a/i &&
120 attr_check subdir/a/i unspecified