summaryrefslogtreecommitdiff
path: root/contrib/completion/git-prompt.sh
diff options
context:
space:
mode:
authorTony Finch <dot@dotat.at>2015-01-14 10:06:28 (GMT)
committerJunio C Hamano <gitster@pobox.com>2015-01-14 18:11:49 (GMT)
commit6babe76496db332d589c1a2e0a2344fe41ca1dd5 (patch)
tree1e1e71a65a6182d284e45b9480603c0ad41caf38 /contrib/completion/git-prompt.sh
parenteb443e3b39482b3d64c1efd46de7481c3321a87a (diff)
downloadgit-6babe76496db332d589c1a2e0a2344fe41ca1dd5.zip
git-6babe76496db332d589c1a2e0a2344fe41ca1dd5.tar.gz
git-6babe76496db332d589c1a2e0a2344fe41ca1dd5.tar.bz2
git-prompt: preserve value of $? in all cases
Signed-off-by: Tony Finch <dot@dotat.at> Reviewed-by: SZEDER Gábor <szeder@ira.uka.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'contrib/completion/git-prompt.sh')
-rw-r--r--contrib/completion/git-prompt.sh8
1 files changed, 4 insertions, 4 deletions
diff --git a/contrib/completion/git-prompt.sh b/contrib/completion/git-prompt.sh
index 5fe69d0..3a11f4e 100644
--- a/contrib/completion/git-prompt.sh
+++ b/contrib/completion/git-prompt.sh
@@ -288,6 +288,7 @@ __git_eread ()
# In this mode you can request colored hints using GIT_PS1_SHOWCOLORHINTS=true
__git_ps1 ()
{
+ # preserve exit status
local exit=$?
local pcmode=no
local detached=no
@@ -303,7 +304,7 @@ __git_ps1 ()
;;
0|1) printf_format="${1:-$printf_format}"
;;
- *) return
+ *) return $exit
;;
esac
@@ -355,7 +356,7 @@ __git_ps1 ()
#In PC mode PS1 always needs to be set
PS1="$ps1pc_start$ps1pc_end"
fi
- return
+ return $exit
fi
local short_sha
@@ -416,7 +417,7 @@ __git_ps1 ()
if [ $pcmode = yes ]; then
PS1="$ps1pc_start$ps1pc_end"
fi
- return
+ return $exit
fi
# is it a symbolic ref?
b="${head#ref: }"
@@ -513,6 +514,5 @@ __git_ps1 ()
printf -- "$printf_format" "$gitstring"
fi
- # preserve exit status
return $exit
}