summaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authorAndrew Sayers <andrew-git@pileofstuff.org>2010-06-17 22:32:16 +0100
committerJunio C Hamano <gitster@pobox.com>2010-06-18 09:15:52 -0700
commit6c44b6406bc9093945aa030f33c06ecda47ba7f5 (patch)
tree0aa0f4afa1df44b2ae328f35206aa26f98ca64ac /contrib
parent45a0ee116348d1b36756fe47d338713c06b918ad (diff)
downloadgit-6c44b6406bc9093945aa030f33c06ecda47ba7f5.tar.gz
bash-completion: Fix __git_ps1 to work with "set -u"
Define several variables in __git_ps1 to avoid errors under "set -u" semantics. __git_ps1 seems to have been missed when the rest of the file was fixed in 25a31f8. Signed-off-by: Andrew Sayers <andrew-git@pileofstuff.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'contrib')
-rwxr-xr-xcontrib/completion/git-completion.bash14
1 files changed, 7 insertions, 7 deletions
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 57245a8c01..256b1a8f92 100755
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -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