Commit 3c84ac86 authored by Junio C Hamano's avatar Junio C Hamano

Merge branch 'maint-2.0' into maint-2.1

* maint-2.0:
  is_hfs_dotgit: loosen over-eager match of \u{..47}
parents 8e36a6d5 282616c7
...@@ -307,6 +307,21 @@ dot-backslash-case .\\\\.GIT\\\\foobar ...@@ -307,6 +307,21 @@ dot-backslash-case .\\\\.GIT\\\\foobar
dotgit-case-backslash .git\\\\foobar dotgit-case-backslash .git\\\\foobar
EOF 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
)
'
# create a static test repo which is broken by omitting # create a static test repo which is broken by omitting
# one particular object ($1, which is looked up via rev-parse # one particular object ($1, which is looked up via rev-parse
# in the new repository). # in the new repository).
......
...@@ -567,8 +567,8 @@ int mbs_chrlen(const char **text, size_t *remainder_p, const char *encoding) ...@@ -567,8 +567,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 * Pick the next char from the stream, ignoring codepoints an HFS+ would.
* would. Note that this is _not_ complete by any means. It's just enough * 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. * to make is_hfs_dotgit() work, and should not be used otherwise.
*/ */
static ucs_char_t next_hfs_char(const char **in) static ucs_char_t next_hfs_char(const char **in)
...@@ -605,12 +605,7 @@ static ucs_char_t next_hfs_char(const char **in) ...@@ -605,12 +605,7 @@ static ucs_char_t next_hfs_char(const char **in)
continue; continue;
} }
/* return out;
* 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);
} }
} }
...@@ -618,10 +613,23 @@ int is_hfs_dotgit(const char *path) ...@@ -618,10 +613,23 @@ int is_hfs_dotgit(const char *path)
{ {
ucs_char_t c; ucs_char_t c;
if (next_hfs_char(&path) != '.' || c = next_hfs_char(&path);
next_hfs_char(&path) != 'g' || if (c != '.')
next_hfs_char(&path) != 'i' || return 0;
next_hfs_char(&path) != 't') 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; return 0;
c = next_hfs_char(&path); c = next_hfs_char(&path);
if (c && !is_dir_sep(c)) if (c && !is_dir_sep(c))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment