summaryrefslogtreecommitdiff
path: root/read-cache.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2011-06-07 03:49:06 (GMT)
committerJunio C Hamano <gitster@pobox.com>2011-06-07 19:22:51 (GMT)
commit3bdf09c7f555d553b4fee00c00c760b546812d4f (patch)
tree957ccc58974a3d0bf19f0943dc60846fa28bf74e /read-cache.c
parent56948cb6aa8189e3b77c700119d179172e0f8c4a (diff)
downloadgit-3bdf09c7f555d553b4fee00c00c760b546812d4f.zip
git-3bdf09c7f555d553b4fee00c00c760b546812d4f.tar.gz
git-3bdf09c7f555d553b4fee00c00c760b546812d4f.tar.bz2
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 <gitster@pobox.com>
Diffstat (limited to 'read-cache.c')
-rw-r--r--read-cache.c13
1 files changed, 3 insertions, 10 deletions
diff --git a/read-cache.c b/read-cache.c
index 31cf0b5..3593291 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++;
}