Re: Subject: [PATCH 2/3] Let git-add--interactive read colors from .gitconfig

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Jeff King
Date: Tuesday, November 13, 2007 - 12:26 am

On Mon, Nov 12, 2007 at 08:55:13PM -0600, Dan Zwell wrote:


Your regex is wrong, because it doesn't anchor at the beginning and end
of the string (so /red/ will match "supercaliredfragilistic", which is
probably not what you want). So you probably want /^red$/, which is
equivalent to using 'eq' with 'red'. Or, as Junio noted, you are overall
trying to say "is element $word in this list"; the canonical perl way of
doing that is to make the list a hash for quick lookup.


Your patch doesn't just ignore; sometimes it accidentally matches
invalid input (the example above is obviously silly, but consider what
accidentally omitting the space in "blinkblack" would do).

-Peff
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Re: [PATCH] Color support added to git-add--interactive., Johannes Schindelin, (Sat Oct 13, 5:25 am)
Re: [PATCH] Color support added to git-add--interactive., Frank Lichtenheld, (Sat Oct 13, 5:49 am)
Re: [PATCH] Color support added to git-add--interactive., Wincent Colaiuta, (Sat Oct 13, 7:45 am)
Re: [PATCH] Color support added to git-add--interactive., Jean-Luc Herren, (Sat Oct 13, 9:38 am)
Re: [PATCH] Color support added to git-add--interactive., Johannes Schindelin, (Sat Oct 13, 9:38 am)
Re: [PATCH] Color support added to git-add--interactive., Wincent Colaiuta, (Sat Oct 13, 10:14 am)
Re: [PATCH] Color support added to git-add--interactive., Andreas Ericsson, (Sat Oct 13, 11:31 am)
Re: [PATCH] Color support added to git-add--interactive., Wincent Colaiuta, (Sat Oct 13, 1:36 pm)
Re: [PATCH] Color support added to git-add--interactive., Jean-Luc Herren, (Sat Oct 13, 3:23 pm)
Re: [PATCH 1/2] Added basic color support to git add --int ..., Wincent Colaiuta, (Mon Oct 22, 11:28 pm)
Re: [PATCH 1/2] Added basic color support to git add --int ..., Wincent Colaiuta, (Tue Oct 23, 12:44 am)
[PATCH 0/3] Adding colors to git-add--interactive, Dan Zwell, (Sat Nov 10, 5:01 pm)
[PATCH 0/3] Adding colors to git-add--interactive, Dan Zwell, (Sat Nov 10, 7:21 pm)
Re: [PATCH 0/3] Adding colors to git-add--interactive, Junio C Hamano, (Sun Nov 11, 1:23 am)
Re: Subject: [PATCH 2/3] Let git-add--interactive read col ..., Jeff King, (Tue Nov 13, 12:26 am)
[PATCH 0/5] Colors for git-add--interactive, Dan Zwell, (Thu Nov 22, 3:54 am)
Re: [PATCH 0/5] Colors for git-add--interactive, Jeff King, (Thu Nov 22, 4:57 am)
Re: [PATCH 0/5] Colors for git-add--interactive, Junio C Hamano, (Thu Nov 22, 12:20 pm)