From: mhagger@alum.mit.edu Date: Mon, 30 Apr 2012 23:02:50 GMT Subject: [RFC 2/7] check_refname_component(): fix check with REFNAME_DOT_COMPONENT Message-ID: <1335826975-3093-3-git-send-email-mhagger@alum.mit.edu> In-Reply-To: <1335826975-3093-1-git-send-email-mhagger@alum.mit.edu> From: Michael Haggerty When REFNAME_DOT_COMPONENT is set, we want to allow refname components that start with '.' but not equal to ".". The old code would have allowed refname components equal to "." if they were not the last component of the refname. Fix the test. Signed-off-by: Michael Haggerty --- refs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/refs.c b/refs.c index 927d36c..c293fd2 100644 --- a/refs.c +++ b/refs.c @@ -59,7 +59,7 @@ static int check_refname_component(const char *refname, int flags) * Even if leading dots are allowed, don't allow "." * as a component (".." is prevented by a rule above). */ - if (len == 1) + if (i == 1) return -1; /* Component equals ".". */ } if (i >= 5 && !memcmp(&refname[i - 5], ".lock", 5)) -- 1.7.10