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
This commit is contained in:
Junio C Hamano 2015-01-07 13:09:35 -08:00
commit 487b17de3e

View File

@ -288,6 +288,7 @@ __git_eread ()
# 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 @@ __git_ps1 ()
else
printf -- "$printf_format" "$gitstring"
fi
# preserve exit status
return $exit
}