[PATCH 1/2] Allow __git_ps1 to be used in PROMPT_COMMAND

2012-10-10 Thread Simon Oosthoek
Changes __git_ps1 to allow its use as PROMPT_COMMAND in bash in addition to setting PS1 with __git_ps1 in a command substitution. PROMPT_COMMAND has advantages for using color without running into prompt-wrapping issues. Only by assigning \[ and \] to PS1 directly can bash know that these and the

[PATCH 1/2] Allow __git_ps1 to be used in PROMPT_COMMAND

2012-10-10 Thread Simon Oosthoek
Apologies if you receive this e-mail multiple times, my MTA was misconfigured... Changes __git_ps1 to allow its use as PROMPT_COMMAND in bash in addition to setting PS1 with __git_ps1 in a command substitution. PROMPT_COMMAND has advantages for using color without running into prompt-wrapping

Re: [PATCH 1/2] Allow __git_ps1 to be used in PROMPT_COMMAND

2012-10-10 Thread Junio C Hamano
Simon Oosthoek s.oosth...@xs4all.nl writes: __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 ... @@ -284,6 +317,12 @@ __git_ps1 ()

Re: [PATCH 1/2] Allow __git_ps1 to be used in PROMPT_COMMAND

2012-10-08 Thread Junio C Hamano
Simon Oosthoek s.oosth...@xs4all.nl writes: changes __git_ps1 to not just allow use in setting PS1 with __git_ps1 in a command substitution, but also allows __git_ps1 to be used as PROMPT_COMMAND in bash. This has advantages for using color and I think it is more elegant Is and I think

Re: [PATCH 1/2] Allow __git_ps1 to be used in PROMPT_COMMAND

2012-10-08 Thread Simon Oosthoek
Hi Junio thanks for your feedback! On 08/10/12 20:12, Junio C Hamano wrote: Simon Oosthoek s.oosth...@xs4all.nl writes: changes __git_ps1 to not just allow use in setting PS1 with __git_ps1 in a command substitution, but also allows __git_ps1 to be used as PROMPT_COMMAND in bash. This has

Re: [PATCH 1/2] Allow __git_ps1 to be used in PROMPT_COMMAND

2012-10-08 Thread Junio C Hamano
Simon Oosthoek s.oosth...@xs4all.nl writes: How about This has advantages for using color without running into prompt-wrapping issues. Only by assigning \[ and \] to PS1 directly can bash know these and the color codes in between don't count in the length of the prompt.? I'll rewrite the

[PATCH 1/2] Allow __git_ps1 to be used in PROMPT_COMMAND

2012-10-05 Thread Simon Oosthoek
changes __git_ps1 to not just allow use in setting PS1 with __git_ps1 in a command substitution, but also allows __git_ps1 to be used as PROMPT_COMMAND in bash. This has advantages for using color and I think it is more elegant Signed-off-by: Simon Oosthoek soosth...@nieuwland.nl ---