summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2015-01-07 13:27:56 -0800
committerLibravatar Junio C Hamano <gitster@pobox.com>2015-01-07 13:27:56 -0800
commit3c84ac86fc896c108b789b8eb26b169cc0e8088a (patch)
tree647250e896ab9c29d8c4b3867aae4a5ee7d15822
parentGit 2.1.4 (diff)
parentMerge branch 'maint-1.9' into maint-2.0 (diff)
downloadtgif-3c84ac86fc896c108b789b8eb26b169cc0e8088a.tar.xz
Merge branch 'maint-2.0' into maint-2.1
* maint-2.0: 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 426f753fe3..6475f10bc5 100755
--- a/t/t1450-fsck.sh
+++ b/t/t1450-fsck.sh
@@ -307,6 +307,21 @@ 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
+ )
+'
+
# create a static test repo which is broken by omitting
# one particular object ($1, which is looked up via rev-parse
# in the new repository).
diff --git a/utf8.c b/utf8.c
index 3b77e97658..7d2d6a0117 100644
--- a/utf8.c
+++ b/utf8.c
@@ -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
- * 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)
@@ -605,12 +605,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;
}
}
@@ -618,10 +613,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))