diff options
author | Jeff King <peff@peff.net> | 2014-11-24 13:39:12 -0500 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2014-11-24 12:45:32 -0800 |
commit | 31bfc4da724265ef271adf856c3d0844b62b664a (patch) | |
tree | b32606189f1d860eaaf2fe5f005147439d5d71ff | |
parent | cdaa82ddbaff7decad93547fa605983d8b67ea62 (diff) | |
download | git-31bfc4da724265ef271adf856c3d0844b62b664a.tar.gz |
verify_dotfile: reject .git case-insensitively
We do not allow ".git" to enter into the index as a path
component, because checking out the result to the working
tree may causes confusion for subsequent git commands.
However, on case-insensitive file systems, ".Git" or ".GIT"
is the same. We should catch and prevent those, too.
Note that technically we could allow this for repos on
case-sensitive filesystems. But there's not much point. It's
unlikely that anybody cares, and it creates a repository
that is unexpectedly non-portable to other systems.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r-- | read-cache.c | 5 | ||||
-rwxr-xr-x | t/t1014-read-tree-confusing.sh | 1 |
2 files changed, 4 insertions, 2 deletions
diff --git a/read-cache.c b/read-cache.c index 7f5645e745..a98bfb1522 100644 --- a/read-cache.c +++ b/read-cache.c @@ -756,9 +756,10 @@ static int verify_dotfile(const char *rest) * shares the path end test with the ".." case. */ case 'g': - if (rest[1] != 'i') + case 'G': + if (rest[1] != 'i' && rest[1] != 'I') break; - if (rest[2] != 't') + if (rest[2] != 't' && rest[2] != 'T') break; rest += 2; /* fallthrough */ diff --git a/t/t1014-read-tree-confusing.sh b/t/t1014-read-tree-confusing.sh index 7b31d53196..eff8aedf7a 100755 --- a/t/t1014-read-tree-confusing.sh +++ b/t/t1014-read-tree-confusing.sh @@ -27,6 +27,7 @@ done <<-\EOF . .. .git +.GIT EOF test_done |