From: Dan Zwell Date: Tue, 13 Nov 2007 02:55:13 GMT Subject: Re: Subject: [PATCH 2/3] Let git-add--interactive read colors from .gitconfig Message-ID: <47391211.5000606@zwell.net> In-Reply-To: <7v4pfq27tx.fsf@gitster.siamese.dyndns.org> Junio C Hamano wrote: > I suggested the hash approach only because (1) it is easier to > read than two regexp matches that are split only to keep the > line less than 80-chars long, and (2) a misconfiguration like > "color.foo = fred" can be caught more easily. > > I do not quite understand the "after all, we're pattern > matching" part, though. Are you talking about "split(/\s+/, $str)" > your for-loop iterates over? > I think we're talking about the same thing. I was referring to the split regular expression, and the question is, "for the current element of split(/\s+/, $str), does it match a color?" Anyway, I preferred the regex version for readability, though I should have used the /x modifier--it would still take two lines, but it would not need to attempt two matches. As for misconfigured color configurations, should we catch that? I wrote this with the intent that it should ignore invalid color names, but it would probably be more useful to print a warning. Dan