|
50 | 50 | # variable.
|
51 | 51 | __git_find_repo_path ()
|
52 | 52 | {
|
53 |
| - if [ -n "$__git_repo_path" ]; then |
| 53 | + if [ -n "${__git_repo_path-}" ]; then |
54 | 54 | # we already know where it is
|
55 | 55 | return
|
56 | 56 | fi
|
@@ -404,12 +404,12 @@ __gitcomp_builtin ()
|
404 | 404 | # spaces must be replaced with underscore for multi-word
|
405 | 405 | # commands, e.g. "git remote add" becomes remote_add.
|
406 | 406 | local cmd="$1"
|
407 |
| - local incl="$2" |
408 |
| - local excl="$3" |
| 407 | + local incl="${2-}" |
| 408 | + local excl="${3-}" |
409 | 409 |
|
410 | 410 | local var=__gitcomp_builtin_"${cmd/-/_}"
|
411 | 411 | local options
|
412 |
| - eval "options=\$$var" |
| 412 | + eval "options=\${$var-}" |
413 | 413 |
|
414 | 414 | if [ -z "$options" ]; then
|
415 | 415 | # leading and trailing spaces are significant to make
|
@@ -801,7 +801,7 @@ __git_refs ()
|
801 | 801 | # --remote is only compatible with --mode=refs.
|
802 | 802 | __git_complete_refs ()
|
803 | 803 | {
|
804 |
| - local remote dwim pfx cur_="$cur" sfx=" " mode="refs" |
| 804 | + local remote= dwim= pfx= cur_="$cur" sfx=" " mode="refs" |
805 | 805 |
|
806 | 806 | while test $# != 0; do
|
807 | 807 | case "$1" in
|
@@ -1152,7 +1152,7 @@ __git_find_on_cmdline ()
|
1152 | 1152 | while [ $c -lt $cword ]; do
|
1153 | 1153 | for word in $wordlist; do
|
1154 | 1154 | if [ "$word" = "${words[c]}" ]; then
|
1155 |
| - if [ -n "$show_idx" ]; then |
| 1155 | + if [ -n "${show_idx-}" ]; then |
1156 | 1156 | echo "$c $word"
|
1157 | 1157 | else
|
1158 | 1158 | echo "$word"
|
@@ -1468,7 +1468,7 @@ __git_checkout_default_dwim_mode ()
|
1468 | 1468 | {
|
1469 | 1469 | local last_option dwim_opt="--dwim"
|
1470 | 1470 |
|
1471 |
| - if [ "$GIT_COMPLETION_CHECKOUT_NO_GUESS" = "1" ]; then |
| 1471 | + if [ "${GIT_COMPLETION_CHECKOUT_NO_GUESS-}" = "1" ]; then |
1472 | 1472 | dwim_opt=""
|
1473 | 1473 | fi
|
1474 | 1474 |
|
@@ -3350,7 +3350,7 @@ __git_main ()
|
3350 | 3350 | ((c++))
|
3351 | 3351 | done
|
3352 | 3352 |
|
3353 |
| - if [ -z "$command" ]; then |
| 3353 | + if [ -z "${command-}" ]; then |
3354 | 3354 | case "$prev" in
|
3355 | 3355 | --git-dir|-C|--work-tree)
|
3356 | 3356 | # these need a path argument, let's fall back to
|
@@ -3385,7 +3385,7 @@ __git_main ()
|
3385 | 3385 | "
|
3386 | 3386 | ;;
|
3387 | 3387 | *)
|
3388 |
| - if test -n "$GIT_TESTING_PORCELAIN_COMMAND_LIST" |
| 3388 | + if test -n "${GIT_TESTING_PORCELAIN_COMMAND_LIST-}" |
3389 | 3389 | then
|
3390 | 3390 | __gitcomp "$GIT_TESTING_PORCELAIN_COMMAND_LIST"
|
3391 | 3391 | else
|
|
0 commit comments