Let core.excludesfile default to $XDG_CONFIG_HOME/git/ignore
[gitweb.git] / t / t1306-xdg-files.sh
index 5b971d93ebe6c1b2f0bddebc48635b2cfa389d5c..05103f54addde966b4c450101fba3403571ec737 100755 (executable)
@@ -67,4 +67,33 @@ test_expect_success 'read with --list: xdg file exists and ~/.gitconfig exists'
 '
 
 
+test_expect_success 'Setup' '
+       git init git &&
+       cd git &&
+       echo foo >to_be_excluded
+'
+
+
+test_expect_success 'Exclusion of a file in the XDG ignore file' '
+       mkdir -p "$HOME"/.config/git/ &&
+       echo to_be_excluded >"$HOME"/.config/git/ignore &&
+       test_must_fail git add to_be_excluded
+'
+
+
+test_expect_success 'Exclusion in both XDG and local ignore files' '
+       echo to_be_excluded >.gitignore &&
+       test_must_fail git add to_be_excluded
+'
+
+
+test_expect_success 'Exclusion in a non-XDG global ignore file' '
+       rm .gitignore &&
+       echo >"$HOME"/.config/git/ignore &&
+       echo to_be_excluded >"$HOME"/my_gitignore &&
+       git config core.excludesfile "$HOME"/my_gitignore &&
+       test_must_fail git add to_be_excluded
+'
+
+
 test_done