summaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2020-07-09 21:00:41 (GMT)
committerJunio C Hamano <gitster@pobox.com>2020-07-09 21:00:41 (GMT)
commitb2b7a5410d811579932a22ff61092780be1f0bb7 (patch)
tree39a4fcbb912ea2b41357377ffbfd6d82f415f175 /contrib
parent8251695fe72eed0b2ad9c3762ed53e04a7ee4f5e (diff)
parentc2dbcd206d2d654c1d934501a7f03a5a0f452b92 (diff)
downloadgit-b2b7a5410d811579932a22ff61092780be1f0bb7.zip
git-b2b7a5410d811579932a22ff61092780be1f0bb7.tar.gz
git-b2b7a5410d811579932a22ff61092780be1f0bb7.tar.bz2
Merge branch 'vs/completion-with-set-u' into master
The command line completion support (in contrib/) used to be prepared to work with "set -u" but recent changes got a bit more sloppy. This has been corrected. * vs/completion-with-set-u: completion: nounset mode fixes
Diffstat (limited to 'contrib')
-rw-r--r--contrib/completion/git-completion.bash18
1 files changed, 9 insertions, 9 deletions
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index de5d0fb..ee468ea 100644
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -50,7 +50,7 @@ esac
# variable.
__git_find_repo_path ()
{
- if [ -n "$__git_repo_path" ]; then
+ if [ -n "${__git_repo_path-}" ]; then
# we already know where it is
return
fi
@@ -404,12 +404,12 @@ __gitcomp_builtin ()
# spaces must be replaced with underscore for multi-word
# commands, e.g. "git remote add" becomes remote_add.
local cmd="$1"
- local incl="$2"
- local excl="$3"
+ local incl="${2-}"
+ local excl="${3-}"
local var=__gitcomp_builtin_"${cmd/-/_}"
local options
- eval "options=\$$var"
+ eval "options=\${$var-}"
if [ -z "$options" ]; then
# leading and trailing spaces are significant to make
@@ -801,7 +801,7 @@ __git_refs ()
# --remote is only compatible with --mode=refs.
__git_complete_refs ()
{
- local remote dwim pfx cur_="$cur" sfx=" " mode="refs"
+ local remote= dwim= pfx= cur_="$cur" sfx=" " mode="refs"
while test $# != 0; do
case "$1" in
@@ -1152,7 +1152,7 @@ __git_find_on_cmdline ()
while [ $c -lt $cword ]; do
for word in $wordlist; do
if [ "$word" = "${words[c]}" ]; then
- if [ -n "$show_idx" ]; then
+ if [ -n "${show_idx-}" ]; then
echo "$c $word"
else
echo "$word"
@@ -1468,7 +1468,7 @@ __git_checkout_default_dwim_mode ()
{
local last_option dwim_opt="--dwim"
- if [ "$GIT_COMPLETION_CHECKOUT_NO_GUESS" = "1" ]; then
+ if [ "${GIT_COMPLETION_CHECKOUT_NO_GUESS-}" = "1" ]; then
dwim_opt=""
fi
@@ -3350,7 +3350,7 @@ __git_main ()
((c++))
done
- if [ -z "$command" ]; then
+ if [ -z "${command-}" ]; then
case "$prev" in
--git-dir|-C|--work-tree)
# these need a path argument, let's fall back to
@@ -3385,7 +3385,7 @@ __git_main ()
"
;;
*)
- if test -n "$GIT_TESTING_PORCELAIN_COMMAND_LIST"
+ if test -n "${GIT_TESTING_PORCELAIN_COMMAND_LIST-}"
then
__gitcomp "$GIT_TESTING_PORCELAIN_COMMAND_LIST"
else