Code

t0003: properly quote $HOME
[git.git] / t / t0003-attributes.sh
index 53bd7fcc4abbf6cb7db73b43d5dde477f5115f90..e75153bdea05d2e34570aaf03fbb3902694ddedf 100755 (executable)
@@ -36,6 +36,9 @@ test_expect_success 'setup' '
                echo "d/* test=a/b/d/*"
                echo "d/yes notest"
        ) >a/b/.gitattributes
+       (
+               echo "global test=global"
+       ) >"$HOME"/global-gitattributes
 
 '
 
@@ -48,15 +51,25 @@ test_expect_success 'attribute test' '
        attr_check a/b/g a/b/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
-       attr_check no unspecified
-       attr_check a/b/d/no "a/b/d/*"
+       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
 
 '
 
+test_expect_success 'core.attributesfile' '
+       attr_check global unspecified &&
+       git config core.attributesfile "$HOME/global-gitattributes" &&
+       attr_check global global &&
+       git config core.attributesfile "~/global-gitattributes" &&
+       attr_check global global &&
+       echo "global test=precedence" >> .gitattributes &&
+       attr_check global precedence
+'
+
 test_expect_success 'attribute test: read paths from stdin' '
 
        cat <<EOF > expect