Re: [PATCH 1/2] Allow __git_ps1 to be used in PROMPT_COMMAND
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Oct 10, 2012, 23:00 UTC
- Message-ID
- <7vlife9bkk.fsf@alter.siamese.dyndns.org>
- In-Reply-To
- <20121010193158.GA6454@simaj.xs4all.nl>
Simon Oosthoek <s.oosthoek@xs4all.nl> writes:
Show 8 quoted lines
> __git_ps1 ()
> {
> + local pcmode=no
> + #defaults/examples:
> + local ps1pc_start='\u@\h:\w '
> + local ps1pc_end='\$ '
> + local printf_format='(%s)'
> + ...This conversion is wrong, given that ...
Show 5 quoted lines
> @@ -284,6 +317,12 @@ __git_ps1 ()
> fi
>
> local f="$w$i$s$u"
> - printf -- "${1:- (%s)}" "$c${b##refs/heads/}${f:+ $f}$r$p"... the original has a SP in front. I've tentatively queued a fix-up patch on the topic branch before merging it to 'pu'.
Show 9 quoted lines
> + if [ $pcmode = yes ]; then
> + PS1="$ps1pc_start("
> + PS1="$PS1$c${b##refs/heads/}${f:+ $f}$r$p"
> + PS1="$PS1)$ps1pc_end"
> + else
> + printf -- "$printf_format" "$c${b##refs/heads/}${f:+ $f}$r$p"
> + fi
> fi
> }