Re: [PATCH] Colourise git-branch output
- From
Junio C Hamano <junkio@cox.net>
- Date
- Nov 3, 2006, 19:25 UTC
- Message-ID
- <7v3b908h88.fsf@assigned-by-dhcp.cox.net>
- In-Reply-To
- <200611031206.12515.andyparkins@gmail.com>
Andy Parkins <andyparkins@gmail.com> writes:
Show 5 quoted lines
> I wanted to have a visual indication of which branches are > local and which are remote in git-branch -a output; however > Junio was concerned that someone might be using the output in > a script. This patch addresses the problem by colouring the > git-branch output - which in "auto" mode won't be activated.
Yuck. We are getting more and more color happy. As long as this stays optional I'm Ok with it; we'll see if people find it useful soon enough.
Show 8 quoted lines
> @@ -165,11 +199,28 @@ static void print_ref_list( int type_wan
> qsort(ref_list.list, ref_list.index, sizeof(struct ref_item), ref_cmp);
>
> for (i = 0; i < ref_list.index; i++) {
> + switch( ref_list.list[i].type ) {
> + case REF_LOCAL_BRANCH:
> + color = COLOR_BRANCH_LOCAL;
> + break;Style. SP between "switch" and open parenthesis, no SP after that open parenthesis. We tend to align "switch", "case", and "default" on the same column.