From: Junio C Hamano Date: Wed, 7 Jan 2015 21:09:35 +0000 (-0800) Subject: Merge branch 'tf/prompt-preserve-exit-status' X-Git-Tag: v2.3.0-rc0~14 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/487b17de3ea1842b91a739cf31a08130faa03856?hp=-c Merge branch 'tf/prompt-preserve-exit-status' Using the exit status of the last command in the prompt, e.g. PS1='$(__git_ps1) $? ', did not work well because the helper function stomped on the exit status. * tf/prompt-preserve-exit-status: git-prompt: preserve value of $? inside shell prompt --- 487b17de3ea1842b91a739cf31a08130faa03856 diff --combined contrib/completion/git-prompt.sh index 729f769479,5fe69d046f..3c3fc6d5d9 --- a/contrib/completion/git-prompt.sh +++ b/contrib/completion/git-prompt.sh @@@ -270,7 -270,7 +270,7 @@@ __git_ps1_colorize_gitstring ( __git_eread () { - f="$1" + local f="$1" shift test -r "$f" && read "$@" <"$f" } @@@ -288,6 -288,7 +288,7 @@@ # In this mode you can request colored hints using GIT_PS1_SHOWCOLORHINTS=true __git_ps1 () { + local exit=$? local pcmode=no local detached=no local ps1pc_start='\u@\h:\w ' @@@ -511,4 -512,7 +512,7 @@@ else printf -- "$printf_format" "$gitstring" fi + + # preserve exit status + return $exit }