From: Junio C Hamano Date: Wed, 7 Jan 2015 21:27:19 +0000 (-0800) Subject: Merge branch 'maint-1.9' into maint-2.0 X-Git-Tag: v2.3.1~1^2~1 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/282616c72d1d08a77ca4fe1186cb708c38408d87?ds=inline;hp=-c Merge branch 'maint-1.9' into maint-2.0 * maint-1.9: is_hfs_dotgit: loosen over-eager match of \u{..47} --- 282616c72d1d08a77ca4fe1186cb708c38408d87 diff --combined utf8.c index a89704017a,0cf56e3c7e..969f17ca5a --- a/utf8.c +++ b/utf8.c @@@ -5,8 -5,8 +5,8 @@@ /* This code is originally from http://www.cl.cam.ac.uk/~mgk25/ucs/ */ struct interval { - int first; - int last; + ucs_char_t first; + ucs_char_t last; }; size_t display_mode_esc_sequence_len(const char *s) @@@ -528,7 -528,7 +528,7 @@@ char *reencode_string_iconv(const char while (1) { size_t cnt = iconv(conv, &cp, &insz, &outpos, &outsz); - if (cnt == -1) { + if (cnt == (size_t) -1) { size_t sofar; if (errno != E2BIG) { free(out); @@@ -629,8 -629,8 +629,8 @@@ int mbs_chrlen(const char **text, size_ } /* - * 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 +667,7 @@@ 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 +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))