summaryrefslogtreecommitdiff
path: root/utf8.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2015-01-07 13:28:10 -0800
committerJunio C Hamano <gitster@pobox.com>2015-01-07 13:28:10 -0800
commit7ba46269a04de20032bd2dd614be6290cd65caab (patch)
treea307c572224dd1db28aabc7ce16cfae495e21c81 /utf8.c
parentc2e8e4b9da4d007b15faa2e3d407b2fd279f0572 (diff)
parent3c84ac86fc896c108b789b8eb26b169cc0e8088a (diff)
downloadgit-7ba46269a04de20032bd2dd614be6290cd65caab.tar.gz
Merge branch 'maint-2.1' into maint
* maint-2.1: is_hfs_dotgit: loosen over-eager match of \u{..47}
Diffstat (limited to 'utf8.c')
-rw-r--r--utf8.c32
1 files changed, 20 insertions, 12 deletions
diff --git a/utf8.c b/utf8.c
index 9a3f4ad232..520fbb4994 100644
--- a/utf8.c
+++ b/utf8.c
@@ -563,8 +563,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)
@@ -601,12 +601,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;
}
}
@@ -614,10 +609,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))