diff options
author | Junio C Hamano <gitster@pobox.com> | 2015-01-07 13:26:35 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2015-01-07 13:26:35 -0800 |
commit | 3d8a54eb37d298c251c0b6823dc06935a611bc33 (patch) | |
tree | 416b160751843dfe4be1fd044f8b366ddd9592ac | |
parent | 5c8213a7696b3d9e29feda2516e350d03d7bd9a4 (diff) | |
parent | 6aaf956b08cfab2dcaa1a1afe4192390d0ef14fd (diff) | |
download | git-3d8a54eb37d298c251c0b6823dc06935a611bc33.tar.gz |
Merge branch 'jk/dotgit-case-maint-1.8.5' into maint-1.8.5maint-1.8.5
* jk/dotgit-case-maint-1.8.5:
is_hfs_dotgit: loosen over-eager match of \u{..47}
-rwxr-xr-x | t/t1450-fsck.sh | 15 | ||||
-rw-r--r-- | utf8.c | 32 |
2 files changed, 35 insertions, 12 deletions
diff --git a/t/t1450-fsck.sh b/t/t1450-fsck.sh index 6edd99a81e..0279b2b1c0 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 @@ -630,8 +630,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) @@ -668,12 +668,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; } } @@ -681,10 +676,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)) |