[prev in list] [next in list] [prev in thread] [next in thread] 

List:       git
Subject:    [RFC 2/7] check_refname_component(): fix check with REFNAME_DOT_COMPONENT
From:       mhagger () alum ! mit ! edu
Date:       2012-04-30 23:02:50
Message-ID: 1335826975-3093-3-git-send-email-mhagger () alum ! mit ! edu
[Download RAW message or body]

From: Michael Haggerty <mhagger@alum.mit.edu>

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 <mhagger@alum.mit.edu>
---
 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

--
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
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic