aboutsummaryrefslogtreecommitdiff
path: root/t/t1450-fsck.sh
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2014-12-23 03:45:36 -0500
committerJunio C Hamano <gitster@pobox.com>2014-12-29 12:06:27 -0800
commit6aaf956b08cfab2dcaa1a1afe4192390d0ef14fd (patch)
treec7922e942a9ba4ee433446465d6ca418881c1b82 /t/t1450-fsck.sh
parentd08c13b947335cc48ecc1a8453d97b7147c2d6d6 (diff)
downloadgit-6aaf956b08cfab2dcaa1a1afe4192390d0ef14fd.tar.gz
git-6aaf956b08cfab2dcaa1a1afe4192390d0ef14fd.tar.xz
is_hfs_dotgit: loosen over-eager match of \u{..47}
Our is_hfs_dotgit function relies on the hackily-implemented next_hfs_char to give us the next character that an HFS+ filename comparison would look at. It's hacky because it doesn't implement the full case-folding table of HFS+; it gives us just enough to see if the path matches ".git". At the end of next_hfs_char, we use tolower() to convert our 32-bit code point to lowercase. Our tolower() implementation only takes an 8-bit char, though; it throws away the upper 24 bits. This means we can't have any false negatives for is_hfs_dotgit. We only care about matching 7-bit ASCII characters in ".git", and we will correctly process 'G' or 'g'. However, we _can_ have false positives. Because we throw away the upper bits, code point \u{0147} (for example) will look like 'G' and get downcased to 'g'. It's not known whether a sequence of code points whose truncation ends up as ".git" is meaningful in any language, but it does not hurt to be more accurate here. We can just pass out the full 32-bit code point, and compare it manually to the upper and lowercase characters we care about. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t1450-fsck.sh')
-rwxr-xr-xt/t1450-fsck.sh15
1 files changed, 15 insertions, 0 deletions
diff --git a/t/t1450-fsck.sh b/t/t1450-fsck.sh
index 6edd99a81..0279b2b1c 100755
--- a/t/t1450-fsck.sh
+++ b/t/t1450-fsck.sh
@@ -273,4 +273,19 @@ dot-backslash-case .\\\\.GIT\\\\foobar
dotgit-case-backslash .git\\\\foobar
EOF
+test_expect_success 'fsck allows .Ňit' '
+ (
+ git init not-dotgit &&
+ cd not-dotgit &&
+ echo content >file &&
+ git add file &&
+ git commit -m base &&
+ blob=$(git rev-parse :file) &&
+ printf "100644 blob $blob\t.\\305\\207it" >tree &&
+ tree=$(git mktree <tree) &&
+ git fsck 2>err &&
+ test_line_count = 0 err
+ )
+'
+
test_done