Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
verify_path: drop clever fallthrough
author
Jeff King
<peff@peff.net>
Sun, 13 May 2018 17:00:23 +0000
(13:00 -0400)
committer
Jeff King
<peff@peff.net>
Tue, 22 May 2018 03:50:11 +0000
(23:50 -0400)
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>
read-cache.c
patch
|
blob
|
history
raw
|
patch
|
inline
| side by side (parent:
41a8092
)
diff --git
a/read-cache.c
b/read-cache.c
index 6238df448f8d7954b28630749336eceab70c67f3..5c5dfc629d6e2c25b8cbcd36d28448609ecd9f91 100644
(file)
--- a/
read-cache.c
+++ b/
read-cache.c
@@
-810,8
+810,7
@@
static int verify_dotfile(const char *rest)
switch (*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':
*/
case 'g':
case 'G':
@@
-819,8
+818,9
@@
static int verify_dotfile(const char *rest)
break;
if (rest[2] != 't' && rest[2] != 'T')
break;
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;
case '.':
if (rest[1] == '\0' || is_dir_sep(rest[1]))
return 0;