summaryrefslogtreecommitdiff
path: root/read-cache.c
diff options
context:
space:
mode:
authorTheo Niessink <theo@taletn.com>2011-06-08 12:04:41 (GMT)
committerJunio C Hamano <gitster@pobox.com>2011-06-08 23:34:38 (GMT)
commite0f530ff8afbd252170f57e70a8609a83a7cabe1 (patch)
treec6fa772930e8c6dfe359165995e7e83a20024b35 /read-cache.c
parent3bdf09c7f555d553b4fee00c00c760b546812d4f (diff)
downloadgit-e0f530ff8afbd252170f57e70a8609a83a7cabe1.zip
git-e0f530ff8afbd252170f57e70a8609a83a7cabe1.tar.gz
git-e0f530ff8afbd252170f57e70a8609a83a7cabe1.tar.bz2
verify_dotfile(): do not assume '/' is the path seperator
verify_dotfile() currently assumes that the path seperator is '/', but on Windows it can also be '\\', so use is_dir_sep() instead. Signed-off-by: Theo Niessink <theo@taletn.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'read-cache.c')
-rw-r--r--read-cache.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/read-cache.c b/read-cache.c
index 3593291..e7c9684 100644
--- a/read-cache.c
+++ b/read-cache.c
@@ -747,11 +747,12 @@ static int verify_dotfile(const char *rest)
* has already been discarded, we now test
* the rest.
*/
- switch (*rest) {
+
/* "." is not allowed */
- case '\0': case '/':
+ if (*rest == '\0' || is_dir_sep(*rest))
return 0;
+ switch (*rest) {
/*
* ".git" followed by NUL or slash is bad. This
* shares the path end test with the ".." case.
@@ -764,7 +765,7 @@ static int verify_dotfile(const char *rest)
rest += 2;
/* fallthrough */
case '.':
- if (rest[1] == '\0' || rest[1] == '/')
+ if (rest[1] == '\0' || is_dir_sep(rest[1]))
return 0;
}
return 1;