@matheusbsbs / matheus-bagliano / commits / 5c9cc64a4a
Fork 0

completion: More fixes to prevent unbound variable errors

Several functions make use of "[-n ...]" and "[-z ...]". In many cases, the variables being tested were declared with "local." However, several __variables are not, and so they must be replaced with their ${__-} equivalents. Signed-off-by: Ted Pavlic <ted@tedpavlic.com> Acked-by: Shawn O. Pearce <spearce@spearce.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Ted Pavlic committed Feb 11, 2009 at 13:03 UTC 5c9cc64a4a608ab0bbd5eb5c8e405bfe050be309
1 file changed +4 -4
contrib/completion/git-completion.bash
+4 -4
@@ -62,7 +62,7 @@ esac
62 __gitdir ()
63 {
64 if [ -z "${1-}" ]; then
65 - if [ -n "$__git_dir" ]; then
65 + if [ -n "${__git_dir-}" ]; then
66 echo "$__git_dir"
67 elif [ -d .git ]; then
68 echo .git
@@ -298,7 +298,7 @@ __git_remotes ()
298
299 __git_merge_strategies ()
300 {
301 - if [ -n "$__git_merge_strategylist" ]; then
301 + if [ -n "${__git_merge_strategylist-}" ]; then
302 echo "$__git_merge_strategylist"
303 return
304 fi
@@ -384,7 +384,7 @@ __git_complete_revlist ()
384
385 __git_all_commands ()
386 {
387 - if [ -n "$__git_all_commandlist" ]; then
387 + if [ -n "${__git_all_commandlist-}" ]; then
388 echo "$__git_all_commandlist"
389 return
390 fi
@@ -402,7 +402,7 @@ __git_all_commandlist="$(__git_all_commands 2>/dev/null)"
402
403 __git_porcelain_commands ()
404 {
405 - if [ -n "$__git_porcelain_commandlist" ]; then
405 + if [ -n "${__git_porcelain_commandlist-}" ]; then
406 echo "$__git_porcelain_commandlist"
407 return
408 fi