Re: [PATCH 3/3] Change colors to be based on git status -sb in color mode
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Oct 16, 2012, 21:30 UTC
- Message-ID
- <7vtxtuqf3z.fsf@alter.siamese.dyndns.org>
- In-Reply-To
- <20121016193405.GA12073@simaj.xs4all.nl>
Simon Oosthoek <s.oosthoek@xs4all.nl> writes:
Show 6 quoted lines
> 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.
I think it would be a good idea to squash something like the attached into this patch, though.
contrib/completion/git-prompt.sh | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
diff --git i/contrib/completion/git-prompt.sh w/contrib/completion/git-prompt.sh index dced628..9f0b6bb 100644 --- i/contrib/completion/git-prompt.sh +++ w/contrib/completion/git-prompt.sh @@ -215,7 +215,7 @@ __git_ps1_show_upstream () __git_ps1 () { local pcmode=no - #defaults/examples: + local detached=no local ps1pc_start='\u@\h:\w ' local ps1pc_end='\$ ' local printf_format=' (%s)' @@ -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" else branch_color="$bad_color"