Merge branch 'sb/maint-octopus'
[gitweb.git] / contrib / completion / git-completion.bash
index c65462c9ed113e3dffcd50d1fe405bb68385b98a..3a6498c04ba3382df04b964dcc45bfe60ecc6df1 100755 (executable)
@@ -163,11 +163,8 @@ __git_ps1 ()
                        fi
                fi
 
-               if [ -n "${1-}" ]; then
-                       printf "$1" "$c${b##refs/heads/}$w$i$s$u$r"
-               else
-                       printf " (%s)" "$c${b##refs/heads/}$w$i$s$u$r"
-               fi
+               local f="$w$i$s$u"
+               printf "${1:- (%s)}" "$c${b##refs/heads/}${f:+ $f}$r"
        fi
 }