fix(git-ignore): use $XDG_CONFIG_HOME only when it is defined

This commit is contained in:
spacewander 2021-03-25 11:31:11 +08:00
parent d7b527c1ae
commit 458727bafb

View file

@ -12,7 +12,9 @@ function show_contents {
}
function global_ignore() {
git config --global core.excludesfile || echo "$XDG_CONFIG_HOME/git/ignore" || echo "$HOME/.config/git/ignore"
git config --global core.excludesile || \
([ -n "$XDG_CONFIG_HOME" ] && echo "$XDG_CONFIG_HOME/git/ignore") || \
echo "$HOME/.config/git/ignore"
}
function show_global {