Re: [PATCH v4] git-prompt: make colourization consistent
- From
Joakim Petersen <joak-pet@online.no>
- Date
- Jun 4, 2022, 19:18 UTC
- Message-ID
- <5e6850aa-e2ba-e7d5-0abc-b1190f7b0f9f@online.no>
- In-Reply-To
- <CAGTqyRxS9aBitVivSTqojX_C_VBdgrD7JkUKgKSE6apjabzvQg@mail.gmail.com>
On 04/06/2022 19:30, Justin Donnelly wrote:
Show 7 quoted lines
> I like this solution. This isn't new, but does anybody know if there > is a reason why `$w` is compared for equality to "*" as opposed to > just checking whether it's a nonempty value (`-n`)? I think I'd > generally prefer it to be consistent with the others, which has the > added benefit of continuing to work if the asterisk is ever changed to > something else. >
Looking at the commit that introduced colourization, 9b7e776c0a5 (show color hints based on state of the git tree, 2012-10-10), it looks like the author wanted the be as specific as possible in the check, with $w only being empty or holding a '*', while $i could hold multiple different indicators. Since the layout of the script has changed significantly since then, I'll submit a v5 shortly with the $w check altered.