summaryrefslogtreecommitdiff
path: root/contrib/completion
diff options
context:
space:
mode:
authorVille Skyttä <ville.skytta@iki.fi>2021-04-08 07:06:41 (GMT)
committerJunio C Hamano <gitster@pobox.com>2021-04-08 17:45:36 (GMT)
commitc5c0548d793edf4a6e319f237f3a01a1f093bbd7 (patch)
tree4a4341fa2fbe8f8ae07f309a8bdcc57469d7c04b /contrib/completion
parent48bf2fa8bad054d66bd79c6ba903c89c704201f7 (diff)
downloadgit-c5c0548d793edf4a6e319f237f3a01a1f093bbd7.zip
git-c5c0548d793edf4a6e319f237f3a01a1f093bbd7.tar.gz
git-c5c0548d793edf4a6e319f237f3a01a1f093bbd7.tar.bz2
completion: audit and guard $GIT_* against unset use
$GIT_COMPLETION_SHOW_ALL and $GIT_TESTING_ALL_COMMAND_LIST were used without guarding against them being unset, causing errors in nounset (set -u) mode. No other nounset-unsafe $GIT_* usages were found. While at it, remove a superfluous (duplicate) unset guard from $GIT_DIR in __git_find_repo_path. Signed-off-by: Ville Skyttä <ville.skytta@iki.fi> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'contrib/completion')
-rw-r--r--contrib/completion/git-completion.bash6
1 files changed, 3 insertions, 3 deletions
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 7dc6cd8..1de74f1 100644
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -77,7 +77,7 @@ __git_find_repo_path ()
test -d "$__git_dir" &&
__git_repo_path="$__git_dir"
elif [ -n "${GIT_DIR-}" ]; then
- test -d "${GIT_DIR-}" &&
+ test -d "$GIT_DIR" &&
__git_repo_path="$GIT_DIR"
elif [ -d .git ]; then
__git_repo_path=.git
@@ -427,7 +427,7 @@ __gitcomp_builtin ()
if [ -z "$options" ]; then
local completion_helper
- if [ "$GIT_COMPLETION_SHOW_ALL" = "1" ]; then
+ if [ "${GIT_COMPLETION_SHOW_ALL-}" = "1" ]; then
completion_helper="--git-completion-helper-all"
else
completion_helper="--git-completion-helper"
@@ -1910,7 +1910,7 @@ _git_help ()
return
;;
esac
- if test -n "$GIT_TESTING_ALL_COMMAND_LIST"
+ if test -n "${GIT_TESTING_ALL_COMMAND_LIST-}"
then
__gitcomp "$GIT_TESTING_ALL_COMMAND_LIST $(__git --list-cmds=alias,list-guide) gitk"
else