summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2015-01-07 13:27:19 -0800
committerJunio C Hamano <gitster@pobox.com>2015-01-07 13:27:19 -0800
commit282616c72d1d08a77ca4fe1186cb708c38408d87 (patch)
tree2e8e4242f7c7891adbad096ac9d47350358b0ef1
parent9a8c2b67cd5a51666f2c0ce3fbbdb08b97b79b3d (diff)
parent64a03e970ab3ef0ce45d6bd3c1de1bff1de2beee (diff)
downloadgit-282616c72d1d08a77ca4fe1186cb708c38408d87.tar.gz
Merge branch 'maint-1.9' into maint-2.0maint-2.0
* maint-1.9: is_hfs_dotgit: loosen over-eager match of \u{..47}
-rwxr-xr-xt/t1450-fsck.sh15
-rw-r--r--utf8.c32
2 files changed, 35 insertions, 12 deletions
diff --git a/t/t1450-fsck.sh b/t/t1450-fsck.sh
index 983568a4b9..a5589e2da7 100755
--- a/t/t1450-fsck.sh
+++ b/t/t1450-fsck.sh
@@ -287,4 +287,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
diff --git a/utf8.c b/utf8.c
index a89704017a..969f17ca5a 100644
--- a/utf8.c
+++ b/utf8.c
@@ -629,8 +629,8 @@ int mbs_chrlen(const char **text, size_t *remainder_p, const char *encoding)
}
/*
- * Pick the next char from the stream, folding as an HFS+ filename comparison
- * would. Note that this is _not_ complete by any means. It's just enough
+ * Pick the next char from the stream, ignoring codepoints an HFS+ would.
+ * Note that this is _not_ complete by any means. It's just enough
* to make is_hfs_dotgit() work, and should not be used otherwise.
*/
static ucs_char_t next_hfs_char(const char **in)
@@ -667,12 +667,7 @@ static ucs_char_t next_hfs_char(const char **in)
continue;
}
- /*
- * there's a great deal of other case-folding that occurs,
- * but this is enough to catch anything that will convert
- * to ".git"
- */
- return tolower(out);
+ return out;
}
}
@@ -680,10 +675,23 @@ int is_hfs_dotgit(const char *path)
{
ucs_char_t c;
- if (next_hfs_char(&path) != '.' ||
- next_hfs_char(&path) != 'g' ||
- next_hfs_char(&path) != 'i' ||
- next_hfs_char(&path) != 't')
+ c = next_hfs_char(&path);
+ if (c != '.')
+ return 0;
+ c = next_hfs_char(&path);
+
+ /*
+ * there's a great deal of other case-folding that occurs
+ * in HFS+, but this is enough to catch anything that will
+ * convert to ".git"
+ */
+ if (c != 'g' && c != 'G')
+ return 0;
+ c = next_hfs_char(&path);
+ if (c != 'i' && c != 'I')
+ return 0;
+ c = next_hfs_char(&path);
+ if (c != 't' && c != 'T')
return 0;
c = next_hfs_char(&path);
if (c && !is_dir_sep(c))