Re: [PATCH 2/2] Let git-add--interactive read colors from git-config
- From
Jeff King <peff@peff.net>
- Date
- Oct 23, 2007, 04:27 UTC
- Message-ID
- <20071023042702.GB28312@coredump.intra.peff.net>
- In-Reply-To
- <20071022164048.71a3dceb@danzwell.com>
On Mon, Oct 22, 2007 at 04:40:48PM -0500, Dan Zwell wrote:
Show 5 quoted lines
> Note: the code to parse git-style color strings to perl-style color > strings should eventually be added to Git.pm so that other (perl) > parts of git can be configured to read colors from .gitconfig in > a nicer way. A git-style string is "ul red black", while perl > likes strings like "underline red on_black".
Why not do it as part of this patch, then?
> + # Sane (visible) defaults:
> + if (! @git_prompt_color) {
> + @git_prompt_color = ("blue", "bold");
> + }I think it might be a bit more readable to keep the assignment and defaults together:
my @git_prompt_color = split /\s+/,
qx(git config --get color.interactive.prompt) || 'blue bold';Though I wonder why we are splitting here at all, since we just end up converting the list into a scalar below. And if we just turned that into a function, we could get a nice:
my $prompt_color = git_color_to_ansicolor(
qx(git config --get color.interactive.prompt) || 'blue bold');-Peff