From 458727bafb84c2d4608c7084fdee7a4b5d107f46 Mon Sep 17 00:00:00 2001 From: spacewander Date: Thu, 25 Mar 2021 11:31:11 +0800 Subject: [PATCH] fix(git-ignore): use $XDG_CONFIG_HOME only when it is defined --- bin/git-ignore | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bin/git-ignore b/bin/git-ignore index 217adda..d19b44f 100755 --- a/bin/git-ignore +++ b/bin/git-ignore @@ -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 {