From: Junio C Hamano Date: Tue, 7 Jun 2011 03:49:06 +0000 (-0700) Subject: verify_path(): simplify check at the directory boundary X-Git-Tag: v1.7.7-rc0~117^2~1 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=3bdf09c7f555d553b4fee00c00c760b546812d4f;p=git.git verify_path(): simplify check at the directory boundary We simply want to say "At a directory boundary, be careful with a name that begins with a dot, forbid a name that ends with the boundary character or has duplicated bounadry characters". Signed-off-by: Junio C Hamano --- diff --git a/read-cache.c b/read-cache.c index 31cf0b503..3593291f7 100644 --- a/read-cache.c +++ b/read-cache.c @@ -784,16 +784,9 @@ int verify_path(const char *path) if (is_dir_sep(c)) { inside: c = *path++; - switch (c) { - default: - continue; - case '/': case '\0': - break; - case '.': - if (verify_dotfile(path)) - continue; - } - return 0; + if ((c == '.' && !verify_dotfile(path)) || + is_dir_sep(c) || c == '\0') + return 0; } c = *path++; }