Merge branch 'maint-1.8.5' into maint-1.9
authorJunio C Hamano <gitster@pobox.com>
Wed, 7 Jan 2015 21:27:13 +0000 (13:27 -0800)
committerJunio C Hamano <gitster@pobox.com>
Wed, 7 Jan 2015 21:27:13 +0000 (13:27 -0800)
* maint-1.8.5:
is_hfs_dotgit: loosen over-eager match of \u{..47}

1  2 
t/t1450-fsck.sh
utf8.c
diff --combined t/t1450-fsck.sh
index 983568a4b9f81d95c5142b02a3760be3644b5bd8,0279b2b1c00fab5f7ff25b760443a6675ffbb940..a5589e2da7d59d2d303ca5a5b5eadc968c87f5c9
@@@ -142,20 -142,6 +142,20 @@@ test_expect_success '> in name is repor
        grep "error in commit $new" out
  '
  
 +# date is 2^64 + 1
 +test_expect_success 'integer overflow in timestamps is reported' '
 +      git cat-file commit HEAD >basis &&
 +      sed "s/^\\(author .*>\\) [0-9]*/\\1 18446744073709551617/" \
 +              <basis >bad-timestamp &&
 +      new=$(git hash-object -t commit -w --stdin <bad-timestamp) &&
 +      test_when_finished "remove_object $new" &&
 +      git update-ref refs/heads/bogus "$new" &&
 +      test_when_finished "git update-ref -d refs/heads/bogus" &&
 +      git fsck 2>out &&
 +      cat out &&
 +      grep "error in commit $new.*integer overflow" out
 +'
 +
  test_expect_success 'tag pointing to nonexistent' '
        cat >invalid-tag <<-\EOF &&
        object ffffffffffffffffffffffffffffffffffffffff
@@@ -287,4 -273,19 +287,19 @@@ dot-backslash-case .\\\\.GIT\\\\fooba
  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
diff --combined utf8.c
index 015c8157eda650450f8dfc9bb744959056d10e9b,9c9fa3a75781baa7507d9318c8a03ec54625679d..0cf56e3c7e1ef9ad74b612da7b6a83479afd9b88
--- 1/utf8.c
--- 2/utf8.c
+++ b/utf8.c
@@@ -84,10 -84,11 +84,10 @@@ static int git_wcwidth(ucs_char_t ch
         *   "uniset +cat=Me +cat=Mn +cat=Cf -00AD +1160-11FF +200B c".
         */
        static const struct interval combining[] = {
 -              { 0x0300, 0x0357 }, { 0x035D, 0x036F }, { 0x0483, 0x0486 },
 -              { 0x0488, 0x0489 }, { 0x0591, 0x05A1 }, { 0x05A3, 0x05B9 },
 -              { 0x05BB, 0x05BD }, { 0x05BF, 0x05BF }, { 0x05C1, 0x05C2 },
 -              { 0x05C4, 0x05C4 }, { 0x0600, 0x0603 }, { 0x0610, 0x0615 },
 -              { 0x064B, 0x0658 }, { 0x0670, 0x0670 }, { 0x06D6, 0x06E4 },
 +              { 0x0300, 0x036F }, { 0x0483, 0x0489 }, { 0x0591, 0x05BD },
 +              { 0x05BF, 0x05BF }, { 0x05C1, 0x05C2 }, { 0x05C4, 0x05C5 },
 +              { 0x05C7, 0x05C7 }, { 0x0600, 0x0604 }, { 0x0610, 0x061A },
 +              { 0x064B, 0x065F }, { 0x0670, 0x0670 }, { 0x06D6, 0x06E4 },
                { 0x06E7, 0x06E8 }, { 0x06EA, 0x06ED }, { 0x070F, 0x070F },
                { 0x0711, 0x0711 }, { 0x0730, 0x074A }, { 0x07A6, 0x07B0 },
                { 0x0901, 0x0902 }, { 0x093C, 0x093C }, { 0x0941, 0x0948 },
@@@ -629,8 -630,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)
                        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 -676,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))