Merge branch 'vs/completion-with-set-u'

The command-line completion script (in contrib/) had a couple of
references that would have given a warning under the "-u" (nounset)
option.

* vs/completion-with-set-u:
  completion: audit and guard $GIT_* against unset use
This commit is contained in:
Junio C Hamano
2021-04-13 15:28:53 -07:00

View File

@ -77,7 +77,7 @@ __git_find_repo_path ()
test -d "$__git_dir" && test -d "$__git_dir" &&
__git_repo_path="$__git_dir" __git_repo_path="$__git_dir"
elif [ -n "${GIT_DIR-}" ]; then elif [ -n "${GIT_DIR-}" ]; then
test -d "${GIT_DIR-}" && test -d "$GIT_DIR" &&
__git_repo_path="$GIT_DIR" __git_repo_path="$GIT_DIR"
elif [ -d .git ]; then elif [ -d .git ]; then
__git_repo_path=.git __git_repo_path=.git
@ -427,7 +427,7 @@ __gitcomp_builtin ()
if [ -z "$options" ]; then if [ -z "$options" ]; then
local completion_helper local completion_helper
if [ "$GIT_COMPLETION_SHOW_ALL" = "1" ]; then if [ "${GIT_COMPLETION_SHOW_ALL-}" = "1" ]; then
completion_helper="--git-completion-helper-all" completion_helper="--git-completion-helper-all"
else else
completion_helper="--git-completion-helper" completion_helper="--git-completion-helper"
@ -1910,7 +1910,7 @@ _git_help ()
return return
;; ;;
esac esac
if test -n "$GIT_TESTING_ALL_COMMAND_LIST" if test -n "${GIT_TESTING_ALL_COMMAND_LIST-}"
then then
__gitcomp "$GIT_TESTING_ALL_COMMAND_LIST $(__git --list-cmds=alias,list-guide) gitk" __gitcomp "$GIT_TESTING_ALL_COMMAND_LIST $(__git --list-cmds=alias,list-guide) gitk"
else else