]> git.ipfire.org Git - thirdparty/git.git/blobdiff - t/t1306-xdg-files.sh
Let core.attributesfile default to $XDG_CONFIG_HOME/git/attributes
[thirdparty/git.git] / t / t1306-xdg-files.sh
index 05103f54addde966b4c450101fba3403571ec737..e8cd78a48d9824bc0bb4b99a7bb30ad407f40ddb 100755 (executable)
@@ -96,4 +96,33 @@ test_expect_success 'Exclusion in a non-XDG global ignore file' '
 '
 
 
+test_expect_success 'Checking attributes in the XDG attributes file' '
+       echo foo >f &&
+       git check-attr -a f >actual &&
+       test_line_count -eq 0 actual &&
+       echo "f attr_f" >"$HOME"/.config/git/attributes &&
+       echo "f: attr_f: set" >expected &&
+       git check-attr -a f >actual &&
+       test_cmp expected actual
+'
+
+
+test_expect_success 'Checking attributes in both XDG and local attributes files' '
+       echo "f -attr_f" >.gitattributes &&
+       echo "f: attr_f: unset" >expected &&
+       git check-attr -a f >actual &&
+       test_cmp expected actual
+'
+
+
+test_expect_success 'Checking attributes in a non-XDG global attributes file' '
+       test_might_fail rm .gitattributes &&
+       echo "f attr_f=test" >"$HOME"/my_gitattributes &&
+       git config core.attributesfile "$HOME"/my_gitattributes &&
+       echo "f: attr_f: test" >expected &&
+       git check-attr -a f >actual &&
+       test_cmp expected actual
+'
+
+
 test_done