bash-completion: Fix __git_ps1 to work with "set -u"
[gitweb.git] / contrib / completion / git-completion.bash
index 57245a8c01fa3aba4f9e3f2bc258b40f38f446c0..256b1a8f9299d238af9f1633c778db705c9e1258 100755 (executable)
@@ -84,8 +84,8 @@ __git_ps1 ()
 {
        local g="$(__gitdir)"
        if [ -n "$g" ]; then
-               local r
-               local b
+               local r=""
+               local b=""
                if [ -f "$g/rebase-merge/interactive" ]; then
                        r="|REBASE-i"
                        b="$(cat "$g/rebase-merge/head-name")"
@@ -127,11 +127,11 @@ __git_ps1 ()
                        }
                fi
 
-               local w
-               local i
-               local s
-               local u
-               local c
+               local w=""
+               local i=""
+               local s=""
+               local u=""
+               local c=""
 
                if [ "true" = "$(git rev-parse --is-inside-git-dir 2>/dev/null)" ]; then
                        if [ "true" = "$(git rev-parse --is-bare-repository 2>/dev/null)" ]; then