summaryrefslogtreecommitdiff
path: root/read-cache.c
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2018-05-13 17:00:23 (GMT)
committerJeff King <peff@peff.net>2018-05-22 03:50:11 (GMT)
commite19e5e66d691bdeeeb5e0ed2ffcecdd7666b0d7b (patch)
treed274664188ab560297f020005873b4bee2190473 /read-cache.c
parent41a80924aec0e94309786837b6f954a3b3f19b71 (diff)
downloadgit-e19e5e66d691bdeeeb5e0ed2ffcecdd7666b0d7b.zip
git-e19e5e66d691bdeeeb5e0ed2ffcecdd7666b0d7b.tar.gz
git-e19e5e66d691bdeeeb5e0ed2ffcecdd7666b0d7b.tar.bz2
verify_path: drop clever fallthrough
We check ".git" and ".." in the same switch statement, and fall through the cases to share the end-of-component check. While this saves us a line or two, it makes modifying the function much harder. Let's just write it out. Signed-off-by: Jeff King <peff@peff.net>
Diffstat (limited to 'read-cache.c')
-rw-r--r--read-cache.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/read-cache.c b/read-cache.c
index 6238df4..5c5dfc6 100644
--- a/read-cache.c
+++ b/read-cache.c
@@ -810,8 +810,7 @@ static int verify_dotfile(const char *rest)
switch (*rest) {
/*
- * ".git" followed by NUL or slash is bad. This
- * shares the path end test with the ".." case.
+ * ".git" followed by NUL or slash is bad.
*/
case 'g':
case 'G':
@@ -819,8 +818,9 @@ static int verify_dotfile(const char *rest)
break;
if (rest[2] != 't' && rest[2] != 'T')
break;
- rest += 2;
- /* fallthrough */
+ if (rest[3] == '\0' || is_dir_sep(rest[3]))
+ return 0;
+ break;
case '.':
if (rest[1] == '\0' || is_dir_sep(rest[1]))
return 0;