Re: [PATCH] Colourise git-branch output

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Andy Parkins <andyparkins@xxxxxxxxx> writes:

> The colour parameter is "color.branch" rather than "branch.color" to
> avoid clashing with the default namespace for default branch merge
> definitions.

Very nice.

>  		c = ' ';
>  		if (ref_list.list[i].kind == REF_LOCAL_BRANCH &&
> -				!strcmp(ref_list.list[i].name, head))
> +				!strcmp(ref_list.list[i].name, head)) {
>  			c = '*';
> +			color = COLOR_BRANCH_CURRENT;
> +		}
>  
>  		if (verbose) {
> -			printf("%c %-*s", c, ref_list.maxwidth,
> -			       ref_list.list[i].name);
> +			printf("%c %s%-*s%s", c,
> +					branch_get_color(color),
> +					ref_list.maxwidth,
> +					ref_list.list[i].name,
> +					branch_get_color(COLOR_BRANCH_RESET));
>  			print_ref_info(ref_list.list[i].sha1, abbrev);
>  		}
>  		else
> -			printf("%c %s\n", c, ref_list.list[i].name);
> +			printf("%c %s%s%s\n", c,
> +					branch_get_color(color),
> +					ref_list.list[i].name,
> +					branch_get_color(COLOR_BRANCH_RESET));
>  	}

Now this makes me wonder if under output coloring we would still
want the two-space indent and '*' prefix.

-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]