Re: [PATCH 3/3] Change colors to be based on git status -sb in color mode
- From
Simon Oosthoek <s.oosthoek@xs4all.nl>
- Date
- Oct 17, 2012, 07:17 UTC
- Message-ID
- <507E5B98.2020006@xs4all.nl>
- In-Reply-To
- <7vtxtuqf3z.fsf@alter.siamese.dyndns.org>
On 16/10/12 23:30, Junio C Hamano wrote:
Show 10 quoted lines
> Simon Oosthoek <s.oosthoek@xs4all.nl> writes: > >> Hi >> >> Fixed the mistakes of the last one, and I'm now using the symbolic names "ok_color" and "bad_color". >> The test for headless state is now more direct, and I hope it is still correct. >> >> /Simon > > Will apply with a bit more readable log message.
Ok
> > I think it would be a good idea to squash something like the > attached into this patch, though.
I tried the patch and it works when you switch the color assignments in the if statement you added...
Show 16 quoted lines
> @@ -264,7 +264,7 @@ __git_ps1 ()
> fi
>
> b="$(git symbolic-ref HEAD 2>/dev/null)" || {
> -
> + detached=yes
> b="$(
> case "${GIT_PS1_DESCRIBE_STYLE-}" in
> (contains)
> @@ -335,8 +335,7 @@ __git_ps1 ()
> local flags_color="$c_lblue"
> local branchstring="$c${b##refs/heads/}"
>
> - if git symbolic-ref HEAD 2>/dev/null 1>&2
> - then
> + if [ $detached = yes ]; then- branch_color="$ok_color" + branch_color="$bad_color"
> else
- branch_color="$bad_color" + branch_color="$ok_color"
if detached = yes, then bad_color should be applied, else use ok_color.
Cheers
Simon