Merge pull request #615 from benstraub/port-all-tests-to-clar Port all tests to clar
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 3314 3315 3316 3317 3318 3319 3320 3321 3322 3323 3324 3325 3326 3327 3328 3329 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 3419 3420 3421 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 3434 3435 3436 3437 3438 3439 3440 3441 3442 3443 3444 3445 3446 3447 3448 3449 3450 3451 3452 3453 3454 3455 3456 3457 3458 3459 3460 3461 3462 3463 3464 3465 3466 3467 3468 3469 3470 3471 3472 3473 3474 3475 3476 3477 3478 3479 3480 3481 3482 3483 3484 3485 3486 3487 3488 3489 3490 3491 3492 3493 3494 3495 3496 3497 3498 3499 3500 3501 3502 3503 3504 3505 3506 3507 3508 3509 3510 3511 3512 3513 3514 3515 3516 3517 3518 3519 3520 3521 3522 3523 3524 3525 3526 3527 3528 3529 3530 3531 3532 3533 3534 3535 3536 3537 3538 3539 3540 3541 3542 3543 3544 3545 3546 3547 3548 3549 3550 3551 3552 3553 3554 3555 3556 3557 3558 3559 3560 3561 3562 3563 3564 3565 3566 3567 3568 3569 3570 3571 3572 3573 3574 3575 3576 3577 3578 3579 3580 3581 3582 3583 3584 3585 3586 3587 3588 3589 3590 3591 3592 3593 3594 3595 3596 3597 3598 3599 3600 3601 3602 3603 3604 3605 3606 3607 3608 3609 3610 3611 3612 3613 3614 3615 3616 3617 3618 3619 3620 3621 3622 3623 3624 3625 3626 3627 3628 3629 3630 3631 3632 3633 3634 3635 3636 3637 3638 3639 3640 3641 3642 3643 3644 3645 3646 3647 3648 3649 3650 3651 3652 3653 3654 3655 3656 3657 3658 3659 3660 3661 3662 3663 3664 3665 3666 3667 3668 3669 3670 3671 3672 3673 3674 3675 3676 3677 3678 3679 3680 3681 3682 3683 3684 3685 3686 3687 3688 3689 3690 3691 3692 3693 3694 3695 3696 3697 3698 3699 3700 3701 3702 3703 3704 3705 3706 3707 3708 3709 3710 3711 3712 3713 3714 3715 3716 3717 3718 3719 3720 3721 3722 3723 3724 3725 3726 3727 3728 3729 3730 3731 3732 3733 3734 3735 3736 3737 3738 3739 3740 3741 3742 3743 3744 3745 3746 3747 3748 3749 3750 3751 3752 3753 3754 3755 3756 3757 3758 3759 3760 3761 3762 3763 3764 3765 3766 3767 3768 3769 3770 3771 3772 3773 3774 3775 3776 3777 3778 3779 3780 3781 3782 3783 3784 3785 3786 3787 3788 3789 3790 3791 3792 3793 3794 3795 3796 3797 3798 3799 3800 3801 3802 3803 3804 3805 3806 3807 3808 3809 3810 3811 3812 3813 3814 3815 3816 3817 3818 3819 3820 3821 3822 3823 3824 3825 3826 3827 3828 3829 3830 3831 3832 3833 3834 3835 3836 3837 3838 3839 3840 3841 3842 3843 3844 3845 3846 3847 3848 3849 3850 3851 3852 3853 3854 3855 3856 3857 3858 3859 3860 3861 3862 3863 3864 3865 3866 3867 3868 3869 3870 3871 3872 3873 3874 3875 3876 3877 3878 3879 3880 3881 3882 3883 3884 3885 3886 3887 3888 3889 3890 3891 3892 3893 3894 3895 3896 3897 3898 3899 3900 3901 3902 3903 3904 3905 3906 3907 3908 3909 3910 3911 3912 3913 3914 3915 3916 3917 3918 3919 3920 3921 3922 3923 3924 3925 3926 3927 3928 3929 3930 3931 3932 3933 3934 3935 3936 3937 3938 3939 3940 3941 3942 3943 3944 3945 3946 3947 3948 3949 3950 3951 3952 3953 3954 3955 3956 3957 3958 3959 3960 3961 3962 3963 3964 3965 3966 3967 3968 3969 3970 3971 3972 3973 3974 3975 3976 3977 3978 3979 3980 3981 3982 3983 3984 3985 3986 3987 3988 3989 3990 3991 3992 3993 3994 3995 3996 3997 3998 3999 4000 4001 4002 4003 4004 4005 4006 4007 4008 4009 4010 4011 4012 4013 4014 4015 4016 4017 4018 4019 4020 4021 4022 4023 4024 4025 4026 4027 4028 4029 4030 4031 4032 4033 4034 4035 4036 4037 4038 4039 4040 4041 4042 4043 4044 4045 4046 4047 4048 4049 4050 4051 4052 4053 4054 4055 4056 4057 4058 4059 4060 4061 4062 4063 4064 4065 4066 4067 4068 4069 4070 4071 4072 4073 4074 4075 4076 4077 4078 4079 4080 4081 4082 4083 4084 4085 4086 4087 4088 4089 4090 4091 4092 4093 4094 4095 4096 4097 4098 4099 4100 4101 4102 4103 4104 4105 4106 4107 4108 4109 4110 4111 4112 4113 4114 4115 4116 4117 4118 4119 4120 4121 4122 4123 4124 4125 4126 4127 4128 4129 4130 4131 4132 4133 4134 4135 4136 4137 4138 4139 4140 4141 4142 4143 4144 4145 4146 4147 4148 4149 4150 4151 4152 4153 4154 4155 4156 4157 4158 4159 4160 4161 4162 4163 4164 4165 4166 4167 4168 4169 4170 4171 4172 4173 4174 4175 4176 4177 4178 4179 4180 4181 4182 4183 4184 4185 4186 4187 4188 4189 4190 4191 4192 4193 4194 4195 4196 4197 4198 4199 4200 4201 4202 4203 4204 4205 4206 4207 4208 4209 4210 4211 4212 4213 4214 4215 4216 4217 4218 4219 4220 4221 4222 4223 4224 4225 4226 4227 4228 4229 4230 4231 4232 4233 4234 4235 4236 4237 4238 4239 4240 4241 4242 4243 4244 4245 4246 4247 4248 4249 4250 4251 4252 4253 4254 4255 4256 4257 4258 4259 4260 4261 4262 4263 4264 4265 4266 4267 4268 4269 4270 4271 4272 4273 4274 4275 4276 4277 4278 4279 4280 4281 4282 4283 4284 4285 4286 4287 4288 4289 4290 4291 4292 4293 4294 4295 4296 4297 4298 4299 4300 4301 4302 4303 4304 4305 4306 4307 4308 4309 4310 4311 4312 4313 4314 4315 4316 4317 4318 4319 4320 4321 4322 4323 4324 4325 4326 4327 4328 4329 4330 4331 4332 4333 4334 4335 4336 4337 4338 4339 4340 4341 4342 4343 4344 4345 4346 4347 4348 4349 4350 4351 4352 4353 4354 4355 4356 4357 4358 4359 4360 4361 4362 4363 4364 4365 4366 4367 4368 4369 4370 4371 4372 4373 4374 4375 4376 4377 4378 4379 4380 4381 4382 4383 4384 4385 4386 4387 4388 4389 4390 4391 4392 4393 4394 4395 4396 4397 4398 4399 4400 4401 4402 4403 4404 4405 4406 4407 4408 4409 4410 4411 4412 4413 4414 4415 4416 4417 4418 4419 4420 4421 4422 4423 4424 4425 4426 4427 4428 4429 4430 4431 4432 4433 4434 4435 4436 4437 4438 4439 4440 4441 4442 4443 4444 4445 4446 4447 4448 4449 4450 4451 4452 4453 4454 4455 4456 4457 4458 4459 4460 4461 4462 4463 4464 4465 4466 4467 4468 4469 4470 4471 4472 4473 4474 4475 4476 4477 4478 4479 4480 4481 4482 4483 4484 4485 4486 4487 4488 4489 4490 4491 4492 4493 4494 4495 4496 4497 4498 4499 4500 4501 4502 4503 4504 4505 4506 4507 4508 4509 4510 4511 4512 4513 4514 4515 4516 4517 4518 4519 4520 4521 4522 4523 4524 4525 4526 4527 4528 4529 4530 4531 4532 4533 4534 4535 4536 4537 4538 4539 4540 4541 4542 4543 4544 4545 4546 4547 4548 4549 4550 4551 4552 4553 4554 4555 4556 4557 4558 4559 4560 4561 4562 4563 4564 4565 4566 4567 4568 4569 4570 4571 4572 4573 4574 4575 4576 4577 4578 4579 4580 4581 4582 4583 4584 4585 4586 4587 4588 4589 4590 4591 4592 4593 4594 4595 4596 4597 4598 4599 4600 4601 4602 4603 4604 4605 4606 4607 4608 4609 4610 4611 4612 4613 4614 4615 4616 4617 4618 4619 4620 4621 4622 4623 4624 4625 4626 4627 4628 4629 4630 4631 4632 4633 4634 4635 4636 4637 4638 4639 4640 4641 4642 4643 4644 4645 4646 4647 4648 4649 4650 4651 4652 4653 4654 4655 4656 4657 4658 4659 4660 4661 4662 4663 4664 4665 4666 4667 4668 4669 4670 4671 4672 4673 4674 4675 4676 4677 4678 4679 4680 4681 4682 4683 4684 4685 4686 4687 4688 4689 4690 4691 4692 4693 4694 4695 4696 4697 4698 4699 4700 4701 4702 4703 4704 4705 4706 4707 4708 4709 4710 4711 4712 4713 4714 4715 4716 4717 4718 4719 4720 4721 4722 4723 4724 4725 4726 4727 4728 4729 4730 4731 4732 4733 4734 4735 4736 4737 4738 4739 4740 4741 4742 4743 4744 4745 4746 4747 4748 4749 4750 4751 4752 4753 4754 4755 4756 4757 4758 4759 4760 4761 4762 4763 4764 4765 4766 4767 4768 4769 4770 4771 4772 4773 4774 4775 4776 4777 4778 4779 4780 4781 4782 4783 4784 4785 4786 4787 4788 4789 4790 4791 4792 4793 4794 4795 4796 4797 4798 4799 4800 4801 4802 4803 4804 4805 4806 4807 4808 4809 4810 4811 4812 4813 4814 4815 4816 4817 4818 4819 4820 4821 4822 4823 4824 4825 4826 4827 4828 4829 4830 4831 4832 4833 4834 4835 4836 4837 4838 4839 4840 4841 4842 4843 4844 4845 4846 4847 4848 4849 4850 4851 4852 4853 4854 4855 4856 4857 4858 4859 4860 4861 4862 4863 4864 4865 4866 4867 4868 4869 4870 4871 4872 4873 4874 4875 4876 4877 4878 4879 4880 4881 4882 4883 4884 4885 4886 4887 4888 4889 4890 4891 4892 4893 4894 4895 4896 4897 4898 4899 4900 4901 4902 4903 4904 4905 4906 4907 4908 4909 4910 4911 4912 4913 4914 4915 4916 4917 4918 4919 4920 4921 4922 4923 4924 4925 4926 4927 4928 4929 4930 4931 4932 4933 4934 4935 4936 4937 4938 4939 4940 4941 4942 4943 4944 4945 4946 4947 4948 4949 4950 4951 4952 4953 4954 4955 4956 4957 4958 4959 4960 4961 4962 4963 4964 4965 4966 4967 4968 4969 4970 4971 4972 4973 4974 4975 4976 4977 4978 4979 4980 4981 4982 4983 4984 4985 4986 4987 4988 4989 4990 4991 4992 4993 4994 4995 4996 4997 4998 4999 5000 5001 5002 5003 5004 5005 5006 5007 5008 5009 5010 5011 5012 5013 5014 5015 5016 5017 5018 5019 5020 5021 5022 5023 5024 5025 5026 5027 5028 5029 5030 5031 5032 5033 5034 5035 5036 5037 5038 5039 5040 5041 5042 5043 5044 5045 5046 5047 5048 5049 5050 5051 5052 5053 5054 5055 5056 5057 5058 5059 5060 5061 5062 5063 5064 5065 5066 5067 5068 5069 5070 5071 5072 5073 5074 5075 5076 5077 5078 5079 5080 5081 5082 5083 5084 5085 5086 5087 5088 5089 5090 5091 5092 5093 5094 5095 5096 5097 5098 5099 5100 5101 5102 5103 5104 5105 5106 5107 5108 5109 5110 5111 5112 5113 5114 5115 5116 5117 5118 5119 5120 5121 5122 5123 5124 5125 5126 5127 5128 5129 5130 5131 5132 5133 5134 5135 5136 5137 5138 5139 5140 5141 5142 5143 5144 5145 5146 5147 5148 5149 5150 5151 5152 5153 5154 5155 5156 5157 5158 5159 5160 5161 5162 5163 5164 5165 5166 5167 5168 5169 5170 5171 5172 5173 5174 5175 5176 5177 5178 5179 5180 5181 5182 5183 5184 5185 5186 5187 5188 5189 5190 5191 5192 5193 5194 5195 5196 5197 5198 5199 5200 5201 5202 5203 5204 5205 5206 5207 5208 5209 5210 5211 5212 5213 5214 5215 5216 5217 5218 5219 5220 5221 5222 5223 5224 5225 5226 5227 5228 5229 5230 5231 5232 5233 5234 5235 5236 5237 5238 5239 5240 5241 5242 5243 5244 5245 5246 5247 5248 5249 5250 5251 5252 5253 5254 5255 5256 5257 5258 5259 5260 5261 5262 5263 5264 5265 5266 5267 5268 5269 5270 5271 5272 5273 5274 5275 5276 5277 5278 5279 5280 5281 5282 5283 5284 5285 5286 5287 5288 5289 5290 5291 5292 5293 5294 5295 5296 5297 5298 5299 5300 5301 5302 5303 5304 5305 5306 5307 5308 5309 5310 5311 5312 5313 5314 5315 5316 5317 5318 5319 5320 5321 5322 5323 5324 5325 5326 5327 5328 5329 5330 5331 5332 5333 5334 5335 5336 5337 5338 5339 5340 5341 5342 5343 5344 5345 5346 5347 5348 5349 5350 5351 5352 5353 5354 5355 5356 5357 5358 5359 5360 5361 5362 5363 5364 5365 5366 5367 5368 5369 5370 5371 5372 5373 5374 5375 5376 5377 5378 5379 5380 5381 5382 5383 5384 5385 5386 5387 5388 5389 5390 5391 5392 5393 5394 5395 5396 5397 5398 5399 5400 5401 5402 5403 5404 5405 5406 5407 5408 5409 5410 5411 5412 5413 5414 5415 5416 5417 5418 5419 5420 5421 5422 5423 5424 5425 5426 5427 5428 5429 5430 5431 5432 5433 5434 5435 5436 5437 5438 5439 5440 5441 5442 5443 5444 5445 5446 5447 5448 5449 5450 5451 5452 5453 5454 5455 5456 5457 5458 5459 5460 5461 5462 5463 5464 5465 5466 5467 5468 5469 5470 5471 5472 5473 5474 5475 5476 5477 5478 5479 5480 5481 5482 5483 5484 5485 5486 5487 5488 5489 5490 5491 5492 5493 5494 5495 5496 5497 5498 5499 5500 5501 5502 5503 5504 5505 5506 5507 5508 5509 5510 5511 5512 5513 5514 5515 5516 5517 5518 5519 5520 5521 5522 5523 5524 5525 5526 5527 5528 5529 5530 5531 5532 5533 5534 5535 5536 5537 5538 5539 5540 5541 5542 5543 5544 5545 5546 5547 5548 5549 5550 5551 5552 5553 5554 5555 5556 5557 5558 5559 5560 5561 5562 5563 5564 5565 5566 5567 5568 5569 5570 5571 5572 5573 5574 5575 5576 5577 5578 5579 5580 5581 5582 5583 5584 5585 5586 5587 5588 5589 5590 5591 5592 5593 5594 5595 5596 5597 5598 5599 5600 5601 5602 5603 5604 5605 5606 5607 5608 5609 5610 5611 5612 5613 5614 5615 5616 5617 5618 5619 5620 5621 5622 5623 5624 5625 5626 5627 5628 5629 5630 5631 5632 5633 5634 5635 5636 5637 5638 5639 5640 5641 5642 5643 5644 5645 5646 5647 5648 5649 5650 5651 5652 5653 5654 5655 5656 5657 5658 5659 5660 5661 5662 5663 5664 5665 5666 5667 5668 5669 5670 5671 5672 5673 5674 5675 5676 5677 5678 5679 5680 5681 5682 5683 5684 5685 5686 5687 5688 5689 5690 5691 5692 5693 5694 5695 5696 5697 5698 5699 5700 5701 5702 5703 5704 5705 5706 5707 5708 5709 5710 5711 5712 5713 5714 5715 5716 5717 5718 5719 5720 5721 5722 5723 5724 5725 5726 5727 5728 5729 5730 5731 5732 5733 5734 5735 5736 5737 5738 5739 5740 5741 5742 5743 5744 5745 5746 5747 5748 5749 5750 5751 5752 5753 5754 5755 5756 5757 5758 5759 5760 5761 5762 5763 5764 5765 5766 5767 5768 5769 5770 5771 5772 5773 5774 5775 5776 5777 5778 5779 5780 5781 5782 5783 5784 5785 5786 5787 5788 5789 5790 5791 5792 5793 5794 5795 5796 5797 5798 5799 5800 5801 5802 5803 5804 5805 5806 5807 5808 5809 5810 5811 5812 5813 5814 5815 5816 5817 5818 5819 5820 5821 5822 5823 5824 5825 5826 5827 5828 5829 5830 5831 5832 5833 5834 5835 5836 5837 5838 5839 5840 5841 5842 5843 5844 5845 5846 5847 5848 5849 5850 5851 5852 5853 5854 5855 5856 5857 5858 5859 5860 5861 5862 5863 5864 5865 5866 5867 5868 5869 5870 5871 5872 5873 5874 5875 5876 5877 5878 5879 5880 5881 5882 5883 5884 5885 5886 5887 5888 5889 5890 5891 5892 5893 5894 5895 5896 5897 5898 5899 5900 5901 5902 5903 5904 5905 5906 5907 5908 5909 5910 5911 5912 5913 5914 5915 5916 5917 5918 5919 5920 5921 5922 5923 5924 5925 5926 5927 5928 5929 5930 5931 5932 5933 5934 5935 5936 5937 5938 5939 5940 5941 5942 5943 5944 5945 5946 5947 5948 5949 5950 5951 5952 5953 5954 5955 5956 5957 5958 5959 5960 5961 5962 5963 5964 5965 5966 5967 5968 5969 5970 5971 5972 5973 5974 5975 5976 5977 5978 5979 5980 5981 5982 5983 5984 5985 5986 5987 5988 5989 5990 5991 5992 5993 5994 5995 5996 5997 5998 5999 6000 6001 6002 6003 6004 6005 6006 6007 6008 6009 6010 6011 6012 6013 6014 6015 6016 6017 6018 6019 6020 6021 6022 6023 6024 6025 6026 6027 6028 6029 6030 6031 6032 6033 6034 6035 6036 6037 6038 6039 6040 6041 6042 6043 6044 6045 6046 6047 6048 6049 6050 6051 6052 6053 6054 6055 6056 6057 6058 6059 6060 6061 6062 6063 6064 6065 6066 6067 6068 6069 6070 6071 6072 6073 6074 6075 6076 6077 6078 6079 6080 6081 6082 6083 6084 6085 6086 6087 6088 6089 6090 6091 6092 6093 6094 6095 6096 6097 6098 6099 6100 6101 6102 6103 6104 6105 6106 6107 6108 6109 6110 6111 6112 6113 6114 6115 6116 6117 6118 6119 6120 6121 6122 6123 6124 6125 6126 6127 6128 6129 6130 6131 6132 6133 6134 6135 6136 6137 6138 6139 6140 6141 6142 6143 6144 6145 6146 6147 6148 6149 6150 6151 6152 6153 6154 6155 6156 6157 6158 6159 6160 6161 6162 6163 6164 6165 6166 6167 6168 6169 6170 6171 6172 6173 6174 6175 6176 6177 6178 6179 6180 6181 6182 6183 6184 6185 6186 6187 6188 6189 6190 6191 6192 6193 6194 6195 6196 6197 6198 6199 6200 6201 6202 6203 6204 6205 6206 6207 6208 6209 6210 6211 6212 6213 6214 6215 6216 6217 6218 6219 6220 6221 6222 6223 6224 6225 6226 6227 6228 6229 6230 6231 6232 6233 6234 6235 6236 6237 6238 6239 6240 6241 6242 6243 6244 6245 6246 6247 6248 6249 6250 6251 6252 6253 6254 6255 6256 6257 6258 6259 6260 6261 6262 6263 6264 6265 6266 6267 6268 6269 6270 6271 6272 6273 6274 6275 6276 6277 6278 6279 6280 6281 6282 6283 6284 6285 6286 6287 6288 6289 6290 6291 6292 6293 6294 6295 6296 6297 6298 6299 6300 6301 6302 6303 6304 6305 6306 6307 6308 6309 6310 6311 6312 6313 6314 6315 6316 6317 6318 6319 6320 6321 6322 6323 6324 6325 6326 6327 6328 6329 6330 6331 6332 6333 6334 6335 6336 6337 6338 6339 6340 6341 6342 6343 6344 6345 6346 6347 6348 6349 6350 6351 6352 6353 6354 6355 6356 6357 6358 6359 6360 6361 6362 6363 6364 6365 6366 6367 6368 6369 6370 6371 6372 6373 6374 6375 6376 6377 6378 6379 6380 6381 6382 6383 6384 6385 6386 6387 6388 6389 6390 6391 6392 6393 6394 6395 6396 6397 6398 6399 6400 6401 6402 6403 6404 6405 6406 6407 6408 6409 6410 6411 6412 6413 6414 6415 6416 6417 6418 6419 6420 6421 6422 6423 6424 6425 6426 6427 6428 6429 6430 6431 6432 6433 6434 6435 6436 6437 6438 6439 6440 6441 6442 6443 6444 6445 6446 6447 6448 6449 6450 6451 6452 6453 6454 6455 6456 6457 6458 6459 6460 6461 6462 6463 6464 6465 6466 6467 6468 6469 6470 6471 6472 6473 6474 6475 6476 6477 6478 6479 6480 6481 6482 6483 6484 6485 6486 6487 6488 6489 6490 6491 6492 6493 6494 6495 6496 6497 6498 6499 6500 6501 6502 6503 6504 6505 6506 6507 6508 6509 6510 6511 6512 6513 6514 6515 6516 6517 6518 6519 6520 6521 6522 6523 6524 6525 6526 6527 6528 6529 6530 6531 6532 6533 6534 6535 6536 6537 6538 6539 6540 6541 6542 6543 6544 6545 6546 6547 6548 6549 6550 6551 6552 6553 6554 6555 6556 6557 6558 6559 6560 6561 6562 6563 6564 6565 6566 6567 6568 6569 6570 6571 6572 6573 6574 6575 6576 6577 6578 6579 6580 6581 6582 6583 6584 6585 6586 6587 6588 6589 6590 6591 6592 6593 6594 6595 6596 6597 6598 6599 6600 6601 6602 6603 6604 6605 6606 6607 6608 6609 6610 6611 6612 6613 6614 6615 6616 6617 6618 6619 6620 6621 6622 6623 6624 6625 6626 6627 6628 6629 6630 6631 6632 6633 6634 6635 6636 6637 6638 6639 6640 6641 6642 6643 6644 6645 6646 6647 6648 6649 6650 6651 6652 6653 6654 6655 6656 6657 6658 6659 6660 6661 6662 6663 6664 6665 6666 6667 6668 6669 6670 6671 6672 6673 6674 6675 6676 6677 6678 6679 6680 6681 6682 6683 6684 6685 6686 6687 6688 6689 6690 6691 6692 6693 6694 6695 6696 6697 6698 6699 6700 6701 6702 6703 6704 6705 6706 6707 6708 6709 6710 6711 6712 6713 6714 6715 6716 6717 6718 6719 6720 6721 6722 6723 6724 6725 6726 6727 6728 6729 6730 6731 6732 6733 6734 6735 6736 6737 6738 6739 6740 6741 6742 6743 6744 6745 6746 6747 6748 6749 6750 6751 6752 6753 6754 6755 6756 6757 6758 6759 6760 6761 6762 6763 6764 6765 6766 6767 6768 6769 6770 6771 6772 6773 6774 6775 6776 6777 6778 6779 6780 6781 6782 6783 6784 6785 6786 6787 6788 6789 6790 6791 6792 6793 6794 6795 6796 6797 6798 6799 6800 6801 6802 6803 6804 6805 6806 6807 6808 6809 6810 6811 6812 6813 6814 6815 6816 6817 6818 6819 6820 6821 6822 6823 6824 6825 6826 6827 6828 6829 6830 6831 6832 6833 6834 6835 6836 6837 6838 6839 6840 6841 6842 6843 6844 6845 6846 6847 6848 6849 6850 6851 6852 6853 6854 6855 6856 6857 6858 6859 6860 6861 6862 6863 6864 6865 6866 6867 6868 6869 6870 6871 6872 6873 6874 6875 6876 6877 6878 6879 6880 6881 6882 6883 6884 6885 6886 6887 6888 6889 6890 6891 6892 6893 6894 6895 6896 6897 6898 6899 6900 6901 6902 6903 6904 6905 6906 6907 6908 6909 6910 6911 6912 6913 6914 6915 6916 6917 6918 6919 6920 6921 6922 6923 6924 6925 6926 6927 6928 6929 6930 6931 6932 6933 6934 6935 6936 6937 6938 6939 6940 6941 6942 6943 6944 6945 6946 6947 6948 6949 6950 6951 6952 6953 6954 6955 6956 6957 6958 6959 6960 6961 6962 6963 6964 6965 6966 6967 6968 6969 6970 6971 6972 6973 6974 6975 6976 6977 6978 6979 6980 6981 6982 6983 6984 6985 6986 6987 6988 6989 6990 6991 6992 6993 6994 6995 6996 6997 6998 6999 7000 7001 7002 7003 7004 7005 7006 7007 7008 7009 7010 7011 7012 7013 7014 7015 7016 7017 7018 7019 7020 7021 7022 7023 7024 7025 7026 7027 7028 7029 7030 7031 7032 7033 7034 7035 7036 7037 7038 7039 7040 7041 7042 7043 7044 7045 7046 7047 7048 7049 7050 7051 7052 7053 7054 7055 7056 7057 7058 7059 7060 7061 7062 7063 7064 7065 7066 7067 7068 7069 7070 7071 7072 7073 7074 7075 7076 7077 7078 7079 7080 7081 7082 7083 7084 7085 7086 7087 7088 7089 7090 7091 7092 7093 7094 7095 7096 7097 7098 7099 7100 7101 7102 7103 7104 7105 7106 7107 7108 7109 7110 7111 7112 7113 7114 7115 7116 7117 7118 7119 7120 7121 7122 7123 7124 7125 7126 7127 7128 7129 7130 7131 7132 7133 7134 7135 7136 7137 7138 7139 7140 7141 7142 7143 7144 7145 7146 7147 7148 7149 7150 7151 7152 7153 7154 7155 7156 7157 7158 7159 7160 7161 7162 7163 7164 7165 7166 7167 7168 7169 7170 7171 7172 7173 7174 7175 7176 7177 7178 7179 7180 7181 7182 7183 7184 7185 7186 7187 7188 7189 7190 7191 7192 7193 7194 7195 7196 7197 7198 7199 7200 7201 7202 7203 7204 7205 7206 7207 7208 7209 7210 7211 7212 7213 7214 7215 7216 7217 7218 7219 7220 7221 7222 7223 7224 7225 7226 7227 7228 7229 7230 7231 7232 7233 7234 7235 7236 7237 7238 7239 7240 7241 7242 7243 7244 7245 7246 7247 7248 7249 7250 7251 7252 7253 7254 7255 7256 7257 7258 7259 7260 7261 7262 7263 7264 7265 7266 7267 7268 7269 7270 7271 7272 7273 7274 7275 7276 7277 7278 7279 7280 7281 7282 7283 7284 7285 7286 7287 7288 7289 7290 7291 7292 7293 7294 7295 7296 7297 7298 7299 7300 7301 7302 7303 7304 7305 7306 7307 7308 7309 7310 7311 7312 7313 7314 7315 7316 7317 7318 7319 7320 7321 7322 7323 7324 7325 7326 7327 7328 7329 7330 7331 7332 7333 7334 7335 7336 7337 7338 7339 7340 7341 7342 7343 7344 7345 7346 7347 7348 7349 7350 7351 7352 7353 7354 7355 7356 7357 7358 7359 7360 7361 7362 7363 7364 7365 7366 7367 7368 7369 7370 7371 7372 7373 7374 7375 7376 7377 7378 7379 7380 7381 7382 7383 7384 7385 7386 7387 7388 7389 7390 7391 7392 7393 7394 7395 7396 7397 7398 7399 7400 7401 7402 7403 7404 7405 7406 7407 7408 7409 7410 7411 7412 7413 7414 7415 7416 7417 7418 7419 7420 7421 7422 7423 7424 7425 7426 7427 7428 7429 7430 7431 7432 7433 7434 7435 7436 7437 7438 7439 7440 7441 7442 7443 7444 7445 7446 7447 7448 7449 7450 7451 7452 7453 7454 7455 7456 7457 7458 7459 7460 7461 7462 7463 7464 7465 7466 7467 7468 7469 7470 7471 7472 7473 7474 7475 7476 7477 7478 7479 7480 7481 7482 7483 7484 7485 7486 7487 7488 7489 7490 7491 7492 7493 7494 7495 7496 7497 7498 7499 7500 7501 7502 7503 7504 7505 7506 7507 7508 7509 7510 7511 7512 7513 7514 7515 7516 7517 7518 7519 7520 7521 7522 7523 7524 7525 7526 7527 7528 7529 7530 7531 7532 7533 7534 7535 7536 7537 7538 7539 7540 7541 7542 7543 7544 7545 7546 7547 7548 7549 7550 7551 7552 7553 7554 7555 7556 7557 7558 7559 7560 7561 7562 7563 7564 7565 7566 7567 7568 7569 7570 7571 7572 7573 7574 7575 7576 7577 7578 7579 7580 7581 7582 7583 7584 7585 7586 7587 7588 7589 7590 7591 7592 7593 7594 7595 7596 7597 7598 7599 7600 7601 7602 7603 7604 7605 7606 7607 7608 7609 7610 7611 7612 7613 7614 7615 7616 7617 7618 7619 7620 7621 7622 7623 7624 7625 7626 7627 7628 7629 7630 7631 7632 7633 7634 7635 7636 7637 7638 7639 7640 7641 7642 7643 7644 7645 7646 7647 7648 7649 7650 7651 7652 7653 7654 7655 7656 7657 7658 7659 7660 7661 7662 7663 7664 7665 7666 7667 7668 7669 7670 7671 7672 7673 7674 7675 7676 7677 7678 7679 7680 7681 7682 7683 7684 7685 7686 7687 7688 7689 7690 7691 7692 7693 7694 7695 7696 7697 7698 7699 7700 7701 7702 7703 7704 7705 7706 7707 7708 7709 7710 7711 7712 7713 7714 7715 7716 7717 7718 7719 7720 7721 7722 7723 7724 7725 7726 7727 7728 7729 7730 7731 7732 7733 7734 7735 7736 7737 7738 7739 7740 7741 7742 7743 7744 7745 7746 7747 7748 7749 7750 7751 7752 7753 7754 7755 7756 7757 7758 7759 7760 7761 7762 7763 7764 7765 7766 7767 7768 7769 7770 7771 7772 7773 7774 7775 7776 7777 7778 7779 7780 7781 7782 7783 7784 7785 7786 7787 7788 7789 7790 7791 7792 7793 7794 7795 7796 7797 7798 7799 7800 7801 7802 7803 7804 7805 7806 7807 7808 7809 7810 7811 7812 7813 7814 7815 7816 7817 7818 7819 7820 7821 7822 7823 7824 7825 7826 7827 7828 7829 7830 7831 7832 7833 7834 7835 7836 7837 7838 7839 7840 7841 7842 7843 7844 7845 7846 7847 7848 7849 7850 7851 7852 7853 7854 7855 7856 7857 7858 7859 7860 7861 7862 7863 7864 7865 7866 7867 7868 7869 7870 7871 7872 7873 7874 7875 7876 7877 7878 7879 7880 7881 7882 7883 7884 7885 7886 7887 7888 7889 7890 7891 7892 7893 7894 7895 7896 7897 7898 7899 7900 7901 7902 7903 7904 7905 7906 7907 7908 7909 7910 7911 7912 7913 7914 7915 7916 7917 7918 7919 7920 7921 7922 7923 7924 7925 7926 7927 7928 7929 7930 7931 7932 7933 7934 7935 7936 7937 7938 7939 7940 7941 7942 7943 7944 7945 7946 7947 7948 7949 7950 7951 7952 7953 7954 7955 7956 7957 7958 7959 7960 7961 7962 7963 7964 7965 7966 7967 7968 7969 7970 7971 7972 7973 7974 7975 7976 7977 7978 7979 7980 7981 7982 7983 7984 7985 7986 7987 7988 7989 7990 7991 7992 7993 7994 7995 7996 7997 7998 7999 8000 8001 8002 8003 8004 8005 8006 8007 8008 8009 8010 8011 8012 8013 8014 8015 8016 8017 8018 8019 8020 8021 8022 8023 8024 8025 8026 8027 8028 8029 8030 8031 8032 8033 8034 8035 8036 8037 8038 8039 8040 8041 8042 8043 8044 8045 8046 8047 8048 8049 8050 8051 8052 8053 8054 8055 8056 8057 8058 8059 8060 8061 8062 8063 8064 8065 8066 8067 8068 8069 8070 8071 8072 8073 8074 8075 8076 8077 8078 8079 8080 8081 8082 8083 8084 8085 8086 8087 8088 8089 8090 8091 8092 8093 8094 8095 8096 8097 8098 8099 8100 8101 8102 8103 8104 8105 8106 8107 8108 8109 8110 8111 8112 8113 8114 8115 8116 8117 8118 8119 8120 8121 8122 8123 8124 8125 8126 8127 8128 8129 8130 8131 8132 8133 8134 8135 8136 8137 8138 8139 8140 8141 8142 8143 8144 8145 8146 8147 8148 8149 8150 8151 8152 8153 8154 8155 8156 8157 8158 8159 8160 8161 8162 8163 8164 8165 8166 8167 8168 8169 8170 8171 8172 8173 8174 8175 8176 8177 8178 8179 8180 8181 8182 8183 8184 8185 8186 8187 8188 8189 8190 8191 8192 8193 8194 8195 8196 8197 8198 8199 8200 8201 8202 8203 8204 8205 8206 8207 8208 8209 8210 8211 8212 8213 8214 8215 8216 8217 8218 8219 8220 8221 8222 8223 8224 8225 8226 8227 8228 8229 8230 8231 8232 8233 8234 8235 8236 8237 8238 8239 8240 8241 8242 8243 8244 8245 8246 8247 8248 8249 8250 8251 8252 8253 8254 8255 8256 8257 8258 8259 8260 8261 8262 8263 8264 8265 8266 8267 8268 8269 8270 8271 8272 8273 8274 8275 8276 8277 8278 8279 8280 8281 8282 8283 8284 8285 8286 8287 8288 8289 8290 8291 8292 8293 8294 8295 8296 8297 8298 8299 8300 8301 8302 8303 8304 8305 8306 8307 8308 8309 8310 8311 8312 8313 8314 8315 8316 8317 8318 8319 8320 8321 8322 8323 8324 8325 8326 8327 8328 8329 8330 8331 8332 8333 8334 8335 8336 8337 8338 8339 8340 8341 8342 8343 8344 8345 8346 8347 8348 8349 8350 8351 8352 8353 8354 8355 8356 8357 8358 8359 8360 8361 8362 8363 8364 8365 8366 8367 8368 8369 8370 8371 8372 8373 8374 8375 8376 8377 8378 8379 8380 8381 8382 8383 8384 8385 8386 8387 8388 8389 8390 8391 8392 8393 8394 8395 8396 8397 8398 8399 8400 8401 8402 8403 8404 8405 8406 8407 8408 8409 8410 8411 8412 8413 8414 8415 8416 8417 8418 8419 8420 8421 8422 8423 8424 8425 8426 8427 8428 8429 8430 8431 8432 8433 8434 8435 8436 8437 8438 8439 8440 8441 8442 8443 8444 8445 8446 8447 8448 8449 8450 8451 8452 8453 8454 8455 8456 8457 8458 8459 8460 8461 8462 8463 8464 8465 8466 8467 8468 8469 8470 8471 8472 8473 8474 8475 8476 8477 8478 8479 8480 8481 8482 8483 8484 8485 8486 8487 8488 8489 8490 8491 8492 8493 8494 8495 8496 8497 8498 8499 8500 8501 8502 8503 8504 8505 8506 8507 8508 8509 8510 8511 8512 8513 8514 8515 8516 8517 8518 8519 8520 8521 8522 8523 8524 8525 8526 8527 8528 8529 8530 8531 8532 8533 8534 8535 8536 8537 8538 8539 8540 8541 8542 8543 8544 8545 8546 8547 8548 8549 8550 8551 8552 8553 8554 8555 8556 8557 8558 8559 8560 8561 8562 8563 8564 8565 8566 8567 8568 8569 8570 8571 8572 8573 8574 8575 8576 8577 8578 8579 8580 8581 8582 8583 8584 8585 8586 8587 8588 8589 8590 8591 8592 8593 8594 8595 8596 8597 8598 8599 8600 8601 8602 8603 8604 8605 8606 8607 8608 8609 8610 8611 8612 8613 8614 8615 8616 8617 8618 8619 8620 8621 8622 8623 8624 8625 8626 8627 8628 8629 8630 8631 8632 8633 8634 8635 8636 8637 8638 8639 8640 8641 8642 8643 8644 8645 8646 8647 8648 8649 8650 8651 8652 8653 8654 8655 8656 8657 8658 8659 8660 8661 8662 8663 8664 8665 8666 8667 8668 8669 8670 8671 8672 8673 8674 8675 8676 8677 8678 8679 8680 8681 8682 8683 8684 8685 8686 8687 8688 8689 8690 8691 8692 8693 8694 8695 8696 8697 8698 8699 8700 8701 8702 8703 8704 8705 8706 8707 8708 8709 8710 8711 8712 8713 8714 8715 8716 8717 8718 8719 8720 8721 8722 8723 8724 8725 8726 8727 8728 8729 8730 8731 8732 8733 8734 8735 8736 8737 8738 8739 8740 8741 8742 8743 8744 8745 8746 8747 8748 8749 8750 8751 8752 8753 8754 8755 8756 8757 8758 8759 8760 8761 8762 8763 8764 8765 8766 8767 8768 8769 8770 8771 8772 8773 8774 8775 8776 8777 8778 8779 8780 8781 8782 8783 8784 8785 8786 8787 8788 8789 8790 8791 8792 8793 8794 8795 8796 8797 8798 8799 8800 8801 8802 8803 8804 8805 8806 8807 8808 8809 8810 8811 8812 8813 8814 8815 8816 8817 8818 8819 8820 8821 8822 8823 8824 8825 8826 8827 8828 8829 8830 8831 8832 8833 8834 8835 8836 8837 8838 8839 8840 8841 8842 8843 8844 8845 8846 8847 8848 8849 8850 8851 8852 8853 8854 8855 8856 8857 8858 8859 8860 8861 8862 8863 8864 8865 8866 8867 8868 8869 8870 8871 8872 8873 8874 8875 8876 8877 8878 8879 8880 8881 8882 8883 8884 8885 8886 8887 8888 8889 8890 8891 8892 8893 8894 8895 8896 8897 8898 8899 8900 8901 8902 8903 8904 8905 8906 8907 8908 8909 8910 8911 8912 8913 8914 8915 8916 8917 8918 8919 8920 8921 8922 8923 8924 8925 8926 8927 8928 8929 8930 8931 8932 8933 8934 8935 8936 8937 8938 8939 8940 8941 8942 8943 8944 8945 8946 8947 8948 8949 8950 8951 8952 8953 8954 8955 8956 8957 8958 8959 8960 8961 8962 8963 8964 8965 8966 8967 8968 8969 8970 8971 8972 8973 8974 8975 8976 8977 8978 8979 8980 8981 8982 8983 8984 8985 8986 8987 8988 8989 8990 8991 8992 8993 8994 8995 8996 8997 8998 8999 9000 9001 9002 9003 9004 9005 9006 9007 9008 9009 9010 9011 9012 9013 9014 9015 9016 9017 9018 9019 9020 9021 9022 9023 9024 9025 9026 9027 9028 9029 9030 9031 9032 9033 9034 9035 9036 9037 9038 9039 9040 9041 9042 9043 9044 9045 9046 9047 9048 9049 9050 9051 9052 9053 9054 9055 9056 9057 9058 9059 9060 9061 9062 9063 9064 9065 9066 9067 9068 9069 9070 9071 9072 9073 9074 9075 9076 9077 9078 9079 9080 9081 9082 9083 9084 9085 9086 9087 9088 9089 9090 9091 9092 9093 9094 9095 9096 9097 9098 9099 9100 9101 9102 9103 9104 9105 9106 9107 9108 9109 9110 9111 9112 9113 9114 9115 9116 9117 9118 9119 9120 9121 9122 9123 9124 9125 9126 9127 9128 9129 9130 9131 9132 9133 9134 9135 9136 9137 9138 9139 9140 9141 9142 9143 9144 9145 9146 9147 9148 9149 9150 9151 9152 9153 9154 9155 9156 9157 9158 9159 9160 9161 9162 9163 9164 9165 9166 9167 9168 9169 9170 9171 9172 9173 9174 9175 9176 9177 9178 9179 9180 9181 9182 9183 9184 9185 9186 9187 9188 9189 9190 9191 9192 9193 9194 9195 9196 9197 9198 9199 9200 9201 9202 9203 9204 9205 9206 9207 9208 9209 9210 9211 9212 9213 9214 9215 9216 9217 9218 9219 9220 9221 9222 9223 9224 9225 9226 9227 9228 9229 9230 9231 9232 9233 9234 9235 9236 9237 9238 9239 9240 9241 9242 9243 9244 9245 9246 9247 9248 9249 9250 9251 9252 9253 9254 9255 9256 9257 9258 9259 9260 9261 9262 9263 9264 9265 9266 9267 9268 9269 9270 9271 9272 9273 9274 9275 9276 9277 9278 9279 9280 9281 9282 9283 9284 9285 9286 9287 9288 9289 9290 9291 9292 9293 9294 9295 9296 9297 9298 9299 9300 9301 9302 9303 9304 9305 9306 9307 9308 9309 9310 9311 9312 9313 9314 9315 9316 9317 9318 9319 9320 9321 9322 9323 9324 9325 9326 9327 9328 9329 9330 9331 9332 9333 9334 9335 9336 9337 9338 9339 9340 9341 9342 9343 9344 9345 9346 9347 9348 9349 9350 9351 9352 9353 9354 9355 9356 9357 9358 9359 9360 9361 9362 9363 9364 9365 9366 9367 9368 9369 9370 9371 9372 9373 9374 9375 9376 9377 9378 9379 9380 9381 9382 9383 9384 9385 9386 9387 9388 9389 9390 9391 9392 9393 9394 9395 9396 9397 9398 9399 9400 9401 9402 9403 9404 9405 9406 9407 9408 9409 9410 9411 9412 9413 9414 9415 9416 9417 9418 9419 9420 9421 9422 9423 9424 9425 9426 9427 9428 9429 9430 9431 9432 9433 9434 9435 9436 9437 9438 9439 9440 9441 9442 9443 9444 9445 9446 9447 9448 9449 9450 9451 9452 9453 9454 9455 9456 9457 9458 9459 9460 9461 9462 9463 9464 9465 9466 9467 9468 9469 9470 9471 9472 9473 9474 9475 9476 9477 9478 9479 9480 9481 9482 9483 9484 9485 9486 9487 9488 9489 9490 9491 9492 9493 9494 9495 9496 9497 9498 9499 9500 9501 9502 9503 9504 9505 9506 9507 9508 9509 9510 9511 9512 9513 9514 9515 9516 9517 9518 9519 9520 9521 9522 9523 9524 9525 9526 9527 9528 9529 9530 9531 9532 9533 9534 9535 9536 9537 9538 9539 9540 9541 9542 9543 9544 9545 9546 9547 9548 9549 9550 9551 9552 9553 9554 9555 9556 9557 9558 9559 9560 9561 9562 9563 9564 9565 9566 9567 9568 9569 9570 9571 9572 9573 9574 9575 9576 9577 9578 9579 9580 9581 9582 9583 9584 9585 9586 9587 9588 9589 9590 9591 9592 9593 9594 9595 9596 9597 9598 9599 9600 9601 9602 9603 9604 9605 9606 9607 9608 9609 9610 9611 9612 9613 9614 9615 9616 9617 9618 9619 9620 9621 9622 9623 9624 9625 9626 9627 9628 9629 9630 9631 9632 9633 9634 9635 9636 9637 9638 9639 9640 9641 9642 9643 9644 9645 9646 9647 9648 9649 9650 9651 9652 9653 9654 9655 9656 9657 9658 9659 9660 9661 9662 9663 9664 9665 9666 9667 9668 9669 9670 9671 9672 9673 9674 9675 9676 9677 9678 9679 9680 9681 9682 9683 9684 9685 9686 9687 9688 9689 9690 9691 9692 9693 9694 9695 9696 9697 9698 9699 9700 9701 9702 9703 9704 9705 9706 9707 9708 9709 9710 9711 9712 9713 9714 9715 9716 9717 9718 9719 9720 9721 9722 9723 9724 9725 9726 9727 9728 9729 9730 9731 9732 9733 9734 9735 9736 9737 9738 9739 9740 9741 9742 9743 9744 9745 9746 9747 9748 9749 9750 9751 9752 9753 9754 9755 9756 9757 9758 9759 9760 9761 9762 9763 9764 9765 9766 9767 9768 9769 9770 9771 9772 9773 9774 9775 9776 9777 9778 9779 9780 9781 9782 9783 9784 9785 9786 9787 9788 9789 9790 9791 9792 9793 9794 9795 9796 9797 9798 9799 9800 9801 9802 9803 9804 9805 9806 9807 9808 9809 9810 9811 9812 9813 9814 9815 9816 9817 9818 9819 9820 9821 9822 9823 9824 9825 9826 9827 9828 9829 9830 9831 9832 9833 9834 9835 9836 9837 9838 9839 9840 9841 9842 9843 9844 9845 9846 9847 9848 9849 9850 9851 9852 9853 9854 9855 9856 9857 9858 9859 9860 9861 9862 9863 9864 9865 9866 9867 9868 9869 9870 9871 9872 9873 9874 9875 9876 9877 9878 9879 9880 9881 9882 9883 9884 9885 9886 9887 9888 9889 9890 9891 9892 9893 9894 9895 9896 9897 9898 9899 9900 9901 9902 9903 9904 9905 9906 9907 9908 9909 9910 9911 9912 9913 9914 9915 9916 9917 9918 9919 9920 9921 9922 9923 9924 9925 9926 9927 9928 9929 9930 9931 9932 9933 9934 9935 9936 9937 9938 9939 9940 9941 9942 9943 9944 9945 9946 9947 9948 9949 9950 9951 9952 9953 9954 9955 9956 9957 9958 9959 9960 9961 9962 9963 9964 9965 9966 9967 9968 9969 9970 9971 9972 9973 9974 9975 9976 9977 9978 9979 9980 9981 9982 9983 9984 9985 9986 9987 9988 9989 9990 9991 9992 9993 9994 9995 9996 9997 9998 9999 10000 10001 10002 10003 10004 10005 10006 10007 10008 10009 10010 10011 10012 10013 10014 10015 10016 10017 10018 10019 10020 10021 10022 10023 10024 10025 10026 10027 10028 10029 10030 10031 10032 10033 10034 10035 10036 10037 10038 10039 10040 10041 10042 10043 10044 10045 10046 10047 10048 10049 10050 10051 10052 10053 10054 10055 10056 10057 10058 10059 10060 10061 10062 10063 10064 10065 10066 10067 10068 10069 10070 10071 10072 10073 10074 10075 10076 10077 10078 10079 10080 10081 10082 10083 10084 10085 10086 10087 10088 10089 10090 10091 10092 10093 10094 10095 10096 10097 10098 10099 10100 10101 10102 10103 10104 10105 10106 10107 10108 10109 10110 10111 10112 10113 10114 10115 10116 10117 10118 10119 10120 10121 10122 10123 10124 10125 10126 10127 10128 10129 10130 10131 10132 10133 10134 10135 10136 10137 10138 10139 10140 10141 10142 10143 10144 10145 10146 10147 10148 10149 10150 10151 10152 10153 10154 10155 10156 10157 10158 10159 10160 10161 10162 10163 10164 10165 10166 10167 10168 10169 10170 10171 10172 10173 10174 10175 10176 10177 10178 10179 10180 10181 10182 10183 10184 10185 10186 10187 10188 10189 10190 10191 10192 10193 10194 10195 10196 10197 10198 10199 10200 10201 10202 10203 10204 10205 10206 10207 10208 10209 10210 10211 10212 10213 10214 10215 10216 10217 10218 10219 10220 10221 10222 10223 10224 10225 10226 10227 10228 10229 10230 10231 10232 10233 10234 10235 10236 10237 10238 10239 10240 10241 10242 10243 10244 10245 10246 10247 10248 10249 10250 10251 10252 10253 10254 10255 10256 10257 10258 10259 10260 10261 10262 10263 10264 10265 10266 10267 10268 10269 10270 10271 10272 10273 10274 10275 10276 10277 10278 10279 10280 10281 10282 10283 10284 10285 10286 10287 10288 10289 10290 10291 10292 10293 10294 10295 10296 10297 10298 10299 10300 10301 10302 10303 10304 10305 10306 10307 10308 10309 10310 10311 10312 10313 10314 10315 10316 10317 10318 10319 10320 10321 10322 10323 10324 10325 10326 10327 10328 10329 10330 10331 10332 10333 10334 10335 10336 10337 10338 10339 10340 10341 10342 10343 10344 10345 10346 10347 10348 10349 10350 10351 10352 10353 10354 10355 10356 10357 10358 10359 10360 10361 10362 10363 10364 10365 10366 10367 10368 10369 10370 10371 10372 10373 10374 10375 10376 10377 10378 10379 10380 10381 10382 10383 10384 10385 10386 10387 10388 10389 10390 10391 10392 10393 10394 10395 10396 10397 10398 10399 10400 10401 10402 10403 10404 10405 10406 10407 10408 10409 10410 10411 10412 10413 10414 10415 10416 10417 10418 10419 10420 10421 10422 10423 10424 10425 10426 10427 10428 10429 10430 10431 10432 10433 10434 10435 10436 10437 10438 10439 10440 10441 10442 10443 10444 10445 10446 10447 10448 10449 10450 10451 10452 10453 10454 10455 10456 10457 10458 10459 10460 10461 10462 10463 10464 10465 10466 10467 10468 10469 10470 10471 10472 10473 10474 10475 10476 10477 10478 10479 10480 10481 10482 10483 10484 10485 10486 10487 10488 10489 10490 10491 10492 10493 10494 10495 10496 10497 10498 10499 10500 10501 10502 10503 10504 10505 10506 10507 10508 10509 10510 10511 10512 10513 10514 10515 10516 10517 10518 10519 10520 10521 10522 10523 10524 10525 10526 10527 10528 10529 10530 10531 10532 10533 10534 10535 10536 10537 10538 10539 10540 10541 10542 10543 10544 10545 10546 10547 10548 10549 10550 10551 10552 10553 10554 10555 10556 10557 10558 10559 10560 10561 10562 10563 10564 10565 10566 10567 10568 10569 10570 10571 10572 10573 10574 10575 10576 10577 10578 10579 10580 10581 10582 10583 10584 10585 10586 10587 10588 10589 10590 10591 10592 10593 10594 10595 10596 10597 10598 10599 10600 10601 10602 10603 10604 10605 10606 10607 10608 10609 10610 10611 10612 10613 10614 10615 10616 10617 10618 10619 10620 10621 10622 10623 10624 10625 10626 10627 10628 10629 10630 10631 10632 10633 10634 10635 10636 10637 10638 10639 10640 10641 10642 10643 10644 10645 10646 10647 10648 10649 10650 10651 10652 10653 10654 10655 10656 10657 10658 10659 10660 10661 10662 10663 10664 10665 10666 10667 10668 10669 10670 10671 10672 10673 10674 10675 10676 10677 10678 10679 10680 10681 10682 10683 10684 10685 10686 10687 10688 10689 10690 10691 10692 10693 10694 10695 10696 10697 10698 10699 10700 10701 10702 10703 10704 10705 10706 10707 10708 10709 10710 10711 10712 10713 10714 10715 10716 10717 10718 10719 10720 10721 10722 10723 10724 10725 10726 10727 10728 10729 10730 10731 10732 10733 10734 10735 10736 10737 10738 10739 10740 10741 10742 10743 10744 10745 10746 10747 10748 10749 10750 10751 10752 10753 10754 10755 10756 10757 10758 10759 10760 10761 10762 10763 10764 10765 10766 10767 10768 10769 10770 10771 10772 10773 10774 10775 10776 10777 10778 10779 10780 10781 10782 10783 10784 10785 10786 10787 10788 10789 10790 10791 10792 10793 10794 10795 10796 10797 10798 10799 10800 10801 10802 10803 10804 10805 10806 10807 10808 10809 10810 10811 10812 10813 10814 10815 10816 10817 10818 10819 10820 10821 10822 10823 10824 10825 10826 10827 10828 10829 10830 10831 10832 10833 10834 10835 10836 10837 10838 10839 10840 10841 10842 10843 10844 10845 10846 10847 10848 10849 10850 10851 10852 10853 10854 10855 10856 10857 10858 10859 10860 10861 10862 10863 10864 10865 10866 10867 10868 10869 10870 10871 10872 10873 10874 10875 10876 10877 10878 10879 10880 10881 10882 10883 10884 10885 10886 10887 10888 10889 10890 10891 10892 10893 10894 10895 10896 10897 10898 10899 10900 10901 10902 10903 10904 10905 10906 10907 10908 10909 10910 10911 10912 10913 10914 10915 10916 10917 10918 10919 10920 10921 10922 10923 10924 10925 10926 10927 10928 10929 10930 10931 10932 10933 10934 10935 10936 10937 10938 10939 10940 10941 10942 10943 10944 10945 10946 10947 10948 10949 10950 10951 10952 10953 10954 10955 10956 10957 10958 10959 10960 10961 10962 10963 10964 10965 10966 10967 10968 10969 10970 10971 10972 10973 10974 10975 10976 10977 10978 10979 10980 10981 10982 10983 10984 10985 10986 10987 10988 10989 10990 10991 10992 10993 10994 10995 10996 10997 10998 10999 11000 11001 11002 11003 11004 11005 11006 11007 11008 11009 11010 11011 11012 11013 11014 11015 11016 11017 11018 11019 11020 11021 11022 11023 11024 11025 11026 11027 11028 11029 11030 11031 11032 11033 11034 11035 11036 11037 11038 11039 11040 11041 11042 11043 11044 11045 11046 11047 11048 11049 11050 11051 11052 11053 11054 11055 11056 11057 11058 11059 11060 11061 11062 11063 11064 11065 11066 11067 11068 11069 11070 11071 11072 11073 11074 11075 11076 11077 11078 11079 11080 11081 11082 11083 11084 11085 11086 11087 11088 11089 11090 11091 11092 11093 11094 11095 11096 11097 11098 11099 11100 11101 11102 11103 11104 11105 11106 11107 11108 11109 11110 11111 11112 11113 11114 11115 11116 11117 11118 11119 11120 11121 11122 11123 11124 11125 11126 11127 11128 11129 11130 11131 11132 11133 11134 11135 11136 11137 11138 11139 11140 11141 11142 11143 11144 11145 11146 11147 11148 11149 11150 11151 11152 11153 11154 11155 11156 11157 11158 11159 11160 11161 11162 11163 11164 11165 11166 11167 11168 11169 11170 11171 11172 11173 11174 11175 11176 11177 11178 11179 11180 11181 11182 11183 11184 11185 11186 11187 11188 11189 11190 11191 11192 11193 11194 11195 11196 11197 11198 11199 11200 11201 11202 11203 11204 11205 11206 11207 11208 11209 11210 11211 11212 11213 11214 11215 11216 11217 11218 11219 11220 11221 11222 11223 11224 11225 11226 11227 11228 11229 11230 11231 11232 11233 11234 11235 11236 11237 11238 11239 11240 11241 11242 11243 11244 11245 11246 11247 11248 11249 11250 11251 11252 11253 11254 11255 11256 11257 11258 11259 11260 11261 11262 11263 11264 11265 11266 11267 11268 11269 11270 11271 11272 11273 11274 11275 11276 11277 11278 11279 11280 11281 11282 11283 11284 11285 11286 11287 11288 11289 11290 11291 11292 11293 11294 11295 11296 11297 11298 11299 11300 11301 11302 11303 11304 11305 11306 11307 11308 11309 11310 11311 11312 11313 11314 11315 11316 11317 11318 11319 11320 11321 11322 11323 11324 11325 11326 11327 11328 11329 11330 11331 11332 11333 11334 11335 11336 11337 11338 11339 11340 11341 11342 11343 11344 11345 11346 11347 11348 11349 11350 11351 11352 11353 11354 11355 11356 11357 11358 11359 11360 11361 11362 11363 11364 11365 11366 11367 11368 11369 11370 11371 11372 11373 11374 11375 11376 11377 11378 11379 11380 11381 11382 11383 11384 11385 11386 11387 11388 11389 11390 11391 11392 11393 11394 11395 11396 11397 11398 11399 11400 11401 11402 11403 11404 11405 11406 11407 11408 11409 11410 11411 11412 11413 11414 11415 11416 11417 11418 11419 11420 11421 11422 11423 11424 11425 11426 11427 11428 11429 11430 11431 11432 11433 11434 11435 11436 11437 11438 11439 11440 11441 11442 11443 11444 11445 11446 11447 11448 11449 11450 11451 11452 11453 11454 11455 11456 11457 11458 11459 11460 11461 11462 11463 11464 11465 11466 11467 11468 11469 11470 11471 11472 11473 11474 11475 11476 11477 11478 11479 11480 11481 11482 11483 11484 11485 11486 11487 11488 11489 11490 11491 11492 11493 11494 11495 11496 11497 11498 11499 11500 11501 11502 11503 11504 11505 11506 11507 11508 11509 11510 11511 11512 11513 11514 11515 11516 11517 11518 11519 11520 11521 11522 11523 11524 11525 11526 11527 11528 11529 11530 11531 11532 11533 11534 11535 11536 11537 11538 11539 11540 11541 11542 11543 11544 11545 11546 11547 11548 11549 11550 11551 11552 11553 11554 11555 11556 11557 11558 11559 11560 11561 11562 11563 11564 11565 11566 11567 11568 11569 11570 11571 11572 11573 11574 11575 11576 11577 11578 11579 11580 11581 11582 11583 11584 11585 11586 11587 11588 11589 11590 11591 11592 11593 11594 11595 11596 11597 11598 11599 11600 11601 11602 11603 11604 11605 11606 11607 11608 11609 11610 11611 11612 11613 11614 11615 11616 11617 11618 11619 11620 11621 11622 11623 11624 11625 11626 11627 11628 11629 11630 11631 11632 11633 11634 11635 11636 11637 11638 11639 11640 11641 11642 11643 11644 11645 11646 11647 11648 11649 11650 11651 11652 11653 11654 11655 11656 11657 11658 11659 11660 11661 11662 11663 11664 11665 11666 11667 11668 11669 11670 11671 11672 11673 11674 11675 11676 11677 11678 11679 11680 11681 11682 11683 11684 11685 11686 11687 11688 11689 11690 11691 11692 11693 11694 11695 11696 11697 11698 11699 11700 11701 11702 11703 11704 11705 11706 11707 11708 11709 11710 11711 11712 11713 11714 11715 11716 11717 11718 11719 11720 11721 11722 11723 11724 11725 11726 11727 11728 11729 11730 11731 11732 11733 11734 11735 11736 11737 11738 11739 11740 11741 11742 11743 11744 11745 11746 11747 11748 11749 11750 11751 11752 11753 11754 11755 11756 11757 11758 11759 11760 11761 11762 11763 11764 11765 11766 11767 11768 11769 11770 11771 11772 11773 11774 11775 11776 11777 11778 11779 11780 11781 11782 11783 11784 11785 11786 11787 11788 11789 11790 11791 11792 11793 11794 11795 11796 11797 11798 11799 11800 11801 11802 11803 11804 11805 11806 11807 11808 11809 11810 11811 11812 11813 11814 11815 11816 11817 11818 11819 11820 11821 11822 11823 11824 11825 11826 11827 11828 11829 11830 11831 11832 11833 11834 11835 11836 11837 11838 11839 11840 11841 11842 11843 11844 11845 11846 11847 11848 11849 11850 11851 11852 11853 11854 11855 11856 11857 11858 11859 11860 11861 11862 11863 11864 11865 11866 11867 11868 11869 11870 11871 11872 11873 11874 11875 11876 11877 11878 11879 11880 11881 11882 11883 11884 11885 11886 11887 11888 11889 11890 11891 11892 11893 11894 11895 11896 11897 11898 11899 11900 11901 11902 11903 11904 11905 11906 11907 11908 11909 11910 11911 11912 11913 11914 11915 11916 11917 11918 11919 11920 11921 11922 11923 11924 11925 11926 11927 11928 11929 11930 11931 11932 11933 11934 11935 11936 11937 11938 11939 11940 11941 11942 11943 11944 11945 11946 11947 11948 11949 11950 11951 11952 11953 11954 11955 11956 11957 11958 11959 11960 11961 11962 11963 11964 11965 11966 11967 11968 11969 11970 11971 11972 11973 11974 11975 11976 11977 11978 11979 11980 11981 11982 11983 11984 11985 11986 11987 11988 11989 11990 11991 11992 11993 11994 11995 11996 11997 11998 11999 12000 12001 12002 12003 12004 12005 12006 12007 12008 12009 12010 12011 12012 12013 12014 12015 12016 12017 12018 12019 12020 12021 12022 12023 12024 12025 12026 12027 12028 12029 12030 12031 12032 12033 12034 12035 12036 12037 12038 12039 12040 12041 12042 12043 12044 12045 12046 12047 12048 12049 12050 12051 12052 12053 12054 12055 12056 12057 12058 12059 12060 12061 12062 12063 12064 12065 12066 12067 12068 12069 12070 12071 12072 12073 12074 12075 12076 12077 12078 12079 12080 12081 12082 12083 12084 12085 12086 12087 12088 12089 12090 12091 12092 12093 12094 12095 12096 12097 12098 12099 12100 12101 12102 12103 12104 12105 12106 12107 12108 12109 12110 12111 12112 12113 12114 12115 12116 12117 12118 12119 12120 12121 12122 12123 12124 12125 12126 12127 12128 12129 12130 12131 12132 12133 12134 12135 12136 12137 12138 12139 12140 12141 12142 12143 12144 12145 12146 12147 12148 12149 12150 12151 12152 12153 12154 12155 12156 12157 12158 12159 12160 12161 12162 12163 12164 12165 12166 12167 12168 12169 12170 12171 12172 12173 12174 12175 12176 12177 12178 12179 12180 12181 12182 12183 12184 12185 12186 12187 12188 12189 12190 12191 12192 12193 12194 12195 12196 12197 12198 12199 12200 12201 12202 12203 12204 12205 12206 12207 12208 12209 12210 12211 12212 12213 12214 12215 12216 12217 12218 12219 12220 12221 12222 12223 12224 12225 12226 12227 12228 12229 12230 12231 12232 12233 12234 12235 12236 12237 12238 12239 12240 12241 12242 12243 12244 12245 12246 12247 12248 12249 12250 12251 12252 12253 12254 12255 12256 12257 12258 12259 12260 12261 12262 12263 12264 12265 12266 12267 12268 12269 12270 12271 12272 12273 12274 12275 12276 12277 12278 12279 12280 12281 12282 12283 12284 12285 12286 12287 12288 12289 12290 12291 12292 12293 12294 12295 12296 12297 12298 12299 12300 12301 12302 12303 12304 12305 12306 12307 12308 12309 12310 12311 12312 12313 12314 12315 12316 12317 12318 12319 12320 12321 12322 12323 12324 12325 12326 12327 12328 12329 12330 12331 12332 12333 12334 12335 12336 12337 12338 12339 12340 12341 12342 12343 12344 12345 12346 12347 12348 12349 12350 12351 12352 12353 12354 12355 12356 12357 12358 12359 12360 12361 12362 12363 12364 12365 12366 12367 12368 12369 12370 12371 12372 12373 12374 12375 12376 12377 12378 12379 12380 12381 12382 12383 12384 12385 12386 12387 12388 12389 12390 12391 12392 12393 12394 12395 12396 12397 12398 12399 12400 12401 12402 12403 12404 12405 12406 12407 12408 12409 12410 12411 12412 12413 12414 12415 12416 12417 12418 12419 12420 12421 12422 12423 12424 12425 12426 12427 12428 12429 12430 12431 12432 12433 12434 12435 12436 12437 12438 12439 12440 12441 12442 12443 12444 12445 12446 12447 12448 12449 12450 12451 12452 12453 12454 12455 12456 12457 12458 12459 12460 12461 12462 12463 12464 12465 12466 12467 12468 12469 12470 12471 12472 12473 12474 12475 12476 12477 12478 12479 12480 12481 12482 12483 12484 12485 12486 12487 12488 12489 12490 12491 12492 12493 12494 12495 12496 12497 12498 12499 12500 12501 12502 12503 12504 12505 12506 12507 12508 12509 12510 12511 12512 12513 12514 12515 12516 12517 12518 12519 12520 12521 12522 12523 12524 12525 12526 12527 12528 12529 12530 12531 12532 12533 12534 12535 12536 12537 12538 12539 12540 12541 12542 12543 12544 12545 12546 12547 12548 12549 12550 12551 12552 12553 12554 12555 12556 12557 12558 12559 12560 12561 12562 12563 12564 12565 12566 12567 12568 12569 12570 12571 12572 12573 12574 12575 12576 12577 12578 12579 12580 12581 12582 12583 12584 12585 12586 12587 12588 12589 12590 12591 12592 12593 12594 12595 12596 12597 12598 12599 12600 12601 12602 12603 12604 12605 12606 12607 12608 12609 12610 12611 12612 12613 12614 12615 12616 12617 12618 12619 12620 12621 12622 12623 12624 12625 12626 12627 12628 12629 12630 12631 12632 12633 12634 12635 12636 12637 12638 12639 12640 12641 12642 12643 12644 12645 12646 12647 12648 12649 12650 12651 12652 12653 12654 12655 12656 12657 12658 12659 12660 12661 12662 12663 12664 12665 12666 12667 12668 12669 12670 12671 12672 12673 12674 12675 12676 12677 12678 12679 12680 12681 12682 12683 12684 12685 12686 12687 12688 12689 12690 12691 12692 12693 12694 12695 12696 12697 12698 12699 12700 12701 12702 12703 12704 12705 12706 12707 12708 12709 12710 12711 12712 12713 12714 12715 12716 12717 12718 12719 12720 12721 12722 12723 12724 12725 12726 12727 12728 12729 12730 12731 12732 12733 12734 12735 12736 12737 12738 12739 12740 12741 12742 12743 12744 12745 12746 12747 12748 12749 12750 12751 12752 12753 12754 12755 12756 12757 12758 12759 12760 12761 12762 12763 12764 12765 12766 12767 12768 12769 12770 12771 12772 12773 12774 12775 12776 12777 12778 12779 12780 12781 12782 12783 12784 12785 12786 12787 12788 12789 12790 12791 12792 12793 12794 12795 12796 12797 12798 12799 12800 12801 12802 12803 12804 12805 12806 12807 12808 12809 12810 12811 12812 12813 12814 12815 12816 12817 12818 12819 12820 12821 12822 12823 12824 12825 12826 12827 12828 12829 12830 12831 12832 12833 12834 12835 12836 12837 12838 12839 12840 12841 12842 12843 12844 12845 12846 12847 12848 12849 12850 12851 12852 12853 12854 12855 12856 12857 12858 12859 12860 12861 12862 12863 12864 12865 12866 12867 12868 12869 12870 12871 12872 12873 12874 12875 12876 12877 12878 12879 12880 12881 12882 12883 12884 12885 12886 12887 12888 12889 12890 12891 12892 12893 12894 12895 12896 12897 12898 12899 12900 12901 12902 12903 12904 12905 12906 12907 12908 12909 12910 12911 12912 12913 12914 12915 12916 12917 12918 12919 12920 12921 12922 12923 12924 12925 12926 12927 12928 12929 12930 12931 12932 12933 12934 12935 12936 12937 12938 12939 12940 12941 12942 12943 12944 12945 12946 12947 12948 12949 12950 12951 12952 12953 12954 12955 12956 12957 12958 12959 12960 12961 12962 12963 12964 12965 12966 12967 12968 12969 12970 12971 12972 12973 12974 12975 12976 12977 12978 12979 12980 12981 12982 12983 12984 12985 12986 12987 12988 12989 12990 12991 12992 12993 12994 12995 12996 12997 12998 12999 13000 13001 13002 13003 13004 13005 13006 13007 13008 13009 13010 13011 13012 13013 13014 13015 13016 13017 13018 13019 13020 13021 13022 13023 13024 13025 13026 13027 13028 13029 13030 13031 13032 13033 13034 13035 13036 13037 13038 13039 13040 13041 13042 13043 13044 13045 13046 13047 13048 13049 13050 13051 13052 13053 13054 13055 13056 13057 13058 13059 13060 13061 13062 13063 13064 13065 13066 13067 13068 13069 13070 13071 13072 13073 13074 13075 13076 13077 13078 13079 13080 13081 13082 13083 13084 13085 13086 13087 13088 13089 13090 13091 13092 13093 13094 13095 13096 13097 13098 13099 13100 13101 13102 13103 13104 13105 13106 13107 13108 13109 13110 13111 13112 13113 13114 13115 13116 13117 13118 13119 13120 13121 13122 13123 13124 13125 13126 13127 13128 13129 13130 13131 13132 13133 13134 13135 13136 13137 13138 13139 13140 13141 13142 13143 13144 13145 13146 13147 13148 13149 13150 13151 13152 13153 13154 13155 13156 13157 13158 13159 13160 13161 13162 13163 13164 13165 13166 13167 13168 13169 13170 13171 13172 13173 13174 13175 13176 13177 13178 13179 13180 13181 13182 13183 13184 13185 13186 13187 13188 13189 13190 13191 13192 13193 13194 13195 13196 13197 13198 13199 13200 13201 13202 13203 13204 13205 13206 13207 13208 13209 13210 13211 13212 13213 13214 13215 13216 13217 13218 13219 13220 13221 13222 13223 13224 13225 13226 13227 13228 13229 13230 13231 13232 13233 13234 13235 13236 13237 13238 13239 13240 13241 13242 13243 13244 13245 13246 13247 13248 13249 13250 13251 13252 13253 13254 13255 13256 13257 13258 13259 13260 13261 13262 13263 13264 13265 13266 13267 13268 13269 13270 13271 13272 13273 13274 13275 13276 13277 13278 13279 13280 13281 13282 13283 13284 13285 13286 13287 13288 13289 13290 13291 13292 13293 13294 13295 13296 13297 13298 13299 13300 13301 13302 13303 13304 13305 13306 13307 13308 13309 13310 13311 13312 13313 13314 13315 13316 13317 13318 13319 13320 13321 13322 13323 13324 13325 13326 13327 13328 13329 13330 13331 13332 13333 13334 13335 13336 13337 13338 13339 13340 13341 13342 13343 13344 13345 13346 13347 13348 13349 13350 13351 13352 13353 13354 13355 13356 13357 13358 13359 13360 13361 13362 13363 13364 13365 13366 13367 13368 13369 13370 13371 13372 13373 13374 13375 13376 13377 13378 13379 13380 13381 13382 13383 13384 13385 13386 13387 13388 13389 13390 13391 13392 13393 13394 13395 13396 13397 13398 13399 13400 13401 13402 13403 13404 13405 13406 13407 13408 13409 13410 13411 13412 13413 13414 13415 13416 13417 13418 13419 13420 13421 13422 13423 13424 13425 13426 13427 13428 13429 13430 13431 13432 13433 13434 13435 13436 13437 13438 13439 13440 13441 13442 13443 13444 13445 13446 13447 13448 13449 13450 13451 13452 13453 13454 13455 13456 13457 13458 13459 13460 13461 13462 13463 13464 13465 13466 13467 13468 13469 13470 13471 13472 13473 13474 13475 13476 13477 13478 13479 13480 13481 13482 13483 13484 13485 13486 13487 13488 13489 13490 13491 13492 13493 13494 13495 13496 13497 13498 13499 13500 13501 13502 13503 13504 13505 13506 13507 13508 13509 13510 13511 13512 13513 13514 13515 13516 13517 13518 13519 13520 13521 13522 13523 13524 13525 13526 13527 13528 13529 13530 13531 13532 13533 13534 13535 13536 13537 13538 13539 13540 13541 13542 13543 13544 13545 13546 13547 13548 13549 13550 13551 13552 13553 13554 13555 13556 13557 13558 13559 13560 13561 13562 13563 13564 13565 13566 13567 13568 13569 13570 13571 13572 13573 13574 13575 13576 13577 13578 13579 13580 13581 13582 13583 13584 13585 13586 13587 13588 13589 13590 13591 13592 13593 13594 13595 13596 13597 13598 13599 13600 13601 13602 13603 13604 13605 13606 13607 13608 13609 13610 13611 13612 13613 13614 13615 13616 13617 13618 13619 13620 13621 13622 13623 13624 13625 13626 13627 13628 13629 13630 13631 13632 13633 13634 13635 13636 13637 13638 13639 13640 13641 13642 13643 13644 13645 13646 13647 13648 13649 13650 13651 13652 13653 13654 13655 13656 13657 13658 13659 13660 13661 13662 13663 13664 13665 13666 13667 13668 13669 13670 13671 13672 13673 13674 13675 13676 13677 13678 13679 13680 13681 13682 13683 13684 13685 13686 13687 13688 13689 13690 13691 13692 13693 13694 13695 13696 13697 13698 13699 13700 13701 13702 13703 13704 13705 13706 13707 13708 13709 13710 13711 13712 13713 13714 13715 13716 13717 13718 13719 13720 13721 13722 13723 13724 13725 13726 13727 13728 13729 13730 13731 13732 13733 13734 13735 13736 13737 13738 13739 13740 13741 13742 13743 13744 13745 13746 13747 13748 13749 13750 13751 13752 13753 13754 13755 13756 13757 13758 13759 13760 13761 13762 13763 13764 13765 13766 13767 13768 13769 13770 13771 13772 13773 13774 13775 13776 13777 13778 13779 13780 13781 13782 13783 13784 13785 13786 13787 13788 13789 13790 13791 13792 13793 13794 13795 13796 13797 13798 13799 13800 13801 13802 13803 13804 13805 13806 13807 13808 13809 13810 13811 13812 13813 13814 13815 13816 13817 13818 13819 13820 13821 13822 13823 13824 13825 13826 13827 13828 13829 13830 13831 13832 13833 13834 13835 13836 13837 13838 13839 13840 13841 13842 13843 13844 13845 13846 13847 13848 13849 13850 13851 13852 13853 13854 13855 13856 13857 13858 13859 13860 13861 13862 13863 13864 13865 13866 13867 13868 13869 13870 13871 13872 13873 13874 13875 13876 13877 13878 13879 13880 13881 13882 13883 13884 13885 13886 13887 13888 13889 13890 13891 13892 13893 13894 13895 13896 13897 13898 13899 13900 13901 13902 13903 13904 13905 13906 13907 13908 13909 13910 13911 13912 13913 13914 13915 13916 13917 13918 13919 13920 13921 13922 13923 13924 13925 13926 13927 13928 13929 13930 13931 13932 13933 13934 13935 13936 13937 13938 13939 13940 13941 13942 13943 13944 13945 13946 13947 13948 13949 13950 13951 13952 13953 13954 13955 13956 13957 13958 13959 13960 13961 13962 13963 13964 13965 13966 13967 13968 13969 13970 13971 13972 13973 13974 13975 13976 13977 13978 13979 13980 13981 13982 13983 13984 13985 13986 13987 13988 13989 13990 13991 13992 13993 13994 13995 13996 13997 13998 13999 14000 14001 14002 14003 14004 14005 14006 14007 14008 14009 14010 14011 14012 14013 14014 14015 14016 14017 14018 14019 14020 14021 14022 14023 14024 14025 14026 14027 14028 14029 14030 14031 14032 14033 14034 14035 14036 14037 14038 14039 14040 14041 14042 14043 14044 14045 14046 14047 14048 14049 14050 14051 14052 14053 14054 14055 14056 14057 14058 14059 14060 14061 14062 14063 14064 14065 14066 14067 14068 14069 14070 14071 14072 14073 14074 14075 14076 14077 14078 14079 14080 14081 14082 14083 14084 14085 14086 14087 14088 14089 14090 14091 14092 14093 14094 14095 14096 14097 14098 14099 14100 14101 14102 14103 14104 14105 14106 14107 14108 14109 14110 14111 14112 14113 14114 14115 14116 14117 14118 14119 14120 14121 14122 14123 14124 14125 14126 14127 14128 14129 14130 14131 14132 14133 14134 14135 14136 14137 14138 14139 14140 14141 14142 14143 14144 14145 14146 14147 14148 14149 14150 14151 14152 14153 14154 14155 14156 14157 14158 14159 14160 14161 14162 14163 14164 14165 14166 14167 14168 14169 14170 14171 14172 14173 14174 14175 14176 14177 14178 14179 14180 14181 14182 14183 14184 14185 14186 14187 14188 14189 14190 14191 14192 14193 14194 14195 14196 14197 14198 14199 14200 14201 14202 14203 14204 14205 14206 14207 14208 14209 14210 14211 14212 14213 14214 14215 14216 14217 14218 14219 14220 14221 14222 14223 14224 14225 14226 14227 14228 14229 14230 14231 14232 14233 14234 14235 14236 14237 14238 14239 14240 14241 14242 14243 14244 14245 14246 14247 14248 14249 14250
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 383627b..cf8d4f6 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -51,8 +51,7 @@ SET(INSTALL_INC include CACHE PATH "Where to install headers to.")
# Build options
OPTION (BUILD_SHARED_LIBS "Build Shared Library (OFF for Static)" ON)
OPTION (THREADSAFE "Build libgit2 as threadsafe" OFF)
-OPTION (BUILD_TESTS "Build Tests" ON)
-OPTION (BUILD_CLAR "Build Tests using the Clar suite" OFF)
+OPTION (BUILD_CLAR "Build Tests using the Clar suite" ON)
OPTION (TAGS "Generate tags" OFF)
# Platform specific compilation flags
@@ -64,10 +63,11 @@ IF (MSVC)
IF (STDCALL)
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /Gz")
ENDIF ()
- # TODO: bring back /RTC1 /RTCc
- SET(CMAKE_C_FLAGS_DEBUG "/Od /DEBUG /MTd")
+ SET(CMAKE_C_FLAGS_DEBUG "/Od /DEBUG /MTd /RTC1 /RTCs /RTCu")
SET(CMAKE_C_FLAGS_RELEASE "/MT /O2")
SET(WIN_RC "src/win32/git2.rc")
+
+ # Precompiled headers
ELSE ()
SET(CMAKE_C_FLAGS "-O2 -g -D_GNU_SOURCE -Wall -Wextra -Wno-missing-field-initializers -Wstrict-aliasing=2 -Wstrict-prototypes -Wmissing-prototypes ${CMAKE_C_FLAGS}")
SET(CMAKE_C_FLAGS_DEBUG "-O0 -g")
@@ -127,29 +127,10 @@ INSTALL(DIRECTORY include/git2 DESTINATION ${INSTALL_INC} )
INSTALL(FILES include/git2.h DESTINATION ${INSTALL_INC} )
# Tests
-IF (BUILD_TESTS)
- SET(TEST_RESOURCES "${CMAKE_CURRENT_SOURCE_DIR}/tests/resources" CACHE PATH "Path to test resources.")
- ADD_DEFINITIONS(-DTEST_RESOURCES=\"${TEST_RESOURCES}\")
-
- INCLUDE_DIRECTORIES(tests)
- FILE(GLOB SRC_TEST tests/t??-*.c)
-
- ADD_EXECUTABLE(libgit2_test tests/test_main.c tests/test_lib.c tests/test_helpers.c ${SRC} ${SRC_TEST} ${SRC_ZLIB} ${SRC_HTTP} ${SRC_REGEX})
- TARGET_LINK_LIBRARIES(libgit2_test ${CMAKE_THREAD_LIBS_INIT})
- IF (WIN32)
- TARGET_LINK_LIBRARIES(libgit2_test ws2_32)
- ELSEIF (CMAKE_SYSTEM_NAME MATCHES "(Solaris|SunOS)")
- TARGET_LINK_LIBRARIES(libgit2_test socket nsl)
- ENDIF ()
-
- ENABLE_TESTING()
- ADD_TEST(libgit2_test libgit2_test)
-ENDIF ()
-
IF (BUILD_CLAR)
FIND_PACKAGE(PythonInterp REQUIRED)
- SET(CLAR_FIXTURES "${CMAKE_CURRENT_SOURCE_DIR}/tests/resources/")
+ SET(CLAR_FIXTURES "${CMAKE_CURRENT_SOURCE_DIR}/tests-clar/resources/")
SET(CLAR_PATH "${CMAKE_CURRENT_SOURCE_DIR}/tests-clar")
ADD_DEFINITIONS(-DCLAR_FIXTURE_PATH=\"${CLAR_FIXTURES}\")
diff --git a/README.md b/README.md
index 755a62b..b0c0db1 100644
--- a/README.md
+++ b/README.md
@@ -70,7 +70,7 @@ The following CMake variables are declared:
- `INSTALL_LIB`: Where to install libraries to.
- `INSTALL_INC`: Where to install headers to.
- `BUILD_SHARED_LIBS`: Build libgit2 as a Shared Library (defaults to ON)
-- `BUILD_TESTS`: Build the libgit2 test suite (defaults to ON)
+- `BUILD_CLAR`: Build [Clar](https://github.com/tanoku/clar)-based test suite (defaults to ON)
- `THREADSAFE`: Build libgit2 with threading support (defaults to OFF)
Language Bindings
diff --git a/tests-clar/buf/basic.c b/tests-clar/buf/basic.c
index b025c99..5d4a5ff 100644
--- a/tests-clar/buf/basic.c
+++ b/tests-clar/buf/basic.c
@@ -8,7 +8,7 @@ void test_buf_basic__resize(void)
git_buf buf1 = GIT_BUF_INIT;
git_buf_puts(&buf1, test_string);
cl_assert(git_buf_oom(&buf1) == 0);
- cl_assert(strcmp(git_buf_cstr(&buf1), test_string) == 0);
+ cl_assert_strequal(git_buf_cstr(&buf1), test_string);
git_buf_puts(&buf1, test_string);
cl_assert(strlen(git_buf_cstr(&buf1)) == strlen(test_string) * 2);
@@ -20,10 +20,10 @@ void test_buf_basic__printf(void)
git_buf buf2 = GIT_BUF_INIT;
git_buf_printf(&buf2, "%s %s %d ", "shoop", "da", 23);
cl_assert(git_buf_oom(&buf2) == 0);
- cl_assert(strcmp(git_buf_cstr(&buf2), "shoop da 23 ") == 0);
+ cl_assert_strequal(git_buf_cstr(&buf2), "shoop da 23 ");
git_buf_printf(&buf2, "%s %d", "woop", 42);
cl_assert(git_buf_oom(&buf2) == 0);
- cl_assert(strcmp(git_buf_cstr(&buf2), "shoop da 23 woop 42") == 0);
+ cl_assert_strequal(git_buf_cstr(&buf2), "shoop da 23 woop 42");
git_buf_free(&buf2);
}
diff --git a/tests-clar/config/multivar.c b/tests-clar/config/multivar.c
index 9a411f0..d3784c0 100644
--- a/tests-clar/config/multivar.c
+++ b/tests-clar/config/multivar.c
@@ -21,7 +21,7 @@ static int mv_read_cb(const char *name, const char *value, void *data)
if (!strcmp(name, _name))
(*n)++;
- return 0;
+ return GIT_SUCCESS;
}
void test_config_multivar__foreach(void)
diff --git a/tests-clar/config/new.c b/tests-clar/config/new.c
index 96aed2b..651e739 100644
--- a/tests-clar/config/new.c
+++ b/tests-clar/config/new.c
@@ -26,9 +26,9 @@ void test_config_new__write_new_config(void)
cl_git_pass(git_config_add_file(config, file, 0));
cl_git_pass(git_config_get_string(config, "color.ui", &out));
- cl_assert(strcmp(out, "auto") == 0);
+ cl_assert_strequal(out, "auto");
cl_git_pass(git_config_get_string(config, "core.editor", &out));
- cl_assert(strcmp(out, "ed") == 0);
+ cl_assert_strequal(out, "ed");
git_config_free(config);
diff --git a/tests-clar/config/read.c b/tests-clar/config/read.c
index 26e6f42..2813048 100644
--- a/tests-clar/config/read.c
+++ b/tests-clar/config/read.c
@@ -28,9 +28,9 @@ void test_config_read__case_sensitive(void)
cl_git_pass(git_config_open_ondisk(&cfg, cl_fixture("config/config1")));
cl_git_pass(git_config_get_string(cfg, "this.that.other", &str));
- cl_assert(!strcmp(str, "true"));
+ cl_assert_strequal(str, "true");
cl_git_pass(git_config_get_string(cfg, "this.That.other", &str));
- cl_assert(!strcmp(str, "yes"));
+ cl_assert_strequal(str, "yes");
cl_git_pass(git_config_get_bool(cfg, "this.that.other", &i));
cl_assert(i == 1);
@@ -55,7 +55,7 @@ void test_config_read__multiline_value(void)
cl_git_pass(git_config_open_ondisk(&cfg, cl_fixture("config/config2")));
cl_git_pass(git_config_get_string(cfg, "this.That.and", &str));
- cl_assert(!strcmp(str, "one one one two two three three"));
+ cl_assert_strequal(str, "one one one two two three three");
git_config_free(cfg);
}
@@ -71,7 +71,7 @@ void test_config_read__subsection_header(void)
cl_git_pass(git_config_open_ondisk(&cfg, cl_fixture("config/config3")));
cl_git_pass(git_config_get_string(cfg, "section.subsection.var", &str));
- cl_assert(!strcmp(str, "hello"));
+ cl_assert_strequal(str, "hello");
/* The subsection is transformed to lower-case */
cl_must_fail(git_config_get_string(cfg, "section.subSectIon.var", &str));
@@ -171,10 +171,10 @@ void test_config_read__prefixes(void)
cl_git_pass(git_config_open_ondisk(&cfg, cl_fixture("config/config9")));
cl_git_pass(git_config_get_string(cfg, "remote.ab.url", &str));
- cl_assert(strcmp(str, "http://example.com/git/ab") == 0);
+ cl_assert_strequal(str, "http://example.com/git/ab");
cl_git_pass(git_config_get_string(cfg, "remote.abba.url", &str));
- cl_assert(strcmp(str, "http://example.com/git/abba") == 0);
+ cl_assert_strequal(str, "http://example.com/git/abba");
git_config_free(cfg);
}
diff --git a/tests-clar/hash/table.c b/tests-clar/hash/table.c
new file mode 100644
index 0000000..e69d386
--- /dev/null
+++ b/tests-clar/hash/table.c
@@ -0,0 +1,162 @@
+#include "clar_libgit2.h"
+
+#include "hashtable.h"
+#include "hash.h"
+
+
+// Helpers
+typedef struct _aux_object {
+ int __bulk;
+ git_oid id;
+ int visited;
+} table_item;
+
+static uint32_t hash_func(const void *key, int hash_id)
+{
+ uint32_t r;
+ const git_oid *id = (const git_oid *)key;
+
+ memcpy(&r, id->id + (hash_id * sizeof(uint32_t)), sizeof(r));
+ return r;
+}
+
+static int hash_cmpkey(const void *a, const void *b)
+{
+ return git_oid_cmp((const git_oid*)a, (const git_oid*)b);
+}
+
+
+void test_hash_table__new(void)
+{
+ // create a new hashtable
+ git_hashtable *table = NULL;
+
+ table = git_hashtable_alloc(55, hash_func, hash_cmpkey);
+ cl_assert(table != NULL);
+ cl_assert(table->size_mask + 1 == 64);
+
+ git_hashtable_free(table);
+}
+
+void test_hash_table__fill(void)
+{
+ // fill the hashtable with random entries
+ const int objects_n = 32;
+ int i;
+ table_item *objects;
+ git_hashtable *table = NULL;
+
+ table = git_hashtable_alloc(objects_n * 2, hash_func, hash_cmpkey);
+ cl_assert(table != NULL);
+
+ objects = (table_item *)git__malloc(objects_n * sizeof(table_item));
+ memset(objects, 0x0, objects_n * sizeof(table_item));
+
+ /* populate the hash table */
+ for (i = 0; i < objects_n; ++i) {
+ git_hash_buf(&(objects[i].id), &i, sizeof(int));
+ cl_git_pass(git_hashtable_insert(table, &(objects[i].id), &(objects[i])));
+ }
+
+ /* make sure all the inserted objects can be found */
+ for (i = 0; i < objects_n; ++i) {
+ git_oid id;
+ table_item *ob;
+
+ git_hash_buf(&id, &i, sizeof(int));
+ ob = (table_item *)git_hashtable_lookup(table, &id);
+
+ cl_assert(ob != NULL);
+ cl_assert(ob == &(objects[i]));
+ }
+
+ /* make sure we cannot find inexisting objects */
+ for (i = 0; i < 50; ++i) {
+ int hash_id;
+ git_oid id;
+
+ hash_id = (rand() % 50000) + objects_n;
+ git_hash_buf(&id, &hash_id, sizeof(int));
+ cl_assert(git_hashtable_lookup(table, &id) == NULL);
+ }
+
+ git_hashtable_free(table);
+ git__free(objects);
+}
+
+
+void test_hash_table__resize(void)
+{
+ // make sure the table resizes automatically
+ const int objects_n = 64;
+ int i;
+ unsigned int old_size;
+ table_item *objects;
+ git_hashtable *table = NULL;
+
+ table = git_hashtable_alloc(objects_n, hash_func, hash_cmpkey);
+ cl_assert(table != NULL);
+
+ objects = (table_item*)git__malloc(objects_n * sizeof(table_item));
+ memset(objects, 0x0, objects_n * sizeof(table_item));
+
+ old_size = table->size_mask + 1;
+
+ /* populate the hash table -- should be automatically resized */
+ for (i = 0; i < objects_n; ++i) {
+ git_hash_buf(&(objects[i].id), &i, sizeof(int));
+ cl_git_pass(git_hashtable_insert(table, &(objects[i].id), &(objects[i])));
+ }
+
+ cl_assert(table->size_mask > old_size);
+
+ /* make sure all the inserted objects can be found */
+ for (i = 0; i < objects_n; ++i) {
+ git_oid id;
+ table_item *ob;
+
+ git_hash_buf(&id, &i, sizeof(int));
+ ob = (table_item *)git_hashtable_lookup(table, &id);
+
+ cl_assert(ob != NULL);
+ cl_assert(ob == &(objects[i]));
+ }
+
+ git_hashtable_free(table);
+ git__free(objects);
+}
+
+
+void test_hash_table__iterate(void)
+{
+ // iterate through all the contents of the table
+
+ const int objects_n = 32;
+ int i;
+ table_item *objects, *ob;
+
+ git_hashtable *table = NULL;
+
+ table = git_hashtable_alloc(objects_n * 2, hash_func, hash_cmpkey);
+ cl_assert(table != NULL);
+
+ objects = git__malloc(objects_n * sizeof(table_item));
+ memset(objects, 0x0, objects_n * sizeof(table_item));
+
+ /* populate the hash table */
+ for (i = 0; i < objects_n; ++i) {
+ git_hash_buf(&(objects[i].id), &i, sizeof(int));
+ cl_git_pass(git_hashtable_insert(table, &(objects[i].id), &(objects[i])));
+ }
+
+ GIT_HASHTABLE_FOREACH_VALUE(table, ob, ob->visited = 1);
+
+ /* make sure all nodes have been visited */
+ for (i = 0; i < objects_n; ++i)
+ {
+ cl_assert(objects[i].visited);
+ }
+
+ git_hashtable_free(table);
+ git__free(objects);
+}
diff --git a/tests-clar/index/tests.c b/tests-clar/index/tests.c
new file mode 100644
index 0000000..9edcabe
--- /dev/null
+++ b/tests-clar/index/tests.c
@@ -0,0 +1,245 @@
+#include "clar_libgit2.h"
+#include "index.h"
+
+static const int index_entry_count = 109;
+static const int index_entry_count_2 = 1437;
+#define TEST_INDEX_PATH cl_fixture("testrepo.git/index")
+#define TEST_INDEX2_PATH cl_fixture("gitgit.index")
+#define TEST_INDEXBIG_PATH cl_fixture("big.index")
+
+
+// Suite data
+struct test_entry {
+ int index;
+ char path[128];
+ git_off_t file_size;
+ git_time_t mtime;
+};
+
+static struct test_entry test_entries[] = {
+ {4, "Makefile", 5064, 0x4C3F7F33},
+ {62, "tests/Makefile", 2631, 0x4C3F7F33},
+ {36, "src/index.c", 10014, 0x4C43368D},
+ {6, "git.git-authors", 2709, 0x4C3F7F33},
+ {48, "src/revobject.h", 1448, 0x4C3F7FE2}
+};
+
+
+// Helpers
+static void copy_file(const char *src, const char *dst)
+{
+ git_buf source_buf = GIT_BUF_INIT;
+ git_file dst_fd;
+ int error = GIT_ERROR;
+
+ cl_git_pass(git_futils_readbuffer(&source_buf, src));
+
+ dst_fd = git_futils_creat_withpath(dst, 0777, 0666);
+ if (dst_fd < 0)
+ goto cleanup;
+
+ cl_git_pass(p_write(dst_fd, source_buf.ptr, source_buf.size));
+
+cleanup:
+ git_buf_free(&source_buf);
+ p_close(dst_fd);
+}
+
+static void files_are_equal(const char *a, const char *b)
+{
+ git_buf buf_a = GIT_BUF_INIT;
+ git_buf buf_b = GIT_BUF_INIT;
+ int pass;
+
+ if (git_futils_readbuffer(&buf_a, a) < GIT_SUCCESS)
+ cl_assert(0);
+
+ if (git_futils_readbuffer(&buf_b, b) < GIT_SUCCESS) {
+ git_buf_free(&buf_a);
+ cl_assert(0);
+ }
+
+ pass = (buf_a.size == buf_b.size && !memcmp(buf_a.ptr, buf_b.ptr, buf_a.size));
+
+ git_buf_free(&buf_a);
+ git_buf_free(&buf_b);
+}
+
+
+// Fixture setup and teardown
+void test_index_tests__initialize(void)
+{
+}
+
+void test_index_tests__cleanup(void)
+{
+}
+
+
+void test_index_tests__empty_index(void)
+{
+ git_index *index;
+
+ cl_git_pass(git_index_open(&index, "in-memory-index"));
+ cl_assert(index->on_disk == 0);
+
+ cl_assert(git_index_entrycount(index) == 0);
+ cl_assert(index->entries.sorted);
+
+ git_index_free(index);
+}
+
+void test_index_tests__default_test_index(void)
+{
+ git_index *index;
+ unsigned int i;
+ git_index_entry **entries;
+
+ cl_git_pass(git_index_open(&index, TEST_INDEX_PATH));
+ cl_assert(index->on_disk);
+
+ cl_assert(git_index_entrycount(index) == (unsigned int)index_entry_count);
+ cl_assert(index->entries.sorted);
+
+ entries = (git_index_entry **)index->entries.contents;
+
+ for (i = 0; i < ARRAY_SIZE(test_entries); ++i) {
+ git_index_entry *e = entries[test_entries[i].index];
+
+ cl_assert_strequal(e->path, test_entries[i].path);
+ cl_assert(e->mtime.seconds == test_entries[i].mtime);
+ cl_assert(e->file_size == test_entries[i].file_size);
+ }
+
+ git_index_free(index);
+}
+
+void test_index_tests__gitgit_index(void)
+{
+ git_index *index;
+
+ cl_git_pass(git_index_open(&index, TEST_INDEX2_PATH));
+ cl_assert(index->on_disk);
+
+ cl_assert(git_index_entrycount(index) == (unsigned int)index_entry_count_2);
+ cl_assert(index->entries.sorted);
+ cl_assert(index->tree != NULL);
+
+ git_index_free(index);
+}
+
+void test_index_tests__find_in_existing(void)
+{
+ git_index *index;
+ unsigned int i;
+
+ cl_git_pass(git_index_open(&index, TEST_INDEX_PATH));
+
+ for (i = 0; i < ARRAY_SIZE(test_entries); ++i) {
+ int idx = git_index_find(index, test_entries[i].path);
+ cl_assert(idx == test_entries[i].index);
+ }
+
+ git_index_free(index);
+}
+
+void test_index_tests__find_in_empty(void)
+{
+ git_index *index;
+ unsigned int i;
+
+ cl_git_pass(git_index_open(&index, "fake-index"));
+
+ for (i = 0; i < ARRAY_SIZE(test_entries); ++i) {
+ int idx = git_index_find(index, test_entries[i].path);
+ cl_assert(idx == GIT_ENOTFOUND);
+ }
+
+ git_index_free(index);
+}
+
+void test_index_tests__write(void)
+{
+ git_index *index;
+
+ copy_file(TEST_INDEXBIG_PATH, "index_rewrite");
+
+ cl_git_pass(git_index_open(&index, "index_rewrite"));
+ cl_assert(index->on_disk);
+
+ cl_git_pass(git_index_write(index));
+ files_are_equal(TEST_INDEXBIG_PATH, "index_rewrite");
+
+ git_index_free(index);
+
+ p_unlink("index_rewrite");
+}
+
+void test_index_tests__sort0(void)
+{
+ // sort the entires in an index
+ /*
+ * TODO: This no longer applies:
+ * index sorting in Git uses some specific changes to the way
+ * directories are sorted.
+ *
+ * We need to specificially check for this by creating a new
+ * index, adding entries in random order and then
+ * checking for consistency
+ */
+}
+
+void test_index_tests__sort1(void)
+{
+ // sort the entires in an empty index
+ git_index *index;
+
+ cl_git_pass(git_index_open(&index, "fake-index"));
+
+ /* FIXME: this test is slightly dumb */
+ cl_assert(index->entries.sorted);
+
+ git_index_free(index);
+}
+
+void test_index_tests__add(void)
+{
+ git_index *index;
+ git_filebuf file = GIT_FILEBUF_INIT;
+ git_repository *repo;
+ git_index_entry *entry;
+ git_oid id1;
+
+ /* Intialize a new repository */
+ cl_git_pass(git_repository_init(&repo, "./myrepo", 0));
+
+ /* Ensure we're the only guy in the room */
+ cl_git_pass(git_repository_index(&index, repo));
+ cl_assert(git_index_entrycount(index) == 0);
+
+ /* Create a new file in the working directory */
+ cl_git_pass(git_futils_mkpath2file("myrepo/test.txt", 0777));
+ cl_git_pass(git_filebuf_open(&file, "myrepo/test.txt", 0));
+ cl_git_pass(git_filebuf_write(&file, "hey there\n", 10));
+ cl_git_pass(git_filebuf_commit(&file, 0666));
+
+ /* Store the expected hash of the file/blob
+ * This has been generated by executing the following
+ * $ echo "hey there" | git hash-object --stdin
+ */
+ cl_git_pass(git_oid_fromstr(&id1, "a8233120f6ad708f843d861ce2b7228ec4e3dec6"));
+
+ /* Add the new file to the index */
+ cl_git_pass(git_index_add(index, "test.txt", 0));
+
+ /* Wow... it worked! */
+ cl_assert(git_index_entrycount(index) == 1);
+ entry = git_index_get(index, 0);
+
+ /* And the built-in hashing mechanism worked as expected */
+ cl_assert(git_oid_cmp(&id1, &entry->oid) == 0);
+
+ git_index_free(index);
+ git_repository_free(repo);
+}
+
diff --git a/tests-clar/network/createremotethenload.c b/tests-clar/network/createremotethenload.c
index 68ba929..a805e2d 100644
--- a/tests-clar/network/createremotethenload.c
+++ b/tests-clar/network/createremotethenload.c
@@ -28,6 +28,6 @@ void test_network_createremotethenload__cleanup(void)
void test_network_createremotethenload__parsing(void)
{
- cl_assert(!strcmp(git_remote_name(_remote), "origin"));
- cl_assert(!strcmp(git_remote_url(_remote), url));
+ cl_assert_strequal(git_remote_name(_remote), "origin");
+ cl_assert_strequal(git_remote_url(_remote), url);
}
diff --git a/tests-clar/network/remotes.c b/tests-clar/network/remotes.c
index add99c1..5dc5f33 100644
--- a/tests-clar/network/remotes.c
+++ b/tests-clar/network/remotes.c
@@ -27,8 +27,8 @@ void test_network_remotes__cleanup(void)
void test_network_remotes__parsing(void)
{
- cl_assert(!strcmp(git_remote_name(_remote), "test"));
- cl_assert(!strcmp(git_remote_url(_remote), "git://github.com/libgit2/libgit2"));
+ cl_assert_strequal(git_remote_name(_remote), "test");
+ cl_assert_strequal(git_remote_url(_remote), "git://github.com/libgit2/libgit2");
}
void test_network_remotes__parsing_ssh_remote(void)
@@ -53,24 +53,24 @@ void test_network_remotes__unsupported_transport_methods_are_unsupported(void)
void test_network_remotes__refspec_parsing(void)
{
- cl_assert(!strcmp(git_refspec_src(_refspec), "refs/heads/*"));
- cl_assert(!strcmp(git_refspec_dst(_refspec), "refs/remotes/test/*"));
+ cl_assert_strequal(git_refspec_src(_refspec), "refs/heads/*");
+ cl_assert_strequal(git_refspec_dst(_refspec), "refs/remotes/test/*");
}
void test_network_remotes__set_fetchspec(void)
{
cl_git_pass(git_remote_set_fetchspec(_remote, "refs/*:refs/*"));
_refspec = git_remote_fetchspec(_remote);
- cl_assert(!strcmp(git_refspec_src(_refspec), "refs/*"));
- cl_assert(!strcmp(git_refspec_dst(_refspec), "refs/*"));
+ cl_assert_strequal(git_refspec_src(_refspec), "refs/*");
+ cl_assert_strequal(git_refspec_dst(_refspec), "refs/*");
}
void test_network_remotes__set_pushspec(void)
{
cl_git_pass(git_remote_set_pushspec(_remote, "refs/*:refs/*"));
_refspec = git_remote_pushspec(_remote);
- cl_assert(!strcmp(git_refspec_src(_refspec), "refs/*"));
- cl_assert(!strcmp(git_refspec_dst(_refspec), "refs/*"));
+ cl_assert_strequal(git_refspec_src(_refspec), "refs/*");
+ cl_assert_strequal(git_refspec_dst(_refspec), "refs/*");
}
void test_network_remotes__save(void)
@@ -90,13 +90,13 @@ void test_network_remotes__save(void)
_refspec = git_remote_fetchspec(_remote);
cl_assert(_refspec != NULL);
- cl_assert(!strcmp(git_refspec_src(_refspec), "refs/heads/*"));
- cl_assert(!strcmp(git_refspec_dst(_refspec), "refs/remotes/upstream/*"));
+ cl_assert_strequal(git_refspec_src(_refspec), "refs/heads/*");
+ cl_assert_strequal(git_refspec_dst(_refspec), "refs/remotes/upstream/*");
_refspec = git_remote_pushspec(_remote);
cl_assert(_refspec != NULL);
- cl_assert(!strcmp(git_refspec_src(_refspec), "refs/heads/*"));
- cl_assert(!strcmp(git_refspec_dst(_refspec), "refs/heads/*"));
+ cl_assert_strequal(git_refspec_src(_refspec), "refs/heads/*");
+ cl_assert_strequal(git_refspec_dst(_refspec), "refs/heads/*");
}
void test_network_remotes__fnmatch(void)
@@ -111,7 +111,7 @@ void test_network_remotes__transform(void)
memset(ref, 0x0, sizeof(ref));
cl_git_pass(git_refspec_transform(ref, sizeof(ref), _refspec, "refs/heads/master"));
- cl_assert(!strcmp(ref, "refs/remotes/test/master"));
+ cl_assert_strequal(ref, "refs/remotes/test/master");
}
void test_network_remotes__transform_r(void)
@@ -119,7 +119,7 @@ void test_network_remotes__transform_r(void)
git_buf buf = GIT_BUF_INIT;
cl_git_pass(git_refspec_transform_r(&buf, _refspec, "refs/heads/master"));
- cl_assert(!strcmp(git_buf_cstr(&buf), "refs/remotes/test/master"));
+ cl_assert_strequal(git_buf_cstr(&buf), "refs/remotes/test/master");
git_buf_free(&buf);
}
diff --git a/tests-clar/notes/notes.c b/tests-clar/notes/notes.c
index 0e9a165..bb5a85d 100644
--- a/tests-clar/notes/notes.c
+++ b/tests-clar/notes/notes.c
@@ -33,11 +33,11 @@ void test_notes_notes__1(void)
cl_git_pass(git_note_read(&_note, _repo, NULL, &oid));
- cl_assert(!strcmp(git_note_message(_note), "hello world\n"));
+ cl_assert_strequal(git_note_message(_note), "hello world\n");
cl_assert(!git_oid_cmp(git_note_oid(_note), ¬e_oid));
cl_git_pass(git_blob_lookup(&_blob, _repo, ¬e_oid));
- cl_assert(!strcmp(git_note_message(_note), git_blob_rawcontent(_blob)));
+ cl_assert_strequal(git_note_message(_note), git_blob_rawcontent(_blob));
cl_git_fail(git_note_create(¬e_oid, _repo, _sig, _sig, NULL, &oid, "hello world\n"));
cl_git_fail(git_note_create(¬e_oid, _repo, _sig, _sig, "refs/notes/some/namespace", &oid, "hello world\n"));
diff --git a/tests-clar/object/raw/compare.c b/tests-clar/object/raw/compare.c
index 22f9580..6dc6d71 100644
--- a/tests-clar/object/raw/compare.c
+++ b/tests-clar/object/raw/compare.c
@@ -87,7 +87,7 @@ void test_object_raw_compare__compare_fmt_oids(void)
/* Format produced the right result */
out[GIT_OID_HEXSZ] = '\0';
- cl_assert(strcmp(exp, out) == 0);
+ cl_assert_strequal(exp, out);
}
void test_object_raw_compare__compare_allocfmt_oids(void)
@@ -100,7 +100,7 @@ void test_object_raw_compare__compare_allocfmt_oids(void)
out = git_oid_allocfmt(&in);
cl_assert(out);
- cl_assert(strcmp(exp, out) == 0);
+ cl_assert_strequal(exp, out);
git__free(out);
}
@@ -120,5 +120,5 @@ void test_object_raw_compare__compare_pathfmt_oids(void)
/* Format produced the right result */
out[GIT_OID_HEXSZ + 1] = '\0';
- cl_assert(strcmp(exp2, out) == 0);
+ cl_assert_strequal(exp2, out);
}
diff --git a/tests-clar/object/raw/convert.c b/tests-clar/object/raw/convert.c
index b5b879e..4e7aecf 100644
--- a/tests-clar/object/raw/convert.c
+++ b/tests-clar/object/raw/convert.c
@@ -45,7 +45,7 @@ void test_object_raw_convert__succeed_on_oid_to_string_conversion(void)
/* returns out as hex formatted c-string */
str = git_oid_tostr(out, sizeof(out), &in);
cl_assert(str && str == out && *(str+GIT_OID_HEXSZ) == '\0');
- cl_assert(strcmp(exp, out) == 0);
+ cl_assert_strequal(exp, out);
}
void test_object_raw_convert__succeed_on_oid_to_string_conversion_big(void)
@@ -66,7 +66,7 @@ void test_object_raw_convert__succeed_on_oid_to_string_conversion_big(void)
/* returns big as hex formatted c-string */
str = git_oid_tostr(big, sizeof(big), &in);
cl_assert(str && str == big && *(str+GIT_OID_HEXSZ) == '\0');
- cl_assert(strcmp(exp, big) == 0);
+ cl_assert_strequal(exp, big);
/* check tail material is untouched */
cl_assert(str && str == big && *(str+GIT_OID_HEXSZ+1) == 'X');
diff --git a/tests-clar/object/raw/hash.c b/tests-clar/object/raw/hash.c
index 2375851..4b8b1b7 100644
--- a/tests-clar/object/raw/hash.c
+++ b/tests-clar/object/raw/hash.c
@@ -6,9 +6,13 @@
#include "data.h"
-static int hash_object(git_oid *oid, git_rawobj *obj)
+static void hash_object_pass(git_oid *oid, git_rawobj *obj)
{
- return git_odb_hash(oid, obj->data, obj->len, obj->type);
+ cl_git_pass(git_odb_hash(oid, obj->data, obj->len, obj->type));
+}
+static void hash_object_fail(git_oid *oid, git_rawobj *obj)
+{
+ cl_git_fail(git_odb_hash(oid, obj->data, obj->len, obj->type));
}
static char *hello_id = "22596363b3de40b06f981fb85d82312e8c0ed511";
@@ -74,28 +78,28 @@ void test_object_raw_hash__hash_junk_data(void)
/* invalid types: */
junk_obj.data = some_data;
- cl_git_fail(hash_object(&id, &junk_obj));
+ hash_object_fail(&id, &junk_obj);
junk_obj.type = GIT_OBJ__EXT1;
- cl_git_fail(hash_object(&id, &junk_obj));
+ hash_object_fail(&id, &junk_obj);
junk_obj.type = GIT_OBJ__EXT2;
- cl_git_fail(hash_object(&id, &junk_obj));
+ hash_object_fail(&id, &junk_obj);
junk_obj.type = GIT_OBJ_OFS_DELTA;
- cl_git_fail(hash_object(&id, &junk_obj));
+ hash_object_fail(&id, &junk_obj);
junk_obj.type = GIT_OBJ_REF_DELTA;
- cl_git_fail(hash_object(&id, &junk_obj));
+ hash_object_fail(&id, &junk_obj);
/* data can be NULL only if len is zero: */
junk_obj.type = GIT_OBJ_BLOB;
junk_obj.data = NULL;
- cl_git_pass(hash_object(&id, &junk_obj));
+ hash_object_pass(&id, &junk_obj);
cl_assert(git_oid_cmp(&id, &id_zero) == 0);
junk_obj.len = 1;
- cl_git_fail(hash_object(&id, &junk_obj));
+ hash_object_fail(&id, &junk_obj);
}
void test_object_raw_hash__hash_commit_object(void)
@@ -103,7 +107,7 @@ void test_object_raw_hash__hash_commit_object(void)
git_oid id1, id2;
cl_git_pass(git_oid_fromstr(&id1, commit_id));
- cl_git_pass(hash_object(&id2, &commit_obj));
+ hash_object_pass(&id2, &commit_obj);
cl_assert(git_oid_cmp(&id1, &id2) == 0);
}
@@ -112,7 +116,7 @@ void test_object_raw_hash__hash_tree_object(void)
git_oid id1, id2;
cl_git_pass(git_oid_fromstr(&id1, tree_id));
- cl_git_pass(hash_object(&id2, &tree_obj));
+ hash_object_pass(&id2, &tree_obj);
cl_assert(git_oid_cmp(&id1, &id2) == 0);
}
@@ -121,7 +125,7 @@ void test_object_raw_hash__hash_tag_object(void)
git_oid id1, id2;
cl_git_pass(git_oid_fromstr(&id1, tag_id));
- cl_git_pass(hash_object(&id2, &tag_obj));
+ hash_object_pass(&id2, &tag_obj);
cl_assert(git_oid_cmp(&id1, &id2) == 0);
}
@@ -130,7 +134,7 @@ void test_object_raw_hash__hash_zero_length_object(void)
git_oid id1, id2;
cl_git_pass(git_oid_fromstr(&id1, zero_id));
- cl_git_pass(hash_object(&id2, &zero_obj));
+ hash_object_pass(&id2, &zero_obj);
cl_assert(git_oid_cmp(&id1, &id2) == 0);
}
@@ -139,7 +143,7 @@ void test_object_raw_hash__hash_one_byte_object(void)
git_oid id1, id2;
cl_git_pass(git_oid_fromstr(&id1, one_id));
- cl_git_pass(hash_object(&id2, &one_obj));
+ hash_object_pass(&id2, &one_obj);
cl_assert(git_oid_cmp(&id1, &id2) == 0);
}
@@ -148,7 +152,7 @@ void test_object_raw_hash__hash_two_byte_object(void)
git_oid id1, id2;
cl_git_pass(git_oid_fromstr(&id1, two_id));
- cl_git_pass(hash_object(&id2, &two_obj));
+ hash_object_pass(&id2, &two_obj);
cl_assert(git_oid_cmp(&id1, &id2) == 0);
}
@@ -157,6 +161,6 @@ void test_object_raw_hash__hash_multi_byte_object(void)
git_oid id1, id2;
cl_git_pass(git_oid_fromstr(&id1, some_id));
- cl_git_pass(hash_object(&id2, &some_obj));
+ hash_object_pass(&id2, &some_obj);
cl_assert(git_oid_cmp(&id1, &id2) == 0);
}
diff --git a/tests-clar/object/raw/type2string.c b/tests-clar/object/raw/type2string.c
index 24ed1c4..2092d2c 100644
--- a/tests-clar/object/raw/type2string.c
+++ b/tests-clar/object/raw/type2string.c
@@ -6,19 +6,19 @@
void test_object_raw_type2string__convert_type_to_string(void)
{
- cl_assert(!strcmp(git_object_type2string(GIT_OBJ_BAD), ""));
- cl_assert(!strcmp(git_object_type2string(GIT_OBJ__EXT1), ""));
- cl_assert(!strcmp(git_object_type2string(GIT_OBJ_COMMIT), "commit"));
- cl_assert(!strcmp(git_object_type2string(GIT_OBJ_TREE), "tree"));
- cl_assert(!strcmp(git_object_type2string(GIT_OBJ_BLOB), "blob"));
- cl_assert(!strcmp(git_object_type2string(GIT_OBJ_TAG), "tag"));
- cl_assert(!strcmp(git_object_type2string(GIT_OBJ__EXT2), ""));
- cl_assert(!strcmp(git_object_type2string(GIT_OBJ_OFS_DELTA), "OFS_DELTA"));
- cl_assert(!strcmp(git_object_type2string(GIT_OBJ_REF_DELTA), "REF_DELTA"));
-
- cl_assert(!strcmp(git_object_type2string(-2), ""));
- cl_assert(!strcmp(git_object_type2string(8), ""));
- cl_assert(!strcmp(git_object_type2string(1234), ""));
+ cl_assert_strequal(git_object_type2string(GIT_OBJ_BAD), "");
+ cl_assert_strequal(git_object_type2string(GIT_OBJ__EXT1), "");
+ cl_assert_strequal(git_object_type2string(GIT_OBJ_COMMIT), "commit");
+ cl_assert_strequal(git_object_type2string(GIT_OBJ_TREE), "tree");
+ cl_assert_strequal(git_object_type2string(GIT_OBJ_BLOB), "blob");
+ cl_assert_strequal(git_object_type2string(GIT_OBJ_TAG), "tag");
+ cl_assert_strequal(git_object_type2string(GIT_OBJ__EXT2), "");
+ cl_assert_strequal(git_object_type2string(GIT_OBJ_OFS_DELTA), "OFS_DELTA");
+ cl_assert_strequal(git_object_type2string(GIT_OBJ_REF_DELTA), "REF_DELTA");
+
+ cl_assert_strequal(git_object_type2string(-2), "");
+ cl_assert_strequal(git_object_type2string(8), "");
+ cl_assert_strequal(git_object_type2string(1234), "");
}
void test_object_raw_type2string__convert_string_to_type(void)
diff --git a/tests-clar/object/raw/write.c b/tests-clar/object/raw/write.c
new file mode 100644
index 0000000..885d336
--- /dev/null
+++ b/tests-clar/object/raw/write.c
@@ -0,0 +1,455 @@
+
+#include "clar_libgit2.h"
+#include "fileops.h"
+#include "odb.h"
+
+typedef struct object_data {
+ char *id; /* object id (sha1) */
+ char *dir; /* object store (fan-out) directory name */
+ char *file; /* object store filename */
+} object_data;
+
+static const char *odb_dir = "test-objects";
+
+void test_body(object_data *d, git_rawobj *o);
+
+
+
+// Helpers
+static void remove_object_files(object_data *d)
+{
+ cl_git_pass(p_unlink(d->file));
+ cl_git_pass(p_rmdir(d->dir));
+ cl_assert(errno != ENOTEMPTY);
+ cl_git_pass(p_rmdir(odb_dir) < 0);
+}
+
+static void streaming_write(git_oid *oid, git_odb *odb, git_rawobj *raw)
+{
+ git_odb_stream *stream;
+ int error;
+
+ cl_git_pass(git_odb_open_wstream(&stream, odb, raw->len, raw->type));
+ stream->write(stream, raw->data, raw->len);
+ error = stream->finalize_write(oid, stream);
+ stream->free(stream);
+ cl_git_pass(error);
+}
+
+static void check_object_files(object_data *d)
+{
+ cl_git_pass(git_path_exists(d->dir));
+ cl_git_pass(git_path_exists(d->file));
+}
+
+static void cmp_objects(git_rawobj *o1, git_rawobj *o2)
+{
+ cl_assert(o1->type == o2->type);
+ cl_assert(o1->len == o2->len);
+ if (o1->len > 0)
+ cl_assert(memcmp(o1->data, o2->data, o1->len) == 0);
+}
+
+static void make_odb_dir(void)
+{
+ cl_git_pass(p_mkdir(odb_dir, GIT_OBJECT_DIR_MODE));
+}
+
+
+// Standard test form
+void test_body(object_data *d, git_rawobj *o)
+{
+ git_odb *db;
+ git_oid id1, id2;
+ git_odb_object *obj;
+
+ make_odb_dir();
+ cl_git_pass(git_odb_open(&db, odb_dir));
+ cl_git_pass(git_oid_fromstr(&id1, d->id));
+
+ streaming_write(&id2, db, o);
+ cl_assert(git_oid_cmp(&id1, &id2) == 0);
+ check_object_files(d);
+
+ cl_git_pass(git_odb_read(&obj, db, &id1));
+ cmp_objects(&obj->raw, o);
+
+ git_odb_object_free(obj);
+ git_odb_free(db);
+ remove_object_files(d);
+}
+
+
+void test_object_raw_write__loose_object(void)
+{
+ object_data commit = {
+ "3d7f8a6af076c8c3f20071a8935cdbe8228594d1",
+ "test-objects/3d",
+ "test-objects/3d/7f8a6af076c8c3f20071a8935cdbe8228594d1",
+ };
+
+ unsigned char commit_data[] = {
+ 0x74, 0x72, 0x65, 0x65, 0x20, 0x64, 0x66, 0x66,
+ 0x32, 0x64, 0x61, 0x39, 0x30, 0x62, 0x32, 0x35,
+ 0x34, 0x65, 0x31, 0x62, 0x65, 0x62, 0x38, 0x38,
+ 0x39, 0x64, 0x31, 0x66, 0x31, 0x66, 0x31, 0x32,
+ 0x38, 0x38, 0x62, 0x65, 0x31, 0x38, 0x30, 0x33,
+ 0x37, 0x38, 0x32, 0x64, 0x66, 0x0a, 0x61, 0x75,
+ 0x74, 0x68, 0x6f, 0x72, 0x20, 0x41, 0x20, 0x55,
+ 0x20, 0x54, 0x68, 0x6f, 0x72, 0x20, 0x3c, 0x61,
+ 0x75, 0x74, 0x68, 0x6f, 0x72, 0x40, 0x65, 0x78,
+ 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2e, 0x63, 0x6f,
+ 0x6d, 0x3e, 0x20, 0x31, 0x32, 0x32, 0x37, 0x38,
+ 0x31, 0x34, 0x32, 0x39, 0x37, 0x20, 0x2b, 0x30,
+ 0x30, 0x30, 0x30, 0x0a, 0x63, 0x6f, 0x6d, 0x6d,
+ 0x69, 0x74, 0x74, 0x65, 0x72, 0x20, 0x43, 0x20,
+ 0x4f, 0x20, 0x4d, 0x69, 0x74, 0x74, 0x65, 0x72,
+ 0x20, 0x3c, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74,
+ 0x74, 0x65, 0x72, 0x40, 0x65, 0x78, 0x61, 0x6d,
+ 0x70, 0x6c, 0x65, 0x2e, 0x63, 0x6f, 0x6d, 0x3e,
+ 0x20, 0x31, 0x32, 0x32, 0x37, 0x38, 0x31, 0x34,
+ 0x32, 0x39, 0x37, 0x20, 0x2b, 0x30, 0x30, 0x30,
+ 0x30, 0x0a, 0x0a, 0x41, 0x20, 0x6f, 0x6e, 0x65,
+ 0x2d, 0x6c, 0x69, 0x6e, 0x65, 0x20, 0x63, 0x6f,
+ 0x6d, 0x6d, 0x69, 0x74, 0x20, 0x73, 0x75, 0x6d,
+ 0x6d, 0x61, 0x72, 0x79, 0x0a, 0x0a, 0x54, 0x68,
+ 0x65, 0x20, 0x62, 0x6f, 0x64, 0x79, 0x20, 0x6f,
+ 0x66, 0x20, 0x74, 0x68, 0x65, 0x20, 0x63, 0x6f,
+ 0x6d, 0x6d, 0x69, 0x74, 0x20, 0x6d, 0x65, 0x73,
+ 0x73, 0x61, 0x67, 0x65, 0x2c, 0x20, 0x63, 0x6f,
+ 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x69, 0x6e, 0x67,
+ 0x20, 0x66, 0x75, 0x72, 0x74, 0x68, 0x65, 0x72,
+ 0x20, 0x65, 0x78, 0x70, 0x6c, 0x61, 0x6e, 0x61,
+ 0x74, 0x69, 0x6f, 0x6e, 0x0a, 0x6f, 0x66, 0x20,
+ 0x74, 0x68, 0x65, 0x20, 0x70, 0x75, 0x72, 0x70,
+ 0x6f, 0x73, 0x65, 0x20, 0x6f, 0x66, 0x20, 0x74,
+ 0x68, 0x65, 0x20, 0x63, 0x68, 0x61, 0x6e, 0x67,
+ 0x65, 0x73, 0x20, 0x69, 0x6e, 0x74, 0x72, 0x6f,
+ 0x64, 0x75, 0x63, 0x65, 0x64, 0x20, 0x62, 0x79,
+ 0x20, 0x74, 0x68, 0x65, 0x20, 0x63, 0x6f, 0x6d,
+ 0x6d, 0x69, 0x74, 0x2e, 0x0a, 0x0a, 0x53, 0x69,
+ 0x67, 0x6e, 0x65, 0x64, 0x2d, 0x6f, 0x66, 0x2d,
+ 0x62, 0x79, 0x3a, 0x20, 0x41, 0x20, 0x55, 0x20,
+ 0x54, 0x68, 0x6f, 0x72, 0x20, 0x3c, 0x61, 0x75,
+ 0x74, 0x68, 0x6f, 0x72, 0x40, 0x65, 0x78, 0x61,
+ 0x6d, 0x70, 0x6c, 0x65, 0x2e, 0x63, 0x6f, 0x6d,
+ 0x3e, 0x0a,
+ };
+
+ git_rawobj commit_obj = {
+ commit_data,
+ sizeof(commit_data),
+ GIT_OBJ_COMMIT
+ };
+
+ test_body(&commit, &commit_obj);
+}
+
+void test_object_raw_write__loose_tree(void)
+{
+ static object_data tree = {
+ "dff2da90b254e1beb889d1f1f1288be1803782df",
+ "test-objects/df",
+ "test-objects/df/f2da90b254e1beb889d1f1f1288be1803782df",
+ };
+
+ static unsigned char tree_data[] = {
+ 0x31, 0x30, 0x30, 0x36, 0x34, 0x34, 0x20, 0x6f,
+ 0x6e, 0x65, 0x00, 0x8b, 0x13, 0x78, 0x91, 0x79,
+ 0x1f, 0xe9, 0x69, 0x27, 0xad, 0x78, 0xe6, 0x4b,
+ 0x0a, 0xad, 0x7b, 0xde, 0xd0, 0x8b, 0xdc, 0x31,
+ 0x30, 0x30, 0x36, 0x34, 0x34, 0x20, 0x73, 0x6f,
+ 0x6d, 0x65, 0x00, 0xfd, 0x84, 0x30, 0xbc, 0x86,
+ 0x4c, 0xfc, 0xd5, 0xf1, 0x0e, 0x55, 0x90, 0xf8,
+ 0xa4, 0x47, 0xe0, 0x1b, 0x94, 0x2b, 0xfe, 0x31,
+ 0x30, 0x30, 0x36, 0x34, 0x34, 0x20, 0x74, 0x77,
+ 0x6f, 0x00, 0x78, 0x98, 0x19, 0x22, 0x61, 0x3b,
+ 0x2a, 0xfb, 0x60, 0x25, 0x04, 0x2f, 0xf6, 0xbd,
+ 0x87, 0x8a, 0xc1, 0x99, 0x4e, 0x85, 0x31, 0x30,
+ 0x30, 0x36, 0x34, 0x34, 0x20, 0x7a, 0x65, 0x72,
+ 0x6f, 0x00, 0xe6, 0x9d, 0xe2, 0x9b, 0xb2, 0xd1,
+ 0xd6, 0x43, 0x4b, 0x8b, 0x29, 0xae, 0x77, 0x5a,
+ 0xd8, 0xc2, 0xe4, 0x8c, 0x53, 0x91,
+ };
+
+ static git_rawobj tree_obj = {
+ tree_data,
+ sizeof(tree_data),
+ GIT_OBJ_TREE
+ };
+
+ test_body(&tree, &tree_obj);
+}
+
+void test_object_raw_write__loose_tag(void)
+{
+ static object_data tag = {
+ "09d373e1dfdc16b129ceec6dd649739911541e05",
+ "test-objects/09",
+ "test-objects/09/d373e1dfdc16b129ceec6dd649739911541e05",
+ };
+
+ static unsigned char tag_data[] = {
+ 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x20, 0x33,
+ 0x64, 0x37, 0x66, 0x38, 0x61, 0x36, 0x61, 0x66,
+ 0x30, 0x37, 0x36, 0x63, 0x38, 0x63, 0x33, 0x66,
+ 0x32, 0x30, 0x30, 0x37, 0x31, 0x61, 0x38, 0x39,
+ 0x33, 0x35, 0x63, 0x64, 0x62, 0x65, 0x38, 0x32,
+ 0x32, 0x38, 0x35, 0x39, 0x34, 0x64, 0x31, 0x0a,
+ 0x74, 0x79, 0x70, 0x65, 0x20, 0x63, 0x6f, 0x6d,
+ 0x6d, 0x69, 0x74, 0x0a, 0x74, 0x61, 0x67, 0x20,
+ 0x76, 0x30, 0x2e, 0x30, 0x2e, 0x31, 0x0a, 0x74,
+ 0x61, 0x67, 0x67, 0x65, 0x72, 0x20, 0x43, 0x20,
+ 0x4f, 0x20, 0x4d, 0x69, 0x74, 0x74, 0x65, 0x72,
+ 0x20, 0x3c, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74,
+ 0x74, 0x65, 0x72, 0x40, 0x65, 0x78, 0x61, 0x6d,
+ 0x70, 0x6c, 0x65, 0x2e, 0x63, 0x6f, 0x6d, 0x3e,
+ 0x20, 0x31, 0x32, 0x32, 0x37, 0x38, 0x31, 0x34,
+ 0x32, 0x39, 0x37, 0x20, 0x2b, 0x30, 0x30, 0x30,
+ 0x30, 0x0a, 0x0a, 0x54, 0x68, 0x69, 0x73, 0x20,
+ 0x69, 0x73, 0x20, 0x74, 0x68, 0x65, 0x20, 0x74,
+ 0x61, 0x67, 0x20, 0x6f, 0x62, 0x6a, 0x65, 0x63,
+ 0x74, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x72, 0x65,
+ 0x6c, 0x65, 0x61, 0x73, 0x65, 0x20, 0x76, 0x30,
+ 0x2e, 0x30, 0x2e, 0x31, 0x0a,
+ };
+
+ static git_rawobj tag_obj = {
+ tag_data,
+ sizeof(tag_data),
+ GIT_OBJ_TAG
+ };
+
+
+ test_body(&tag, &tag_obj);
+}
+
+void test_object_raw_write__zero_length(void)
+{
+ static object_data zero = {
+ "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391",
+ "test-objects/e6",
+ "test-objects/e6/9de29bb2d1d6434b8b29ae775ad8c2e48c5391",
+ };
+
+ static unsigned char zero_data[] = {
+ 0x00 /* dummy data */
+ };
+
+ static git_rawobj zero_obj = {
+ zero_data,
+ 0,
+ GIT_OBJ_BLOB
+ };
+
+ test_body(&zero, &zero_obj);
+}
+
+void test_object_raw_write__one_byte(void)
+{
+ static object_data one = {
+ "8b137891791fe96927ad78e64b0aad7bded08bdc",
+ "test-objects/8b",
+ "test-objects/8b/137891791fe96927ad78e64b0aad7bded08bdc",
+ };
+
+ static unsigned char one_data[] = {
+ 0x0a,
+ };
+
+ static git_rawobj one_obj = {
+ one_data,
+ sizeof(one_data),
+ GIT_OBJ_BLOB
+ };
+
+ test_body(&one, &one_obj);
+}
+
+void test_object_raw_write__two_byte(void)
+{
+ static object_data two = {
+ "78981922613b2afb6025042ff6bd878ac1994e85",
+ "test-objects/78",
+ "test-objects/78/981922613b2afb6025042ff6bd878ac1994e85",
+ };
+
+ static unsigned char two_data[] = {
+ 0x61, 0x0a,
+ };
+
+ static git_rawobj two_obj = {
+ two_data,
+ sizeof(two_data),
+ GIT_OBJ_BLOB
+ };
+
+ test_body(&two, &two_obj);
+}
+
+void test_object_raw_write__several_bytes(void)
+{
+ static object_data some = {
+ "fd8430bc864cfcd5f10e5590f8a447e01b942bfe",
+ "test-objects/fd",
+ "test-objects/fd/8430bc864cfcd5f10e5590f8a447e01b942bfe",
+ };
+
+ static unsigned char some_data[] = {
+ 0x2f, 0x2a, 0x0a, 0x20, 0x2a, 0x20, 0x54, 0x68,
+ 0x69, 0x73, 0x20, 0x66, 0x69, 0x6c, 0x65, 0x20,
+ 0x69, 0x73, 0x20, 0x66, 0x72, 0x65, 0x65, 0x20,
+ 0x73, 0x6f, 0x66, 0x74, 0x77, 0x61, 0x72, 0x65,
+ 0x3b, 0x20, 0x79, 0x6f, 0x75, 0x20, 0x63, 0x61,
+ 0x6e, 0x20, 0x72, 0x65, 0x64, 0x69, 0x73, 0x74,
+ 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x20, 0x69,
+ 0x74, 0x20, 0x61, 0x6e, 0x64, 0x2f, 0x6f, 0x72,
+ 0x20, 0x6d, 0x6f, 0x64, 0x69, 0x66, 0x79, 0x0a,
+ 0x20, 0x2a, 0x20, 0x69, 0x74, 0x20, 0x75, 0x6e,
+ 0x64, 0x65, 0x72, 0x20, 0x74, 0x68, 0x65, 0x20,
+ 0x74, 0x65, 0x72, 0x6d, 0x73, 0x20, 0x6f, 0x66,
+ 0x20, 0x74, 0x68, 0x65, 0x20, 0x47, 0x4e, 0x55,
+ 0x20, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x6c,
+ 0x20, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x20,
+ 0x4c, 0x69, 0x63, 0x65, 0x6e, 0x73, 0x65, 0x2c,
+ 0x20, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e,
+ 0x20, 0x32, 0x2c, 0x0a, 0x20, 0x2a, 0x20, 0x61,
+ 0x73, 0x20, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x73,
+ 0x68, 0x65, 0x64, 0x20, 0x62, 0x79, 0x20, 0x74,
+ 0x68, 0x65, 0x20, 0x46, 0x72, 0x65, 0x65, 0x20,
+ 0x53, 0x6f, 0x66, 0x74, 0x77, 0x61, 0x72, 0x65,
+ 0x20, 0x46, 0x6f, 0x75, 0x6e, 0x64, 0x61, 0x74,
+ 0x69, 0x6f, 0x6e, 0x2e, 0x0a, 0x20, 0x2a, 0x0a,
+ 0x20, 0x2a, 0x20, 0x49, 0x6e, 0x20, 0x61, 0x64,
+ 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x74,
+ 0x6f, 0x20, 0x74, 0x68, 0x65, 0x20, 0x70, 0x65,
+ 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e,
+ 0x73, 0x20, 0x69, 0x6e, 0x20, 0x74, 0x68, 0x65,
+ 0x20, 0x47, 0x4e, 0x55, 0x20, 0x47, 0x65, 0x6e,
+ 0x65, 0x72, 0x61, 0x6c, 0x20, 0x50, 0x75, 0x62,
+ 0x6c, 0x69, 0x63, 0x20, 0x4c, 0x69, 0x63, 0x65,
+ 0x6e, 0x73, 0x65, 0x2c, 0x0a, 0x20, 0x2a, 0x20,
+ 0x74, 0x68, 0x65, 0x20, 0x61, 0x75, 0x74, 0x68,
+ 0x6f, 0x72, 0x73, 0x20, 0x67, 0x69, 0x76, 0x65,
+ 0x20, 0x79, 0x6f, 0x75, 0x20, 0x75, 0x6e, 0x6c,
+ 0x69, 0x6d, 0x69, 0x74, 0x65, 0x64, 0x20, 0x70,
+ 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f,
+ 0x6e, 0x20, 0x74, 0x6f, 0x20, 0x6c, 0x69, 0x6e,
+ 0x6b, 0x20, 0x74, 0x68, 0x65, 0x20, 0x63, 0x6f,
+ 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x64, 0x0a, 0x20,
+ 0x2a, 0x20, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f,
+ 0x6e, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, 0x69,
+ 0x73, 0x20, 0x66, 0x69, 0x6c, 0x65, 0x20, 0x69,
+ 0x6e, 0x74, 0x6f, 0x20, 0x63, 0x6f, 0x6d, 0x62,
+ 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73,
+ 0x20, 0x77, 0x69, 0x74, 0x68, 0x20, 0x6f, 0x74,
+ 0x68, 0x65, 0x72, 0x20, 0x70, 0x72, 0x6f, 0x67,
+ 0x72, 0x61, 0x6d, 0x73, 0x2c, 0x0a, 0x20, 0x2a,
+ 0x20, 0x61, 0x6e, 0x64, 0x20, 0x74, 0x6f, 0x20,
+ 0x64, 0x69, 0x73, 0x74, 0x72, 0x69, 0x62, 0x75,
+ 0x74, 0x65, 0x20, 0x74, 0x68, 0x6f, 0x73, 0x65,
+ 0x20, 0x63, 0x6f, 0x6d, 0x62, 0x69, 0x6e, 0x61,
+ 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x77, 0x69,
+ 0x74, 0x68, 0x6f, 0x75, 0x74, 0x20, 0x61, 0x6e,
+ 0x79, 0x20, 0x72, 0x65, 0x73, 0x74, 0x72, 0x69,
+ 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x0a, 0x20, 0x2a,
+ 0x20, 0x63, 0x6f, 0x6d, 0x69, 0x6e, 0x67, 0x20,
+ 0x66, 0x72, 0x6f, 0x6d, 0x20, 0x74, 0x68, 0x65,
+ 0x20, 0x75, 0x73, 0x65, 0x20, 0x6f, 0x66, 0x20,
+ 0x74, 0x68, 0x69, 0x73, 0x20, 0x66, 0x69, 0x6c,
+ 0x65, 0x2e, 0x20, 0x20, 0x28, 0x54, 0x68, 0x65,
+ 0x20, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x6c,
+ 0x20, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x20,
+ 0x4c, 0x69, 0x63, 0x65, 0x6e, 0x73, 0x65, 0x0a,
+ 0x20, 0x2a, 0x20, 0x72, 0x65, 0x73, 0x74, 0x72,
+ 0x69, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20,
+ 0x64, 0x6f, 0x20, 0x61, 0x70, 0x70, 0x6c, 0x79,
+ 0x20, 0x69, 0x6e, 0x20, 0x6f, 0x74, 0x68, 0x65,
+ 0x72, 0x20, 0x72, 0x65, 0x73, 0x70, 0x65, 0x63,
+ 0x74, 0x73, 0x3b, 0x20, 0x66, 0x6f, 0x72, 0x20,
+ 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2c,
+ 0x20, 0x74, 0x68, 0x65, 0x79, 0x20, 0x63, 0x6f,
+ 0x76, 0x65, 0x72, 0x0a, 0x20, 0x2a, 0x20, 0x6d,
+ 0x6f, 0x64, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74,
+ 0x69, 0x6f, 0x6e, 0x20, 0x6f, 0x66, 0x20, 0x74,
+ 0x68, 0x65, 0x20, 0x66, 0x69, 0x6c, 0x65, 0x2c,
+ 0x20, 0x61, 0x6e, 0x64, 0x20, 0x64, 0x69, 0x73,
+ 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x69, 0x6f,
+ 0x6e, 0x20, 0x77, 0x68, 0x65, 0x6e, 0x20, 0x6e,
+ 0x6f, 0x74, 0x20, 0x6c, 0x69, 0x6e, 0x6b, 0x65,
+ 0x64, 0x20, 0x69, 0x6e, 0x74, 0x6f, 0x0a, 0x20,
+ 0x2a, 0x20, 0x61, 0x20, 0x63, 0x6f, 0x6d, 0x62,
+ 0x69, 0x6e, 0x65, 0x64, 0x20, 0x65, 0x78, 0x65,
+ 0x63, 0x75, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x2e,
+ 0x29, 0x0a, 0x20, 0x2a, 0x0a, 0x20, 0x2a, 0x20,
+ 0x54, 0x68, 0x69, 0x73, 0x20, 0x66, 0x69, 0x6c,
+ 0x65, 0x20, 0x69, 0x73, 0x20, 0x64, 0x69, 0x73,
+ 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x64,
+ 0x20, 0x69, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20,
+ 0x68, 0x6f, 0x70, 0x65, 0x20, 0x74, 0x68, 0x61,
+ 0x74, 0x20, 0x69, 0x74, 0x20, 0x77, 0x69, 0x6c,
+ 0x6c, 0x20, 0x62, 0x65, 0x20, 0x75, 0x73, 0x65,
+ 0x66, 0x75, 0x6c, 0x2c, 0x20, 0x62, 0x75, 0x74,
+ 0x0a, 0x20, 0x2a, 0x20, 0x57, 0x49, 0x54, 0x48,
+ 0x4f, 0x55, 0x54, 0x20, 0x41, 0x4e, 0x59, 0x20,
+ 0x57, 0x41, 0x52, 0x52, 0x41, 0x4e, 0x54, 0x59,
+ 0x3b, 0x20, 0x77, 0x69, 0x74, 0x68, 0x6f, 0x75,
+ 0x74, 0x20, 0x65, 0x76, 0x65, 0x6e, 0x20, 0x74,
+ 0x68, 0x65, 0x20, 0x69, 0x6d, 0x70, 0x6c, 0x69,
+ 0x65, 0x64, 0x20, 0x77, 0x61, 0x72, 0x72, 0x61,
+ 0x6e, 0x74, 0x79, 0x20, 0x6f, 0x66, 0x0a, 0x20,
+ 0x2a, 0x20, 0x4d, 0x45, 0x52, 0x43, 0x48, 0x41,
+ 0x4e, 0x54, 0x41, 0x42, 0x49, 0x4c, 0x49, 0x54,
+ 0x59, 0x20, 0x6f, 0x72, 0x20, 0x46, 0x49, 0x54,
+ 0x4e, 0x45, 0x53, 0x53, 0x20, 0x46, 0x4f, 0x52,
+ 0x20, 0x41, 0x20, 0x50, 0x41, 0x52, 0x54, 0x49,
+ 0x43, 0x55, 0x4c, 0x41, 0x52, 0x20, 0x50, 0x55,
+ 0x52, 0x50, 0x4f, 0x53, 0x45, 0x2e, 0x20, 0x20,
+ 0x53, 0x65, 0x65, 0x20, 0x74, 0x68, 0x65, 0x20,
+ 0x47, 0x4e, 0x55, 0x0a, 0x20, 0x2a, 0x20, 0x47,
+ 0x65, 0x6e, 0x65, 0x72, 0x61, 0x6c, 0x20, 0x50,
+ 0x75, 0x62, 0x6c, 0x69, 0x63, 0x20, 0x4c, 0x69,
+ 0x63, 0x65, 0x6e, 0x73, 0x65, 0x20, 0x66, 0x6f,
+ 0x72, 0x20, 0x6d, 0x6f, 0x72, 0x65, 0x20, 0x64,
+ 0x65, 0x74, 0x61, 0x69, 0x6c, 0x73, 0x2e, 0x0a,
+ 0x20, 0x2a, 0x0a, 0x20, 0x2a, 0x20, 0x59, 0x6f,
+ 0x75, 0x20, 0x73, 0x68, 0x6f, 0x75, 0x6c, 0x64,
+ 0x20, 0x68, 0x61, 0x76, 0x65, 0x20, 0x72, 0x65,
+ 0x63, 0x65, 0x69, 0x76, 0x65, 0x64, 0x20, 0x61,
+ 0x20, 0x63, 0x6f, 0x70, 0x79, 0x20, 0x6f, 0x66,
+ 0x20, 0x74, 0x68, 0x65, 0x20, 0x47, 0x4e, 0x55,
+ 0x20, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x6c,
+ 0x20, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x20,
+ 0x4c, 0x69, 0x63, 0x65, 0x6e, 0x73, 0x65, 0x0a,
+ 0x20, 0x2a, 0x20, 0x61, 0x6c, 0x6f, 0x6e, 0x67,
+ 0x20, 0x77, 0x69, 0x74, 0x68, 0x20, 0x74, 0x68,
+ 0x69, 0x73, 0x20, 0x70, 0x72, 0x6f, 0x67, 0x72,
+ 0x61, 0x6d, 0x3b, 0x20, 0x73, 0x65, 0x65, 0x20,
+ 0x74, 0x68, 0x65, 0x20, 0x66, 0x69, 0x6c, 0x65,
+ 0x20, 0x43, 0x4f, 0x50, 0x59, 0x49, 0x4e, 0x47,
+ 0x2e, 0x20, 0x20, 0x49, 0x66, 0x20, 0x6e, 0x6f,
+ 0x74, 0x2c, 0x20, 0x77, 0x72, 0x69, 0x74, 0x65,
+ 0x20, 0x74, 0x6f, 0x0a, 0x20, 0x2a, 0x20, 0x74,
+ 0x68, 0x65, 0x20, 0x46, 0x72, 0x65, 0x65, 0x20,
+ 0x53, 0x6f, 0x66, 0x74, 0x77, 0x61, 0x72, 0x65,
+ 0x20, 0x46, 0x6f, 0x75, 0x6e, 0x64, 0x61, 0x74,
+ 0x69, 0x6f, 0x6e, 0x2c, 0x20, 0x35, 0x31, 0x20,
+ 0x46, 0x72, 0x61, 0x6e, 0x6b, 0x6c, 0x69, 0x6e,
+ 0x20, 0x53, 0x74, 0x72, 0x65, 0x65, 0x74, 0x2c,
+ 0x20, 0x46, 0x69, 0x66, 0x74, 0x68, 0x20, 0x46,
+ 0x6c, 0x6f, 0x6f, 0x72, 0x2c, 0x0a, 0x20, 0x2a,
+ 0x20, 0x42, 0x6f, 0x73, 0x74, 0x6f, 0x6e, 0x2c,
+ 0x20, 0x4d, 0x41, 0x20, 0x30, 0x32, 0x31, 0x31,
+ 0x30, 0x2d, 0x31, 0x33, 0x30, 0x31, 0x2c, 0x20,
+ 0x55, 0x53, 0x41, 0x2e, 0x0a, 0x20, 0x2a, 0x2f,
+ 0x0a,
+ };
+
+ static git_rawobj some_obj = {
+ some_data,
+ sizeof(some_data),
+ GIT_OBJ_BLOB
+ };
+
+ test_body(&some, &some_obj);
+}
diff --git a/tests-clar/object/tag/read.c b/tests-clar/object/tag/read.c
new file mode 100644
index 0000000..2ab31e5
--- /dev/null
+++ b/tests-clar/object/tag/read.c
@@ -0,0 +1,130 @@
+#include "clar_libgit2.h"
+
+#include "tag.h"
+
+static const char *tag1_id = "b25fa35b38051e4ae45d4222e795f9df2e43f1d1";
+static const char *tag2_id = "7b4384978d2493e851f9cca7858815fac9b10980";
+static const char *tagged_commit = "e90810b8df3e80c413d903f631643c716887138d";
+static const char *bad_tag_id = "eda9f45a2a98d4c17a09d681d88569fa4ea91755";
+static const char *badly_tagged_commit = "e90810b8df3e80c413d903f631643c716887138d";
+
+static git_repository *g_repo;
+
+
+// Helpers
+static void ensure_tag_pattern_match(git_repository *repo,
+ const char *pattern,
+ const size_t expected_matches)
+{
+ git_strarray tag_list;
+ int error = GIT_SUCCESS;
+
+ if ((error = git_tag_list_match(&tag_list, pattern, repo)) < GIT_SUCCESS)
+ goto exit;
+
+ if (tag_list.count != expected_matches)
+ error = GIT_ERROR;
+
+exit:
+ git_strarray_free(&tag_list);
+ cl_git_pass(error);
+}
+
+
+// Fixture setup and teardown
+void test_object_tag_read__initialize(void)
+{
+ g_repo = cl_git_sandbox_init("testrepo");
+}
+
+void test_object_tag_read__cleanup(void)
+{
+ cl_git_sandbox_cleanup();
+}
+
+
+void test_object_tag_read__parse(void)
+{
+ // read and parse a tag from the repository
+ git_tag *tag1, *tag2;
+ git_commit *commit;
+ git_oid id1, id2, id_commit;
+
+ git_oid_fromstr(&id1, tag1_id);
+ git_oid_fromstr(&id2, tag2_id);
+ git_oid_fromstr(&id_commit, tagged_commit);
+
+ cl_git_pass(git_tag_lookup(&tag1, g_repo, &id1));
+
+ cl_assert_strequal(git_tag_name(tag1), "test");
+ cl_assert(git_tag_type(tag1) == GIT_OBJ_TAG);
+
+ cl_git_pass(git_tag_target((git_object **)&tag2, tag1));
+ cl_assert(tag2 != NULL);
+
+ cl_assert(git_oid_cmp(&id2, git_tag_id(tag2)) == 0);
+
+ cl_git_pass(git_tag_target((git_object **)&commit, tag2));
+ cl_assert(commit != NULL);
+
+ cl_assert(git_oid_cmp(&id_commit, git_commit_id(commit)) == 0);
+
+ git_tag_free(tag1);
+ git_tag_free(tag2);
+ git_commit_free(commit);
+}
+
+void test_object_tag_read__list(void)
+{
+ // list all tag names from the repository
+ git_strarray tag_list;
+
+ cl_git_pass(git_tag_list(&tag_list, g_repo));
+
+ cl_assert(tag_list.count == 3);
+
+ git_strarray_free(&tag_list);
+}
+
+void test_object_tag_read__list_pattern(void)
+{
+ // list all tag names from the repository matching a specified pattern
+ ensure_tag_pattern_match(g_repo, "", 3);
+ ensure_tag_pattern_match(g_repo, "*", 3);
+ ensure_tag_pattern_match(g_repo, "t*", 1);
+ ensure_tag_pattern_match(g_repo, "*b", 2);
+ ensure_tag_pattern_match(g_repo, "e", 0);
+ ensure_tag_pattern_match(g_repo, "e90810b", 1);
+ ensure_tag_pattern_match(g_repo, "e90810[ab]", 1);
+}
+
+void test_object_tag_read__parse_without_tagger(void)
+{
+ // read and parse a tag without a tagger field
+ git_repository *bad_tag_repo;
+ git_tag *bad_tag;
+ git_commit *commit;
+ git_oid id, id_commit;
+
+ // TODO: This is a little messy
+ cl_git_pass(git_repository_open(&bad_tag_repo, cl_fixture("bad_tag.git")));
+
+ git_oid_fromstr(&id, bad_tag_id);
+ git_oid_fromstr(&id_commit, badly_tagged_commit);
+
+ cl_git_pass(git_tag_lookup(&bad_tag, bad_tag_repo, &id));
+ cl_assert(bad_tag != NULL);
+
+ cl_assert_strequal(git_tag_name(bad_tag), "e90810b");
+ cl_assert(git_oid_cmp(&id, git_tag_id(bad_tag)) == 0);
+ cl_assert(bad_tag->tagger == NULL);
+
+ cl_git_pass(git_tag_target((git_object **)&commit, bad_tag));
+ cl_assert(commit != NULL);
+
+ cl_assert(git_oid_cmp(&id_commit, git_commit_id(commit)) == 0);
+
+ git_tag_free(bad_tag);
+ git_commit_free(commit);
+ git_repository_free(bad_tag_repo);
+}
diff --git a/tests-clar/object/tag/write.c b/tests-clar/object/tag/write.c
new file mode 100644
index 0000000..10db0f3
--- /dev/null
+++ b/tests-clar/object/tag/write.c
@@ -0,0 +1,252 @@
+#include "clar_libgit2.h"
+
+static const char* tagger_name = "Vicent Marti";
+static const char* tagger_email = "vicent@github.com";
+static const char* tagger_message = "This is my tag.\n\nThere are many tags, but this one is mine\n";
+
+static const char *tag2_id = "7b4384978d2493e851f9cca7858815fac9b10980";
+static const char *tagged_commit = "e90810b8df3e80c413d903f631643c716887138d";
+
+static git_repository *g_repo;
+
+
+// Helpers
+#ifndef GIT_WIN32
+#include "odb.h"
+
+static void locate_loose_object(const char *repository_folder,
+ git_object *object,
+ char **out,
+ char **out_folder)
+{
+ static const char *objects_folder = "objects/";
+
+ char *ptr, *full_path, *top_folder;
+ int path_length, objects_length;
+
+ assert(repository_folder && object);
+
+ objects_length = strlen(objects_folder);
+ path_length = strlen(repository_folder);
+ ptr = full_path = git__malloc(path_length + objects_length + GIT_OID_HEXSZ + 3);
+
+ strcpy(ptr, repository_folder);
+ strcpy(ptr + path_length, objects_folder);
+
+ ptr = top_folder = ptr + path_length + objects_length;
+ *ptr++ = '/';
+ git_oid_pathfmt(ptr, git_object_id(object));
+ ptr += GIT_OID_HEXSZ + 1;
+ *ptr = 0;
+
+ *out = full_path;
+
+ if (out_folder)
+ *out_folder = top_folder;
+}
+
+static void loose_object_mode(const char *repository_folder, git_object *object)
+{
+ char *object_path;
+ struct stat st;
+
+ locate_loose_object(repository_folder, object, &object_path, NULL);
+ cl_git_pass(p_stat(object_path, &st));
+ free(object_path);
+ cl_assert((st.st_mode & 0777) == GIT_OBJECT_FILE_MODE);
+}
+#endif
+
+
+
+// Fixture setup and teardown
+void test_object_tag_write__initialize(void)
+{
+ g_repo = cl_git_sandbox_init("testrepo");
+}
+
+void test_object_tag_write__cleanup(void)
+{
+ cl_git_sandbox_cleanup();
+}
+
+
+
+void test_object_tag_write__basic(void)
+{
+ // write a tag to the repository and read it again
+ git_tag *tag;
+ git_oid target_id, tag_id;
+ git_signature *tagger;
+ const git_signature *tagger1;
+ git_reference *ref_tag;
+ git_object *target;
+
+ git_oid_fromstr(&target_id, tagged_commit);
+ cl_git_pass(git_object_lookup(&target, g_repo, &target_id, GIT_OBJ_COMMIT));
+
+ /* create signature */
+ cl_git_pass(git_signature_new(&tagger, tagger_name, tagger_email, 123456789, 60));
+
+ cl_git_pass(git_tag_create(
+ &tag_id, /* out id */
+ g_repo,
+ "the-tag",
+ target,
+ tagger,
+ tagger_message,
+ 0));
+
+ git_object_free(target);
+ git_signature_free(tagger);
+
+ cl_git_pass(git_tag_lookup(&tag, g_repo, &tag_id));
+ cl_assert(git_oid_cmp(git_tag_target_oid(tag), &target_id) == 0);
+
+ /* Check attributes were set correctly */
+ tagger1 = git_tag_tagger(tag);
+ cl_assert(tagger1 != NULL);
+ cl_assert_strequal(tagger1->name, tagger_name);
+ cl_assert_strequal(tagger1->email, tagger_email);
+ cl_assert(tagger1->when.time == 123456789);
+ cl_assert(tagger1->when.offset == 60);
+
+ cl_assert_strequal(git_tag_message(tag), tagger_message);
+
+ cl_git_pass(git_reference_lookup(&ref_tag, g_repo, "refs/tags/the-tag"));
+ cl_assert(git_oid_cmp(git_reference_oid(ref_tag), &tag_id) == 0);
+ cl_git_pass(git_reference_delete(ref_tag));
+#ifndef GIT_WIN32
+ // TODO: Get this to work on Linux
+ //loose_object_mode("testrepo/", (git_object *)tag);
+#endif
+
+ git_tag_free(tag);
+}
+
+void test_object_tag_write__overwrite(void)
+{
+ // Attempt to write a tag bearing the same name than an already existing tag
+ git_oid target_id, tag_id;
+ git_signature *tagger;
+ git_object *target;
+
+ git_oid_fromstr(&target_id, tagged_commit);
+ cl_git_pass(git_object_lookup(&target, g_repo, &target_id, GIT_OBJ_COMMIT));
+
+ /* create signature */
+ cl_git_pass(git_signature_new(&tagger, tagger_name, tagger_email, 123456789, 60));
+
+ cl_git_fail(git_tag_create(
+ &tag_id, /* out id */
+ g_repo,
+ "e90810b",
+ target,
+ tagger,
+ tagger_message,
+ 0));
+
+ git_object_free(target);
+ git_signature_free(tagger);
+
+}
+
+void test_object_tag_write__replace(void)
+{
+ // Replace an already existing tag
+ git_oid target_id, tag_id, old_tag_id;
+ git_signature *tagger;
+ git_reference *ref_tag;
+ git_object *target;
+
+ git_oid_fromstr(&target_id, tagged_commit);
+ cl_git_pass(git_object_lookup(&target, g_repo, &target_id, GIT_OBJ_COMMIT));
+
+ cl_git_pass(git_reference_lookup(&ref_tag, g_repo, "refs/tags/e90810b"));
+ git_oid_cpy(&old_tag_id, git_reference_oid(ref_tag));
+ git_reference_free(ref_tag);
+
+ /* create signature */
+ cl_git_pass(git_signature_new(&tagger, tagger_name, tagger_email, 123456789, 60));
+
+ cl_git_pass(git_tag_create(
+ &tag_id, /* out id */
+ g_repo,
+ "e90810b",
+ target,
+ tagger,
+ tagger_message,
+ 1));
+
+ git_object_free(target);
+ git_signature_free(tagger);
+
+ cl_git_pass(git_reference_lookup(&ref_tag, g_repo, "refs/tags/e90810b"));
+ cl_assert(git_oid_cmp(git_reference_oid(ref_tag), &tag_id) == 0);
+ cl_assert(git_oid_cmp(git_reference_oid(ref_tag), &old_tag_id) != 0);
+
+ git_reference_free(ref_tag);
+}
+
+void test_object_tag_write__lightweight(void)
+{
+ // write a lightweight tag to the repository and read it again
+ git_oid target_id, object_id;
+ git_reference *ref_tag;
+ git_object *target;
+
+ git_oid_fromstr(&target_id, tagged_commit);
+ cl_git_pass(git_object_lookup(&target, g_repo, &target_id, GIT_OBJ_COMMIT));
+
+ cl_git_pass(git_tag_create_lightweight(
+ &object_id,
+ g_repo,
+ "light-tag",
+ target,
+ 0));
+
+ git_object_free(target);
+
+ cl_assert(git_oid_cmp(&object_id, &target_id) == 0);
+
+ cl_git_pass(git_reference_lookup(&ref_tag, g_repo, "refs/tags/light-tag"));
+ cl_assert(git_oid_cmp(git_reference_oid(ref_tag), &target_id) == 0);
+
+ cl_git_pass(git_tag_delete(g_repo, "light-tag"));
+
+ git_reference_free(ref_tag);
+}
+
+void test_object_tag_write__lightweight_over_existing(void)
+{
+ // Attempt to write a lightweight tag bearing the same name than an already existing tag
+ git_oid target_id, object_id, existing_object_id;
+ git_object *target;
+
+ git_oid_fromstr(&target_id, tagged_commit);
+ cl_git_pass(git_object_lookup(&target, g_repo, &target_id, GIT_OBJ_COMMIT));
+
+ cl_git_fail(git_tag_create_lightweight(
+ &object_id,
+ g_repo,
+ "e90810b",
+ target,
+ 0));
+
+ git_oid_fromstr(&existing_object_id, tag2_id);
+ cl_assert(git_oid_cmp(&object_id, &existing_object_id) == 0);
+
+ git_object_free(target);
+}
+
+void test_object_tag_write__delete(void)
+{
+ // Delete an already existing tag
+ git_reference *ref_tag;
+
+ cl_git_pass(git_tag_delete(g_repo, "e90810b"));
+
+ cl_git_fail(git_reference_lookup(&ref_tag, g_repo, "refs/tags/e90810b"));
+
+ git_reference_free(ref_tag);
+}
diff --git a/tests-clar/object/tree/diff.c b/tests-clar/object/tree/diff.c
index d481b6f..011080c 100644
--- a/tests-clar/object/tree/diff.c
+++ b/tests-clar/object/tree/diff.c
@@ -18,7 +18,7 @@ static void diff_cmp(const git_tree_diff_data *a, const git_tree_diff_data *b)
cl_assert(a->status - b->status == 0);
- cl_assert(strcmp(a->path, b->path) == 0);
+ cl_assert_strequal(a->path, b->path);
}
static int diff_cb(const git_tree_diff_data *diff, void *data)
diff --git a/tests-clar/object/tree/frompath.c b/tests-clar/object/tree/frompath.c
index 3857d42..35d863e 100644
--- a/tests-clar/object/tree/frompath.c
+++ b/tests-clar/object/tree/frompath.c
@@ -24,7 +24,10 @@ void test_object_tree_frompath__cleanup(void)
cl_fixture_cleanup("testrepo.git");
}
-static void assert_tree_from_path(git_tree *root, const char *path, git_error expected_result, const char *expected_raw_oid)
+static void assert_tree_from_path(git_tree *root,
+ const char *path,
+ git_error expected_result,
+ const char *expected_raw_oid)
{
git_tree *containing_tree = NULL;
@@ -35,7 +38,7 @@ static void assert_tree_from_path(git_tree *root, const char *path, git_error ex
cl_assert(containing_tree != NULL && expected_result == GIT_SUCCESS);
- cl_assert(git_oid_streq(git_object_id((const git_object *)containing_tree), expected_raw_oid) == GIT_SUCCESS);
+ cl_git_pass(git_oid_streq(git_object_id((const git_object *)containing_tree), expected_raw_oid));
git_tree_free(containing_tree);
}
diff --git a/tests-clar/object/tree/read.c b/tests-clar/object/tree/read.c
new file mode 100644
index 0000000..fc2b44b
--- /dev/null
+++ b/tests-clar/object/tree/read.c
@@ -0,0 +1,75 @@
+#include "clar_libgit2.h"
+
+#include "tree.h"
+
+static const char *tree_oid = "1810dff58d8a660512d4832e740f692884338ccd";
+
+static git_repository *g_repo;
+
+// Fixture setup and teardown
+void test_object_tree_read__initialize(void)
+{
+ g_repo = cl_git_sandbox_init("testrepo");
+}
+
+void test_object_tree_read__cleanup(void)
+{
+ cl_git_sandbox_cleanup();
+}
+
+
+
+void test_object_tree_read__loaded(void)
+{
+ // acces randomly the entries on a loaded tree
+ git_oid id;
+ git_tree *tree;
+
+ git_oid_fromstr(&id, tree_oid);
+
+ cl_git_pass(git_tree_lookup(&tree, g_repo, &id));
+
+ cl_assert(git_tree_entry_byname(tree, "README") != NULL);
+ cl_assert(git_tree_entry_byname(tree, "NOTEXISTS") == NULL);
+ cl_assert(git_tree_entry_byname(tree, "") == NULL);
+ cl_assert(git_tree_entry_byindex(tree, 0) != NULL);
+ cl_assert(git_tree_entry_byindex(tree, 2) != NULL);
+ cl_assert(git_tree_entry_byindex(tree, 3) == NULL);
+ cl_assert(git_tree_entry_byindex(tree, (unsigned int)-1) == NULL);
+
+ git_tree_free(tree);
+}
+
+void test_object_tree_read__two(void)
+{
+ // read a tree from the repository
+ git_oid id;
+ git_tree *tree;
+ const git_tree_entry *entry;
+ git_object *obj;
+
+ git_oid_fromstr(&id, tree_oid);
+
+ cl_git_pass(git_tree_lookup(&tree, g_repo, &id));
+
+ cl_assert(git_tree_entrycount(tree) == 3);
+
+ /* GH-86: git_object_lookup() should also check the type if the object comes from the cache */
+ cl_assert(git_object_lookup(&obj, g_repo, &id, GIT_OBJ_TREE) == 0);
+ cl_assert(obj != NULL);
+ git_object_free(obj);
+ obj = NULL;
+ cl_assert(git_object_lookup(&obj, g_repo, &id, GIT_OBJ_BLOB) == GIT_EINVALIDTYPE);
+ cl_assert(obj == NULL);
+
+ entry = git_tree_entry_byname(tree, "README");
+ cl_assert(entry != NULL);
+
+ cl_assert_strequal(git_tree_entry_name(entry), "README");
+
+ cl_git_pass(git_tree_entry_2object(&obj, g_repo, entry));
+ cl_assert(obj != NULL);
+
+ git_object_free(obj);
+ git_tree_free(tree);
+}
diff --git a/tests-clar/object/tree/write.c b/tests-clar/object/tree/write.c
new file mode 100644
index 0000000..7916886
--- /dev/null
+++ b/tests-clar/object/tree/write.c
@@ -0,0 +1,202 @@
+#include "clar_libgit2.h"
+
+#include "tree.h"
+
+static const char *blob_oid = "fa49b077972391ad58037050f2a75f74e3671e92";
+static const char *first_tree = "181037049a54a1eb5fab404658a3a250b44335d7";
+static const char *second_tree = "f60079018b664e4e79329a7ef9559c8d9e0378d1";
+static const char *third_tree = "eb86d8b81d6adbd5290a935d6c9976882de98488";
+
+static git_repository *g_repo;
+
+
+// Helpers
+static int print_tree(git_repository *repo, const git_oid *tree_oid, int depth)
+{
+ static const char *indent = " ";
+ git_tree *tree;
+ unsigned int i;
+
+ if (git_tree_lookup(&tree, repo, tree_oid) < GIT_SUCCESS)
+ return GIT_ERROR;
+
+ for (i = 0; i < git_tree_entrycount(tree); ++i) {
+ const git_tree_entry *entry = git_tree_entry_byindex(tree, i);
+ char entry_oid[40];
+
+ git_oid_fmt(entry_oid, &entry->oid);
+ printf("%.*s%o [%.*s] %s\n", depth*2, indent, entry->attr, 40, entry_oid, entry->filename);
+
+ if (entry->attr == S_IFDIR) {
+ if (print_tree(repo, &entry->oid, depth + 1) < GIT_SUCCESS) {
+ git_tree_free(tree);
+ return GIT_ERROR;
+ }
+ }
+ }
+
+ git_tree_free(tree);
+ return GIT_SUCCESS;
+}
+
+static void locate_loose_object(const char *repository_folder,
+ git_object *object,
+ char **out,
+ char **out_folder)
+{
+ static const char *objects_folder = "objects/";
+
+ char *ptr, *full_path, *top_folder;
+ int path_length, objects_length;
+
+ assert(repository_folder && object);
+
+ objects_length = strlen(objects_folder);
+ path_length = strlen(repository_folder);
+ ptr = full_path = git__malloc(path_length + objects_length + GIT_OID_HEXSZ + 3);
+
+ strcpy(ptr, repository_folder);
+ strcpy(ptr + path_length, objects_folder);
+
+ ptr = top_folder = ptr + path_length + objects_length;
+ *ptr++ = '/';
+ git_oid_pathfmt(ptr, git_object_id(object));
+ ptr += GIT_OID_HEXSZ + 1;
+ *ptr = 0;
+
+ *out = full_path;
+
+ if (out_folder)
+ *out_folder = top_folder;
+}
+
+static int loose_object_mode(const char *repository_folder, git_object *object)
+{
+ char *object_path;
+ struct stat st;
+
+ locate_loose_object(repository_folder, object, &object_path, NULL);
+ if (p_stat(object_path, &st) < 0)
+ return 0;
+ free(object_path);
+
+ return st.st_mode;
+}
+
+static int loose_object_dir_mode(const char *repository_folder, git_object *object)
+{
+ char *object_path;
+ size_t pos;
+ struct stat st;
+
+ locate_loose_object(repository_folder, object, &object_path, NULL);
+
+ pos = strlen(object_path);
+ while (pos--) {
+ if (object_path[pos] == '/') {
+ object_path[pos] = 0;
+ break;
+ }
+ }
+
+ if (p_stat(object_path, &st) < 0)
+ return 0;
+ free(object_path);
+
+ return st.st_mode;
+}
+
+
+// Fixture setup and teardown
+void test_object_tree_write__initialize(void)
+{
+ g_repo = cl_git_sandbox_init("testrepo");
+}
+
+void test_object_tree_write__cleanup(void)
+{
+ cl_git_sandbox_cleanup();
+}
+
+
+#if 0
+void xtest_object_tree_write__print(void)
+{
+ // write a tree from an index
+ git_index *index;
+ git_oid tree_oid;
+
+ cl_git_pass(git_repository_index(&index, g_repo));
+
+ cl_git_pass(git_tree_create_fromindex(&tree_oid, index));
+ cl_git_pass(print_tree(g_repo, &tree_oid, 0));
+}
+#endif
+
+void test_object_tree_write__from_memory(void)
+{
+ // write a tree from a memory
+ git_treebuilder *builder;
+ git_tree *tree;
+ git_oid id, bid, rid, id2;
+
+ git_oid_fromstr(&id, first_tree);
+ git_oid_fromstr(&id2, second_tree);
+ git_oid_fromstr(&bid, blob_oid);
+
+ //create a second tree from first tree using `git_treebuilder_insert` on REPOSITORY_FOLDER.
+ cl_git_pass(git_tree_lookup(&tree, g_repo, &id));
+ cl_git_pass(git_treebuilder_create(&builder, tree));
+
+ cl_git_fail(git_treebuilder_insert(NULL, builder, "", &bid, 0100644));
+ cl_git_fail(git_treebuilder_insert(NULL, builder, "/", &bid, 0100644));
+ cl_git_fail(git_treebuilder_insert(NULL, builder, "folder/new.txt", &bid, 0100644));
+
+ cl_git_pass(git_treebuilder_insert(NULL,builder,"new.txt",&bid,0100644));
+ cl_git_pass(git_treebuilder_write(&rid, g_repo, builder));
+
+ cl_assert(git_oid_cmp(&rid, &id2) == 0);
+
+ git_treebuilder_free(builder);
+ git_tree_free(tree);
+}
+
+void test_object_tree_write__subtree(void)
+{
+ // write a hierarchical tree from a memory
+ git_treebuilder *builder;
+ git_tree *tree;
+ git_oid id, bid, subtree_id, id2, id3;
+ git_oid id_hiearar;
+
+ git_oid_fromstr(&id, first_tree);
+ git_oid_fromstr(&id2, second_tree);
+ git_oid_fromstr(&id3, third_tree);
+ git_oid_fromstr(&bid, blob_oid);
+
+ //create subtree
+ cl_git_pass(git_treebuilder_create(&builder, NULL));
+ cl_git_pass(git_treebuilder_insert(NULL,builder,"new.txt",&bid,0100644));
+ cl_git_pass(git_treebuilder_write(&subtree_id, g_repo, builder));
+ git_treebuilder_free(builder);
+
+ // create parent tree
+ cl_git_pass(git_tree_lookup(&tree, g_repo, &id));
+ cl_git_pass(git_treebuilder_create(&builder, tree));
+ cl_git_pass(git_treebuilder_insert(NULL,builder,"new",&subtree_id,040000));
+ cl_git_pass(git_treebuilder_write(&id_hiearar, g_repo, builder));
+ git_treebuilder_free(builder);
+ git_tree_free(tree);
+
+ cl_assert(git_oid_cmp(&id_hiearar, &id3) == 0);
+
+ // check data is correct
+ cl_git_pass(git_tree_lookup(&tree, g_repo, &id_hiearar));
+ cl_assert(2 == git_tree_entrycount(tree));
+#ifndef GIT_WIN32
+ // TODO: fix these
+ //cl_assert((loose_object_dir_mode("testrepo", (git_object *)tree) & 0777) == GIT_OBJECT_DIR_MODE);
+ //cl_assert((loose_object_mode("testrespo", (git_object *)tree) & 0777) == GIT_OBJECT_FILE_MODE);
+#endif
+ git_tree_free(tree);
+}
diff --git a/tests-clar/refs/crashes.c b/tests-clar/refs/crashes.c
index 26ce98a..e1b289a 100644
--- a/tests-clar/refs/crashes.c
+++ b/tests-clar/refs/crashes.c
@@ -11,7 +11,7 @@ void test_refs_crashes__double_free(void)
cl_git_pass(git_reference_lookup(&ref2, repo, REFNAME));
cl_git_pass(git_reference_delete(ref));
/* reference is gone from disk, so reloading it will fail */
- cl_must_fail(git_reference_reload(ref2));
+ cl_git_fail(git_reference_reload(ref2));
git_repository_free(repo);
}
diff --git a/tests-clar/refs/create.c b/tests-clar/refs/create.c
new file mode 100644
index 0000000..e8f99a2
--- /dev/null
+++ b/tests-clar/refs/create.c
@@ -0,0 +1,153 @@
+#include "clar_libgit2.h"
+
+#include "repository.h"
+#include "git2/reflog.h"
+#include "reflog.h"
+
+static const char *current_master_tip = "a65fedf39aefe402d3bb6e24df4d4f5fe4547750";
+static const char *current_head_target = "refs/heads/master";
+
+static git_repository *g_repo;
+
+
+
+void test_ref_create__initialize(void)
+{
+ g_repo = cl_git_sandbox_init("testrepo");
+}
+
+void test_ref_create__cleanup(void)
+{
+ cl_git_sandbox_cleanup();
+}
+
+
+
+void test_ref_create__symbolic(void)
+{
+ // create a new symbolic reference
+ git_reference *new_reference, *looked_up_ref, *resolved_ref;
+ git_repository *repo2;
+ git_oid id;
+ git_buf ref_path = GIT_BUF_INIT;
+
+ const char *new_head_tracker = "another-head-tracker";
+
+ git_oid_fromstr(&id, current_master_tip);
+
+ /* Retrieve the physical path to the symbolic ref for further cleaning */
+ cl_git_pass(git_buf_joinpath(&ref_path, g_repo->path_repository, new_head_tracker));
+ git_buf_free(&ref_path);
+
+ /* Create and write the new symbolic reference */
+ cl_git_pass(git_reference_create_symbolic(&new_reference, g_repo, new_head_tracker, current_head_target, 0));
+
+ /* Ensure the reference can be looked-up... */
+ cl_git_pass(git_reference_lookup(&looked_up_ref, g_repo, new_head_tracker));
+ cl_assert(git_reference_type(looked_up_ref) & GIT_REF_SYMBOLIC);
+ cl_assert(git_reference_is_packed(looked_up_ref) == 0);
+ cl_assert_strequal(looked_up_ref->name, new_head_tracker);
+
+ /* ...peeled.. */
+ cl_git_pass(git_reference_resolve(&resolved_ref, looked_up_ref));
+ cl_assert(git_reference_type(resolved_ref) == GIT_REF_OID);
+
+ /* ...and that it points to the current master tip */
+ cl_assert(git_oid_cmp(&id, git_reference_oid(resolved_ref)) == 0);
+ git_reference_free(looked_up_ref);
+ git_reference_free(resolved_ref);
+
+ /* Similar test with a fresh new repository */
+ cl_git_pass(git_repository_open(&repo2, "testrepo"));
+
+ cl_git_pass(git_reference_lookup(&looked_up_ref, repo2, new_head_tracker));
+ cl_git_pass(git_reference_resolve(&resolved_ref, looked_up_ref));
+ cl_assert(git_oid_cmp(&id, git_reference_oid(resolved_ref)) == 0);
+
+ git_repository_free(repo2);
+
+ git_reference_free(new_reference);
+ git_reference_free(looked_up_ref);
+ git_reference_free(resolved_ref);
+}
+
+void test_ref_create__deep_symbolic(void)
+{
+ // create a deep symbolic reference
+ git_reference *new_reference, *looked_up_ref, *resolved_ref;
+ git_oid id;
+ git_buf ref_path = GIT_BUF_INIT;
+
+ const char *new_head_tracker = "deep/rooted/tracker";
+
+ git_oid_fromstr(&id, current_master_tip);
+
+ cl_git_pass(git_buf_joinpath(&ref_path, g_repo->path_repository, new_head_tracker));
+ cl_git_pass(git_reference_create_symbolic(&new_reference, g_repo, new_head_tracker, current_head_target, 0));
+ cl_git_pass(git_reference_lookup(&looked_up_ref, g_repo, new_head_tracker));
+ cl_git_pass(git_reference_resolve(&resolved_ref, looked_up_ref));
+ cl_assert(git_oid_cmp(&id, git_reference_oid(resolved_ref)) == 0);
+
+ git_reference_free(new_reference);
+ git_reference_free(looked_up_ref);
+ git_reference_free(resolved_ref);
+ git_buf_free(&ref_path);
+}
+
+void test_ref_create__oid(void)
+{
+ // create a new OID reference
+ git_reference *new_reference, *looked_up_ref;
+ git_repository *repo2;
+ git_oid id;
+ git_buf ref_path = GIT_BUF_INIT;
+
+ const char *new_head = "refs/heads/new-head";
+
+ git_oid_fromstr(&id, current_master_tip);
+
+ /* Retrieve the physical path to the symbolic ref for further cleaning */
+ cl_git_pass(git_buf_joinpath(&ref_path, g_repo->path_repository, new_head));
+
+ /* Create and write the new object id reference */
+ cl_git_pass(git_reference_create_oid(&new_reference, g_repo, new_head, &id, 0));
+
+ /* Ensure the reference can be looked-up... */
+ cl_git_pass(git_reference_lookup(&looked_up_ref, g_repo, new_head));
+ cl_assert(git_reference_type(looked_up_ref) & GIT_REF_OID);
+ cl_assert(git_reference_is_packed(looked_up_ref) == 0);
+ cl_assert_strequal(looked_up_ref->name, new_head);
+
+ /* ...and that it points to the current master tip */
+ cl_assert(git_oid_cmp(&id, git_reference_oid(looked_up_ref)) == 0);
+ git_reference_free(looked_up_ref);
+
+ /* Similar test with a fresh new repository */
+ cl_git_pass(git_repository_open(&repo2, "testrepo"));
+
+ cl_git_pass(git_reference_lookup(&looked_up_ref, repo2, new_head));
+ cl_assert(git_oid_cmp(&id, git_reference_oid(looked_up_ref)) == 0);
+
+ git_repository_free(repo2);
+
+ git_reference_free(new_reference);
+ git_reference_free(looked_up_ref);
+ git_buf_free(&ref_path);
+}
+
+void test_ref_create__oid_unknown(void)
+{
+ // Can not create a new OID reference which targets at an unknown id
+ git_reference *new_reference, *looked_up_ref;
+ git_oid id;
+
+ const char *new_head = "refs/heads/new-head";
+
+ git_oid_fromstr(&id, "deadbeef3f795b2b4353bcce3a527ad0a4f7f644");
+
+ /* Create and write the new object id reference */
+ cl_git_fail(git_reference_create_oid(&new_reference, g_repo, new_head, &id, 0));
+
+ /* Ensure the reference can't be looked-up... */
+ cl_git_fail(git_reference_lookup(&looked_up_ref, g_repo, new_head));
+}
diff --git a/tests-clar/refs/delete.c b/tests-clar/refs/delete.c
new file mode 100644
index 0000000..cc3b936
--- /dev/null
+++ b/tests-clar/refs/delete.c
@@ -0,0 +1,85 @@
+#include "clar_libgit2.h"
+
+#include "repository.h"
+#include "git2/reflog.h"
+#include "reflog.h"
+
+static const char *packed_test_head_name = "refs/heads/packed-test";
+static const char *current_master_tip = "a65fedf39aefe402d3bb6e24df4d4f5fe4547750";
+
+static git_repository *g_repo;
+
+
+
+void test_refs_delete__initialize(void)
+{
+ g_repo = cl_git_sandbox_init("testrepo");
+}
+
+void test_refs_delete__cleanup(void)
+{
+ cl_git_sandbox_cleanup();
+}
+
+
+
+void test_refs_delete__packed_loose(void)
+{
+ // deleting a ref which is both packed and loose should remove both tracks in the filesystem
+ git_reference *looked_up_ref, *another_looked_up_ref;
+ git_buf temp_path = GIT_BUF_INIT;
+
+ /* Ensure the loose reference exists on the file system */
+ cl_git_pass(git_buf_joinpath(&temp_path, g_repo->path_repository, packed_test_head_name));
+ cl_git_pass(git_path_exists(temp_path.ptr));
+
+ /* Lookup the reference */
+ cl_git_pass(git_reference_lookup(&looked_up_ref, g_repo, packed_test_head_name));
+
+ /* Ensure it's the loose version that has been found */
+ cl_assert(git_reference_is_packed(looked_up_ref) == 0);
+
+ /* Now that the reference is deleted... */
+ cl_git_pass(git_reference_delete(looked_up_ref));
+
+ /* Looking up the reference once again should not retrieve it */
+ cl_git_fail(git_reference_lookup(&another_looked_up_ref, g_repo, packed_test_head_name));
+
+ /* Ensure the loose reference doesn't exist any longer on the file system */
+ cl_git_pass(!git_path_exists(temp_path.ptr));
+
+ git_reference_free(another_looked_up_ref);
+ git_buf_free(&temp_path);
+}
+
+void test_refs_delete__packed_only(void)
+{
+ // can delete a just packed reference
+ git_reference *ref;
+ git_oid id;
+ const char *new_ref = "refs/heads/new_ref";
+
+ git_oid_fromstr(&id, current_master_tip);
+
+ /* Create and write the new object id reference */
+ cl_git_pass(git_reference_create_oid(&ref, g_repo, new_ref, &id, 0));
+ git_reference_free(ref);
+
+ /* Lookup the reference */
+ cl_git_pass(git_reference_lookup(&ref, g_repo, new_ref));
+
+ /* Ensure it's a loose reference */
+ cl_assert(git_reference_is_packed(ref) == 0);
+
+ /* Pack all existing references */
+ cl_git_pass(git_reference_packall(g_repo));
+
+ /* Reload the reference from disk */
+ cl_git_pass(git_reference_reload(ref));
+
+ /* Ensure it's a packed reference */
+ cl_assert(git_reference_is_packed(ref) == 1);
+
+ /* This should pass */
+ cl_git_pass(git_reference_delete(ref));
+}
diff --git a/tests-clar/refs/list.c b/tests-clar/refs/list.c
new file mode 100644
index 0000000..f673bd9
--- /dev/null
+++ b/tests-clar/refs/list.c
@@ -0,0 +1,53 @@
+#include "clar_libgit2.h"
+
+#include "repository.h"
+#include "git2/reflog.h"
+#include "reflog.h"
+
+static git_repository *g_repo;
+
+
+
+void test_refs_list__initialize(void)
+{
+ g_repo = cl_git_sandbox_init("testrepo");
+}
+
+void test_refs_list__cleanup(void)
+{
+ cl_git_sandbox_cleanup();
+}
+
+
+
+void test_refs_list__all(void)
+{
+ // try to list all the references in our test repo
+ git_strarray ref_list;
+
+ cl_git_pass(git_reference_listall(&ref_list, g_repo, GIT_REF_LISTALL));
+
+ /*{
+ unsigned short i;
+ for (i = 0; i < ref_list.count; ++i)
+ printf("# %s\n", ref_list.strings[i]);
+ }*/
+
+ /* We have exactly 9 refs in total if we include the packed ones:
+ * there is a reference that exists both in the packfile and as
+ * loose, but we only list it once */
+ cl_assert(ref_list.count == 9);
+
+ git_strarray_free(&ref_list);
+}
+
+void test_refs_list__symbolic_only(void)
+{
+ // try to list only the symbolic references
+ git_strarray ref_list;
+
+ cl_git_pass(git_reference_listall(&ref_list, g_repo, GIT_REF_SYMBOLIC));
+ cl_assert(ref_list.count == 0); /* no symrefs in the test repo */
+
+ git_strarray_free(&ref_list);
+}
diff --git a/tests-clar/refs/normalize.c b/tests-clar/refs/normalize.c
new file mode 100644
index 0000000..135d0a9
--- /dev/null
+++ b/tests-clar/refs/normalize.c
@@ -0,0 +1,200 @@
+#include "clar_libgit2.h"
+
+#include "repository.h"
+#include "git2/reflog.h"
+#include "reflog.h"
+
+
+// Helpers
+static void ensure_refname_normalized(int is_oid_ref,
+ const char *input_refname,
+ const char *expected_refname)
+{
+ char buffer_out[GIT_REFNAME_MAX];
+
+ if (is_oid_ref)
+ cl_git_pass(git_reference__normalize_name_oid(buffer_out, sizeof(buffer_out), input_refname));
+ else
+ cl_git_pass(git_reference__normalize_name(buffer_out, sizeof(buffer_out), input_refname));
+
+ if (expected_refname)
+ cl_assert(0 == strcmp(buffer_out, expected_refname));
+}
+
+static void ensure_refname_invalid(int is_oid_ref, const char *input_refname)
+{
+ char buffer_out[GIT_REFNAME_MAX];
+
+ if (is_oid_ref)
+ cl_git_fail(git_reference__normalize_name_oid(buffer_out, sizeof(buffer_out), input_refname));
+ else
+ cl_git_fail(git_reference__normalize_name(buffer_out, sizeof(buffer_out), input_refname));
+}
+
+#define OID_REF 1
+#define SYM_REF 0
+
+
+
+void test_refs_normalize__direct(void)
+{
+ // normalize a direct (OID) reference name
+ ensure_refname_invalid(OID_REF, "a");
+ ensure_refname_invalid(OID_REF, "");
+ ensure_refname_invalid(OID_REF, "refs/heads/a/");
+ ensure_refname_invalid(OID_REF, "refs/heads/a.");
+ ensure_refname_invalid(OID_REF, "refs/heads/a.lock");
+ ensure_refname_normalized(OID_REF, "refs/dummy/a", NULL);
+ ensure_refname_normalized(OID_REF, "refs/stash", NULL);
+ ensure_refname_normalized(OID_REF, "refs/tags/a", "refs/tags/a");
+ ensure_refname_normalized(OID_REF, "refs/heads/a/b", "refs/heads/a/b");
+ ensure_refname_normalized(OID_REF, "refs/heads/a./b", "refs/heads/a./b");
+ ensure_refname_invalid(OID_REF, "refs/heads/foo?bar");
+ ensure_refname_invalid(OID_REF, "refs/heads\foo");
+ ensure_refname_normalized(OID_REF, "refs/heads/v@ation", "refs/heads/v@ation");
+ ensure_refname_normalized(OID_REF, "refs///heads///a", "refs/heads/a");
+ ensure_refname_invalid(OID_REF, "refs/heads/.a/b");
+ ensure_refname_invalid(OID_REF, "refs/heads/foo/../bar");
+ ensure_refname_invalid(OID_REF, "refs/heads/foo..bar");
+ ensure_refname_invalid(OID_REF, "refs/heads/./foo");
+ ensure_refname_invalid(OID_REF, "refs/heads/v@{ation");
+}
+
+void test_refs_normalize__symbolic(void)
+{
+ // normalize a symbolic reference name
+ ensure_refname_normalized(SYM_REF, "a", "a");
+ ensure_refname_normalized(SYM_REF, "a/b", "a/b");
+ ensure_refname_normalized(SYM_REF, "refs///heads///a", "refs/heads/a");
+ ensure_refname_invalid(SYM_REF, "");
+ ensure_refname_invalid(SYM_REF, "heads\foo");
+}
+
+/* Ported from JGit, BSD licence.
+ * See https://github.com/spearce/JGit/commit/e4bf8f6957bbb29362575d641d1e77a02d906739 */
+void test_refs_normalize__jgit_suite(void)
+{
+ // tests borrowed from JGit
+
+/* EmptyString */
+ ensure_refname_invalid(SYM_REF, "");
+ ensure_refname_invalid(SYM_REF, "/");
+
+/* MustHaveTwoComponents */
+ ensure_refname_invalid(OID_REF, "master");
+ ensure_refname_normalized(SYM_REF, "heads/master", "heads/master");
+
+/* ValidHead */
+
+ ensure_refname_normalized(SYM_REF, "refs/heads/master", "refs/heads/master");
+ ensure_refname_normalized(SYM_REF, "refs/heads/pu", "refs/heads/pu");
+ ensure_refname_normalized(SYM_REF, "refs/heads/z", "refs/heads/z");
+ ensure_refname_normalized(SYM_REF, "refs/heads/FoO", "refs/heads/FoO");
+
+/* ValidTag */
+ ensure_refname_normalized(SYM_REF, "refs/tags/v1.0", "refs/tags/v1.0");
+
+/* NoLockSuffix */
+ ensure_refname_invalid(SYM_REF, "refs/heads/master.lock");
+
+/* NoDirectorySuffix */
+ ensure_refname_invalid(SYM_REF, "refs/heads/master/");
+
+/* NoSpace */
+ ensure_refname_invalid(SYM_REF, "refs/heads/i haz space");
+
+/* NoAsciiControlCharacters */
+ {
+ char c;
+ char buffer[GIT_REFNAME_MAX];
+ for (c = '\1'; c < ' '; c++) {
+ strncpy(buffer, "refs/heads/mast", 15);
+ strncpy(buffer + 15, (const char *)&c, 1);
+ strncpy(buffer + 16, "er", 2);
+ buffer[18 - 1] = '\0';
+ ensure_refname_invalid(SYM_REF, buffer);
+ }
+ }
+
+/* NoBareDot */
+ ensure_refname_invalid(SYM_REF, "refs/heads/.");
+ ensure_refname_invalid(SYM_REF, "refs/heads/..");
+ ensure_refname_invalid(SYM_REF, "refs/heads/./master");
+ ensure_refname_invalid(SYM_REF, "refs/heads/../master");
+
+/* NoLeadingOrTrailingDot */
+ ensure_refname_invalid(SYM_REF, ".");
+ ensure_refname_invalid(SYM_REF, "refs/heads/.bar");
+ ensure_refname_invalid(SYM_REF, "refs/heads/..bar");
+ ensure_refname_invalid(SYM_REF, "refs/heads/bar.");
+
+/* ContainsDot */
+ ensure_refname_normalized(SYM_REF, "refs/heads/m.a.s.t.e.r", "refs/heads/m.a.s.t.e.r");
+ ensure_refname_invalid(SYM_REF, "refs/heads/master..pu");
+
+/* NoMagicRefCharacters */
+ ensure_refname_invalid(SYM_REF, "refs/heads/master^");
+ ensure_refname_invalid(SYM_REF, "refs/heads/^master");
+ ensure_refname_invalid(SYM_REF, "^refs/heads/master");
+
+ ensure_refname_invalid(SYM_REF, "refs/heads/master~");
+ ensure_refname_invalid(SYM_REF, "refs/heads/~master");
+ ensure_refname_invalid(SYM_REF, "~refs/heads/master");
+
+ ensure_refname_invalid(SYM_REF, "refs/heads/master:");
+ ensure_refname_invalid(SYM_REF, "refs/heads/:master");
+ ensure_refname_invalid(SYM_REF, ":refs/heads/master");
+
+/* ShellGlob */
+ ensure_refname_invalid(SYM_REF, "refs/heads/master?");
+ ensure_refname_invalid(SYM_REF, "refs/heads/?master");
+ ensure_refname_invalid(SYM_REF, "?refs/heads/master");
+
+ ensure_refname_invalid(SYM_REF, "refs/heads/master[");
+ ensure_refname_invalid(SYM_REF, "refs/heads/[master");
+ ensure_refname_invalid(SYM_REF, "[refs/heads/master");
+
+ ensure_refname_invalid(SYM_REF, "refs/heads/master*");
+ ensure_refname_invalid(SYM_REF, "refs/heads/*master");
+ ensure_refname_invalid(SYM_REF, "*refs/heads/master");
+
+/* ValidSpecialCharacters */
+ ensure_refname_normalized(SYM_REF, "refs/heads/!", "refs/heads/!");
+ ensure_refname_normalized(SYM_REF, "refs/heads/\"", "refs/heads/\"");
+ ensure_refname_normalized(SYM_REF, "refs/heads/#", "refs/heads/#");
+ ensure_refname_normalized(SYM_REF, "refs/heads/$", "refs/heads/$");
+ ensure_refname_normalized(SYM_REF, "refs/heads/%", "refs/heads/%");
+ ensure_refname_normalized(SYM_REF, "refs/heads/&", "refs/heads/&");
+ ensure_refname_normalized(SYM_REF, "refs/heads/'", "refs/heads/'");
+ ensure_refname_normalized(SYM_REF, "refs/heads/(", "refs/heads/(");
+ ensure_refname_normalized(SYM_REF, "refs/heads/)", "refs/heads/)");
+ ensure_refname_normalized(SYM_REF, "refs/heads/+", "refs/heads/+");
+ ensure_refname_normalized(SYM_REF, "refs/heads/,", "refs/heads/,");
+ ensure_refname_normalized(SYM_REF, "refs/heads/-", "refs/heads/-");
+ ensure_refname_normalized(SYM_REF, "refs/heads/;", "refs/heads/;");
+ ensure_refname_normalized(SYM_REF, "refs/heads/<", "refs/heads/<");
+ ensure_refname_normalized(SYM_REF, "refs/heads/=", "refs/heads/=");
+ ensure_refname_normalized(SYM_REF, "refs/heads/>", "refs/heads/>");
+ ensure_refname_normalized(SYM_REF, "refs/heads/@", "refs/heads/@");
+ ensure_refname_normalized(SYM_REF, "refs/heads/]", "refs/heads/]");
+ ensure_refname_normalized(SYM_REF, "refs/heads/_", "refs/heads/_");
+ ensure_refname_normalized(SYM_REF, "refs/heads/`", "refs/heads/`");
+ ensure_refname_normalized(SYM_REF, "refs/heads/{", "refs/heads/{");
+ ensure_refname_normalized(SYM_REF, "refs/heads/|", "refs/heads/|");
+ ensure_refname_normalized(SYM_REF, "refs/heads/}", "refs/heads/}");
+
+ // This is valid on UNIX, but not on Windows
+ // hence we make in invalid due to non-portability
+ //
+ ensure_refname_invalid(SYM_REF, "refs/heads/\\");
+
+/* UnicodeNames */
+ /*
+ * Currently this fails.
+ * ensure_refname_normalized(SYM_REF, "refs/heads/\u00e5ngstr\u00f6m", "refs/heads/\u00e5ngstr\u00f6m");
+ */
+
+/* RefLogQueryIsValidRef */
+ ensure_refname_invalid(SYM_REF, "refs/heads/master@{1}");
+ ensure_refname_invalid(SYM_REF, "refs/heads/master@{1.hour.ago}");
+}
diff --git a/tests-clar/refs/overwrite.c b/tests-clar/refs/overwrite.c
new file mode 100644
index 0000000..60d3149
--- /dev/null
+++ b/tests-clar/refs/overwrite.c
@@ -0,0 +1,140 @@
+#include "clar_libgit2.h"
+
+#include "repository.h"
+#include "git2/reflog.h"
+#include "reflog.h"
+
+static const char *ref_name = "refs/heads/other";
+static const char *ref_master_name = "refs/heads/master";
+static const char *ref_branch_name = "refs/heads/branch";
+static const char *ref_test_name = "refs/heads/test";
+
+static git_repository *g_repo;
+
+
+
+void test_ref_overwrite__initialize(void)
+{
+ g_repo = cl_git_sandbox_init("testrepo");
+}
+
+void test_ref_overwrite__cleanup(void)
+{
+ cl_git_sandbox_cleanup();
+}
+
+
+
+void test_ref_overwrite__symbolic(void)
+{
+ // Overwrite an existing symbolic reference
+ git_reference *ref, *branch_ref;
+
+ /* The target needds to exist and we need to check the name has changed */
+ cl_git_pass(git_reference_create_symbolic(&branch_ref, g_repo, ref_branch_name, ref_master_name, 0));
+ cl_git_pass(git_reference_create_symbolic(&ref, g_repo, ref_name, ref_branch_name, 0));
+ git_reference_free(ref);
+
+ /* Ensure it points to the right place*/
+ cl_git_pass(git_reference_lookup(&ref, g_repo, ref_name));
+ cl_assert(git_reference_type(ref) & GIT_REF_SYMBOLIC);
+ cl_assert_strequal(git_reference_target(ref), ref_branch_name);
+ git_reference_free(ref);
+
+ /* Ensure we can't create it unless we force it to */
+ cl_git_fail(git_reference_create_symbolic(&ref, g_repo, ref_name, ref_master_name, 0));
+ cl_git_pass(git_reference_create_symbolic(&ref, g_repo, ref_name, ref_master_name, 1));
+ git_reference_free(ref);
+
+ /* Ensure it points to the right place */
+ cl_git_pass(git_reference_lookup(&ref, g_repo, ref_name));
+ cl_assert(git_reference_type(ref) & GIT_REF_SYMBOLIC);
+ cl_assert_strequal(git_reference_target(ref), ref_master_name);
+
+ git_reference_free(ref);
+ git_reference_free(branch_ref);
+}
+
+void test_ref_overwrite__object_id(void)
+{
+ // Overwrite an existing object id reference
+ git_reference *ref;
+ git_oid id;
+
+ cl_git_pass(git_reference_lookup(&ref, g_repo, ref_master_name));
+ cl_assert(git_reference_type(ref) & GIT_REF_OID);
+ git_oid_cpy(&id, git_reference_oid(ref));
+ git_reference_free(ref);
+
+ /* Create it */
+ cl_git_pass(git_reference_create_oid(&ref, g_repo, ref_name, &id, 0));
+ git_reference_free(ref);
+
+ cl_git_pass(git_reference_lookup(&ref, g_repo, ref_test_name));
+ cl_assert(git_reference_type(ref) & GIT_REF_OID);
+ git_oid_cpy(&id, git_reference_oid(ref));
+ git_reference_free(ref);
+
+ /* Ensure we can't overwrite unless we force it */
+ cl_git_fail(git_reference_create_oid(&ref, g_repo, ref_name, &id, 0));
+ cl_git_pass(git_reference_create_oid(&ref, g_repo, ref_name, &id, 1));
+ git_reference_free(ref);
+
+ /* Ensure it has been overwritten */
+ cl_git_pass(git_reference_lookup(&ref, g_repo, ref_name));
+ cl_assert(!git_oid_cmp(&id, git_reference_oid(ref)));
+
+ git_reference_free(ref);
+}
+
+void test_ref_overwrite__object_id_with_symbolic(void)
+{
+ // Overwrite an existing object id reference with a symbolic one
+ git_reference *ref;
+ git_oid id;
+
+ cl_git_pass(git_reference_lookup(&ref, g_repo, ref_master_name));
+ cl_assert(git_reference_type(ref) & GIT_REF_OID);
+ git_oid_cpy(&id, git_reference_oid(ref));
+ git_reference_free(ref);
+
+ cl_git_pass(git_reference_create_oid(&ref, g_repo, ref_name, &id, 0));
+ git_reference_free(ref);
+ cl_git_fail(git_reference_create_symbolic(&ref, g_repo, ref_name, ref_master_name, 0));
+ cl_git_pass(git_reference_create_symbolic(&ref, g_repo, ref_name, ref_master_name, 1));
+ git_reference_free(ref);
+
+ /* Ensure it points to the right place */
+ cl_git_pass(git_reference_lookup(&ref, g_repo, ref_name));
+ cl_assert(git_reference_type(ref) & GIT_REF_SYMBOLIC);
+ cl_assert_strequal(git_reference_target(ref), ref_master_name);
+
+ git_reference_free(ref);
+}
+
+void test_ref_overwrite__symbolic_with_object_id(void)
+{
+ // Overwrite an existing symbolic reference with an object id one
+ git_reference *ref;
+ git_oid id;
+
+ cl_git_pass(git_reference_lookup(&ref, g_repo, ref_master_name));
+ cl_assert(git_reference_type(ref) & GIT_REF_OID);
+ git_oid_cpy(&id, git_reference_oid(ref));
+ git_reference_free(ref);
+
+ /* Create the symbolic ref */
+ cl_git_pass(git_reference_create_symbolic(&ref, g_repo, ref_name, ref_master_name, 0));
+ git_reference_free(ref);
+ /* It shouldn't overwrite unless we tell it to */
+ cl_git_fail(git_reference_create_oid(&ref, g_repo, ref_name, &id, 0));
+ cl_git_pass(git_reference_create_oid(&ref, g_repo, ref_name, &id, 1));
+ git_reference_free(ref);
+
+ /* Ensure it points to the right place */
+ cl_git_pass(git_reference_lookup(&ref, g_repo, ref_name));
+ cl_assert(git_reference_type(ref) & GIT_REF_OID);
+ cl_assert(!git_oid_cmp(git_reference_oid(ref), &id));
+
+ git_reference_free(ref);
+}
diff --git a/tests-clar/refs/pack.c b/tests-clar/refs/pack.c
new file mode 100644
index 0000000..6bb42cd
--- /dev/null
+++ b/tests-clar/refs/pack.c
@@ -0,0 +1,71 @@
+#include "clar_libgit2.h"
+
+#include "repository.h"
+#include "git2/reflog.h"
+#include "reflog.h"
+
+static const char *loose_tag_ref_name = "refs/tags/e90810b";
+
+static git_repository *g_repo;
+
+
+
+void test_ref_pack__initialize(void)
+{
+ g_repo = cl_git_sandbox_init("testrepo");
+}
+
+void test_ref_pack__cleanup(void)
+{
+ cl_git_sandbox_cleanup();
+}
+
+
+
+void test_ref_pack__empty(void)
+{
+ // create a packfile for an empty folder
+ git_buf temp_path = GIT_BUF_INIT;
+
+ cl_git_pass(git_buf_join_n(&temp_path, '/', 3, g_repo->path_repository, GIT_REFS_HEADS_DIR, "empty_dir"));
+ cl_git_pass(git_futils_mkdir_r(temp_path.ptr, NULL, GIT_REFS_DIR_MODE));
+ git_buf_free(&temp_path);
+
+ cl_git_pass(git_reference_packall(g_repo));
+}
+
+void test_ref_pack__loose(void)
+{
+ // create a packfile from all the loose rn a repo
+ git_reference *reference;
+ git_buf temp_path = GIT_BUF_INIT;
+
+ /* Ensure a known loose ref can be looked up */
+ cl_git_pass(git_reference_lookup(&reference, g_repo, loose_tag_ref_name));
+ cl_assert(git_reference_is_packed(reference) == 0);
+ cl_assert_strequal(reference->name, loose_tag_ref_name);
+ git_reference_free(reference);
+
+ /*
+ * We are now trying to pack also a loose reference
+ * called `points_to_blob`, to make sure we can properly
+ * pack weak tags
+ */
+ cl_git_pass(git_reference_packall(g_repo));
+
+ /* Ensure the packed-refs file exists */
+ cl_git_pass(git_buf_joinpath(&temp_path, g_repo->path_repository, GIT_PACKEDREFS_FILE));
+ cl_git_pass(git_path_exists(temp_path.ptr));
+
+ /* Ensure the known ref can still be looked up but is now packed */
+ cl_git_pass(git_reference_lookup(&reference, g_repo, loose_tag_ref_name));
+ cl_assert(git_reference_is_packed(reference));
+ cl_assert_strequal(reference->name, loose_tag_ref_name);
+
+ /* Ensure the known ref has been removed from the loose folder structure */
+ cl_git_pass(git_buf_joinpath(&temp_path, g_repo->path_repository, loose_tag_ref_name));
+ cl_git_pass(!git_path_exists(temp_path.ptr));
+
+ git_reference_free(reference);
+ git_buf_free(&temp_path);
+}
diff --git a/tests-clar/refs/read.c b/tests-clar/refs/read.c
new file mode 100644
index 0000000..f26fb63
--- /dev/null
+++ b/tests-clar/refs/read.c
@@ -0,0 +1,199 @@
+#include "clar_libgit2.h"
+
+#include "repository.h"
+#include "git2/reflog.h"
+#include "reflog.h"
+
+
+static const char *loose_tag_ref_name = "refs/tags/e90810b";
+static const char *non_existing_tag_ref_name = "refs/tags/i-do-not-exist";
+static const char *head_tracker_sym_ref_name = "head-tracker";
+static const char *current_head_target = "refs/heads/master";
+static const char *current_master_tip = "a65fedf39aefe402d3bb6e24df4d4f5fe4547750";
+static const char *packed_head_name = "refs/heads/packed";
+static const char *packed_test_head_name = "refs/heads/packed-test";
+
+static git_repository *g_repo;
+
+
+
+void test_ref_read__initialize(void)
+{
+ g_repo = cl_git_sandbox_init("testrepo");
+}
+
+void test_ref_read__cleanup(void)
+{
+ cl_git_sandbox_cleanup();
+}
+
+
+
+void test_ref_read__loose_tag(void)
+{
+ // lookup a loose tag reference
+ git_reference *reference;
+ git_object *object;
+ git_buf ref_name_from_tag_name = GIT_BUF_INIT;
+
+ cl_git_pass(git_reference_lookup(&reference, g_repo, loose_tag_ref_name));
+ cl_assert(git_reference_type(reference) & GIT_REF_OID);
+ cl_assert(git_reference_is_packed(reference) == 0);
+ cl_assert_strequal(reference->name, loose_tag_ref_name);
+
+ cl_git_pass(git_object_lookup(&object, g_repo, git_reference_oid(reference), GIT_OBJ_ANY));
+ cl_assert(object != NULL);
+ cl_assert(git_object_type(object) == GIT_OBJ_TAG);
+
+ /* Ensure the name of the tag matches the name of the reference */
+ cl_git_pass(git_buf_joinpath(&ref_name_from_tag_name, GIT_REFS_TAGS_DIR, git_tag_name((git_tag *)object)));
+ cl_assert_strequal(ref_name_from_tag_name.ptr, loose_tag_ref_name);
+ git_buf_free(&ref_name_from_tag_name);
+
+ git_object_free(object);
+
+ git_reference_free(reference);
+}
+
+void test_ref_read__nonexisting_tag(void)
+{
+ // lookup a loose tag reference that doesn't exist
+ git_reference *reference;
+
+ cl_git_fail(git_reference_lookup(&reference, g_repo, non_existing_tag_ref_name));
+
+ git_reference_free(reference);
+}
+
+
+void test_ref_read__symbolic(void)
+{
+ // lookup a symbolic reference
+ git_reference *reference, *resolved_ref;
+ git_object *object;
+ git_oid id;
+
+ cl_git_pass(git_reference_lookup(&reference, g_repo, GIT_HEAD_FILE));
+ cl_assert(git_reference_type(reference) & GIT_REF_SYMBOLIC);
+ cl_assert(git_reference_is_packed(reference) == 0);
+ cl_assert_strequal(reference->name, GIT_HEAD_FILE);
+
+ cl_git_pass(git_reference_resolve(&resolved_ref, reference));
+ cl_assert(git_reference_type(resolved_ref) == GIT_REF_OID);
+
+ cl_git_pass(git_object_lookup(&object, g_repo, git_reference_oid(resolved_ref), GIT_OBJ_ANY));
+ cl_assert(object != NULL);
+ cl_assert(git_object_type(object) == GIT_OBJ_COMMIT);
+
+ git_oid_fromstr(&id, current_master_tip);
+ cl_assert(git_oid_cmp(&id, git_object_id(object)) == 0);
+
+ git_object_free(object);
+
+ git_reference_free(reference);
+ git_reference_free(resolved_ref);
+}
+
+void test_ref_read__nested_symbolic(void)
+{
+ // lookup a nested symbolic reference
+ git_reference *reference, *resolved_ref;
+ git_object *object;
+ git_oid id;
+
+ cl_git_pass(git_reference_lookup(&reference, g_repo, head_tracker_sym_ref_name));
+ cl_assert(git_reference_type(reference) & GIT_REF_SYMBOLIC);
+ cl_assert(git_reference_is_packed(reference) == 0);
+ cl_assert_strequal(reference->name, head_tracker_sym_ref_name);
+
+ cl_git_pass(git_reference_resolve(&resolved_ref, reference));
+ cl_assert(git_reference_type(resolved_ref) == GIT_REF_OID);
+
+ cl_git_pass(git_object_lookup(&object, g_repo, git_reference_oid(resolved_ref), GIT_OBJ_ANY));
+ cl_assert(object != NULL);
+ cl_assert(git_object_type(object) == GIT_OBJ_COMMIT);
+
+ git_oid_fromstr(&id, current_master_tip);
+ cl_assert(git_oid_cmp(&id, git_object_id(object)) == 0);
+
+ git_object_free(object);
+
+ git_reference_free(reference);
+ git_reference_free(resolved_ref);
+}
+
+void test_ref_read__head_then_master(void)
+{
+ // lookup the HEAD and resolve the master branch
+ git_reference *reference, *resolved_ref, *comp_base_ref;
+
+ cl_git_pass(git_reference_lookup(&reference, g_repo, head_tracker_sym_ref_name));
+ cl_git_pass(git_reference_resolve(&comp_base_ref, reference));
+ git_reference_free(reference);
+
+ cl_git_pass(git_reference_lookup(&reference, g_repo, GIT_HEAD_FILE));
+ cl_git_pass(git_reference_resolve(&resolved_ref, reference));
+ cl_git_pass(git_oid_cmp(git_reference_oid(comp_base_ref), git_reference_oid(resolved_ref)));
+ git_reference_free(reference);
+ git_reference_free(resolved_ref);
+
+ cl_git_pass(git_reference_lookup(&reference, g_repo, current_head_target));
+ cl_git_pass(git_reference_resolve(&resolved_ref, reference));
+ cl_git_pass(git_oid_cmp(git_reference_oid(comp_base_ref), git_reference_oid(resolved_ref)));
+ git_reference_free(reference);
+ git_reference_free(resolved_ref);
+
+ git_reference_free(comp_base_ref);
+}
+
+void test_ref_read__master_then_head(void)
+{
+ // lookup the master branch and then the HEAD
+ git_reference *reference, *master_ref, *resolved_ref;
+
+ cl_git_pass(git_reference_lookup(&master_ref, g_repo, current_head_target));
+ cl_git_pass(git_reference_lookup(&reference, g_repo, GIT_HEAD_FILE));
+
+ cl_git_pass(git_reference_resolve(&resolved_ref, reference));
+ cl_git_pass(git_oid_cmp(git_reference_oid(master_ref), git_reference_oid(resolved_ref)));
+
+ git_reference_free(reference);
+ git_reference_free(resolved_ref);
+ git_reference_free(master_ref);
+}
+
+
+void test_ref_read__packed(void)
+{
+ // lookup a packed reference
+ git_reference *reference;
+ git_object *object;
+
+ cl_git_pass(git_reference_lookup(&reference, g_repo, packed_head_name));
+ cl_assert(git_reference_type(reference) & GIT_REF_OID);
+ cl_assert(git_reference_is_packed(reference));
+ cl_assert_strequal(reference->name, packed_head_name);
+
+ cl_git_pass(git_object_lookup(&object, g_repo, git_reference_oid(reference), GIT_OBJ_ANY));
+ cl_assert(object != NULL);
+ cl_assert(git_object_type(object) == GIT_OBJ_COMMIT);
+
+ git_object_free(object);
+
+ git_reference_free(reference);
+}
+
+void test_ref_read__loose_first(void)
+{
+ // assure that a loose reference is looked up before a packed reference
+ git_reference *reference;
+
+ cl_git_pass(git_reference_lookup(&reference, g_repo, packed_head_name));
+ git_reference_free(reference);
+ cl_git_pass(git_reference_lookup(&reference, g_repo, packed_test_head_name));
+ cl_assert(git_reference_type(reference) & GIT_REF_OID);
+ cl_assert(git_reference_is_packed(reference) == 0);
+ cl_assert_strequal(reference->name, packed_test_head_name);
+
+ git_reference_free(reference);
+}
diff --git a/tests-clar/refs/reflog.c b/tests-clar/refs/reflog.c
new file mode 100644
index 0000000..8000e48
--- /dev/null
+++ b/tests-clar/refs/reflog.c
@@ -0,0 +1,123 @@
+#include "clar_libgit2.h"
+
+#include "repository.h"
+#include "git2/reflog.h"
+#include "reflog.h"
+
+
+static const char *new_ref = "refs/heads/test-reflog";
+static const char *current_master_tip = "a65fedf39aefe402d3bb6e24df4d4f5fe4547750";
+static const char *commit_msg = "commit: bla bla";
+
+static git_repository *g_repo;
+
+
+// helpers
+static void assert_signature(git_signature *expected, git_signature *actual)
+{
+ cl_assert(actual);
+ cl_assert_strequal(expected->name, actual->name);
+ cl_assert_strequal(expected->email, actual->email);
+ cl_assert(expected->when.offset == actual->when.offset);
+ cl_assert(expected->when.time == actual->when.time);
+}
+
+
+// Fixture setup and teardown
+void test_refs_reflog__initialize(void)
+{
+ g_repo = cl_git_sandbox_init("testrepo");
+}
+
+void test_refs_reflog__cleanup(void)
+{
+ cl_git_sandbox_cleanup();
+}
+
+
+
+void test_refs_reflog__write_then_read(void)
+{
+ // write a reflog for a given reference and ensure it can be read back
+ git_repository *repo2;
+ git_reference *ref, *lookedup_ref;
+ git_oid oid;
+ git_signature *committer;
+ git_reflog *reflog;
+ git_reflog_entry *entry;
+ char oid_str[GIT_OID_HEXSZ+1];
+
+ /* Create a new branch pointing at the HEAD */
+ git_oid_fromstr(&oid, current_master_tip);
+ cl_git_pass(git_reference_create_oid(&ref, g_repo, new_ref, &oid, 0));
+ git_reference_free(ref);
+ cl_git_pass(git_reference_lookup(&ref, g_repo, new_ref));
+
+ cl_git_pass(git_signature_now(&committer, "foo", "foo@bar"));
+
+ cl_git_pass(git_reflog_write(ref, NULL, committer, NULL));
+ cl_git_fail(git_reflog_write(ref, NULL, committer, "no ancestor NULL for an existing reflog"));
+ cl_git_fail(git_reflog_write(ref, NULL, committer, "no\nnewline"));
+ cl_git_pass(git_reflog_write(ref, &oid, committer, commit_msg));
+
+ /* Reopen a new instance of the repository */
+ cl_git_pass(git_repository_open(&repo2, "testrepo"));
+
+ /* Lookup the preivously created branch */
+ cl_git_pass(git_reference_lookup(&lookedup_ref, repo2, new_ref));
+
+ /* Read and parse the reflog for this branch */
+ cl_git_pass(git_reflog_read(&reflog, lookedup_ref));
+ cl_assert(reflog->entries.length == 2);
+
+ entry = (git_reflog_entry *)git_vector_get(&reflog->entries, 0);
+ assert_signature(committer, entry->committer);
+ git_oid_tostr(oid_str, GIT_OID_HEXSZ+1, &entry->oid_old);
+ cl_assert_strequal("0000000000000000000000000000000000000000", oid_str);
+ git_oid_tostr(oid_str, GIT_OID_HEXSZ+1, &entry->oid_cur);
+ cl_assert_strequal(current_master_tip, oid_str);
+ cl_assert(entry->msg == NULL);
+
+ entry = (git_reflog_entry *)git_vector_get(&reflog->entries, 1);
+ assert_signature(committer, entry->committer);
+ git_oid_tostr(oid_str, GIT_OID_HEXSZ+1, &entry->oid_old);
+ cl_assert_strequal(current_master_tip, oid_str);
+ git_oid_tostr(oid_str, GIT_OID_HEXSZ+1, &entry->oid_cur);
+ cl_assert_strequal(current_master_tip, oid_str);
+ cl_assert_strequal(commit_msg, entry->msg);
+
+ git_signature_free(committer);
+ git_reflog_free(reflog);
+ git_repository_free(repo2);
+
+ git_reference_free(ref);
+ git_reference_free(lookedup_ref);
+}
+
+void test_refs_reflog__dont_write_bad(void)
+{
+ // avoid writing an obviously wrong reflog
+ git_reference *ref;
+ git_oid oid;
+ git_signature *committer;
+
+ /* Create a new branch pointing at the HEAD */
+ git_oid_fromstr(&oid, current_master_tip);
+ cl_git_pass(git_reference_create_oid(&ref, g_repo, new_ref, &oid, 0));
+ git_reference_free(ref);
+ cl_git_pass(git_reference_lookup(&ref, g_repo, new_ref));
+
+ cl_git_pass(git_signature_now(&committer, "foo", "foo@bar"));
+
+ /* Write the reflog for the new branch */
+ cl_git_pass(git_reflog_write(ref, NULL, committer, NULL));
+
+ /* Try to update the reflog with wrong information:
+ * It's no new reference, so the ancestor OID cannot
+ * be NULL. */
+ cl_git_fail(git_reflog_write(ref, NULL, committer, NULL));
+
+ git_signature_free(committer);
+
+ git_reference_free(ref);
+}
diff --git a/tests-clar/refs/rename.c b/tests-clar/refs/rename.c
new file mode 100644
index 0000000..8e7c93c
--- /dev/null
+++ b/tests-clar/refs/rename.c
@@ -0,0 +1,339 @@
+#include "clar_libgit2.h"
+
+#include "repository.h"
+#include "git2/reflog.h"
+#include "reflog.h"
+
+static const char *loose_tag_ref_name = "refs/tags/e90810b";
+static const char *packed_head_name = "refs/heads/packed";
+static const char *packed_test_head_name = "refs/heads/packed-test";
+static const char *ref_one_name = "refs/heads/one/branch";
+static const char *ref_one_name_new = "refs/heads/two/branch";
+static const char *ref_two_name = "refs/heads/two";
+static const char *ref_master_name = "refs/heads/master";
+static const char *ref_two_name_new = "refs/heads/two/two";
+
+static git_repository *g_repo;
+
+
+
+void test_refs_rename__initialize(void)
+{
+ g_repo = cl_git_sandbox_init("testrepo");
+}
+
+void test_refs_rename__cleanup(void)
+{
+ cl_git_sandbox_cleanup();
+}
+
+
+
+void test_refs_rename__loose(void)
+{
+ // rename a loose reference
+ git_reference *looked_up_ref, *another_looked_up_ref;
+ git_buf temp_path = GIT_BUF_INIT;
+ const char *new_name = "refs/tags/Nemo/knows/refs.kung-fu";
+
+ /* Ensure the ref doesn't exist on the file system */
+ cl_git_pass(git_buf_joinpath(&temp_path, g_repo->path_repository, new_name));
+ cl_git_pass(!git_path_exists(temp_path.ptr));
+
+ /* Retrieval of the reference to rename */
+ cl_git_pass(git_reference_lookup(&looked_up_ref, g_repo, loose_tag_ref_name));
+
+ /* ... which is indeed loose */
+ cl_assert(git_reference_is_packed(looked_up_ref) == 0);
+
+ /* Now that the reference is renamed... */
+ cl_git_pass(git_reference_rename(looked_up_ref, new_name, 0));
+ cl_assert_strequal(looked_up_ref->name, new_name);
+
+ /* ...It can't be looked-up with the old name... */
+ cl_git_fail(git_reference_lookup(&another_looked_up_ref, g_repo, loose_tag_ref_name));
+
+ /* ...but the new name works ok... */
+ cl_git_pass(git_reference_lookup(&another_looked_up_ref, g_repo, new_name));
+ cl_assert_strequal(another_looked_up_ref->name, new_name);
+
+ /* .. the ref is still loose... */
+ cl_assert(git_reference_is_packed(another_looked_up_ref) == 0);
+ cl_assert(git_reference_is_packed(looked_up_ref) == 0);
+
+ /* ...and the ref can be found in the file system */
+ cl_git_pass(git_buf_joinpath(&temp_path, g_repo->path_repository, new_name));
+ cl_git_pass(git_path_exists(temp_path.ptr));
+
+ git_reference_free(looked_up_ref);
+ git_reference_free(another_looked_up_ref);
+ git_buf_free(&temp_path);
+}
+
+void test_refs_rename__packed(void)
+{
+ // rename a packed reference (should make it loose)
+ git_reference *looked_up_ref, *another_looked_up_ref;
+ git_buf temp_path = GIT_BUF_INIT;
+ const char *brand_new_name = "refs/heads/brand_new_name";
+
+ /* Ensure the ref doesn't exist on the file system */
+ cl_git_pass(git_buf_joinpath(&temp_path, g_repo->path_repository, packed_head_name));
+ cl_git_pass(!git_path_exists(temp_path.ptr));
+
+ /* The reference can however be looked-up... */
+ cl_git_pass(git_reference_lookup(&looked_up_ref, g_repo, packed_head_name));
+
+ /* .. and it's packed */
+ cl_assert(git_reference_is_packed(looked_up_ref) != 0);
+
+ /* Now that the reference is renamed... */
+ cl_git_pass(git_reference_rename(looked_up_ref, brand_new_name, 0));
+ cl_assert_strequal(looked_up_ref->name, brand_new_name);
+
+ /* ...It can't be looked-up with the old name... */
+ cl_git_fail(git_reference_lookup(&another_looked_up_ref, g_repo, packed_head_name));
+
+ /* ...but the new name works ok... */
+ cl_git_pass(git_reference_lookup(&another_looked_up_ref, g_repo, brand_new_name));
+ cl_assert_strequal(another_looked_up_ref->name, brand_new_name);
+
+ /* .. the ref is no longer packed... */
+ cl_assert(git_reference_is_packed(another_looked_up_ref) == 0);
+ cl_assert(git_reference_is_packed(looked_up_ref) == 0);
+
+ /* ...and the ref now happily lives in the file system */
+ cl_git_pass(git_buf_joinpath(&temp_path, g_repo->path_repository, brand_new_name));
+ cl_git_pass(git_path_exists(temp_path.ptr));
+
+ git_reference_free(looked_up_ref);
+ git_reference_free(another_looked_up_ref);
+ git_buf_free(&temp_path);
+}
+
+void test_refs_rename__packed_doesnt_pack_others(void)
+{
+ // renaming a packed reference does not pack another reference which happens to be in both loose and pack state
+ git_reference *looked_up_ref, *another_looked_up_ref;
+ git_buf temp_path = GIT_BUF_INIT;
+ const char *brand_new_name = "refs/heads/brand_new_name";
+
+ /* Ensure the other reference exists on the file system */
+ cl_git_pass(git_buf_joinpath(&temp_path, g_repo->path_repository, packed_test_head_name));
+ cl_git_pass(git_path_exists(temp_path.ptr));
+
+ /* Lookup the other reference */
+ cl_git_pass(git_reference_lookup(&another_looked_up_ref, g_repo, packed_test_head_name));
+
+ /* Ensure it's loose */
+ cl_assert(git_reference_is_packed(another_looked_up_ref) == 0);
+ git_reference_free(another_looked_up_ref);
+
+ /* Lookup the reference to rename */
+ cl_git_pass(git_reference_lookup(&looked_up_ref, g_repo, packed_head_name));
+
+ /* Ensure it's packed */
+ cl_assert(git_reference_is_packed(looked_up_ref) != 0);
+
+ /* Now that the reference is renamed... */
+ cl_git_pass(git_reference_rename(looked_up_ref, brand_new_name, 0));
+
+ /* Lookup the other reference */
+ cl_git_pass(git_reference_lookup(&another_looked_up_ref, g_repo, packed_test_head_name));
+
+ /* Ensure it's loose */
+ cl_assert(git_reference_is_packed(another_looked_up_ref) == 0);
+
+ /* Ensure the other ref still exists on the file system */
+ cl_git_pass(git_path_exists(temp_path.ptr));
+
+ git_reference_free(looked_up_ref);
+ git_reference_free(another_looked_up_ref);
+ git_buf_free(&temp_path);
+}
+
+void test_refs_rename__name_collision(void)
+{
+ // can not rename a reference with the name of an existing reference
+ git_reference *looked_up_ref;
+
+ /* An existing reference... */
+ cl_git_pass(git_reference_lookup(&looked_up_ref, g_repo, packed_head_name));
+
+ /* Can not be renamed to the name of another existing reference. */
+ cl_git_fail(git_reference_rename(looked_up_ref, packed_test_head_name, 0));
+ git_reference_free(looked_up_ref);
+
+ /* Failure to rename it hasn't corrupted its state */
+ cl_git_pass(git_reference_lookup(&looked_up_ref, g_repo, packed_head_name));
+ cl_assert_strequal(looked_up_ref->name, packed_head_name);
+
+ git_reference_free(looked_up_ref);
+}
+
+void test_refs_rename__invalid_name(void)
+{
+ // can not rename a reference with an invalid name
+ git_reference *looked_up_ref;
+
+ /* An existing oid reference... */
+ cl_git_pass(git_reference_lookup(&looked_up_ref, g_repo, packed_test_head_name));
+
+ /* Can not be renamed with an invalid name. */
+ cl_git_fail(git_reference_rename(looked_up_ref, "Hello! I'm a very invalid name.", 0));
+
+ /* Can not be renamed outside of the refs hierarchy. */
+ cl_git_fail(git_reference_rename(looked_up_ref, "i-will-sudo-you", 0));
+
+ /* Failure to rename it hasn't corrupted its state */
+ git_reference_free(looked_up_ref);
+ cl_git_pass(git_reference_lookup(&looked_up_ref, g_repo, packed_test_head_name));
+ cl_assert_strequal(looked_up_ref->name, packed_test_head_name);
+
+ git_reference_free(looked_up_ref);
+}
+
+void test_refs_rename__force_loose_packed(void)
+{
+ // can force-rename a packed reference with the name of an existing loose and packed reference
+ git_reference *looked_up_ref;
+ git_oid oid;
+
+ /* An existing reference... */
+ cl_git_pass(git_reference_lookup(&looked_up_ref, g_repo, packed_head_name));
+ git_oid_cpy(&oid, git_reference_oid(looked_up_ref));
+
+ /* Can be force-renamed to the name of another existing reference. */
+ cl_git_pass(git_reference_rename(looked_up_ref, packed_test_head_name, 1));
+ git_reference_free(looked_up_ref);
+
+ /* Check we actually renamed it */
+ cl_git_pass(git_reference_lookup(&looked_up_ref, g_repo, packed_test_head_name));
+ cl_assert_strequal(looked_up_ref->name, packed_test_head_name);
+ cl_assert(!git_oid_cmp(&oid, git_reference_oid(looked_up_ref)));
+ git_reference_free(looked_up_ref);
+
+ /* And that the previous one doesn't exist any longer */
+ cl_git_fail(git_reference_lookup(&looked_up_ref, g_repo, packed_head_name));
+}
+
+void test_refs_rename__force_loose(void)
+{
+ // can force-rename a loose reference with the name of an existing loose reference
+ git_reference *looked_up_ref;
+ git_oid oid;
+
+ /* An existing reference... */
+ cl_git_pass(git_reference_lookup(&looked_up_ref, g_repo, "refs/heads/br2"));
+ git_oid_cpy(&oid, git_reference_oid(looked_up_ref));
+
+ /* Can be force-renamed to the name of another existing reference. */
+ cl_git_pass(git_reference_rename(looked_up_ref, "refs/heads/test", 1));
+ git_reference_free(looked_up_ref);
+
+ /* Check we actually renamed it */
+ cl_git_pass(git_reference_lookup(&looked_up_ref, g_repo, "refs/heads/test"));
+ cl_assert_strequal(looked_up_ref->name, "refs/heads/test");
+ cl_assert(!git_oid_cmp(&oid, git_reference_oid(looked_up_ref)));
+ git_reference_free(looked_up_ref);
+
+ /* And that the previous one doesn't exist any longer */
+ cl_git_fail(git_reference_lookup(&looked_up_ref, g_repo, "refs/heads/br2"));
+
+ git_reference_free(looked_up_ref);
+}
+
+
+void test_refs_rename__overwrite(void)
+{
+ // can not overwrite name of existing reference
+ git_reference *ref, *ref_one, *ref_one_new, *ref_two;
+ git_oid id;
+
+ cl_git_pass(git_reference_lookup(&ref, g_repo, ref_master_name));
+ cl_assert(git_reference_type(ref) & GIT_REF_OID);
+
+ git_oid_cpy(&id, git_reference_oid(ref));
+
+ /* Create loose references */
+ cl_git_pass(git_reference_create_oid(&ref_one, g_repo, ref_one_name, &id, 0));
+ cl_git_pass(git_reference_create_oid(&ref_two, g_repo, ref_two_name, &id, 0));
+
+ /* Pack everything */
+ cl_git_pass(git_reference_packall(g_repo));
+
+ /* Attempt to create illegal reference */
+ cl_git_fail(git_reference_create_oid(&ref_one_new, g_repo, ref_one_name_new, &id, 0));
+
+ /* Illegal reference couldn't be created so this is supposed to fail */
+ cl_git_fail(git_reference_lookup(&ref_one_new, g_repo, ref_one_name_new));
+
+ git_reference_free(ref);
+ git_reference_free(ref_one);
+ git_reference_free(ref_one_new);
+ git_reference_free(ref_two);
+}
+
+
+void test_refs_rename__prefix(void)
+{
+ // can be renamed to a new name prefixed with the old name
+ git_reference *ref, *ref_two, *looked_up_ref;
+ git_oid id;
+
+ cl_git_pass(git_reference_lookup(&ref, g_repo, ref_master_name));
+ cl_assert(git_reference_type(ref) & GIT_REF_OID);
+
+ git_oid_cpy(&id, git_reference_oid(ref));
+
+ /* Create loose references */
+ cl_git_pass(git_reference_create_oid(&ref_two, g_repo, ref_two_name, &id, 0));
+
+ /* An existing reference... */
+ cl_git_pass(git_reference_lookup(&looked_up_ref, g_repo, ref_two_name));
+
+ /* Can be rename to a new name starting with the old name. */
+ cl_git_pass(git_reference_rename(looked_up_ref, ref_two_name_new, 0));
+ git_reference_free(looked_up_ref);
+
+ /* Check we actually renamed it */
+ cl_git_pass(git_reference_lookup(&looked_up_ref, g_repo, ref_two_name_new));
+ cl_assert_strequal(looked_up_ref->name, ref_two_name_new);
+ git_reference_free(looked_up_ref);
+ cl_git_fail(git_reference_lookup(&looked_up_ref, g_repo, ref_two_name));
+
+ git_reference_free(ref);
+ git_reference_free(ref_two);
+ git_reference_free(looked_up_ref);
+}
+
+void test_refs_rename__move_up(void)
+{
+ // can move a reference to a upper reference hierarchy
+ git_reference *ref, *ref_two, *looked_up_ref;
+ git_oid id;
+
+ cl_git_pass(git_reference_lookup(&ref, g_repo, ref_master_name));
+ cl_assert(git_reference_type(ref) & GIT_REF_OID);
+
+ git_oid_cpy(&id, git_reference_oid(ref));
+
+ /* Create loose references */
+ cl_git_pass(git_reference_create_oid(&ref_two, g_repo, ref_two_name_new, &id, 0));
+ git_reference_free(ref_two);
+
+ /* An existing reference... */
+ cl_git_pass(git_reference_lookup(&looked_up_ref, g_repo, ref_two_name_new));
+
+ /* Can be renamed upward the reference tree. */
+ cl_git_pass(git_reference_rename(looked_up_ref, ref_two_name, 0));
+ git_reference_free(looked_up_ref);
+
+ /* Check we actually renamed it */
+ cl_git_pass(git_reference_lookup(&looked_up_ref, g_repo, ref_two_name));
+ cl_assert_strequal(looked_up_ref->name, ref_two_name);
+ git_reference_free(looked_up_ref);
+ cl_git_fail(git_reference_lookup(&looked_up_ref, g_repo, ref_two_name_new));
+ git_reference_free(ref);
+ git_reference_free(looked_up_ref);
+}
diff --git a/tests-clar/repo/discover.c b/tests-clar/repo/discover.c
new file mode 100644
index 0000000..072e326
--- /dev/null
+++ b/tests-clar/repo/discover.c
@@ -0,0 +1,141 @@
+#include "clar_libgit2.h"
+
+#include "odb.h"
+#include "repository.h"
+
+
+#define TEMP_REPO_FOLDER "temprepo/"
+#define DISCOVER_FOLDER TEMP_REPO_FOLDER "discover.git"
+
+#define SUB_REPOSITORY_FOLDER_NAME "sub_repo"
+#define SUB_REPOSITORY_FOLDER DISCOVER_FOLDER "/" SUB_REPOSITORY_FOLDER_NAME
+#define SUB_REPOSITORY_FOLDER_SUB SUB_REPOSITORY_FOLDER "/sub"
+#define SUB_REPOSITORY_FOLDER_SUB_SUB SUB_REPOSITORY_FOLDER_SUB "/subsub"
+#define SUB_REPOSITORY_FOLDER_SUB_SUB_SUB SUB_REPOSITORY_FOLDER_SUB_SUB "/subsubsub"
+
+#define REPOSITORY_ALTERNATE_FOLDER DISCOVER_FOLDER "/alternate_sub_repo"
+#define REPOSITORY_ALTERNATE_FOLDER_SUB REPOSITORY_ALTERNATE_FOLDER "/sub"
+#define REPOSITORY_ALTERNATE_FOLDER_SUB_SUB REPOSITORY_ALTERNATE_FOLDER_SUB "/subsub"
+#define REPOSITORY_ALTERNATE_FOLDER_SUB_SUB_SUB REPOSITORY_ALTERNATE_FOLDER_SUB_SUB "/subsubsub"
+
+#define ALTERNATE_MALFORMED_FOLDER1 DISCOVER_FOLDER "/alternate_malformed_repo1"
+#define ALTERNATE_MALFORMED_FOLDER2 DISCOVER_FOLDER "/alternate_malformed_repo2"
+#define ALTERNATE_MALFORMED_FOLDER3 DISCOVER_FOLDER "/alternate_malformed_repo3"
+#define ALTERNATE_NOT_FOUND_FOLDER DISCOVER_FOLDER "/alternate_not_found_repo"
+
+static void ensure_repository_discover(const char *start_path,
+ const char *ceiling_dirs,
+ const char *expected_path)
+{
+ char found_path[GIT_PATH_MAX];
+ cl_git_pass(git_repository_discover(found_path, sizeof(found_path), start_path, 0, ceiling_dirs));
+ //across_fs is always 0 as we can't automate the filesystem change tests
+ cl_assert_strequal(found_path, expected_path);
+}
+
+static void write_file(const char *path, const char *content)
+{
+ git_file file;
+ int error;
+
+ if (git_path_exists(path) == GIT_SUCCESS) {
+ cl_git_pass(p_unlink(path));
+ }
+
+ file = git_futils_creat_withpath(path, 0777, 0666);
+ cl_assert(file >= 0);
+
+ error = p_write(file, content, strlen(content) * sizeof(char));
+ p_close(file);
+ cl_git_pass(error);
+}
+
+//no check is performed on ceiling_dirs length, so be sure it's long enough
+static void append_ceiling_dir(git_buf *ceiling_dirs, const char *path)
+{
+ git_buf pretty_path = GIT_BUF_INIT;
+ char ceiling_separator[2] = { GIT_PATH_LIST_SEPARATOR, '\0' };
+
+ cl_git_pass(git_path_prettify_dir(&pretty_path, path, NULL));
+
+ if (ceiling_dirs->size > 0)
+ git_buf_puts(ceiling_dirs, ceiling_separator);
+ git_buf_puts(ceiling_dirs, pretty_path.ptr);
+
+ git_buf_free(&pretty_path);
+ cl_git_pass(git_buf_lasterror(ceiling_dirs));
+}
+
+void test_repo_discover__0(void)
+{
+ // test discover
+ git_repository *repo;
+ git_buf ceiling_dirs_buf = GIT_BUF_INIT;
+ const char *ceiling_dirs;
+ char repository_path[GIT_PATH_MAX];
+ char sub_repository_path[GIT_PATH_MAX];
+ char found_path[GIT_PATH_MAX];
+ const mode_t mode = 0777;
+
+ git_futils_mkdir_r(DISCOVER_FOLDER, NULL, mode);
+ append_ceiling_dir(&ceiling_dirs_buf, TEMP_REPO_FOLDER);
+ ceiling_dirs = git_buf_cstr(&ceiling_dirs_buf);
+
+ cl_assert(git_repository_discover(repository_path, sizeof(repository_path), DISCOVER_FOLDER, 0, ceiling_dirs) == GIT_ENOTAREPO);
+
+ cl_git_pass(git_repository_init(&repo, DISCOVER_FOLDER, 1));
+ cl_git_pass(git_repository_discover(repository_path, sizeof(repository_path), DISCOVER_FOLDER, 0, ceiling_dirs));
+ git_repository_free(repo);
+
+ cl_git_pass(git_repository_init(&repo, SUB_REPOSITORY_FOLDER, 0));
+ cl_git_pass(git_futils_mkdir_r(SUB_REPOSITORY_FOLDER_SUB_SUB_SUB, NULL, mode));
+ cl_git_pass(git_repository_discover(sub_repository_path, sizeof(sub_repository_path), SUB_REPOSITORY_FOLDER, 0, ceiling_dirs));
+
+ cl_git_pass(git_futils_mkdir_r(SUB_REPOSITORY_FOLDER_SUB_SUB_SUB, NULL, mode));
+ ensure_repository_discover(SUB_REPOSITORY_FOLDER_SUB, ceiling_dirs, sub_repository_path);
+ ensure_repository_discover(SUB_REPOSITORY_FOLDER_SUB_SUB, ceiling_dirs, sub_repository_path);
+ ensure_repository_discover(SUB_REPOSITORY_FOLDER_SUB_SUB_SUB, ceiling_dirs, sub_repository_path);
+
+ cl_git_pass(git_futils_mkdir_r(REPOSITORY_ALTERNATE_FOLDER_SUB_SUB_SUB, NULL, mode));
+ write_file(REPOSITORY_ALTERNATE_FOLDER "/" DOT_GIT, "gitdir: ../" SUB_REPOSITORY_FOLDER_NAME "/" DOT_GIT);
+ write_file(REPOSITORY_ALTERNATE_FOLDER_SUB_SUB "/" DOT_GIT, "gitdir: ../../../" SUB_REPOSITORY_FOLDER_NAME "/" DOT_GIT);
+ write_file(REPOSITORY_ALTERNATE_FOLDER_SUB_SUB_SUB "/" DOT_GIT, "gitdir: ../../../../");
+ ensure_repository_discover(REPOSITORY_ALTERNATE_FOLDER, ceiling_dirs, sub_repository_path);
+ ensure_repository_discover(REPOSITORY_ALTERNATE_FOLDER_SUB, ceiling_dirs, sub_repository_path);
+ ensure_repository_discover(REPOSITORY_ALTERNATE_FOLDER_SUB_SUB, ceiling_dirs, sub_repository_path);
+ ensure_repository_discover(REPOSITORY_ALTERNATE_FOLDER_SUB_SUB_SUB, ceiling_dirs, repository_path);
+
+ cl_git_pass(git_futils_mkdir_r(ALTERNATE_MALFORMED_FOLDER1, NULL, mode));
+ write_file(ALTERNATE_MALFORMED_FOLDER1 "/" DOT_GIT, "Anything but not gitdir:");
+ cl_git_pass(git_futils_mkdir_r(ALTERNATE_MALFORMED_FOLDER2, NULL, mode));
+ write_file(ALTERNATE_MALFORMED_FOLDER2 "/" DOT_GIT, "gitdir:");
+ cl_git_pass(git_futils_mkdir_r(ALTERNATE_MALFORMED_FOLDER3, NULL, mode));
+ write_file(ALTERNATE_MALFORMED_FOLDER3 "/" DOT_GIT, "gitdir: \n\n\n");
+ cl_git_pass(git_futils_mkdir_r(ALTERNATE_NOT_FOUND_FOLDER, NULL, mode));
+ write_file(ALTERNATE_NOT_FOUND_FOLDER "/" DOT_GIT, "gitdir: a_repository_that_surely_does_not_exist");
+ cl_git_fail(git_repository_discover(found_path, sizeof(found_path), ALTERNATE_MALFORMED_FOLDER1, 0, ceiling_dirs));
+ cl_git_fail(git_repository_discover(found_path, sizeof(found_path), ALTERNATE_MALFORMED_FOLDER2, 0, ceiling_dirs));
+ cl_git_fail(git_repository_discover(found_path, sizeof(found_path), ALTERNATE_MALFORMED_FOLDER3, 0, ceiling_dirs));
+ cl_git_fail(git_repository_discover(found_path, sizeof(found_path), ALTERNATE_NOT_FOUND_FOLDER, 0, ceiling_dirs));
+
+ append_ceiling_dir(&ceiling_dirs_buf, SUB_REPOSITORY_FOLDER);
+ ceiling_dirs = git_buf_cstr(&ceiling_dirs_buf);
+
+ //this must pass as ceiling_directories cannot predent the current
+ //working directory to be checked
+ cl_git_pass(git_repository_discover(found_path, sizeof(found_path), SUB_REPOSITORY_FOLDER, 0, ceiling_dirs));
+ cl_git_fail(git_repository_discover(found_path, sizeof(found_path), SUB_REPOSITORY_FOLDER_SUB, 0, ceiling_dirs));
+ cl_git_fail(git_repository_discover(found_path, sizeof(found_path), SUB_REPOSITORY_FOLDER_SUB_SUB, 0, ceiling_dirs));
+ cl_git_fail(git_repository_discover(found_path, sizeof(found_path), SUB_REPOSITORY_FOLDER_SUB_SUB_SUB, 0, ceiling_dirs));
+
+ //.gitfile redirection should not be affected by ceiling directories
+ ensure_repository_discover(REPOSITORY_ALTERNATE_FOLDER, ceiling_dirs, sub_repository_path);
+ ensure_repository_discover(REPOSITORY_ALTERNATE_FOLDER_SUB, ceiling_dirs, sub_repository_path);
+ ensure_repository_discover(REPOSITORY_ALTERNATE_FOLDER_SUB_SUB, ceiling_dirs, sub_repository_path);
+ ensure_repository_discover(REPOSITORY_ALTERNATE_FOLDER_SUB_SUB_SUB, ceiling_dirs, repository_path);
+
+ cl_git_pass(git_futils_rmdir_r(TEMP_REPO_FOLDER, 1));
+ git_repository_free(repo);
+ git_buf_free(&ceiling_dirs_buf);
+}
+
diff --git a/tests-clar/resources/.gitattributes b/tests-clar/resources/.gitattributes
new file mode 100644
index 0000000..556f8c8
--- /dev/null
+++ b/tests-clar/resources/.gitattributes
@@ -0,0 +1 @@
+* binary
diff --git a/tests-clar/resources/.gitignore b/tests-clar/resources/.gitignore
new file mode 100644
index 0000000..43a19cc
--- /dev/null
+++ b/tests-clar/resources/.gitignore
@@ -0,0 +1 @@
+discover.git
diff --git a/tests-clar/resources/attr/.gitted/HEAD b/tests-clar/resources/attr/.gitted/HEAD
new file mode 100644
index 0000000..cb089cd
--- /dev/null
+++ b/tests-clar/resources/attr/.gitted/HEAD
@@ -0,0 +1 @@
+ref: refs/heads/master
diff --git a/tests-clar/resources/attr/.gitted/config b/tests-clar/resources/attr/.gitted/config
new file mode 100644
index 0000000..af10792
--- /dev/null
+++ b/tests-clar/resources/attr/.gitted/config
@@ -0,0 +1,6 @@
+[core]
+ repositoryformatversion = 0
+ filemode = true
+ bare = false
+ logallrefupdates = true
+ ignorecase = true
diff --git a/tests-clar/resources/attr/.gitted/description b/tests-clar/resources/attr/.gitted/description
new file mode 100644
index 0000000..498b267
--- /dev/null
+++ b/tests-clar/resources/attr/.gitted/description
@@ -0,0 +1 @@
+Unnamed repository; edit this file 'description' to name the repository.
diff --git a/tests-clar/resources/attr/.gitted/index b/tests-clar/resources/attr/.gitted/index
new file mode 100644
index 0000000..19fa99d
Binary files /dev/null and b/tests-clar/resources/attr/.gitted/index differ
diff --git a/tests-clar/resources/attr/.gitted/info/attributes b/tests-clar/resources/attr/.gitted/info/attributes
new file mode 100644
index 0000000..5fe62a3
--- /dev/null
+++ b/tests-clar/resources/attr/.gitted/info/attributes
@@ -0,0 +1,4 @@
+* repoattr
+a* foo !bar -baz
+sub/*.txt reposub
+sub/sub/*.txt reposubsub
diff --git a/tests-clar/resources/attr/.gitted/info/exclude b/tests-clar/resources/attr/.gitted/info/exclude
new file mode 100644
index 0000000..a5196d1
--- /dev/null
+++ b/tests-clar/resources/attr/.gitted/info/exclude
@@ -0,0 +1,6 @@
+# git ls-files --others --exclude-from=.git/info/exclude
+# Lines that start with '#' are comments.
+# For a project mostly in C, the following would be a good set of
+# exclude patterns (uncomment them if you want to use them):
+# *.[oa]
+# *~
diff --git a/tests-clar/resources/attr/.gitted/logs/HEAD b/tests-clar/resources/attr/.gitted/logs/HEAD
new file mode 100644
index 0000000..68fcff2
--- /dev/null
+++ b/tests-clar/resources/attr/.gitted/logs/HEAD
@@ -0,0 +1,6 @@
+0000000000000000000000000000000000000000 6bab5c79cd5140d0f800917f550eb2a3dc32b0da Russell Belfer <arrbee@arrbee.com> 1324416995 -0800 commit (initial): initial test data
+6bab5c79cd5140d0f800917f550eb2a3dc32b0da 605812ab7fe421fdd325a935d35cb06a9234a7d7 Russell Belfer <arrbee@arrbee.com> 1325143098 -0800 commit: latest test updates
+605812ab7fe421fdd325a935d35cb06a9234a7d7 a5d76cad53f66f1312bd995909a5bab3c0820770 Russell Belfer <arrbee@arrbee.com> 1325281762 -0800 commit: more macro tests
+a5d76cad53f66f1312bd995909a5bab3c0820770 370fe9ec224ce33e71f9e5ec2bd1142ce9937a6a Russell Belfer <arrbee@arrbee.com> 1327611749 -0800 commit: Updating files so we can do diffs
+370fe9ec224ce33e71f9e5ec2bd1142ce9937a6a f5b0af1fb4f5c0cd7aad880711d368a07333c307 Russell Belfer <arrbee@arrbee.com> 1327621027 -0800 commit: Updating test data
+f5b0af1fb4f5c0cd7aad880711d368a07333c307 a97cc019851d401a4f1d091cb91a15890a0dd1ba Russell Belfer <arrbee@arrbee.com> 1328653313 -0800 commit: Some whitespace only changes for testing purposes
diff --git a/tests-clar/resources/attr/.gitted/logs/refs/heads/master b/tests-clar/resources/attr/.gitted/logs/refs/heads/master
new file mode 100644
index 0000000..68fcff2
--- /dev/null
+++ b/tests-clar/resources/attr/.gitted/logs/refs/heads/master
@@ -0,0 +1,6 @@
+0000000000000000000000000000000000000000 6bab5c79cd5140d0f800917f550eb2a3dc32b0da Russell Belfer <arrbee@arrbee.com> 1324416995 -0800 commit (initial): initial test data
+6bab5c79cd5140d0f800917f550eb2a3dc32b0da 605812ab7fe421fdd325a935d35cb06a9234a7d7 Russell Belfer <arrbee@arrbee.com> 1325143098 -0800 commit: latest test updates
+605812ab7fe421fdd325a935d35cb06a9234a7d7 a5d76cad53f66f1312bd995909a5bab3c0820770 Russell Belfer <arrbee@arrbee.com> 1325281762 -0800 commit: more macro tests
+a5d76cad53f66f1312bd995909a5bab3c0820770 370fe9ec224ce33e71f9e5ec2bd1142ce9937a6a Russell Belfer <arrbee@arrbee.com> 1327611749 -0800 commit: Updating files so we can do diffs
+370fe9ec224ce33e71f9e5ec2bd1142ce9937a6a f5b0af1fb4f5c0cd7aad880711d368a07333c307 Russell Belfer <arrbee@arrbee.com> 1327621027 -0800 commit: Updating test data
+f5b0af1fb4f5c0cd7aad880711d368a07333c307 a97cc019851d401a4f1d091cb91a15890a0dd1ba Russell Belfer <arrbee@arrbee.com> 1328653313 -0800 commit: Some whitespace only changes for testing purposes
diff --git a/tests-clar/resources/attr/.gitted/objects/10/8bb4e7fd7b16490dc33ff7d972151e73d7166e b/tests-clar/resources/attr/.gitted/objects/10/8bb4e7fd7b16490dc33ff7d972151e73d7166e
new file mode 100644
index 0000000..edcf752
Binary files /dev/null and b/tests-clar/resources/attr/.gitted/objects/10/8bb4e7fd7b16490dc33ff7d972151e73d7166e differ
diff --git a/tests-clar/resources/attr/.gitted/objects/29/29de282ce999e95183aedac6451d3384559c4b b/tests-clar/resources/attr/.gitted/objects/29/29de282ce999e95183aedac6451d3384559c4b
new file mode 100644
index 0000000..ad84f08
Binary files /dev/null and b/tests-clar/resources/attr/.gitted/objects/29/29de282ce999e95183aedac6451d3384559c4b differ
diff --git a/tests-clar/resources/attr/.gitted/objects/2b/40c5aca159b04ea8d20ffe36cdf8b09369b14a b/tests-clar/resources/attr/.gitted/objects/2b/40c5aca159b04ea8d20ffe36cdf8b09369b14a
new file mode 100644
index 0000000..0e23680
--- /dev/null
+++ b/tests-clar/resources/attr/.gitted/objects/2b/40c5aca159b04ea8d20ffe36cdf8b09369b14a
@@ -0,0 +1 @@
+xmPÑj„0ì«ùŠ=úP8Z…ÞS¾¤”c£ñhR6{=¼¯obâ™Ò"šÙafvŒšœ‚÷×æéä#3‰Î¬=7Pÿ%[8<Heì`&]@?aFZª®ªç@!…÷.ÊÈù:±ù½§…•ldðÚLG|K’7~XÃN8¤˜·IÏdìê}¿øˆqŸó2cG¾œ7l¾5ÔV_pEûŸ®’#lZ´ŽGMòt[JÌÈͽ¥&©h¸±uÌ][‰Öß4‰-3;ËCˆg˜4¿x`ZÀ»YÃŒ“錻ú€bÝ^>ïyNlÍ£¡>c¯;gÓ•¥kÇYXÄ9b|Dª~VØ—)…v¿øñÎÜ•
\ No newline at end of file
diff --git a/tests-clar/resources/attr/.gitted/objects/2c/66e14f77196ea763fb1e41612c1aa2bc2d8ed2 b/tests-clar/resources/attr/.gitted/objects/2c/66e14f77196ea763fb1e41612c1aa2bc2d8ed2
new file mode 100644
index 0000000..4b75d50
Binary files /dev/null and b/tests-clar/resources/attr/.gitted/objects/2c/66e14f77196ea763fb1e41612c1aa2bc2d8ed2 differ
diff --git a/tests-clar/resources/attr/.gitted/objects/2d/e7dfe3588f3c7e9ad59e7d50ba90e3329df9d9 b/tests-clar/resources/attr/.gitted/objects/2d/e7dfe3588f3c7e9ad59e7d50ba90e3329df9d9
new file mode 100644
index 0000000..e0fd046
Binary files /dev/null and b/tests-clar/resources/attr/.gitted/objects/2d/e7dfe3588f3c7e9ad59e7d50ba90e3329df9d9 differ
diff --git a/tests-clar/resources/attr/.gitted/objects/37/0fe9ec224ce33e71f9e5ec2bd1142ce9937a6a b/tests-clar/resources/attr/.gitted/objects/37/0fe9ec224ce33e71f9e5ec2bd1142ce9937a6a
new file mode 100644
index 0000000..9c37c59
Binary files /dev/null and b/tests-clar/resources/attr/.gitted/objects/37/0fe9ec224ce33e71f9e5ec2bd1142ce9937a6a differ
diff --git a/tests-clar/resources/attr/.gitted/objects/3a/6df026462ebafe455af9867d27eda20a9e0974 b/tests-clar/resources/attr/.gitted/objects/3a/6df026462ebafe455af9867d27eda20a9e0974
new file mode 100644
index 0000000..c74add8
Binary files /dev/null and b/tests-clar/resources/attr/.gitted/objects/3a/6df026462ebafe455af9867d27eda20a9e0974 differ
diff --git a/tests-clar/resources/attr/.gitted/objects/3b/74db7ab381105dc0d28f8295a77f6a82989292 b/tests-clar/resources/attr/.gitted/objects/3b/74db7ab381105dc0d28f8295a77f6a82989292
new file mode 100644
index 0000000..e5cef35
Binary files /dev/null and b/tests-clar/resources/attr/.gitted/objects/3b/74db7ab381105dc0d28f8295a77f6a82989292 differ
diff --git a/tests-clar/resources/attr/.gitted/objects/3e/42ffc54a663f9401cc25843d6c0e71a33e4249 b/tests-clar/resources/attr/.gitted/objects/3e/42ffc54a663f9401cc25843d6c0e71a33e4249
new file mode 100644
index 0000000..091d79b
Binary files /dev/null and b/tests-clar/resources/attr/.gitted/objects/3e/42ffc54a663f9401cc25843d6c0e71a33e4249 differ
diff --git a/tests-clar/resources/attr/.gitted/objects/45/141a79a77842c59a63229403220a4e4be74e3d b/tests-clar/resources/attr/.gitted/objects/45/141a79a77842c59a63229403220a4e4be74e3d
new file mode 100644
index 0000000..5b58ef0
Binary files /dev/null and b/tests-clar/resources/attr/.gitted/objects/45/141a79a77842c59a63229403220a4e4be74e3d differ
diff --git a/tests-clar/resources/attr/.gitted/objects/4d/713dc48e6b1bd75b0d61ad078ba9ca3a56745d b/tests-clar/resources/attr/.gitted/objects/4d/713dc48e6b1bd75b0d61ad078ba9ca3a56745d
new file mode 100644
index 0000000..eb1e8d0
--- /dev/null
+++ b/tests-clar/resources/attr/.gitted/objects/4d/713dc48e6b1bd75b0d61ad078ba9ca3a56745d
@@ -0,0 +1,2 @@
+xÁÁ
€ @ßWŶàÇ
+|ø§k 9n$¡}gŠ«à:‡îÂ;5°1¥e–4ˆ\k_]‘ÞƒŸÙhœD¡k›ý'~
\ No newline at end of file
diff --git a/tests-clar/resources/attr/.gitted/objects/55/6f8c827b8e4a02ad5cab77dca2bcb3e226b0b3 b/tests-clar/resources/attr/.gitted/objects/55/6f8c827b8e4a02ad5cab77dca2bcb3e226b0b3
new file mode 100644
index 0000000..4bcff1f
Binary files /dev/null and b/tests-clar/resources/attr/.gitted/objects/55/6f8c827b8e4a02ad5cab77dca2bcb3e226b0b3 differ
diff --git a/tests-clar/resources/attr/.gitted/objects/58/19a185d77b03325aaf87cafc771db36f6ddca7 b/tests-clar/resources/attr/.gitted/objects/58/19a185d77b03325aaf87cafc771db36f6ddca7
new file mode 100644
index 0000000..fe34eb6
Binary files /dev/null and b/tests-clar/resources/attr/.gitted/objects/58/19a185d77b03325aaf87cafc771db36f6ddca7 differ
diff --git a/tests-clar/resources/attr/.gitted/objects/60/5812ab7fe421fdd325a935d35cb06a9234a7d7 b/tests-clar/resources/attr/.gitted/objects/60/5812ab7fe421fdd325a935d35cb06a9234a7d7
new file mode 100644
index 0000000..b0cc51e
--- /dev/null
+++ b/tests-clar/resources/attr/.gitted/objects/60/5812ab7fe421fdd325a935d35cb06a9234a7d7
@@ -0,0 +1,2 @@
+xNÛ
Â0ã;SÜ Ë»•BŒÀ—ËU ¥´JÓý °?¶lÙ–y™çgcáU RbaâÙcG;¸l²ã DqÖ Z©Ê«AH”<Ç‘³×3Nâ¨ãä=J2d3[“0“¢½=–
+÷}Û¤¸I™¤Â™jM"×x™/ é[ÇŽØçTwûÇÖãÿ´U¡&[ƒ/ìkþ(õtJL
\ No newline at end of file
diff --git a/tests-clar/resources/attr/.gitted/objects/6b/ab5c79cd5140d0f800917f550eb2a3dc32b0da b/tests-clar/resources/attr/.gitted/objects/6b/ab5c79cd5140d0f800917f550eb2a3dc32b0da
new file mode 100644
index 0000000..f51e11c
--- /dev/null
+++ b/tests-clar/resources/attr/.gitted/objects/6b/ab5c79cd5140d0f800917f550eb2a3dc32b0da
@@ -0,0 +1,3 @@
+xÛ Ã0Eûí)´@‹d'~@(¥#tÅQ¨ÁiÀQö¯¡ôëÂánÞ·(Pôm"Ř2æh°sL+d{—"{Zœ“`øÔ÷Þàu‡Ô
+O©«4˜¸µYäñ›[Þ·;³Ã@>¥®M§ýS»þOmʧhá
+*‡ÂÂÊæ¿<-
\ No newline at end of file
diff --git a/tests-clar/resources/attr/.gitted/objects/6d/968d62c89c7d9ea23a4c9a7b665d017c3d8ffd b/tests-clar/resources/attr/.gitted/objects/6d/968d62c89c7d9ea23a4c9a7b665d017c3d8ffd
new file mode 100644
index 0000000..e832241
Binary files /dev/null and b/tests-clar/resources/attr/.gitted/objects/6d/968d62c89c7d9ea23a4c9a7b665d017c3d8ffd differ
diff --git a/tests-clar/resources/attr/.gitted/objects/71/7fc31f6b84f9d6fc3a4edbca259d7fc92beee2 b/tests-clar/resources/attr/.gitted/objects/71/7fc31f6b84f9d6fc3a4edbca259d7fc92beee2
new file mode 100644
index 0000000..a80265c
Binary files /dev/null and b/tests-clar/resources/attr/.gitted/objects/71/7fc31f6b84f9d6fc3a4edbca259d7fc92beee2 differ
diff --git a/tests-clar/resources/attr/.gitted/objects/94/da4faa0a6bfb8ee6ccf7153801a69202b31857 b/tests-clar/resources/attr/.gitted/objects/94/da4faa0a6bfb8ee6ccf7153801a69202b31857
new file mode 100644
index 0000000..a9ddf5d
Binary files /dev/null and b/tests-clar/resources/attr/.gitted/objects/94/da4faa0a6bfb8ee6ccf7153801a69202b31857 differ
diff --git a/tests-clar/resources/attr/.gitted/objects/96/089fd31ce1d3ee2afb0ba09ba063066932f027 b/tests-clar/resources/attr/.gitted/objects/96/089fd31ce1d3ee2afb0ba09ba063066932f027
new file mode 100644
index 0000000..efa62f9
Binary files /dev/null and b/tests-clar/resources/attr/.gitted/objects/96/089fd31ce1d3ee2afb0ba09ba063066932f027 differ
diff --git a/tests-clar/resources/attr/.gitted/objects/99/eae476896f4907224978b88e5ecaa6c5bb67a9 b/tests-clar/resources/attr/.gitted/objects/99/eae476896f4907224978b88e5ecaa6c5bb67a9
new file mode 100644
index 0000000..8f5acc7
Binary files /dev/null and b/tests-clar/resources/attr/.gitted/objects/99/eae476896f4907224978b88e5ecaa6c5bb67a9 differ
diff --git a/tests-clar/resources/attr/.gitted/objects/9f/b40b6675dde60b5697afceae91b66d908c02d9 b/tests-clar/resources/attr/.gitted/objects/9f/b40b6675dde60b5697afceae91b66d908c02d9
new file mode 100644
index 0000000..7663ad0
Binary files /dev/null and b/tests-clar/resources/attr/.gitted/objects/9f/b40b6675dde60b5697afceae91b66d908c02d9 differ
diff --git a/tests-clar/resources/attr/.gitted/objects/a5/6bbcecaeac760cc26239384d2d4c614e7e4320 b/tests-clar/resources/attr/.gitted/objects/a5/6bbcecaeac760cc26239384d2d4c614e7e4320
new file mode 100644
index 0000000..d898ae9
Binary files /dev/null and b/tests-clar/resources/attr/.gitted/objects/a5/6bbcecaeac760cc26239384d2d4c614e7e4320 differ
diff --git a/tests-clar/resources/attr/.gitted/objects/a5/d76cad53f66f1312bd995909a5bab3c0820770 b/tests-clar/resources/attr/.gitted/objects/a5/d76cad53f66f1312bd995909a5bab3c0820770
new file mode 100644
index 0000000..cd6a389
--- /dev/null
+++ b/tests-clar/resources/attr/.gitted/objects/a5/d76cad53f66f1312bd995909a5bab3c0820770
@@ -0,0 +1,4 @@
+xŽ]
+‚!E{v³B>!"ZB;u¤à3Cmÿ í §‡{.7µZŸ4âavfÈÖgBLÊEeP;NQÚ¬BŒLAnŲIÆç ÞÔù5ÁI»)MÑ6Z•œQ[
+h3Úe:
+
ùì}æ£u¸Æà}‡ï…;œ©÷È|ýÅ)µzµ&ô¦¼Óp”›”bÑõq®ú?¶¨3TJ½Áä1‡ø3ÙJX
\ No newline at end of file
diff --git a/tests-clar/resources/attr/.gitted/objects/a9/7cc019851d401a4f1d091cb91a15890a0dd1ba b/tests-clar/resources/attr/.gitted/objects/a9/7cc019851d401a4f1d091cb91a15890a0dd1ba
new file mode 100644
index 0000000..1a7ec0c
--- /dev/null
+++ b/tests-clar/resources/attr/.gitted/objects/a9/7cc019851d401a4f1d091cb91a15890a0dd1ba
@@ -0,0 +1,2 @@
+xŽQjÄ0DûíSè[ähc;PJéÚ(²¼ $q°–Þ¾†Þ _3oàIÞ÷µÁàÜK+ªàâäBtƒ„I|œ”â»LìgçƈÖÅR4'=¤qFN6Í÷4
+JôÌ1ôÖFrÑ‘zÃW[r¯«VÝ6øÔ-i7.eVýø‹WÉû;X‚‰,Á
¢émwlÿÏÛ|ç]ṬMëÉ¢ídáã¡RwêC[œW9sÕj~’Wy
\ No newline at end of file
diff --git a/tests-clar/resources/attr/.gitted/objects/c0/091889c0c77142b87a1fa5123a6398a61d33e7 b/tests-clar/resources/attr/.gitted/objects/c0/091889c0c77142b87a1fa5123a6398a61d33e7
new file mode 100644
index 0000000..11dc63c
Binary files /dev/null and b/tests-clar/resources/attr/.gitted/objects/c0/091889c0c77142b87a1fa5123a6398a61d33e7 differ
diff --git a/tests-clar/resources/attr/.gitted/objects/c4/85abe35abd4aa6fd83b076a78bbea9e2e7e06c b/tests-clar/resources/attr/.gitted/objects/c4/85abe35abd4aa6fd83b076a78bbea9e2e7e06c
new file mode 100644
index 0000000..58569ca
Binary files /dev/null and b/tests-clar/resources/attr/.gitted/objects/c4/85abe35abd4aa6fd83b076a78bbea9e2e7e06c differ
diff --git a/tests-clar/resources/attr/.gitted/objects/c7/aadd770d5907a8475c29e9ee21a27b88bf675d b/tests-clar/resources/attr/.gitted/objects/c7/aadd770d5907a8475c29e9ee21a27b88bf675d
new file mode 100644
index 0000000..39aedb7
Binary files /dev/null and b/tests-clar/resources/attr/.gitted/objects/c7/aadd770d5907a8475c29e9ee21a27b88bf675d differ
diff --git a/tests-clar/resources/attr/.gitted/objects/c9/6bbb2c2557a8325ae1559e3ba79cdcecb23076 b/tests-clar/resources/attr/.gitted/objects/c9/6bbb2c2557a8325ae1559e3ba79cdcecb23076
new file mode 100644
index 0000000..589f9ad
--- /dev/null
+++ b/tests-clar/resources/attr/.gitted/objects/c9/6bbb2c2557a8325ae1559e3ba79cdcecb23076
@@ -0,0 +1,2 @@
+x5A
+Â0D]ÿSÌεèoàÂuJ~L0ýͯ¡··)¸xÃcfªœp¹]OOΊcñBµ˜6‘»!뢘´²Ã³‚{,áU<C¿j˜¹[ÁE-ŠÜ-¢Ò˜ð&#š¯)~ëÇäÆ=˜;;{.öùe"3A
\ No newline at end of file
diff --git a/tests-clar/resources/attr/.gitted/objects/d5/7da33c16b14326ecb05d19bbea908f5e4c47d9 b/tests-clar/resources/attr/.gitted/objects/d5/7da33c16b14326ecb05d19bbea908f5e4c47d9
new file mode 100644
index 0000000..b96d40c
Binary files /dev/null and b/tests-clar/resources/attr/.gitted/objects/d5/7da33c16b14326ecb05d19bbea908f5e4c47d9 differ
diff --git a/tests-clar/resources/attr/.gitted/objects/d8/00886d9c86731ae5c4a62b0b77c437015e00d2 b/tests-clar/resources/attr/.gitted/objects/d8/00886d9c86731ae5c4a62b0b77c437015e00d2
new file mode 100644
index 0000000..83f3b72
Binary files /dev/null and b/tests-clar/resources/attr/.gitted/objects/d8/00886d9c86731ae5c4a62b0b77c437015e00d2 differ
diff --git a/tests-clar/resources/attr/.gitted/objects/dc/cada462d3df8ac6de596fb8c896aba9344f941 b/tests-clar/resources/attr/.gitted/objects/dc/cada462d3df8ac6de596fb8c896aba9344f941
new file mode 100644
index 0000000..ef62f8b
Binary files /dev/null and b/tests-clar/resources/attr/.gitted/objects/dc/cada462d3df8ac6de596fb8c896aba9344f941 differ
diff --git a/tests-clar/resources/attr/.gitted/objects/e5/63cf4758f0d646f1b14b76016aa17fa9e549a4 b/tests-clar/resources/attr/.gitted/objects/e5/63cf4758f0d646f1b14b76016aa17fa9e549a4
new file mode 100644
index 0000000..1bc1f0f
Binary files /dev/null and b/tests-clar/resources/attr/.gitted/objects/e5/63cf4758f0d646f1b14b76016aa17fa9e549a4 differ
diff --git a/tests-clar/resources/attr/.gitted/objects/f2/c6d717cf4a5a3e6b02684155ab07b766982165 b/tests-clar/resources/attr/.gitted/objects/f2/c6d717cf4a5a3e6b02684155ab07b766982165
new file mode 100644
index 0000000..27a25dc
Binary files /dev/null and b/tests-clar/resources/attr/.gitted/objects/f2/c6d717cf4a5a3e6b02684155ab07b766982165 differ
diff --git a/tests-clar/resources/attr/.gitted/objects/f5/b0af1fb4f5c0cd7aad880711d368a07333c307 b/tests-clar/resources/attr/.gitted/objects/f5/b0af1fb4f5c0cd7aad880711d368a07333c307
new file mode 100644
index 0000000..21faeb8
--- /dev/null
+++ b/tests-clar/resources/attr/.gitted/objects/f5/b0af1fb4f5c0cd7aad880711d368a07333c307
@@ -0,0 +1,2 @@
+xN[j1Ì·O¡4ÈRbÇPJÈ
+=€Ö;NûÂë½
½A?†y 1“×y~7½žZ(¾¥2ªÏð£beàÁ8uå’Ja‰n³Š¥‘F.HÈ"—UD_®Ý£÷ÉHI£sv´×ZéûØwL=0Tú´ZàþGç¼Î_äUbßKèƒoÌ®§}cëçÿùv?Ûhí½<©aoÔµ¹_áEK
\ No newline at end of file
diff --git a/tests-clar/resources/attr/.gitted/objects/fb/5067b1aef3ac1ada4b379dbcb7d17255df7d78 b/tests-clar/resources/attr/.gitted/objects/fb/5067b1aef3ac1ada4b379dbcb7d17255df7d78
new file mode 100644
index 0000000..6c8ff83
Binary files /dev/null and b/tests-clar/resources/attr/.gitted/objects/fb/5067b1aef3ac1ada4b379dbcb7d17255df7d78 differ
diff --git a/tests-clar/resources/attr/.gitted/objects/fe/773770c5a6cc7185580c9204b1ff18a33ff3fc b/tests-clar/resources/attr/.gitted/objects/fe/773770c5a6cc7185580c9204b1ff18a33ff3fc
new file mode 100644
index 0000000..e6fcbc0
--- /dev/null
+++ b/tests-clar/resources/attr/.gitted/objects/fe/773770c5a6cc7185580c9204b1ff18a33ff3fc
@@ -0,0 +1 @@
+x5ŽAÂ09ûû„xBÜAâœG¤vÕ¤Tüž¤Ð£åõÙ<ûãîÂ#¥Î1ÂUT釛*ÑMúWlÎOCR˜2dÖѵC.„T“©ËÈI¹lQH/öœmYÛ¬UN[àžª€ß¬¬¥þBÖ@t¶Üð8~˜†Õ‹¿}}R#Ä#kAØdD_=-H–
\ No newline at end of file
diff --git a/tests-clar/resources/attr/.gitted/objects/ff/69f8639ce2e6010b3f33a74160aad98b48da2b b/tests-clar/resources/attr/.gitted/objects/ff/69f8639ce2e6010b3f33a74160aad98b48da2b
new file mode 100644
index 0000000..b736c0b
Binary files /dev/null and b/tests-clar/resources/attr/.gitted/objects/ff/69f8639ce2e6010b3f33a74160aad98b48da2b differ
diff --git a/tests-clar/resources/attr/.gitted/refs/heads/master b/tests-clar/resources/attr/.gitted/refs/heads/master
new file mode 100644
index 0000000..7f8bbe3
--- /dev/null
+++ b/tests-clar/resources/attr/.gitted/refs/heads/master
@@ -0,0 +1 @@
+a97cc019851d401a4f1d091cb91a15890a0dd1ba
diff --git a/tests-clar/resources/attr/attr0 b/tests-clar/resources/attr/attr0
new file mode 100644
index 0000000..556f8c8
--- /dev/null
+++ b/tests-clar/resources/attr/attr0
@@ -0,0 +1 @@
+* binary
diff --git a/tests-clar/resources/attr/attr1 b/tests-clar/resources/attr/attr1
new file mode 100644
index 0000000..3b74db7
--- /dev/null
+++ b/tests-clar/resources/attr/attr1
@@ -0,0 +1,29 @@
+# a comment followed by some blank lines
+
+
+
+ # another comment that is indented
+
+# variations on fnmatch
+
+pat0 attr0
+!pat1 attr1
+pat2/ attr2
+pat3dir/pat3file attr3
+pat4.* attr4
+ *.pat5 attr5
+pat6/pat6/*.pat6 attr6
+
+pat7[a-e]??[xyz] attr7 # with a comment on the line
+
+pat8\ with\ spaces attr8
+
+ invalid # attr with no assignments doesn't count
+
+also/invalid
+
+invalid.again/
+
+# next attr is at eof
+
+ pat9 attr9
\ No newline at end of file
diff --git a/tests-clar/resources/attr/attr2 b/tests-clar/resources/attr/attr2
new file mode 100644
index 0000000..2c66e14
--- /dev/null
+++ b/tests-clar/resources/attr/attr2
@@ -0,0 +1,21 @@
+
+# variations on assignments
+
+pat0 simple
+pat1 -neg
+* notundef
+pat2 !notundef
+pat3 assigned=test-value
+pat4 rule-with-more-chars=value-with-more-chars
+pat5 empty=
+pat6 -negempty=
+pat7 multiple -single values=1 also=a-really-long-value/* happy=yes!
+# the next line has trailing spaces
+pat8 again= another=12321
+patbad0 # empty assignment does not count
+# next line will be another simple empty assign that should not count
+ patbad1
+
+# BTW I think there are 11 valid rules and two "invalid" empty ones
+
+pat9 -at-eof
\ No newline at end of file
diff --git a/tests-clar/resources/attr/attr3 b/tests-clar/resources/attr/attr3
new file mode 100644
index 0000000..c485abe
--- /dev/null
+++ b/tests-clar/resources/attr/attr3
@@ -0,0 +1,4 @@
+# These are examples from the git-check-attr.1 man page
+*.java diff=java -crlf myAttr
+NoMyAttr.java !myAttr
+README caveat=unspecified
diff --git a/tests-clar/resources/attr/binfile b/tests-clar/resources/attr/binfile
new file mode 100644
index 0000000..d800886
--- /dev/null
+++ b/tests-clar/resources/attr/binfile
@@ -0,0 +1 @@
+123
\ No newline at end of file
diff --git a/tests-clar/resources/attr/dir/file b/tests-clar/resources/attr/dir/file
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/tests-clar/resources/attr/dir/file
diff --git a/tests-clar/resources/attr/file b/tests-clar/resources/attr/file
new file mode 100644
index 0000000..45b983b
--- /dev/null
+++ b/tests-clar/resources/attr/file
@@ -0,0 +1 @@
+hi
diff --git a/tests-clar/resources/attr/gitattributes b/tests-clar/resources/attr/gitattributes
new file mode 100644
index 0000000..e038983
--- /dev/null
+++ b/tests-clar/resources/attr/gitattributes
@@ -0,0 +1,29 @@
+* rootattr
+root_test2 -rootattr
+root_test3 !rootattr
+binfile binary
+abc foo bar baz
+does-not-exist foo=yes
+
+root_test2 multiattr
+root_test3 multi2=foo
+
+root_test3 multiattr=1 multiattr=2 multiattr=3 multi2=abc !multi2
+root_test2 multiattr=string -multiattr
+
+[attr]mymacro positive -negative !rootattr
+macro* mymacro another=77
+
+[attr]macro2 multi2 -multi2 multi3 !multi3 multi3=answer
+macro* macro2 macro2 macro2
+
+# let's try some malicious macro defs
+[attr]firstmacro -thirdmacro -secondmacro
+[attr]secondmacro firstmacro -firstmacro
+[attr]thirdmacro secondmacro=hahaha
+
+macro_bad firstmacro secondmacro thirdmacro
+
+# another test that Peff found was failing
+[attr]notest !test
+
diff --git a/tests-clar/resources/attr/gitignore b/tests-clar/resources/attr/gitignore
new file mode 100644
index 0000000..546d48f
--- /dev/null
+++ b/tests-clar/resources/attr/gitignore
@@ -0,0 +1,3 @@
+sub
+ign
+dir/
diff --git a/tests-clar/resources/attr/ign b/tests-clar/resources/attr/ign
new file mode 100644
index 0000000..592fd25
--- /dev/null
+++ b/tests-clar/resources/attr/ign
@@ -0,0 +1 @@
+ignore me
diff --git a/tests-clar/resources/attr/macro_bad b/tests-clar/resources/attr/macro_bad
new file mode 100644
index 0000000..5819a18
--- /dev/null
+++ b/tests-clar/resources/attr/macro_bad
@@ -0,0 +1 @@
+boo
diff --git a/tests-clar/resources/attr/macro_test b/tests-clar/resources/attr/macro_test
new file mode 100644
index 0000000..ff69f86
--- /dev/null
+++ b/tests-clar/resources/attr/macro_test
@@ -0,0 +1 @@
+Yo
diff --git a/tests-clar/resources/attr/root_test1 b/tests-clar/resources/attr/root_test1
new file mode 100644
index 0000000..45141a7
--- /dev/null
+++ b/tests-clar/resources/attr/root_test1
@@ -0,0 +1 @@
+Hello from the root
diff --git a/tests-clar/resources/attr/root_test2 b/tests-clar/resources/attr/root_test2
new file mode 100644
index 0000000..4d713dc
--- /dev/null
+++ b/tests-clar/resources/attr/root_test2
@@ -0,0 +1,6 @@
+Hello from the root
+
+Some additional lines
+
+Down here below
+
diff --git a/tests-clar/resources/attr/root_test3 b/tests-clar/resources/attr/root_test3
new file mode 100644
index 0000000..108bb4e
--- /dev/null
+++ b/tests-clar/resources/attr/root_test3
@@ -0,0 +1,19 @@
+Some additional lines
+
+
+ Down here below the other lines
+
+
+With even more at the end
+
+
+And lots of good stuff
+
+
+Anywhere you want
+
+
+Don't you think
+
+
+
diff --git a/tests-clar/resources/attr/root_test4.txt b/tests-clar/resources/attr/root_test4.txt
new file mode 100644
index 0000000..fe77377
--- /dev/null
+++ b/tests-clar/resources/attr/root_test4.txt
@@ -0,0 +1,14 @@
+Here is some stuff at the start
+
+This should go in one hunk
+
+Some additional lines
+
+Down here below the other lines
+
+With even more at the end
+
+Followed by a second hunk of stuff
+
+That happens down here
+
diff --git a/tests-clar/resources/attr/sub/.gitattributes b/tests-clar/resources/attr/sub/.gitattributes
new file mode 100644
index 0000000..329c1c5
--- /dev/null
+++ b/tests-clar/resources/attr/sub/.gitattributes
@@ -0,0 +1,7 @@
+* subattr=yes -negattr
+*.txt another=zero
+sub/*.txt another=one
+ab* merge=filfre
+abc -foo -bar
+*.c frotz
+deep/file deepdeep
diff --git a/tests-clar/resources/attr/sub/abc b/tests-clar/resources/attr/sub/abc
new file mode 100644
index 0000000..3e42ffc
--- /dev/null
+++ b/tests-clar/resources/attr/sub/abc
@@ -0,0 +1,37 @@
+# Test file from gitattributes(5) example:
+
+If you have these three gitattributes file:
+
+ (in $GIT_DIR/info/attributes)
+
+ a* foo !bar -baz
+
+ (in .gitattributes)
+ abc foo bar baz
+
+ (in t/.gitattributes)
+ ab* merge=filfre
+ abc -foo -bar
+ *.c frotz
+
+the attributes given to path t/abc are computed as follows:
+
+1. By examining t/.gitattributes (which is in the same directory as the path
+ in question), git finds that the first line matches. merge attribute is
+ set. It also finds that the second line matches, and attributes foo and
+ bar are unset.
+2. Then it examines .gitattributes (which is in the parent directory), and
+ finds that the first line matches, but t/.gitattributes file already
+ decided how merge, foo and bar attributes should be given to this path,
+ so it leaves foo and bar unset. Attribute baz is set.
+3. Finally it examines $GIT_DIR/info/attributes. This file is used to
+ override the in-tree settings. The first line is a match, and foo is set,
+ bar is reverted to unspecified state, and baz is unset.
+
+As the result, the attributes assignment to t/abc becomes:
+
+ foo set to true
+ bar unspecified
+ baz set to false
+ merge set to string value "filfre"
+ frotz unspecified
diff --git a/tests-clar/resources/attr/sub/dir/file b/tests-clar/resources/attr/sub/dir/file
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/tests-clar/resources/attr/sub/dir/file
diff --git a/tests-clar/resources/attr/sub/file b/tests-clar/resources/attr/sub/file
new file mode 100644
index 0000000..45b983b
--- /dev/null
+++ b/tests-clar/resources/attr/sub/file
@@ -0,0 +1 @@
+hi
diff --git a/tests-clar/resources/attr/sub/ign b/tests-clar/resources/attr/sub/ign
new file mode 100644
index 0000000..592fd25
--- /dev/null
+++ b/tests-clar/resources/attr/sub/ign
@@ -0,0 +1 @@
+ignore me
diff --git a/tests-clar/resources/attr/sub/sub/.gitattributes b/tests-clar/resources/attr/sub/sub/.gitattributes
new file mode 100644
index 0000000..55225e4
--- /dev/null
+++ b/tests-clar/resources/attr/sub/sub/.gitattributes
@@ -0,0 +1,3 @@
+d/* test=a/b/d/*
+d/yes notest
+
diff --git a/tests-clar/resources/attr/sub/sub/dir b/tests-clar/resources/attr/sub/sub/dir
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/tests-clar/resources/attr/sub/sub/dir
diff --git a/tests-clar/resources/attr/sub/sub/file b/tests-clar/resources/attr/sub/sub/file
new file mode 100644
index 0000000..45b983b
--- /dev/null
+++ b/tests-clar/resources/attr/sub/sub/file
@@ -0,0 +1 @@
+hi
diff --git a/tests-clar/resources/attr/sub/sub/subsub.txt b/tests-clar/resources/attr/sub/sub/subsub.txt
new file mode 100644
index 0000000..9e5bdc4
--- /dev/null
+++ b/tests-clar/resources/attr/sub/sub/subsub.txt
@@ -0,0 +1 @@
+subsub
diff --git a/tests-clar/resources/attr/sub/subdir_test1 b/tests-clar/resources/attr/sub/subdir_test1
new file mode 100644
index 0000000..e563cf4
--- /dev/null
+++ b/tests-clar/resources/attr/sub/subdir_test1
@@ -0,0 +1,2 @@
+Hello from the subdir
+
diff --git a/tests-clar/resources/attr/sub/subdir_test2.txt b/tests-clar/resources/attr/sub/subdir_test2.txt
new file mode 100644
index 0000000..fb5067b
--- /dev/null
+++ b/tests-clar/resources/attr/sub/subdir_test2.txt
@@ -0,0 +1 @@
+Hello again
diff --git a/tests-clar/resources/bad_tag.git/HEAD b/tests-clar/resources/bad_tag.git/HEAD
new file mode 100644
index 0000000..cb089cd
--- /dev/null
+++ b/tests-clar/resources/bad_tag.git/HEAD
@@ -0,0 +1 @@
+ref: refs/heads/master
diff --git a/tests-clar/resources/bad_tag.git/config b/tests-clar/resources/bad_tag.git/config
new file mode 100644
index 0000000..2f89580
--- /dev/null
+++ b/tests-clar/resources/bad_tag.git/config
@@ -0,0 +1,5 @@
+[core]
+ repositoryformatversion = 0
+ filemode = true
+ bare = true
+ logallrefupdates = true
diff --git a/tests-clar/resources/bad_tag.git/objects/pack/pack-7a28f4e000a17f49a41d7a79fc2f762a8a7d9164.idx b/tests-clar/resources/bad_tag.git/objects/pack/pack-7a28f4e000a17f49a41d7a79fc2f762a8a7d9164.idx
new file mode 100644
index 0000000..c404aa1
Binary files /dev/null and b/tests-clar/resources/bad_tag.git/objects/pack/pack-7a28f4e000a17f49a41d7a79fc2f762a8a7d9164.idx differ
diff --git a/tests-clar/resources/bad_tag.git/objects/pack/pack-7a28f4e000a17f49a41d7a79fc2f762a8a7d9164.pack b/tests-clar/resources/bad_tag.git/objects/pack/pack-7a28f4e000a17f49a41d7a79fc2f762a8a7d9164.pack
new file mode 100644
index 0000000..90eac50
Binary files /dev/null and b/tests-clar/resources/bad_tag.git/objects/pack/pack-7a28f4e000a17f49a41d7a79fc2f762a8a7d9164.pack differ
diff --git a/tests-clar/resources/bad_tag.git/packed-refs b/tests-clar/resources/bad_tag.git/packed-refs
new file mode 100644
index 0000000..f9fd2fd
--- /dev/null
+++ b/tests-clar/resources/bad_tag.git/packed-refs
@@ -0,0 +1,3 @@
+# pack-refs with: peeled
+eda9f45a2a98d4c17a09d681d88569fa4ea91755 refs/tags/e90810b
+^e90810b8df3e80c413d903f631643c716887138d
diff --git a/tests-clar/resources/bad_tag.git/refs/dummy-marker.txt b/tests-clar/resources/bad_tag.git/refs/dummy-marker.txt
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/tests-clar/resources/bad_tag.git/refs/dummy-marker.txt
diff --git a/tests-clar/resources/big.index b/tests-clar/resources/big.index
new file mode 100644
index 0000000..66932f1
Binary files /dev/null and b/tests-clar/resources/big.index differ
diff --git a/tests-clar/resources/config/.gitconfig b/tests-clar/resources/config/.gitconfig
new file mode 100644
index 0000000..fa72bdd
--- /dev/null
+++ b/tests-clar/resources/config/.gitconfig
@@ -0,0 +1,3 @@
+[core]
+ repositoryformatversion = 5
+ something = 2
\ No newline at end of file
diff --git a/tests-clar/resources/config/config0 b/tests-clar/resources/config/config0
new file mode 100644
index 0000000..85235c5
--- /dev/null
+++ b/tests-clar/resources/config/config0
@@ -0,0 +1,7 @@
+# This is a test
+; of different comments
+[core]
+ repositoryformatversion = 0
+ filemode = true
+ bare = false
+ logallrefupdates = true
\ No newline at end of file
diff --git a/tests-clar/resources/config/config1 b/tests-clar/resources/config/config1
new file mode 100644
index 0000000..211dc9e
--- /dev/null
+++ b/tests-clar/resources/config/config1
@@ -0,0 +1,5 @@
+# This one checks for case sensitivity
+[this "that"]
+ other = true
+[this "That"]
+ other = yes
diff --git a/tests-clar/resources/config/config10 b/tests-clar/resources/config/config10
new file mode 100644
index 0000000..dde1791
--- /dev/null
+++ b/tests-clar/resources/config/config10
@@ -0,0 +1 @@
+[empty]
diff --git a/tests-clar/resources/config/config11 b/tests-clar/resources/config/config11
new file mode 100644
index 0000000..880c945
--- /dev/null
+++ b/tests-clar/resources/config/config11
@@ -0,0 +1,3 @@
+[remote "fancy"]
+ url = git://github.com/libgit2/libgit2
+ url = git://git.example.com/libgit2
diff --git a/tests-clar/resources/config/config2 b/tests-clar/resources/config/config2
new file mode 100644
index 0000000..60a3898
--- /dev/null
+++ b/tests-clar/resources/config/config2
@@ -0,0 +1,5 @@
+; This one tests for multiline values
+[this "That"]
+ and = one one one \
+two two \
+three three
\ No newline at end of file
diff --git a/tests-clar/resources/config/config3 b/tests-clar/resources/config/config3
new file mode 100644
index 0000000..44a5e50
--- /dev/null
+++ b/tests-clar/resources/config/config3
@@ -0,0 +1,3 @@
+# A [section.subsection] header is case-insensitive
+[section.SuBsection]
+ var = hello
diff --git a/tests-clar/resources/config/config4 b/tests-clar/resources/config/config4
new file mode 100644
index 0000000..741fa0f
--- /dev/null
+++ b/tests-clar/resources/config/config4
@@ -0,0 +1,3 @@
+# A variable name on its own is valid
+[some.section]
+ variable
diff --git a/tests-clar/resources/config/config5 b/tests-clar/resources/config/config5
new file mode 100644
index 0000000..8ab60cc
--- /dev/null
+++ b/tests-clar/resources/config/config5
@@ -0,0 +1,9 @@
+# Test for number suffixes
+[number]
+ simple = 1
+ k = 1k
+ kk = 1K
+ m = 1m
+ mm = 1M
+ g = 1g
+ gg = 1G
diff --git a/tests-clar/resources/config/config6 b/tests-clar/resources/config/config6
new file mode 100644
index 0000000..0f8f90a
--- /dev/null
+++ b/tests-clar/resources/config/config6
@@ -0,0 +1,5 @@
+[valid "subsection"]
+ something = true
+
+[something "else"]
+ something = false
diff --git a/tests-clar/resources/config/config7 b/tests-clar/resources/config/config7
new file mode 100644
index 0000000..6af6fcf
--- /dev/null
+++ b/tests-clar/resources/config/config7
@@ -0,0 +1,5 @@
+[valid "subsection"]
+ something = a
+; we don't allow anything after closing "
+[sec "subsec"x]
+ bleh = blah
diff --git a/tests-clar/resources/config/config8 b/tests-clar/resources/config/config8
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/tests-clar/resources/config/config8
diff --git a/tests-clar/resources/config/config9 b/tests-clar/resources/config/config9
new file mode 100644
index 0000000..fcaac42
--- /dev/null
+++ b/tests-clar/resources/config/config9
@@ -0,0 +1,9 @@
+[core]
+ dummy2 = 42
+ verylong = 1
+ dummy = 1
+
+[remote "ab"]
+ url = http://example.com/git/ab
+[remote "abba"]
+ url = http://example.com/git/abba
diff --git a/tests-clar/resources/empty_bare.git/HEAD b/tests-clar/resources/empty_bare.git/HEAD
new file mode 100644
index 0000000..cb089cd
--- /dev/null
+++ b/tests-clar/resources/empty_bare.git/HEAD
@@ -0,0 +1 @@
+ref: refs/heads/master
diff --git a/tests-clar/resources/empty_bare.git/config b/tests-clar/resources/empty_bare.git/config
new file mode 100644
index 0000000..90e1647
--- /dev/null
+++ b/tests-clar/resources/empty_bare.git/config
@@ -0,0 +1,7 @@
+[core]
+ repositoryformatversion = 0
+ filemode = false
+ bare = true
+ symlinks = false
+ ignorecase = true
+ hideDotFiles = dotGitOnly
diff --git a/tests-clar/resources/empty_bare.git/description b/tests-clar/resources/empty_bare.git/description
new file mode 100644
index 0000000..498b267
--- /dev/null
+++ b/tests-clar/resources/empty_bare.git/description
@@ -0,0 +1 @@
+Unnamed repository; edit this file 'description' to name the repository.
diff --git a/tests-clar/resources/empty_bare.git/info/exclude b/tests-clar/resources/empty_bare.git/info/exclude
new file mode 100644
index 0000000..a5196d1
--- /dev/null
+++ b/tests-clar/resources/empty_bare.git/info/exclude
@@ -0,0 +1,6 @@
+# git ls-files --others --exclude-from=.git/info/exclude
+# Lines that start with '#' are comments.
+# For a project mostly in C, the following would be a good set of
+# exclude patterns (uncomment them if you want to use them):
+# *.[oa]
+# *~
diff --git a/tests-clar/resources/empty_bare.git/objects/info/dummy-marker.txt b/tests-clar/resources/empty_bare.git/objects/info/dummy-marker.txt
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/tests-clar/resources/empty_bare.git/objects/info/dummy-marker.txt
diff --git a/tests-clar/resources/empty_bare.git/objects/pack/dummy-marker.txt b/tests-clar/resources/empty_bare.git/objects/pack/dummy-marker.txt
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/tests-clar/resources/empty_bare.git/objects/pack/dummy-marker.txt
diff --git a/tests-clar/resources/empty_bare.git/refs/heads/dummy-marker.txt b/tests-clar/resources/empty_bare.git/refs/heads/dummy-marker.txt
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/tests-clar/resources/empty_bare.git/refs/heads/dummy-marker.txt
diff --git a/tests-clar/resources/empty_bare.git/refs/tags/dummy-marker.txt b/tests-clar/resources/empty_bare.git/refs/tags/dummy-marker.txt
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/tests-clar/resources/empty_bare.git/refs/tags/dummy-marker.txt
diff --git a/tests-clar/resources/empty_standard_repo/.gitted/HEAD b/tests-clar/resources/empty_standard_repo/.gitted/HEAD
new file mode 100644
index 0000000..cb089cd
--- /dev/null
+++ b/tests-clar/resources/empty_standard_repo/.gitted/HEAD
@@ -0,0 +1 @@
+ref: refs/heads/master
diff --git a/tests-clar/resources/empty_standard_repo/.gitted/config b/tests-clar/resources/empty_standard_repo/.gitted/config
new file mode 100644
index 0000000..78387c5
--- /dev/null
+++ b/tests-clar/resources/empty_standard_repo/.gitted/config
@@ -0,0 +1,8 @@
+[core]
+ repositoryformatversion = 0
+ filemode = false
+ bare = false
+ logallrefupdates = true
+ symlinks = false
+ ignorecase = true
+ hideDotFiles = dotGitOnly
diff --git a/tests-clar/resources/empty_standard_repo/.gitted/description b/tests-clar/resources/empty_standard_repo/.gitted/description
new file mode 100644
index 0000000..498b267
--- /dev/null
+++ b/tests-clar/resources/empty_standard_repo/.gitted/description
@@ -0,0 +1 @@
+Unnamed repository; edit this file 'description' to name the repository.
diff --git a/tests-clar/resources/empty_standard_repo/.gitted/info/exclude b/tests-clar/resources/empty_standard_repo/.gitted/info/exclude
new file mode 100644
index 0000000..a5196d1
--- /dev/null
+++ b/tests-clar/resources/empty_standard_repo/.gitted/info/exclude
@@ -0,0 +1,6 @@
+# git ls-files --others --exclude-from=.git/info/exclude
+# Lines that start with '#' are comments.
+# For a project mostly in C, the following would be a good set of
+# exclude patterns (uncomment them if you want to use them):
+# *.[oa]
+# *~
diff --git a/tests-clar/resources/empty_standard_repo/.gitted/objects/info/dummy-marker.txt b/tests-clar/resources/empty_standard_repo/.gitted/objects/info/dummy-marker.txt
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/tests-clar/resources/empty_standard_repo/.gitted/objects/info/dummy-marker.txt
diff --git a/tests-clar/resources/empty_standard_repo/.gitted/objects/pack/dummy-marker.txt b/tests-clar/resources/empty_standard_repo/.gitted/objects/pack/dummy-marker.txt
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/tests-clar/resources/empty_standard_repo/.gitted/objects/pack/dummy-marker.txt
diff --git a/tests-clar/resources/empty_standard_repo/.gitted/refs/heads/dummy-marker.txt b/tests-clar/resources/empty_standard_repo/.gitted/refs/heads/dummy-marker.txt
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/tests-clar/resources/empty_standard_repo/.gitted/refs/heads/dummy-marker.txt
diff --git a/tests-clar/resources/empty_standard_repo/.gitted/refs/tags/dummy-marker.txt b/tests-clar/resources/empty_standard_repo/.gitted/refs/tags/dummy-marker.txt
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/tests-clar/resources/empty_standard_repo/.gitted/refs/tags/dummy-marker.txt
diff --git a/tests-clar/resources/gitgit.index b/tests-clar/resources/gitgit.index
new file mode 100644
index 0000000..215da64
Binary files /dev/null and b/tests-clar/resources/gitgit.index differ
diff --git a/tests-clar/resources/status/.gitted/COMMIT_EDITMSG b/tests-clar/resources/status/.gitted/COMMIT_EDITMSG
new file mode 100644
index 0000000..1a25cd4
--- /dev/null
+++ b/tests-clar/resources/status/.gitted/COMMIT_EDITMSG
@@ -0,0 +1 @@
+Add a file which name should appear before the "subdir/" folder while being dealt with by the treewalker
diff --git a/tests-clar/resources/status/.gitted/HEAD b/tests-clar/resources/status/.gitted/HEAD
new file mode 100644
index 0000000..cb089cd
--- /dev/null
+++ b/tests-clar/resources/status/.gitted/HEAD
@@ -0,0 +1 @@
+ref: refs/heads/master
diff --git a/tests-clar/resources/status/.gitted/ORIG_HEAD b/tests-clar/resources/status/.gitted/ORIG_HEAD
new file mode 100644
index 0000000..b46871f
--- /dev/null
+++ b/tests-clar/resources/status/.gitted/ORIG_HEAD
@@ -0,0 +1 @@
+735b6a258cd196a8f7c9428419b02c1dca93fd75
diff --git a/tests-clar/resources/status/.gitted/config b/tests-clar/resources/status/.gitted/config
new file mode 100644
index 0000000..af10792
--- /dev/null
+++ b/tests-clar/resources/status/.gitted/config
@@ -0,0 +1,6 @@
+[core]
+ repositoryformatversion = 0
+ filemode = true
+ bare = false
+ logallrefupdates = true
+ ignorecase = true
diff --git a/tests-clar/resources/status/.gitted/description b/tests-clar/resources/status/.gitted/description
new file mode 100644
index 0000000..498b267
--- /dev/null
+++ b/tests-clar/resources/status/.gitted/description
@@ -0,0 +1 @@
+Unnamed repository; edit this file 'description' to name the repository.
diff --git a/tests-clar/resources/status/.gitted/index b/tests-clar/resources/status/.gitted/index
new file mode 100644
index 0000000..9a383ec
Binary files /dev/null and b/tests-clar/resources/status/.gitted/index differ
diff --git a/tests-clar/resources/status/.gitted/info/exclude b/tests-clar/resources/status/.gitted/info/exclude
new file mode 100644
index 0000000..0c4042a
--- /dev/null
+++ b/tests-clar/resources/status/.gitted/info/exclude
@@ -0,0 +1,8 @@
+# git ls-files --others --exclude-from=.git/info/exclude
+# Lines that start with '#' are comments.
+# For a project mostly in C, the following would be a good set of
+# exclude patterns (uncomment them if you want to use them):
+# *.[oa]
+# *~
+ignored*
+
diff --git a/tests-clar/resources/status/.gitted/logs/HEAD b/tests-clar/resources/status/.gitted/logs/HEAD
new file mode 100644
index 0000000..7b95b3c
--- /dev/null
+++ b/tests-clar/resources/status/.gitted/logs/HEAD
@@ -0,0 +1,3 @@
+0000000000000000000000000000000000000000 0017bd4ab1ec30440b17bae1680cff124ab5f1f6 Jason Penny <jasonpenny4@gmail.com> 1308050070 -0400 commit (initial): initial
+0017bd4ab1ec30440b17bae1680cff124ab5f1f6 735b6a258cd196a8f7c9428419b02c1dca93fd75 Jason Penny <jasonpenny4@gmail.com> 1308954538 -0400 commit: add subdir
+735b6a258cd196a8f7c9428419b02c1dca93fd75 26a125ee1bfc5df1e1b2e9441bbe63c8a7ae989f nulltoken <emeric.fermas@gmail.com> 1319911544 +0200 commit: Add a file which name should appear before the "subdir/" folder while being dealt with by the treewalker
diff --git a/tests-clar/resources/status/.gitted/logs/refs/heads/master b/tests-clar/resources/status/.gitted/logs/refs/heads/master
new file mode 100644
index 0000000..7b95b3c
--- /dev/null
+++ b/tests-clar/resources/status/.gitted/logs/refs/heads/master
@@ -0,0 +1,3 @@
+0000000000000000000000000000000000000000 0017bd4ab1ec30440b17bae1680cff124ab5f1f6 Jason Penny <jasonpenny4@gmail.com> 1308050070 -0400 commit (initial): initial
+0017bd4ab1ec30440b17bae1680cff124ab5f1f6 735b6a258cd196a8f7c9428419b02c1dca93fd75 Jason Penny <jasonpenny4@gmail.com> 1308954538 -0400 commit: add subdir
+735b6a258cd196a8f7c9428419b02c1dca93fd75 26a125ee1bfc5df1e1b2e9441bbe63c8a7ae989f nulltoken <emeric.fermas@gmail.com> 1319911544 +0200 commit: Add a file which name should appear before the "subdir/" folder while being dealt with by the treewalker
diff --git a/tests-clar/resources/status/.gitted/objects/00/17bd4ab1ec30440b17bae1680cff124ab5f1f6 b/tests-clar/resources/status/.gitted/objects/00/17bd4ab1ec30440b17bae1680cff124ab5f1f6
new file mode 100644
index 0000000..b256d95
--- /dev/null
+++ b/tests-clar/resources/status/.gitted/objects/00/17bd4ab1ec30440b17bae1680cff124ab5f1f6
@@ -0,0 +1,2 @@
+xA E]sŠ¹€fh)‰1]»ò
+#SÀTºðö¶Wp÷ßK^~¨9§šÜ¡-"àC'Ø…)FvõbƒvÉÞ"¶wŽŽ¼EÅk{Ö®ü©nRÊίÞû6ã#sšO¡æ舄pDƒ¨6»6ù3W©¤–xV?¨Å9é
\ No newline at end of file
diff --git a/tests-clar/resources/status/.gitted/objects/06/1d42a44cacde5726057b67558821d95db96f19 b/tests-clar/resources/status/.gitted/objects/06/1d42a44cacde5726057b67558821d95db96f19
new file mode 100644
index 0000000..82e02cb
Binary files /dev/null and b/tests-clar/resources/status/.gitted/objects/06/1d42a44cacde5726057b67558821d95db96f19 differ
diff --git a/tests-clar/resources/status/.gitted/objects/18/88c805345ba265b0ee9449b8877b6064592058 b/tests-clar/resources/status/.gitted/objects/18/88c805345ba265b0ee9449b8877b6064592058
new file mode 100644
index 0000000..e3cad2f
Binary files /dev/null and b/tests-clar/resources/status/.gitted/objects/18/88c805345ba265b0ee9449b8877b6064592058 differ
diff --git a/tests-clar/resources/status/.gitted/objects/19/d9cc8584ac2c7dcf57d2680375e80f099dc481 b/tests-clar/resources/status/.gitted/objects/19/d9cc8584ac2c7dcf57d2680375e80f099dc481
new file mode 100644
index 0000000..2d5e711
Binary files /dev/null and b/tests-clar/resources/status/.gitted/objects/19/d9cc8584ac2c7dcf57d2680375e80f099dc481 differ
diff --git a/tests-clar/resources/status/.gitted/objects/26/a125ee1bfc5df1e1b2e9441bbe63c8a7ae989f b/tests-clar/resources/status/.gitted/objects/26/a125ee1bfc5df1e1b2e9441bbe63c8a7ae989f
new file mode 100644
index 0000000..f7dddc4
--- /dev/null
+++ b/tests-clar/resources/status/.gitted/objects/26/a125ee1bfc5df1e1b2e9441bbe63c8a7ae989f
@@ -0,0 +1,2 @@
+xMnÄ …»Î)¬ÙVšò† ªö(Ì€BDˆ¢Þ¾LÐöûüžž«¥¤RÈ·Þˆ@êà,Î9Ž‹òÜÌœtàìæ•ðNj6f`žM6Z;h©ì
…ZÜÐÞp Ú™Y,37¯/Ü;42x&<z¬
Ö#ç^Ÿ´Â
+µä®ZÁýëQ0å««å¸äÆp®æÞ™`lÛ²Ó?ñéÛ{@)œ1¹+‚=Ö#ö6°j#è‘à²Ö§öqP³®¨¥´>ÀægêìÏŸüÕÛ‰ùImú|½jñ
\ No newline at end of file
diff --git a/tests-clar/resources/status/.gitted/objects/32/504b727382542f9f089e24fddac5e78533e96c b/tests-clar/resources/status/.gitted/objects/32/504b727382542f9f089e24fddac5e78533e96c
new file mode 100644
index 0000000..7fca67b
Binary files /dev/null and b/tests-clar/resources/status/.gitted/objects/32/504b727382542f9f089e24fddac5e78533e96c differ
diff --git a/tests-clar/resources/status/.gitted/objects/37/fcb02ccc1a85d1941e7f106d52dc3702dcf0d0 b/tests-clar/resources/status/.gitted/objects/37/fcb02ccc1a85d1941e7f106d52dc3702dcf0d0
new file mode 100644
index 0000000..b75481b
Binary files /dev/null and b/tests-clar/resources/status/.gitted/objects/37/fcb02ccc1a85d1941e7f106d52dc3702dcf0d0 differ
diff --git a/tests-clar/resources/status/.gitted/objects/45/2e4244b5d083ddf0460acf1ecc74db9dcfa11a b/tests-clar/resources/status/.gitted/objects/45/2e4244b5d083ddf0460acf1ecc74db9dcfa11a
new file mode 100644
index 0000000..5b47461
Binary files /dev/null and b/tests-clar/resources/status/.gitted/objects/45/2e4244b5d083ddf0460acf1ecc74db9dcfa11a differ
diff --git a/tests-clar/resources/status/.gitted/objects/52/9a16e8e762d4acb7b9636ff540a00831f9155a b/tests-clar/resources/status/.gitted/objects/52/9a16e8e762d4acb7b9636ff540a00831f9155a
new file mode 100644
index 0000000..615009a
Binary files /dev/null and b/tests-clar/resources/status/.gitted/objects/52/9a16e8e762d4acb7b9636ff540a00831f9155a differ
diff --git a/tests-clar/resources/status/.gitted/objects/53/ace0d1cc1145a5f4fe4f78a186a60263190733 b/tests-clar/resources/status/.gitted/objects/53/ace0d1cc1145a5f4fe4f78a186a60263190733
new file mode 100644
index 0000000..cdb7e96
Binary files /dev/null and b/tests-clar/resources/status/.gitted/objects/53/ace0d1cc1145a5f4fe4f78a186a60263190733 differ
diff --git a/tests-clar/resources/status/.gitted/objects/54/52d32f1dd538eb0405e8a83cc185f79e25e80f b/tests-clar/resources/status/.gitted/objects/54/52d32f1dd538eb0405e8a83cc185f79e25e80f
new file mode 100644
index 0000000..a72dff6
Binary files /dev/null and b/tests-clar/resources/status/.gitted/objects/54/52d32f1dd538eb0405e8a83cc185f79e25e80f differ
diff --git a/tests-clar/resources/status/.gitted/objects/55/d316c9ba708999f1918e9677d01dfcae69c6b9 b/tests-clar/resources/status/.gitted/objects/55/d316c9ba708999f1918e9677d01dfcae69c6b9
new file mode 100644
index 0000000..72807f3
Binary files /dev/null and b/tests-clar/resources/status/.gitted/objects/55/d316c9ba708999f1918e9677d01dfcae69c6b9 differ
diff --git a/tests-clar/resources/status/.gitted/objects/70/bd9443ada07063e7fbf0b3ff5c13f7494d89c2 b/tests-clar/resources/status/.gitted/objects/70/bd9443ada07063e7fbf0b3ff5c13f7494d89c2
new file mode 100644
index 0000000..3665a8f
Binary files /dev/null and b/tests-clar/resources/status/.gitted/objects/70/bd9443ada07063e7fbf0b3ff5c13f7494d89c2 differ
diff --git a/tests-clar/resources/status/.gitted/objects/73/5b6a258cd196a8f7c9428419b02c1dca93fd75 b/tests-clar/resources/status/.gitted/objects/73/5b6a258cd196a8f7c9428419b02c1dca93fd75
new file mode 100644
index 0000000..08e6fd2
Binary files /dev/null and b/tests-clar/resources/status/.gitted/objects/73/5b6a258cd196a8f7c9428419b02c1dca93fd75 differ
diff --git a/tests-clar/resources/status/.gitted/objects/75/6e27627e67bfbc048d01ece5819c6de733d7ea b/tests-clar/resources/status/.gitted/objects/75/6e27627e67bfbc048d01ece5819c6de733d7ea
new file mode 100644
index 0000000..8f3fa89
Binary files /dev/null and b/tests-clar/resources/status/.gitted/objects/75/6e27627e67bfbc048d01ece5819c6de733d7ea differ
diff --git a/tests-clar/resources/status/.gitted/objects/90/6ee7711f4f4928ddcb2a5f8fbc500deba0d2a8 b/tests-clar/resources/status/.gitted/objects/90/6ee7711f4f4928ddcb2a5f8fbc500deba0d2a8
new file mode 100644
index 0000000..bb732b0
Binary files /dev/null and b/tests-clar/resources/status/.gitted/objects/90/6ee7711f4f4928ddcb2a5f8fbc500deba0d2a8 differ
diff --git a/tests-clar/resources/status/.gitted/objects/90/b8c29d8ba39434d1c63e1b093daaa26e5bd972 b/tests-clar/resources/status/.gitted/objects/90/b8c29d8ba39434d1c63e1b093daaa26e5bd972
new file mode 100644
index 0000000..7a96618
Binary files /dev/null and b/tests-clar/resources/status/.gitted/objects/90/b8c29d8ba39434d1c63e1b093daaa26e5bd972 differ
diff --git a/tests-clar/resources/status/.gitted/objects/9c/2e02cdffa8d73e6c189074594477a6baf87960 b/tests-clar/resources/status/.gitted/objects/9c/2e02cdffa8d73e6c189074594477a6baf87960
new file mode 100644
index 0000000..20a3c49
Binary files /dev/null and b/tests-clar/resources/status/.gitted/objects/9c/2e02cdffa8d73e6c189074594477a6baf87960 differ
diff --git a/tests-clar/resources/status/.gitted/objects/a0/de7e0ac200c489c41c59dfa910154a70264e6e b/tests-clar/resources/status/.gitted/objects/a0/de7e0ac200c489c41c59dfa910154a70264e6e
new file mode 100644
index 0000000..a1789c9
Binary files /dev/null and b/tests-clar/resources/status/.gitted/objects/a0/de7e0ac200c489c41c59dfa910154a70264e6e differ
diff --git a/tests-clar/resources/status/.gitted/objects/a6/191982709b746d5650e93c2acf34ef74e11504 b/tests-clar/resources/status/.gitted/objects/a6/191982709b746d5650e93c2acf34ef74e11504
new file mode 100644
index 0000000..cc1f377
Binary files /dev/null and b/tests-clar/resources/status/.gitted/objects/a6/191982709b746d5650e93c2acf34ef74e11504 differ
diff --git a/tests-clar/resources/status/.gitted/objects/a6/be623522ce87a1d862128ac42672604f7b468b b/tests-clar/resources/status/.gitted/objects/a6/be623522ce87a1d862128ac42672604f7b468b
new file mode 100644
index 0000000..c472983
Binary files /dev/null and b/tests-clar/resources/status/.gitted/objects/a6/be623522ce87a1d862128ac42672604f7b468b differ
diff --git a/tests-clar/resources/status/.gitted/objects/aa/27a641456848200fdb7f7c99ba36f8a0952877 b/tests-clar/resources/status/.gitted/objects/aa/27a641456848200fdb7f7c99ba36f8a0952877
new file mode 100644
index 0000000..a4669cc
Binary files /dev/null and b/tests-clar/resources/status/.gitted/objects/aa/27a641456848200fdb7f7c99ba36f8a0952877 differ
diff --git a/tests-clar/resources/status/.gitted/objects/da/bc8af9bd6e9f5bbe96a176f1a24baf3d1f8916 b/tests-clar/resources/status/.gitted/objects/da/bc8af9bd6e9f5bbe96a176f1a24baf3d1f8916
new file mode 100644
index 0000000..3e3c03c
Binary files /dev/null and b/tests-clar/resources/status/.gitted/objects/da/bc8af9bd6e9f5bbe96a176f1a24baf3d1f8916 differ
diff --git a/tests-clar/resources/status/.gitted/objects/e8/ee89e15bbe9b20137715232387b3de5b28972e b/tests-clar/resources/status/.gitted/objects/e8/ee89e15bbe9b20137715232387b3de5b28972e
new file mode 100644
index 0000000..cfc2413
Binary files /dev/null and b/tests-clar/resources/status/.gitted/objects/e8/ee89e15bbe9b20137715232387b3de5b28972e differ
diff --git a/tests-clar/resources/status/.gitted/objects/e9/b9107f290627c04d097733a10055af941f6bca b/tests-clar/resources/status/.gitted/objects/e9/b9107f290627c04d097733a10055af941f6bca
new file mode 100644
index 0000000..1266d3e
Binary files /dev/null and b/tests-clar/resources/status/.gitted/objects/e9/b9107f290627c04d097733a10055af941f6bca differ
diff --git a/tests-clar/resources/status/.gitted/objects/ed/062903b8f6f3dccb2fa81117ba6590944ef9bd b/tests-clar/resources/status/.gitted/objects/ed/062903b8f6f3dccb2fa81117ba6590944ef9bd
new file mode 100644
index 0000000..8fa8c17
Binary files /dev/null and b/tests-clar/resources/status/.gitted/objects/ed/062903b8f6f3dccb2fa81117ba6590944ef9bd differ
diff --git a/tests-clar/resources/status/.gitted/refs/heads/master b/tests-clar/resources/status/.gitted/refs/heads/master
new file mode 100644
index 0000000..3e2e2a0
--- /dev/null
+++ b/tests-clar/resources/status/.gitted/refs/heads/master
@@ -0,0 +1 @@
+26a125ee1bfc5df1e1b2e9441bbe63c8a7ae989f
diff --git a/tests-clar/resources/status/current_file b/tests-clar/resources/status/current_file
new file mode 100644
index 0000000..a0de7e0
--- /dev/null
+++ b/tests-clar/resources/status/current_file
@@ -0,0 +1 @@
+current_file
diff --git a/tests-clar/resources/status/ignored_file b/tests-clar/resources/status/ignored_file
new file mode 100644
index 0000000..6a79f80
--- /dev/null
+++ b/tests-clar/resources/status/ignored_file
@@ -0,0 +1 @@
+ignored_file
diff --git a/tests-clar/resources/status/modified_file b/tests-clar/resources/status/modified_file
new file mode 100644
index 0000000..0a53963
--- /dev/null
+++ b/tests-clar/resources/status/modified_file
@@ -0,0 +1,2 @@
+modified_file
+modified_file
diff --git a/tests-clar/resources/status/new_file b/tests-clar/resources/status/new_file
new file mode 100644
index 0000000..d4fa860
--- /dev/null
+++ b/tests-clar/resources/status/new_file
@@ -0,0 +1 @@
+new_file
diff --git a/tests-clar/resources/status/staged_changes b/tests-clar/resources/status/staged_changes
new file mode 100644
index 0000000..55d316c
--- /dev/null
+++ b/tests-clar/resources/status/staged_changes
@@ -0,0 +1,2 @@
+staged_changes
+staged_changes
diff --git a/tests-clar/resources/status/staged_changes_modified_file b/tests-clar/resources/status/staged_changes_modified_file
new file mode 100644
index 0000000..011c344
--- /dev/null
+++ b/tests-clar/resources/status/staged_changes_modified_file
@@ -0,0 +1,3 @@
+staged_changes_modified_file
+staged_changes_modified_file
+staged_changes_modified_file
diff --git a/tests-clar/resources/status/staged_delete_modified_file b/tests-clar/resources/status/staged_delete_modified_file
new file mode 100644
index 0000000..dabc8af
--- /dev/null
+++ b/tests-clar/resources/status/staged_delete_modified_file
@@ -0,0 +1 @@
+staged_delete_modified_file
diff --git a/tests-clar/resources/status/staged_new_file b/tests-clar/resources/status/staged_new_file
new file mode 100644
index 0000000..529a16e
--- /dev/null
+++ b/tests-clar/resources/status/staged_new_file
@@ -0,0 +1 @@
+staged_new_file
diff --git a/tests-clar/resources/status/staged_new_file_modified_file b/tests-clar/resources/status/staged_new_file_modified_file
new file mode 100644
index 0000000..8b090c0
--- /dev/null
+++ b/tests-clar/resources/status/staged_new_file_modified_file
@@ -0,0 +1,2 @@
+staged_new_file_modified_file
+staged_new_file_modified_file
diff --git a/tests-clar/resources/status/subdir.txt b/tests-clar/resources/status/subdir.txt
new file mode 100644
index 0000000..e8ee89e
--- /dev/null
+++ b/tests-clar/resources/status/subdir.txt
@@ -0,0 +1,2 @@
+Is it a bird?
+Is it a plane?
diff --git a/tests-clar/resources/status/subdir/current_file b/tests-clar/resources/status/subdir/current_file
new file mode 100644
index 0000000..53ace0d
--- /dev/null
+++ b/tests-clar/resources/status/subdir/current_file
@@ -0,0 +1 @@
+subdir/current_file
diff --git a/tests-clar/resources/status/subdir/modified_file b/tests-clar/resources/status/subdir/modified_file
new file mode 100644
index 0000000..57274b7
--- /dev/null
+++ b/tests-clar/resources/status/subdir/modified_file
@@ -0,0 +1,2 @@
+subdir/modified_file
+subdir/modified_file
diff --git a/tests-clar/resources/status/subdir/new_file b/tests-clar/resources/status/subdir/new_file
new file mode 100644
index 0000000..80a86a6
--- /dev/null
+++ b/tests-clar/resources/status/subdir/new_file
@@ -0,0 +1 @@
+subdir/new_file
diff --git a/tests-clar/resources/testrepo.git/HEAD b/tests-clar/resources/testrepo.git/HEAD
new file mode 100644
index 0000000..cb089cd
--- /dev/null
+++ b/tests-clar/resources/testrepo.git/HEAD
@@ -0,0 +1 @@
+ref: refs/heads/master
diff --git a/tests-clar/resources/testrepo.git/config b/tests-clar/resources/testrepo.git/config
new file mode 100644
index 0000000..1a5aacd
--- /dev/null
+++ b/tests-clar/resources/testrepo.git/config
@@ -0,0 +1,8 @@
+[core]
+ repositoryformatversion = 0
+ filemode = true
+ bare = true
+ logallrefupdates = true
+[remote "test"]
+ url = git://github.com/libgit2/libgit2
+ fetch = +refs/heads/*:refs/remotes/test/*
diff --git a/tests-clar/resources/testrepo.git/head-tracker b/tests-clar/resources/testrepo.git/head-tracker
new file mode 100644
index 0000000..40d876b
--- /dev/null
+++ b/tests-clar/resources/testrepo.git/head-tracker
@@ -0,0 +1 @@
+ref: HEAD
diff --git a/tests-clar/resources/testrepo.git/index b/tests-clar/resources/testrepo.git/index
new file mode 100644
index 0000000..a27fb9c
Binary files /dev/null and b/tests-clar/resources/testrepo.git/index differ
diff --git a/tests-clar/resources/testrepo.git/objects/13/85f264afb75a56a5bec74243be9b367ba4ca08 b/tests-clar/resources/testrepo.git/objects/13/85f264afb75a56a5bec74243be9b367ba4ca08
new file mode 100644
index 0000000..cedb2a2
Binary files /dev/null and b/tests-clar/resources/testrepo.git/objects/13/85f264afb75a56a5bec74243be9b367ba4ca08 differ
diff --git a/tests-clar/resources/testrepo.git/objects/18/1037049a54a1eb5fab404658a3a250b44335d7 b/tests-clar/resources/testrepo.git/objects/18/1037049a54a1eb5fab404658a3a250b44335d7
new file mode 100644
index 0000000..93a16f1
Binary files /dev/null and b/tests-clar/resources/testrepo.git/objects/18/1037049a54a1eb5fab404658a3a250b44335d7 differ
diff --git a/tests-clar/resources/testrepo.git/objects/18/10dff58d8a660512d4832e740f692884338ccd b/tests-clar/resources/testrepo.git/objects/18/10dff58d8a660512d4832e740f692884338ccd
new file mode 100644
index 0000000..ba0bfb3
Binary files /dev/null and b/tests-clar/resources/testrepo.git/objects/18/10dff58d8a660512d4832e740f692884338ccd differ
diff --git a/tests-clar/resources/testrepo.git/objects/1f/67fc4386b2d171e0d21be1c447e12660561f9b b/tests-clar/resources/testrepo.git/objects/1f/67fc4386b2d171e0d21be1c447e12660561f9b
new file mode 100644
index 0000000..225c457
Binary files /dev/null and b/tests-clar/resources/testrepo.git/objects/1f/67fc4386b2d171e0d21be1c447e12660561f9b differ
diff --git a/tests-clar/resources/testrepo.git/objects/27/0b8ea76056d5cad83af921837702d3e3c2924d b/tests-clar/resources/testrepo.git/objects/27/0b8ea76056d5cad83af921837702d3e3c2924d
new file mode 100644
index 0000000..df40d99
Binary files /dev/null and b/tests-clar/resources/testrepo.git/objects/27/0b8ea76056d5cad83af921837702d3e3c2924d differ
diff --git a/tests-clar/resources/testrepo.git/objects/32/59a6bd5b57fb9c1281bb7ed3167b50f224cb54 b/tests-clar/resources/testrepo.git/objects/32/59a6bd5b57fb9c1281bb7ed3167b50f224cb54
new file mode 100644
index 0000000..321eaa8
Binary files /dev/null and b/tests-clar/resources/testrepo.git/objects/32/59a6bd5b57fb9c1281bb7ed3167b50f224cb54 differ
diff --git a/tests-clar/resources/testrepo.git/objects/36/97d64be941a53d4ae8f6a271e4e3fa56b022cc b/tests-clar/resources/testrepo.git/objects/36/97d64be941a53d4ae8f6a271e4e3fa56b022cc
new file mode 100644
index 0000000..9bb5b62
Binary files /dev/null and b/tests-clar/resources/testrepo.git/objects/36/97d64be941a53d4ae8f6a271e4e3fa56b022cc differ
diff --git a/tests-clar/resources/testrepo.git/objects/45/b983be36b73c0788dc9cbcb76cbb80fc7bb057 b/tests-clar/resources/testrepo.git/objects/45/b983be36b73c0788dc9cbcb76cbb80fc7bb057
new file mode 100644
index 0000000..7ca4cee
Binary files /dev/null and b/tests-clar/resources/testrepo.git/objects/45/b983be36b73c0788dc9cbcb76cbb80fc7bb057 differ
diff --git a/tests-clar/resources/testrepo.git/objects/4a/202b346bb0fb0db7eff3cffeb3c70babbd2045 b/tests-clar/resources/testrepo.git/objects/4a/202b346bb0fb0db7eff3cffeb3c70babbd2045
new file mode 100644
index 0000000..8953b6c
--- /dev/null
+++ b/tests-clar/resources/testrepo.git/objects/4a/202b346bb0fb0db7eff3cffeb3c70babbd2045
@@ -0,0 +1,2 @@
+xŽQ
+Â0DýÎ)öÊ6›Í¦ "xO°‰‰-ØFb¼¿EoàÏ0¼Ç¤º,ske×[ÎPn8R,EpD?±gŸ}Ê^3²âÙ<µåµGŽhYKÄèÒ8ЖDAÉ)¿ÉÈ;gôݧÚàšjïp™4ÕŽ¯ô-çû¢óãêr‚ÁŠ;°s°GA4Ûº=ìùÖ(ôin7øIÌKÍFE
\ No newline at end of file
diff --git a/tests-clar/resources/testrepo.git/objects/5b/5b025afb0b4c913b4c338a42934a3863bf3644 b/tests-clar/resources/testrepo.git/objects/5b/5b025afb0b4c913b4c338a42934a3863bf3644
new file mode 100644
index 0000000..c1f22c5
--- /dev/null
+++ b/tests-clar/resources/testrepo.git/objects/5b/5b025afb0b4c913b4c338a42934a3863bf3644
@@ -0,0 +1,2 @@
+xŽÛ 1EýNi@™Ék2 "X‚$ÙYW0YcÿíÀ¿Ã…s¸¥ÕzïÚÚõMDÏ€0æœ8!¶†ÉÌÞs‰XŠªgÚdí::@X0»P¢wÙ"F/‰‰œÍRàˆUz÷¥múZZïú²¤ÒV}|•/œo5݇ÒêI£!¬1z Æ:vùÇUim}ê/¢>
+öF-
\ No newline at end of file
diff --git a/tests-clar/resources/testrepo.git/objects/75/057dd4114e74cca1d750d0aee1647c903cb60a b/tests-clar/resources/testrepo.git/objects/75/057dd4114e74cca1d750d0aee1647c903cb60a
new file mode 100644
index 0000000..2ef4faa
Binary files /dev/null and b/tests-clar/resources/testrepo.git/objects/75/057dd4114e74cca1d750d0aee1647c903cb60a differ
diff --git a/tests-clar/resources/testrepo.git/objects/76/3d71aadf09a7951596c9746c024e7eece7c7af b/tests-clar/resources/testrepo.git/objects/76/3d71aadf09a7951596c9746c024e7eece7c7af
new file mode 100644
index 0000000..716b0c6
--- /dev/null
+++ b/tests-clar/resources/testrepo.git/objects/76/3d71aadf09a7951596c9746c024e7eece7c7af
@@ -0,0 +1 @@
+xŽAj!³ö?0¨£ßÂ09Êo}HÚ6¨}ÿôjUPP©ÕZ&Yÿø˜ AÔ›±€pŒÁFdë¼÷pz[fŽYŒ½PÒqLJ.,Z§`™Å®Ð.ù`’vÙ³q
$Æ5+9çOëtœû>Û/úDE/龡W¯ï*e¿§VŸdf1>ðè¦Öê²×äÄ›¹úÊ™F« ìTŽÙhœk.i¶^0Ô?P¼R,
\ No newline at end of file
diff --git a/tests-clar/resources/testrepo.git/objects/7b/4384978d2493e851f9cca7858815fac9b10980 b/tests-clar/resources/testrepo.git/objects/7b/4384978d2493e851f9cca7858815fac9b10980
new file mode 100644
index 0000000..23c462f
Binary files /dev/null and b/tests-clar/resources/testrepo.git/objects/7b/4384978d2493e851f9cca7858815fac9b10980 differ
diff --git a/tests-clar/resources/testrepo.git/objects/81/4889a078c031f61ed08ab5fa863aea9314344d b/tests-clar/resources/testrepo.git/objects/81/4889a078c031f61ed08ab5fa863aea9314344d
new file mode 100644
index 0000000..2f9b6b6
Binary files /dev/null and b/tests-clar/resources/testrepo.git/objects/81/4889a078c031f61ed08ab5fa863aea9314344d differ
diff --git a/tests-clar/resources/testrepo.git/objects/84/96071c1b46c854b31185ea97743be6a8774479 b/tests-clar/resources/testrepo.git/objects/84/96071c1b46c854b31185ea97743be6a8774479
new file mode 100644
index 0000000..5df58dd
Binary files /dev/null and b/tests-clar/resources/testrepo.git/objects/84/96071c1b46c854b31185ea97743be6a8774479 differ
diff --git a/tests-clar/resources/testrepo.git/objects/94/4c0f6e4dfa41595e6eb3ceecdb14f50fe18162 b/tests-clar/resources/testrepo.git/objects/94/4c0f6e4dfa41595e6eb3ceecdb14f50fe18162
new file mode 100644
index 0000000..4cc3f4d
--- /dev/null
+++ b/tests-clar/resources/testrepo.git/objects/94/4c0f6e4dfa41595e6eb3ceecdb14f50fe18162
@@ -0,0 +1 @@
+x+)JMU044b040031QrutñueX¡l¨ðmmA‹m›Ì£íJ}Gß;U‘T”˜—œŸ–™“ªWRQÂ`6ýš÷KÇ¥¶^/¾-*|òøWØ¥3P¥y©å`%ËEÛÞ±\&gŽÐ|Ÿ0§ÿ†{Ó1X
\ No newline at end of file
diff --git a/tests-clar/resources/testrepo.git/objects/9a/03079b8a8ee85a0bee58bf9be3da8b62414ed4 b/tests-clar/resources/testrepo.git/objects/9a/03079b8a8ee85a0bee58bf9be3da8b62414ed4
new file mode 100644
index 0000000..bf7b2bb
Binary files /dev/null and b/tests-clar/resources/testrepo.git/objects/9a/03079b8a8ee85a0bee58bf9be3da8b62414ed4 differ
diff --git a/tests-clar/resources/testrepo.git/objects/9f/d738e8f7967c078dceed8190330fc8648ee56a b/tests-clar/resources/testrepo.git/objects/9f/d738e8f7967c078dceed8190330fc8648ee56a
new file mode 100644
index 0000000..a796124
--- /dev/null
+++ b/tests-clar/resources/testrepo.git/objects/9f/d738e8f7967c078dceed8190330fc8648ee56a
@@ -0,0 +1,3 @@
+xŽ[
+Â0EýÎ*fÊäÕ¤ "¸W0“‡-ØFâtÿÝ—çpS[–YÀ˜x^
+Díb CLhutɉ}¥8X*4Zí¬sY½¨—UÀ‘AÃÖ
ÌX3‡R«Mµ¶) s6è¼¢M¦ÖážšÜ&Jm…ó;}Çõ±Ðü<¥¶\@›à‚ÑÞpÄ€¨vº?”ò«jÛºLð«¨Ø?Hå
\ No newline at end of file
diff --git a/tests-clar/resources/testrepo.git/objects/a4/a7dce85cf63874e984719f4fdd239f5145052f b/tests-clar/resources/testrepo.git/objects/a4/a7dce85cf63874e984719f4fdd239f5145052f
new file mode 100644
index 0000000..f858869
--- /dev/null
+++ b/tests-clar/resources/testrepo.git/objects/a4/a7dce85cf63874e984719f4fdd239f5145052f
@@ -0,0 +1,2 @@
+x;j1DëmdÓú·À˜ÇŽ|M«µ3`ŒV{>€³âQ¯ ¸·vL0I?Í!š4–Z=Ê! צ8²F¢Ã’!rÖsQßyÈ9]$DŽ&„l6AÇ>jFWüÒµIKNiûë§Z¢%¡SˆŒ‘
+‹Ò ÅʉøU~̽øä>'¼ï™û ¯wþ
×[ËÇ×÷öÚDGÚ¡±ðŒQ-ºMù«>dܶ‘OÞáÒò}í\à8g_ШÂoYr
\ No newline at end of file
diff --git a/tests-clar/resources/testrepo.git/objects/a6/5fedf39aefe402d3bb6e24df4d4f5fe4547750 b/tests-clar/resources/testrepo.git/objects/a6/5fedf39aefe402d3bb6e24df4d4f5fe4547750
new file mode 100644
index 0000000..29c8e82
--- /dev/null
+++ b/tests-clar/resources/testrepo.git/objects/a6/5fedf39aefe402d3bb6e24df4d4f5fe4547750
@@ -0,0 +1,3 @@
+xŽQ
+!@ûösBQ"‚ŽÐ ÆÙ±
rÍîßÒú{<xð¤·öàîƪ
+™HlJSer!ZPTe*Žj°UÝÑEo^¼ê2 (†ˆ¬XSÅ€ED‘ƒO<Y¦šj$2üs_á&}¸Î,}Ó[~p¹7~<ÒÛ:Ÿ £°·ÉZ³Ùípè?1_ûåC0
\ No newline at end of file
diff --git a/tests-clar/resources/testrepo.git/objects/a7/1586c1dfe8a71c6cbf6c129f404c5642ff31bd b/tests-clar/resources/testrepo.git/objects/a7/1586c1dfe8a71c6cbf6c129f404c5642ff31bd
new file mode 100644
index 0000000..d0d7e73
Binary files /dev/null and b/tests-clar/resources/testrepo.git/objects/a7/1586c1dfe8a71c6cbf6c129f404c5642ff31bd differ
diff --git a/tests-clar/resources/testrepo.git/objects/a8/233120f6ad708f843d861ce2b7228ec4e3dec6 b/tests-clar/resources/testrepo.git/objects/a8/233120f6ad708f843d861ce2b7228ec4e3dec6
new file mode 100644
index 0000000..18a7f61
Binary files /dev/null and b/tests-clar/resources/testrepo.git/objects/a8/233120f6ad708f843d861ce2b7228ec4e3dec6 differ
diff --git a/tests-clar/resources/testrepo.git/objects/ae/90f12eea699729ed24555e40b9fd669da12a12 b/tests-clar/resources/testrepo.git/objects/ae/90f12eea699729ed24555e40b9fd669da12a12
new file mode 100644
index 0000000..d952546
Binary files /dev/null and b/tests-clar/resources/testrepo.git/objects/ae/90f12eea699729ed24555e40b9fd669da12a12 differ
diff --git a/tests-clar/resources/testrepo.git/objects/b2/5fa35b38051e4ae45d4222e795f9df2e43f1d1 b/tests-clar/resources/testrepo.git/objects/b2/5fa35b38051e4ae45d4222e795f9df2e43f1d1
new file mode 100644
index 0000000..f460f25
--- /dev/null
+++ b/tests-clar/resources/testrepo.git/objects/b2/5fa35b38051e4ae45d4222e795f9df2e43f1d1
@@ -0,0 +1,2 @@
+xÌA
+Â0…a×9ÅìIÒ ™€ˆp'î§1Ѷ‘v\x{cáýðVŸpƒvWûgŠ¾ÇŽ0xº[]"g†#{rDÆ
Cot äûN œU$ò?9-p+1Í^¤ÀQx®¯Ï9O\ÆC¬Ó Œm'D
{mµVêú(+´ñælè¶,Þ
\ No newline at end of file
diff --git a/tests-clar/resources/testrepo.git/objects/b6/361fc6a97178d8fc8639fdeed71c775ab52593 b/tests-clar/resources/testrepo.git/objects/b6/361fc6a97178d8fc8639fdeed71c775ab52593
new file mode 100644
index 0000000..f613670
Binary files /dev/null and b/tests-clar/resources/testrepo.git/objects/b6/361fc6a97178d8fc8639fdeed71c775ab52593 differ
diff --git a/tests-clar/resources/testrepo.git/objects/be/3563ae3f795b2b4353bcce3a527ad0a4f7f644 b/tests-clar/resources/testrepo.git/objects/be/3563ae3f795b2b4353bcce3a527ad0a4f7f644
new file mode 100644
index 0000000..0817229
--- /dev/null
+++ b/tests-clar/resources/testrepo.git/objects/be/3563ae3f795b2b4353bcce3a527ad0a4f7f644
@@ -0,0 +1,3 @@
+xKj1D³Ö)zçUBëÛ-0ÁuV9¦Õò<#£È÷ÏȲ+ŠW<Jú¶Ý&8Ê/s¨‚e‹µµÈ•KJ«½S
+ØRvÌÁ{©æQ†îr«äY¹QN$H\Eµ²Íè=6áX5¦òÇK Fr)·(‰dC‡Î†”–œ—jÊs®}À—ô9ác-Òw8Ëo¸\·r»¿IßÞÁ:
+l}F‚W$Ds´Ç£©ÿÙšOW…e”]V8-ÃÌÈ"U
\ No newline at end of file
diff --git a/tests-clar/resources/testrepo.git/objects/c4/7800c7266a2be04c571c04d5a6614691ea99bd b/tests-clar/resources/testrepo.git/objects/c4/7800c7266a2be04c571c04d5a6614691ea99bd
new file mode 100644
index 0000000..75f541f
--- /dev/null
+++ b/tests-clar/resources/testrepo.git/objects/c4/7800c7266a2be04c571c04d5a6614691ea99bd
@@ -0,0 +1,3 @@
+xŽQ
+Â0DýÎ)öʦ»I<‚'ØlR+˜Fj¼¿EoàÏ0<xÃh«õÞa Üõµ]È™åXUlÞPF)Åz‘4yó”µ,\r 'SÂÄ-mI4
+‘Xhô”&òÌFÞ}n+\µõ—Y´-p|é·œoUz;-‘aÑlt{ØË?®I«,:ÃoÚR̳cHK
\ No newline at end of file
diff --git a/tests-clar/resources/testrepo.git/objects/d6/c93164c249c8000205dd4ec5cbca1b516d487f b/tests-clar/resources/testrepo.git/objects/d6/c93164c249c8000205dd4ec5cbca1b516d487f
new file mode 100644
index 0000000..a67d6e6
Binary files /dev/null and b/tests-clar/resources/testrepo.git/objects/d6/c93164c249c8000205dd4ec5cbca1b516d487f differ
diff --git a/tests-clar/resources/testrepo.git/objects/e6/9de29bb2d1d6434b8b29ae775ad8c2e48c5391 b/tests-clar/resources/testrepo.git/objects/e6/9de29bb2d1d6434b8b29ae775ad8c2e48c5391
new file mode 100644
index 0000000..7112238
Binary files /dev/null and b/tests-clar/resources/testrepo.git/objects/e6/9de29bb2d1d6434b8b29ae775ad8c2e48c5391 differ
diff --git a/tests-clar/resources/testrepo.git/objects/e7/b4ad382349ff96dd8199000580b9b1e2042eb0 b/tests-clar/resources/testrepo.git/objects/e7/b4ad382349ff96dd8199000580b9b1e2042eb0
new file mode 100644
index 0000000..b135ecc
Binary files /dev/null and b/tests-clar/resources/testrepo.git/objects/e7/b4ad382349ff96dd8199000580b9b1e2042eb0 differ
diff --git a/tests-clar/resources/testrepo.git/objects/f1/425cef211cc08caa31e7b545ffb232acb098c3 b/tests-clar/resources/testrepo.git/objects/f1/425cef211cc08caa31e7b545ffb232acb098c3
new file mode 100644
index 0000000..82e2790
Binary files /dev/null and b/tests-clar/resources/testrepo.git/objects/f1/425cef211cc08caa31e7b545ffb232acb098c3 differ
diff --git a/tests-clar/resources/testrepo.git/objects/f6/0079018b664e4e79329a7ef9559c8d9e0378d1 b/tests-clar/resources/testrepo.git/objects/f6/0079018b664e4e79329a7ef9559c8d9e0378d1
new file mode 100644
index 0000000..697c94c
Binary files /dev/null and b/tests-clar/resources/testrepo.git/objects/f6/0079018b664e4e79329a7ef9559c8d9e0378d1 differ
diff --git a/tests-clar/resources/testrepo.git/objects/fa/49b077972391ad58037050f2a75f74e3671e92 b/tests-clar/resources/testrepo.git/objects/fa/49b077972391ad58037050f2a75f74e3671e92
new file mode 100644
index 0000000..112998d
Binary files /dev/null and b/tests-clar/resources/testrepo.git/objects/fa/49b077972391ad58037050f2a75f74e3671e92 differ
diff --git a/tests-clar/resources/testrepo.git/objects/fd/093bff70906175335656e6ce6ae05783708765 b/tests-clar/resources/testrepo.git/objects/fd/093bff70906175335656e6ce6ae05783708765
new file mode 100644
index 0000000..12bf5f3
Binary files /dev/null and b/tests-clar/resources/testrepo.git/objects/fd/093bff70906175335656e6ce6ae05783708765 differ
diff --git a/tests-clar/resources/testrepo.git/objects/pack/pack-a81e489679b7d3418f9ab594bda8ceb37dd4c695.idx b/tests-clar/resources/testrepo.git/objects/pack/pack-a81e489679b7d3418f9ab594bda8ceb37dd4c695.idx
new file mode 100644
index 0000000..5068f28
Binary files /dev/null and b/tests-clar/resources/testrepo.git/objects/pack/pack-a81e489679b7d3418f9ab594bda8ceb37dd4c695.idx differ
diff --git a/tests-clar/resources/testrepo.git/objects/pack/pack-a81e489679b7d3418f9ab594bda8ceb37dd4c695.pack b/tests-clar/resources/testrepo.git/objects/pack/pack-a81e489679b7d3418f9ab594bda8ceb37dd4c695.pack
new file mode 100644
index 0000000..a6a1f30
Binary files /dev/null and b/tests-clar/resources/testrepo.git/objects/pack/pack-a81e489679b7d3418f9ab594bda8ceb37dd4c695.pack differ
diff --git a/tests-clar/resources/testrepo.git/objects/pack/pack-d7c6adf9f61318f041845b01440d09aa7a91e1b5.idx b/tests-clar/resources/testrepo.git/objects/pack/pack-d7c6adf9f61318f041845b01440d09aa7a91e1b5.idx
new file mode 100644
index 0000000..94c3c71
Binary files /dev/null and b/tests-clar/resources/testrepo.git/objects/pack/pack-d7c6adf9f61318f041845b01440d09aa7a91e1b5.idx differ
diff --git a/tests-clar/resources/testrepo.git/objects/pack/pack-d7c6adf9f61318f041845b01440d09aa7a91e1b5.pack b/tests-clar/resources/testrepo.git/objects/pack/pack-d7c6adf9f61318f041845b01440d09aa7a91e1b5.pack
new file mode 100644
index 0000000..74c7fe4
Binary files /dev/null and b/tests-clar/resources/testrepo.git/objects/pack/pack-d7c6adf9f61318f041845b01440d09aa7a91e1b5.pack differ
diff --git a/tests-clar/resources/testrepo.git/objects/pack/pack-d85f5d483273108c9d8dd0e4728ccf0b2982423a.idx b/tests-clar/resources/testrepo.git/objects/pack/pack-d85f5d483273108c9d8dd0e4728ccf0b2982423a.idx
new file mode 100644
index 0000000..555cfa9
Binary files /dev/null and b/tests-clar/resources/testrepo.git/objects/pack/pack-d85f5d483273108c9d8dd0e4728ccf0b2982423a.idx differ
diff --git a/tests-clar/resources/testrepo.git/objects/pack/pack-d85f5d483273108c9d8dd0e4728ccf0b2982423a.pack b/tests-clar/resources/testrepo.git/objects/pack/pack-d85f5d483273108c9d8dd0e4728ccf0b2982423a.pack
new file mode 100644
index 0000000..4d539ed
Binary files /dev/null and b/tests-clar/resources/testrepo.git/objects/pack/pack-d85f5d483273108c9d8dd0e4728ccf0b2982423a.pack differ
diff --git a/tests-clar/resources/testrepo.git/packed-refs b/tests-clar/resources/testrepo.git/packed-refs
new file mode 100644
index 0000000..52f5e87
--- /dev/null
+++ b/tests-clar/resources/testrepo.git/packed-refs
@@ -0,0 +1,3 @@
+# pack-refs with: peeled
+41bc8c69075bbdb46c5c6f0566cc8cc5b46e8bd9 refs/heads/packed
+5b5b025afb0b4c913b4c338a42934a3863bf3644 refs/heads/packed-test
diff --git a/tests-clar/resources/testrepo.git/refs/heads/br2 b/tests-clar/resources/testrepo.git/refs/heads/br2
new file mode 100644
index 0000000..aab87e5
--- /dev/null
+++ b/tests-clar/resources/testrepo.git/refs/heads/br2
@@ -0,0 +1 @@
+a4a7dce85cf63874e984719f4fdd239f5145052f
diff --git a/tests-clar/resources/testrepo.git/refs/heads/master b/tests-clar/resources/testrepo.git/refs/heads/master
new file mode 100644
index 0000000..3d8f0a4
--- /dev/null
+++ b/tests-clar/resources/testrepo.git/refs/heads/master
@@ -0,0 +1 @@
+a65fedf39aefe402d3bb6e24df4d4f5fe4547750
diff --git a/tests-clar/resources/testrepo.git/refs/heads/packed-test b/tests-clar/resources/testrepo.git/refs/heads/packed-test
new file mode 100644
index 0000000..f2c14ad
--- /dev/null
+++ b/tests-clar/resources/testrepo.git/refs/heads/packed-test
@@ -0,0 +1 @@
+4a202b346bb0fb0db7eff3cffeb3c70babbd2045
diff --git a/tests-clar/resources/testrepo.git/refs/heads/subtrees b/tests-clar/resources/testrepo.git/refs/heads/subtrees
new file mode 100644
index 0000000..ad27e0b
--- /dev/null
+++ b/tests-clar/resources/testrepo.git/refs/heads/subtrees
@@ -0,0 +1 @@
+763d71aadf09a7951596c9746c024e7eece7c7af
diff --git a/tests-clar/resources/testrepo.git/refs/heads/test b/tests-clar/resources/testrepo.git/refs/heads/test
new file mode 100644
index 0000000..399c4c7
--- /dev/null
+++ b/tests-clar/resources/testrepo.git/refs/heads/test
@@ -0,0 +1 @@
+e90810b8df3e80c413d903f631643c716887138d
diff --git a/tests-clar/resources/testrepo.git/refs/tags/e90810b b/tests-clar/resources/testrepo.git/refs/tags/e90810b
new file mode 100644
index 0000000..584495d
--- /dev/null
+++ b/tests-clar/resources/testrepo.git/refs/tags/e90810b
@@ -0,0 +1 @@
+7b4384978d2493e851f9cca7858815fac9b10980
diff --git a/tests-clar/resources/testrepo.git/refs/tags/point_to_blob b/tests-clar/resources/testrepo.git/refs/tags/point_to_blob
new file mode 100644
index 0000000..f874a3f
--- /dev/null
+++ b/tests-clar/resources/testrepo.git/refs/tags/point_to_blob
@@ -0,0 +1 @@
+1385f264afb75a56a5bec74243be9b367ba4ca08
diff --git a/tests-clar/resources/testrepo.git/refs/tags/test b/tests-clar/resources/testrepo.git/refs/tags/test
new file mode 100644
index 0000000..6ee952a
--- /dev/null
+++ b/tests-clar/resources/testrepo.git/refs/tags/test
@@ -0,0 +1 @@
+b25fa35b38051e4ae45d4222e795f9df2e43f1d1
diff --git a/tests-clar/resources/testrepo/.gitted/HEAD b/tests-clar/resources/testrepo/.gitted/HEAD
new file mode 100644
index 0000000..cb089cd
--- /dev/null
+++ b/tests-clar/resources/testrepo/.gitted/HEAD
@@ -0,0 +1 @@
+ref: refs/heads/master
diff --git a/tests-clar/resources/testrepo/.gitted/config b/tests-clar/resources/testrepo/.gitted/config
new file mode 100644
index 0000000..1a5aacd
--- /dev/null
+++ b/tests-clar/resources/testrepo/.gitted/config
@@ -0,0 +1,8 @@
+[core]
+ repositoryformatversion = 0
+ filemode = true
+ bare = true
+ logallrefupdates = true
+[remote "test"]
+ url = git://github.com/libgit2/libgit2
+ fetch = +refs/heads/*:refs/remotes/test/*
diff --git a/tests-clar/resources/testrepo/.gitted/head-tracker b/tests-clar/resources/testrepo/.gitted/head-tracker
new file mode 100644
index 0000000..40d876b
--- /dev/null
+++ b/tests-clar/resources/testrepo/.gitted/head-tracker
@@ -0,0 +1 @@
+ref: HEAD
diff --git a/tests-clar/resources/testrepo/.gitted/index b/tests-clar/resources/testrepo/.gitted/index
new file mode 100644
index 0000000..a27fb9c
Binary files /dev/null and b/tests-clar/resources/testrepo/.gitted/index differ
diff --git a/tests-clar/resources/testrepo/.gitted/objects/13/85f264afb75a56a5bec74243be9b367ba4ca08 b/tests-clar/resources/testrepo/.gitted/objects/13/85f264afb75a56a5bec74243be9b367ba4ca08
new file mode 100644
index 0000000..cedb2a2
Binary files /dev/null and b/tests-clar/resources/testrepo/.gitted/objects/13/85f264afb75a56a5bec74243be9b367ba4ca08 differ
diff --git a/tests-clar/resources/testrepo/.gitted/objects/18/1037049a54a1eb5fab404658a3a250b44335d7 b/tests-clar/resources/testrepo/.gitted/objects/18/1037049a54a1eb5fab404658a3a250b44335d7
new file mode 100644
index 0000000..93a16f1
Binary files /dev/null and b/tests-clar/resources/testrepo/.gitted/objects/18/1037049a54a1eb5fab404658a3a250b44335d7 differ
diff --git a/tests-clar/resources/testrepo/.gitted/objects/18/10dff58d8a660512d4832e740f692884338ccd b/tests-clar/resources/testrepo/.gitted/objects/18/10dff58d8a660512d4832e740f692884338ccd
new file mode 100644
index 0000000..ba0bfb3
Binary files /dev/null and b/tests-clar/resources/testrepo/.gitted/objects/18/10dff58d8a660512d4832e740f692884338ccd differ
diff --git a/tests-clar/resources/testrepo/.gitted/objects/1f/67fc4386b2d171e0d21be1c447e12660561f9b b/tests-clar/resources/testrepo/.gitted/objects/1f/67fc4386b2d171e0d21be1c447e12660561f9b
new file mode 100644
index 0000000..225c457
Binary files /dev/null and b/tests-clar/resources/testrepo/.gitted/objects/1f/67fc4386b2d171e0d21be1c447e12660561f9b differ
diff --git a/tests-clar/resources/testrepo/.gitted/objects/27/0b8ea76056d5cad83af921837702d3e3c2924d b/tests-clar/resources/testrepo/.gitted/objects/27/0b8ea76056d5cad83af921837702d3e3c2924d
new file mode 100644
index 0000000..df40d99
Binary files /dev/null and b/tests-clar/resources/testrepo/.gitted/objects/27/0b8ea76056d5cad83af921837702d3e3c2924d differ
diff --git a/tests-clar/resources/testrepo/.gitted/objects/32/59a6bd5b57fb9c1281bb7ed3167b50f224cb54 b/tests-clar/resources/testrepo/.gitted/objects/32/59a6bd5b57fb9c1281bb7ed3167b50f224cb54
new file mode 100644
index 0000000..321eaa8
Binary files /dev/null and b/tests-clar/resources/testrepo/.gitted/objects/32/59a6bd5b57fb9c1281bb7ed3167b50f224cb54 differ
diff --git a/tests-clar/resources/testrepo/.gitted/objects/36/97d64be941a53d4ae8f6a271e4e3fa56b022cc b/tests-clar/resources/testrepo/.gitted/objects/36/97d64be941a53d4ae8f6a271e4e3fa56b022cc
new file mode 100644
index 0000000..9bb5b62
Binary files /dev/null and b/tests-clar/resources/testrepo/.gitted/objects/36/97d64be941a53d4ae8f6a271e4e3fa56b022cc differ
diff --git a/tests-clar/resources/testrepo/.gitted/objects/45/b983be36b73c0788dc9cbcb76cbb80fc7bb057 b/tests-clar/resources/testrepo/.gitted/objects/45/b983be36b73c0788dc9cbcb76cbb80fc7bb057
new file mode 100644
index 0000000..7ca4cee
Binary files /dev/null and b/tests-clar/resources/testrepo/.gitted/objects/45/b983be36b73c0788dc9cbcb76cbb80fc7bb057 differ
diff --git a/tests-clar/resources/testrepo/.gitted/objects/4a/202b346bb0fb0db7eff3cffeb3c70babbd2045 b/tests-clar/resources/testrepo/.gitted/objects/4a/202b346bb0fb0db7eff3cffeb3c70babbd2045
new file mode 100644
index 0000000..8953b6c
--- /dev/null
+++ b/tests-clar/resources/testrepo/.gitted/objects/4a/202b346bb0fb0db7eff3cffeb3c70babbd2045
@@ -0,0 +1,2 @@
+xŽQ
+Â0DýÎ)öÊ6›Í¦ "xO°‰‰-ØFb¼¿EoàÏ0¼Ç¤º,ske×[ÎPn8R,EpD?±gŸ}Ê^3²âÙ<µåµGŽhYKÄèÒ8ЖDAÉ)¿ÉÈ;gôݧÚàšjïp™4ÕŽ¯ô-çû¢óãêr‚ÁŠ;°s°GA4Ûº=ìùÖ(ôin7øIÌKÍFE
\ No newline at end of file
diff --git a/tests-clar/resources/testrepo/.gitted/objects/5b/5b025afb0b4c913b4c338a42934a3863bf3644 b/tests-clar/resources/testrepo/.gitted/objects/5b/5b025afb0b4c913b4c338a42934a3863bf3644
new file mode 100644
index 0000000..c1f22c5
--- /dev/null
+++ b/tests-clar/resources/testrepo/.gitted/objects/5b/5b025afb0b4c913b4c338a42934a3863bf3644
@@ -0,0 +1,2 @@
+xŽÛ 1EýNi@™Ék2 "X‚$ÙYW0YcÿíÀ¿Ã…s¸¥ÕzïÚÚõMDÏ€0æœ8!¶†ÉÌÞs‰XŠªgÚdí::@X0»P¢wÙ"F/‰‰œÍRàˆUz÷¥múZZïú²¤ÒV}|•/œo5݇ÒêI£!¬1z Æ:vùÇUim}ê/¢>
+öF-
\ No newline at end of file
diff --git a/tests-clar/resources/testrepo/.gitted/objects/75/057dd4114e74cca1d750d0aee1647c903cb60a b/tests-clar/resources/testrepo/.gitted/objects/75/057dd4114e74cca1d750d0aee1647c903cb60a
new file mode 100644
index 0000000..2ef4faa
Binary files /dev/null and b/tests-clar/resources/testrepo/.gitted/objects/75/057dd4114e74cca1d750d0aee1647c903cb60a differ
diff --git a/tests-clar/resources/testrepo/.gitted/objects/76/3d71aadf09a7951596c9746c024e7eece7c7af b/tests-clar/resources/testrepo/.gitted/objects/76/3d71aadf09a7951596c9746c024e7eece7c7af
new file mode 100644
index 0000000..716b0c6
--- /dev/null
+++ b/tests-clar/resources/testrepo/.gitted/objects/76/3d71aadf09a7951596c9746c024e7eece7c7af
@@ -0,0 +1 @@
+xŽAj!³ö?0¨£ßÂ09Êo}HÚ6¨}ÿôjUPP©ÕZ&Yÿø˜ AÔ›±€pŒÁFdë¼÷pz[fŽYŒ½PÒqLJ.,Z§`™Å®Ð.ù`’vÙ³q
$Æ5+9çOëtœû>Û/úDE/龡W¯ï*e¿§VŸdf1>ðè¦Öê²×äÄ›¹úÊ™F« ìTŽÙhœk.i¶^0Ô?P¼R,
\ No newline at end of file
diff --git a/tests-clar/resources/testrepo/.gitted/objects/7b/4384978d2493e851f9cca7858815fac9b10980 b/tests-clar/resources/testrepo/.gitted/objects/7b/4384978d2493e851f9cca7858815fac9b10980
new file mode 100644
index 0000000..23c462f
Binary files /dev/null and b/tests-clar/resources/testrepo/.gitted/objects/7b/4384978d2493e851f9cca7858815fac9b10980 differ
diff --git a/tests-clar/resources/testrepo/.gitted/objects/81/4889a078c031f61ed08ab5fa863aea9314344d b/tests-clar/resources/testrepo/.gitted/objects/81/4889a078c031f61ed08ab5fa863aea9314344d
new file mode 100644
index 0000000..2f9b6b6
Binary files /dev/null and b/tests-clar/resources/testrepo/.gitted/objects/81/4889a078c031f61ed08ab5fa863aea9314344d differ
diff --git a/tests-clar/resources/testrepo/.gitted/objects/84/96071c1b46c854b31185ea97743be6a8774479 b/tests-clar/resources/testrepo/.gitted/objects/84/96071c1b46c854b31185ea97743be6a8774479
new file mode 100644
index 0000000..5df58dd
Binary files /dev/null and b/tests-clar/resources/testrepo/.gitted/objects/84/96071c1b46c854b31185ea97743be6a8774479 differ
diff --git a/tests-clar/resources/testrepo/.gitted/objects/94/4c0f6e4dfa41595e6eb3ceecdb14f50fe18162 b/tests-clar/resources/testrepo/.gitted/objects/94/4c0f6e4dfa41595e6eb3ceecdb14f50fe18162
new file mode 100644
index 0000000..4cc3f4d
--- /dev/null
+++ b/tests-clar/resources/testrepo/.gitted/objects/94/4c0f6e4dfa41595e6eb3ceecdb14f50fe18162
@@ -0,0 +1 @@
+x+)JMU044b040031QrutñueX¡l¨ðmmA‹m›Ì£íJ}Gß;U‘T”˜—œŸ–™“ªWRQÂ`6ýš÷KÇ¥¶^/¾-*|òøWØ¥3P¥y©å`%ËEÛÞ±\&gŽÐ|Ÿ0§ÿ†{Ó1X
\ No newline at end of file
diff --git a/tests-clar/resources/testrepo/.gitted/objects/9a/03079b8a8ee85a0bee58bf9be3da8b62414ed4 b/tests-clar/resources/testrepo/.gitted/objects/9a/03079b8a8ee85a0bee58bf9be3da8b62414ed4
new file mode 100644
index 0000000..bf7b2bb
Binary files /dev/null and b/tests-clar/resources/testrepo/.gitted/objects/9a/03079b8a8ee85a0bee58bf9be3da8b62414ed4 differ
diff --git a/tests-clar/resources/testrepo/.gitted/objects/9f/d738e8f7967c078dceed8190330fc8648ee56a b/tests-clar/resources/testrepo/.gitted/objects/9f/d738e8f7967c078dceed8190330fc8648ee56a
new file mode 100644
index 0000000..a796124
--- /dev/null
+++ b/tests-clar/resources/testrepo/.gitted/objects/9f/d738e8f7967c078dceed8190330fc8648ee56a
@@ -0,0 +1,3 @@
+xŽ[
+Â0EýÎ*fÊäÕ¤ "¸W0“‡-ØFâtÿÝ—çpS[–YÀ˜x^
+Díb CLhutɉ}¥8X*4Zí¬sY½¨—UÀ‘AÃÖ
ÌX3‡R«Mµ¶) s6è¼¢M¦ÖážšÜ&Jm…ó;}Çõ±Ðü<¥¶\@›à‚ÑÞpÄ€¨vº?”ò«jÛºLð«¨Ø?Hå
\ No newline at end of file
diff --git a/tests-clar/resources/testrepo/.gitted/objects/a4/a7dce85cf63874e984719f4fdd239f5145052f b/tests-clar/resources/testrepo/.gitted/objects/a4/a7dce85cf63874e984719f4fdd239f5145052f
new file mode 100644
index 0000000..f858869
--- /dev/null
+++ b/tests-clar/resources/testrepo/.gitted/objects/a4/a7dce85cf63874e984719f4fdd239f5145052f
@@ -0,0 +1,2 @@
+x;j1DëmdÓú·À˜ÇŽ|M«µ3`ŒV{>€³âQ¯ ¸·vL0I?Í!š4–Z=Ê! צ8²F¢Ã’!rÖsQßyÈ9]$DŽ&„l6AÇ>jFWüÒµIKNiûë§Z¢%¡SˆŒ‘
+‹Ò ÅʉøU~̽øä>'¼ï™û ¯wþ
×[ËÇ×÷öÚDGÚ¡±ðŒQ-ºMù«>dܶ‘OÞáÒò}í\à8g_ШÂoYr
\ No newline at end of file
diff --git a/tests-clar/resources/testrepo/.gitted/objects/a6/5fedf39aefe402d3bb6e24df4d4f5fe4547750 b/tests-clar/resources/testrepo/.gitted/objects/a6/5fedf39aefe402d3bb6e24df4d4f5fe4547750
new file mode 100644
index 0000000..29c8e82
--- /dev/null
+++ b/tests-clar/resources/testrepo/.gitted/objects/a6/5fedf39aefe402d3bb6e24df4d4f5fe4547750
@@ -0,0 +1,3 @@
+xŽQ
+!@ûösBQ"‚ŽÐ ÆÙ±
rÍîßÒú{<xð¤·öàîƪ
+™HlJSer!ZPTe*Žj°UÝÑEo^¼ê2 (†ˆ¬XSÅ€ED‘ƒO<Y¦šj$2üs_á&}¸Î,}Ó[~p¹7~<ÒÛ:Ÿ £°·ÉZ³Ùípè?1_ûåC0
\ No newline at end of file
diff --git a/tests-clar/resources/testrepo/.gitted/objects/a7/1586c1dfe8a71c6cbf6c129f404c5642ff31bd b/tests-clar/resources/testrepo/.gitted/objects/a7/1586c1dfe8a71c6cbf6c129f404c5642ff31bd
new file mode 100644
index 0000000..d0d7e73
Binary files /dev/null and b/tests-clar/resources/testrepo/.gitted/objects/a7/1586c1dfe8a71c6cbf6c129f404c5642ff31bd differ
diff --git a/tests-clar/resources/testrepo/.gitted/objects/a8/233120f6ad708f843d861ce2b7228ec4e3dec6 b/tests-clar/resources/testrepo/.gitted/objects/a8/233120f6ad708f843d861ce2b7228ec4e3dec6
new file mode 100644
index 0000000..18a7f61
Binary files /dev/null and b/tests-clar/resources/testrepo/.gitted/objects/a8/233120f6ad708f843d861ce2b7228ec4e3dec6 differ
diff --git a/tests-clar/resources/testrepo/.gitted/objects/ae/90f12eea699729ed24555e40b9fd669da12a12 b/tests-clar/resources/testrepo/.gitted/objects/ae/90f12eea699729ed24555e40b9fd669da12a12
new file mode 100644
index 0000000..d952546
Binary files /dev/null and b/tests-clar/resources/testrepo/.gitted/objects/ae/90f12eea699729ed24555e40b9fd669da12a12 differ
diff --git a/tests-clar/resources/testrepo/.gitted/objects/b2/5fa35b38051e4ae45d4222e795f9df2e43f1d1 b/tests-clar/resources/testrepo/.gitted/objects/b2/5fa35b38051e4ae45d4222e795f9df2e43f1d1
new file mode 100644
index 0000000..f460f25
--- /dev/null
+++ b/tests-clar/resources/testrepo/.gitted/objects/b2/5fa35b38051e4ae45d4222e795f9df2e43f1d1
@@ -0,0 +1,2 @@
+xÌA
+Â0…a×9ÅìIÒ ™€ˆp'î§1Ѷ‘v\x{cáýðVŸpƒvWûgŠ¾ÇŽ0xº[]"g†#{rDÆ
Cot äûN œU$ò?9-p+1Í^¤ÀQx®¯Ï9O\ÆC¬Ó Œm'D
{mµVêú(+´ñælè¶,Þ
\ No newline at end of file
diff --git a/tests-clar/resources/testrepo/.gitted/objects/b6/361fc6a97178d8fc8639fdeed71c775ab52593 b/tests-clar/resources/testrepo/.gitted/objects/b6/361fc6a97178d8fc8639fdeed71c775ab52593
new file mode 100644
index 0000000..f613670
Binary files /dev/null and b/tests-clar/resources/testrepo/.gitted/objects/b6/361fc6a97178d8fc8639fdeed71c775ab52593 differ
diff --git a/tests-clar/resources/testrepo/.gitted/objects/be/3563ae3f795b2b4353bcce3a527ad0a4f7f644 b/tests-clar/resources/testrepo/.gitted/objects/be/3563ae3f795b2b4353bcce3a527ad0a4f7f644
new file mode 100644
index 0000000..0817229
--- /dev/null
+++ b/tests-clar/resources/testrepo/.gitted/objects/be/3563ae3f795b2b4353bcce3a527ad0a4f7f644
@@ -0,0 +1,3 @@
+xKj1D³Ö)zçUBëÛ-0ÁuV9¦Õò<#£È÷ÏȲ+ŠW<Jú¶Ý&8Ê/s¨‚e‹µµÈ•KJ«½S
+ØRvÌÁ{©æQ†îr«äY¹QN$H\Eµ²Íè=6áX5¦òÇK Fr)·(‰dC‡Î†”–œ—jÊs®}À—ô9ác-Òw8Ëo¸\·r»¿IßÞÁ:
+l}F‚W$Ds´Ç£©ÿÙšOW…e”]V8-ÃÌÈ"U
\ No newline at end of file
diff --git a/tests-clar/resources/testrepo/.gitted/objects/c4/7800c7266a2be04c571c04d5a6614691ea99bd b/tests-clar/resources/testrepo/.gitted/objects/c4/7800c7266a2be04c571c04d5a6614691ea99bd
new file mode 100644
index 0000000..75f541f
--- /dev/null
+++ b/tests-clar/resources/testrepo/.gitted/objects/c4/7800c7266a2be04c571c04d5a6614691ea99bd
@@ -0,0 +1,3 @@
+xŽQ
+Â0DýÎ)öʦ»I<‚'ØlR+˜Fj¼¿EoàÏ0<xÃh«õÞa Üõµ]È™åXUlÞPF)Åz‘4yó”µ,\r 'SÂÄ-mI4
+‘Xhô”&òÌFÞ}n+\µõ—Y´-p|é·œoUz;-‘aÑlt{ØË?®I«,:ÃoÚR̳cHK
\ No newline at end of file
diff --git a/tests-clar/resources/testrepo/.gitted/objects/d6/c93164c249c8000205dd4ec5cbca1b516d487f b/tests-clar/resources/testrepo/.gitted/objects/d6/c93164c249c8000205dd4ec5cbca1b516d487f
new file mode 100644
index 0000000..a67d6e6
Binary files /dev/null and b/tests-clar/resources/testrepo/.gitted/objects/d6/c93164c249c8000205dd4ec5cbca1b516d487f differ
diff --git a/tests-clar/resources/testrepo/.gitted/objects/e6/9de29bb2d1d6434b8b29ae775ad8c2e48c5391 b/tests-clar/resources/testrepo/.gitted/objects/e6/9de29bb2d1d6434b8b29ae775ad8c2e48c5391
new file mode 100644
index 0000000..7112238
Binary files /dev/null and b/tests-clar/resources/testrepo/.gitted/objects/e6/9de29bb2d1d6434b8b29ae775ad8c2e48c5391 differ
diff --git a/tests-clar/resources/testrepo/.gitted/objects/e7/b4ad382349ff96dd8199000580b9b1e2042eb0 b/tests-clar/resources/testrepo/.gitted/objects/e7/b4ad382349ff96dd8199000580b9b1e2042eb0
new file mode 100644
index 0000000..b135ecc
Binary files /dev/null and b/tests-clar/resources/testrepo/.gitted/objects/e7/b4ad382349ff96dd8199000580b9b1e2042eb0 differ
diff --git a/tests-clar/resources/testrepo/.gitted/objects/f1/425cef211cc08caa31e7b545ffb232acb098c3 b/tests-clar/resources/testrepo/.gitted/objects/f1/425cef211cc08caa31e7b545ffb232acb098c3
new file mode 100644
index 0000000..82e2790
Binary files /dev/null and b/tests-clar/resources/testrepo/.gitted/objects/f1/425cef211cc08caa31e7b545ffb232acb098c3 differ
diff --git a/tests-clar/resources/testrepo/.gitted/objects/f6/0079018b664e4e79329a7ef9559c8d9e0378d1 b/tests-clar/resources/testrepo/.gitted/objects/f6/0079018b664e4e79329a7ef9559c8d9e0378d1
new file mode 100644
index 0000000..697c94c
Binary files /dev/null and b/tests-clar/resources/testrepo/.gitted/objects/f6/0079018b664e4e79329a7ef9559c8d9e0378d1 differ
diff --git a/tests-clar/resources/testrepo/.gitted/objects/fa/49b077972391ad58037050f2a75f74e3671e92 b/tests-clar/resources/testrepo/.gitted/objects/fa/49b077972391ad58037050f2a75f74e3671e92
new file mode 100644
index 0000000..112998d
Binary files /dev/null and b/tests-clar/resources/testrepo/.gitted/objects/fa/49b077972391ad58037050f2a75f74e3671e92 differ
diff --git a/tests-clar/resources/testrepo/.gitted/objects/fd/093bff70906175335656e6ce6ae05783708765 b/tests-clar/resources/testrepo/.gitted/objects/fd/093bff70906175335656e6ce6ae05783708765
new file mode 100644
index 0000000..12bf5f3
Binary files /dev/null and b/tests-clar/resources/testrepo/.gitted/objects/fd/093bff70906175335656e6ce6ae05783708765 differ
diff --git a/tests-clar/resources/testrepo/.gitted/objects/pack/pack-a81e489679b7d3418f9ab594bda8ceb37dd4c695.idx b/tests-clar/resources/testrepo/.gitted/objects/pack/pack-a81e489679b7d3418f9ab594bda8ceb37dd4c695.idx
new file mode 100644
index 0000000..5068f28
Binary files /dev/null and b/tests-clar/resources/testrepo/.gitted/objects/pack/pack-a81e489679b7d3418f9ab594bda8ceb37dd4c695.idx differ
diff --git a/tests-clar/resources/testrepo/.gitted/objects/pack/pack-a81e489679b7d3418f9ab594bda8ceb37dd4c695.pack b/tests-clar/resources/testrepo/.gitted/objects/pack/pack-a81e489679b7d3418f9ab594bda8ceb37dd4c695.pack
new file mode 100644
index 0000000..a6a1f30
Binary files /dev/null and b/tests-clar/resources/testrepo/.gitted/objects/pack/pack-a81e489679b7d3418f9ab594bda8ceb37dd4c695.pack differ
diff --git a/tests-clar/resources/testrepo/.gitted/objects/pack/pack-d7c6adf9f61318f041845b01440d09aa7a91e1b5.idx b/tests-clar/resources/testrepo/.gitted/objects/pack/pack-d7c6adf9f61318f041845b01440d09aa7a91e1b5.idx
new file mode 100644
index 0000000..94c3c71
Binary files /dev/null and b/tests-clar/resources/testrepo/.gitted/objects/pack/pack-d7c6adf9f61318f041845b01440d09aa7a91e1b5.idx differ
diff --git a/tests-clar/resources/testrepo/.gitted/objects/pack/pack-d7c6adf9f61318f041845b01440d09aa7a91e1b5.pack b/tests-clar/resources/testrepo/.gitted/objects/pack/pack-d7c6adf9f61318f041845b01440d09aa7a91e1b5.pack
new file mode 100644
index 0000000..74c7fe4
Binary files /dev/null and b/tests-clar/resources/testrepo/.gitted/objects/pack/pack-d7c6adf9f61318f041845b01440d09aa7a91e1b5.pack differ
diff --git a/tests-clar/resources/testrepo/.gitted/objects/pack/pack-d85f5d483273108c9d8dd0e4728ccf0b2982423a.idx b/tests-clar/resources/testrepo/.gitted/objects/pack/pack-d85f5d483273108c9d8dd0e4728ccf0b2982423a.idx
new file mode 100644
index 0000000..555cfa9
Binary files /dev/null and b/tests-clar/resources/testrepo/.gitted/objects/pack/pack-d85f5d483273108c9d8dd0e4728ccf0b2982423a.idx differ
diff --git a/tests-clar/resources/testrepo/.gitted/objects/pack/pack-d85f5d483273108c9d8dd0e4728ccf0b2982423a.pack b/tests-clar/resources/testrepo/.gitted/objects/pack/pack-d85f5d483273108c9d8dd0e4728ccf0b2982423a.pack
new file mode 100644
index 0000000..4d539ed
Binary files /dev/null and b/tests-clar/resources/testrepo/.gitted/objects/pack/pack-d85f5d483273108c9d8dd0e4728ccf0b2982423a.pack differ
diff --git a/tests-clar/resources/testrepo/.gitted/packed-refs b/tests-clar/resources/testrepo/.gitted/packed-refs
new file mode 100644
index 0000000..52f5e87
--- /dev/null
+++ b/tests-clar/resources/testrepo/.gitted/packed-refs
@@ -0,0 +1,3 @@
+# pack-refs with: peeled
+41bc8c69075bbdb46c5c6f0566cc8cc5b46e8bd9 refs/heads/packed
+5b5b025afb0b4c913b4c338a42934a3863bf3644 refs/heads/packed-test
diff --git a/tests-clar/resources/testrepo/.gitted/refs/heads/br2 b/tests-clar/resources/testrepo/.gitted/refs/heads/br2
new file mode 100644
index 0000000..aab87e5
--- /dev/null
+++ b/tests-clar/resources/testrepo/.gitted/refs/heads/br2
@@ -0,0 +1 @@
+a4a7dce85cf63874e984719f4fdd239f5145052f
diff --git a/tests-clar/resources/testrepo/.gitted/refs/heads/master b/tests-clar/resources/testrepo/.gitted/refs/heads/master
new file mode 100644
index 0000000..3d8f0a4
--- /dev/null
+++ b/tests-clar/resources/testrepo/.gitted/refs/heads/master
@@ -0,0 +1 @@
+a65fedf39aefe402d3bb6e24df4d4f5fe4547750
diff --git a/tests-clar/resources/testrepo/.gitted/refs/heads/packed-test b/tests-clar/resources/testrepo/.gitted/refs/heads/packed-test
new file mode 100644
index 0000000..f2c14ad
--- /dev/null
+++ b/tests-clar/resources/testrepo/.gitted/refs/heads/packed-test
@@ -0,0 +1 @@
+4a202b346bb0fb0db7eff3cffeb3c70babbd2045
diff --git a/tests-clar/resources/testrepo/.gitted/refs/heads/subtrees b/tests-clar/resources/testrepo/.gitted/refs/heads/subtrees
new file mode 100644
index 0000000..ad27e0b
--- /dev/null
+++ b/tests-clar/resources/testrepo/.gitted/refs/heads/subtrees
@@ -0,0 +1 @@
+763d71aadf09a7951596c9746c024e7eece7c7af
diff --git a/tests-clar/resources/testrepo/.gitted/refs/heads/test b/tests-clar/resources/testrepo/.gitted/refs/heads/test
new file mode 100644
index 0000000..399c4c7
--- /dev/null
+++ b/tests-clar/resources/testrepo/.gitted/refs/heads/test
@@ -0,0 +1 @@
+e90810b8df3e80c413d903f631643c716887138d
diff --git a/tests-clar/resources/testrepo/.gitted/refs/tags/e90810b b/tests-clar/resources/testrepo/.gitted/refs/tags/e90810b
new file mode 100644
index 0000000..584495d
--- /dev/null
+++ b/tests-clar/resources/testrepo/.gitted/refs/tags/e90810b
@@ -0,0 +1 @@
+7b4384978d2493e851f9cca7858815fac9b10980
diff --git a/tests-clar/resources/testrepo/.gitted/refs/tags/point_to_blob b/tests-clar/resources/testrepo/.gitted/refs/tags/point_to_blob
new file mode 100644
index 0000000..f874a3f
--- /dev/null
+++ b/tests-clar/resources/testrepo/.gitted/refs/tags/point_to_blob
@@ -0,0 +1 @@
+1385f264afb75a56a5bec74243be9b367ba4ca08
diff --git a/tests-clar/resources/testrepo/.gitted/refs/tags/test b/tests-clar/resources/testrepo/.gitted/refs/tags/test
new file mode 100644
index 0000000..6ee952a
--- /dev/null
+++ b/tests-clar/resources/testrepo/.gitted/refs/tags/test
@@ -0,0 +1 @@
+b25fa35b38051e4ae45d4222e795f9df2e43f1d1
diff --git a/tests-clar/threads/basic.c b/tests-clar/threads/basic.c
new file mode 100644
index 0000000..2b1c368
--- /dev/null
+++ b/tests-clar/threads/basic.c
@@ -0,0 +1,20 @@
+#include "clar_libgit2.h"
+
+#include "cache.h"
+
+
+static git_repository *g_repo;
+
+void test_threads_basic__initialize(void) {
+ g_repo = cl_git_sandbox_init("testrepo");
+}
+
+void test_threads_basic__cleanup(void) {
+ cl_git_sandbox_cleanup();
+}
+
+
+void test_threads_basic__cache(void) {
+ // run several threads polling the cache at the same time
+ cl_assert(1 == 1);
+}
diff --git a/tests/.gitignore b/tests/.gitignore
deleted file mode 100644
index 690624b..0000000
--- a/tests/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-*.toc
diff --git a/tests/NAMING b/tests/NAMING
deleted file mode 100644
index c2da016..0000000
--- a/tests/NAMING
+++ /dev/null
@@ -1,52 +0,0 @@
-Test sources should be named:
-
- t????-function.c
-
-where ???? is a four digit code. The first two digits classify
-the test into a major category; the final two digits indicate the
-sequence of the test within that category. The function part of
-the test name should give a rough indication of what it does.
-
-Categories
-----------
-
-00__: Core library routines based only on the standard library,
- and that are essential for everything else to run. E.g.
- errno and malloc.
-
-01__: Basic hashing functions, needed to handle the content
- addressable store.
-
-02__: Basic object read access.
-
-03__: Basic object writing.
-
-04__: Parsing and loading commit data
-
-05__: Revision walking
-
-06__: Index reading, writing and searching
-
-07__: Tests for the internal hashtable code
-
-08__: Tag reading and writing
-
-09__: Reading tree objects
-
-10__: Symbolic, loose and packed references reading and writing.
-
-11__: SQLite backend
-
-12__: Repository init and opening
-
-13__: Threads, empty as of now
-
-14__: Redis backend
-
-15__: Configuration parsing
-
-16__: Remotes
-
-17__: Buffers
-
-18__: File Status
diff --git a/tests/resources/.gitattributes b/tests/resources/.gitattributes
deleted file mode 100644
index 556f8c8..0000000
--- a/tests/resources/.gitattributes
+++ /dev/null
@@ -1 +0,0 @@
-* binary
diff --git a/tests/resources/.gitignore b/tests/resources/.gitignore
deleted file mode 100644
index 43a19cc..0000000
--- a/tests/resources/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-discover.git
diff --git a/tests/resources/attr/.gitted/HEAD b/tests/resources/attr/.gitted/HEAD
deleted file mode 100644
index cb089cd..0000000
--- a/tests/resources/attr/.gitted/HEAD
+++ /dev/null
@@ -1 +0,0 @@
-ref: refs/heads/master
diff --git a/tests/resources/attr/.gitted/config b/tests/resources/attr/.gitted/config
deleted file mode 100644
index af10792..0000000
--- a/tests/resources/attr/.gitted/config
+++ /dev/null
@@ -1,6 +0,0 @@
-[core]
- repositoryformatversion = 0
- filemode = true
- bare = false
- logallrefupdates = true
- ignorecase = true
diff --git a/tests/resources/attr/.gitted/description b/tests/resources/attr/.gitted/description
deleted file mode 100644
index 498b267..0000000
--- a/tests/resources/attr/.gitted/description
+++ /dev/null
@@ -1 +0,0 @@
-Unnamed repository; edit this file 'description' to name the repository.
diff --git a/tests/resources/attr/.gitted/index b/tests/resources/attr/.gitted/index
deleted file mode 100644
index 19fa99d..0000000
Binary files a/tests/resources/attr/.gitted/index and /dev/null differ
diff --git a/tests/resources/attr/.gitted/info/attributes b/tests/resources/attr/.gitted/info/attributes
deleted file mode 100644
index 5fe62a3..0000000
--- a/tests/resources/attr/.gitted/info/attributes
+++ /dev/null
@@ -1,4 +0,0 @@
-* repoattr
-a* foo !bar -baz
-sub/*.txt reposub
-sub/sub/*.txt reposubsub
diff --git a/tests/resources/attr/.gitted/info/exclude b/tests/resources/attr/.gitted/info/exclude
deleted file mode 100644
index a5196d1..0000000
--- a/tests/resources/attr/.gitted/info/exclude
+++ /dev/null
@@ -1,6 +0,0 @@
-# git ls-files --others --exclude-from=.git/info/exclude
-# Lines that start with '#' are comments.
-# For a project mostly in C, the following would be a good set of
-# exclude patterns (uncomment them if you want to use them):
-# *.[oa]
-# *~
diff --git a/tests/resources/attr/.gitted/logs/HEAD b/tests/resources/attr/.gitted/logs/HEAD
deleted file mode 100644
index 68fcff2..0000000
--- a/tests/resources/attr/.gitted/logs/HEAD
+++ /dev/null
@@ -1,6 +0,0 @@
-0000000000000000000000000000000000000000 6bab5c79cd5140d0f800917f550eb2a3dc32b0da Russell Belfer <arrbee@arrbee.com> 1324416995 -0800 commit (initial): initial test data
-6bab5c79cd5140d0f800917f550eb2a3dc32b0da 605812ab7fe421fdd325a935d35cb06a9234a7d7 Russell Belfer <arrbee@arrbee.com> 1325143098 -0800 commit: latest test updates
-605812ab7fe421fdd325a935d35cb06a9234a7d7 a5d76cad53f66f1312bd995909a5bab3c0820770 Russell Belfer <arrbee@arrbee.com> 1325281762 -0800 commit: more macro tests
-a5d76cad53f66f1312bd995909a5bab3c0820770 370fe9ec224ce33e71f9e5ec2bd1142ce9937a6a Russell Belfer <arrbee@arrbee.com> 1327611749 -0800 commit: Updating files so we can do diffs
-370fe9ec224ce33e71f9e5ec2bd1142ce9937a6a f5b0af1fb4f5c0cd7aad880711d368a07333c307 Russell Belfer <arrbee@arrbee.com> 1327621027 -0800 commit: Updating test data
-f5b0af1fb4f5c0cd7aad880711d368a07333c307 a97cc019851d401a4f1d091cb91a15890a0dd1ba Russell Belfer <arrbee@arrbee.com> 1328653313 -0800 commit: Some whitespace only changes for testing purposes
diff --git a/tests/resources/attr/.gitted/logs/refs/heads/master b/tests/resources/attr/.gitted/logs/refs/heads/master
deleted file mode 100644
index 68fcff2..0000000
--- a/tests/resources/attr/.gitted/logs/refs/heads/master
+++ /dev/null
@@ -1,6 +0,0 @@
-0000000000000000000000000000000000000000 6bab5c79cd5140d0f800917f550eb2a3dc32b0da Russell Belfer <arrbee@arrbee.com> 1324416995 -0800 commit (initial): initial test data
-6bab5c79cd5140d0f800917f550eb2a3dc32b0da 605812ab7fe421fdd325a935d35cb06a9234a7d7 Russell Belfer <arrbee@arrbee.com> 1325143098 -0800 commit: latest test updates
-605812ab7fe421fdd325a935d35cb06a9234a7d7 a5d76cad53f66f1312bd995909a5bab3c0820770 Russell Belfer <arrbee@arrbee.com> 1325281762 -0800 commit: more macro tests
-a5d76cad53f66f1312bd995909a5bab3c0820770 370fe9ec224ce33e71f9e5ec2bd1142ce9937a6a Russell Belfer <arrbee@arrbee.com> 1327611749 -0800 commit: Updating files so we can do diffs
-370fe9ec224ce33e71f9e5ec2bd1142ce9937a6a f5b0af1fb4f5c0cd7aad880711d368a07333c307 Russell Belfer <arrbee@arrbee.com> 1327621027 -0800 commit: Updating test data
-f5b0af1fb4f5c0cd7aad880711d368a07333c307 a97cc019851d401a4f1d091cb91a15890a0dd1ba Russell Belfer <arrbee@arrbee.com> 1328653313 -0800 commit: Some whitespace only changes for testing purposes
diff --git a/tests/resources/attr/.gitted/objects/10/8bb4e7fd7b16490dc33ff7d972151e73d7166e b/tests/resources/attr/.gitted/objects/10/8bb4e7fd7b16490dc33ff7d972151e73d7166e
deleted file mode 100644
index edcf752..0000000
Binary files a/tests/resources/attr/.gitted/objects/10/8bb4e7fd7b16490dc33ff7d972151e73d7166e and /dev/null differ
diff --git a/tests/resources/attr/.gitted/objects/29/29de282ce999e95183aedac6451d3384559c4b b/tests/resources/attr/.gitted/objects/29/29de282ce999e95183aedac6451d3384559c4b
deleted file mode 100644
index ad84f08..0000000
Binary files a/tests/resources/attr/.gitted/objects/29/29de282ce999e95183aedac6451d3384559c4b and /dev/null differ
diff --git a/tests/resources/attr/.gitted/objects/2b/40c5aca159b04ea8d20ffe36cdf8b09369b14a b/tests/resources/attr/.gitted/objects/2b/40c5aca159b04ea8d20ffe36cdf8b09369b14a
deleted file mode 100644
index 0e23680..0000000
--- a/tests/resources/attr/.gitted/objects/2b/40c5aca159b04ea8d20ffe36cdf8b09369b14a
+++ /dev/null
@@ -1 +0,0 @@
-xmPÑj„0ì«ùŠ=úP8Z…ÞS¾¤”c£ñhR6{=¼¯obâ™Ò"šÙafvŒšœ‚÷×æéä#3‰Î¬=7Pÿ%[8<Heì`&]@?aFZª®ªç@!…÷.ÊÈù:±ù½§…•ldðÚLG|K’7~XÃN8¤˜·IÏdìê}¿øˆqŸó2cG¾œ7l¾5ÔV_pEûŸ®’#lZ´ŽGMòt[JÌÈͽ¥&©h¸±uÌ][‰Öß4‰-3;ËCˆg˜4¿x`ZÀ»YÃŒ“錻ú€bÝ^>ïyNlÍ£¡>c¯;gÓ•¥kÇYXÄ9b|Dª~VØ—)…v¿øñÎÜ•
\ No newline at end of file
diff --git a/tests/resources/attr/.gitted/objects/2c/66e14f77196ea763fb1e41612c1aa2bc2d8ed2 b/tests/resources/attr/.gitted/objects/2c/66e14f77196ea763fb1e41612c1aa2bc2d8ed2
deleted file mode 100644
index 4b75d50..0000000
Binary files a/tests/resources/attr/.gitted/objects/2c/66e14f77196ea763fb1e41612c1aa2bc2d8ed2 and /dev/null differ
diff --git a/tests/resources/attr/.gitted/objects/2d/e7dfe3588f3c7e9ad59e7d50ba90e3329df9d9 b/tests/resources/attr/.gitted/objects/2d/e7dfe3588f3c7e9ad59e7d50ba90e3329df9d9
deleted file mode 100644
index e0fd046..0000000
Binary files a/tests/resources/attr/.gitted/objects/2d/e7dfe3588f3c7e9ad59e7d50ba90e3329df9d9 and /dev/null differ
diff --git a/tests/resources/attr/.gitted/objects/37/0fe9ec224ce33e71f9e5ec2bd1142ce9937a6a b/tests/resources/attr/.gitted/objects/37/0fe9ec224ce33e71f9e5ec2bd1142ce9937a6a
deleted file mode 100644
index 9c37c59..0000000
Binary files a/tests/resources/attr/.gitted/objects/37/0fe9ec224ce33e71f9e5ec2bd1142ce9937a6a and /dev/null differ
diff --git a/tests/resources/attr/.gitted/objects/3a/6df026462ebafe455af9867d27eda20a9e0974 b/tests/resources/attr/.gitted/objects/3a/6df026462ebafe455af9867d27eda20a9e0974
deleted file mode 100644
index c74add8..0000000
Binary files a/tests/resources/attr/.gitted/objects/3a/6df026462ebafe455af9867d27eda20a9e0974 and /dev/null differ
diff --git a/tests/resources/attr/.gitted/objects/3b/74db7ab381105dc0d28f8295a77f6a82989292 b/tests/resources/attr/.gitted/objects/3b/74db7ab381105dc0d28f8295a77f6a82989292
deleted file mode 100644
index e5cef35..0000000
Binary files a/tests/resources/attr/.gitted/objects/3b/74db7ab381105dc0d28f8295a77f6a82989292 and /dev/null differ
diff --git a/tests/resources/attr/.gitted/objects/3e/42ffc54a663f9401cc25843d6c0e71a33e4249 b/tests/resources/attr/.gitted/objects/3e/42ffc54a663f9401cc25843d6c0e71a33e4249
deleted file mode 100644
index 091d79b..0000000
Binary files a/tests/resources/attr/.gitted/objects/3e/42ffc54a663f9401cc25843d6c0e71a33e4249 and /dev/null differ
diff --git a/tests/resources/attr/.gitted/objects/45/141a79a77842c59a63229403220a4e4be74e3d b/tests/resources/attr/.gitted/objects/45/141a79a77842c59a63229403220a4e4be74e3d
deleted file mode 100644
index 5b58ef0..0000000
Binary files a/tests/resources/attr/.gitted/objects/45/141a79a77842c59a63229403220a4e4be74e3d and /dev/null differ
diff --git a/tests/resources/attr/.gitted/objects/4d/713dc48e6b1bd75b0d61ad078ba9ca3a56745d b/tests/resources/attr/.gitted/objects/4d/713dc48e6b1bd75b0d61ad078ba9ca3a56745d
deleted file mode 100644
index eb1e8d0..0000000
--- a/tests/resources/attr/.gitted/objects/4d/713dc48e6b1bd75b0d61ad078ba9ca3a56745d
+++ /dev/null
@@ -1,2 +0,0 @@
-xÁÁ
€ @ßWŶàÇ
-|ø§k 9n$¡}gŠ«à:‡îÂ;5°1¥e–4ˆ\k_]‘ÞƒŸÙhœD¡k›ý'~
\ No newline at end of file
diff --git a/tests/resources/attr/.gitted/objects/55/6f8c827b8e4a02ad5cab77dca2bcb3e226b0b3 b/tests/resources/attr/.gitted/objects/55/6f8c827b8e4a02ad5cab77dca2bcb3e226b0b3
deleted file mode 100644
index 4bcff1f..0000000
Binary files a/tests/resources/attr/.gitted/objects/55/6f8c827b8e4a02ad5cab77dca2bcb3e226b0b3 and /dev/null differ
diff --git a/tests/resources/attr/.gitted/objects/58/19a185d77b03325aaf87cafc771db36f6ddca7 b/tests/resources/attr/.gitted/objects/58/19a185d77b03325aaf87cafc771db36f6ddca7
deleted file mode 100644
index fe34eb6..0000000
Binary files a/tests/resources/attr/.gitted/objects/58/19a185d77b03325aaf87cafc771db36f6ddca7 and /dev/null differ
diff --git a/tests/resources/attr/.gitted/objects/60/5812ab7fe421fdd325a935d35cb06a9234a7d7 b/tests/resources/attr/.gitted/objects/60/5812ab7fe421fdd325a935d35cb06a9234a7d7
deleted file mode 100644
index b0cc51e..0000000
--- a/tests/resources/attr/.gitted/objects/60/5812ab7fe421fdd325a935d35cb06a9234a7d7
+++ /dev/null
@@ -1,2 +0,0 @@
-xNÛ
Â0ã;SÜ Ë»•BŒÀ—ËU ¥´JÓý °?¶lÙ–y™çgcáU RbaâÙcG;¸l²ã DqÖ Z©Ê«AH”<Ç‘³×3Nâ¨ãä=J2d3[“0“¢½=–
-÷}Û¤¸I™¤Â™jM"×x™/ é[ÇŽØçTwûÇÖãÿ´U¡&[ƒ/ìkþ(õtJL
\ No newline at end of file
diff --git a/tests/resources/attr/.gitted/objects/6b/ab5c79cd5140d0f800917f550eb2a3dc32b0da b/tests/resources/attr/.gitted/objects/6b/ab5c79cd5140d0f800917f550eb2a3dc32b0da
deleted file mode 100644
index f51e11c..0000000
--- a/tests/resources/attr/.gitted/objects/6b/ab5c79cd5140d0f800917f550eb2a3dc32b0da
+++ /dev/null
@@ -1,3 +0,0 @@
-xÛ Ã0Eûí)´@‹d'~@(¥#tÅQ¨ÁiÀQö¯¡ôëÂánÞ·(Pôm"Ř2æh°sL+d{—"{Zœ“`øÔ÷Þàu‡Ô
-O©«4˜¸µYäñ›[Þ·;³Ã@>¥®M§ýS»þOmʧhá
-*‡ÂÂÊæ¿<-
\ No newline at end of file
diff --git a/tests/resources/attr/.gitted/objects/6d/968d62c89c7d9ea23a4c9a7b665d017c3d8ffd b/tests/resources/attr/.gitted/objects/6d/968d62c89c7d9ea23a4c9a7b665d017c3d8ffd
deleted file mode 100644
index e832241..0000000
Binary files a/tests/resources/attr/.gitted/objects/6d/968d62c89c7d9ea23a4c9a7b665d017c3d8ffd and /dev/null differ
diff --git a/tests/resources/attr/.gitted/objects/71/7fc31f6b84f9d6fc3a4edbca259d7fc92beee2 b/tests/resources/attr/.gitted/objects/71/7fc31f6b84f9d6fc3a4edbca259d7fc92beee2
deleted file mode 100644
index a80265c..0000000
Binary files a/tests/resources/attr/.gitted/objects/71/7fc31f6b84f9d6fc3a4edbca259d7fc92beee2 and /dev/null differ
diff --git a/tests/resources/attr/.gitted/objects/94/da4faa0a6bfb8ee6ccf7153801a69202b31857 b/tests/resources/attr/.gitted/objects/94/da4faa0a6bfb8ee6ccf7153801a69202b31857
deleted file mode 100644
index a9ddf5d..0000000
Binary files a/tests/resources/attr/.gitted/objects/94/da4faa0a6bfb8ee6ccf7153801a69202b31857 and /dev/null differ
diff --git a/tests/resources/attr/.gitted/objects/96/089fd31ce1d3ee2afb0ba09ba063066932f027 b/tests/resources/attr/.gitted/objects/96/089fd31ce1d3ee2afb0ba09ba063066932f027
deleted file mode 100644
index efa62f9..0000000
Binary files a/tests/resources/attr/.gitted/objects/96/089fd31ce1d3ee2afb0ba09ba063066932f027 and /dev/null differ
diff --git a/tests/resources/attr/.gitted/objects/99/eae476896f4907224978b88e5ecaa6c5bb67a9 b/tests/resources/attr/.gitted/objects/99/eae476896f4907224978b88e5ecaa6c5bb67a9
deleted file mode 100644
index 8f5acc7..0000000
Binary files a/tests/resources/attr/.gitted/objects/99/eae476896f4907224978b88e5ecaa6c5bb67a9 and /dev/null differ
diff --git a/tests/resources/attr/.gitted/objects/9f/b40b6675dde60b5697afceae91b66d908c02d9 b/tests/resources/attr/.gitted/objects/9f/b40b6675dde60b5697afceae91b66d908c02d9
deleted file mode 100644
index 7663ad0..0000000
Binary files a/tests/resources/attr/.gitted/objects/9f/b40b6675dde60b5697afceae91b66d908c02d9 and /dev/null differ
diff --git a/tests/resources/attr/.gitted/objects/a5/6bbcecaeac760cc26239384d2d4c614e7e4320 b/tests/resources/attr/.gitted/objects/a5/6bbcecaeac760cc26239384d2d4c614e7e4320
deleted file mode 100644
index d898ae9..0000000
Binary files a/tests/resources/attr/.gitted/objects/a5/6bbcecaeac760cc26239384d2d4c614e7e4320 and /dev/null differ
diff --git a/tests/resources/attr/.gitted/objects/a5/d76cad53f66f1312bd995909a5bab3c0820770 b/tests/resources/attr/.gitted/objects/a5/d76cad53f66f1312bd995909a5bab3c0820770
deleted file mode 100644
index cd6a389..0000000
--- a/tests/resources/attr/.gitted/objects/a5/d76cad53f66f1312bd995909a5bab3c0820770
+++ /dev/null
@@ -1,4 +0,0 @@
-xŽ]
-‚!E{v³B>!"ZB;u¤à3Cmÿ í §‡{.7µZŸ4âavfÈÖgBLÊEeP;NQÚ¬BŒLAnŲIÆç ÞÔù5ÁI»)MÑ6Z•œQ[
-h3Úe:
-
ùì}æ£u¸Æà}‡ï…;œ©÷È|ýÅ)µzµ&ô¦¼Óp”›”bÑõq®ú?¶¨3TJ½Áä1‡ø3ÙJX
\ No newline at end of file
diff --git a/tests/resources/attr/.gitted/objects/a9/7cc019851d401a4f1d091cb91a15890a0dd1ba b/tests/resources/attr/.gitted/objects/a9/7cc019851d401a4f1d091cb91a15890a0dd1ba
deleted file mode 100644
index 1a7ec0c..0000000
--- a/tests/resources/attr/.gitted/objects/a9/7cc019851d401a4f1d091cb91a15890a0dd1ba
+++ /dev/null
@@ -1,2 +0,0 @@
-xŽQjÄ0DûíSè[ähc;PJéÚ(²¼ $q°–Þ¾†Þ _3oàIÞ÷µÁàÜK+ªàâäBtƒ„I|œ”â»LìgçƈÖÅR4'=¤qFN6Í÷4
-JôÌ1ôÖFrÑ‘zÃW[r¯«VÝ6øÔ-i7.eVýø‹WÉû;X‚‰,Á
¢émwlÿÏÛ|ç]ṬMëÉ¢ídáã¡RwêC[œW9sÕj~’Wy
\ No newline at end of file
diff --git a/tests/resources/attr/.gitted/objects/c0/091889c0c77142b87a1fa5123a6398a61d33e7 b/tests/resources/attr/.gitted/objects/c0/091889c0c77142b87a1fa5123a6398a61d33e7
deleted file mode 100644
index 11dc63c..0000000
Binary files a/tests/resources/attr/.gitted/objects/c0/091889c0c77142b87a1fa5123a6398a61d33e7 and /dev/null differ
diff --git a/tests/resources/attr/.gitted/objects/c4/85abe35abd4aa6fd83b076a78bbea9e2e7e06c b/tests/resources/attr/.gitted/objects/c4/85abe35abd4aa6fd83b076a78bbea9e2e7e06c
deleted file mode 100644
index 58569ca..0000000
Binary files a/tests/resources/attr/.gitted/objects/c4/85abe35abd4aa6fd83b076a78bbea9e2e7e06c and /dev/null differ
diff --git a/tests/resources/attr/.gitted/objects/c7/aadd770d5907a8475c29e9ee21a27b88bf675d b/tests/resources/attr/.gitted/objects/c7/aadd770d5907a8475c29e9ee21a27b88bf675d
deleted file mode 100644
index 39aedb7..0000000
Binary files a/tests/resources/attr/.gitted/objects/c7/aadd770d5907a8475c29e9ee21a27b88bf675d and /dev/null differ
diff --git a/tests/resources/attr/.gitted/objects/c9/6bbb2c2557a8325ae1559e3ba79cdcecb23076 b/tests/resources/attr/.gitted/objects/c9/6bbb2c2557a8325ae1559e3ba79cdcecb23076
deleted file mode 100644
index 589f9ad..0000000
--- a/tests/resources/attr/.gitted/objects/c9/6bbb2c2557a8325ae1559e3ba79cdcecb23076
+++ /dev/null
@@ -1,2 +0,0 @@
-x5A
-Â0D]ÿSÌεèoàÂuJ~L0ýͯ¡··)¸xÃcfªœp¹]OOΊcñBµ˜6‘»!뢘´²Ã³‚{,áU<C¿j˜¹[ÁE-ŠÜ-¢Ò˜ð&#š¯)~ëÇäÆ=˜;;{.öùe"3A
\ No newline at end of file
diff --git a/tests/resources/attr/.gitted/objects/d5/7da33c16b14326ecb05d19bbea908f5e4c47d9 b/tests/resources/attr/.gitted/objects/d5/7da33c16b14326ecb05d19bbea908f5e4c47d9
deleted file mode 100644
index b96d40c..0000000
Binary files a/tests/resources/attr/.gitted/objects/d5/7da33c16b14326ecb05d19bbea908f5e4c47d9 and /dev/null differ
diff --git a/tests/resources/attr/.gitted/objects/d8/00886d9c86731ae5c4a62b0b77c437015e00d2 b/tests/resources/attr/.gitted/objects/d8/00886d9c86731ae5c4a62b0b77c437015e00d2
deleted file mode 100644
index 83f3b72..0000000
Binary files a/tests/resources/attr/.gitted/objects/d8/00886d9c86731ae5c4a62b0b77c437015e00d2 and /dev/null differ
diff --git a/tests/resources/attr/.gitted/objects/dc/cada462d3df8ac6de596fb8c896aba9344f941 b/tests/resources/attr/.gitted/objects/dc/cada462d3df8ac6de596fb8c896aba9344f941
deleted file mode 100644
index ef62f8b..0000000
Binary files a/tests/resources/attr/.gitted/objects/dc/cada462d3df8ac6de596fb8c896aba9344f941 and /dev/null differ
diff --git a/tests/resources/attr/.gitted/objects/e5/63cf4758f0d646f1b14b76016aa17fa9e549a4 b/tests/resources/attr/.gitted/objects/e5/63cf4758f0d646f1b14b76016aa17fa9e549a4
deleted file mode 100644
index 1bc1f0f..0000000
Binary files a/tests/resources/attr/.gitted/objects/e5/63cf4758f0d646f1b14b76016aa17fa9e549a4 and /dev/null differ
diff --git a/tests/resources/attr/.gitted/objects/f2/c6d717cf4a5a3e6b02684155ab07b766982165 b/tests/resources/attr/.gitted/objects/f2/c6d717cf4a5a3e6b02684155ab07b766982165
deleted file mode 100644
index 27a25dc..0000000
Binary files a/tests/resources/attr/.gitted/objects/f2/c6d717cf4a5a3e6b02684155ab07b766982165 and /dev/null differ
diff --git a/tests/resources/attr/.gitted/objects/f5/b0af1fb4f5c0cd7aad880711d368a07333c307 b/tests/resources/attr/.gitted/objects/f5/b0af1fb4f5c0cd7aad880711d368a07333c307
deleted file mode 100644
index 21faeb8..0000000
--- a/tests/resources/attr/.gitted/objects/f5/b0af1fb4f5c0cd7aad880711d368a07333c307
+++ /dev/null
@@ -1,2 +0,0 @@
-xN[j1Ì·O¡4ÈRbÇPJÈ
-=€Ö;NûÂë½
½A?†y 1“×y~7½žZ(¾¥2ªÏð£beàÁ8uå’Ja‰n³Š¥‘F.HÈ"—UD_®Ý£÷ÉHI£sv´×ZéûØwL=0Tú´ZàþGç¼Î_äUbßKèƒoÌ®§}cëçÿùv?Ûhí½<©aoÔµ¹_áEK
\ No newline at end of file
diff --git a/tests/resources/attr/.gitted/objects/fb/5067b1aef3ac1ada4b379dbcb7d17255df7d78 b/tests/resources/attr/.gitted/objects/fb/5067b1aef3ac1ada4b379dbcb7d17255df7d78
deleted file mode 100644
index 6c8ff83..0000000
Binary files a/tests/resources/attr/.gitted/objects/fb/5067b1aef3ac1ada4b379dbcb7d17255df7d78 and /dev/null differ
diff --git a/tests/resources/attr/.gitted/objects/fe/773770c5a6cc7185580c9204b1ff18a33ff3fc b/tests/resources/attr/.gitted/objects/fe/773770c5a6cc7185580c9204b1ff18a33ff3fc
deleted file mode 100644
index e6fcbc0..0000000
--- a/tests/resources/attr/.gitted/objects/fe/773770c5a6cc7185580c9204b1ff18a33ff3fc
+++ /dev/null
@@ -1 +0,0 @@
-x5ŽAÂ09ûû„xBÜAâœG¤vÕ¤Tüž¤Ð£åõÙ<ûãîÂ#¥Î1ÂUT釛*ÑMúWlÎOCR˜2dÖѵC.„T“©ËÈI¹lQH/öœmYÛ¬UN[àžª€ß¬¬¥þBÖ@t¶Üð8~˜†Õ‹¿}}R#Ä#kAØdD_=-H–
\ No newline at end of file
diff --git a/tests/resources/attr/.gitted/objects/ff/69f8639ce2e6010b3f33a74160aad98b48da2b b/tests/resources/attr/.gitted/objects/ff/69f8639ce2e6010b3f33a74160aad98b48da2b
deleted file mode 100644
index b736c0b..0000000
Binary files a/tests/resources/attr/.gitted/objects/ff/69f8639ce2e6010b3f33a74160aad98b48da2b and /dev/null differ
diff --git a/tests/resources/attr/.gitted/refs/heads/master b/tests/resources/attr/.gitted/refs/heads/master
deleted file mode 100644
index 7f8bbe3..0000000
--- a/tests/resources/attr/.gitted/refs/heads/master
+++ /dev/null
@@ -1 +0,0 @@
-a97cc019851d401a4f1d091cb91a15890a0dd1ba
diff --git a/tests/resources/attr/attr0 b/tests/resources/attr/attr0
deleted file mode 100644
index 556f8c8..0000000
--- a/tests/resources/attr/attr0
+++ /dev/null
@@ -1 +0,0 @@
-* binary
diff --git a/tests/resources/attr/attr1 b/tests/resources/attr/attr1
deleted file mode 100644
index 3b74db7..0000000
--- a/tests/resources/attr/attr1
+++ /dev/null
@@ -1,29 +0,0 @@
-# a comment followed by some blank lines
-
-
-
- # another comment that is indented
-
-# variations on fnmatch
-
-pat0 attr0
-!pat1 attr1
-pat2/ attr2
-pat3dir/pat3file attr3
-pat4.* attr4
- *.pat5 attr5
-pat6/pat6/*.pat6 attr6
-
-pat7[a-e]??[xyz] attr7 # with a comment on the line
-
-pat8\ with\ spaces attr8
-
- invalid # attr with no assignments doesn't count
-
-also/invalid
-
-invalid.again/
-
-# next attr is at eof
-
- pat9 attr9
\ No newline at end of file
diff --git a/tests/resources/attr/attr2 b/tests/resources/attr/attr2
deleted file mode 100644
index 2c66e14..0000000
--- a/tests/resources/attr/attr2
+++ /dev/null
@@ -1,21 +0,0 @@
-
-# variations on assignments
-
-pat0 simple
-pat1 -neg
-* notundef
-pat2 !notundef
-pat3 assigned=test-value
-pat4 rule-with-more-chars=value-with-more-chars
-pat5 empty=
-pat6 -negempty=
-pat7 multiple -single values=1 also=a-really-long-value/* happy=yes!
-# the next line has trailing spaces
-pat8 again= another=12321
-patbad0 # empty assignment does not count
-# next line will be another simple empty assign that should not count
- patbad1
-
-# BTW I think there are 11 valid rules and two "invalid" empty ones
-
-pat9 -at-eof
\ No newline at end of file
diff --git a/tests/resources/attr/attr3 b/tests/resources/attr/attr3
deleted file mode 100644
index c485abe..0000000
--- a/tests/resources/attr/attr3
+++ /dev/null
@@ -1,4 +0,0 @@
-# These are examples from the git-check-attr.1 man page
-*.java diff=java -crlf myAttr
-NoMyAttr.java !myAttr
-README caveat=unspecified
diff --git a/tests/resources/attr/binfile b/tests/resources/attr/binfile
deleted file mode 100644
index d800886..0000000
--- a/tests/resources/attr/binfile
+++ /dev/null
@@ -1 +0,0 @@
-123
\ No newline at end of file
diff --git a/tests/resources/attr/dir/file b/tests/resources/attr/dir/file
deleted file mode 100644
index e69de29..0000000
--- a/tests/resources/attr/dir/file
+++ /dev/null
diff --git a/tests/resources/attr/file b/tests/resources/attr/file
deleted file mode 100644
index 45b983b..0000000
--- a/tests/resources/attr/file
+++ /dev/null
@@ -1 +0,0 @@
-hi
diff --git a/tests/resources/attr/gitattributes b/tests/resources/attr/gitattributes
deleted file mode 100644
index e038983..0000000
--- a/tests/resources/attr/gitattributes
+++ /dev/null
@@ -1,29 +0,0 @@
-* rootattr
-root_test2 -rootattr
-root_test3 !rootattr
-binfile binary
-abc foo bar baz
-does-not-exist foo=yes
-
-root_test2 multiattr
-root_test3 multi2=foo
-
-root_test3 multiattr=1 multiattr=2 multiattr=3 multi2=abc !multi2
-root_test2 multiattr=string -multiattr
-
-[attr]mymacro positive -negative !rootattr
-macro* mymacro another=77
-
-[attr]macro2 multi2 -multi2 multi3 !multi3 multi3=answer
-macro* macro2 macro2 macro2
-
-# let's try some malicious macro defs
-[attr]firstmacro -thirdmacro -secondmacro
-[attr]secondmacro firstmacro -firstmacro
-[attr]thirdmacro secondmacro=hahaha
-
-macro_bad firstmacro secondmacro thirdmacro
-
-# another test that Peff found was failing
-[attr]notest !test
-
diff --git a/tests/resources/attr/gitignore b/tests/resources/attr/gitignore
deleted file mode 100644
index 546d48f..0000000
--- a/tests/resources/attr/gitignore
+++ /dev/null
@@ -1,3 +0,0 @@
-sub
-ign
-dir/
diff --git a/tests/resources/attr/ign b/tests/resources/attr/ign
deleted file mode 100644
index 592fd25..0000000
--- a/tests/resources/attr/ign
+++ /dev/null
@@ -1 +0,0 @@
-ignore me
diff --git a/tests/resources/attr/macro_bad b/tests/resources/attr/macro_bad
deleted file mode 100644
index 5819a18..0000000
--- a/tests/resources/attr/macro_bad
+++ /dev/null
@@ -1 +0,0 @@
-boo
diff --git a/tests/resources/attr/macro_test b/tests/resources/attr/macro_test
deleted file mode 100644
index ff69f86..0000000
--- a/tests/resources/attr/macro_test
+++ /dev/null
@@ -1 +0,0 @@
-Yo
diff --git a/tests/resources/attr/root_test1 b/tests/resources/attr/root_test1
deleted file mode 100644
index 45141a7..0000000
--- a/tests/resources/attr/root_test1
+++ /dev/null
@@ -1 +0,0 @@
-Hello from the root
diff --git a/tests/resources/attr/root_test2 b/tests/resources/attr/root_test2
deleted file mode 100644
index 4d713dc..0000000
--- a/tests/resources/attr/root_test2
+++ /dev/null
@@ -1,6 +0,0 @@
-Hello from the root
-
-Some additional lines
-
-Down here below
-
diff --git a/tests/resources/attr/root_test3 b/tests/resources/attr/root_test3
deleted file mode 100644
index 108bb4e..0000000
--- a/tests/resources/attr/root_test3
+++ /dev/null
@@ -1,19 +0,0 @@
-Some additional lines
-
-
- Down here below the other lines
-
-
-With even more at the end
-
-
-And lots of good stuff
-
-
-Anywhere you want
-
-
-Don't you think
-
-
-
diff --git a/tests/resources/attr/root_test4.txt b/tests/resources/attr/root_test4.txt
deleted file mode 100644
index fe77377..0000000
--- a/tests/resources/attr/root_test4.txt
+++ /dev/null
@@ -1,14 +0,0 @@
-Here is some stuff at the start
-
-This should go in one hunk
-
-Some additional lines
-
-Down here below the other lines
-
-With even more at the end
-
-Followed by a second hunk of stuff
-
-That happens down here
-
diff --git a/tests/resources/attr/sub/.gitattributes b/tests/resources/attr/sub/.gitattributes
deleted file mode 100644
index 329c1c5..0000000
--- a/tests/resources/attr/sub/.gitattributes
+++ /dev/null
@@ -1,7 +0,0 @@
-* subattr=yes -negattr
-*.txt another=zero
-sub/*.txt another=one
-ab* merge=filfre
-abc -foo -bar
-*.c frotz
-deep/file deepdeep
diff --git a/tests/resources/attr/sub/abc b/tests/resources/attr/sub/abc
deleted file mode 100644
index 3e42ffc..0000000
--- a/tests/resources/attr/sub/abc
+++ /dev/null
@@ -1,37 +0,0 @@
-# Test file from gitattributes(5) example:
-
-If you have these three gitattributes file:
-
- (in $GIT_DIR/info/attributes)
-
- a* foo !bar -baz
-
- (in .gitattributes)
- abc foo bar baz
-
- (in t/.gitattributes)
- ab* merge=filfre
- abc -foo -bar
- *.c frotz
-
-the attributes given to path t/abc are computed as follows:
-
-1. By examining t/.gitattributes (which is in the same directory as the path
- in question), git finds that the first line matches. merge attribute is
- set. It also finds that the second line matches, and attributes foo and
- bar are unset.
-2. Then it examines .gitattributes (which is in the parent directory), and
- finds that the first line matches, but t/.gitattributes file already
- decided how merge, foo and bar attributes should be given to this path,
- so it leaves foo and bar unset. Attribute baz is set.
-3. Finally it examines $GIT_DIR/info/attributes. This file is used to
- override the in-tree settings. The first line is a match, and foo is set,
- bar is reverted to unspecified state, and baz is unset.
-
-As the result, the attributes assignment to t/abc becomes:
-
- foo set to true
- bar unspecified
- baz set to false
- merge set to string value "filfre"
- frotz unspecified
diff --git a/tests/resources/attr/sub/dir/file b/tests/resources/attr/sub/dir/file
deleted file mode 100644
index e69de29..0000000
--- a/tests/resources/attr/sub/dir/file
+++ /dev/null
diff --git a/tests/resources/attr/sub/file b/tests/resources/attr/sub/file
deleted file mode 100644
index 45b983b..0000000
--- a/tests/resources/attr/sub/file
+++ /dev/null
@@ -1 +0,0 @@
-hi
diff --git a/tests/resources/attr/sub/ign b/tests/resources/attr/sub/ign
deleted file mode 100644
index 592fd25..0000000
--- a/tests/resources/attr/sub/ign
+++ /dev/null
@@ -1 +0,0 @@
-ignore me
diff --git a/tests/resources/attr/sub/sub/.gitattributes b/tests/resources/attr/sub/sub/.gitattributes
deleted file mode 100644
index 55225e4..0000000
--- a/tests/resources/attr/sub/sub/.gitattributes
+++ /dev/null
@@ -1,3 +0,0 @@
-d/* test=a/b/d/*
-d/yes notest
-
diff --git a/tests/resources/attr/sub/sub/dir b/tests/resources/attr/sub/sub/dir
deleted file mode 100644
index e69de29..0000000
--- a/tests/resources/attr/sub/sub/dir
+++ /dev/null
diff --git a/tests/resources/attr/sub/sub/file b/tests/resources/attr/sub/sub/file
deleted file mode 100644
index 45b983b..0000000
--- a/tests/resources/attr/sub/sub/file
+++ /dev/null
@@ -1 +0,0 @@
-hi
diff --git a/tests/resources/attr/sub/sub/subsub.txt b/tests/resources/attr/sub/sub/subsub.txt
deleted file mode 100644
index 9e5bdc4..0000000
--- a/tests/resources/attr/sub/sub/subsub.txt
+++ /dev/null
@@ -1 +0,0 @@
-subsub
diff --git a/tests/resources/attr/sub/subdir_test1 b/tests/resources/attr/sub/subdir_test1
deleted file mode 100644
index e563cf4..0000000
--- a/tests/resources/attr/sub/subdir_test1
+++ /dev/null
@@ -1,2 +0,0 @@
-Hello from the subdir
-
diff --git a/tests/resources/attr/sub/subdir_test2.txt b/tests/resources/attr/sub/subdir_test2.txt
deleted file mode 100644
index fb5067b..0000000
--- a/tests/resources/attr/sub/subdir_test2.txt
+++ /dev/null
@@ -1 +0,0 @@
-Hello again
diff --git a/tests/resources/bad_tag.git/HEAD b/tests/resources/bad_tag.git/HEAD
deleted file mode 100644
index cb089cd..0000000
--- a/tests/resources/bad_tag.git/HEAD
+++ /dev/null
@@ -1 +0,0 @@
-ref: refs/heads/master
diff --git a/tests/resources/bad_tag.git/config b/tests/resources/bad_tag.git/config
deleted file mode 100644
index 2f89580..0000000
--- a/tests/resources/bad_tag.git/config
+++ /dev/null
@@ -1,5 +0,0 @@
-[core]
- repositoryformatversion = 0
- filemode = true
- bare = true
- logallrefupdates = true
diff --git a/tests/resources/bad_tag.git/objects/pack/pack-7a28f4e000a17f49a41d7a79fc2f762a8a7d9164.idx b/tests/resources/bad_tag.git/objects/pack/pack-7a28f4e000a17f49a41d7a79fc2f762a8a7d9164.idx
deleted file mode 100644
index c404aa1..0000000
Binary files a/tests/resources/bad_tag.git/objects/pack/pack-7a28f4e000a17f49a41d7a79fc2f762a8a7d9164.idx and /dev/null differ
diff --git a/tests/resources/bad_tag.git/objects/pack/pack-7a28f4e000a17f49a41d7a79fc2f762a8a7d9164.pack b/tests/resources/bad_tag.git/objects/pack/pack-7a28f4e000a17f49a41d7a79fc2f762a8a7d9164.pack
deleted file mode 100644
index 90eac50..0000000
Binary files a/tests/resources/bad_tag.git/objects/pack/pack-7a28f4e000a17f49a41d7a79fc2f762a8a7d9164.pack and /dev/null differ
diff --git a/tests/resources/bad_tag.git/packed-refs b/tests/resources/bad_tag.git/packed-refs
deleted file mode 100644
index f9fd2fd..0000000
--- a/tests/resources/bad_tag.git/packed-refs
+++ /dev/null
@@ -1,3 +0,0 @@
-# pack-refs with: peeled
-eda9f45a2a98d4c17a09d681d88569fa4ea91755 refs/tags/e90810b
-^e90810b8df3e80c413d903f631643c716887138d
diff --git a/tests/resources/bad_tag.git/refs/dummy-marker.txt b/tests/resources/bad_tag.git/refs/dummy-marker.txt
deleted file mode 100644
index e69de29..0000000
--- a/tests/resources/bad_tag.git/refs/dummy-marker.txt
+++ /dev/null
diff --git a/tests/resources/big.index b/tests/resources/big.index
deleted file mode 100644
index 66932f1..0000000
Binary files a/tests/resources/big.index and /dev/null differ
diff --git a/tests/resources/config/.gitconfig b/tests/resources/config/.gitconfig
deleted file mode 100644
index fa72bdd..0000000
--- a/tests/resources/config/.gitconfig
+++ /dev/null
@@ -1,3 +0,0 @@
-[core]
- repositoryformatversion = 5
- something = 2
\ No newline at end of file
diff --git a/tests/resources/config/config0 b/tests/resources/config/config0
deleted file mode 100644
index 85235c5..0000000
--- a/tests/resources/config/config0
+++ /dev/null
@@ -1,7 +0,0 @@
-# This is a test
-; of different comments
-[core]
- repositoryformatversion = 0
- filemode = true
- bare = false
- logallrefupdates = true
\ No newline at end of file
diff --git a/tests/resources/config/config1 b/tests/resources/config/config1
deleted file mode 100644
index 211dc9e..0000000
--- a/tests/resources/config/config1
+++ /dev/null
@@ -1,5 +0,0 @@
-# This one checks for case sensitivity
-[this "that"]
- other = true
-[this "That"]
- other = yes
diff --git a/tests/resources/config/config10 b/tests/resources/config/config10
deleted file mode 100644
index dde1791..0000000
--- a/tests/resources/config/config10
+++ /dev/null
@@ -1 +0,0 @@
-[empty]
diff --git a/tests/resources/config/config11 b/tests/resources/config/config11
deleted file mode 100644
index 880c945..0000000
--- a/tests/resources/config/config11
+++ /dev/null
@@ -1,3 +0,0 @@
-[remote "fancy"]
- url = git://github.com/libgit2/libgit2
- url = git://git.example.com/libgit2
diff --git a/tests/resources/config/config2 b/tests/resources/config/config2
deleted file mode 100644
index 60a3898..0000000
--- a/tests/resources/config/config2
+++ /dev/null
@@ -1,5 +0,0 @@
-; This one tests for multiline values
-[this "That"]
- and = one one one \
-two two \
-three three
\ No newline at end of file
diff --git a/tests/resources/config/config3 b/tests/resources/config/config3
deleted file mode 100644
index 44a5e50..0000000
--- a/tests/resources/config/config3
+++ /dev/null
@@ -1,3 +0,0 @@
-# A [section.subsection] header is case-insensitive
-[section.SuBsection]
- var = hello
diff --git a/tests/resources/config/config4 b/tests/resources/config/config4
deleted file mode 100644
index 741fa0f..0000000
--- a/tests/resources/config/config4
+++ /dev/null
@@ -1,3 +0,0 @@
-# A variable name on its own is valid
-[some.section]
- variable
diff --git a/tests/resources/config/config5 b/tests/resources/config/config5
deleted file mode 100644
index 8ab60cc..0000000
--- a/tests/resources/config/config5
+++ /dev/null
@@ -1,9 +0,0 @@
-# Test for number suffixes
-[number]
- simple = 1
- k = 1k
- kk = 1K
- m = 1m
- mm = 1M
- g = 1g
- gg = 1G
diff --git a/tests/resources/config/config6 b/tests/resources/config/config6
deleted file mode 100644
index 0f8f90a..0000000
--- a/tests/resources/config/config6
+++ /dev/null
@@ -1,5 +0,0 @@
-[valid "subsection"]
- something = true
-
-[something "else"]
- something = false
diff --git a/tests/resources/config/config7 b/tests/resources/config/config7
deleted file mode 100644
index 6af6fcf..0000000
--- a/tests/resources/config/config7
+++ /dev/null
@@ -1,5 +0,0 @@
-[valid "subsection"]
- something = a
-; we don't allow anything after closing "
-[sec "subsec"x]
- bleh = blah
diff --git a/tests/resources/config/config8 b/tests/resources/config/config8
deleted file mode 100644
index e69de29..0000000
--- a/tests/resources/config/config8
+++ /dev/null
diff --git a/tests/resources/config/config9 b/tests/resources/config/config9
deleted file mode 100644
index fcaac42..0000000
--- a/tests/resources/config/config9
+++ /dev/null
@@ -1,9 +0,0 @@
-[core]
- dummy2 = 42
- verylong = 1
- dummy = 1
-
-[remote "ab"]
- url = http://example.com/git/ab
-[remote "abba"]
- url = http://example.com/git/abba
diff --git a/tests/resources/empty_bare.git/HEAD b/tests/resources/empty_bare.git/HEAD
deleted file mode 100644
index cb089cd..0000000
--- a/tests/resources/empty_bare.git/HEAD
+++ /dev/null
@@ -1 +0,0 @@
-ref: refs/heads/master
diff --git a/tests/resources/empty_bare.git/config b/tests/resources/empty_bare.git/config
deleted file mode 100644
index 90e1647..0000000
--- a/tests/resources/empty_bare.git/config
+++ /dev/null
@@ -1,7 +0,0 @@
-[core]
- repositoryformatversion = 0
- filemode = false
- bare = true
- symlinks = false
- ignorecase = true
- hideDotFiles = dotGitOnly
diff --git a/tests/resources/empty_bare.git/description b/tests/resources/empty_bare.git/description
deleted file mode 100644
index 498b267..0000000
--- a/tests/resources/empty_bare.git/description
+++ /dev/null
@@ -1 +0,0 @@
-Unnamed repository; edit this file 'description' to name the repository.
diff --git a/tests/resources/empty_bare.git/info/exclude b/tests/resources/empty_bare.git/info/exclude
deleted file mode 100644
index a5196d1..0000000
--- a/tests/resources/empty_bare.git/info/exclude
+++ /dev/null
@@ -1,6 +0,0 @@
-# git ls-files --others --exclude-from=.git/info/exclude
-# Lines that start with '#' are comments.
-# For a project mostly in C, the following would be a good set of
-# exclude patterns (uncomment them if you want to use them):
-# *.[oa]
-# *~
diff --git a/tests/resources/empty_bare.git/objects/info/dummy-marker.txt b/tests/resources/empty_bare.git/objects/info/dummy-marker.txt
deleted file mode 100644
index e69de29..0000000
--- a/tests/resources/empty_bare.git/objects/info/dummy-marker.txt
+++ /dev/null
diff --git a/tests/resources/empty_bare.git/objects/pack/dummy-marker.txt b/tests/resources/empty_bare.git/objects/pack/dummy-marker.txt
deleted file mode 100644
index e69de29..0000000
--- a/tests/resources/empty_bare.git/objects/pack/dummy-marker.txt
+++ /dev/null
diff --git a/tests/resources/empty_bare.git/refs/heads/dummy-marker.txt b/tests/resources/empty_bare.git/refs/heads/dummy-marker.txt
deleted file mode 100644
index e69de29..0000000
--- a/tests/resources/empty_bare.git/refs/heads/dummy-marker.txt
+++ /dev/null
diff --git a/tests/resources/empty_bare.git/refs/tags/dummy-marker.txt b/tests/resources/empty_bare.git/refs/tags/dummy-marker.txt
deleted file mode 100644
index e69de29..0000000
--- a/tests/resources/empty_bare.git/refs/tags/dummy-marker.txt
+++ /dev/null
diff --git a/tests/resources/empty_standard_repo/.gitted/HEAD b/tests/resources/empty_standard_repo/.gitted/HEAD
deleted file mode 100644
index cb089cd..0000000
--- a/tests/resources/empty_standard_repo/.gitted/HEAD
+++ /dev/null
@@ -1 +0,0 @@
-ref: refs/heads/master
diff --git a/tests/resources/empty_standard_repo/.gitted/config b/tests/resources/empty_standard_repo/.gitted/config
deleted file mode 100644
index 78387c5..0000000
--- a/tests/resources/empty_standard_repo/.gitted/config
+++ /dev/null
@@ -1,8 +0,0 @@
-[core]
- repositoryformatversion = 0
- filemode = false
- bare = false
- logallrefupdates = true
- symlinks = false
- ignorecase = true
- hideDotFiles = dotGitOnly
diff --git a/tests/resources/empty_standard_repo/.gitted/description b/tests/resources/empty_standard_repo/.gitted/description
deleted file mode 100644
index 498b267..0000000
--- a/tests/resources/empty_standard_repo/.gitted/description
+++ /dev/null
@@ -1 +0,0 @@
-Unnamed repository; edit this file 'description' to name the repository.
diff --git a/tests/resources/empty_standard_repo/.gitted/info/exclude b/tests/resources/empty_standard_repo/.gitted/info/exclude
deleted file mode 100644
index a5196d1..0000000
--- a/tests/resources/empty_standard_repo/.gitted/info/exclude
+++ /dev/null
@@ -1,6 +0,0 @@
-# git ls-files --others --exclude-from=.git/info/exclude
-# Lines that start with '#' are comments.
-# For a project mostly in C, the following would be a good set of
-# exclude patterns (uncomment them if you want to use them):
-# *.[oa]
-# *~
diff --git a/tests/resources/empty_standard_repo/.gitted/objects/info/dummy-marker.txt b/tests/resources/empty_standard_repo/.gitted/objects/info/dummy-marker.txt
deleted file mode 100644
index e69de29..0000000
--- a/tests/resources/empty_standard_repo/.gitted/objects/info/dummy-marker.txt
+++ /dev/null
diff --git a/tests/resources/empty_standard_repo/.gitted/objects/pack/dummy-marker.txt b/tests/resources/empty_standard_repo/.gitted/objects/pack/dummy-marker.txt
deleted file mode 100644
index e69de29..0000000
--- a/tests/resources/empty_standard_repo/.gitted/objects/pack/dummy-marker.txt
+++ /dev/null
diff --git a/tests/resources/empty_standard_repo/.gitted/refs/heads/dummy-marker.txt b/tests/resources/empty_standard_repo/.gitted/refs/heads/dummy-marker.txt
deleted file mode 100644
index e69de29..0000000
--- a/tests/resources/empty_standard_repo/.gitted/refs/heads/dummy-marker.txt
+++ /dev/null
diff --git a/tests/resources/empty_standard_repo/.gitted/refs/tags/dummy-marker.txt b/tests/resources/empty_standard_repo/.gitted/refs/tags/dummy-marker.txt
deleted file mode 100644
index e69de29..0000000
--- a/tests/resources/empty_standard_repo/.gitted/refs/tags/dummy-marker.txt
+++ /dev/null
diff --git a/tests/resources/gitgit.index b/tests/resources/gitgit.index
deleted file mode 100644
index 215da64..0000000
Binary files a/tests/resources/gitgit.index and /dev/null differ
diff --git a/tests/resources/status/.gitted/COMMIT_EDITMSG b/tests/resources/status/.gitted/COMMIT_EDITMSG
deleted file mode 100644
index 1a25cd4..0000000
--- a/tests/resources/status/.gitted/COMMIT_EDITMSG
+++ /dev/null
@@ -1 +0,0 @@
-Add a file which name should appear before the "subdir/" folder while being dealt with by the treewalker
diff --git a/tests/resources/status/.gitted/HEAD b/tests/resources/status/.gitted/HEAD
deleted file mode 100644
index cb089cd..0000000
--- a/tests/resources/status/.gitted/HEAD
+++ /dev/null
@@ -1 +0,0 @@
-ref: refs/heads/master
diff --git a/tests/resources/status/.gitted/ORIG_HEAD b/tests/resources/status/.gitted/ORIG_HEAD
deleted file mode 100644
index b46871f..0000000
--- a/tests/resources/status/.gitted/ORIG_HEAD
+++ /dev/null
@@ -1 +0,0 @@
-735b6a258cd196a8f7c9428419b02c1dca93fd75
diff --git a/tests/resources/status/.gitted/config b/tests/resources/status/.gitted/config
deleted file mode 100644
index af10792..0000000
--- a/tests/resources/status/.gitted/config
+++ /dev/null
@@ -1,6 +0,0 @@
-[core]
- repositoryformatversion = 0
- filemode = true
- bare = false
- logallrefupdates = true
- ignorecase = true
diff --git a/tests/resources/status/.gitted/description b/tests/resources/status/.gitted/description
deleted file mode 100644
index 498b267..0000000
--- a/tests/resources/status/.gitted/description
+++ /dev/null
@@ -1 +0,0 @@
-Unnamed repository; edit this file 'description' to name the repository.
diff --git a/tests/resources/status/.gitted/index b/tests/resources/status/.gitted/index
deleted file mode 100644
index 9a383ec..0000000
Binary files a/tests/resources/status/.gitted/index and /dev/null differ
diff --git a/tests/resources/status/.gitted/info/exclude b/tests/resources/status/.gitted/info/exclude
deleted file mode 100644
index 0c4042a..0000000
--- a/tests/resources/status/.gitted/info/exclude
+++ /dev/null
@@ -1,8 +0,0 @@
-# git ls-files --others --exclude-from=.git/info/exclude
-# Lines that start with '#' are comments.
-# For a project mostly in C, the following would be a good set of
-# exclude patterns (uncomment them if you want to use them):
-# *.[oa]
-# *~
-ignored*
-
diff --git a/tests/resources/status/.gitted/logs/HEAD b/tests/resources/status/.gitted/logs/HEAD
deleted file mode 100644
index 7b95b3c..0000000
--- a/tests/resources/status/.gitted/logs/HEAD
+++ /dev/null
@@ -1,3 +0,0 @@
-0000000000000000000000000000000000000000 0017bd4ab1ec30440b17bae1680cff124ab5f1f6 Jason Penny <jasonpenny4@gmail.com> 1308050070 -0400 commit (initial): initial
-0017bd4ab1ec30440b17bae1680cff124ab5f1f6 735b6a258cd196a8f7c9428419b02c1dca93fd75 Jason Penny <jasonpenny4@gmail.com> 1308954538 -0400 commit: add subdir
-735b6a258cd196a8f7c9428419b02c1dca93fd75 26a125ee1bfc5df1e1b2e9441bbe63c8a7ae989f nulltoken <emeric.fermas@gmail.com> 1319911544 +0200 commit: Add a file which name should appear before the "subdir/" folder while being dealt with by the treewalker
diff --git a/tests/resources/status/.gitted/logs/refs/heads/master b/tests/resources/status/.gitted/logs/refs/heads/master
deleted file mode 100644
index 7b95b3c..0000000
--- a/tests/resources/status/.gitted/logs/refs/heads/master
+++ /dev/null
@@ -1,3 +0,0 @@
-0000000000000000000000000000000000000000 0017bd4ab1ec30440b17bae1680cff124ab5f1f6 Jason Penny <jasonpenny4@gmail.com> 1308050070 -0400 commit (initial): initial
-0017bd4ab1ec30440b17bae1680cff124ab5f1f6 735b6a258cd196a8f7c9428419b02c1dca93fd75 Jason Penny <jasonpenny4@gmail.com> 1308954538 -0400 commit: add subdir
-735b6a258cd196a8f7c9428419b02c1dca93fd75 26a125ee1bfc5df1e1b2e9441bbe63c8a7ae989f nulltoken <emeric.fermas@gmail.com> 1319911544 +0200 commit: Add a file which name should appear before the "subdir/" folder while being dealt with by the treewalker
diff --git a/tests/resources/status/.gitted/objects/00/17bd4ab1ec30440b17bae1680cff124ab5f1f6 b/tests/resources/status/.gitted/objects/00/17bd4ab1ec30440b17bae1680cff124ab5f1f6
deleted file mode 100644
index b256d95..0000000
--- a/tests/resources/status/.gitted/objects/00/17bd4ab1ec30440b17bae1680cff124ab5f1f6
+++ /dev/null
@@ -1,2 +0,0 @@
-xA E]sŠ¹€fh)‰1]»ò
-#SÀTºðö¶Wp÷ßK^~¨9§šÜ¡-"àC'Ø…)FvõbƒvÉÞ"¶wŽŽ¼EÅk{Ö®ü©nRÊίÞû6ã#sšO¡æ舄pDƒ¨6»6ù3W©¤–xV?¨Å9é
\ No newline at end of file
diff --git a/tests/resources/status/.gitted/objects/06/1d42a44cacde5726057b67558821d95db96f19 b/tests/resources/status/.gitted/objects/06/1d42a44cacde5726057b67558821d95db96f19
deleted file mode 100644
index 82e02cb..0000000
Binary files a/tests/resources/status/.gitted/objects/06/1d42a44cacde5726057b67558821d95db96f19 and /dev/null differ
diff --git a/tests/resources/status/.gitted/objects/18/88c805345ba265b0ee9449b8877b6064592058 b/tests/resources/status/.gitted/objects/18/88c805345ba265b0ee9449b8877b6064592058
deleted file mode 100644
index e3cad2f..0000000
Binary files a/tests/resources/status/.gitted/objects/18/88c805345ba265b0ee9449b8877b6064592058 and /dev/null differ
diff --git a/tests/resources/status/.gitted/objects/19/d9cc8584ac2c7dcf57d2680375e80f099dc481 b/tests/resources/status/.gitted/objects/19/d9cc8584ac2c7dcf57d2680375e80f099dc481
deleted file mode 100644
index 2d5e711..0000000
Binary files a/tests/resources/status/.gitted/objects/19/d9cc8584ac2c7dcf57d2680375e80f099dc481 and /dev/null differ
diff --git a/tests/resources/status/.gitted/objects/26/a125ee1bfc5df1e1b2e9441bbe63c8a7ae989f b/tests/resources/status/.gitted/objects/26/a125ee1bfc5df1e1b2e9441bbe63c8a7ae989f
deleted file mode 100644
index f7dddc4..0000000
--- a/tests/resources/status/.gitted/objects/26/a125ee1bfc5df1e1b2e9441bbe63c8a7ae989f
+++ /dev/null
@@ -1,2 +0,0 @@
-xMnÄ …»Î)¬ÙVšò† ªö(Ì€BDˆ¢Þ¾LÐöûüžž«¥¤RÈ·Þˆ@êà,Î9Ž‹òÜÌœtàìæ•ðNj6f`žM6Z;h©ì
…ZÜÐÞp Ú™Y,37¯/Ü;42x&<z¬
Ö#ç^Ÿ´Â
-µä®ZÁýëQ0å««å¸äÆp®æÞ™`lÛ²Ó?ñéÛ{@)œ1¹+‚=Ö#ö6°j#è‘à²Ö§öqP³®¨¥´>ÀægêìÏŸüÕÛ‰ùImú|½jñ
\ No newline at end of file
diff --git a/tests/resources/status/.gitted/objects/32/504b727382542f9f089e24fddac5e78533e96c b/tests/resources/status/.gitted/objects/32/504b727382542f9f089e24fddac5e78533e96c
deleted file mode 100644
index 7fca67b..0000000
Binary files a/tests/resources/status/.gitted/objects/32/504b727382542f9f089e24fddac5e78533e96c and /dev/null differ
diff --git a/tests/resources/status/.gitted/objects/37/fcb02ccc1a85d1941e7f106d52dc3702dcf0d0 b/tests/resources/status/.gitted/objects/37/fcb02ccc1a85d1941e7f106d52dc3702dcf0d0
deleted file mode 100644
index b75481b..0000000
Binary files a/tests/resources/status/.gitted/objects/37/fcb02ccc1a85d1941e7f106d52dc3702dcf0d0 and /dev/null differ
diff --git a/tests/resources/status/.gitted/objects/45/2e4244b5d083ddf0460acf1ecc74db9dcfa11a b/tests/resources/status/.gitted/objects/45/2e4244b5d083ddf0460acf1ecc74db9dcfa11a
deleted file mode 100644
index 5b47461..0000000
Binary files a/tests/resources/status/.gitted/objects/45/2e4244b5d083ddf0460acf1ecc74db9dcfa11a and /dev/null differ
diff --git a/tests/resources/status/.gitted/objects/52/9a16e8e762d4acb7b9636ff540a00831f9155a b/tests/resources/status/.gitted/objects/52/9a16e8e762d4acb7b9636ff540a00831f9155a
deleted file mode 100644
index 615009a..0000000
Binary files a/tests/resources/status/.gitted/objects/52/9a16e8e762d4acb7b9636ff540a00831f9155a and /dev/null differ
diff --git a/tests/resources/status/.gitted/objects/53/ace0d1cc1145a5f4fe4f78a186a60263190733 b/tests/resources/status/.gitted/objects/53/ace0d1cc1145a5f4fe4f78a186a60263190733
deleted file mode 100644
index cdb7e96..0000000
Binary files a/tests/resources/status/.gitted/objects/53/ace0d1cc1145a5f4fe4f78a186a60263190733 and /dev/null differ
diff --git a/tests/resources/status/.gitted/objects/54/52d32f1dd538eb0405e8a83cc185f79e25e80f b/tests/resources/status/.gitted/objects/54/52d32f1dd538eb0405e8a83cc185f79e25e80f
deleted file mode 100644
index a72dff6..0000000
Binary files a/tests/resources/status/.gitted/objects/54/52d32f1dd538eb0405e8a83cc185f79e25e80f and /dev/null differ
diff --git a/tests/resources/status/.gitted/objects/55/d316c9ba708999f1918e9677d01dfcae69c6b9 b/tests/resources/status/.gitted/objects/55/d316c9ba708999f1918e9677d01dfcae69c6b9
deleted file mode 100644
index 72807f3..0000000
Binary files a/tests/resources/status/.gitted/objects/55/d316c9ba708999f1918e9677d01dfcae69c6b9 and /dev/null differ
diff --git a/tests/resources/status/.gitted/objects/70/bd9443ada07063e7fbf0b3ff5c13f7494d89c2 b/tests/resources/status/.gitted/objects/70/bd9443ada07063e7fbf0b3ff5c13f7494d89c2
deleted file mode 100644
index 3665a8f..0000000
Binary files a/tests/resources/status/.gitted/objects/70/bd9443ada07063e7fbf0b3ff5c13f7494d89c2 and /dev/null differ
diff --git a/tests/resources/status/.gitted/objects/73/5b6a258cd196a8f7c9428419b02c1dca93fd75 b/tests/resources/status/.gitted/objects/73/5b6a258cd196a8f7c9428419b02c1dca93fd75
deleted file mode 100644
index 08e6fd2..0000000
Binary files a/tests/resources/status/.gitted/objects/73/5b6a258cd196a8f7c9428419b02c1dca93fd75 and /dev/null differ
diff --git a/tests/resources/status/.gitted/objects/75/6e27627e67bfbc048d01ece5819c6de733d7ea b/tests/resources/status/.gitted/objects/75/6e27627e67bfbc048d01ece5819c6de733d7ea
deleted file mode 100644
index 8f3fa89..0000000
Binary files a/tests/resources/status/.gitted/objects/75/6e27627e67bfbc048d01ece5819c6de733d7ea and /dev/null differ
diff --git a/tests/resources/status/.gitted/objects/90/6ee7711f4f4928ddcb2a5f8fbc500deba0d2a8 b/tests/resources/status/.gitted/objects/90/6ee7711f4f4928ddcb2a5f8fbc500deba0d2a8
deleted file mode 100644
index bb732b0..0000000
Binary files a/tests/resources/status/.gitted/objects/90/6ee7711f4f4928ddcb2a5f8fbc500deba0d2a8 and /dev/null differ
diff --git a/tests/resources/status/.gitted/objects/90/b8c29d8ba39434d1c63e1b093daaa26e5bd972 b/tests/resources/status/.gitted/objects/90/b8c29d8ba39434d1c63e1b093daaa26e5bd972
deleted file mode 100644
index 7a96618..0000000
Binary files a/tests/resources/status/.gitted/objects/90/b8c29d8ba39434d1c63e1b093daaa26e5bd972 and /dev/null differ
diff --git a/tests/resources/status/.gitted/objects/9c/2e02cdffa8d73e6c189074594477a6baf87960 b/tests/resources/status/.gitted/objects/9c/2e02cdffa8d73e6c189074594477a6baf87960
deleted file mode 100644
index 20a3c49..0000000
Binary files a/tests/resources/status/.gitted/objects/9c/2e02cdffa8d73e6c189074594477a6baf87960 and /dev/null differ
diff --git a/tests/resources/status/.gitted/objects/a0/de7e0ac200c489c41c59dfa910154a70264e6e b/tests/resources/status/.gitted/objects/a0/de7e0ac200c489c41c59dfa910154a70264e6e
deleted file mode 100644
index a1789c9..0000000
Binary files a/tests/resources/status/.gitted/objects/a0/de7e0ac200c489c41c59dfa910154a70264e6e and /dev/null differ
diff --git a/tests/resources/status/.gitted/objects/a6/191982709b746d5650e93c2acf34ef74e11504 b/tests/resources/status/.gitted/objects/a6/191982709b746d5650e93c2acf34ef74e11504
deleted file mode 100644
index cc1f377..0000000
Binary files a/tests/resources/status/.gitted/objects/a6/191982709b746d5650e93c2acf34ef74e11504 and /dev/null differ
diff --git a/tests/resources/status/.gitted/objects/a6/be623522ce87a1d862128ac42672604f7b468b b/tests/resources/status/.gitted/objects/a6/be623522ce87a1d862128ac42672604f7b468b
deleted file mode 100644
index c472983..0000000
Binary files a/tests/resources/status/.gitted/objects/a6/be623522ce87a1d862128ac42672604f7b468b and /dev/null differ
diff --git a/tests/resources/status/.gitted/objects/aa/27a641456848200fdb7f7c99ba36f8a0952877 b/tests/resources/status/.gitted/objects/aa/27a641456848200fdb7f7c99ba36f8a0952877
deleted file mode 100644
index a4669cc..0000000
Binary files a/tests/resources/status/.gitted/objects/aa/27a641456848200fdb7f7c99ba36f8a0952877 and /dev/null differ
diff --git a/tests/resources/status/.gitted/objects/da/bc8af9bd6e9f5bbe96a176f1a24baf3d1f8916 b/tests/resources/status/.gitted/objects/da/bc8af9bd6e9f5bbe96a176f1a24baf3d1f8916
deleted file mode 100644
index 3e3c03c..0000000
Binary files a/tests/resources/status/.gitted/objects/da/bc8af9bd6e9f5bbe96a176f1a24baf3d1f8916 and /dev/null differ
diff --git a/tests/resources/status/.gitted/objects/e8/ee89e15bbe9b20137715232387b3de5b28972e b/tests/resources/status/.gitted/objects/e8/ee89e15bbe9b20137715232387b3de5b28972e
deleted file mode 100644
index cfc2413..0000000
Binary files a/tests/resources/status/.gitted/objects/e8/ee89e15bbe9b20137715232387b3de5b28972e and /dev/null differ
diff --git a/tests/resources/status/.gitted/objects/e9/b9107f290627c04d097733a10055af941f6bca b/tests/resources/status/.gitted/objects/e9/b9107f290627c04d097733a10055af941f6bca
deleted file mode 100644
index 1266d3e..0000000
Binary files a/tests/resources/status/.gitted/objects/e9/b9107f290627c04d097733a10055af941f6bca and /dev/null differ
diff --git a/tests/resources/status/.gitted/objects/ed/062903b8f6f3dccb2fa81117ba6590944ef9bd b/tests/resources/status/.gitted/objects/ed/062903b8f6f3dccb2fa81117ba6590944ef9bd
deleted file mode 100644
index 8fa8c17..0000000
Binary files a/tests/resources/status/.gitted/objects/ed/062903b8f6f3dccb2fa81117ba6590944ef9bd and /dev/null differ
diff --git a/tests/resources/status/.gitted/refs/heads/master b/tests/resources/status/.gitted/refs/heads/master
deleted file mode 100644
index 3e2e2a0..0000000
--- a/tests/resources/status/.gitted/refs/heads/master
+++ /dev/null
@@ -1 +0,0 @@
-26a125ee1bfc5df1e1b2e9441bbe63c8a7ae989f
diff --git a/tests/resources/status/current_file b/tests/resources/status/current_file
deleted file mode 100644
index a0de7e0..0000000
--- a/tests/resources/status/current_file
+++ /dev/null
@@ -1 +0,0 @@
-current_file
diff --git a/tests/resources/status/ignored_file b/tests/resources/status/ignored_file
deleted file mode 100644
index 6a79f80..0000000
--- a/tests/resources/status/ignored_file
+++ /dev/null
@@ -1 +0,0 @@
-ignored_file
diff --git a/tests/resources/status/modified_file b/tests/resources/status/modified_file
deleted file mode 100644
index 0a53963..0000000
--- a/tests/resources/status/modified_file
+++ /dev/null
@@ -1,2 +0,0 @@
-modified_file
-modified_file
diff --git a/tests/resources/status/new_file b/tests/resources/status/new_file
deleted file mode 100644
index d4fa860..0000000
--- a/tests/resources/status/new_file
+++ /dev/null
@@ -1 +0,0 @@
-new_file
diff --git a/tests/resources/status/staged_changes b/tests/resources/status/staged_changes
deleted file mode 100644
index 55d316c..0000000
--- a/tests/resources/status/staged_changes
+++ /dev/null
@@ -1,2 +0,0 @@
-staged_changes
-staged_changes
diff --git a/tests/resources/status/staged_changes_modified_file b/tests/resources/status/staged_changes_modified_file
deleted file mode 100644
index 011c344..0000000
--- a/tests/resources/status/staged_changes_modified_file
+++ /dev/null
@@ -1,3 +0,0 @@
-staged_changes_modified_file
-staged_changes_modified_file
-staged_changes_modified_file
diff --git a/tests/resources/status/staged_delete_modified_file b/tests/resources/status/staged_delete_modified_file
deleted file mode 100644
index dabc8af..0000000
--- a/tests/resources/status/staged_delete_modified_file
+++ /dev/null
@@ -1 +0,0 @@
-staged_delete_modified_file
diff --git a/tests/resources/status/staged_new_file b/tests/resources/status/staged_new_file
deleted file mode 100644
index 529a16e..0000000
--- a/tests/resources/status/staged_new_file
+++ /dev/null
@@ -1 +0,0 @@
-staged_new_file
diff --git a/tests/resources/status/staged_new_file_modified_file b/tests/resources/status/staged_new_file_modified_file
deleted file mode 100644
index 8b090c0..0000000
--- a/tests/resources/status/staged_new_file_modified_file
+++ /dev/null
@@ -1,2 +0,0 @@
-staged_new_file_modified_file
-staged_new_file_modified_file
diff --git a/tests/resources/status/subdir.txt b/tests/resources/status/subdir.txt
deleted file mode 100644
index e8ee89e..0000000
--- a/tests/resources/status/subdir.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-Is it a bird?
-Is it a plane?
diff --git a/tests/resources/status/subdir/current_file b/tests/resources/status/subdir/current_file
deleted file mode 100644
index 53ace0d..0000000
--- a/tests/resources/status/subdir/current_file
+++ /dev/null
@@ -1 +0,0 @@
-subdir/current_file
diff --git a/tests/resources/status/subdir/modified_file b/tests/resources/status/subdir/modified_file
deleted file mode 100644
index 57274b7..0000000
--- a/tests/resources/status/subdir/modified_file
+++ /dev/null
@@ -1,2 +0,0 @@
-subdir/modified_file
-subdir/modified_file
diff --git a/tests/resources/status/subdir/new_file b/tests/resources/status/subdir/new_file
deleted file mode 100644
index 80a86a6..0000000
--- a/tests/resources/status/subdir/new_file
+++ /dev/null
@@ -1 +0,0 @@
-subdir/new_file
diff --git a/tests/resources/testrepo.git/HEAD b/tests/resources/testrepo.git/HEAD
deleted file mode 100644
index cb089cd..0000000
--- a/tests/resources/testrepo.git/HEAD
+++ /dev/null
@@ -1 +0,0 @@
-ref: refs/heads/master
diff --git a/tests/resources/testrepo.git/config b/tests/resources/testrepo.git/config
deleted file mode 100644
index 1a5aacd..0000000
--- a/tests/resources/testrepo.git/config
+++ /dev/null
@@ -1,8 +0,0 @@
-[core]
- repositoryformatversion = 0
- filemode = true
- bare = true
- logallrefupdates = true
-[remote "test"]
- url = git://github.com/libgit2/libgit2
- fetch = +refs/heads/*:refs/remotes/test/*
diff --git a/tests/resources/testrepo.git/head-tracker b/tests/resources/testrepo.git/head-tracker
deleted file mode 100644
index 40d876b..0000000
--- a/tests/resources/testrepo.git/head-tracker
+++ /dev/null
@@ -1 +0,0 @@
-ref: HEAD
diff --git a/tests/resources/testrepo.git/index b/tests/resources/testrepo.git/index
deleted file mode 100644
index a27fb9c..0000000
Binary files a/tests/resources/testrepo.git/index and /dev/null differ
diff --git a/tests/resources/testrepo.git/objects/13/85f264afb75a56a5bec74243be9b367ba4ca08 b/tests/resources/testrepo.git/objects/13/85f264afb75a56a5bec74243be9b367ba4ca08
deleted file mode 100644
index cedb2a2..0000000
Binary files a/tests/resources/testrepo.git/objects/13/85f264afb75a56a5bec74243be9b367ba4ca08 and /dev/null differ
diff --git a/tests/resources/testrepo.git/objects/18/1037049a54a1eb5fab404658a3a250b44335d7 b/tests/resources/testrepo.git/objects/18/1037049a54a1eb5fab404658a3a250b44335d7
deleted file mode 100644
index 93a16f1..0000000
Binary files a/tests/resources/testrepo.git/objects/18/1037049a54a1eb5fab404658a3a250b44335d7 and /dev/null differ
diff --git a/tests/resources/testrepo.git/objects/18/10dff58d8a660512d4832e740f692884338ccd b/tests/resources/testrepo.git/objects/18/10dff58d8a660512d4832e740f692884338ccd
deleted file mode 100644
index ba0bfb3..0000000
Binary files a/tests/resources/testrepo.git/objects/18/10dff58d8a660512d4832e740f692884338ccd and /dev/null differ
diff --git a/tests/resources/testrepo.git/objects/1f/67fc4386b2d171e0d21be1c447e12660561f9b b/tests/resources/testrepo.git/objects/1f/67fc4386b2d171e0d21be1c447e12660561f9b
deleted file mode 100644
index 225c457..0000000
Binary files a/tests/resources/testrepo.git/objects/1f/67fc4386b2d171e0d21be1c447e12660561f9b and /dev/null differ
diff --git a/tests/resources/testrepo.git/objects/27/0b8ea76056d5cad83af921837702d3e3c2924d b/tests/resources/testrepo.git/objects/27/0b8ea76056d5cad83af921837702d3e3c2924d
deleted file mode 100644
index df40d99..0000000
Binary files a/tests/resources/testrepo.git/objects/27/0b8ea76056d5cad83af921837702d3e3c2924d and /dev/null differ
diff --git a/tests/resources/testrepo.git/objects/32/59a6bd5b57fb9c1281bb7ed3167b50f224cb54 b/tests/resources/testrepo.git/objects/32/59a6bd5b57fb9c1281bb7ed3167b50f224cb54
deleted file mode 100644
index 321eaa8..0000000
Binary files a/tests/resources/testrepo.git/objects/32/59a6bd5b57fb9c1281bb7ed3167b50f224cb54 and /dev/null differ
diff --git a/tests/resources/testrepo.git/objects/36/97d64be941a53d4ae8f6a271e4e3fa56b022cc b/tests/resources/testrepo.git/objects/36/97d64be941a53d4ae8f6a271e4e3fa56b022cc
deleted file mode 100644
index 9bb5b62..0000000
Binary files a/tests/resources/testrepo.git/objects/36/97d64be941a53d4ae8f6a271e4e3fa56b022cc and /dev/null differ
diff --git a/tests/resources/testrepo.git/objects/45/b983be36b73c0788dc9cbcb76cbb80fc7bb057 b/tests/resources/testrepo.git/objects/45/b983be36b73c0788dc9cbcb76cbb80fc7bb057
deleted file mode 100644
index 7ca4cee..0000000
Binary files a/tests/resources/testrepo.git/objects/45/b983be36b73c0788dc9cbcb76cbb80fc7bb057 and /dev/null differ
diff --git a/tests/resources/testrepo.git/objects/4a/202b346bb0fb0db7eff3cffeb3c70babbd2045 b/tests/resources/testrepo.git/objects/4a/202b346bb0fb0db7eff3cffeb3c70babbd2045
deleted file mode 100644
index 8953b6c..0000000
--- a/tests/resources/testrepo.git/objects/4a/202b346bb0fb0db7eff3cffeb3c70babbd2045
+++ /dev/null
@@ -1,2 +0,0 @@
-xŽQ
-Â0DýÎ)öÊ6›Í¦ "xO°‰‰-ØFb¼¿EoàÏ0¼Ç¤º,ske×[ÎPn8R,EpD?±gŸ}Ê^3²âÙ<µåµGŽhYKÄèÒ8ЖDAÉ)¿ÉÈ;gôݧÚàšjïp™4ÕŽ¯ô-çû¢óãêr‚ÁŠ;°s°GA4Ûº=ìùÖ(ôin7øIÌKÍFE
\ No newline at end of file
diff --git a/tests/resources/testrepo.git/objects/5b/5b025afb0b4c913b4c338a42934a3863bf3644 b/tests/resources/testrepo.git/objects/5b/5b025afb0b4c913b4c338a42934a3863bf3644
deleted file mode 100644
index c1f22c5..0000000
--- a/tests/resources/testrepo.git/objects/5b/5b025afb0b4c913b4c338a42934a3863bf3644
+++ /dev/null
@@ -1,2 +0,0 @@
-xŽÛ 1EýNi@™Ék2 "X‚$ÙYW0YcÿíÀ¿Ã…s¸¥ÕzïÚÚõMDÏ€0æœ8!¶†ÉÌÞs‰XŠªgÚdí::@X0»P¢wÙ"F/‰‰œÍRàˆUz÷¥múZZïú²¤ÒV}|•/œo5݇ÒêI£!¬1z Æ:vùÇUim}ê/¢>
-öF-
\ No newline at end of file
diff --git a/tests/resources/testrepo.git/objects/75/057dd4114e74cca1d750d0aee1647c903cb60a b/tests/resources/testrepo.git/objects/75/057dd4114e74cca1d750d0aee1647c903cb60a
deleted file mode 100644
index 2ef4faa..0000000
Binary files a/tests/resources/testrepo.git/objects/75/057dd4114e74cca1d750d0aee1647c903cb60a and /dev/null differ
diff --git a/tests/resources/testrepo.git/objects/76/3d71aadf09a7951596c9746c024e7eece7c7af b/tests/resources/testrepo.git/objects/76/3d71aadf09a7951596c9746c024e7eece7c7af
deleted file mode 100644
index 716b0c6..0000000
--- a/tests/resources/testrepo.git/objects/76/3d71aadf09a7951596c9746c024e7eece7c7af
+++ /dev/null
@@ -1 +0,0 @@
-xŽAj!³ö?0¨£ßÂ09Êo}HÚ6¨}ÿôjUPP©ÕZ&Yÿø˜ AÔ›±€pŒÁFdë¼÷pz[fŽYŒ½PÒqLJ.,Z§`™Å®Ð.ù`’vÙ³q
$Æ5+9çOëtœû>Û/úDE/龡W¯ï*e¿§VŸdf1>ðè¦Öê²×äÄ›¹úÊ™F« ìTŽÙhœk.i¶^0Ô?P¼R,
\ No newline at end of file
diff --git a/tests/resources/testrepo.git/objects/7b/4384978d2493e851f9cca7858815fac9b10980 b/tests/resources/testrepo.git/objects/7b/4384978d2493e851f9cca7858815fac9b10980
deleted file mode 100644
index 23c462f..0000000
Binary files a/tests/resources/testrepo.git/objects/7b/4384978d2493e851f9cca7858815fac9b10980 and /dev/null differ
diff --git a/tests/resources/testrepo.git/objects/81/4889a078c031f61ed08ab5fa863aea9314344d b/tests/resources/testrepo.git/objects/81/4889a078c031f61ed08ab5fa863aea9314344d
deleted file mode 100644
index 2f9b6b6..0000000
Binary files a/tests/resources/testrepo.git/objects/81/4889a078c031f61ed08ab5fa863aea9314344d and /dev/null differ
diff --git a/tests/resources/testrepo.git/objects/84/96071c1b46c854b31185ea97743be6a8774479 b/tests/resources/testrepo.git/objects/84/96071c1b46c854b31185ea97743be6a8774479
deleted file mode 100644
index 5df58dd..0000000
Binary files a/tests/resources/testrepo.git/objects/84/96071c1b46c854b31185ea97743be6a8774479 and /dev/null differ
diff --git a/tests/resources/testrepo.git/objects/94/4c0f6e4dfa41595e6eb3ceecdb14f50fe18162 b/tests/resources/testrepo.git/objects/94/4c0f6e4dfa41595e6eb3ceecdb14f50fe18162
deleted file mode 100644
index 4cc3f4d..0000000
--- a/tests/resources/testrepo.git/objects/94/4c0f6e4dfa41595e6eb3ceecdb14f50fe18162
+++ /dev/null
@@ -1 +0,0 @@
-x+)JMU044b040031QrutñueX¡l¨ðmmA‹m›Ì£íJ}Gß;U‘T”˜—œŸ–™“ªWRQÂ`6ýš÷KÇ¥¶^/¾-*|òøWØ¥3P¥y©å`%ËEÛÞ±\&gŽÐ|Ÿ0§ÿ†{Ó1X
\ No newline at end of file
diff --git a/tests/resources/testrepo.git/objects/9a/03079b8a8ee85a0bee58bf9be3da8b62414ed4 b/tests/resources/testrepo.git/objects/9a/03079b8a8ee85a0bee58bf9be3da8b62414ed4
deleted file mode 100644
index bf7b2bb..0000000
Binary files a/tests/resources/testrepo.git/objects/9a/03079b8a8ee85a0bee58bf9be3da8b62414ed4 and /dev/null differ
diff --git a/tests/resources/testrepo.git/objects/9f/d738e8f7967c078dceed8190330fc8648ee56a b/tests/resources/testrepo.git/objects/9f/d738e8f7967c078dceed8190330fc8648ee56a
deleted file mode 100644
index a796124..0000000
--- a/tests/resources/testrepo.git/objects/9f/d738e8f7967c078dceed8190330fc8648ee56a
+++ /dev/null
@@ -1,3 +0,0 @@
-xŽ[
-Â0EýÎ*fÊäÕ¤ "¸W0“‡-ØFâtÿÝ—çpS[–YÀ˜x^
-Díb CLhutɉ}¥8X*4Zí¬sY½¨—UÀ‘AÃÖ
ÌX3‡R«Mµ¶) s6è¼¢M¦ÖážšÜ&Jm…ó;}Çõ±Ðü<¥¶\@›à‚ÑÞpÄ€¨vº?”ò«jÛºLð«¨Ø?Hå
\ No newline at end of file
diff --git a/tests/resources/testrepo.git/objects/a4/a7dce85cf63874e984719f4fdd239f5145052f b/tests/resources/testrepo.git/objects/a4/a7dce85cf63874e984719f4fdd239f5145052f
deleted file mode 100644
index f858869..0000000
--- a/tests/resources/testrepo.git/objects/a4/a7dce85cf63874e984719f4fdd239f5145052f
+++ /dev/null
@@ -1,2 +0,0 @@
-x;j1DëmdÓú·À˜ÇŽ|M«µ3`ŒV{>€³âQ¯ ¸·vL0I?Í!š4–Z=Ê! צ8²F¢Ã’!rÖsQßyÈ9]$DŽ&„l6AÇ>jFWüÒµIKNiûë§Z¢%¡SˆŒ‘
-‹Ò ÅʉøU~̽øä>'¼ï™û ¯wþ
×[ËÇ×÷öÚDGÚ¡±ðŒQ-ºMù«>dܶ‘OÞáÒò}í\à8g_ШÂoYr
\ No newline at end of file
diff --git a/tests/resources/testrepo.git/objects/a6/5fedf39aefe402d3bb6e24df4d4f5fe4547750 b/tests/resources/testrepo.git/objects/a6/5fedf39aefe402d3bb6e24df4d4f5fe4547750
deleted file mode 100644
index 29c8e82..0000000
--- a/tests/resources/testrepo.git/objects/a6/5fedf39aefe402d3bb6e24df4d4f5fe4547750
+++ /dev/null
@@ -1,3 +0,0 @@
-xŽQ
-!@ûösBQ"‚ŽÐ ÆÙ±
rÍîßÒú{<xð¤·öàîƪ
-™HlJSer!ZPTe*Žj°UÝÑEo^¼ê2 (†ˆ¬XSÅ€ED‘ƒO<Y¦šj$2üs_á&}¸Î,}Ó[~p¹7~<ÒÛ:Ÿ £°·ÉZ³Ùípè?1_ûåC0
\ No newline at end of file
diff --git a/tests/resources/testrepo.git/objects/a7/1586c1dfe8a71c6cbf6c129f404c5642ff31bd b/tests/resources/testrepo.git/objects/a7/1586c1dfe8a71c6cbf6c129f404c5642ff31bd
deleted file mode 100644
index d0d7e73..0000000
Binary files a/tests/resources/testrepo.git/objects/a7/1586c1dfe8a71c6cbf6c129f404c5642ff31bd and /dev/null differ
diff --git a/tests/resources/testrepo.git/objects/a8/233120f6ad708f843d861ce2b7228ec4e3dec6 b/tests/resources/testrepo.git/objects/a8/233120f6ad708f843d861ce2b7228ec4e3dec6
deleted file mode 100644
index 18a7f61..0000000
Binary files a/tests/resources/testrepo.git/objects/a8/233120f6ad708f843d861ce2b7228ec4e3dec6 and /dev/null differ
diff --git a/tests/resources/testrepo.git/objects/ae/90f12eea699729ed24555e40b9fd669da12a12 b/tests/resources/testrepo.git/objects/ae/90f12eea699729ed24555e40b9fd669da12a12
deleted file mode 100644
index d952546..0000000
Binary files a/tests/resources/testrepo.git/objects/ae/90f12eea699729ed24555e40b9fd669da12a12 and /dev/null differ
diff --git a/tests/resources/testrepo.git/objects/b2/5fa35b38051e4ae45d4222e795f9df2e43f1d1 b/tests/resources/testrepo.git/objects/b2/5fa35b38051e4ae45d4222e795f9df2e43f1d1
deleted file mode 100644
index f460f25..0000000
--- a/tests/resources/testrepo.git/objects/b2/5fa35b38051e4ae45d4222e795f9df2e43f1d1
+++ /dev/null
@@ -1,2 +0,0 @@
-xÌA
-Â0…a×9ÅìIÒ ™€ˆp'î§1Ѷ‘v\x{cáýðVŸpƒvWûgŠ¾ÇŽ0xº[]"g†#{rDÆ
Cot äûN œU$ò?9-p+1Í^¤ÀQx®¯Ï9O\ÆC¬Ó Œm'D
{mµVêú(+´ñælè¶,Þ
\ No newline at end of file
diff --git a/tests/resources/testrepo.git/objects/b6/361fc6a97178d8fc8639fdeed71c775ab52593 b/tests/resources/testrepo.git/objects/b6/361fc6a97178d8fc8639fdeed71c775ab52593
deleted file mode 100644
index f613670..0000000
Binary files a/tests/resources/testrepo.git/objects/b6/361fc6a97178d8fc8639fdeed71c775ab52593 and /dev/null differ
diff --git a/tests/resources/testrepo.git/objects/be/3563ae3f795b2b4353bcce3a527ad0a4f7f644 b/tests/resources/testrepo.git/objects/be/3563ae3f795b2b4353bcce3a527ad0a4f7f644
deleted file mode 100644
index 0817229..0000000
--- a/tests/resources/testrepo.git/objects/be/3563ae3f795b2b4353bcce3a527ad0a4f7f644
+++ /dev/null
@@ -1,3 +0,0 @@
-xKj1D³Ö)zçUBëÛ-0ÁuV9¦Õò<#£È÷ÏȲ+ŠW<Jú¶Ý&8Ê/s¨‚e‹µµÈ•KJ«½S
-ØRvÌÁ{©æQ†îr«äY¹QN$H\Eµ²Íè=6áX5¦òÇK Fr)·(‰dC‡Î†”–œ—jÊs®}À—ô9ác-Òw8Ëo¸\·r»¿IßÞÁ:
-l}F‚W$Ds´Ç£©ÿÙšOW…e”]V8-ÃÌÈ"U
\ No newline at end of file
diff --git a/tests/resources/testrepo.git/objects/c4/7800c7266a2be04c571c04d5a6614691ea99bd b/tests/resources/testrepo.git/objects/c4/7800c7266a2be04c571c04d5a6614691ea99bd
deleted file mode 100644
index 75f541f..0000000
--- a/tests/resources/testrepo.git/objects/c4/7800c7266a2be04c571c04d5a6614691ea99bd
+++ /dev/null
@@ -1,3 +0,0 @@
-xŽQ
-Â0DýÎ)öʦ»I<‚'ØlR+˜Fj¼¿EoàÏ0<xÃh«õÞa Üõµ]È™åXUlÞPF)Åz‘4yó”µ,\r 'SÂÄ-mI4
-‘Xhô”&òÌFÞ}n+\µõ—Y´-p|é·œoUz;-‘aÑlt{ØË?®I«,:ÃoÚR̳cHK
\ No newline at end of file
diff --git a/tests/resources/testrepo.git/objects/d6/c93164c249c8000205dd4ec5cbca1b516d487f b/tests/resources/testrepo.git/objects/d6/c93164c249c8000205dd4ec5cbca1b516d487f
deleted file mode 100644
index a67d6e6..0000000
Binary files a/tests/resources/testrepo.git/objects/d6/c93164c249c8000205dd4ec5cbca1b516d487f and /dev/null differ
diff --git a/tests/resources/testrepo.git/objects/e6/9de29bb2d1d6434b8b29ae775ad8c2e48c5391 b/tests/resources/testrepo.git/objects/e6/9de29bb2d1d6434b8b29ae775ad8c2e48c5391
deleted file mode 100644
index 7112238..0000000
Binary files a/tests/resources/testrepo.git/objects/e6/9de29bb2d1d6434b8b29ae775ad8c2e48c5391 and /dev/null differ
diff --git a/tests/resources/testrepo.git/objects/e7/b4ad382349ff96dd8199000580b9b1e2042eb0 b/tests/resources/testrepo.git/objects/e7/b4ad382349ff96dd8199000580b9b1e2042eb0
deleted file mode 100644
index b135ecc..0000000
Binary files a/tests/resources/testrepo.git/objects/e7/b4ad382349ff96dd8199000580b9b1e2042eb0 and /dev/null differ
diff --git a/tests/resources/testrepo.git/objects/f1/425cef211cc08caa31e7b545ffb232acb098c3 b/tests/resources/testrepo.git/objects/f1/425cef211cc08caa31e7b545ffb232acb098c3
deleted file mode 100644
index 82e2790..0000000
Binary files a/tests/resources/testrepo.git/objects/f1/425cef211cc08caa31e7b545ffb232acb098c3 and /dev/null differ
diff --git a/tests/resources/testrepo.git/objects/f6/0079018b664e4e79329a7ef9559c8d9e0378d1 b/tests/resources/testrepo.git/objects/f6/0079018b664e4e79329a7ef9559c8d9e0378d1
deleted file mode 100644
index 697c94c..0000000
Binary files a/tests/resources/testrepo.git/objects/f6/0079018b664e4e79329a7ef9559c8d9e0378d1 and /dev/null differ
diff --git a/tests/resources/testrepo.git/objects/fa/49b077972391ad58037050f2a75f74e3671e92 b/tests/resources/testrepo.git/objects/fa/49b077972391ad58037050f2a75f74e3671e92
deleted file mode 100644
index 112998d..0000000
Binary files a/tests/resources/testrepo.git/objects/fa/49b077972391ad58037050f2a75f74e3671e92 and /dev/null differ
diff --git a/tests/resources/testrepo.git/objects/fd/093bff70906175335656e6ce6ae05783708765 b/tests/resources/testrepo.git/objects/fd/093bff70906175335656e6ce6ae05783708765
deleted file mode 100644
index 12bf5f3..0000000
Binary files a/tests/resources/testrepo.git/objects/fd/093bff70906175335656e6ce6ae05783708765 and /dev/null differ
diff --git a/tests/resources/testrepo.git/objects/pack/pack-a81e489679b7d3418f9ab594bda8ceb37dd4c695.idx b/tests/resources/testrepo.git/objects/pack/pack-a81e489679b7d3418f9ab594bda8ceb37dd4c695.idx
deleted file mode 100644
index 5068f28..0000000
Binary files a/tests/resources/testrepo.git/objects/pack/pack-a81e489679b7d3418f9ab594bda8ceb37dd4c695.idx and /dev/null differ
diff --git a/tests/resources/testrepo.git/objects/pack/pack-a81e489679b7d3418f9ab594bda8ceb37dd4c695.pack b/tests/resources/testrepo.git/objects/pack/pack-a81e489679b7d3418f9ab594bda8ceb37dd4c695.pack
deleted file mode 100644
index a6a1f30..0000000
Binary files a/tests/resources/testrepo.git/objects/pack/pack-a81e489679b7d3418f9ab594bda8ceb37dd4c695.pack and /dev/null differ
diff --git a/tests/resources/testrepo.git/objects/pack/pack-d7c6adf9f61318f041845b01440d09aa7a91e1b5.idx b/tests/resources/testrepo.git/objects/pack/pack-d7c6adf9f61318f041845b01440d09aa7a91e1b5.idx
deleted file mode 100644
index 94c3c71..0000000
Binary files a/tests/resources/testrepo.git/objects/pack/pack-d7c6adf9f61318f041845b01440d09aa7a91e1b5.idx and /dev/null differ
diff --git a/tests/resources/testrepo.git/objects/pack/pack-d7c6adf9f61318f041845b01440d09aa7a91e1b5.pack b/tests/resources/testrepo.git/objects/pack/pack-d7c6adf9f61318f041845b01440d09aa7a91e1b5.pack
deleted file mode 100644
index 74c7fe4..0000000
Binary files a/tests/resources/testrepo.git/objects/pack/pack-d7c6adf9f61318f041845b01440d09aa7a91e1b5.pack and /dev/null differ
diff --git a/tests/resources/testrepo.git/objects/pack/pack-d85f5d483273108c9d8dd0e4728ccf0b2982423a.idx b/tests/resources/testrepo.git/objects/pack/pack-d85f5d483273108c9d8dd0e4728ccf0b2982423a.idx
deleted file mode 100644
index 555cfa9..0000000
Binary files a/tests/resources/testrepo.git/objects/pack/pack-d85f5d483273108c9d8dd0e4728ccf0b2982423a.idx and /dev/null differ
diff --git a/tests/resources/testrepo.git/objects/pack/pack-d85f5d483273108c9d8dd0e4728ccf0b2982423a.pack b/tests/resources/testrepo.git/objects/pack/pack-d85f5d483273108c9d8dd0e4728ccf0b2982423a.pack
deleted file mode 100644
index 4d539ed..0000000
Binary files a/tests/resources/testrepo.git/objects/pack/pack-d85f5d483273108c9d8dd0e4728ccf0b2982423a.pack and /dev/null differ
diff --git a/tests/resources/testrepo.git/packed-refs b/tests/resources/testrepo.git/packed-refs
deleted file mode 100644
index 52f5e87..0000000
--- a/tests/resources/testrepo.git/packed-refs
+++ /dev/null
@@ -1,3 +0,0 @@
-# pack-refs with: peeled
-41bc8c69075bbdb46c5c6f0566cc8cc5b46e8bd9 refs/heads/packed
-5b5b025afb0b4c913b4c338a42934a3863bf3644 refs/heads/packed-test
diff --git a/tests/resources/testrepo.git/refs/heads/br2 b/tests/resources/testrepo.git/refs/heads/br2
deleted file mode 100644
index aab87e5..0000000
--- a/tests/resources/testrepo.git/refs/heads/br2
+++ /dev/null
@@ -1 +0,0 @@
-a4a7dce85cf63874e984719f4fdd239f5145052f
diff --git a/tests/resources/testrepo.git/refs/heads/master b/tests/resources/testrepo.git/refs/heads/master
deleted file mode 100644
index 3d8f0a4..0000000
--- a/tests/resources/testrepo.git/refs/heads/master
+++ /dev/null
@@ -1 +0,0 @@
-a65fedf39aefe402d3bb6e24df4d4f5fe4547750
diff --git a/tests/resources/testrepo.git/refs/heads/packed-test b/tests/resources/testrepo.git/refs/heads/packed-test
deleted file mode 100644
index f2c14ad..0000000
--- a/tests/resources/testrepo.git/refs/heads/packed-test
+++ /dev/null
@@ -1 +0,0 @@
-4a202b346bb0fb0db7eff3cffeb3c70babbd2045
diff --git a/tests/resources/testrepo.git/refs/heads/subtrees b/tests/resources/testrepo.git/refs/heads/subtrees
deleted file mode 100644
index ad27e0b..0000000
--- a/tests/resources/testrepo.git/refs/heads/subtrees
+++ /dev/null
@@ -1 +0,0 @@
-763d71aadf09a7951596c9746c024e7eece7c7af
diff --git a/tests/resources/testrepo.git/refs/heads/test b/tests/resources/testrepo.git/refs/heads/test
deleted file mode 100644
index 399c4c7..0000000
--- a/tests/resources/testrepo.git/refs/heads/test
+++ /dev/null
@@ -1 +0,0 @@
-e90810b8df3e80c413d903f631643c716887138d
diff --git a/tests/resources/testrepo.git/refs/tags/e90810b b/tests/resources/testrepo.git/refs/tags/e90810b
deleted file mode 100644
index 584495d..0000000
--- a/tests/resources/testrepo.git/refs/tags/e90810b
+++ /dev/null
@@ -1 +0,0 @@
-7b4384978d2493e851f9cca7858815fac9b10980
diff --git a/tests/resources/testrepo.git/refs/tags/point_to_blob b/tests/resources/testrepo.git/refs/tags/point_to_blob
deleted file mode 100644
index f874a3f..0000000
--- a/tests/resources/testrepo.git/refs/tags/point_to_blob
+++ /dev/null
@@ -1 +0,0 @@
-1385f264afb75a56a5bec74243be9b367ba4ca08
diff --git a/tests/resources/testrepo.git/refs/tags/test b/tests/resources/testrepo.git/refs/tags/test
deleted file mode 100644
index 6ee952a..0000000
--- a/tests/resources/testrepo.git/refs/tags/test
+++ /dev/null
@@ -1 +0,0 @@
-b25fa35b38051e4ae45d4222e795f9df2e43f1d1
diff --git a/tests/t00-core.c b/tests/t00-core.c
deleted file mode 100644
index 7f142ba..0000000
--- a/tests/t00-core.c
+++ /dev/null
@@ -1,636 +0,0 @@
-/*
- * This file is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License, version 2,
- * as published by the Free Software Foundation.
- *
- * In addition to the permissions in the GNU General Public License,
- * the authors give you unlimited permission to link the compiled
- * version of this file into combinations with other programs,
- * and to distribute those combinations without any restriction
- * coming from the use of this file. (The General Public License
- * restrictions do apply in other respects; for example, they cover
- * modification of the file, and distribution when not linked into
- * a combined executable.)
- *
- * This file is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; see the file COPYING. If not, write to
- * the Free Software Foundation, 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-#include "test_lib.h"
-
-#include "vector.h"
-#include "fileops.h"
-#include "filebuf.h"
-
-BEGIN_TEST(string0, "compare prefixes")
- must_be_true(git__prefixcmp("", "") == 0);
- must_be_true(git__prefixcmp("a", "") == 0);
- must_be_true(git__prefixcmp("", "a") < 0);
- must_be_true(git__prefixcmp("a", "b") < 0);
- must_be_true(git__prefixcmp("b", "a") > 0);
- must_be_true(git__prefixcmp("ab", "a") == 0);
- must_be_true(git__prefixcmp("ab", "ac") < 0);
- must_be_true(git__prefixcmp("ab", "aa") > 0);
-END_TEST
-
-BEGIN_TEST(string1, "compare suffixes")
- must_be_true(git__suffixcmp("", "") == 0);
- must_be_true(git__suffixcmp("a", "") == 0);
- must_be_true(git__suffixcmp("", "a") < 0);
- must_be_true(git__suffixcmp("a", "b") < 0);
- must_be_true(git__suffixcmp("b", "a") > 0);
- must_be_true(git__suffixcmp("ba", "a") == 0);
- must_be_true(git__suffixcmp("zaa", "ac") < 0);
- must_be_true(git__suffixcmp("zaz", "ac") > 0);
-END_TEST
-
-
-BEGIN_TEST(vector0, "initial size of 1 would cause writing past array bounds")
- git_vector x;
- int i;
- git_vector_init(&x, 1, NULL);
- for (i = 0; i < 10; ++i) {
- git_vector_insert(&x, (void*) 0xabc);
- }
- git_vector_free(&x);
-END_TEST
-
-BEGIN_TEST(vector1, "don't read past array bounds on remove()")
- git_vector x;
- // make initial capacity exact for our insertions.
- git_vector_init(&x, 3, NULL);
- git_vector_insert(&x, (void*) 0xabc);
- git_vector_insert(&x, (void*) 0xdef);
- git_vector_insert(&x, (void*) 0x123);
-
- git_vector_remove(&x, 0); // used to read past array bounds.
- git_vector_free(&x);
-END_TEST
-
-static int test_cmp(const void *a, const void *b)
-{
- return *(const int *)a - *(const int *)b;
-}
-
-BEGIN_TEST(vector2, "remove duplicates")
- git_vector x;
- int *ptrs[2];
-
- ptrs[0] = git__malloc(sizeof(int));
- ptrs[1] = git__malloc(sizeof(int));
-
- *ptrs[0] = 2;
- *ptrs[1] = 1;
-
- must_pass(git_vector_init(&x, 5, test_cmp));
- must_pass(git_vector_insert(&x, ptrs[0]));
- must_pass(git_vector_insert(&x, ptrs[1]));
- must_pass(git_vector_insert(&x, ptrs[1]));
- must_pass(git_vector_insert(&x, ptrs[0]));
- must_pass(git_vector_insert(&x, ptrs[1]));
- must_be_true(x.length == 5);
- git_vector_uniq(&x);
- must_be_true(x.length == 2);
- git_vector_free(&x);
-
- git__free(ptrs[0]);
- git__free(ptrs[1]);
-END_TEST
-
-
-BEGIN_TEST(path0, "get the dirname of a path")
- git_buf dir = GIT_BUF_INIT;
- char *dir2;
-
-#define DIRNAME_TEST(A, B) { \
- must_be_true(git_path_dirname_r(&dir, A) >= 0); \
- must_be_true(strcmp(B, dir.ptr) == 0); \
- must_be_true((dir2 = git_path_dirname(A)) != NULL); \
- must_be_true(strcmp(dir2, B) == 0); \
- git__free(dir2); \
-}
-
- DIRNAME_TEST(NULL, ".");
- DIRNAME_TEST("", ".");
- DIRNAME_TEST("a", ".");
- DIRNAME_TEST("/", "/");
- DIRNAME_TEST("/usr", "/");
- DIRNAME_TEST("/usr/", "/");
- DIRNAME_TEST("/usr/lib", "/usr");
- DIRNAME_TEST("/usr/lib/", "/usr");
- DIRNAME_TEST("/usr/lib//", "/usr");
- DIRNAME_TEST("usr/lib", "usr");
- DIRNAME_TEST("usr/lib/", "usr");
- DIRNAME_TEST("usr/lib//", "usr");
- DIRNAME_TEST(".git/", ".");
-
-#undef DIRNAME_TEST
-
- git_buf_free(&dir);
-END_TEST
-
-BEGIN_TEST(path1, "get the base name of a path")
- git_buf base = GIT_BUF_INIT;
- char *base2;
-
-#define BASENAME_TEST(A, B) { \
- must_be_true(git_path_basename_r(&base, A) >= 0); \
- must_be_true(strcmp(B, base.ptr) == 0); \
- must_be_true((base2 = git_path_basename(A)) != NULL); \
- must_be_true(strcmp(base2, B) == 0); \
- git__free(base2); \
-}
-
- BASENAME_TEST(NULL, ".");
- BASENAME_TEST("", ".");
- BASENAME_TEST("a", "a");
- BASENAME_TEST("/", "/");
- BASENAME_TEST("/usr", "usr");
- BASENAME_TEST("/usr/", "usr");
- BASENAME_TEST("/usr/lib", "lib");
- BASENAME_TEST("/usr/lib//", "lib");
- BASENAME_TEST("usr/lib", "lib");
-
-#undef BASENAME_TEST
-
- git_buf_free(&base);
-END_TEST
-
-BEGIN_TEST(path2, "get the latest component in a path")
- const char *dir;
-
-#define TOPDIR_TEST(A, B) { \
- must_be_true((dir = git_path_topdir(A)) != NULL); \
- must_be_true(strcmp(dir, B) == 0); \
-}
-
- TOPDIR_TEST(".git/", ".git/");
- TOPDIR_TEST("/.git/", ".git/");
- TOPDIR_TEST("usr/local/.git/", ".git/");
- TOPDIR_TEST("./.git/", ".git/");
- TOPDIR_TEST("/usr/.git/", ".git/");
- TOPDIR_TEST("/", "/");
- TOPDIR_TEST("a/", "a/");
-
- must_be_true(git_path_topdir("/usr/.git") == NULL);
- must_be_true(git_path_topdir(".") == NULL);
- must_be_true(git_path_topdir("") == NULL);
- must_be_true(git_path_topdir("a") == NULL);
-
-#undef TOPDIR_TEST
-END_TEST
-
-static int ensure_joinpath(const char *path_a, const char *path_b, const char *expected_path)
-{
- int error = GIT_SUCCESS;
- git_buf joined_path = GIT_BUF_INIT;
- if (!(error = git_buf_joinpath(&joined_path, path_a, path_b)))
- error = strcmp(joined_path.ptr, expected_path) == 0 ?
- GIT_SUCCESS : GIT_ERROR;
- git_buf_free(&joined_path);
- return error;
-}
-
-BEGIN_TEST(path5, "properly join path components")
- must_pass(ensure_joinpath("", "", ""));
- must_pass(ensure_joinpath("", "a", "a"));
- must_pass(ensure_joinpath("", "/a", "/a"));
- must_pass(ensure_joinpath("a", "", "a/"));
- must_pass(ensure_joinpath("a", "/", "a/"));
- must_pass(ensure_joinpath("a", "b", "a/b"));
- must_pass(ensure_joinpath("/", "a", "/a"));
- must_pass(ensure_joinpath("/", "", "/"));
- must_pass(ensure_joinpath("/a", "/b", "/a/b"));
- must_pass(ensure_joinpath("/a", "/b/", "/a/b/"));
- must_pass(ensure_joinpath("/a/", "b/", "/a/b/"));
- must_pass(ensure_joinpath("/a/", "/b/", "/a/b/"));
-END_TEST
-
-static int ensure_joinpath_n(const char *path_a, const char *path_b, const char *path_c, const char *path_d, const char *expected_path)
-{
- int error = GIT_SUCCESS;
- git_buf joined_path = GIT_BUF_INIT;
- if (!(error = git_buf_join_n(&joined_path, '/', 4,
- path_a, path_b, path_c, path_d)))
- error = strcmp(joined_path.ptr, expected_path) == 0 ?
- GIT_SUCCESS : GIT_ERROR;
- git_buf_free(&joined_path);
- return error;
-}
-
-BEGIN_TEST(path6, "properly join path components for more than one path")
- must_pass(ensure_joinpath_n("", "", "", "", ""));
- must_pass(ensure_joinpath_n("", "a", "", "", "a/"));
- must_pass(ensure_joinpath_n("a", "", "", "", "a/"));
- must_pass(ensure_joinpath_n("", "", "", "a", "a"));
- must_pass(ensure_joinpath_n("a", "b", "", "/c/d/", "a/b/c/d/"));
- must_pass(ensure_joinpath_n("a", "b", "", "/c/d", "a/b/c/d"));
-END_TEST
-
-typedef struct name_data {
- int count; /* return count */
- char *name; /* filename */
-} name_data;
-
-typedef struct walk_data {
- char *sub; /* sub-directory name */
- name_data *names; /* name state data */
- git_buf path; /* buffer to store path */
-} walk_data;
-
-
-static char *top_dir = "dir-walk";
-static walk_data *state_loc;
-
-static int error(const char *fmt, ...)
-{
- va_list ap;
-
- va_start(ap, fmt);
- vfprintf(stderr, fmt, ap);
- va_end(ap);
- fprintf(stderr, "\n");
- return -1;
-}
-
-static int setup(walk_data *d)
-{
- name_data *n;
-
- if (p_mkdir(top_dir, 0777) < 0)
- return error("can't mkdir(\"%s\")", top_dir);
-
- if (p_chdir(top_dir) < 0)
- return error("can't chdir(\"%s\")", top_dir);
-
- if (strcmp(d->sub, ".") != 0)
- if (p_mkdir(d->sub, 0777) < 0)
- return error("can't mkdir(\"%s\")", d->sub);
-
- if (git_buf_sets(&d->path, d->sub) < 0)
- return error("can't allocate space for \"%s\"", d->sub);
-
- state_loc = d;
-
- for (n = d->names; n->name; n++) {
- git_file fd = p_creat(n->name, 0666);
- if (fd < 0)
- return GIT_ERROR;
- p_close(fd);
- n->count = 0;
- }
-
- return 0;
-}
-
-static int knockdown(walk_data *d)
-{
- name_data *n;
-
- git_buf_free(&d->path);
-
- for (n = d->names; n->name; n++) {
- if (p_unlink(n->name) < 0)
- return error("can't unlink(\"%s\")", n->name);
- }
-
- if (strcmp(d->sub, ".") != 0)
- if (p_rmdir(d->sub) < 0)
- return error("can't rmdir(\"%s\")", d->sub);
-
- if (p_chdir("..") < 0)
- return error("can't chdir(\"..\")");
-
- if (p_rmdir(top_dir) < 0)
- return error("can't rmdir(\"%s\")", top_dir);
-
- return 0;
-}
-
-static int check_counts(walk_data *d)
-{
- int ret = 0;
- name_data *n;
-
- for (n = d->names; n->name; n++) {
- if (n->count != 1)
- ret = error("count (%d, %s)", n->count, n->name);
- }
- return ret;
-}
-
-static int one_entry(void *state, git_buf *path)
-{
- walk_data *d = (walk_data *) state;
- name_data *n;
-
- if (state != state_loc)
- return GIT_ERROR;
-
- if (path != &d->path)
- return GIT_ERROR;
-
- for (n = d->names; n->name; n++) {
- if (!strcmp(n->name, path->ptr)) {
- n->count++;
- return 0;
- }
- }
-
- return GIT_ERROR;
-}
-
-
-static name_data dot_names[] = {
- { 0, "./a" },
- { 0, "./asdf" },
- { 0, "./pack-foo.pack" },
- { 0, NULL }
-};
-static walk_data dot = {
- ".",
- dot_names,
- GIT_BUF_INIT
-};
-
-BEGIN_TEST(dirent0, "make sure that the '.' folder is not traversed")
- must_pass(setup(&dot));
-
- must_pass(git_path_direach(&dot.path,
- one_entry,
- &dot));
-
- must_pass(check_counts(&dot));
-
- must_pass(knockdown(&dot));
-END_TEST
-
-static name_data sub_names[] = {
- { 0, "sub/a" },
- { 0, "sub/asdf" },
- { 0, "sub/pack-foo.pack" },
- { 0, NULL }
-};
-static walk_data sub = {
- "sub",
- sub_names,
- GIT_BUF_INIT
-};
-
-BEGIN_TEST(dirent1, "traverse a subfolder")
-
- must_pass(setup(&sub));
-
- must_pass(git_path_direach(&sub.path,
- one_entry,
- &sub));
-
- must_pass(check_counts(&sub));
-
- must_pass(knockdown(&sub));
-END_TEST
-
-static walk_data sub_slash = {
- "sub/",
- sub_names,
- GIT_BUF_INIT
-};
-
-BEGIN_TEST(dirent2, "traverse a slash-terminated subfolder")
-
- must_pass(setup(&sub_slash));
-
- must_pass(git_path_direach(&sub_slash.path,
- one_entry,
- &sub_slash));
-
- must_pass(check_counts(&sub_slash));
-
- must_pass(knockdown(&sub_slash));
-END_TEST
-
-static name_data empty_names[] = {
- { 0, NULL }
-};
-static walk_data empty = {
- "empty",
- empty_names,
- GIT_BUF_INIT
-};
-
-static int dont_call_me(void *state, git_buf *path)
-{
- GIT_UNUSED(state);
- GIT_UNUSED(path);
- return GIT_ERROR;
-}
-
-BEGIN_TEST(dirent3, "make sure that empty folders are not traversed")
-
- must_pass(setup(&empty));
-
- must_pass(git_path_direach(&empty.path,
- one_entry,
- &empty));
-
- must_pass(check_counts(&empty));
-
- /* make sure callback not called */
- must_pass(git_path_direach(&empty.path,
- dont_call_me,
- &empty));
-
- must_pass(knockdown(&empty));
-END_TEST
-
-static name_data odd_names[] = {
- { 0, "odd/.a" },
- { 0, "odd/..c" },
- /* the following don't work on cygwin/win32 */
- /* { 0, "odd/.b." }, */
- /* { 0, "odd/..d.." }, */
- { 0, NULL }
-};
-static walk_data odd = {
- "odd",
- odd_names,
- GIT_BUF_INIT
-};
-
-BEGIN_TEST(dirent4, "make sure that strange looking filenames ('..c') are traversed")
-
- must_pass(setup(&odd));
-
- must_pass(git_path_direach(&odd.path,
- one_entry,
- &odd));
-
- must_pass(check_counts(&odd));
-
- must_pass(knockdown(&odd));
-END_TEST
-
-BEGIN_TEST(filebuf0, "make sure git_filebuf_open doesn't delete an existing lock")
- git_filebuf file = GIT_FILEBUF_INIT;
- int fd;
- char test[] = "test", testlock[] = "test.lock";
-
- fd = p_creat(testlock, 0744);
- must_pass(fd);
- must_pass(p_close(fd));
- must_fail(git_filebuf_open(&file, test, 0));
- must_pass(git_path_exists(testlock));
- must_pass(p_unlink(testlock));
-END_TEST
-
-BEGIN_TEST(filebuf1, "make sure GIT_FILEBUF_APPEND works as expected")
- git_filebuf file = GIT_FILEBUF_INIT;
- int fd;
- char test[] = "test";
-
- fd = p_creat(test, 0666);
- must_pass(fd);
- must_pass(p_write(fd, "libgit2 rocks\n", 14));
- must_pass(p_close(fd));
-
- must_pass(git_filebuf_open(&file, test, GIT_FILEBUF_APPEND));
- must_pass(git_filebuf_printf(&file, "%s\n", "libgit2 rocks"));
- must_pass(git_filebuf_commit(&file, 0666));
-
- must_pass(p_unlink(test));
-END_TEST
-
-BEGIN_TEST(filebuf2, "make sure git_filebuf_write writes large buffer correctly")
- git_filebuf file = GIT_FILEBUF_INIT;
- char test[] = "test";
- unsigned char buf[4096 * 4]; /* 2 * WRITE_BUFFER_SIZE */
-
- memset(buf, 0xfe, sizeof(buf));
- must_pass(git_filebuf_open(&file, test, 0));
- must_pass(git_filebuf_write(&file, buf, sizeof(buf)));
- must_pass(git_filebuf_commit(&file, 0666));
-
- must_pass(p_unlink(test));
-END_TEST
-
-static char *empty_tmp_dir = "test_gitfo_rmdir_recurs_test";
-
-static int setup_empty_tmp_dir(void)
-{
- git_buf path = GIT_BUF_INIT;
-
- int error =
- p_mkdir(empty_tmp_dir, 0777) ||
- git_buf_joinpath(&path, empty_tmp_dir, "/one") ||
- p_mkdir(path.ptr, 0777) ||
- git_buf_joinpath(&path, empty_tmp_dir, "/one/two_one") ||
- p_mkdir(path.ptr, 0777) ||
- git_buf_joinpath(&path, empty_tmp_dir, "/one/two_two") ||
- p_mkdir(path.ptr, 0777) ||
- git_buf_joinpath(&path, empty_tmp_dir, "/one/two_two/three") ||
- p_mkdir(path.ptr, 0777) ||
- git_buf_joinpath(&path, empty_tmp_dir, "/two") ||
- p_mkdir(path.ptr, 0777);
-
- git_buf_free(&path);
-
- return error ? -1 : 0;
-}
-
-BEGIN_TEST(rmdir0, "make sure empty dir can be deleted recusively")
- must_pass(setup_empty_tmp_dir());
- must_pass(git_futils_rmdir_r(empty_tmp_dir, 0));
-END_TEST
-
-BEGIN_TEST(rmdir1, "make sure non-empty dir cannot be deleted recusively")
- git_buf file = GIT_BUF_INIT;
- int fd;
-
- must_pass(setup_empty_tmp_dir());
- must_pass(git_buf_joinpath(&file, empty_tmp_dir, "/two/file.txt"));
- fd = p_creat(file.ptr, 0777);
- must_pass(fd);
- must_pass(p_close(fd));
- must_fail(git_futils_rmdir_r(empty_tmp_dir, 0));
- must_pass(p_unlink(file.ptr));
- must_pass(git_futils_rmdir_r(empty_tmp_dir, 0));
- git_buf_free(&file);
-END_TEST
-
-BEGIN_TEST(strtol0, "parsing out 32 integers from a string")
- int32_t i;
-
- must_pass(git__strtol32(&i, "123", NULL, 10));
- must_be_true(i == 123);
-
- must_pass(git__strtol32(&i, " +123 ", NULL, 10));
- must_be_true(i == 123);
-
- must_pass(git__strtol32(&i, " +2147483647 ", NULL, 10));
- must_be_true(i == 2147483647);
-
- must_pass(git__strtol32(&i, " -2147483648 ", NULL, 10));
- must_be_true(i == -2147483648LL);
-
- must_fail(git__strtol32(&i, " 2147483657 ", NULL, 10));
- must_fail(git__strtol32(&i, " -2147483657 ", NULL, 10));
-END_TEST
-
-BEGIN_TEST(strtol1, "parsing out 64 integers from a string")
- int64_t i;
-
- must_pass(git__strtol64(&i, "123", NULL, 10));
- must_be_true(i == 123);
-
- must_pass(git__strtol64(&i, " +123 ", NULL, 10));
- must_be_true(i == 123);
-
- must_pass(git__strtol64(&i, " +2147483647 ", NULL, 10));
- must_be_true(i == 2147483647);
-
- must_pass(git__strtol64(&i, " -2147483648 ", NULL, 10));
- must_be_true(i == -2147483648LL);
-
- must_pass(git__strtol64(&i, " 2147483657 ", NULL, 10));
- must_be_true(i == 2147483657LL);
-
- must_pass(git__strtol64(&i, " -2147483657 ", NULL, 10));
- must_be_true(i == -2147483657LL);
-END_TEST
-
-BEGIN_SUITE(core)
- ADD_TEST(string0);
- ADD_TEST(string1);
-
- ADD_TEST(vector0);
- ADD_TEST(vector1);
- ADD_TEST(vector2);
-
- ADD_TEST(path0);
- ADD_TEST(path1);
- ADD_TEST(path2);
- ADD_TEST(path5);
- ADD_TEST(path6);
-
- ADD_TEST(dirent0);
- ADD_TEST(dirent1);
- ADD_TEST(dirent2);
- ADD_TEST(dirent3);
- ADD_TEST(dirent4);
-
- ADD_TEST(filebuf0);
- ADD_TEST(filebuf1);
- ADD_TEST(filebuf2);
-
- ADD_TEST(rmdir0);
- ADD_TEST(rmdir1);
-
- ADD_TEST(strtol0);
- ADD_TEST(strtol1);
-END_SUITE
diff --git a/tests/t01-data.h b/tests/t01-data.h
deleted file mode 100644
index 268269d..0000000
--- a/tests/t01-data.h
+++ /dev/null
@@ -1,322 +0,0 @@
-
-/*
- * Raw data
- */
-static unsigned char commit_data[] = {
- 0x74, 0x72, 0x65, 0x65, 0x20, 0x64, 0x66, 0x66,
- 0x32, 0x64, 0x61, 0x39, 0x30, 0x62, 0x32, 0x35,
- 0x34, 0x65, 0x31, 0x62, 0x65, 0x62, 0x38, 0x38,
- 0x39, 0x64, 0x31, 0x66, 0x31, 0x66, 0x31, 0x32,
- 0x38, 0x38, 0x62, 0x65, 0x31, 0x38, 0x30, 0x33,
- 0x37, 0x38, 0x32, 0x64, 0x66, 0x0a, 0x61, 0x75,
- 0x74, 0x68, 0x6f, 0x72, 0x20, 0x41, 0x20, 0x55,
- 0x20, 0x54, 0x68, 0x6f, 0x72, 0x20, 0x3c, 0x61,
- 0x75, 0x74, 0x68, 0x6f, 0x72, 0x40, 0x65, 0x78,
- 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2e, 0x63, 0x6f,
- 0x6d, 0x3e, 0x20, 0x31, 0x32, 0x32, 0x37, 0x38,
- 0x31, 0x34, 0x32, 0x39, 0x37, 0x20, 0x2b, 0x30,
- 0x30, 0x30, 0x30, 0x0a, 0x63, 0x6f, 0x6d, 0x6d,
- 0x69, 0x74, 0x74, 0x65, 0x72, 0x20, 0x43, 0x20,
- 0x4f, 0x20, 0x4d, 0x69, 0x74, 0x74, 0x65, 0x72,
- 0x20, 0x3c, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74,
- 0x74, 0x65, 0x72, 0x40, 0x65, 0x78, 0x61, 0x6d,
- 0x70, 0x6c, 0x65, 0x2e, 0x63, 0x6f, 0x6d, 0x3e,
- 0x20, 0x31, 0x32, 0x32, 0x37, 0x38, 0x31, 0x34,
- 0x32, 0x39, 0x37, 0x20, 0x2b, 0x30, 0x30, 0x30,
- 0x30, 0x0a, 0x0a, 0x41, 0x20, 0x6f, 0x6e, 0x65,
- 0x2d, 0x6c, 0x69, 0x6e, 0x65, 0x20, 0x63, 0x6f,
- 0x6d, 0x6d, 0x69, 0x74, 0x20, 0x73, 0x75, 0x6d,
- 0x6d, 0x61, 0x72, 0x79, 0x0a, 0x0a, 0x54, 0x68,
- 0x65, 0x20, 0x62, 0x6f, 0x64, 0x79, 0x20, 0x6f,
- 0x66, 0x20, 0x74, 0x68, 0x65, 0x20, 0x63, 0x6f,
- 0x6d, 0x6d, 0x69, 0x74, 0x20, 0x6d, 0x65, 0x73,
- 0x73, 0x61, 0x67, 0x65, 0x2c, 0x20, 0x63, 0x6f,
- 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x69, 0x6e, 0x67,
- 0x20, 0x66, 0x75, 0x72, 0x74, 0x68, 0x65, 0x72,
- 0x20, 0x65, 0x78, 0x70, 0x6c, 0x61, 0x6e, 0x61,
- 0x74, 0x69, 0x6f, 0x6e, 0x0a, 0x6f, 0x66, 0x20,
- 0x74, 0x68, 0x65, 0x20, 0x70, 0x75, 0x72, 0x70,
- 0x6f, 0x73, 0x65, 0x20, 0x6f, 0x66, 0x20, 0x74,
- 0x68, 0x65, 0x20, 0x63, 0x68, 0x61, 0x6e, 0x67,
- 0x65, 0x73, 0x20, 0x69, 0x6e, 0x74, 0x72, 0x6f,
- 0x64, 0x75, 0x63, 0x65, 0x64, 0x20, 0x62, 0x79,
- 0x20, 0x74, 0x68, 0x65, 0x20, 0x63, 0x6f, 0x6d,
- 0x6d, 0x69, 0x74, 0x2e, 0x0a, 0x0a, 0x53, 0x69,
- 0x67, 0x6e, 0x65, 0x64, 0x2d, 0x6f, 0x66, 0x2d,
- 0x62, 0x79, 0x3a, 0x20, 0x41, 0x20, 0x55, 0x20,
- 0x54, 0x68, 0x6f, 0x72, 0x20, 0x3c, 0x61, 0x75,
- 0x74, 0x68, 0x6f, 0x72, 0x40, 0x65, 0x78, 0x61,
- 0x6d, 0x70, 0x6c, 0x65, 0x2e, 0x63, 0x6f, 0x6d,
- 0x3e, 0x0a,
-};
-
-
-static unsigned char tree_data[] = {
- 0x31, 0x30, 0x30, 0x36, 0x34, 0x34, 0x20, 0x6f,
- 0x6e, 0x65, 0x00, 0x8b, 0x13, 0x78, 0x91, 0x79,
- 0x1f, 0xe9, 0x69, 0x27, 0xad, 0x78, 0xe6, 0x4b,
- 0x0a, 0xad, 0x7b, 0xde, 0xd0, 0x8b, 0xdc, 0x31,
- 0x30, 0x30, 0x36, 0x34, 0x34, 0x20, 0x73, 0x6f,
- 0x6d, 0x65, 0x00, 0xfd, 0x84, 0x30, 0xbc, 0x86,
- 0x4c, 0xfc, 0xd5, 0xf1, 0x0e, 0x55, 0x90, 0xf8,
- 0xa4, 0x47, 0xe0, 0x1b, 0x94, 0x2b, 0xfe, 0x31,
- 0x30, 0x30, 0x36, 0x34, 0x34, 0x20, 0x74, 0x77,
- 0x6f, 0x00, 0x78, 0x98, 0x19, 0x22, 0x61, 0x3b,
- 0x2a, 0xfb, 0x60, 0x25, 0x04, 0x2f, 0xf6, 0xbd,
- 0x87, 0x8a, 0xc1, 0x99, 0x4e, 0x85, 0x31, 0x30,
- 0x30, 0x36, 0x34, 0x34, 0x20, 0x7a, 0x65, 0x72,
- 0x6f, 0x00, 0xe6, 0x9d, 0xe2, 0x9b, 0xb2, 0xd1,
- 0xd6, 0x43, 0x4b, 0x8b, 0x29, 0xae, 0x77, 0x5a,
- 0xd8, 0xc2, 0xe4, 0x8c, 0x53, 0x91,
-};
-
-static unsigned char tag_data[] = {
- 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x20, 0x33,
- 0x64, 0x37, 0x66, 0x38, 0x61, 0x36, 0x61, 0x66,
- 0x30, 0x37, 0x36, 0x63, 0x38, 0x63, 0x33, 0x66,
- 0x32, 0x30, 0x30, 0x37, 0x31, 0x61, 0x38, 0x39,
- 0x33, 0x35, 0x63, 0x64, 0x62, 0x65, 0x38, 0x32,
- 0x32, 0x38, 0x35, 0x39, 0x34, 0x64, 0x31, 0x0a,
- 0x74, 0x79, 0x70, 0x65, 0x20, 0x63, 0x6f, 0x6d,
- 0x6d, 0x69, 0x74, 0x0a, 0x74, 0x61, 0x67, 0x20,
- 0x76, 0x30, 0x2e, 0x30, 0x2e, 0x31, 0x0a, 0x74,
- 0x61, 0x67, 0x67, 0x65, 0x72, 0x20, 0x43, 0x20,
- 0x4f, 0x20, 0x4d, 0x69, 0x74, 0x74, 0x65, 0x72,
- 0x20, 0x3c, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74,
- 0x74, 0x65, 0x72, 0x40, 0x65, 0x78, 0x61, 0x6d,
- 0x70, 0x6c, 0x65, 0x2e, 0x63, 0x6f, 0x6d, 0x3e,
- 0x20, 0x31, 0x32, 0x32, 0x37, 0x38, 0x31, 0x34,
- 0x32, 0x39, 0x37, 0x20, 0x2b, 0x30, 0x30, 0x30,
- 0x30, 0x0a, 0x0a, 0x54, 0x68, 0x69, 0x73, 0x20,
- 0x69, 0x73, 0x20, 0x74, 0x68, 0x65, 0x20, 0x74,
- 0x61, 0x67, 0x20, 0x6f, 0x62, 0x6a, 0x65, 0x63,
- 0x74, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x72, 0x65,
- 0x6c, 0x65, 0x61, 0x73, 0x65, 0x20, 0x76, 0x30,
- 0x2e, 0x30, 0x2e, 0x31, 0x0a,
-};
-
-static unsigned char zero_data[] = {
- 0x00 /* dummy data */
-};
-
-static unsigned char one_data[] = {
- 0x0a,
-};
-
-static unsigned char two_data[] = {
- 0x61, 0x0a,
-};
-
-static unsigned char some_data[] = {
- 0x2f, 0x2a, 0x0a, 0x20, 0x2a, 0x20, 0x54, 0x68,
- 0x69, 0x73, 0x20, 0x66, 0x69, 0x6c, 0x65, 0x20,
- 0x69, 0x73, 0x20, 0x66, 0x72, 0x65, 0x65, 0x20,
- 0x73, 0x6f, 0x66, 0x74, 0x77, 0x61, 0x72, 0x65,
- 0x3b, 0x20, 0x79, 0x6f, 0x75, 0x20, 0x63, 0x61,
- 0x6e, 0x20, 0x72, 0x65, 0x64, 0x69, 0x73, 0x74,
- 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x20, 0x69,
- 0x74, 0x20, 0x61, 0x6e, 0x64, 0x2f, 0x6f, 0x72,
- 0x20, 0x6d, 0x6f, 0x64, 0x69, 0x66, 0x79, 0x0a,
- 0x20, 0x2a, 0x20, 0x69, 0x74, 0x20, 0x75, 0x6e,
- 0x64, 0x65, 0x72, 0x20, 0x74, 0x68, 0x65, 0x20,
- 0x74, 0x65, 0x72, 0x6d, 0x73, 0x20, 0x6f, 0x66,
- 0x20, 0x74, 0x68, 0x65, 0x20, 0x47, 0x4e, 0x55,
- 0x20, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x6c,
- 0x20, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x20,
- 0x4c, 0x69, 0x63, 0x65, 0x6e, 0x73, 0x65, 0x2c,
- 0x20, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e,
- 0x20, 0x32, 0x2c, 0x0a, 0x20, 0x2a, 0x20, 0x61,
- 0x73, 0x20, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x73,
- 0x68, 0x65, 0x64, 0x20, 0x62, 0x79, 0x20, 0x74,
- 0x68, 0x65, 0x20, 0x46, 0x72, 0x65, 0x65, 0x20,
- 0x53, 0x6f, 0x66, 0x74, 0x77, 0x61, 0x72, 0x65,
- 0x20, 0x46, 0x6f, 0x75, 0x6e, 0x64, 0x61, 0x74,
- 0x69, 0x6f, 0x6e, 0x2e, 0x0a, 0x20, 0x2a, 0x0a,
- 0x20, 0x2a, 0x20, 0x49, 0x6e, 0x20, 0x61, 0x64,
- 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x74,
- 0x6f, 0x20, 0x74, 0x68, 0x65, 0x20, 0x70, 0x65,
- 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e,
- 0x73, 0x20, 0x69, 0x6e, 0x20, 0x74, 0x68, 0x65,
- 0x20, 0x47, 0x4e, 0x55, 0x20, 0x47, 0x65, 0x6e,
- 0x65, 0x72, 0x61, 0x6c, 0x20, 0x50, 0x75, 0x62,
- 0x6c, 0x69, 0x63, 0x20, 0x4c, 0x69, 0x63, 0x65,
- 0x6e, 0x73, 0x65, 0x2c, 0x0a, 0x20, 0x2a, 0x20,
- 0x74, 0x68, 0x65, 0x20, 0x61, 0x75, 0x74, 0x68,
- 0x6f, 0x72, 0x73, 0x20, 0x67, 0x69, 0x76, 0x65,
- 0x20, 0x79, 0x6f, 0x75, 0x20, 0x75, 0x6e, 0x6c,
- 0x69, 0x6d, 0x69, 0x74, 0x65, 0x64, 0x20, 0x70,
- 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f,
- 0x6e, 0x20, 0x74, 0x6f, 0x20, 0x6c, 0x69, 0x6e,
- 0x6b, 0x20, 0x74, 0x68, 0x65, 0x20, 0x63, 0x6f,
- 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x64, 0x0a, 0x20,
- 0x2a, 0x20, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f,
- 0x6e, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, 0x69,
- 0x73, 0x20, 0x66, 0x69, 0x6c, 0x65, 0x20, 0x69,
- 0x6e, 0x74, 0x6f, 0x20, 0x63, 0x6f, 0x6d, 0x62,
- 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73,
- 0x20, 0x77, 0x69, 0x74, 0x68, 0x20, 0x6f, 0x74,
- 0x68, 0x65, 0x72, 0x20, 0x70, 0x72, 0x6f, 0x67,
- 0x72, 0x61, 0x6d, 0x73, 0x2c, 0x0a, 0x20, 0x2a,
- 0x20, 0x61, 0x6e, 0x64, 0x20, 0x74, 0x6f, 0x20,
- 0x64, 0x69, 0x73, 0x74, 0x72, 0x69, 0x62, 0x75,
- 0x74, 0x65, 0x20, 0x74, 0x68, 0x6f, 0x73, 0x65,
- 0x20, 0x63, 0x6f, 0x6d, 0x62, 0x69, 0x6e, 0x61,
- 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x77, 0x69,
- 0x74, 0x68, 0x6f, 0x75, 0x74, 0x20, 0x61, 0x6e,
- 0x79, 0x20, 0x72, 0x65, 0x73, 0x74, 0x72, 0x69,
- 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x0a, 0x20, 0x2a,
- 0x20, 0x63, 0x6f, 0x6d, 0x69, 0x6e, 0x67, 0x20,
- 0x66, 0x72, 0x6f, 0x6d, 0x20, 0x74, 0x68, 0x65,
- 0x20, 0x75, 0x73, 0x65, 0x20, 0x6f, 0x66, 0x20,
- 0x74, 0x68, 0x69, 0x73, 0x20, 0x66, 0x69, 0x6c,
- 0x65, 0x2e, 0x20, 0x20, 0x28, 0x54, 0x68, 0x65,
- 0x20, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x6c,
- 0x20, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x20,
- 0x4c, 0x69, 0x63, 0x65, 0x6e, 0x73, 0x65, 0x0a,
- 0x20, 0x2a, 0x20, 0x72, 0x65, 0x73, 0x74, 0x72,
- 0x69, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20,
- 0x64, 0x6f, 0x20, 0x61, 0x70, 0x70, 0x6c, 0x79,
- 0x20, 0x69, 0x6e, 0x20, 0x6f, 0x74, 0x68, 0x65,
- 0x72, 0x20, 0x72, 0x65, 0x73, 0x70, 0x65, 0x63,
- 0x74, 0x73, 0x3b, 0x20, 0x66, 0x6f, 0x72, 0x20,
- 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2c,
- 0x20, 0x74, 0x68, 0x65, 0x79, 0x20, 0x63, 0x6f,
- 0x76, 0x65, 0x72, 0x0a, 0x20, 0x2a, 0x20, 0x6d,
- 0x6f, 0x64, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74,
- 0x69, 0x6f, 0x6e, 0x20, 0x6f, 0x66, 0x20, 0x74,
- 0x68, 0x65, 0x20, 0x66, 0x69, 0x6c, 0x65, 0x2c,
- 0x20, 0x61, 0x6e, 0x64, 0x20, 0x64, 0x69, 0x73,
- 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x69, 0x6f,
- 0x6e, 0x20, 0x77, 0x68, 0x65, 0x6e, 0x20, 0x6e,
- 0x6f, 0x74, 0x20, 0x6c, 0x69, 0x6e, 0x6b, 0x65,
- 0x64, 0x20, 0x69, 0x6e, 0x74, 0x6f, 0x0a, 0x20,
- 0x2a, 0x20, 0x61, 0x20, 0x63, 0x6f, 0x6d, 0x62,
- 0x69, 0x6e, 0x65, 0x64, 0x20, 0x65, 0x78, 0x65,
- 0x63, 0x75, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x2e,
- 0x29, 0x0a, 0x20, 0x2a, 0x0a, 0x20, 0x2a, 0x20,
- 0x54, 0x68, 0x69, 0x73, 0x20, 0x66, 0x69, 0x6c,
- 0x65, 0x20, 0x69, 0x73, 0x20, 0x64, 0x69, 0x73,
- 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x64,
- 0x20, 0x69, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20,
- 0x68, 0x6f, 0x70, 0x65, 0x20, 0x74, 0x68, 0x61,
- 0x74, 0x20, 0x69, 0x74, 0x20, 0x77, 0x69, 0x6c,
- 0x6c, 0x20, 0x62, 0x65, 0x20, 0x75, 0x73, 0x65,
- 0x66, 0x75, 0x6c, 0x2c, 0x20, 0x62, 0x75, 0x74,
- 0x0a, 0x20, 0x2a, 0x20, 0x57, 0x49, 0x54, 0x48,
- 0x4f, 0x55, 0x54, 0x20, 0x41, 0x4e, 0x59, 0x20,
- 0x57, 0x41, 0x52, 0x52, 0x41, 0x4e, 0x54, 0x59,
- 0x3b, 0x20, 0x77, 0x69, 0x74, 0x68, 0x6f, 0x75,
- 0x74, 0x20, 0x65, 0x76, 0x65, 0x6e, 0x20, 0x74,
- 0x68, 0x65, 0x20, 0x69, 0x6d, 0x70, 0x6c, 0x69,
- 0x65, 0x64, 0x20, 0x77, 0x61, 0x72, 0x72, 0x61,
- 0x6e, 0x74, 0x79, 0x20, 0x6f, 0x66, 0x0a, 0x20,
- 0x2a, 0x20, 0x4d, 0x45, 0x52, 0x43, 0x48, 0x41,
- 0x4e, 0x54, 0x41, 0x42, 0x49, 0x4c, 0x49, 0x54,
- 0x59, 0x20, 0x6f, 0x72, 0x20, 0x46, 0x49, 0x54,
- 0x4e, 0x45, 0x53, 0x53, 0x20, 0x46, 0x4f, 0x52,
- 0x20, 0x41, 0x20, 0x50, 0x41, 0x52, 0x54, 0x49,
- 0x43, 0x55, 0x4c, 0x41, 0x52, 0x20, 0x50, 0x55,
- 0x52, 0x50, 0x4f, 0x53, 0x45, 0x2e, 0x20, 0x20,
- 0x53, 0x65, 0x65, 0x20, 0x74, 0x68, 0x65, 0x20,
- 0x47, 0x4e, 0x55, 0x0a, 0x20, 0x2a, 0x20, 0x47,
- 0x65, 0x6e, 0x65, 0x72, 0x61, 0x6c, 0x20, 0x50,
- 0x75, 0x62, 0x6c, 0x69, 0x63, 0x20, 0x4c, 0x69,
- 0x63, 0x65, 0x6e, 0x73, 0x65, 0x20, 0x66, 0x6f,
- 0x72, 0x20, 0x6d, 0x6f, 0x72, 0x65, 0x20, 0x64,
- 0x65, 0x74, 0x61, 0x69, 0x6c, 0x73, 0x2e, 0x0a,
- 0x20, 0x2a, 0x0a, 0x20, 0x2a, 0x20, 0x59, 0x6f,
- 0x75, 0x20, 0x73, 0x68, 0x6f, 0x75, 0x6c, 0x64,
- 0x20, 0x68, 0x61, 0x76, 0x65, 0x20, 0x72, 0x65,
- 0x63, 0x65, 0x69, 0x76, 0x65, 0x64, 0x20, 0x61,
- 0x20, 0x63, 0x6f, 0x70, 0x79, 0x20, 0x6f, 0x66,
- 0x20, 0x74, 0x68, 0x65, 0x20, 0x47, 0x4e, 0x55,
- 0x20, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x6c,
- 0x20, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x20,
- 0x4c, 0x69, 0x63, 0x65, 0x6e, 0x73, 0x65, 0x0a,
- 0x20, 0x2a, 0x20, 0x61, 0x6c, 0x6f, 0x6e, 0x67,
- 0x20, 0x77, 0x69, 0x74, 0x68, 0x20, 0x74, 0x68,
- 0x69, 0x73, 0x20, 0x70, 0x72, 0x6f, 0x67, 0x72,
- 0x61, 0x6d, 0x3b, 0x20, 0x73, 0x65, 0x65, 0x20,
- 0x74, 0x68, 0x65, 0x20, 0x66, 0x69, 0x6c, 0x65,
- 0x20, 0x43, 0x4f, 0x50, 0x59, 0x49, 0x4e, 0x47,
- 0x2e, 0x20, 0x20, 0x49, 0x66, 0x20, 0x6e, 0x6f,
- 0x74, 0x2c, 0x20, 0x77, 0x72, 0x69, 0x74, 0x65,
- 0x20, 0x74, 0x6f, 0x0a, 0x20, 0x2a, 0x20, 0x74,
- 0x68, 0x65, 0x20, 0x46, 0x72, 0x65, 0x65, 0x20,
- 0x53, 0x6f, 0x66, 0x74, 0x77, 0x61, 0x72, 0x65,
- 0x20, 0x46, 0x6f, 0x75, 0x6e, 0x64, 0x61, 0x74,
- 0x69, 0x6f, 0x6e, 0x2c, 0x20, 0x35, 0x31, 0x20,
- 0x46, 0x72, 0x61, 0x6e, 0x6b, 0x6c, 0x69, 0x6e,
- 0x20, 0x53, 0x74, 0x72, 0x65, 0x65, 0x74, 0x2c,
- 0x20, 0x46, 0x69, 0x66, 0x74, 0x68, 0x20, 0x46,
- 0x6c, 0x6f, 0x6f, 0x72, 0x2c, 0x0a, 0x20, 0x2a,
- 0x20, 0x42, 0x6f, 0x73, 0x74, 0x6f, 0x6e, 0x2c,
- 0x20, 0x4d, 0x41, 0x20, 0x30, 0x32, 0x31, 0x31,
- 0x30, 0x2d, 0x31, 0x33, 0x30, 0x31, 0x2c, 0x20,
- 0x55, 0x53, 0x41, 0x2e, 0x0a, 0x20, 0x2a, 0x2f,
- 0x0a,
-};
-
-/*
- * Sha1 IDS
- */
-static char *commit_id = "3d7f8a6af076c8c3f20071a8935cdbe8228594d1";
-static char *tree_id = "dff2da90b254e1beb889d1f1f1288be1803782df";
-static char *tag_id = "09d373e1dfdc16b129ceec6dd649739911541e05";
-static char *zero_id = "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391";
-static char *one_id = "8b137891791fe96927ad78e64b0aad7bded08bdc";
-static char *two_id = "78981922613b2afb6025042ff6bd878ac1994e85";
-static char *some_id = "fd8430bc864cfcd5f10e5590f8a447e01b942bfe";
-
-/*
- * In memory objects
- */
-static git_rawobj tree_obj = {
- tree_data,
- sizeof(tree_data),
- GIT_OBJ_TREE
-};
-
-static git_rawobj tag_obj = {
- tag_data,
- sizeof(tag_data),
- GIT_OBJ_TAG
-};
-
-static git_rawobj zero_obj = {
- zero_data,
- 0,
- GIT_OBJ_BLOB
-};
-
-static git_rawobj one_obj = {
- one_data,
- sizeof(one_data),
- GIT_OBJ_BLOB
-};
-
-static git_rawobj two_obj = {
- two_data,
- sizeof(two_data),
- GIT_OBJ_BLOB
-};
-
-static git_rawobj commit_obj = {
- commit_data,
- sizeof(commit_data),
- GIT_OBJ_COMMIT
-};
-
-static git_rawobj some_obj = {
- some_data,
- sizeof(some_data),
- GIT_OBJ_BLOB
-};
-
-static git_rawobj junk_obj = {
- NULL,
- 0,
- GIT_OBJ_BAD
-};
-
-
diff --git a/tests/t01-rawobj.c b/tests/t01-rawobj.c
deleted file mode 100644
index 3cb00c2..0000000
--- a/tests/t01-rawobj.c
+++ /dev/null
@@ -1,627 +0,0 @@
-/*
- * This file is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License, version 2,
- * as published by the Free Software Foundation.
- *
- * In addition to the permissions in the GNU General Public License,
- * the authors give you unlimited permission to link the compiled
- * version of this file into combinations with other programs,
- * and to distribute those combinations without any restriction
- * coming from the use of this file. (The General Public License
- * restrictions do apply in other respects; for example, they cover
- * modification of the file, and distribution when not linked into
- * a combined executable.)
- *
- * This file is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; see the file COPYING. If not, write to
- * the Free Software Foundation, 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-#include "test_lib.h"
-
-#include "odb.h"
-#include "hash.h"
-
-#include "t01-data.h"
-
-static int hash_object(git_oid *oid, git_rawobj *obj)
-{
- return git_odb_hash(oid, obj->data, obj->len, obj->type);
-}
-
-BEGIN_TEST(oid0, "validate size of oid objects")
- git_oid out;
- must_be_true(20 == GIT_OID_RAWSZ);
- must_be_true(40 == GIT_OID_HEXSZ);
- must_be_true(sizeof(out) == GIT_OID_RAWSZ);
- must_be_true(sizeof(out.id) == GIT_OID_RAWSZ);
-END_TEST
-
-BEGIN_TEST(oid1, "fail when parsing an empty string as oid")
- git_oid out;
- must_fail(git_oid_fromstr(&out, ""));
-END_TEST
-
-BEGIN_TEST(oid2, "fail when parsing an invalid string as oid")
- git_oid out;
- must_fail(git_oid_fromstr(&out, "moo"));
-END_TEST
-
-BEGIN_TEST(oid3, "find all invalid characters when parsing an oid")
- git_oid out;
- unsigned char exp[] = {
- 0x16, 0xa6, 0x77, 0x70, 0xb7,
- 0xd8, 0xd7, 0x23, 0x17, 0xc4,
- 0xb7, 0x75, 0x21, 0x3c, 0x23,
- 0xa8, 0xbd, 0x74, 0xf5, 0xe0,
- };
- char in[41] = "16a67770b7d8d72317c4b775213c23a8bd74f5e0";
- unsigned int i;
-
- for (i = 0; i < 256; i++) {
- in[38] = (char)i;
-
- if (git__fromhex(i) >= 0) {
- exp[19] = (unsigned char)(git__fromhex(i) << 4);
- must_pass(git_oid_fromstr(&out, in));
- must_be_true(memcmp(out.id, exp, sizeof(out.id)) == 0);
- } else {
- must_fail(git_oid_fromstr(&out, in));
- }
- }
-END_TEST
-
-BEGIN_TEST(oid4, "fail when parsing an invalid oid string")
- git_oid out;
- must_fail(git_oid_fromstr(&out, "16a67770b7d8d72317c4b775213c23a8bd74f5ez"));
-END_TEST
-
-BEGIN_TEST(oid5, "succeed when parsing a valid oid string")
- git_oid out;
- unsigned char exp[] = {
- 0x16, 0xa6, 0x77, 0x70, 0xb7,
- 0xd8, 0xd7, 0x23, 0x17, 0xc4,
- 0xb7, 0x75, 0x21, 0x3c, 0x23,
- 0xa8, 0xbd, 0x74, 0xf5, 0xe0,
- };
-
- must_pass(git_oid_fromstr(&out, "16a67770b7d8d72317c4b775213c23a8bd74f5e0"));
- must_pass(memcmp(out.id, exp, sizeof(out.id)));
-
- must_pass(git_oid_fromstr(&out, "16A67770B7D8D72317C4b775213C23A8BD74F5E0"));
- must_pass(memcmp(out.id, exp, sizeof(out.id)));
-END_TEST
-
-BEGIN_TEST(oid6, "build a valid oid from raw bytes")
- git_oid out;
- unsigned char exp[] = {
- 0x16, 0xa6, 0x77, 0x70, 0xb7,
- 0xd8, 0xd7, 0x23, 0x17, 0xc4,
- 0xb7, 0x75, 0x21, 0x3c, 0x23,
- 0xa8, 0xbd, 0x74, 0xf5, 0xe0,
- };
-
- git_oid_fromraw(&out, exp);
- must_pass(memcmp(out.id, exp, sizeof(out.id)));
-END_TEST
-
-BEGIN_TEST(oid7, "properly copy an oid to another")
- git_oid a, b;
- unsigned char exp[] = {
- 0x16, 0xa6, 0x77, 0x70, 0xb7,
- 0xd8, 0xd7, 0x23, 0x17, 0xc4,
- 0xb7, 0x75, 0x21, 0x3c, 0x23,
- 0xa8, 0xbd, 0x74, 0xf5, 0xe0,
- };
-
- memset(&b, 0, sizeof(b));
- git_oid_fromraw(&a, exp);
- git_oid_cpy(&b, &a);
- must_pass(memcmp(a.id, exp, sizeof(a.id)));
-END_TEST
-
-BEGIN_TEST(oid8, "compare two oids (lesser than)")
- git_oid a, b;
- unsigned char a_in[] = {
- 0x16, 0xa6, 0x77, 0x70, 0xb7,
- 0xd8, 0xd7, 0x23, 0x17, 0xc4,
- 0xb7, 0x75, 0x21, 0x3c, 0x23,
- 0xa8, 0xbd, 0x74, 0xf5, 0xe0,
- };
- unsigned char b_in[] = {
- 0x16, 0xa6, 0x77, 0x70, 0xb7,
- 0xd8, 0xd7, 0x23, 0x17, 0xc4,
- 0xb7, 0x75, 0x21, 0x3c, 0x23,
- 0xa8, 0xbd, 0x74, 0xf5, 0xf0,
- };
-
- git_oid_fromraw(&a, a_in);
- git_oid_fromraw(&b, b_in);
- must_be_true(git_oid_cmp(&a, &b) < 0);
-END_TEST
-
-BEGIN_TEST(oid9, "compare two oids (equal)")
- git_oid a, b;
- unsigned char a_in[] = {
- 0x16, 0xa6, 0x77, 0x70, 0xb7,
- 0xd8, 0xd7, 0x23, 0x17, 0xc4,
- 0xb7, 0x75, 0x21, 0x3c, 0x23,
- 0xa8, 0xbd, 0x74, 0xf5, 0xe0,
- };
-
- git_oid_fromraw(&a, a_in);
- git_oid_fromraw(&b, a_in);
- must_be_true(git_oid_cmp(&a, &b) == 0);
-END_TEST
-
-BEGIN_TEST(oid10, "compare two oids (greater than)")
- git_oid a, b;
- unsigned char a_in[] = {
- 0x16, 0xa6, 0x77, 0x70, 0xb7,
- 0xd8, 0xd7, 0x23, 0x17, 0xc4,
- 0xb7, 0x75, 0x21, 0x3c, 0x23,
- 0xa8, 0xbd, 0x74, 0xf5, 0xe0,
- };
- unsigned char b_in[] = {
- 0x16, 0xa6, 0x77, 0x70, 0xb7,
- 0xd8, 0xd7, 0x23, 0x17, 0xc4,
- 0xb7, 0x75, 0x21, 0x3c, 0x23,
- 0xa8, 0xbd, 0x74, 0xf5, 0xd0,
- };
-
- git_oid_fromraw(&a, a_in);
- git_oid_fromraw(&b, b_in);
- must_be_true(git_oid_cmp(&a, &b) > 0);
-END_TEST
-
-BEGIN_TEST(oid11, "compare formated oids")
- const char *exp = "16a0123456789abcdef4b775213c23a8bd74f5e0";
- git_oid in;
- char out[GIT_OID_HEXSZ + 1];
-
- must_pass(git_oid_fromstr(&in, exp));
-
- /* Format doesn't touch the last byte */
- out[GIT_OID_HEXSZ] = 'Z';
- git_oid_fmt(out, &in);
- must_be_true(out[GIT_OID_HEXSZ] == 'Z');
-
- /* Format produced the right result */
- out[GIT_OID_HEXSZ] = '\0';
- must_be_true(strcmp(exp, out) == 0);
-END_TEST
-
-BEGIN_TEST(oid12, "compare oids (allocate + format)")
- const char *exp = "16a0123456789abcdef4b775213c23a8bd74f5e0";
- git_oid in;
- char *out;
-
- must_pass(git_oid_fromstr(&in, exp));
-
- out = git_oid_allocfmt(&in);
- must_be_true(out);
- must_be_true(strcmp(exp, out) == 0);
- git__free(out);
-END_TEST
-
-BEGIN_TEST(oid13, "compare oids (path format)")
- const char *exp1 = "16a0123456789abcdef4b775213c23a8bd74f5e0";
- const char *exp2 = "16/a0123456789abcdef4b775213c23a8bd74f5e0";
- git_oid in;
- char out[GIT_OID_HEXSZ + 2];
-
- must_pass(git_oid_fromstr(&in, exp1));
-
- /* Format doesn't touch the last byte */
- out[GIT_OID_HEXSZ + 1] = 'Z';
- git_oid_pathfmt(out, &in);
- must_be_true(out[GIT_OID_HEXSZ + 1] == 'Z');
-
- /* Format produced the right result */
- out[GIT_OID_HEXSZ + 1] = '\0';
- must_be_true(strcmp(exp2, out) == 0);
-END_TEST
-
-BEGIN_TEST(oid14, "convert raw oid to string")
- const char *exp = "16a0123456789abcdef4b775213c23a8bd74f5e0";
- git_oid in;
- char out[GIT_OID_HEXSZ + 1];
- char *str;
- int i;
-
- must_pass(git_oid_fromstr(&in, exp));
-
- /* NULL buffer pointer, returns static empty string */
- str = git_oid_tostr(NULL, sizeof(out), &in);
- must_be_true(str && *str == '\0' && str != out);
-
- /* zero buffer size, returns static empty string */
- str = git_oid_tostr(out, 0, &in);
- must_be_true(str && *str == '\0' && str != out);
-
- /* NULL oid pointer, returns static empty string */
- str = git_oid_tostr(out, sizeof(out), NULL);
- must_be_true(str && *str == '\0' && str != out);
-
- /* n == 1, returns out as an empty string */
- str = git_oid_tostr(out, 1, &in);
- must_be_true(str && *str == '\0' && str == out);
-
- for (i = 1; i < GIT_OID_HEXSZ; i++) {
- out[i+1] = 'Z';
- str = git_oid_tostr(out, i+1, &in);
- /* returns out containing c-string */
- must_be_true(str && str == out);
- /* must be '\0' terminated */
- must_be_true(*(str+i) == '\0');
- /* must not touch bytes past end of string */
- must_be_true(*(str+(i+1)) == 'Z');
- /* i == n-1 charaters of string */
- must_pass(strncmp(exp, out, i));
- }
-
- /* returns out as hex formatted c-string */
- str = git_oid_tostr(out, sizeof(out), &in);
- must_be_true(str && str == out && *(str+GIT_OID_HEXSZ) == '\0');
- must_be_true(strcmp(exp, out) == 0);
-END_TEST
-
-BEGIN_TEST(oid15, "convert raw oid to string (big)")
- const char *exp = "16a0123456789abcdef4b775213c23a8bd74f5e0";
- git_oid in;
- char big[GIT_OID_HEXSZ + 1 + 3]; /* note + 4 => big buffer */
- char *str;
-
- must_pass(git_oid_fromstr(&in, exp));
-
- /* place some tail material */
- big[GIT_OID_HEXSZ+0] = 'W'; /* should be '\0' afterwards */
- big[GIT_OID_HEXSZ+1] = 'X'; /* should remain untouched */
- big[GIT_OID_HEXSZ+2] = 'Y'; /* ditto */
- big[GIT_OID_HEXSZ+3] = 'Z'; /* ditto */
-
- /* returns big as hex formatted c-string */
- str = git_oid_tostr(big, sizeof(big), &in);
- must_be_true(str && str == big && *(str+GIT_OID_HEXSZ) == '\0');
- must_be_true(strcmp(exp, big) == 0);
-
- /* check tail material is untouched */
- must_be_true(str && str == big && *(str+GIT_OID_HEXSZ+1) == 'X');
- must_be_true(str && str == big && *(str+GIT_OID_HEXSZ+2) == 'Y');
- must_be_true(str && str == big && *(str+GIT_OID_HEXSZ+3) == 'Z');
-END_TEST
-
-
-BEGIN_TEST(oid16, "make sure the OID shortener doesn't choke on duplicate sha1s")
-
- git_oid_shorten *os;
- int min_len;
-
- os = git_oid_shorten_new(0);
- must_be_true(os != NULL);
-
- git_oid_shorten_add(os, "22596363b3de40b06f981fb85d82312e8c0ed511");
- git_oid_shorten_add(os, "ce08fe4884650f067bd5703b6a59a8b3b3c99a09");
- git_oid_shorten_add(os, "16a0123456789abcdef4b775213c23a8bd74f5e0");
- min_len = git_oid_shorten_add(os, "ce08fe4884650f067bd5703b6a59a8b3b3c99a09");
-
- must_be_true(min_len == GIT_OID_HEXSZ + 1);
-
- git_oid_shorten_free(os);
-END_TEST
-
-BEGIN_TEST(oid17, "stress test for the git_oid_shorten object")
-
-#define MAX_OIDS 1000
-
- git_oid_shorten *os;
- char *oids[MAX_OIDS];
- char number_buffer[16];
- git_oid oid;
- size_t i, j;
-
- int min_len = 0, found_collision;
-
- os = git_oid_shorten_new(0);
- must_be_true(os != NULL);
-
- /*
- * Insert in the shortener 1000 unique SHA1 ids
- */
- for (i = 0; i < MAX_OIDS; ++i) {
- char *oid_text;
-
- sprintf(number_buffer, "%u", (unsigned int)i);
- git_hash_buf(&oid, number_buffer, strlen(number_buffer));
-
- oid_text = git__malloc(GIT_OID_HEXSZ + 1);
- git_oid_fmt(oid_text, &oid);
- oid_text[GIT_OID_HEXSZ] = 0;
-
- min_len = git_oid_shorten_add(os, oid_text);
- must_be_true(min_len >= 0);
-
- oids[i] = oid_text;
- }
-
- /*
- * Compare the first `min_char - 1` characters of each
- * SHA1 OID. If the minimizer worked, we should find at
- * least one collision
- */
- found_collision = 0;
- for (i = 0; i < MAX_OIDS; ++i) {
- for (j = 0; j < MAX_OIDS; ++j) {
- if (i != j && memcmp(oids[i], oids[j], min_len - 1) == 0)
- found_collision = 1;
- }
- }
- must_be_true(found_collision == 1);
-
- /*
- * Compare the first `min_char` characters of each
- * SHA1 OID. If the minimizer worked, every single preffix
- * should be unique.
- */
- found_collision = 0;
- for (i = 0; i < MAX_OIDS; ++i) {
- for (j = 0; j < MAX_OIDS; ++j) {
- if (i != j && memcmp(oids[i], oids[j], min_len) == 0)
- found_collision = 1;
- }
- }
- must_be_true(found_collision == 0);
-
- /* cleanup */
- for (i = 0; i < MAX_OIDS; ++i)
- git__free(oids[i]);
-
- git_oid_shorten_free(os);
-
-#undef MAX_OIDS
-END_TEST
-
-static char *hello_id = "22596363b3de40b06f981fb85d82312e8c0ed511";
-static char *hello_text = "hello world\n";
-
-static char *bye_id = "ce08fe4884650f067bd5703b6a59a8b3b3c99a09";
-static char *bye_text = "bye world\n";
-
-BEGIN_TEST(hash0, "normal hash by blocks")
- git_hash_ctx *ctx;
- git_oid id1, id2;
-
- must_be_true((ctx = git_hash_new_ctx()) != NULL);
-
- /* should already be init'd */
- git_hash_update(ctx, hello_text, strlen(hello_text));
- git_hash_final(&id2, ctx);
- must_pass(git_oid_fromstr(&id1, hello_id));
- must_be_true(git_oid_cmp(&id1, &id2) == 0);
-
- /* reinit should permit reuse */
- git_hash_init(ctx);
- git_hash_update(ctx, bye_text, strlen(bye_text));
- git_hash_final(&id2, ctx);
- must_pass(git_oid_fromstr(&id1, bye_id));
- must_be_true(git_oid_cmp(&id1, &id2) == 0);
-
- git_hash_free_ctx(ctx);
-END_TEST
-
-BEGIN_TEST(hash1, "hash whole buffer in a single call")
- git_oid id1, id2;
-
- must_pass(git_oid_fromstr(&id1, hello_id));
-
- git_hash_buf(&id2, hello_text, strlen(hello_text));
-
- must_be_true(git_oid_cmp(&id1, &id2) == 0);
-END_TEST
-
-BEGIN_TEST(hash2, "hash a vector")
- git_oid id1, id2;
- git_buf_vec vec[2];
-
- must_pass(git_oid_fromstr(&id1, hello_id));
-
- vec[0].data = hello_text;
- vec[0].len = 4;
- vec[1].data = hello_text+4;
- vec[1].len = strlen(hello_text)-4;
-
- git_hash_vec(&id2, vec, 2);
-
- must_be_true(git_oid_cmp(&id1, &id2) == 0);
-END_TEST
-
-BEGIN_TEST(objtype0, "convert type to string")
- must_be_true(!strcmp(git_object_type2string(GIT_OBJ_BAD), ""));
- must_be_true(!strcmp(git_object_type2string(GIT_OBJ__EXT1), ""));
- must_be_true(!strcmp(git_object_type2string(GIT_OBJ_COMMIT), "commit"));
- must_be_true(!strcmp(git_object_type2string(GIT_OBJ_TREE), "tree"));
- must_be_true(!strcmp(git_object_type2string(GIT_OBJ_BLOB), "blob"));
- must_be_true(!strcmp(git_object_type2string(GIT_OBJ_TAG), "tag"));
- must_be_true(!strcmp(git_object_type2string(GIT_OBJ__EXT2), ""));
- must_be_true(!strcmp(git_object_type2string(GIT_OBJ_OFS_DELTA), "OFS_DELTA"));
- must_be_true(!strcmp(git_object_type2string(GIT_OBJ_REF_DELTA), "REF_DELTA"));
-
- must_be_true(!strcmp(git_object_type2string(-2), ""));
- must_be_true(!strcmp(git_object_type2string(8), ""));
- must_be_true(!strcmp(git_object_type2string(1234), ""));
-END_TEST
-
-BEGIN_TEST(objtype1, "convert string to type")
- must_be_true(git_object_string2type(NULL) == GIT_OBJ_BAD);
- must_be_true(git_object_string2type("") == GIT_OBJ_BAD);
- must_be_true(git_object_string2type("commit") == GIT_OBJ_COMMIT);
- must_be_true(git_object_string2type("tree") == GIT_OBJ_TREE);
- must_be_true(git_object_string2type("blob") == GIT_OBJ_BLOB);
- must_be_true(git_object_string2type("tag") == GIT_OBJ_TAG);
- must_be_true(git_object_string2type("OFS_DELTA") == GIT_OBJ_OFS_DELTA);
- must_be_true(git_object_string2type("REF_DELTA") == GIT_OBJ_REF_DELTA);
-
- must_be_true(git_object_string2type("CoMmIt") == GIT_OBJ_BAD);
- must_be_true(git_object_string2type("hohoho") == GIT_OBJ_BAD);
-END_TEST
-
-BEGIN_TEST(objtype2, "check if an object type is loose")
- must_be_true(git_object_typeisloose(GIT_OBJ_BAD) == 0);
- must_be_true(git_object_typeisloose(GIT_OBJ__EXT1) == 0);
- must_be_true(git_object_typeisloose(GIT_OBJ_COMMIT) == 1);
- must_be_true(git_object_typeisloose(GIT_OBJ_TREE) == 1);
- must_be_true(git_object_typeisloose(GIT_OBJ_BLOB) == 1);
- must_be_true(git_object_typeisloose(GIT_OBJ_TAG) == 1);
- must_be_true(git_object_typeisloose(GIT_OBJ__EXT2) == 0);
- must_be_true(git_object_typeisloose(GIT_OBJ_OFS_DELTA) == 0);
- must_be_true(git_object_typeisloose(GIT_OBJ_REF_DELTA) == 0);
-
- must_be_true(git_object_typeisloose(-2) == 0);
- must_be_true(git_object_typeisloose(8) == 0);
- must_be_true(git_object_typeisloose(1234) == 0);
-END_TEST
-
-BEGIN_TEST(objhash0, "hash junk data")
- git_oid id, id_zero;
-
- must_pass(git_oid_fromstr(&id_zero, zero_id));
-
- /* invalid types: */
- junk_obj.data = some_data;
- must_fail(hash_object(&id, &junk_obj));
-
- junk_obj.type = GIT_OBJ__EXT1;
- must_fail(hash_object(&id, &junk_obj));
-
- junk_obj.type = GIT_OBJ__EXT2;
- must_fail(hash_object(&id, &junk_obj));
-
- junk_obj.type = GIT_OBJ_OFS_DELTA;
- must_fail(hash_object(&id, &junk_obj));
-
- junk_obj.type = GIT_OBJ_REF_DELTA;
- must_fail(hash_object(&id, &junk_obj));
-
- /* data can be NULL only if len is zero: */
- junk_obj.type = GIT_OBJ_BLOB;
- junk_obj.data = NULL;
- must_pass(hash_object(&id, &junk_obj));
- must_be_true(git_oid_cmp(&id, &id_zero) == 0);
-
- junk_obj.len = 1;
- must_fail(hash_object(&id, &junk_obj));
-END_TEST
-
-BEGIN_TEST(objhash1, "hash a commit object")
- git_oid id1, id2;
-
- must_pass(git_oid_fromstr(&id1, commit_id));
-
- must_pass(hash_object(&id2, &commit_obj));
-
- must_be_true(git_oid_cmp(&id1, &id2) == 0);
-END_TEST
-
-BEGIN_TEST(objhash2, "hash a tree object")
- git_oid id1, id2;
-
- must_pass(git_oid_fromstr(&id1, tree_id));
-
- must_pass(hash_object(&id2, &tree_obj));
-
- must_be_true(git_oid_cmp(&id1, &id2) == 0);
-END_TEST
-
-BEGIN_TEST(objhash3, "hash a tag object")
- git_oid id1, id2;
-
- must_pass(git_oid_fromstr(&id1, tag_id));
-
- must_pass(hash_object(&id2, &tag_obj));
-
- must_be_true(git_oid_cmp(&id1, &id2) == 0);
-END_TEST
-
-BEGIN_TEST(objhash4, "hash a zero-length object")
- git_oid id1, id2;
-
- must_pass(git_oid_fromstr(&id1, zero_id));
-
- must_pass(hash_object(&id2, &zero_obj));
-
- must_be_true(git_oid_cmp(&id1, &id2) == 0);
-END_TEST
-
-BEGIN_TEST(objhash5, "hash an one-byte long object")
- git_oid id1, id2;
-
- must_pass(git_oid_fromstr(&id1, one_id));
-
- must_pass(hash_object(&id2, &one_obj));
-
- must_be_true(git_oid_cmp(&id1, &id2) == 0);
-END_TEST
-
-BEGIN_TEST(objhash6, "hash a two-byte long object")
- git_oid id1, id2;
-
- must_pass(git_oid_fromstr(&id1, two_id));
-
- must_pass(hash_object(&id2, &two_obj));
-
- must_be_true(git_oid_cmp(&id1, &id2) == 0);
-END_TEST
-
-BEGIN_TEST(objhash7, "hash an object several bytes long")
- git_oid id1, id2;
-
- must_pass(git_oid_fromstr(&id1, some_id));
-
- must_pass(hash_object(&id2, &some_obj));
-
- must_be_true(git_oid_cmp(&id1, &id2) == 0);
-END_TEST
-
-BEGIN_SUITE(rawobjects)
- ADD_TEST(oid0);
- ADD_TEST(oid1);
- ADD_TEST(oid2);
- ADD_TEST(oid3);
- ADD_TEST(oid4);
- ADD_TEST(oid5);
- ADD_TEST(oid6);
- ADD_TEST(oid7);
- ADD_TEST(oid8);
- ADD_TEST(oid9);
- ADD_TEST(oid10);
- ADD_TEST(oid11);
- ADD_TEST(oid12);
- ADD_TEST(oid13);
- ADD_TEST(oid14);
- ADD_TEST(oid15);
- ADD_TEST(oid16);
- ADD_TEST(oid17);
-
- ADD_TEST(hash0);
- ADD_TEST(hash1);
- ADD_TEST(hash2);
-
- ADD_TEST(objtype0);
- ADD_TEST(objtype1);
- ADD_TEST(objtype2);
-
- ADD_TEST(objhash0);
- ADD_TEST(objhash1);
- ADD_TEST(objhash2);
- ADD_TEST(objhash3);
- ADD_TEST(objhash4);
- ADD_TEST(objhash5);
- ADD_TEST(objhash6);
- ADD_TEST(objhash7);
-END_SUITE
-
diff --git a/tests/t03-data.h b/tests/t03-data.h
deleted file mode 100644
index a4b73fe..0000000
--- a/tests/t03-data.h
+++ /dev/null
@@ -1,344 +0,0 @@
-
-typedef struct object_data {
- char *id; /* object id (sha1) */
- char *dir; /* object store (fan-out) directory name */
- char *file; /* object store filename */
-} object_data;
-
-static object_data commit = {
- "3d7f8a6af076c8c3f20071a8935cdbe8228594d1",
- "test-objects/3d",
- "test-objects/3d/7f8a6af076c8c3f20071a8935cdbe8228594d1",
-};
-
-static unsigned char commit_data[] = {
- 0x74, 0x72, 0x65, 0x65, 0x20, 0x64, 0x66, 0x66,
- 0x32, 0x64, 0x61, 0x39, 0x30, 0x62, 0x32, 0x35,
- 0x34, 0x65, 0x31, 0x62, 0x65, 0x62, 0x38, 0x38,
- 0x39, 0x64, 0x31, 0x66, 0x31, 0x66, 0x31, 0x32,
- 0x38, 0x38, 0x62, 0x65, 0x31, 0x38, 0x30, 0x33,
- 0x37, 0x38, 0x32, 0x64, 0x66, 0x0a, 0x61, 0x75,
- 0x74, 0x68, 0x6f, 0x72, 0x20, 0x41, 0x20, 0x55,
- 0x20, 0x54, 0x68, 0x6f, 0x72, 0x20, 0x3c, 0x61,
- 0x75, 0x74, 0x68, 0x6f, 0x72, 0x40, 0x65, 0x78,
- 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2e, 0x63, 0x6f,
- 0x6d, 0x3e, 0x20, 0x31, 0x32, 0x32, 0x37, 0x38,
- 0x31, 0x34, 0x32, 0x39, 0x37, 0x20, 0x2b, 0x30,
- 0x30, 0x30, 0x30, 0x0a, 0x63, 0x6f, 0x6d, 0x6d,
- 0x69, 0x74, 0x74, 0x65, 0x72, 0x20, 0x43, 0x20,
- 0x4f, 0x20, 0x4d, 0x69, 0x74, 0x74, 0x65, 0x72,
- 0x20, 0x3c, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74,
- 0x74, 0x65, 0x72, 0x40, 0x65, 0x78, 0x61, 0x6d,
- 0x70, 0x6c, 0x65, 0x2e, 0x63, 0x6f, 0x6d, 0x3e,
- 0x20, 0x31, 0x32, 0x32, 0x37, 0x38, 0x31, 0x34,
- 0x32, 0x39, 0x37, 0x20, 0x2b, 0x30, 0x30, 0x30,
- 0x30, 0x0a, 0x0a, 0x41, 0x20, 0x6f, 0x6e, 0x65,
- 0x2d, 0x6c, 0x69, 0x6e, 0x65, 0x20, 0x63, 0x6f,
- 0x6d, 0x6d, 0x69, 0x74, 0x20, 0x73, 0x75, 0x6d,
- 0x6d, 0x61, 0x72, 0x79, 0x0a, 0x0a, 0x54, 0x68,
- 0x65, 0x20, 0x62, 0x6f, 0x64, 0x79, 0x20, 0x6f,
- 0x66, 0x20, 0x74, 0x68, 0x65, 0x20, 0x63, 0x6f,
- 0x6d, 0x6d, 0x69, 0x74, 0x20, 0x6d, 0x65, 0x73,
- 0x73, 0x61, 0x67, 0x65, 0x2c, 0x20, 0x63, 0x6f,
- 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x69, 0x6e, 0x67,
- 0x20, 0x66, 0x75, 0x72, 0x74, 0x68, 0x65, 0x72,
- 0x20, 0x65, 0x78, 0x70, 0x6c, 0x61, 0x6e, 0x61,
- 0x74, 0x69, 0x6f, 0x6e, 0x0a, 0x6f, 0x66, 0x20,
- 0x74, 0x68, 0x65, 0x20, 0x70, 0x75, 0x72, 0x70,
- 0x6f, 0x73, 0x65, 0x20, 0x6f, 0x66, 0x20, 0x74,
- 0x68, 0x65, 0x20, 0x63, 0x68, 0x61, 0x6e, 0x67,
- 0x65, 0x73, 0x20, 0x69, 0x6e, 0x74, 0x72, 0x6f,
- 0x64, 0x75, 0x63, 0x65, 0x64, 0x20, 0x62, 0x79,
- 0x20, 0x74, 0x68, 0x65, 0x20, 0x63, 0x6f, 0x6d,
- 0x6d, 0x69, 0x74, 0x2e, 0x0a, 0x0a, 0x53, 0x69,
- 0x67, 0x6e, 0x65, 0x64, 0x2d, 0x6f, 0x66, 0x2d,
- 0x62, 0x79, 0x3a, 0x20, 0x41, 0x20, 0x55, 0x20,
- 0x54, 0x68, 0x6f, 0x72, 0x20, 0x3c, 0x61, 0x75,
- 0x74, 0x68, 0x6f, 0x72, 0x40, 0x65, 0x78, 0x61,
- 0x6d, 0x70, 0x6c, 0x65, 0x2e, 0x63, 0x6f, 0x6d,
- 0x3e, 0x0a,
-};
-
-static git_rawobj commit_obj = {
- commit_data,
- sizeof(commit_data),
- GIT_OBJ_COMMIT
-};
-
-static object_data tree = {
- "dff2da90b254e1beb889d1f1f1288be1803782df",
- "test-objects/df",
- "test-objects/df/f2da90b254e1beb889d1f1f1288be1803782df",
-};
-
-static unsigned char tree_data[] = {
- 0x31, 0x30, 0x30, 0x36, 0x34, 0x34, 0x20, 0x6f,
- 0x6e, 0x65, 0x00, 0x8b, 0x13, 0x78, 0x91, 0x79,
- 0x1f, 0xe9, 0x69, 0x27, 0xad, 0x78, 0xe6, 0x4b,
- 0x0a, 0xad, 0x7b, 0xde, 0xd0, 0x8b, 0xdc, 0x31,
- 0x30, 0x30, 0x36, 0x34, 0x34, 0x20, 0x73, 0x6f,
- 0x6d, 0x65, 0x00, 0xfd, 0x84, 0x30, 0xbc, 0x86,
- 0x4c, 0xfc, 0xd5, 0xf1, 0x0e, 0x55, 0x90, 0xf8,
- 0xa4, 0x47, 0xe0, 0x1b, 0x94, 0x2b, 0xfe, 0x31,
- 0x30, 0x30, 0x36, 0x34, 0x34, 0x20, 0x74, 0x77,
- 0x6f, 0x00, 0x78, 0x98, 0x19, 0x22, 0x61, 0x3b,
- 0x2a, 0xfb, 0x60, 0x25, 0x04, 0x2f, 0xf6, 0xbd,
- 0x87, 0x8a, 0xc1, 0x99, 0x4e, 0x85, 0x31, 0x30,
- 0x30, 0x36, 0x34, 0x34, 0x20, 0x7a, 0x65, 0x72,
- 0x6f, 0x00, 0xe6, 0x9d, 0xe2, 0x9b, 0xb2, 0xd1,
- 0xd6, 0x43, 0x4b, 0x8b, 0x29, 0xae, 0x77, 0x5a,
- 0xd8, 0xc2, 0xe4, 0x8c, 0x53, 0x91,
-};
-
-static git_rawobj tree_obj = {
- tree_data,
- sizeof(tree_data),
- GIT_OBJ_TREE
-};
-
-static object_data tag = {
- "09d373e1dfdc16b129ceec6dd649739911541e05",
- "test-objects/09",
- "test-objects/09/d373e1dfdc16b129ceec6dd649739911541e05",
-};
-
-static unsigned char tag_data[] = {
- 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x20, 0x33,
- 0x64, 0x37, 0x66, 0x38, 0x61, 0x36, 0x61, 0x66,
- 0x30, 0x37, 0x36, 0x63, 0x38, 0x63, 0x33, 0x66,
- 0x32, 0x30, 0x30, 0x37, 0x31, 0x61, 0x38, 0x39,
- 0x33, 0x35, 0x63, 0x64, 0x62, 0x65, 0x38, 0x32,
- 0x32, 0x38, 0x35, 0x39, 0x34, 0x64, 0x31, 0x0a,
- 0x74, 0x79, 0x70, 0x65, 0x20, 0x63, 0x6f, 0x6d,
- 0x6d, 0x69, 0x74, 0x0a, 0x74, 0x61, 0x67, 0x20,
- 0x76, 0x30, 0x2e, 0x30, 0x2e, 0x31, 0x0a, 0x74,
- 0x61, 0x67, 0x67, 0x65, 0x72, 0x20, 0x43, 0x20,
- 0x4f, 0x20, 0x4d, 0x69, 0x74, 0x74, 0x65, 0x72,
- 0x20, 0x3c, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74,
- 0x74, 0x65, 0x72, 0x40, 0x65, 0x78, 0x61, 0x6d,
- 0x70, 0x6c, 0x65, 0x2e, 0x63, 0x6f, 0x6d, 0x3e,
- 0x20, 0x31, 0x32, 0x32, 0x37, 0x38, 0x31, 0x34,
- 0x32, 0x39, 0x37, 0x20, 0x2b, 0x30, 0x30, 0x30,
- 0x30, 0x0a, 0x0a, 0x54, 0x68, 0x69, 0x73, 0x20,
- 0x69, 0x73, 0x20, 0x74, 0x68, 0x65, 0x20, 0x74,
- 0x61, 0x67, 0x20, 0x6f, 0x62, 0x6a, 0x65, 0x63,
- 0x74, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x72, 0x65,
- 0x6c, 0x65, 0x61, 0x73, 0x65, 0x20, 0x76, 0x30,
- 0x2e, 0x30, 0x2e, 0x31, 0x0a,
-};
-
-static git_rawobj tag_obj = {
- tag_data,
- sizeof(tag_data),
- GIT_OBJ_TAG
-};
-
-static object_data zero = {
- "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391",
- "test-objects/e6",
- "test-objects/e6/9de29bb2d1d6434b8b29ae775ad8c2e48c5391",
-};
-
-static unsigned char zero_data[] = {
- 0x00 /* dummy data */
-};
-
-static git_rawobj zero_obj = {
- zero_data,
- 0,
- GIT_OBJ_BLOB
-};
-
-static object_data one = {
- "8b137891791fe96927ad78e64b0aad7bded08bdc",
- "test-objects/8b",
- "test-objects/8b/137891791fe96927ad78e64b0aad7bded08bdc",
-};
-
-static unsigned char one_data[] = {
- 0x0a,
-};
-
-static git_rawobj one_obj = {
- one_data,
- sizeof(one_data),
- GIT_OBJ_BLOB
-};
-
-static object_data two = {
- "78981922613b2afb6025042ff6bd878ac1994e85",
- "test-objects/78",
- "test-objects/78/981922613b2afb6025042ff6bd878ac1994e85",
-};
-
-static unsigned char two_data[] = {
- 0x61, 0x0a,
-};
-
-static git_rawobj two_obj = {
- two_data,
- sizeof(two_data),
- GIT_OBJ_BLOB
-};
-
-static object_data some = {
- "fd8430bc864cfcd5f10e5590f8a447e01b942bfe",
- "test-objects/fd",
- "test-objects/fd/8430bc864cfcd5f10e5590f8a447e01b942bfe",
-};
-
-static unsigned char some_data[] = {
- 0x2f, 0x2a, 0x0a, 0x20, 0x2a, 0x20, 0x54, 0x68,
- 0x69, 0x73, 0x20, 0x66, 0x69, 0x6c, 0x65, 0x20,
- 0x69, 0x73, 0x20, 0x66, 0x72, 0x65, 0x65, 0x20,
- 0x73, 0x6f, 0x66, 0x74, 0x77, 0x61, 0x72, 0x65,
- 0x3b, 0x20, 0x79, 0x6f, 0x75, 0x20, 0x63, 0x61,
- 0x6e, 0x20, 0x72, 0x65, 0x64, 0x69, 0x73, 0x74,
- 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x20, 0x69,
- 0x74, 0x20, 0x61, 0x6e, 0x64, 0x2f, 0x6f, 0x72,
- 0x20, 0x6d, 0x6f, 0x64, 0x69, 0x66, 0x79, 0x0a,
- 0x20, 0x2a, 0x20, 0x69, 0x74, 0x20, 0x75, 0x6e,
- 0x64, 0x65, 0x72, 0x20, 0x74, 0x68, 0x65, 0x20,
- 0x74, 0x65, 0x72, 0x6d, 0x73, 0x20, 0x6f, 0x66,
- 0x20, 0x74, 0x68, 0x65, 0x20, 0x47, 0x4e, 0x55,
- 0x20, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x6c,
- 0x20, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x20,
- 0x4c, 0x69, 0x63, 0x65, 0x6e, 0x73, 0x65, 0x2c,
- 0x20, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e,
- 0x20, 0x32, 0x2c, 0x0a, 0x20, 0x2a, 0x20, 0x61,
- 0x73, 0x20, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x73,
- 0x68, 0x65, 0x64, 0x20, 0x62, 0x79, 0x20, 0x74,
- 0x68, 0x65, 0x20, 0x46, 0x72, 0x65, 0x65, 0x20,
- 0x53, 0x6f, 0x66, 0x74, 0x77, 0x61, 0x72, 0x65,
- 0x20, 0x46, 0x6f, 0x75, 0x6e, 0x64, 0x61, 0x74,
- 0x69, 0x6f, 0x6e, 0x2e, 0x0a, 0x20, 0x2a, 0x0a,
- 0x20, 0x2a, 0x20, 0x49, 0x6e, 0x20, 0x61, 0x64,
- 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x74,
- 0x6f, 0x20, 0x74, 0x68, 0x65, 0x20, 0x70, 0x65,
- 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e,
- 0x73, 0x20, 0x69, 0x6e, 0x20, 0x74, 0x68, 0x65,
- 0x20, 0x47, 0x4e, 0x55, 0x20, 0x47, 0x65, 0x6e,
- 0x65, 0x72, 0x61, 0x6c, 0x20, 0x50, 0x75, 0x62,
- 0x6c, 0x69, 0x63, 0x20, 0x4c, 0x69, 0x63, 0x65,
- 0x6e, 0x73, 0x65, 0x2c, 0x0a, 0x20, 0x2a, 0x20,
- 0x74, 0x68, 0x65, 0x20, 0x61, 0x75, 0x74, 0x68,
- 0x6f, 0x72, 0x73, 0x20, 0x67, 0x69, 0x76, 0x65,
- 0x20, 0x79, 0x6f, 0x75, 0x20, 0x75, 0x6e, 0x6c,
- 0x69, 0x6d, 0x69, 0x74, 0x65, 0x64, 0x20, 0x70,
- 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f,
- 0x6e, 0x20, 0x74, 0x6f, 0x20, 0x6c, 0x69, 0x6e,
- 0x6b, 0x20, 0x74, 0x68, 0x65, 0x20, 0x63, 0x6f,
- 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x64, 0x0a, 0x20,
- 0x2a, 0x20, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f,
- 0x6e, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, 0x69,
- 0x73, 0x20, 0x66, 0x69, 0x6c, 0x65, 0x20, 0x69,
- 0x6e, 0x74, 0x6f, 0x20, 0x63, 0x6f, 0x6d, 0x62,
- 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73,
- 0x20, 0x77, 0x69, 0x74, 0x68, 0x20, 0x6f, 0x74,
- 0x68, 0x65, 0x72, 0x20, 0x70, 0x72, 0x6f, 0x67,
- 0x72, 0x61, 0x6d, 0x73, 0x2c, 0x0a, 0x20, 0x2a,
- 0x20, 0x61, 0x6e, 0x64, 0x20, 0x74, 0x6f, 0x20,
- 0x64, 0x69, 0x73, 0x74, 0x72, 0x69, 0x62, 0x75,
- 0x74, 0x65, 0x20, 0x74, 0x68, 0x6f, 0x73, 0x65,
- 0x20, 0x63, 0x6f, 0x6d, 0x62, 0x69, 0x6e, 0x61,
- 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x77, 0x69,
- 0x74, 0x68, 0x6f, 0x75, 0x74, 0x20, 0x61, 0x6e,
- 0x79, 0x20, 0x72, 0x65, 0x73, 0x74, 0x72, 0x69,
- 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x0a, 0x20, 0x2a,
- 0x20, 0x63, 0x6f, 0x6d, 0x69, 0x6e, 0x67, 0x20,
- 0x66, 0x72, 0x6f, 0x6d, 0x20, 0x74, 0x68, 0x65,
- 0x20, 0x75, 0x73, 0x65, 0x20, 0x6f, 0x66, 0x20,
- 0x74, 0x68, 0x69, 0x73, 0x20, 0x66, 0x69, 0x6c,
- 0x65, 0x2e, 0x20, 0x20, 0x28, 0x54, 0x68, 0x65,
- 0x20, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x6c,
- 0x20, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x20,
- 0x4c, 0x69, 0x63, 0x65, 0x6e, 0x73, 0x65, 0x0a,
- 0x20, 0x2a, 0x20, 0x72, 0x65, 0x73, 0x74, 0x72,
- 0x69, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20,
- 0x64, 0x6f, 0x20, 0x61, 0x70, 0x70, 0x6c, 0x79,
- 0x20, 0x69, 0x6e, 0x20, 0x6f, 0x74, 0x68, 0x65,
- 0x72, 0x20, 0x72, 0x65, 0x73, 0x70, 0x65, 0x63,
- 0x74, 0x73, 0x3b, 0x20, 0x66, 0x6f, 0x72, 0x20,
- 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2c,
- 0x20, 0x74, 0x68, 0x65, 0x79, 0x20, 0x63, 0x6f,
- 0x76, 0x65, 0x72, 0x0a, 0x20, 0x2a, 0x20, 0x6d,
- 0x6f, 0x64, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74,
- 0x69, 0x6f, 0x6e, 0x20, 0x6f, 0x66, 0x20, 0x74,
- 0x68, 0x65, 0x20, 0x66, 0x69, 0x6c, 0x65, 0x2c,
- 0x20, 0x61, 0x6e, 0x64, 0x20, 0x64, 0x69, 0x73,
- 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x69, 0x6f,
- 0x6e, 0x20, 0x77, 0x68, 0x65, 0x6e, 0x20, 0x6e,
- 0x6f, 0x74, 0x20, 0x6c, 0x69, 0x6e, 0x6b, 0x65,
- 0x64, 0x20, 0x69, 0x6e, 0x74, 0x6f, 0x0a, 0x20,
- 0x2a, 0x20, 0x61, 0x20, 0x63, 0x6f, 0x6d, 0x62,
- 0x69, 0x6e, 0x65, 0x64, 0x20, 0x65, 0x78, 0x65,
- 0x63, 0x75, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x2e,
- 0x29, 0x0a, 0x20, 0x2a, 0x0a, 0x20, 0x2a, 0x20,
- 0x54, 0x68, 0x69, 0x73, 0x20, 0x66, 0x69, 0x6c,
- 0x65, 0x20, 0x69, 0x73, 0x20, 0x64, 0x69, 0x73,
- 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x64,
- 0x20, 0x69, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20,
- 0x68, 0x6f, 0x70, 0x65, 0x20, 0x74, 0x68, 0x61,
- 0x74, 0x20, 0x69, 0x74, 0x20, 0x77, 0x69, 0x6c,
- 0x6c, 0x20, 0x62, 0x65, 0x20, 0x75, 0x73, 0x65,
- 0x66, 0x75, 0x6c, 0x2c, 0x20, 0x62, 0x75, 0x74,
- 0x0a, 0x20, 0x2a, 0x20, 0x57, 0x49, 0x54, 0x48,
- 0x4f, 0x55, 0x54, 0x20, 0x41, 0x4e, 0x59, 0x20,
- 0x57, 0x41, 0x52, 0x52, 0x41, 0x4e, 0x54, 0x59,
- 0x3b, 0x20, 0x77, 0x69, 0x74, 0x68, 0x6f, 0x75,
- 0x74, 0x20, 0x65, 0x76, 0x65, 0x6e, 0x20, 0x74,
- 0x68, 0x65, 0x20, 0x69, 0x6d, 0x70, 0x6c, 0x69,
- 0x65, 0x64, 0x20, 0x77, 0x61, 0x72, 0x72, 0x61,
- 0x6e, 0x74, 0x79, 0x20, 0x6f, 0x66, 0x0a, 0x20,
- 0x2a, 0x20, 0x4d, 0x45, 0x52, 0x43, 0x48, 0x41,
- 0x4e, 0x54, 0x41, 0x42, 0x49, 0x4c, 0x49, 0x54,
- 0x59, 0x20, 0x6f, 0x72, 0x20, 0x46, 0x49, 0x54,
- 0x4e, 0x45, 0x53, 0x53, 0x20, 0x46, 0x4f, 0x52,
- 0x20, 0x41, 0x20, 0x50, 0x41, 0x52, 0x54, 0x49,
- 0x43, 0x55, 0x4c, 0x41, 0x52, 0x20, 0x50, 0x55,
- 0x52, 0x50, 0x4f, 0x53, 0x45, 0x2e, 0x20, 0x20,
- 0x53, 0x65, 0x65, 0x20, 0x74, 0x68, 0x65, 0x20,
- 0x47, 0x4e, 0x55, 0x0a, 0x20, 0x2a, 0x20, 0x47,
- 0x65, 0x6e, 0x65, 0x72, 0x61, 0x6c, 0x20, 0x50,
- 0x75, 0x62, 0x6c, 0x69, 0x63, 0x20, 0x4c, 0x69,
- 0x63, 0x65, 0x6e, 0x73, 0x65, 0x20, 0x66, 0x6f,
- 0x72, 0x20, 0x6d, 0x6f, 0x72, 0x65, 0x20, 0x64,
- 0x65, 0x74, 0x61, 0x69, 0x6c, 0x73, 0x2e, 0x0a,
- 0x20, 0x2a, 0x0a, 0x20, 0x2a, 0x20, 0x59, 0x6f,
- 0x75, 0x20, 0x73, 0x68, 0x6f, 0x75, 0x6c, 0x64,
- 0x20, 0x68, 0x61, 0x76, 0x65, 0x20, 0x72, 0x65,
- 0x63, 0x65, 0x69, 0x76, 0x65, 0x64, 0x20, 0x61,
- 0x20, 0x63, 0x6f, 0x70, 0x79, 0x20, 0x6f, 0x66,
- 0x20, 0x74, 0x68, 0x65, 0x20, 0x47, 0x4e, 0x55,
- 0x20, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x6c,
- 0x20, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x20,
- 0x4c, 0x69, 0x63, 0x65, 0x6e, 0x73, 0x65, 0x0a,
- 0x20, 0x2a, 0x20, 0x61, 0x6c, 0x6f, 0x6e, 0x67,
- 0x20, 0x77, 0x69, 0x74, 0x68, 0x20, 0x74, 0x68,
- 0x69, 0x73, 0x20, 0x70, 0x72, 0x6f, 0x67, 0x72,
- 0x61, 0x6d, 0x3b, 0x20, 0x73, 0x65, 0x65, 0x20,
- 0x74, 0x68, 0x65, 0x20, 0x66, 0x69, 0x6c, 0x65,
- 0x20, 0x43, 0x4f, 0x50, 0x59, 0x49, 0x4e, 0x47,
- 0x2e, 0x20, 0x20, 0x49, 0x66, 0x20, 0x6e, 0x6f,
- 0x74, 0x2c, 0x20, 0x77, 0x72, 0x69, 0x74, 0x65,
- 0x20, 0x74, 0x6f, 0x0a, 0x20, 0x2a, 0x20, 0x74,
- 0x68, 0x65, 0x20, 0x46, 0x72, 0x65, 0x65, 0x20,
- 0x53, 0x6f, 0x66, 0x74, 0x77, 0x61, 0x72, 0x65,
- 0x20, 0x46, 0x6f, 0x75, 0x6e, 0x64, 0x61, 0x74,
- 0x69, 0x6f, 0x6e, 0x2c, 0x20, 0x35, 0x31, 0x20,
- 0x46, 0x72, 0x61, 0x6e, 0x6b, 0x6c, 0x69, 0x6e,
- 0x20, 0x53, 0x74, 0x72, 0x65, 0x65, 0x74, 0x2c,
- 0x20, 0x46, 0x69, 0x66, 0x74, 0x68, 0x20, 0x46,
- 0x6c, 0x6f, 0x6f, 0x72, 0x2c, 0x0a, 0x20, 0x2a,
- 0x20, 0x42, 0x6f, 0x73, 0x74, 0x6f, 0x6e, 0x2c,
- 0x20, 0x4d, 0x41, 0x20, 0x30, 0x32, 0x31, 0x31,
- 0x30, 0x2d, 0x31, 0x33, 0x30, 0x31, 0x2c, 0x20,
- 0x55, 0x53, 0x41, 0x2e, 0x0a, 0x20, 0x2a, 0x2f,
- 0x0a,
-};
-
-static git_rawobj some_obj = {
- some_data,
- sizeof(some_data),
- GIT_OBJ_BLOB
-};
diff --git a/tests/t03-objwrite.c b/tests/t03-objwrite.c
deleted file mode 100644
index 1650b80..0000000
--- a/tests/t03-objwrite.c
+++ /dev/null
@@ -1,255 +0,0 @@
-/*
- * This file is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License, version 2,
- * as published by the Free Software Foundation.
- *
- * In addition to the permissions in the GNU General Public License,
- * the authors give you unlimited permission to link the compiled
- * version of this file into combinations with other programs,
- * and to distribute those combinations without any restriction
- * coming from the use of this file. (The General Public License
- * restrictions do apply in other respects; for example, they cover
- * modification of the file, and distribution when not linked into
- * a combined executable.)
- *
- * This file is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; see the file COPYING. If not, write to
- * the Free Software Foundation, 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-#include "test_lib.h"
-#include "fileops.h"
-#include "odb.h"
-
-static char *odb_dir = "test-objects";
-#include "t03-data.h"
-
-static int make_odb_dir(void)
-{
- if (p_mkdir(odb_dir, GIT_OBJECT_DIR_MODE) < 0) {
- int err = errno;
- fprintf(stderr, "can't make directory \"%s\"", odb_dir);
- if (err == EEXIST)
- fprintf(stderr, " (already exists)");
- fprintf(stderr, "\n");
- return -1;
- }
- return 0;
-}
-
-static int check_object_files(object_data *d)
-{
- if (git_path_exists(d->dir) < 0)
- return -1;
- if (git_path_exists(d->file) < 0)
- return -1;
- return 0;
-}
-
-static int cmp_objects(git_rawobj *o1, git_rawobj *o2)
-{
- if (o1->type != o2->type)
- return -1;
- if (o1->len != o2->len)
- return -1;
- if ((o1->len > 0) && (memcmp(o1->data, o2->data, o1->len) != 0))
- return -1;
- return 0;
-}
-
-static int remove_object_files(object_data *d)
-{
- if (p_unlink(d->file) < 0) {
- fprintf(stderr, "can't delete object file \"%s\"\n", d->file);
- return -1;
- }
- if ((p_rmdir(d->dir) < 0) && (errno != ENOTEMPTY)) {
- fprintf(stderr, "can't remove directory \"%s\"\n", d->dir);
- return -1;
- }
-
- if (p_rmdir(odb_dir) < 0) {
- fprintf(stderr, "can't remove directory \"%s\"\n", odb_dir);
- return -1;
- }
-
- return 0;
-}
-
-static int streaming_write(git_oid *oid, git_odb *odb, git_rawobj *raw)
-{
- git_odb_stream *stream;
- int error;
-
- if ((error = git_odb_open_wstream(&stream, odb, raw->len, raw->type)) < GIT_SUCCESS)
- return error;
-
- stream->write(stream, raw->data, raw->len);
-
- error = stream->finalize_write(oid, stream);
- stream->free(stream);
-
- return error;
-}
-
-BEGIN_TEST(write0, "write loose commit object")
- git_odb *db;
- git_oid id1, id2;
- git_odb_object *obj;
-
- must_pass(make_odb_dir());
- must_pass(git_odb_open(&db, odb_dir));
- must_pass(git_oid_fromstr(&id1, commit.id));
-
- must_pass(streaming_write(&id2, db, &commit_obj));
- must_be_true(git_oid_cmp(&id1, &id2) == 0);
- must_pass(check_object_files(&commit));
-
- must_pass(git_odb_read(&obj, db, &id1));
- must_pass(cmp_objects(&obj->raw, &commit_obj));
-
- git_odb_object_free(obj);
- git_odb_free(db);
- must_pass(remove_object_files(&commit));
-END_TEST
-
-BEGIN_TEST(write1, "write loose tree object")
- git_odb *db;
- git_oid id1, id2;
- git_odb_object *obj;
-
- must_pass(make_odb_dir());
- must_pass(git_odb_open(&db, odb_dir));
- must_pass(git_oid_fromstr(&id1, tree.id));
-
- must_pass(streaming_write(&id2, db, &tree_obj));
- must_be_true(git_oid_cmp(&id1, &id2) == 0);
- must_pass(check_object_files(&tree));
-
- must_pass(git_odb_read(&obj, db, &id1));
- must_pass(cmp_objects(&obj->raw, &tree_obj));
-
- git_odb_object_free(obj);
- git_odb_free(db);
- must_pass(remove_object_files(&tree));
-END_TEST
-
-BEGIN_TEST(write2, "write loose tag object")
- git_odb *db;
- git_oid id1, id2;
- git_odb_object *obj;
-
- must_pass(make_odb_dir());
- must_pass(git_odb_open(&db, odb_dir));
- must_pass(git_oid_fromstr(&id1, tag.id));
-
- must_pass(streaming_write(&id2, db, &tag_obj));
- must_be_true(git_oid_cmp(&id1, &id2) == 0);
- must_pass(check_object_files(&tag));
-
- must_pass(git_odb_read(&obj, db, &id1));
- must_pass(cmp_objects(&obj->raw, &tag_obj));
-
- git_odb_object_free(obj);
- git_odb_free(db);
- must_pass(remove_object_files(&tag));
-END_TEST
-
-BEGIN_TEST(write3, "write zero-length object")
- git_odb *db;
- git_oid id1, id2;
- git_odb_object *obj;
-
- must_pass(make_odb_dir());
- must_pass(git_odb_open(&db, odb_dir));
- must_pass(git_oid_fromstr(&id1, zero.id));
-
- must_pass(streaming_write(&id2, db, &zero_obj));
- must_be_true(git_oid_cmp(&id1, &id2) == 0);
- must_pass(check_object_files(&zero));
-
- must_pass(git_odb_read(&obj, db, &id1));
- must_pass(cmp_objects(&obj->raw, &zero_obj));
-
- git_odb_object_free(obj);
- git_odb_free(db);
- must_pass(remove_object_files(&zero));
-END_TEST
-
-BEGIN_TEST(write4, "write one-byte long object")
- git_odb *db;
- git_oid id1, id2;
- git_odb_object *obj;
-
- must_pass(make_odb_dir());
- must_pass(git_odb_open(&db, odb_dir));
- must_pass(git_oid_fromstr(&id1, one.id));
-
- must_pass(streaming_write(&id2, db, &one_obj));
- must_be_true(git_oid_cmp(&id1, &id2) == 0);
- must_pass(check_object_files(&one));
-
- must_pass(git_odb_read(&obj, db, &id1));
- must_pass(cmp_objects(&obj->raw, &one_obj));
-
- git_odb_object_free(obj);
- git_odb_free(db);
- must_pass(remove_object_files(&one));
-END_TEST
-
-BEGIN_TEST(write5, "write two-byte long object")
- git_odb *db;
- git_oid id1, id2;
- git_odb_object *obj;
-
- must_pass(make_odb_dir());
- must_pass(git_odb_open(&db, odb_dir));
- must_pass(git_oid_fromstr(&id1, two.id));
-
- must_pass(streaming_write(&id2, db, &two_obj));
- must_be_true(git_oid_cmp(&id1, &id2) == 0);
- must_pass(check_object_files(&two));
-
- must_pass(git_odb_read(&obj, db, &id1));
- must_pass(cmp_objects(&obj->raw, &two_obj));
-
- git_odb_object_free(obj);
- git_odb_free(db);
- must_pass(remove_object_files(&two));
-END_TEST
-
-BEGIN_TEST(write6, "write an object which is several bytes long")
- git_odb *db;
- git_oid id1, id2;
- git_odb_object *obj;
-
- must_pass(make_odb_dir());
- must_pass(git_odb_open(&db, odb_dir));
- must_pass(git_oid_fromstr(&id1, some.id));
-
- must_pass(streaming_write(&id2, db, &some_obj));
- must_be_true(git_oid_cmp(&id1, &id2) == 0);
- must_pass(check_object_files(&some));
-
- must_pass(git_odb_read(&obj, db, &id1));
- must_pass(cmp_objects(&obj->raw, &some_obj));
-
- git_odb_object_free(obj);
- git_odb_free(db);
- must_pass(remove_object_files(&some));
-END_TEST
-
-BEGIN_SUITE(objwrite)
- ADD_TEST(write0);
- ADD_TEST(write1);
- ADD_TEST(write2);
- ADD_TEST(write3);
- ADD_TEST(write4);
- ADD_TEST(write5);
- ADD_TEST(write6);
-END_SUITE
diff --git a/tests/t04-commit.c b/tests/t04-commit.c
deleted file mode 100644
index 82eb983..0000000
--- a/tests/t04-commit.c
+++ /dev/null
@@ -1,789 +0,0 @@
-/*
- * This file is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License, version 2,
- * as published by the Free Software Foundation.
- *
- * In addition to the permissions in the GNU General Public License,
- * the authors give you unlimited permission to link the compiled
- * version of this file into combinations with other programs,
- * and to distribute those combinations without any restriction
- * coming from the use of this file. (The General Public License
- * restrictions do apply in other respects; for example, they cover
- * modification of the file, and distribution when not linked into
- * a combined executable.)
- *
- * This file is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; see the file COPYING. If not, write to
- * the Free Software Foundation, 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-#include "test_lib.h"
-#include "test_helpers.h"
-
-#include "commit.h"
-#include "signature.h"
-
-static char *test_commits_broken[] = {
-
-/* empty commit */
-"",
-
-/* random garbage */
-"asd97sa9du902e9a0jdsuusad09as9du098709aweu8987sd\n",
-
-/* broken endlines 1 */
-"tree f6c0dad3c7b3481caa9d73db21f91964894a945b\r\n\
-parent 05452d6349abcd67aa396dfb28660d765d8b2a36\r\n\
-author Vicent Marti <tanoku@gmail.com> 1273848544 +0200\r\n\
-committer Vicent Marti <tanoku@gmail.com> 1273848544 +0200\r\n\
-\r\n\
-a test commit with broken endlines\r\n",
-
-/* broken endlines 2 */
-"tree f6c0dad3c7b3481caa9d73db21f91964894a945b\
-parent 05452d6349abcd67aa396dfb28660d765d8b2a36\
-author Vicent Marti <tanoku@gmail.com> 1273848544 +0200\
-committer Vicent Marti <tanoku@gmail.com> 1273848544 +0200\
-\
-another test commit with broken endlines",
-
-/* starting endlines */
-"\ntree f6c0dad3c7b3481caa9d73db21f91964894a945b\n\
-parent 05452d6349abcd67aa396dfb28660d765d8b2a36\n\
-author Vicent Marti <tanoku@gmail.com> 1273848544 +0200\n\
-committer Vicent Marti <tanoku@gmail.com> 1273848544 +0200\n\
-\n\
-a test commit with a starting endline\n",
-
-/* corrupted commit 1 */
-"tree f6c0dad3c7b3481caa9d73db21f91964894a945b\n\
-parent 05452d6349abcd67aa396df",
-
-/* corrupted commit 2 */
-"tree f6c0dad3c7b3481caa9d73db21f91964894a945b\n\
-parent ",
-
-/* corrupted commit 3 */
-"tree f6c0dad3c7b3481caa9d73db21f91964894a945b\n\
-parent ",
-
-/* corrupted commit 4 */
-"tree f6c0dad3c7b3481caa9d73db21f91964894a945b\n\
-par",
-
-};
-
-
-static char *test_commits_working[] = {
-/* simple commit with no message */
-"tree 1810dff58d8a660512d4832e740f692884338ccd\n\
-author Vicent Marti <tanoku@gmail.com> 1273848544 +0200\n\
-committer Vicent Marti <tanoku@gmail.com> 1273848544 +0200\n\
-\n",
-
-/* simple commit, no parent */
-"tree 1810dff58d8a660512d4832e740f692884338ccd\n\
-author Vicent Marti <tanoku@gmail.com> 1273848544 +0200\n\
-committer Vicent Marti <tanoku@gmail.com> 1273848544 +0200\n\
-\n\
-a simple commit which works\n",
-
-/* simple commit, no parent, no newline in message */
-"tree 1810dff58d8a660512d4832e740f692884338ccd\n\
-author Vicent Marti <tanoku@gmail.com> 1273848544 +0200\n\
-committer Vicent Marti <tanoku@gmail.com> 1273848544 +0200\n\
-\n\
-a simple commit which works",
-
-/* simple commit, 1 parent */
-"tree 1810dff58d8a660512d4832e740f692884338ccd\n\
-parent e90810b8df3e80c413d903f631643c716887138d\n\
-author Vicent Marti <tanoku@gmail.com> 1273848544 +0200\n\
-committer Vicent Marti <tanoku@gmail.com> 1273848544 +0200\n\
-\n\
-a simple commit which works\n",
-};
-
-BEGIN_TEST(parse0, "parse the OID line in a commit")
-
- git_oid oid;
-
-#define TEST_OID_PASS(string, header) { \
- const char *ptr = string;\
- const char *ptr_original = ptr;\
- size_t len = strlen(ptr);\
- must_pass(git_oid__parse(&oid, &ptr, ptr + len, header));\
- must_be_true(ptr == ptr_original + len);\
-}
-
-#define TEST_OID_FAIL(string, header) { \
- const char *ptr = string;\
- size_t len = strlen(ptr);\
- must_fail(git_oid__parse(&oid, &ptr, ptr + len, header));\
-}
-
- TEST_OID_PASS("parent 05452d6349abcd67aa396dfb28660d765d8b2a36\n", "parent ");
- TEST_OID_PASS("tree 05452d6349abcd67aa396dfb28660d765d8b2a36\n", "tree ");
- TEST_OID_PASS("random_heading 05452d6349abcd67aa396dfb28660d765d8b2a36\n", "random_heading ");
- TEST_OID_PASS("stuck_heading05452d6349abcd67aa396dfb28660d765d8b2a36\n", "stuck_heading");
- TEST_OID_PASS("tree 5F4BEFFC0759261D015AA63A3A85613FF2F235DE\n", "tree ");
- TEST_OID_PASS("tree 1A669B8AB81B5EB7D9DB69562D34952A38A9B504\n", "tree ");
- TEST_OID_PASS("tree 5B20DCC6110FCC75D31C6CEDEBD7F43ECA65B503\n", "tree ");
- TEST_OID_PASS("tree 173E7BF00EA5C33447E99E6C1255954A13026BE4\n", "tree ");
-
- TEST_OID_FAIL("parent 05452d6349abcd67aa396dfb28660d765d8b2a36", "parent ");
- TEST_OID_FAIL("05452d6349abcd67aa396dfb28660d765d8b2a36\n", "tree ");
- TEST_OID_FAIL("parent05452d6349abcd67aa396dfb28660d765d8b2a6a\n", "parent ");
- TEST_OID_FAIL("parent 05452d6349abcd67aa396dfb280d765d8b2a6\n", "parent ");
- TEST_OID_FAIL("tree 05452d6349abcd67aa396dfb28660d765d8b2a36\n", "tree ");
- TEST_OID_FAIL("parent 0545xd6349abcd67aa396dfb28660d765d8b2a36\n", "parent ");
- TEST_OID_FAIL("parent 0545xd6349abcd67aa396dfb28660d765d8b2a36FF\n", "parent ");
- TEST_OID_FAIL("", "tree ");
- TEST_OID_FAIL("", "");
-
-#undef TEST_OID_PASS
-#undef TEST_OID_FAIL
-
-END_TEST
-
-BEGIN_TEST(parse1, "parse the signature line in a commit")
-
-#define TEST_SIGNATURE_PASS(_string, _header, _name, _email, _time, _offset) { \
- const char *ptr = _string; \
- size_t len = strlen(_string);\
- git_signature person = {NULL, NULL, {0, 0}}; \
- must_pass(git_signature__parse(&person, &ptr, ptr + len, _header, '\n'));\
- must_be_true(strcmp(_name, person.name) == 0);\
- must_be_true(strcmp(_email, person.email) == 0);\
- must_be_true(_time == person.when.time);\
- must_be_true(_offset == person.when.offset);\
- git__free(person.name); git__free(person.email);\
-}
-
-#define TEST_SIGNATURE_FAIL(_string, _header) { \
- const char *ptr = _string; \
- size_t len = strlen(_string);\
- git_signature person = {NULL, NULL, {0, 0}}; \
- must_fail(git_signature__parse(&person, &ptr, ptr + len, _header, '\n'));\
- git__free(person.name); git__free(person.email);\
-}
-
- TEST_SIGNATURE_PASS(
- "author Vicent Marti <tanoku@gmail.com> 12345 \n",
- "author ",
- "Vicent Marti",
- "tanoku@gmail.com",
- 12345,
- 0);
-
- TEST_SIGNATURE_PASS(
- "author Vicent Marti <> 12345 \n",
- "author ",
- "Vicent Marti",
- "",
- 12345,
- 0);
-
- TEST_SIGNATURE_PASS(
- "author Vicent Marti <tanoku@gmail.com> 231301 +1020\n",
- "author ",
- "Vicent Marti",
- "tanoku@gmail.com",
- 231301,
- 620);
-
- TEST_SIGNATURE_PASS(
- "author Vicent Marti with an outrageously long name \
- which will probably overflow the buffer <tanoku@gmail.com> 12345 \n",
- "author ",
- "Vicent Marti with an outrageously long name \
- which will probably overflow the buffer",
- "tanoku@gmail.com",
- 12345,
- 0);
-
- TEST_SIGNATURE_PASS(
- "author Vicent Marti <tanokuwithaveryveryverylongemail\
- whichwillprobablyvoverflowtheemailbuffer@gmail.com> 12345 \n",
- "author ",
- "Vicent Marti",
- "tanokuwithaveryveryverylongemail\
- whichwillprobablyvoverflowtheemailbuffer@gmail.com",
- 12345,
- 0);
-
- TEST_SIGNATURE_PASS(
- "committer Vicent Marti <tanoku@gmail.com> 123456 +0000 \n",
- "committer ",
- "Vicent Marti",
- "tanoku@gmail.com",
- 123456,
- 0);
-
- TEST_SIGNATURE_PASS(
- "committer Vicent Marti <tanoku@gmail.com> 123456 +0100 \n",
- "committer ",
- "Vicent Marti",
- "tanoku@gmail.com",
- 123456,
- 60);
-
- TEST_SIGNATURE_PASS(
- "committer Vicent Marti <tanoku@gmail.com> 123456 -0100 \n",
- "committer ",
- "Vicent Marti",
- "tanoku@gmail.com",
- 123456,
- -60);
-
- /* Parse a signature without an author field */
- TEST_SIGNATURE_PASS(
- "committer <tanoku@gmail.com> 123456 -0100 \n",
- "committer ",
- "",
- "tanoku@gmail.com",
- 123456,
- -60);
-
- /* Parse a signature without an author field */
- TEST_SIGNATURE_PASS(
- "committer <tanoku@gmail.com> 123456 -0100 \n",
- "committer ",
- "",
- "tanoku@gmail.com",
- 123456,
- -60);
-
- /* Parse a signature with an empty author field */
- TEST_SIGNATURE_PASS(
- "committer <tanoku@gmail.com> 123456 -0100 \n",
- "committer ",
- "",
- "tanoku@gmail.com",
- 123456,
- -60);
-
- /* Parse a signature with an empty email field */
- TEST_SIGNATURE_PASS(
- "committer Vicent Marti <> 123456 -0100 \n",
- "committer ",
- "Vicent Marti",
- "",
- 123456,
- -60);
-
- /* Parse a signature with an empty email field */
- TEST_SIGNATURE_PASS(
- "committer Vicent Marti < > 123456 -0100 \n",
- "committer ",
- "Vicent Marti",
- "",
- 123456,
- -60);
-
- /* Parse a signature with empty name and email */
- TEST_SIGNATURE_PASS(
- "committer <> 123456 -0100 \n",
- "committer ",
- "",
- "",
- 123456,
- -60);
-
- /* Parse a signature with empty name and email */
- TEST_SIGNATURE_PASS(
- "committer <> 123456 -0100 \n",
- "committer ",
- "",
- "",
- 123456,
- -60);
-
- /* Parse a signature with empty name and email */
- TEST_SIGNATURE_PASS(
- "committer < > 123456 -0100 \n",
- "committer ",
- "",
- "",
- 123456,
- -60);
-
- /* Parse an obviously invalid signature */
- TEST_SIGNATURE_PASS(
- "committer foo<@bar> 123456 -0100 \n",
- "committer ",
- "foo",
- "@bar",
- 123456,
- -60);
-
- /* Parse an obviously invalid signature */
- TEST_SIGNATURE_PASS(
- "committer foo<@bar>123456 -0100 \n",
- "committer ",
- "foo",
- "@bar",
- 123456,
- -60);
-
- /* Parse an obviously invalid signature */
- TEST_SIGNATURE_PASS(
- "committer <>\n",
- "committer ",
- "",
- "",
- 0,
- 0);
-
- TEST_SIGNATURE_PASS(
- "committer Vicent Marti <tanoku@gmail.com> 123456 -1500 \n",
- "committer ",
- "Vicent Marti",
- "tanoku@gmail.com",
- 0,
- 0);
-
- TEST_SIGNATURE_PASS(
- "committer Vicent Marti <tanoku@gmail.com> 123456 +0163 \n",
- "committer ",
- "Vicent Marti",
- "tanoku@gmail.com",
- 0,
- 0);
-
- TEST_SIGNATURE_PASS(
- "author Vicent Marti <tanoku@gmail.com> notime \n",
- "author ",
- "Vicent Marti",
- "tanoku@gmail.com",
- 0,
- 0);
-
- TEST_SIGNATURE_PASS(
- "author Vicent Marti <tanoku@gmail.com> 123456 notimezone \n",
- "author ",
- "Vicent Marti",
- "tanoku@gmail.com",
- 0,
- 0);
-
- TEST_SIGNATURE_PASS(
- "author Vicent Marti <tanoku@gmail.com> notime +0100\n",
- "author ",
- "Vicent Marti",
- "tanoku@gmail.com",
- 0,
- 0);
-
- TEST_SIGNATURE_PASS(
- "author Vicent Marti <tanoku@gmail.com>\n",
- "author ",
- "Vicent Marti",
- "tanoku@gmail.com",
- 0,
- 0);
-
- TEST_SIGNATURE_PASS(
- "author A U Thor <author@example.com>, C O. Miter <comiter@example.com> 1234567890 -0700\n",
- "author ",
- "A U Thor",
- "author@example.com",
- 1234567890,
- -420);
-
- TEST_SIGNATURE_PASS(
- "author A U Thor <author@example.com> and others 1234567890 -0700\n",
- "author ",
- "A U Thor",
- "author@example.com",
- 1234567890,
- -420);
-
- TEST_SIGNATURE_PASS(
- "author A U Thor <author@example.com> and others 1234567890\n",
- "author ",
- "A U Thor",
- "author@example.com",
- 1234567890,
- 0);
-
- TEST_SIGNATURE_PASS(
- "author A U Thor> <author@example.com> and others 1234567890\n",
- "author ",
- "A U Thor>",
- "author@example.com",
- 1234567890,
- 0);
-
- TEST_SIGNATURE_FAIL(
- "committer Vicent Marti tanoku@gmail.com> 123456 -0100 \n",
- "committer ");
-
- TEST_SIGNATURE_FAIL(
- "author Vicent Marti <tanoku@gmail.com> 12345 \n",
- "author ");
-
- TEST_SIGNATURE_FAIL(
- "author Vicent Marti <tanoku@gmail.com> 12345 \n",
- "committer ");
-
- TEST_SIGNATURE_FAIL(
- "author Vicent Marti 12345 \n",
- "author ");
-
- TEST_SIGNATURE_FAIL(
- "author Vicent Marti <broken@email 12345 \n",
- "author ");
-
- TEST_SIGNATURE_FAIL(
- "committer Vicent Marti ><\n",
- "committer ");
-
- TEST_SIGNATURE_FAIL(
- "author ",
- "author ");
-
-#undef TEST_SIGNATURE_PASS
-#undef TEST_SIGNATURE_FAIL
-
-END_TEST
-
-static int try_build_signature(const char *name, const char *email, git_time_t time, int offset)
-{
- git_signature *sign;
- int error = GIT_SUCCESS;
-
- if ((error = git_signature_new(&sign, name, email, time, offset)) < GIT_SUCCESS)
- return error;
-
- git_signature_free((git_signature *)sign);
-
- return error;
-}
-
-BEGIN_TEST(signature0, "creating a signature trims leading and trailing spaces")
- git_signature *sign;
- must_pass(git_signature_new(&sign, " nulltoken ", " emeric.fermas@gmail.com ", 1234567890, 60));
- must_be_true(strcmp(sign->name, "nulltoken") == 0);
- must_be_true(strcmp(sign->email, "emeric.fermas@gmail.com") == 0);
- git_signature_free((git_signature *)sign);
-END_TEST
-
-BEGIN_TEST(signature1, "can not create a signature with empty name or email")
- must_pass(try_build_signature("nulltoken", "emeric.fermas@gmail.com", 1234567890, 60));
-
- must_fail(try_build_signature("", "emeric.fermas@gmail.com", 1234567890, 60));
- must_fail(try_build_signature(" ", "emeric.fermas@gmail.com", 1234567890, 60));
- must_fail(try_build_signature("nulltoken", "", 1234567890, 60));
- must_fail(try_build_signature("nulltoken", " ", 1234567890, 60));
-END_TEST
-
-BEGIN_TEST(signature2, "creating a one character signature")
- git_signature *sign;
- must_pass(git_signature_new(&sign, "x", "foo@bar.baz", 1234567890, 60));
- must_be_true(strcmp(sign->name, "x") == 0);
- must_be_true(strcmp(sign->email, "foo@bar.baz") == 0);
- git_signature_free((git_signature *)sign);
-END_TEST
-
-BEGIN_TEST(signature3, "creating a two character signature")
- git_signature *sign;
- must_pass(git_signature_new(&sign, "xx", "x@y.z", 1234567890, 60));
- must_be_true(strcmp(sign->name, "xx") == 0);
- must_be_true(strcmp(sign->email, "x@y.z") == 0);
- git_signature_free((git_signature *)sign);
-END_TEST
-
-BEGIN_TEST(signature4, "creating a zero character signature")
- git_signature *sign;
- must_fail(git_signature_new(&sign, "", "x@y.z", 1234567890, 60));
- must_be_true(sign == NULL);
-END_TEST
-
-
-BEGIN_TEST(parse2, "parse a whole commit buffer")
- const int broken_commit_count = sizeof(test_commits_broken) / sizeof(*test_commits_broken);
- const int working_commit_count = sizeof(test_commits_working) / sizeof(*test_commits_working);
-
- int i;
- git_repository *repo;
-
- must_pass(git_repository_open(&repo, REPOSITORY_FOLDER));
-
- for (i = 0; i < broken_commit_count; ++i) {
- git_commit *commit;
- commit = git__malloc(sizeof(git_commit));
- memset(commit, 0x0, sizeof(git_commit));
- commit->object.repo = repo;
-
- must_fail(git_commit__parse_buffer(
- commit,
- test_commits_broken[i],
- strlen(test_commits_broken[i]))
- );
-
- git_commit__free(commit);
- }
-
- for (i = 0; i < working_commit_count; ++i) {
- git_commit *commit;
-
- commit = git__malloc(sizeof(git_commit));
- memset(commit, 0x0, sizeof(git_commit));
- commit->object.repo = repo;
-
- must_pass(git_commit__parse_buffer(
- commit,
- test_commits_working[i],
- strlen(test_commits_working[i]))
- );
-
- git_commit__free(commit);
-
- commit = git__malloc(sizeof(git_commit));
- memset(commit, 0x0, sizeof(git_commit));
- commit->object.repo = repo;
-
- must_pass(git_commit__parse_buffer(
- commit,
- test_commits_working[i],
- strlen(test_commits_working[i]))
- );
-
- git_commit__free(commit);
- }
-
- git_repository_free(repo);
-END_TEST
-
-static const char *commit_ids[] = {
- "a4a7dce85cf63874e984719f4fdd239f5145052f", /* 0 */
- "9fd738e8f7967c078dceed8190330fc8648ee56a", /* 1 */
- "4a202b346bb0fb0db7eff3cffeb3c70babbd2045", /* 2 */
- "c47800c7266a2be04c571c04d5a6614691ea99bd", /* 3 */
- "8496071c1b46c854b31185ea97743be6a8774479", /* 4 */
- "5b5b025afb0b4c913b4c338a42934a3863bf3644", /* 5 */
- "a65fedf39aefe402d3bb6e24df4d4f5fe4547750", /* 6 */
-};
-
-BEGIN_TEST(details0, "query the details on a parsed commit")
- const size_t commit_count = sizeof(commit_ids) / sizeof(const char *);
-
- unsigned int i;
- git_repository *repo;
-
- must_pass(git_repository_open(&repo, REPOSITORY_FOLDER));
-
- for (i = 0; i < commit_count; ++i) {
- git_oid id;
- git_commit *commit;
-
- const git_signature *author, *committer;
- const char *message;
- git_time_t commit_time;
- unsigned int parents, p;
- git_commit *parent = NULL, *old_parent = NULL;
-
- git_oid_fromstr(&id, commit_ids[i]);
-
- must_pass(git_commit_lookup(&commit, repo, &id));
-
- message = git_commit_message(commit);
- author = git_commit_author(commit);
- committer = git_commit_committer(commit);
- commit_time = git_commit_time(commit);
- parents = git_commit_parentcount(commit);
-
- must_be_true(strcmp(author->name, "Scott Chacon") == 0);
- must_be_true(strcmp(author->email, "schacon@gmail.com") == 0);
- must_be_true(strcmp(committer->name, "Scott Chacon") == 0);
- must_be_true(strcmp(committer->email, "schacon@gmail.com") == 0);
- must_be_true(message != NULL);
- must_be_true(strchr(message, '\n') != NULL);
- must_be_true(commit_time > 0);
- must_be_true(parents <= 2);
- for (p = 0;p < parents;p++) {
- if (old_parent != NULL)
- git_commit_free(old_parent);
-
- old_parent = parent;
- must_pass(git_commit_parent(&parent, commit, p));
- must_be_true(parent != NULL);
- must_be_true(git_commit_author(parent) != NULL); // is it really a commit?
- }
- git_commit_free(old_parent);
- git_commit_free(parent);
-
- must_fail(git_commit_parent(&parent, commit, parents));
- git_commit_free(commit);
- }
-
- git_repository_free(repo);
-END_TEST
-
-#define COMMITTER_NAME "Vicent Marti"
-#define COMMITTER_EMAIL "vicent@github.com"
-#define COMMIT_MESSAGE "This commit has been created in memory\n\
-This is a commit created in memory and it will be written back to disk\n"
-
-static const char *tree_oid = "1810dff58d8a660512d4832e740f692884338ccd";
-
-BEGIN_TEST(write0, "write a new commit object from memory to disk")
- git_repository *repo;
- git_commit *commit;
- git_oid tree_id, parent_id, commit_id;
- git_signature *author, *committer;
- const git_signature *author1, *committer1;
- git_commit *parent;
- git_tree *tree;
-
- must_pass(git_repository_open(&repo, REPOSITORY_FOLDER));
-
- git_oid_fromstr(&tree_id, tree_oid);
- must_pass(git_tree_lookup(&tree, repo, &tree_id));
-
- git_oid_fromstr(&parent_id, commit_ids[4]);
- must_pass(git_commit_lookup(&parent, repo, &parent_id));
-
- /* create signatures */
- must_pass(git_signature_new(&committer, COMMITTER_NAME, COMMITTER_EMAIL, 123456789, 60));
- must_pass(git_signature_new(&author, COMMITTER_NAME, COMMITTER_EMAIL, 987654321, 90));
-
- must_pass(git_commit_create_v(
- &commit_id, /* out id */
- repo,
- NULL, /* do not update the HEAD */
- author,
- committer,
- NULL,
- COMMIT_MESSAGE,
- tree,
- 1, parent));
-
- git_object_free((git_object *)parent);
- git_object_free((git_object *)tree);
-
- git_signature_free(committer);
- git_signature_free(author);
-
- must_pass(git_commit_lookup(&commit, repo, &commit_id));
-
- /* Check attributes were set correctly */
- author1 = git_commit_author(commit);
- must_be_true(author1 != NULL);
- must_be_true(strcmp(author1->name, COMMITTER_NAME) == 0);
- must_be_true(strcmp(author1->email, COMMITTER_EMAIL) == 0);
- must_be_true(author1->when.time == 987654321);
- must_be_true(author1->when.offset == 90);
-
- committer1 = git_commit_committer(commit);
- must_be_true(committer1 != NULL);
- must_be_true(strcmp(committer1->name, COMMITTER_NAME) == 0);
- must_be_true(strcmp(committer1->email, COMMITTER_EMAIL) == 0);
- must_be_true(committer1->when.time == 123456789);
- must_be_true(committer1->when.offset == 60);
-
- must_be_true(strcmp(git_commit_message(commit), COMMIT_MESSAGE) == 0);
-
-#ifndef GIT_WIN32
- must_be_true((loose_object_mode(REPOSITORY_FOLDER, (git_object *)commit) & 0777) == GIT_OBJECT_FILE_MODE);
-#endif
-
- must_pass(remove_loose_object(REPOSITORY_FOLDER, (git_object *)commit));
-
- git_commit_free(commit);
- git_repository_free(repo);
-END_TEST
-
-#define ROOT_COMMIT_MESSAGE "This is a root commit\n\
-This is a root commit and should be the only one in this branch\n"
-
-BEGIN_TEST(root0, "create a root commit")
- git_repository *repo;
- git_commit *commit;
- git_oid tree_id, commit_id;
- const git_oid *branch_oid;
- git_signature *author, *committer;
- const char *branch_name = "refs/heads/root-commit-branch";
- git_reference *head, *branch;
- char *head_old;
- git_tree *tree;
-
- must_pass(git_repository_open(&repo, REPOSITORY_FOLDER));
-
- git_oid_fromstr(&tree_id, tree_oid);
- must_pass(git_tree_lookup(&tree, repo, &tree_id));
-
- /* create signatures */
- must_pass(git_signature_new(&committer, COMMITTER_NAME, COMMITTER_EMAIL, 123456789, 60));
- must_pass(git_signature_new(&author, COMMITTER_NAME, COMMITTER_EMAIL, 987654321, 90));
-
- /* First we need to update HEAD so it points to our non-existant branch */
- must_pass(git_reference_lookup(&head, repo, "HEAD"));
- must_be_true(git_reference_type(head) == GIT_REF_SYMBOLIC);
- head_old = git__strdup(git_reference_target(head));
- must_be_true(head_old != NULL);
-
- must_pass(git_reference_set_target(head, branch_name));
-
- must_pass(git_commit_create_v(
- &commit_id, /* out id */
- repo,
- "HEAD",
- author,
- committer,
- NULL,
- ROOT_COMMIT_MESSAGE,
- tree,
- 0));
-
- git_object_free((git_object *)tree);
- git_signature_free(committer);
- git_signature_free(author);
-
- /*
- * The fact that creating a commit works has already been
- * tested. Here we just make sure it's our commit and that it was
- * written as a root commit.
- */
- must_pass(git_commit_lookup(&commit, repo, &commit_id));
- must_be_true(git_commit_parentcount(commit) == 0);
- must_pass(git_reference_lookup(&branch, repo, branch_name));
- branch_oid = git_reference_oid(branch);
- must_pass(git_oid_cmp(branch_oid, &commit_id));
- must_be_true(!strcmp(git_commit_message(commit), ROOT_COMMIT_MESSAGE));
-
- /* Remove the data we just added to the repo */
- git_reference_free(head);
- must_pass(git_reference_lookup(&head, repo, "HEAD"));
- must_pass(git_reference_set_target(head, head_old));
- must_pass(git_reference_delete(branch));
- must_pass(remove_loose_object(REPOSITORY_FOLDER, (git_object *)commit));
- git__free(head_old);
- git_commit_free(commit);
- git_repository_free(repo);
-
- git_reference_free(head);
-END_TEST
-
-BEGIN_SUITE(commit)
- ADD_TEST(parse0);
- ADD_TEST(parse1);
- ADD_TEST(parse2);
- ADD_TEST(details0);
-
- ADD_TEST(write0);
-
- ADD_TEST(root0);
-
- ADD_TEST(signature0);
- ADD_TEST(signature1);
- ADD_TEST(signature2);
- ADD_TEST(signature3);
- ADD_TEST(signature4);
-END_SUITE
diff --git a/tests/t05-revwalk.c b/tests/t05-revwalk.c
deleted file mode 100644
index ab509ab..0000000
--- a/tests/t05-revwalk.c
+++ /dev/null
@@ -1,140 +0,0 @@
-/*
- * This file is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License, version 2,
- * as published by the Free Software Foundation.
- *
- * In addition to the permissions in the GNU General Public License,
- * the authors give you unlimited permission to link the compiled
- * version of this file into combinations with other programs,
- * and to distribute those combinations without any restriction
- * coming from the use of this file. (The General Public License
- * restrictions do apply in other respects; for example, they cover
- * modification of the file, and distribution when not linked into
- * a combined executable.)
- *
- * This file is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; see the file COPYING. If not, write to
- * the Free Software Foundation, 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-#include "test_lib.h"
-#include "test_helpers.h"
-
-/*
- $ git log --oneline --graph --decorate
- * a4a7dce (HEAD, br2) Merge branch 'master' into br2
- |\
- | * 9fd738e (master) a fourth commit
- | * 4a202b3 a third commit
- * | c47800c branch commit one
- |/
- * 5b5b025 another commit
- * 8496071 testing
-*/
-static const char *commit_head = "a4a7dce85cf63874e984719f4fdd239f5145052f";
-
-static const char *commit_ids[] = {
- "a4a7dce85cf63874e984719f4fdd239f5145052f", /* 0 */
- "9fd738e8f7967c078dceed8190330fc8648ee56a", /* 1 */
- "4a202b346bb0fb0db7eff3cffeb3c70babbd2045", /* 2 */
- "c47800c7266a2be04c571c04d5a6614691ea99bd", /* 3 */
- "8496071c1b46c854b31185ea97743be6a8774479", /* 4 */
- "5b5b025afb0b4c913b4c338a42934a3863bf3644", /* 5 */
-};
-
-/* Careful: there are two possible topological sorts */
-static const int commit_sorting_topo[][6] = {
- {0, 1, 2, 3, 5, 4}, {0, 3, 1, 2, 5, 4}
-};
-
-static const int commit_sorting_time[][6] = {
- {0, 3, 1, 2, 5, 4}
-};
-
-static const int commit_sorting_topo_reverse[][6] = {
- {4, 5, 3, 2, 1, 0}, {4, 5, 2, 1, 3, 0}
-};
-
-static const int commit_sorting_time_reverse[][6] = {
- {4, 5, 2, 1, 3, 0}
-};
-
-#define commit_count 6
-static const int result_bytes = 24;
-
-
-static int get_commit_index(git_oid *raw_oid)
-{
- int i;
- char oid[40];
-
- git_oid_fmt(oid, raw_oid);
-
- for (i = 0; i < commit_count; ++i)
- if (memcmp(oid, commit_ids[i], 40) == 0)
- return i;
-
- return -1;
-}
-
-static int test_walk(git_revwalk *walk, const git_oid *root,
- int flags, const int possible_results[][6], int results_count)
-{
- git_oid oid;
-
- int i;
- int result_array[commit_count];
-
- git_revwalk_sorting(walk, flags);
- git_revwalk_push(walk, root);
-
- for (i = 0; i < commit_count; ++i)
- result_array[i] = -1;
-
- i = 0;
-
- while (git_revwalk_next(&oid, walk) == GIT_SUCCESS) {
- result_array[i++] = get_commit_index(&oid);
- /*{
- char str[41];
- git_oid_fmt(str, &oid);
- str[40] = 0;
- printf(" %d) %s\n", i, str);
- }*/
- }
-
- for (i = 0; i < results_count; ++i)
- if (memcmp(possible_results[i],
- result_array, result_bytes) == 0)
- return GIT_SUCCESS;
-
- return GIT_ERROR;
-}
-
-BEGIN_TEST(walk0, "do a simple walk on a repo with different sorting modes")
- git_oid id;
- git_repository *repo;
- git_revwalk *walk;
-
- must_pass(git_repository_open(&repo, REPOSITORY_FOLDER));
- must_pass(git_revwalk_new(&walk, repo));
-
- git_oid_fromstr(&id, commit_head);
-
- must_pass(test_walk(walk, &id, GIT_SORT_TIME, commit_sorting_time, 1));
- must_pass(test_walk(walk, &id, GIT_SORT_TOPOLOGICAL, commit_sorting_topo, 2));
- must_pass(test_walk(walk, &id, GIT_SORT_TIME | GIT_SORT_REVERSE, commit_sorting_time_reverse, 1));
- must_pass(test_walk(walk, &id, GIT_SORT_TOPOLOGICAL | GIT_SORT_REVERSE, commit_sorting_topo_reverse, 2));
-
- git_revwalk_free(walk);
- git_repository_free(repo);
-END_TEST
-
-BEGIN_SUITE(revwalk)
- ADD_TEST(walk0);
-END_SUITE
diff --git a/tests/t06-index.c b/tests/t06-index.c
deleted file mode 100644
index 7b0f051..0000000
--- a/tests/t06-index.c
+++ /dev/null
@@ -1,219 +0,0 @@
-/*
- * This file is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License, version 2,
- * as published by the Free Software Foundation.
- *
- * In addition to the permissions in the GNU General Public License,
- * the authors give you unlimited permission to link the compiled
- * version of this file into combinations with other programs,
- * and to distribute those combinations without any restriction
- * coming from the use of this file. (The General Public License
- * restrictions do apply in other respects; for example, they cover
- * modification of the file, and distribution when not linked into
- * a combined executable.)
- *
- * This file is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; see the file COPYING. If not, write to
- * the Free Software Foundation, 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-#include "test_lib.h"
-#include "test_helpers.h"
-
-#include "index.h"
-
-#define TEST_INDEX_ENTRY_COUNT 109
-#define TEST_INDEX2_ENTRY_COUNT 1437
-
-struct test_entry {
- unsigned int index;
- char path[128];
- git_off_t file_size;
- git_time_t mtime;
-};
-
-struct test_entry TEST_ENTRIES[] = {
- {4, "Makefile", 5064, 0x4C3F7F33},
- {62, "tests/Makefile", 2631, 0x4C3F7F33},
- {36, "src/index.c", 10014, 0x4C43368D},
- {6, "git.git-authors", 2709, 0x4C3F7F33},
- {48, "src/revobject.h", 1448, 0x4C3F7FE2}
-};
-
-BEGIN_TEST(read0, "load an empty index")
- git_index *index;
-
- must_pass(git_index_open(&index, "in-memory-index"));
- must_be_true(index->on_disk == 0);
-
- must_be_true(git_index_entrycount(index) == 0);
- must_be_true(index->entries.sorted);
-
- git_index_free(index);
-END_TEST
-
-BEGIN_TEST(read1, "load a standard index (default test index)")
- git_index *index;
- unsigned int i;
- git_index_entry **entries;
-
- must_pass(git_index_open(&index, TEST_INDEX_PATH));
- must_be_true(index->on_disk);
-
- must_be_true(git_index_entrycount(index) == TEST_INDEX_ENTRY_COUNT);
- must_be_true(index->entries.sorted);
-
- entries = (git_index_entry **)index->entries.contents;
-
- for (i = 0; i < ARRAY_SIZE(TEST_ENTRIES); ++i) {
- git_index_entry *e = entries[TEST_ENTRIES[i].index];
-
- must_be_true(strcmp(e->path, TEST_ENTRIES[i].path) == 0);
- must_be_true(e->mtime.seconds == TEST_ENTRIES[i].mtime);
- must_be_true(e->file_size == TEST_ENTRIES[i].file_size);
- }
-
- git_index_free(index);
-END_TEST
-
-BEGIN_TEST(read2, "load a standard index (git.git index)")
- git_index *index;
-
- must_pass(git_index_open(&index, TEST_INDEX2_PATH));
- must_be_true(index->on_disk);
-
- must_be_true(git_index_entrycount(index) == TEST_INDEX2_ENTRY_COUNT);
- must_be_true(index->entries.sorted);
- must_be_true(index->tree != NULL);
-
- git_index_free(index);
-END_TEST
-
-BEGIN_TEST(find0, "find an entry on an index")
- git_index *index;
- unsigned int i;
-
- must_pass(git_index_open(&index, TEST_INDEX_PATH));
-
- for (i = 0; i < ARRAY_SIZE(TEST_ENTRIES); ++i) {
- int idx = git_index_find(index, TEST_ENTRIES[i].path);
- must_be_true((unsigned int)idx == TEST_ENTRIES[i].index);
- }
-
- git_index_free(index);
-END_TEST
-
-BEGIN_TEST(find1, "find an entry in an empty index")
- git_index *index;
- unsigned int i;
-
- must_pass(git_index_open(&index, "fake-index"));
-
- for (i = 0; i < ARRAY_SIZE(TEST_ENTRIES); ++i) {
- int idx = git_index_find(index, TEST_ENTRIES[i].path);
- must_be_true(idx == GIT_ENOTFOUND);
- }
-
- git_index_free(index);
-END_TEST
-
-BEGIN_TEST(write0, "write an index back to disk")
- git_index *index;
-
- must_pass(copy_file(TEST_INDEXBIG_PATH, "index_rewrite"));
-
- must_pass(git_index_open(&index, "index_rewrite"));
- must_be_true(index->on_disk);
-
- must_pass(git_index_write(index));
- must_pass(cmp_files(TEST_INDEXBIG_PATH, "index_rewrite"));
-
- git_index_free(index);
-
- p_unlink("index_rewrite");
-END_TEST
-
-BEGIN_TEST(sort0, "sort the entires in an index")
- /*
- * TODO: This no longer applies:
- * index sorting in Git uses some specific changes to the way
- * directories are sorted.
- *
- * We need to specificially check for this by creating a new
- * index, adding entries in random order and then
- * checking for consistency
- */
-END_TEST
-
-BEGIN_TEST(sort1, "sort the entires in an empty index")
- git_index *index;
-
- must_pass(git_index_open(&index, "fake-index"));
-
- /* FIXME: this test is slightly dumb */
- must_be_true(index->entries.sorted);
-
- git_index_free(index);
-END_TEST
-
-BEGIN_TEST(add0, "add a new file to the index")
- git_index *index;
- git_filebuf file = GIT_FILEBUF_INIT;
- git_repository *repo;
- git_index_entry *entry;
- git_oid id1;
-
- /* Intialize a new repository */
- must_pass(git_repository_init(&repo, TEMP_REPO_FOLDER "myrepo", 0));
-
- /* Ensure we're the only guy in the room */
- must_pass(git_repository_index(&index, repo));
- must_pass(git_index_entrycount(index) == 0);
-
- /* Create a new file in the working directory */
- must_pass(git_futils_mkpath2file(TEMP_REPO_FOLDER "myrepo/test.txt", 0777));
- must_pass(git_filebuf_open(&file, TEMP_REPO_FOLDER "myrepo/test.txt", 0));
- must_pass(git_filebuf_write(&file, "hey there\n", 10));
- must_pass(git_filebuf_commit(&file, 0666));
-
- /* Store the expected hash of the file/blob
- * This has been generated by executing the following
- * $ echo "hey there" | git hash-object --stdin
- */
- must_pass(git_oid_fromstr(&id1, "a8233120f6ad708f843d861ce2b7228ec4e3dec6"));
-
- /* Add the new file to the index */
- must_pass(git_index_add(index, "test.txt", 0));
-
- /* Wow... it worked! */
- must_pass(git_index_entrycount(index) == 1);
- entry = git_index_get(index, 0);
-
- /* And the built-in hashing mechanism worked as expected */
- must_be_true(git_oid_cmp(&id1, &entry->oid) == 0);
-
- git_index_free(index);
- git_repository_free(repo);
- must_pass(git_futils_rmdir_r(TEMP_REPO_FOLDER, 1));
-END_TEST
-
-BEGIN_SUITE(index)
- ADD_TEST(read0);
- ADD_TEST(read1);
- ADD_TEST(read2);
-
- ADD_TEST(find0);
- ADD_TEST(find1);
-
- ADD_TEST(write0);
-
- ADD_TEST(sort0);
- ADD_TEST(sort1);
-
- ADD_TEST(add0);
-END_SUITE
diff --git a/tests/t07-hashtable.c b/tests/t07-hashtable.c
deleted file mode 100644
index 6beaeac..0000000
--- a/tests/t07-hashtable.c
+++ /dev/null
@@ -1,189 +0,0 @@
-/*
- * This file is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License, version 2,
- * as published by the Free Software Foundation.
- *
- * In addition to the permissions in the GNU General Public License,
- * the authors give you unlimited permission to link the compiled
- * version of this file into combinations with other programs,
- * and to distribute those combinations without any restriction
- * coming from the use of this file. (The General Public License
- * restrictions do apply in other respects; for example, they cover
- * modification of the file, and distribution when not linked into
- * a combined executable.)
- *
- * This file is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; see the file COPYING. If not, write to
- * the Free Software Foundation, 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-#include "test_lib.h"
-#include "test_helpers.h"
-
-#include "hashtable.h"
-#include "hash.h"
-
-typedef struct _aux_object {
- int __bulk;
- git_oid id;
- int visited;
-} table_item;
-
-static uint32_t hash_func(const void *key, int hash_id)
-{
- uint32_t r;
- const git_oid *id = key;
-
- memcpy(&r, id->id + (hash_id * sizeof(uint32_t)), sizeof(r));
- return r;
-}
-
-static int hash_cmpkey(const void *a, const void *b)
-{
- return git_oid_cmp(a, b);
-}
-
-BEGIN_TEST(table0, "create a new hashtable")
-
- git_hashtable *table = NULL;
-
- table = git_hashtable_alloc(55, hash_func, hash_cmpkey);
- must_be_true(table != NULL);
- must_be_true(table->size_mask + 1 == 64);
-
- git_hashtable_free(table);
-
-END_TEST
-
-BEGIN_TEST(table1, "fill the hashtable with random entries")
-
- const int objects_n = 32;
- int i;
-
- table_item *objects;
- git_hashtable *table = NULL;
-
- table = git_hashtable_alloc(objects_n * 2, hash_func, hash_cmpkey);
- must_be_true(table != NULL);
-
- objects = git__malloc(objects_n * sizeof(table_item));
- memset(objects, 0x0, objects_n * sizeof(table_item));
-
- /* populate the hash table */
- for (i = 0; i < objects_n; ++i) {
- git_hash_buf(&(objects[i].id), &i, sizeof(int));
- must_pass(git_hashtable_insert(table, &(objects[i].id), &(objects[i])));
- }
-
- /* make sure all the inserted objects can be found */
- for (i = 0; i < objects_n; ++i) {
- git_oid id;
- table_item *ob;
-
- git_hash_buf(&id, &i, sizeof(int));
- ob = (table_item *)git_hashtable_lookup(table, &id);
-
- must_be_true(ob != NULL);
- must_be_true(ob == &(objects[i]));
- }
-
- /* make sure we cannot find inexisting objects */
- for (i = 0; i < 50; ++i) {
- int hash_id;
- git_oid id;
-
- hash_id = (rand() % 50000) + objects_n;
- git_hash_buf(&id, &hash_id, sizeof(int));
- must_be_true(git_hashtable_lookup(table, &id) == NULL);
- }
-
- git_hashtable_free(table);
- git__free(objects);
-
-END_TEST
-
-
-BEGIN_TEST(table2, "make sure the table resizes automatically")
-
- const int objects_n = 64;
- int i;
- unsigned int old_size;
- table_item *objects;
- git_hashtable *table = NULL;
-
- table = git_hashtable_alloc(objects_n, hash_func, hash_cmpkey);
- must_be_true(table != NULL);
-
- objects = git__malloc(objects_n * sizeof(table_item));
- memset(objects, 0x0, objects_n * sizeof(table_item));
-
- old_size = table->size_mask + 1;
-
- /* populate the hash table -- should be automatically resized */
- for (i = 0; i < objects_n; ++i) {
- git_hash_buf(&(objects[i].id), &i, sizeof(int));
- must_pass(git_hashtable_insert(table, &(objects[i].id), &(objects[i])));
- }
-
- must_be_true(table->size_mask > old_size);
-
- /* make sure all the inserted objects can be found */
- for (i = 0; i < objects_n; ++i) {
- git_oid id;
- table_item *ob;
-
- git_hash_buf(&id, &i, sizeof(int));
- ob = (table_item *)git_hashtable_lookup(table, &id);
-
- must_be_true(ob != NULL);
- must_be_true(ob == &(objects[i]));
- }
-
- git_hashtable_free(table);
- git__free(objects);
-
-END_TEST
-
-BEGIN_TEST(tableit0, "iterate through all the contents of the table")
-
- const int objects_n = 32;
- int i;
- table_item *objects, *ob;
-
- git_hashtable *table = NULL;
-
- table = git_hashtable_alloc(objects_n * 2, hash_func, hash_cmpkey);
- must_be_true(table != NULL);
-
- objects = git__malloc(objects_n * sizeof(table_item));
- memset(objects, 0x0, objects_n * sizeof(table_item));
-
- /* populate the hash table */
- for (i = 0; i < objects_n; ++i) {
- git_hash_buf(&(objects[i].id), &i, sizeof(int));
- must_pass(git_hashtable_insert(table, &(objects[i].id), &(objects[i])));
- }
-
- GIT_HASHTABLE_FOREACH_VALUE(table, ob, ob->visited = 1);
-
- /* make sure all nodes have been visited */
- for (i = 0; i < objects_n; ++i)
- must_be_true(objects[i].visited);
-
- git_hashtable_free(table);
- git__free(objects);
-END_TEST
-
-
-BEGIN_SUITE(hashtable)
- ADD_TEST(table0);
- ADD_TEST(table1);
- ADD_TEST(table2);
- ADD_TEST(tableit0);
-END_SUITE
-
diff --git a/tests/t08-tag.c b/tests/t08-tag.c
deleted file mode 100644
index eacbb3a..0000000
--- a/tests/t08-tag.c
+++ /dev/null
@@ -1,358 +0,0 @@
-/*
- * This file is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License, version 2,
- * as published by the Free Software Foundation.
- *
- * In addition to the permissions in the GNU General Public License,
- * the authors give you unlimited permission to link the compiled
- * version of this file into combinations with other programs,
- * and to distribute those combinations without any restriction
- * coming from the use of this file. (The General Public License
- * restrictions do apply in other respects; for example, they cover
- * modification of the file, and distribution when not linked into
- * a combined executable.)
- *
- * This file is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; see the file COPYING. If not, write to
- * the Free Software Foundation, 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-#include "test_lib.h"
-#include "test_helpers.h"
-
-#include "tag.h"
-
-static const char *tag1_id = "b25fa35b38051e4ae45d4222e795f9df2e43f1d1";
-static const char *tag2_id = "7b4384978d2493e851f9cca7858815fac9b10980";
-static const char *tagged_commit = "e90810b8df3e80c413d903f631643c716887138d";
-static const char *bad_tag_id = "eda9f45a2a98d4c17a09d681d88569fa4ea91755";
-static const char *badly_tagged_commit = "e90810b8df3e80c413d903f631643c716887138d";
-
-BEGIN_TEST(read0, "read and parse a tag from the repository")
- git_repository *repo;
- git_tag *tag1, *tag2;
- git_commit *commit;
- git_oid id1, id2, id_commit;
-
- must_pass(git_repository_open(&repo, REPOSITORY_FOLDER));
-
- git_oid_fromstr(&id1, tag1_id);
- git_oid_fromstr(&id2, tag2_id);
- git_oid_fromstr(&id_commit, tagged_commit);
-
- must_pass(git_tag_lookup(&tag1, repo, &id1));
-
- must_be_true(strcmp(git_tag_name(tag1), "test") == 0);
- must_be_true(git_tag_type(tag1) == GIT_OBJ_TAG);
-
- must_pass(git_tag_target((git_object **)&tag2, tag1));
- must_be_true(tag2 != NULL);
-
- must_be_true(git_oid_cmp(&id2, git_tag_id(tag2)) == 0);
-
- must_pass(git_tag_target((git_object **)&commit, tag2));
- must_be_true(commit != NULL);
-
- must_be_true(git_oid_cmp(&id_commit, git_commit_id(commit)) == 0);
-
- git_tag_free(tag1);
- git_tag_free(tag2);
- git_commit_free(commit);
- git_repository_free(repo);
-END_TEST
-
-BEGIN_TEST(read1, "list all tag names from the repository")
- git_repository *repo;
- git_strarray tag_list;
-
- must_pass(git_repository_open(&repo, REPOSITORY_FOLDER));
- must_pass(git_tag_list(&tag_list, repo));
-
- must_be_true(tag_list.count == 3);
-
- git_strarray_free(&tag_list);
- git_repository_free(repo);
-END_TEST
-
-static int ensure_tag_pattern_match(git_repository *repo, const char *pattern, const size_t expected_matches)
-{
- git_strarray tag_list;
- int error = GIT_SUCCESS;
-
- if ((error = git_tag_list_match(&tag_list, pattern, repo)) < GIT_SUCCESS)
- goto exit;
-
- if (tag_list.count != expected_matches)
- error = GIT_ERROR;
-
-exit:
- git_strarray_free(&tag_list);
- return error;
-}
-
-BEGIN_TEST(read2, "list all tag names from the repository matching a specified pattern")
- git_repository *repo;
- must_pass(git_repository_open(&repo, REPOSITORY_FOLDER));
- must_pass(ensure_tag_pattern_match(repo, "", 3));
- must_pass(ensure_tag_pattern_match(repo, "*", 3));
- must_pass(ensure_tag_pattern_match(repo, "t*", 1));
- must_pass(ensure_tag_pattern_match(repo, "*b", 2));
- must_pass(ensure_tag_pattern_match(repo, "e", 0));
- must_pass(ensure_tag_pattern_match(repo, "e90810b", 1));
- must_pass(ensure_tag_pattern_match(repo, "e90810[ab]", 1));
- git_repository_free(repo);
-END_TEST
-
-#define BAD_TAG_REPOSITORY_FOLDER TEST_RESOURCES "/bad_tag.git/"
-
-BEGIN_TEST(read3, "read and parse a tag without a tagger field")
- git_repository *repo;
- git_tag *bad_tag;
- git_commit *commit;
- git_oid id, id_commit;
-
- must_pass(git_repository_open(&repo, BAD_TAG_REPOSITORY_FOLDER));
-
- git_oid_fromstr(&id, bad_tag_id);
- git_oid_fromstr(&id_commit, badly_tagged_commit);
-
- must_pass(git_tag_lookup(&bad_tag, repo, &id));
- must_be_true(bad_tag != NULL);
-
- must_be_true(strcmp(git_tag_name(bad_tag), "e90810b") == 0);
- must_be_true(git_oid_cmp(&id, git_tag_id(bad_tag)) == 0);
- must_be_true(bad_tag->tagger == NULL);
-
- must_pass(git_tag_target((git_object **)&commit, bad_tag));
- must_be_true(commit != NULL);
-
- must_be_true(git_oid_cmp(&id_commit, git_commit_id(commit)) == 0);
-
- git_tag_free(bad_tag);
- git_commit_free(commit);
-
- git_repository_free(repo);
-END_TEST
-
-
-#define TAGGER_NAME "Vicent Marti"
-#define TAGGER_EMAIL "vicent@github.com"
-#define TAGGER_MESSAGE "This is my tag.\n\nThere are many tags, but this one is mine\n"
-
-BEGIN_TEST(write0, "write a tag to the repository and read it again")
- git_repository *repo;
- git_tag *tag;
- git_oid target_id, tag_id;
- git_signature *tagger;
- const git_signature *tagger1;
- git_reference *ref_tag;
- git_object *target;
-
- must_pass(git_repository_open(&repo, REPOSITORY_FOLDER));
-
- git_oid_fromstr(&target_id, tagged_commit);
- must_pass(git_object_lookup(&target, repo, &target_id, GIT_OBJ_COMMIT));
-
- /* create signature */
- must_pass(git_signature_new(&tagger, TAGGER_NAME, TAGGER_EMAIL, 123456789, 60));
-
- must_pass(git_tag_create(
- &tag_id, /* out id */
- repo,
- "the-tag",
- target,
- tagger,
- TAGGER_MESSAGE,
- 0));
-
- git_object_free(target);
- git_signature_free(tagger);
-
- must_pass(git_tag_lookup(&tag, repo, &tag_id));
- must_be_true(git_oid_cmp(git_tag_target_oid(tag), &target_id) == 0);
-
- /* Check attributes were set correctly */
- tagger1 = git_tag_tagger(tag);
- must_be_true(tagger1 != NULL);
- must_be_true(strcmp(tagger1->name, TAGGER_NAME) == 0);
- must_be_true(strcmp(tagger1->email, TAGGER_EMAIL) == 0);
- must_be_true(tagger1->when.time == 123456789);
- must_be_true(tagger1->when.offset == 60);
-
- must_be_true(strcmp(git_tag_message(tag), TAGGER_MESSAGE) == 0);
-
- must_pass(git_reference_lookup(&ref_tag, repo, "refs/tags/the-tag"));
- must_be_true(git_oid_cmp(git_reference_oid(ref_tag), &tag_id) == 0);
- must_pass(git_reference_delete(ref_tag));
-#ifndef GIT_WIN32
- must_be_true((loose_object_mode(REPOSITORY_FOLDER, (git_object *)tag) & 0777) == GIT_OBJECT_FILE_MODE);
-#endif
-
- must_pass(remove_loose_object(REPOSITORY_FOLDER, (git_object *)tag));
-
- git_tag_free(tag);
- git_repository_free(repo);
-END_TEST
-
-BEGIN_TEST(write2, "Attempt to write a tag bearing the same name than an already existing tag")
- git_repository *repo;
- git_oid target_id, tag_id;
- git_signature *tagger;
- git_object *target;
-
- must_pass(git_repository_open(&repo, REPOSITORY_FOLDER));
-
- git_oid_fromstr(&target_id, tagged_commit);
- must_pass(git_object_lookup(&target, repo, &target_id, GIT_OBJ_COMMIT));
-
- /* create signature */
- must_pass(git_signature_new(&tagger, TAGGER_NAME, TAGGER_EMAIL, 123456789, 60));
-
- must_fail(git_tag_create(
- &tag_id, /* out id */
- repo,
- "e90810b",
- target,
- tagger,
- TAGGER_MESSAGE,
- 0));
-
- git_object_free(target);
- git_signature_free(tagger);
-
- git_repository_free(repo);
-
-END_TEST
-
-BEGIN_TEST(write3, "Replace an already existing tag")
- git_repository *repo;
- git_oid target_id, tag_id, old_tag_id;
- git_signature *tagger;
- git_reference *ref_tag;
- git_object *target;
-
- must_pass(open_temp_repo(&repo, REPOSITORY_FOLDER));
-
- git_oid_fromstr(&target_id, tagged_commit);
- must_pass(git_object_lookup(&target, repo, &target_id, GIT_OBJ_COMMIT));
-
- must_pass(git_reference_lookup(&ref_tag, repo, "refs/tags/e90810b"));
- git_oid_cpy(&old_tag_id, git_reference_oid(ref_tag));
- git_reference_free(ref_tag);
-
- /* create signature */
- must_pass(git_signature_new(&tagger, TAGGER_NAME, TAGGER_EMAIL, 123456789, 60));
-
- must_pass(git_tag_create(
- &tag_id, /* out id */
- repo,
- "e90810b",
- target,
- tagger,
- TAGGER_MESSAGE,
- 1));
-
- git_object_free(target);
- git_signature_free(tagger);
-
- must_pass(git_reference_lookup(&ref_tag, repo, "refs/tags/e90810b"));
- must_be_true(git_oid_cmp(git_reference_oid(ref_tag), &tag_id) == 0);
- must_be_true(git_oid_cmp(git_reference_oid(ref_tag), &old_tag_id) != 0);
-
- close_temp_repo(repo);
-
- git_reference_free(ref_tag);
-END_TEST
-
-BEGIN_TEST(write4, "write a lightweight tag to the repository and read it again")
- git_repository *repo;
- git_oid target_id, object_id;
- git_reference *ref_tag;
- git_object *target;
-
- must_pass(git_repository_open(&repo, REPOSITORY_FOLDER));
-
- git_oid_fromstr(&target_id, tagged_commit);
- must_pass(git_object_lookup(&target, repo, &target_id, GIT_OBJ_COMMIT));
-
- must_pass(git_tag_create_lightweight(
- &object_id,
- repo,
- "light-tag",
- target,
- 0));
-
- git_object_free(target);
-
- must_be_true(git_oid_cmp(&object_id, &target_id) == 0);
-
- must_pass(git_reference_lookup(&ref_tag, repo, "refs/tags/light-tag"));
- must_be_true(git_oid_cmp(git_reference_oid(ref_tag), &target_id) == 0);
-
- must_pass(git_tag_delete(repo, "light-tag"));
-
- git_repository_free(repo);
-
- git_reference_free(ref_tag);
-END_TEST
-
-BEGIN_TEST(write5, "Attempt to write a lightweight tag bearing the same name than an already existing tag")
- git_repository *repo;
- git_oid target_id, object_id, existing_object_id;
- git_object *target;
-
- must_pass(git_repository_open(&repo, REPOSITORY_FOLDER));
-
- git_oid_fromstr(&target_id, tagged_commit);
- must_pass(git_object_lookup(&target, repo, &target_id, GIT_OBJ_COMMIT));
-
- must_fail(git_tag_create_lightweight(
- &object_id,
- repo,
- "e90810b",
- target,
- 0));
-
- git_oid_fromstr(&existing_object_id, tag2_id);
- must_be_true(git_oid_cmp(&object_id, &existing_object_id) == 0);
-
- git_object_free(target);
-
- git_repository_free(repo);
-END_TEST
-
-BEGIN_TEST(delete0, "Delete an already existing tag")
- git_repository *repo;
- git_reference *ref_tag;
-
- must_pass(open_temp_repo(&repo, REPOSITORY_FOLDER));
-
- must_pass(git_tag_delete(repo, "e90810b"));
-
- must_fail(git_reference_lookup(&ref_tag, repo, "refs/tags/e90810b"));
-
- close_temp_repo(repo);
-
- git_reference_free(ref_tag);
-END_TEST
-
-BEGIN_SUITE(tag)
- ADD_TEST(read0);
- ADD_TEST(read1);
- ADD_TEST(read2);
- ADD_TEST(read3);
-
- ADD_TEST(write0);
- ADD_TEST(write2);
- ADD_TEST(write3);
- ADD_TEST(write4);
- ADD_TEST(write5);
-
- ADD_TEST(delete0);
-
-END_SUITE
diff --git a/tests/t09-tree.c b/tests/t09-tree.c
deleted file mode 100644
index 8995b45..0000000
--- a/tests/t09-tree.c
+++ /dev/null
@@ -1,221 +0,0 @@
-/*
- * This file is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License, version 2,
- * as published by the Free Software Foundation.
- *
- * In addition to the permissions in the GNU General Public License,
- * the authors give you unlimited permission to link the compiled
- * version of this file into combinations with other programs,
- * and to distribute those combinations without any restriction
- * coming from the use of this file. (The General Public License
- * restrictions do apply in other respects; for example, they cover
- * modification of the file, and distribution when not linked into
- * a combined executable.)
- *
- * This file is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; see the file COPYING. If not, write to
- * the Free Software Foundation, 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-#include "test_lib.h"
-#include "test_helpers.h"
-
-#include "tree.h"
-
-static const char *tree_oid = "1810dff58d8a660512d4832e740f692884338ccd";
-
-static const char *blob_oid = "fa49b077972391ad58037050f2a75f74e3671e92";
-static const char *first_tree = "181037049a54a1eb5fab404658a3a250b44335d7";
-static const char *second_tree = "f60079018b664e4e79329a7ef9559c8d9e0378d1";
-static const char *third_tree = "eb86d8b81d6adbd5290a935d6c9976882de98488";
-
-#if 0
-static int print_tree(git_repository *repo, const git_oid *tree_oid, int depth)
-{
- static const char *indent = " ";
- git_tree *tree;
- unsigned int i;
-
- if (git_tree_lookup(&tree, repo, tree_oid) < GIT_SUCCESS)
- return GIT_ERROR;
-
- for (i = 0; i < git_tree_entrycount(tree); ++i) {
- const git_tree_entry *entry = git_tree_entry_byindex(tree, i);
- char entry_oid[40];
-
- git_oid_fmt(entry_oid, &entry->oid);
- printf("%.*s%o [%.*s] %s\n", depth*2, indent, entry->attr, 40, entry_oid, entry->filename);
-
- if (entry->attr == S_IFDIR) {
- if (print_tree(repo, &entry->oid, depth + 1) < GIT_SUCCESS) {
- git_tree_free(tree);
- return GIT_ERROR;
- }
- }
- }
-
- git_tree_free(tree);
- return GIT_SUCCESS;
-}
-#endif
-
-BEGIN_TEST(read0, "acces randomly the entries on a loaded tree")
- git_oid id;
- git_repository *repo;
- git_tree *tree;
-
- must_pass(git_repository_open(&repo, REPOSITORY_FOLDER));
-
- git_oid_fromstr(&id, tree_oid);
-
- must_pass(git_tree_lookup(&tree, repo, &id));
-
- must_be_true(git_tree_entry_byname(tree, "README") != NULL);
- must_be_true(git_tree_entry_byname(tree, "NOTEXISTS") == NULL);
- must_be_true(git_tree_entry_byname(tree, "") == NULL);
- must_be_true(git_tree_entry_byindex(tree, 0) != NULL);
- must_be_true(git_tree_entry_byindex(tree, 2) != NULL);
- must_be_true(git_tree_entry_byindex(tree, 3) == NULL);
- must_be_true(git_tree_entry_byindex(tree, (unsigned int)-1) == NULL);
-
- git_tree_free(tree);
- git_repository_free(repo);
-END_TEST
-
-BEGIN_TEST(read1, "read a tree from the repository")
- git_oid id;
- git_repository *repo;
- git_tree *tree;
- const git_tree_entry *entry;
- git_object *obj;
-
- must_pass(git_repository_open(&repo, REPOSITORY_FOLDER));
-
- git_oid_fromstr(&id, tree_oid);
-
- must_pass(git_tree_lookup(&tree, repo, &id));
-
- must_be_true(git_tree_entrycount(tree) == 3);
-
- /* GH-86: git_object_lookup() should also check the type if the object comes from the cache */
- must_be_true(git_object_lookup(&obj, repo, &id, GIT_OBJ_TREE) == 0);
- must_be_true(obj != NULL);
- git_object_free(obj);
- obj = NULL;
- must_be_true(git_object_lookup(&obj, repo, &id, GIT_OBJ_BLOB) == GIT_EINVALIDTYPE);
- must_be_true(obj == NULL);
-
- entry = git_tree_entry_byname(tree, "README");
- must_be_true(entry != NULL);
-
- must_be_true(strcmp(git_tree_entry_name(entry), "README") == 0);
-
- must_pass(git_tree_entry_2object(&obj, repo, entry));
- must_be_true(obj != NULL);
-
- git_object_free(obj);
- git_tree_free(tree);
- git_repository_free(repo);
-END_TEST
-
-#if 0
-BEGIN_TEST(write0, "write a tree from an index")
- git_repository *repo;
- git_index *index;
- git_oid tree_oid;
-
- must_pass(git_repository_open(&repo, "/tmp/redtmp/.git"));
- must_pass(git_repository_index(&index, repo));
-
- must_pass(git_tree_create_fromindex(&tree_oid, index));
- must_pass(print_tree(repo, &tree_oid, 0));
-
- git_repository_free(repo);
-END_TEST
-#endif
-
-BEGIN_TEST(write2, "write a tree from a memory")
- git_repository *repo;
- git_treebuilder *builder;
- git_tree *tree;
- git_oid id, bid, rid, id2;
-
- must_pass(open_temp_repo(&repo, REPOSITORY_FOLDER));
- git_oid_fromstr(&id, first_tree);
- git_oid_fromstr(&id2, second_tree);
- git_oid_fromstr(&bid, blob_oid);
-
- //create a second tree from first tree using `git_treebuilder_insert` on REPOSITORY_FOLDER.
- must_pass(git_tree_lookup(&tree, repo, &id));
- must_pass(git_treebuilder_create(&builder, tree));
-
- must_fail(git_treebuilder_insert(NULL, builder, "", &bid, 0100644));
- must_fail(git_treebuilder_insert(NULL, builder, "/", &bid, 0100644));
- must_fail(git_treebuilder_insert(NULL, builder, "folder/new.txt", &bid, 0100644));
-
- must_pass(git_treebuilder_insert(NULL,builder,"new.txt",&bid,0100644));
- must_pass(git_treebuilder_write(&rid,repo,builder));
-
- must_be_true(git_oid_cmp(&rid, &id2) == 0);
-
- git_treebuilder_free(builder);
- git_tree_free(tree);
- close_temp_repo(repo);
-END_TEST
-
-BEGIN_TEST(write3, "write a hierarchical tree from a memory")
- git_repository *repo;
- git_treebuilder *builder;
- git_tree *tree;
- git_oid id, bid, subtree_id, id2, id3;
- git_oid id_hiearar;
-
- must_pass(open_temp_repo(&repo, REPOSITORY_FOLDER));
- git_oid_fromstr(&id, first_tree);
- git_oid_fromstr(&id2, second_tree);
- git_oid_fromstr(&id3, third_tree);
- git_oid_fromstr(&bid, blob_oid);
-
- //create subtree
- must_pass(git_treebuilder_create(&builder, NULL));
- must_pass(git_treebuilder_insert(NULL,builder,"new.txt",&bid,0100644));
- must_pass(git_treebuilder_write(&subtree_id,repo,builder));
- git_treebuilder_free(builder);
-
- // create parent tree
- must_pass(git_tree_lookup(&tree, repo, &id));
- must_pass(git_treebuilder_create(&builder, tree));
- must_pass(git_treebuilder_insert(NULL,builder,"new",&subtree_id,040000));
- must_pass(git_treebuilder_write(&id_hiearar,repo,builder));
- git_treebuilder_free(builder);
- git_tree_free(tree);
-
- must_be_true(git_oid_cmp(&id_hiearar, &id3) == 0);
-
- // check data is correct
- must_pass(git_tree_lookup(&tree, repo, &id_hiearar));
- must_be_true(2 == git_tree_entrycount(tree));
-#ifndef GIT_WIN32
- must_be_true((loose_object_dir_mode(TEMP_REPO_FOLDER, (git_object *)tree) & 0777) == GIT_OBJECT_DIR_MODE);
- must_be_true((loose_object_mode(TEMP_REPO_FOLDER, (git_object *)tree) & 0777) == GIT_OBJECT_FILE_MODE);
-#endif
- git_tree_free(tree);
-
- close_temp_repo(repo);
-
-END_TEST
-
-BEGIN_SUITE(tree)
- //ADD_TEST(print0);
- ADD_TEST(read0);
- ADD_TEST(read1);
- //ADD_TEST(write0);
- //ADD_TEST(write1);
- ADD_TEST(write2);
- ADD_TEST(write3);
-END_SUITE
diff --git a/tests/t10-refs.c b/tests/t10-refs.c
deleted file mode 100644
index afb6d4c..0000000
--- a/tests/t10-refs.c
+++ /dev/null
@@ -1,1338 +0,0 @@
-/*
- * This file is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License, version 2,
- * as published by the Free Software Foundation.
- *
- * In addition to the permissions in the GNU General Public License,
- * the authors give you unlimited permission to link the compiled
- * version of this file into combinations with other programs,
- * and to distribute those combinations without any restriction
- * coming from the use of this file. (The General Public License
- * restrictions do apply in other respects; for example, they cover
- * modification of the file, and distribution when not linked into
- * a combined executable.)
- *
- * This file is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; see the file COPYING. If not, write to
- * the Free Software Foundation, 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-#include "test_lib.h"
-#include "test_helpers.h"
-
-#include "repository.h"
-
-#include "git2/reflog.h"
-#include "reflog.h"
-
-static const char *loose_tag_ref_name = "refs/tags/e90810b";
-static const char *non_existing_tag_ref_name = "refs/tags/i-do-not-exist";
-
-BEGIN_TEST(readtag0, "lookup a loose tag reference")
- git_repository *repo;
- git_reference *reference;
- git_object *object;
- git_buf ref_name_from_tag_name = GIT_BUF_INIT;
-
- must_pass(git_repository_open(&repo, REPOSITORY_FOLDER));
-
- must_pass(git_reference_lookup(&reference, repo, loose_tag_ref_name));
- must_be_true(git_reference_type(reference) & GIT_REF_OID);
- must_be_true(git_reference_is_packed(reference) == 0);
- must_be_true(strcmp(reference->name, loose_tag_ref_name) == 0);
-
- must_pass(git_object_lookup(&object, repo, git_reference_oid(reference), GIT_OBJ_ANY));
- must_be_true(object != NULL);
- must_be_true(git_object_type(object) == GIT_OBJ_TAG);
-
- /* Ensure the name of the tag matches the name of the reference */
- must_pass(git_buf_joinpath(&ref_name_from_tag_name, GIT_REFS_TAGS_DIR, git_tag_name((git_tag *)object)));
- must_be_true(strcmp(ref_name_from_tag_name.ptr, loose_tag_ref_name) == 0);
- git_buf_free(&ref_name_from_tag_name);
-
- git_object_free(object);
- git_repository_free(repo);
-
- git_reference_free(reference);
-END_TEST
-
-BEGIN_TEST(readtag1, "lookup a loose tag reference that doesn't exist")
- git_repository *repo;
- git_reference *reference;
-
- must_pass(git_repository_open(&repo, REPOSITORY_FOLDER));
- must_fail(git_reference_lookup(&reference, repo, non_existing_tag_ref_name));
-
- git_repository_free(repo);
-
- git_reference_free(reference);
-END_TEST
-
-static const char *head_tracker_sym_ref_name = "head-tracker";
-static const char *current_head_target = "refs/heads/master";
-static const char *current_master_tip = "a65fedf39aefe402d3bb6e24df4d4f5fe4547750";
-
-BEGIN_TEST(readsym0, "lookup a symbolic reference")
- git_repository *repo;
- git_reference *reference, *resolved_ref;
- git_object *object;
- git_oid id;
-
- must_pass(git_repository_open(&repo, REPOSITORY_FOLDER));
-
- must_pass(git_reference_lookup(&reference, repo, GIT_HEAD_FILE));
- must_be_true(git_reference_type(reference) & GIT_REF_SYMBOLIC);
- must_be_true(git_reference_is_packed(reference) == 0);
- must_be_true(strcmp(reference->name, GIT_HEAD_FILE) == 0);
-
- must_pass(git_reference_resolve(&resolved_ref, reference));
- must_be_true(git_reference_type(resolved_ref) == GIT_REF_OID);
-
- must_pass(git_object_lookup(&object, repo, git_reference_oid(resolved_ref), GIT_OBJ_ANY));
- must_be_true(object != NULL);
- must_be_true(git_object_type(object) == GIT_OBJ_COMMIT);
-
- git_oid_fromstr(&id, current_master_tip);
- must_be_true(git_oid_cmp(&id, git_object_id(object)) == 0);
-
- git_object_free(object);
- git_repository_free(repo);
-
- git_reference_free(reference);
- git_reference_free(resolved_ref);
-END_TEST
-
-BEGIN_TEST(readsym1, "lookup a nested symbolic reference")
- git_repository *repo;
- git_reference *reference, *resolved_ref;
- git_object *object;
- git_oid id;
-
- must_pass(git_repository_open(&repo, REPOSITORY_FOLDER));
-
- must_pass(git_reference_lookup(&reference, repo, head_tracker_sym_ref_name));
- must_be_true(git_reference_type(reference) & GIT_REF_SYMBOLIC);
- must_be_true(git_reference_is_packed(reference) == 0);
- must_be_true(strcmp(reference->name, head_tracker_sym_ref_name) == 0);
-
- must_pass(git_reference_resolve(&resolved_ref, reference));
- must_be_true(git_reference_type(resolved_ref) == GIT_REF_OID);
-
- must_pass(git_object_lookup(&object, repo, git_reference_oid(resolved_ref), GIT_OBJ_ANY));
- must_be_true(object != NULL);
- must_be_true(git_object_type(object) == GIT_OBJ_COMMIT);
-
- git_oid_fromstr(&id, current_master_tip);
- must_be_true(git_oid_cmp(&id, git_object_id(object)) == 0);
-
- git_object_free(object);
- git_repository_free(repo);
-
- git_reference_free(reference);
- git_reference_free(resolved_ref);
-END_TEST
-
-BEGIN_TEST(readsym2, "lookup the HEAD and resolve the master branch")
- git_repository *repo;
- git_reference *reference, *resolved_ref, *comp_base_ref;
-
- must_pass(git_repository_open(&repo, REPOSITORY_FOLDER));
-
- must_pass(git_reference_lookup(&reference, repo, head_tracker_sym_ref_name));
- must_pass(git_reference_resolve(&comp_base_ref, reference));
- git_reference_free(reference);
-
- must_pass(git_reference_lookup(&reference, repo, GIT_HEAD_FILE));
- must_pass(git_reference_resolve(&resolved_ref, reference));
- must_pass(git_oid_cmp(git_reference_oid(comp_base_ref), git_reference_oid(resolved_ref)));
- git_reference_free(reference);
- git_reference_free(resolved_ref);
-
- must_pass(git_reference_lookup(&reference, repo, current_head_target));
- must_pass(git_reference_resolve(&resolved_ref, reference));
- must_pass(git_oid_cmp(git_reference_oid(comp_base_ref), git_reference_oid(resolved_ref)));
- git_reference_free(reference);
- git_reference_free(resolved_ref);
-
- git_reference_free(comp_base_ref);
- git_repository_free(repo);
-END_TEST
-
-BEGIN_TEST(readsym3, "lookup the master branch and then the HEAD")
- git_repository *repo;
- git_reference *reference, *master_ref, *resolved_ref;
-
- must_pass(git_repository_open(&repo, REPOSITORY_FOLDER));
-
- must_pass(git_reference_lookup(&master_ref, repo, current_head_target));
- must_pass(git_reference_lookup(&reference, repo, GIT_HEAD_FILE));
-
- must_pass(git_reference_resolve(&resolved_ref, reference));
- must_pass(git_oid_cmp(git_reference_oid(master_ref), git_reference_oid(resolved_ref)));
-
- git_repository_free(repo);
-
- git_reference_free(reference);
- git_reference_free(resolved_ref);
- git_reference_free(master_ref);
-END_TEST
-
-static const char *packed_head_name = "refs/heads/packed";
-static const char *packed_test_head_name = "refs/heads/packed-test";
-
-BEGIN_TEST(readpacked0, "lookup a packed reference")
- git_repository *repo;
- git_reference *reference;
- git_object *object;
-
- must_pass(git_repository_open(&repo, REPOSITORY_FOLDER));
-
- must_pass(git_reference_lookup(&reference, repo, packed_head_name));
- must_be_true(git_reference_type(reference) & GIT_REF_OID);
- must_be_true(git_reference_is_packed(reference));
- must_be_true(strcmp(reference->name, packed_head_name) == 0);
-
- must_pass(git_object_lookup(&object, repo, git_reference_oid(reference), GIT_OBJ_ANY));
- must_be_true(object != NULL);
- must_be_true(git_object_type(object) == GIT_OBJ_COMMIT);
-
- git_object_free(object);
- git_repository_free(repo);
-
- git_reference_free(reference);
-END_TEST
-
-BEGIN_TEST(readpacked1, "assure that a loose reference is looked up before a packed reference")
- git_repository *repo;
- git_reference *reference;
-
- must_pass(git_repository_open(&repo, REPOSITORY_FOLDER));
- must_pass(git_reference_lookup(&reference, repo, packed_head_name));
- git_reference_free(reference);
- must_pass(git_reference_lookup(&reference, repo, packed_test_head_name));
- must_be_true(git_reference_type(reference) & GIT_REF_OID);
- must_be_true(git_reference_is_packed(reference) == 0);
- must_be_true(strcmp(reference->name, packed_test_head_name) == 0);
-
- git_repository_free(repo);
-
- git_reference_free(reference);
-END_TEST
-
-BEGIN_TEST(create0, "create a new symbolic reference")
- git_reference *new_reference, *looked_up_ref, *resolved_ref;
- git_repository *repo, *repo2;
- git_oid id;
- git_buf ref_path = GIT_BUF_INIT;
-
- const char *new_head_tracker = "another-head-tracker";
-
- git_oid_fromstr(&id, current_master_tip);
-
- must_pass(open_temp_repo(&repo, REPOSITORY_FOLDER));
-
- /* Retrieve the physical path to the symbolic ref for further cleaning */
- must_pass(git_buf_joinpath(&ref_path, repo->path_repository, new_head_tracker));
- git_buf_free(&ref_path);
-
- /* Create and write the new symbolic reference */
- must_pass(git_reference_create_symbolic(&new_reference, repo, new_head_tracker, current_head_target, 0));
-
- /* Ensure the reference can be looked-up... */
- must_pass(git_reference_lookup(&looked_up_ref, repo, new_head_tracker));
- must_be_true(git_reference_type(looked_up_ref) & GIT_REF_SYMBOLIC);
- must_be_true(git_reference_is_packed(looked_up_ref) == 0);
- must_be_true(strcmp(looked_up_ref->name, new_head_tracker) == 0);
-
- /* ...peeled.. */
- must_pass(git_reference_resolve(&resolved_ref, looked_up_ref));
- must_be_true(git_reference_type(resolved_ref) == GIT_REF_OID);
-
- /* ...and that it points to the current master tip */
- must_be_true(git_oid_cmp(&id, git_reference_oid(resolved_ref)) == 0);
- git_reference_free(looked_up_ref);
- git_reference_free(resolved_ref);
-
- git_repository_free(repo);
-
- /* Similar test with a fresh new repository */
- must_pass(git_repository_open(&repo2, TEMP_REPO_FOLDER));
-
- must_pass(git_reference_lookup(&looked_up_ref, repo2, new_head_tracker));
- must_pass(git_reference_resolve(&resolved_ref, looked_up_ref));
- must_be_true(git_oid_cmp(&id, git_reference_oid(resolved_ref)) == 0);
-
- close_temp_repo(repo2);
-
- git_reference_free(new_reference);
- git_reference_free(looked_up_ref);
- git_reference_free(resolved_ref);
-END_TEST
-
-BEGIN_TEST(create1, "create a deep symbolic reference")
- git_reference *new_reference, *looked_up_ref, *resolved_ref;
- git_repository *repo;
- git_oid id;
- git_buf ref_path = GIT_BUF_INIT;
-
- const char *new_head_tracker = "deep/rooted/tracker";
-
- git_oid_fromstr(&id, current_master_tip);
-
- must_pass(open_temp_repo(&repo, REPOSITORY_FOLDER));
-
- must_pass(git_buf_joinpath(&ref_path, repo->path_repository, new_head_tracker));
- must_pass(git_reference_create_symbolic(&new_reference, repo, new_head_tracker, current_head_target, 0));
- must_pass(git_reference_lookup(&looked_up_ref, repo, new_head_tracker));
- must_pass(git_reference_resolve(&resolved_ref, looked_up_ref));
- must_be_true(git_oid_cmp(&id, git_reference_oid(resolved_ref)) == 0);
-
- close_temp_repo(repo);
-
- git_reference_free(new_reference);
- git_reference_free(looked_up_ref);
- git_reference_free(resolved_ref);
- git_buf_free(&ref_path);
-END_TEST
-
-BEGIN_TEST(create2, "create a new OID reference")
- git_reference *new_reference, *looked_up_ref;
- git_repository *repo, *repo2;
- git_oid id;
- git_buf ref_path = GIT_BUF_INIT;
-
- const char *new_head = "refs/heads/new-head";
-
- git_oid_fromstr(&id, current_master_tip);
-
- must_pass(open_temp_repo(&repo, REPOSITORY_FOLDER));
-
- /* Retrieve the physical path to the symbolic ref for further cleaning */
- must_pass(git_buf_joinpath(&ref_path, repo->path_repository, new_head));
-
- /* Create and write the new object id reference */
- must_pass(git_reference_create_oid(&new_reference, repo, new_head, &id, 0));
-
- /* Ensure the reference can be looked-up... */
- must_pass(git_reference_lookup(&looked_up_ref, repo, new_head));
- must_be_true(git_reference_type(looked_up_ref) & GIT_REF_OID);
- must_be_true(git_reference_is_packed(looked_up_ref) == 0);
- must_be_true(strcmp(looked_up_ref->name, new_head) == 0);
-
- /* ...and that it points to the current master tip */
- must_be_true(git_oid_cmp(&id, git_reference_oid(looked_up_ref)) == 0);
- git_reference_free(looked_up_ref);
-
- git_repository_free(repo);
-
- /* Similar test with a fresh new repository */
- must_pass(git_repository_open(&repo2, TEMP_REPO_FOLDER));
-
- must_pass(git_reference_lookup(&looked_up_ref, repo2, new_head));
- must_be_true(git_oid_cmp(&id, git_reference_oid(looked_up_ref)) == 0);
-
- close_temp_repo(repo2);
-
- git_reference_free(new_reference);
- git_reference_free(looked_up_ref);
- git_buf_free(&ref_path);
-END_TEST
-
-BEGIN_TEST(create3, "Can not create a new OID reference which targets at an unknown id")
- git_reference *new_reference, *looked_up_ref;
- git_repository *repo;
- git_oid id;
-
- const char *new_head = "refs/heads/new-head";
-
- git_oid_fromstr(&id, "deadbeef3f795b2b4353bcce3a527ad0a4f7f644");
-
- must_pass(git_repository_open(&repo, REPOSITORY_FOLDER));
-
- /* Create and write the new object id reference */
- must_fail(git_reference_create_oid(&new_reference, repo, new_head, &id, 0));
-
- /* Ensure the reference can't be looked-up... */
- must_fail(git_reference_lookup(&looked_up_ref, repo, new_head));
-
- git_repository_free(repo);
-END_TEST
-
-static const char *ref_name = "refs/heads/other";
-static const char *ref_master_name = "refs/heads/master";
-static const char *ref_branch_name = "refs/heads/branch";
-static const char *ref_test_name = "refs/heads/test";
-BEGIN_TEST(overwrite0, "Overwrite an existing symbolic reference")
- git_reference *ref, *branch_ref;
- git_repository *repo;
-
- must_pass(open_temp_repo(&repo, REPOSITORY_FOLDER));
-
- /* The target needds to exist and we need to check the name has changed */
- must_pass(git_reference_create_symbolic(&branch_ref, repo, ref_branch_name, ref_master_name, 0));
- must_pass(git_reference_create_symbolic(&ref, repo, ref_name, ref_branch_name, 0));
- git_reference_free(ref);
-
- /* Ensure it points to the right place*/
- must_pass(git_reference_lookup(&ref, repo, ref_name));
- must_be_true(git_reference_type(ref) & GIT_REF_SYMBOLIC);
- must_be_true(!strcmp(git_reference_target(ref), ref_branch_name));
- git_reference_free(ref);
-
- /* Ensure we can't create it unless we force it to */
- must_fail(git_reference_create_symbolic(&ref, repo, ref_name, ref_master_name, 0));
- must_pass(git_reference_create_symbolic(&ref, repo, ref_name, ref_master_name, 1));
- git_reference_free(ref);
-
- /* Ensure it points to the right place */
- must_pass(git_reference_lookup(&ref, repo, ref_name));
- must_be_true(git_reference_type(ref) & GIT_REF_SYMBOLIC);
- must_be_true(!strcmp(git_reference_target(ref), ref_master_name));
-
- close_temp_repo(repo);
-
- git_reference_free(ref);
- git_reference_free(branch_ref);
-END_TEST
-
-BEGIN_TEST(overwrite1, "Overwrite an existing object id reference")
- git_reference *ref;
- git_repository *repo;
- git_oid id;
-
- must_pass(open_temp_repo(&repo, REPOSITORY_FOLDER));
-
- must_pass(git_reference_lookup(&ref, repo, ref_master_name));
- must_be_true(git_reference_type(ref) & GIT_REF_OID);
- git_oid_cpy(&id, git_reference_oid(ref));
- git_reference_free(ref);
-
- /* Create it */
- must_pass(git_reference_create_oid(&ref, repo, ref_name, &id, 0));
- git_reference_free(ref);
-
- must_pass(git_reference_lookup(&ref, repo, ref_test_name));
- must_be_true(git_reference_type(ref) & GIT_REF_OID);
- git_oid_cpy(&id, git_reference_oid(ref));
- git_reference_free(ref);
-
- /* Ensure we can't overwrite unless we force it */
- must_fail(git_reference_create_oid(&ref, repo, ref_name, &id, 0));
- must_pass(git_reference_create_oid(&ref, repo, ref_name, &id, 1));
- git_reference_free(ref);
-
- /* Ensure it has been overwritten */
- must_pass(git_reference_lookup(&ref, repo, ref_name));
- must_be_true(!git_oid_cmp(&id, git_reference_oid(ref)));
-
- close_temp_repo(repo);
-
- git_reference_free(ref);
-END_TEST
-
-BEGIN_TEST(overwrite2, "Overwrite an existing object id reference with a symbolic one")
- git_reference *ref;
- git_repository *repo;
- git_oid id;
-
- must_pass(open_temp_repo(&repo, REPOSITORY_FOLDER));
-
- must_pass(git_reference_lookup(&ref, repo, ref_master_name));
- must_be_true(git_reference_type(ref) & GIT_REF_OID);
- git_oid_cpy(&id, git_reference_oid(ref));
- git_reference_free(ref);
-
- must_pass(git_reference_create_oid(&ref, repo, ref_name, &id, 0));
- git_reference_free(ref);
- must_fail(git_reference_create_symbolic(&ref, repo, ref_name, ref_master_name, 0));
- must_pass(git_reference_create_symbolic(&ref, repo, ref_name, ref_master_name, 1));
- git_reference_free(ref);
-
- /* Ensure it points to the right place */
- must_pass(git_reference_lookup(&ref, repo, ref_name));
- must_be_true(git_reference_type(ref) & GIT_REF_SYMBOLIC);
- must_be_true(!strcmp(git_reference_target(ref), ref_master_name));
-
- close_temp_repo(repo);
-
- git_reference_free(ref);
-END_TEST
-
-BEGIN_TEST(overwrite3, "Overwrite an existing symbolic reference with an object id one")
- git_reference *ref;
- git_repository *repo;
- git_oid id;
-
- must_pass(open_temp_repo(&repo, REPOSITORY_FOLDER));
-
- must_pass(git_reference_lookup(&ref, repo, ref_master_name));
- must_be_true(git_reference_type(ref) & GIT_REF_OID);
- git_oid_cpy(&id, git_reference_oid(ref));
- git_reference_free(ref);
-
- /* Create the symbolic ref */
- must_pass(git_reference_create_symbolic(&ref, repo, ref_name, ref_master_name, 0));
- git_reference_free(ref);
- /* It shouldn't overwrite unless we tell it to */
- must_fail(git_reference_create_oid(&ref, repo, ref_name, &id, 0));
- must_pass(git_reference_create_oid(&ref, repo, ref_name, &id, 1));
- git_reference_free(ref);
-
- /* Ensure it points to the right place */
- must_pass(git_reference_lookup(&ref, repo, ref_name));
- must_be_true(git_reference_type(ref) & GIT_REF_OID);
- must_be_true(!git_oid_cmp(git_reference_oid(ref), &id));
-
- close_temp_repo(repo);
-
- git_reference_free(ref);
-END_TEST
-
-BEGIN_TEST(pack0, "create a packfile for an empty folder")
- git_repository *repo;
- git_buf temp_path = GIT_BUF_INIT;
-
- must_pass(open_temp_repo(&repo, REPOSITORY_FOLDER));
-
- must_pass(git_buf_join_n(&temp_path, '/', 3, repo->path_repository, GIT_REFS_HEADS_DIR, "empty_dir"));
- must_pass(git_futils_mkdir_r(temp_path.ptr, NULL, GIT_REFS_DIR_MODE));
- git_buf_free(&temp_path);
-
- must_pass(git_reference_packall(repo));
-
- close_temp_repo(repo);
-END_TEST
-
-BEGIN_TEST(pack1, "create a packfile from all the loose rn a repo")
- git_repository *repo;
- git_reference *reference;
- git_buf temp_path = GIT_BUF_INIT;
-
- must_pass(open_temp_repo(&repo, REPOSITORY_FOLDER));
-
- /* Ensure a known loose ref can be looked up */
- must_pass(git_reference_lookup(&reference, repo, loose_tag_ref_name));
- must_be_true(git_reference_is_packed(reference) == 0);
- must_be_true(strcmp(reference->name, loose_tag_ref_name) == 0);
- git_reference_free(reference);
-
- /*
- * We are now trying to pack also a loose reference
- * called `points_to_blob`, to make sure we can properly
- * pack weak tags
- */
- must_pass(git_reference_packall(repo));
-
- /* Ensure the packed-refs file exists */
- must_pass(git_buf_joinpath(&temp_path, repo->path_repository, GIT_PACKEDREFS_FILE));
- must_pass(git_path_exists(temp_path.ptr));
-
- /* Ensure the known ref can still be looked up but is now packed */
- must_pass(git_reference_lookup(&reference, repo, loose_tag_ref_name));
- must_be_true(git_reference_is_packed(reference));
- must_be_true(strcmp(reference->name, loose_tag_ref_name) == 0);
-
- /* Ensure the known ref has been removed from the loose folder structure */
- must_pass(git_buf_joinpath(&temp_path, repo->path_repository, loose_tag_ref_name));
- must_pass(!git_path_exists(temp_path.ptr));
-
- close_temp_repo(repo);
-
- git_reference_free(reference);
- git_buf_free(&temp_path);
-END_TEST
-
-BEGIN_TEST(rename0, "rename a loose reference")
- git_reference *looked_up_ref, *another_looked_up_ref;
- git_repository *repo;
- git_buf temp_path = GIT_BUF_INIT;
- const char *new_name = "refs/tags/Nemo/knows/refs.kung-fu";
-
- must_pass(open_temp_repo(&repo, REPOSITORY_FOLDER));
-
- /* Ensure the ref doesn't exist on the file system */
- must_pass(git_buf_joinpath(&temp_path, repo->path_repository, new_name));
- must_pass(!git_path_exists(temp_path.ptr));
-
- /* Retrieval of the reference to rename */
- must_pass(git_reference_lookup(&looked_up_ref, repo, loose_tag_ref_name));
-
- /* ... which is indeed loose */
- must_be_true(git_reference_is_packed(looked_up_ref) == 0);
-
- /* Now that the reference is renamed... */
- must_pass(git_reference_rename(looked_up_ref, new_name, 0));
- must_be_true(!strcmp(looked_up_ref->name, new_name));
-
- /* ...It can't be looked-up with the old name... */
- must_fail(git_reference_lookup(&another_looked_up_ref, repo, loose_tag_ref_name));
-
- /* ...but the new name works ok... */
- must_pass(git_reference_lookup(&another_looked_up_ref, repo, new_name));
- must_be_true(!strcmp(another_looked_up_ref->name, new_name));
-
- /* .. the ref is still loose... */
- must_be_true(git_reference_is_packed(another_looked_up_ref) == 0);
- must_be_true(git_reference_is_packed(looked_up_ref) == 0);
-
- /* ...and the ref can be found in the file system */
- must_pass(git_buf_joinpath(&temp_path, repo->path_repository, new_name));
- must_pass(git_path_exists(temp_path.ptr));
-
- close_temp_repo(repo);
-
- git_reference_free(looked_up_ref);
- git_reference_free(another_looked_up_ref);
- git_buf_free(&temp_path);
-END_TEST
-
-BEGIN_TEST(rename1, "rename a packed reference (should make it loose)")
- git_reference *looked_up_ref, *another_looked_up_ref;
- git_repository *repo;
- git_buf temp_path = GIT_BUF_INIT;
- const char *brand_new_name = "refs/heads/brand_new_name";
-
- must_pass(open_temp_repo(&repo, REPOSITORY_FOLDER));
-
- /* Ensure the ref doesn't exist on the file system */
- must_pass(git_buf_joinpath(&temp_path, repo->path_repository, packed_head_name));
- must_pass(!git_path_exists(temp_path.ptr));
-
- /* The reference can however be looked-up... */
- must_pass(git_reference_lookup(&looked_up_ref, repo, packed_head_name));
-
- /* .. and it's packed */
- must_be_true(git_reference_is_packed(looked_up_ref) != 0);
-
- /* Now that the reference is renamed... */
- must_pass(git_reference_rename(looked_up_ref, brand_new_name, 0));
- must_be_true(!strcmp(looked_up_ref->name, brand_new_name));
-
- /* ...It can't be looked-up with the old name... */
- must_fail(git_reference_lookup(&another_looked_up_ref, repo, packed_head_name));
-
- /* ...but the new name works ok... */
- must_pass(git_reference_lookup(&another_looked_up_ref, repo, brand_new_name));
- must_be_true(!strcmp(another_looked_up_ref->name, brand_new_name));
-
- /* .. the ref is no longer packed... */
- must_be_true(git_reference_is_packed(another_looked_up_ref) == 0);
- must_be_true(git_reference_is_packed(looked_up_ref) == 0);
-
- /* ...and the ref now happily lives in the file system */
- must_pass(git_buf_joinpath(&temp_path, repo->path_repository, brand_new_name));
- must_pass(git_path_exists(temp_path.ptr));
-
- close_temp_repo(repo);
-
- git_reference_free(looked_up_ref);
- git_reference_free(another_looked_up_ref);
- git_buf_free(&temp_path);
-END_TEST
-
-BEGIN_TEST(rename2, "renaming a packed reference does not pack another reference which happens to be in both loose and pack state")
- git_reference *looked_up_ref, *another_looked_up_ref;
- git_repository *repo;
- git_buf temp_path = GIT_BUF_INIT;
- const char *brand_new_name = "refs/heads/brand_new_name";
-
- must_pass(open_temp_repo(&repo, REPOSITORY_FOLDER));
-
- /* Ensure the other reference exists on the file system */
- must_pass(git_buf_joinpath(&temp_path, repo->path_repository, packed_test_head_name));
- must_pass(git_path_exists(temp_path.ptr));
-
- /* Lookup the other reference */
- must_pass(git_reference_lookup(&another_looked_up_ref, repo, packed_test_head_name));
-
- /* Ensure it's loose */
- must_be_true(git_reference_is_packed(another_looked_up_ref) == 0);
- git_reference_free(another_looked_up_ref);
-
- /* Lookup the reference to rename */
- must_pass(git_reference_lookup(&looked_up_ref, repo, packed_head_name));
-
- /* Ensure it's packed */
- must_be_true(git_reference_is_packed(looked_up_ref) != 0);
-
- /* Now that the reference is renamed... */
- must_pass(git_reference_rename(looked_up_ref, brand_new_name, 0));
-
- /* Lookup the other reference */
- must_pass(git_reference_lookup(&another_looked_up_ref, repo, packed_test_head_name));
-
- /* Ensure it's loose */
- must_be_true(git_reference_is_packed(another_looked_up_ref) == 0);
-
- /* Ensure the other ref still exists on the file system */
- must_pass(git_path_exists(temp_path.ptr));
-
- close_temp_repo(repo);
-
- git_reference_free(looked_up_ref);
- git_reference_free(another_looked_up_ref);
- git_buf_free(&temp_path);
-END_TEST
-
-BEGIN_TEST(rename3, "can not rename a reference with the name of an existing reference")
- git_reference *looked_up_ref;
- git_repository *repo;
-
- must_pass(open_temp_repo(&repo, REPOSITORY_FOLDER));
-
- /* An existing reference... */
- must_pass(git_reference_lookup(&looked_up_ref, repo, packed_head_name));
-
- /* Can not be renamed to the name of another existing reference. */
- must_fail(git_reference_rename(looked_up_ref, packed_test_head_name, 0));
- git_reference_free(looked_up_ref);
-
- /* Failure to rename it hasn't corrupted its state */
- must_pass(git_reference_lookup(&looked_up_ref, repo, packed_head_name));
- must_be_true(!strcmp(looked_up_ref->name, packed_head_name));
-
- close_temp_repo(repo);
-
- git_reference_free(looked_up_ref);
-END_TEST
-
-BEGIN_TEST(rename4, "can not rename a reference with an invalid name")
- git_reference *looked_up_ref;
- git_repository *repo;
-
- must_pass(open_temp_repo(&repo, REPOSITORY_FOLDER));
-
- /* An existing oid reference... */
- must_pass(git_reference_lookup(&looked_up_ref, repo, packed_test_head_name));
-
- /* Can not be renamed with an invalid name. */
- must_fail(git_reference_rename(looked_up_ref, "Hello! I'm a very invalid name.", 0));
-
- /* Can not be renamed outside of the refs hierarchy. */
- must_fail(git_reference_rename(looked_up_ref, "i-will-sudo-you", 0));
-
- /* Failure to rename it hasn't corrupted its state */
- git_reference_free(looked_up_ref);
- must_pass(git_reference_lookup(&looked_up_ref, repo, packed_test_head_name));
- must_be_true(!strcmp(looked_up_ref->name, packed_test_head_name));
-
- close_temp_repo(repo);
-
- git_reference_free(looked_up_ref);
-END_TEST
-
-BEGIN_TEST(rename5, "can force-rename a packed reference with the name of an existing loose and packed reference")
- git_reference *looked_up_ref;
- git_repository *repo;
- git_oid oid;
-
- must_pass(open_temp_repo(&repo, REPOSITORY_FOLDER));
-
- /* An existing reference... */
- must_pass(git_reference_lookup(&looked_up_ref, repo, packed_head_name));
- git_oid_cpy(&oid, git_reference_oid(looked_up_ref));
-
- /* Can be force-renamed to the name of another existing reference. */
- must_pass(git_reference_rename(looked_up_ref, packed_test_head_name, 1));
- git_reference_free(looked_up_ref);
-
- /* Check we actually renamed it */
- must_pass(git_reference_lookup(&looked_up_ref, repo, packed_test_head_name));
- must_be_true(!strcmp(looked_up_ref->name, packed_test_head_name));
- must_be_true(!git_oid_cmp(&oid, git_reference_oid(looked_up_ref)));
- git_reference_free(looked_up_ref);
-
- /* And that the previous one doesn't exist any longer */
- must_fail(git_reference_lookup(&looked_up_ref, repo, packed_head_name));
-
- close_temp_repo(repo);
-END_TEST
-
-BEGIN_TEST(rename6, "can force-rename a loose reference with the name of an existing loose reference")
- git_reference *looked_up_ref;
- git_repository *repo;
- git_oid oid;
-
- must_pass(open_temp_repo(&repo, REPOSITORY_FOLDER));
-
- /* An existing reference... */
- must_pass(git_reference_lookup(&looked_up_ref, repo, "refs/heads/br2"));
- git_oid_cpy(&oid, git_reference_oid(looked_up_ref));
-
- /* Can be force-renamed to the name of another existing reference. */
-must_pass(git_reference_rename(looked_up_ref, "refs/heads/test", 1));
- git_reference_free(looked_up_ref);
-
- /* Check we actually renamed it */
- must_pass(git_reference_lookup(&looked_up_ref, repo, "refs/heads/test"));
- must_be_true(!strcmp(looked_up_ref->name, "refs/heads/test"));
- must_be_true(!git_oid_cmp(&oid, git_reference_oid(looked_up_ref)));
- git_reference_free(looked_up_ref);
-
- /* And that the previous one doesn't exist any longer */
- must_fail(git_reference_lookup(&looked_up_ref, repo, "refs/heads/br2"));
-
- close_temp_repo(repo);
-
- git_reference_free(looked_up_ref);
-END_TEST
-
-static const char *ref_one_name = "refs/heads/one/branch";
-static const char *ref_one_name_new = "refs/heads/two/branch";
-static const char *ref_two_name = "refs/heads/two";
-
-BEGIN_TEST(rename7, "can not overwrite name of existing reference")
- git_reference *ref, *ref_one, *ref_one_new, *ref_two;
- git_repository *repo;
- git_oid id;
-
- must_pass(open_temp_repo(&repo, REPOSITORY_FOLDER));
-
- must_pass(git_reference_lookup(&ref, repo, ref_master_name));
- must_be_true(git_reference_type(ref) & GIT_REF_OID);
-
- git_oid_cpy(&id, git_reference_oid(ref));
-
- /* Create loose references */
- must_pass(git_reference_create_oid(&ref_one, repo, ref_one_name, &id, 0));
- must_pass(git_reference_create_oid(&ref_two, repo, ref_two_name, &id, 0));
-
- /* Pack everything */
- must_pass(git_reference_packall(repo));
-
- /* Attempt to create illegal reference */
- must_fail(git_reference_create_oid(&ref_one_new, repo, ref_one_name_new, &id, 0));
-
- /* Illegal reference couldn't be created so this is supposed to fail */
- must_fail(git_reference_lookup(&ref_one_new, repo, ref_one_name_new));
-
- close_temp_repo(repo);
-
- git_reference_free(ref);
- git_reference_free(ref_one);
- git_reference_free(ref_one_new);
- git_reference_free(ref_two);
-END_TEST
-
-static const char *ref_two_name_new = "refs/heads/two/two";
-
-BEGIN_TEST(rename8, "can be renamed to a new name prefixed with the old name")
- git_reference *ref, *ref_two, *looked_up_ref;
- git_repository *repo;
- git_oid id;
-
- must_pass(open_temp_repo(&repo, REPOSITORY_FOLDER));
-
- must_pass(git_reference_lookup(&ref, repo, ref_master_name));
- must_be_true(git_reference_type(ref) & GIT_REF_OID);
-
- git_oid_cpy(&id, git_reference_oid(ref));
-
- /* Create loose references */
- must_pass(git_reference_create_oid(&ref_two, repo, ref_two_name, &id, 0));
-
- /* An existing reference... */
- must_pass(git_reference_lookup(&looked_up_ref, repo, ref_two_name));
-
- /* Can be rename to a new name starting with the old name. */
- must_pass(git_reference_rename(looked_up_ref, ref_two_name_new, 0));
- git_reference_free(looked_up_ref);
-
- /* Check we actually renamed it */
- must_pass(git_reference_lookup(&looked_up_ref, repo, ref_two_name_new));
- must_be_true(!strcmp(looked_up_ref->name, ref_two_name_new));
- git_reference_free(looked_up_ref);
- must_fail(git_reference_lookup(&looked_up_ref, repo, ref_two_name));
-
- close_temp_repo(repo);
-
- git_reference_free(ref);
- git_reference_free(ref_two);
- git_reference_free(looked_up_ref);
-END_TEST
-
-BEGIN_TEST(rename9, "can move a reference to a upper reference hierarchy")
- git_reference *ref, *ref_two, *looked_up_ref;
- git_repository *repo;
- git_oid id;
-
- must_pass(open_temp_repo(&repo, REPOSITORY_FOLDER));
-
- must_pass(git_reference_lookup(&ref, repo, ref_master_name));
- must_be_true(git_reference_type(ref) & GIT_REF_OID);
-
- git_oid_cpy(&id, git_reference_oid(ref));
-
- /* Create loose references */
- must_pass(git_reference_create_oid(&ref_two, repo, ref_two_name_new, &id, 0));
- git_reference_free(ref_two);
-
- /* An existing reference... */
- must_pass(git_reference_lookup(&looked_up_ref, repo, ref_two_name_new));
-
- /* Can be renamed upward the reference tree. */
- must_pass(git_reference_rename(looked_up_ref, ref_two_name, 0));
- git_reference_free(looked_up_ref);
-
- /* Check we actually renamed it */
- must_pass(git_reference_lookup(&looked_up_ref, repo, ref_two_name));
- must_be_true(!strcmp(looked_up_ref->name, ref_two_name));
- git_reference_free(looked_up_ref);
- must_fail(git_reference_lookup(&looked_up_ref, repo, ref_two_name_new));
- git_reference_free(ref);
- git_reference_free(looked_up_ref);
-
- close_temp_repo(repo);
-END_TEST
-
-BEGIN_TEST(delete0, "deleting a ref which is both packed and loose should remove both tracks in the filesystem")
- git_reference *looked_up_ref, *another_looked_up_ref;
- git_repository *repo;
- git_buf temp_path = GIT_BUF_INIT;
-
- must_pass(open_temp_repo(&repo, REPOSITORY_FOLDER));
-
- /* Ensure the loose reference exists on the file system */
- must_pass(git_buf_joinpath(&temp_path, repo->path_repository, packed_test_head_name));
- must_pass(git_path_exists(temp_path.ptr));
-
- /* Lookup the reference */
- must_pass(git_reference_lookup(&looked_up_ref, repo, packed_test_head_name));
-
- /* Ensure it's the loose version that has been found */
- must_be_true(git_reference_is_packed(looked_up_ref) == 0);
-
- /* Now that the reference is deleted... */
- must_pass(git_reference_delete(looked_up_ref));
-
- /* Looking up the reference once again should not retrieve it */
- must_fail(git_reference_lookup(&another_looked_up_ref, repo, packed_test_head_name));
-
- /* Ensure the loose reference doesn't exist any longer on the file system */
- must_pass(!git_path_exists(temp_path.ptr));
-
- close_temp_repo(repo);
-
- git_reference_free(another_looked_up_ref);
- git_buf_free(&temp_path);
-END_TEST
-
-BEGIN_TEST(delete1, "can delete a just packed reference")
- git_reference *ref;
- git_repository *repo;
- git_oid id;
- const char *new_ref = "refs/heads/new_ref";
-
- git_oid_fromstr(&id, current_master_tip);
-
- must_pass(open_temp_repo(&repo, REPOSITORY_FOLDER));
-
- /* Create and write the new object id reference */
- must_pass(git_reference_create_oid(&ref, repo, new_ref, &id, 0));
- git_reference_free(ref);
-
- /* Lookup the reference */
- must_pass(git_reference_lookup(&ref, repo, new_ref));
-
- /* Ensure it's a loose reference */
- must_be_true(git_reference_is_packed(ref) == 0);
-
- /* Pack all existing references */
- must_pass(git_reference_packall(repo));
-
- /* Reload the reference from disk */
- must_pass(git_reference_reload(ref));
-
- /* Ensure it's a packed reference */
- must_be_true(git_reference_is_packed(ref) == 1);
-
- /* This should pass */
- must_pass(git_reference_delete(ref));
-
- close_temp_repo(repo);
-END_TEST
-
-static int ensure_refname_normalized(int is_oid_ref, const char *input_refname, const char *expected_refname)
-{
- int error = GIT_SUCCESS;
- char buffer_out[GIT_REFNAME_MAX];
-
- if (is_oid_ref)
- error = git_reference__normalize_name_oid(buffer_out, sizeof(buffer_out), input_refname);
- else
- error = git_reference__normalize_name(buffer_out, sizeof(buffer_out), input_refname);
-
- if (error < GIT_SUCCESS)
- return error;
-
- if (expected_refname == NULL)
- return error;
-
- if (strcmp(buffer_out, expected_refname))
- error = GIT_ERROR;
-
- return error;
-}
-
-#define OID_REF 1
-#define SYM_REF 0
-
-BEGIN_TEST(normalize0, "normalize a direct (OID) reference name")
- must_fail(ensure_refname_normalized(OID_REF, "a", NULL));
- must_fail(ensure_refname_normalized(OID_REF, "", NULL));
- must_fail(ensure_refname_normalized(OID_REF, "refs/heads/a/", NULL));
- must_fail(ensure_refname_normalized(OID_REF, "refs/heads/a.", NULL));
- must_fail(ensure_refname_normalized(OID_REF, "refs/heads/a.lock", NULL));
- must_pass(ensure_refname_normalized(OID_REF, "refs/dummy/a", NULL));
- must_pass(ensure_refname_normalized(OID_REF, "refs/stash", NULL));
- must_pass(ensure_refname_normalized(OID_REF, "refs/tags/a", "refs/tags/a"));
- must_pass(ensure_refname_normalized(OID_REF, "refs/heads/a/b", "refs/heads/a/b"));
- must_pass(ensure_refname_normalized(OID_REF, "refs/heads/a./b", "refs/heads/a./b"));
- must_fail(ensure_refname_normalized(OID_REF, "refs/heads/foo?bar", NULL));
- must_fail(ensure_refname_normalized(OID_REF, "refs/heads\foo", NULL));
- must_pass(ensure_refname_normalized(OID_REF, "refs/heads/v@ation", "refs/heads/v@ation"));
- must_pass(ensure_refname_normalized(OID_REF, "refs///heads///a", "refs/heads/a"));
- must_fail(ensure_refname_normalized(OID_REF, "refs/heads/.a/b", NULL));
- must_fail(ensure_refname_normalized(OID_REF, "refs/heads/foo/../bar", NULL));
- must_fail(ensure_refname_normalized(OID_REF, "refs/heads/foo..bar", NULL));
- must_fail(ensure_refname_normalized(OID_REF, "refs/heads/./foo", NULL));
- must_fail(ensure_refname_normalized(OID_REF, "refs/heads/v@{ation", NULL));
-END_TEST
-
-BEGIN_TEST(normalize1, "normalize a symbolic reference name")
- must_pass(ensure_refname_normalized(SYM_REF, "a", "a"));
- must_pass(ensure_refname_normalized(SYM_REF, "a/b", "a/b"));
- must_pass(ensure_refname_normalized(SYM_REF, "refs///heads///a", "refs/heads/a"));
- must_fail(ensure_refname_normalized(SYM_REF, "", NULL));
- must_fail(ensure_refname_normalized(SYM_REF, "heads\foo", NULL));
-END_TEST
-
-/* Ported from JGit, BSD licence.
- * See https://github.com/spearce/JGit/commit/e4bf8f6957bbb29362575d641d1e77a02d906739 */
-BEGIN_TEST(normalize2, "tests borrowed from JGit")
-
-/* EmptyString */
- must_fail(ensure_refname_normalized(SYM_REF, "", NULL));
- must_fail(ensure_refname_normalized(SYM_REF, "/", NULL));
-
-/* MustHaveTwoComponents */
- must_fail(ensure_refname_normalized(OID_REF, "master", NULL));
- must_pass(ensure_refname_normalized(SYM_REF, "heads/master", "heads/master"));
-
-/* ValidHead */
-
- must_pass(ensure_refname_normalized(SYM_REF, "refs/heads/master", "refs/heads/master"));
- must_pass(ensure_refname_normalized(SYM_REF, "refs/heads/pu", "refs/heads/pu"));
- must_pass(ensure_refname_normalized(SYM_REF, "refs/heads/z", "refs/heads/z"));
- must_pass(ensure_refname_normalized(SYM_REF, "refs/heads/FoO", "refs/heads/FoO"));
-
-/* ValidTag */
- must_pass(ensure_refname_normalized(SYM_REF, "refs/tags/v1.0", "refs/tags/v1.0"));
-
-/* NoLockSuffix */
- must_fail(ensure_refname_normalized(SYM_REF, "refs/heads/master.lock", NULL));
-
-/* NoDirectorySuffix */
- must_fail(ensure_refname_normalized(SYM_REF, "refs/heads/master/", NULL));
-
-/* NoSpace */
- must_fail(ensure_refname_normalized(SYM_REF, "refs/heads/i haz space", NULL));
-
-/* NoAsciiControlCharacters */
- {
- char c;
- char buffer[GIT_REFNAME_MAX];
- for (c = '\1'; c < ' '; c++) {
- strncpy(buffer, "refs/heads/mast", 15);
- strncpy(buffer + 15, (const char *)&c, 1);
- strncpy(buffer + 16, "er", 2);
- buffer[18 - 1] = '\0';
- must_fail(ensure_refname_normalized(SYM_REF, buffer, NULL));
- }
- }
-
-/* NoBareDot */
- must_fail(ensure_refname_normalized(SYM_REF, "refs/heads/.", NULL));
- must_fail(ensure_refname_normalized(SYM_REF, "refs/heads/..", NULL));
- must_fail(ensure_refname_normalized(SYM_REF, "refs/heads/./master", NULL));
- must_fail(ensure_refname_normalized(SYM_REF, "refs/heads/../master", NULL));
-
-/* NoLeadingOrTrailingDot */
- must_fail(ensure_refname_normalized(SYM_REF, ".", NULL));
- must_fail(ensure_refname_normalized(SYM_REF, "refs/heads/.bar", NULL));
- must_fail(ensure_refname_normalized(SYM_REF, "refs/heads/..bar", NULL));
- must_fail(ensure_refname_normalized(SYM_REF, "refs/heads/bar.", NULL));
-
-/* ContainsDot */
- must_pass(ensure_refname_normalized(SYM_REF, "refs/heads/m.a.s.t.e.r", "refs/heads/m.a.s.t.e.r"));
- must_fail(ensure_refname_normalized(SYM_REF, "refs/heads/master..pu", NULL));
-
-/* NoMagicRefCharacters */
- must_fail(ensure_refname_normalized(SYM_REF, "refs/heads/master^", NULL));
- must_fail(ensure_refname_normalized(SYM_REF, "refs/heads/^master", NULL));
- must_fail(ensure_refname_normalized(SYM_REF, "^refs/heads/master", NULL));
-
- must_fail(ensure_refname_normalized(SYM_REF, "refs/heads/master~", NULL));
- must_fail(ensure_refname_normalized(SYM_REF, "refs/heads/~master", NULL));
- must_fail(ensure_refname_normalized(SYM_REF, "~refs/heads/master", NULL));
-
- must_fail(ensure_refname_normalized(SYM_REF, "refs/heads/master:", NULL));
- must_fail(ensure_refname_normalized(SYM_REF, "refs/heads/:master", NULL));
- must_fail(ensure_refname_normalized(SYM_REF, ":refs/heads/master", NULL));
-
-/* ShellGlob */
- must_fail(ensure_refname_normalized(SYM_REF, "refs/heads/master?", NULL));
- must_fail(ensure_refname_normalized(SYM_REF, "refs/heads/?master", NULL));
- must_fail(ensure_refname_normalized(SYM_REF, "?refs/heads/master", NULL));
-
- must_fail(ensure_refname_normalized(SYM_REF, "refs/heads/master[", NULL));
- must_fail(ensure_refname_normalized(SYM_REF, "refs/heads/[master", NULL));
- must_fail(ensure_refname_normalized(SYM_REF, "[refs/heads/master", NULL));
-
- must_fail(ensure_refname_normalized(SYM_REF, "refs/heads/master*", NULL));
- must_fail(ensure_refname_normalized(SYM_REF, "refs/heads/*master", NULL));
- must_fail(ensure_refname_normalized(SYM_REF, "*refs/heads/master", NULL));
-
-/* ValidSpecialCharacters */
- must_pass(ensure_refname_normalized(SYM_REF, "refs/heads/!", "refs/heads/!"));
- must_pass(ensure_refname_normalized(SYM_REF, "refs/heads/\"", "refs/heads/\""));
- must_pass(ensure_refname_normalized(SYM_REF, "refs/heads/#", "refs/heads/#"));
- must_pass(ensure_refname_normalized(SYM_REF, "refs/heads/$", "refs/heads/$"));
- must_pass(ensure_refname_normalized(SYM_REF, "refs/heads/%", "refs/heads/%"));
- must_pass(ensure_refname_normalized(SYM_REF, "refs/heads/&", "refs/heads/&"));
- must_pass(ensure_refname_normalized(SYM_REF, "refs/heads/'", "refs/heads/'"));
- must_pass(ensure_refname_normalized(SYM_REF, "refs/heads/(", "refs/heads/("));
- must_pass(ensure_refname_normalized(SYM_REF, "refs/heads/)", "refs/heads/)"));
- must_pass(ensure_refname_normalized(SYM_REF, "refs/heads/+", "refs/heads/+"));
- must_pass(ensure_refname_normalized(SYM_REF, "refs/heads/,", "refs/heads/,"));
- must_pass(ensure_refname_normalized(SYM_REF, "refs/heads/-", "refs/heads/-"));
- must_pass(ensure_refname_normalized(SYM_REF, "refs/heads/;", "refs/heads/;"));
- must_pass(ensure_refname_normalized(SYM_REF, "refs/heads/<", "refs/heads/<"));
- must_pass(ensure_refname_normalized(SYM_REF, "refs/heads/=", "refs/heads/="));
- must_pass(ensure_refname_normalized(SYM_REF, "refs/heads/>", "refs/heads/>"));
- must_pass(ensure_refname_normalized(SYM_REF, "refs/heads/@", "refs/heads/@"));
- must_pass(ensure_refname_normalized(SYM_REF, "refs/heads/]", "refs/heads/]"));
- must_pass(ensure_refname_normalized(SYM_REF, "refs/heads/_", "refs/heads/_"));
- must_pass(ensure_refname_normalized(SYM_REF, "refs/heads/`", "refs/heads/`"));
- must_pass(ensure_refname_normalized(SYM_REF, "refs/heads/{", "refs/heads/{"));
- must_pass(ensure_refname_normalized(SYM_REF, "refs/heads/|", "refs/heads/|"));
- must_pass(ensure_refname_normalized(SYM_REF, "refs/heads/}", "refs/heads/}"));
-
- // This is valid on UNIX, but not on Windows
- // hence we make in invalid due to non-portability
- //
- must_fail(ensure_refname_normalized(SYM_REF, "refs/heads/\\", NULL));
-
-/* UnicodeNames */
- /*
- * Currently this fails.
- * must_pass(ensure_refname_normalized(SYM_REF, "refs/heads/\u00e5ngstr\u00f6m", "refs/heads/\u00e5ngstr\u00f6m"));
- */
-
-/* RefLogQueryIsValidRef */
- must_fail(ensure_refname_normalized(SYM_REF, "refs/heads/master@{1}", NULL));
- must_fail(ensure_refname_normalized(SYM_REF, "refs/heads/master@{1.hour.ago}", NULL));
-END_TEST
-
-BEGIN_TEST(list0, "try to list all the references in our test repo")
- git_repository *repo;
- git_strarray ref_list;
-
- must_pass(git_repository_open(&repo, REPOSITORY_FOLDER));
- must_pass(git_reference_listall(&ref_list, repo, GIT_REF_LISTALL));
-
- /*{
- unsigned short i;
- for (i = 0; i < ref_list.count; ++i)
- printf("# %s\n", ref_list.strings[i]);
- }*/
-
- /* We have exactly 9 refs in total if we include the packed ones:
- * there is a reference that exists both in the packfile and as
- * loose, but we only list it once */
- must_be_true(ref_list.count == 9);
-
- git_strarray_free(&ref_list);
- git_repository_free(repo);
-END_TEST
-
-BEGIN_TEST(list1, "try to list only the symbolic references")
- git_repository *repo;
- git_strarray ref_list;
-
- must_pass(git_repository_open(&repo, REPOSITORY_FOLDER));
- must_pass(git_reference_listall(&ref_list, repo, GIT_REF_SYMBOLIC));
- must_be_true(ref_list.count == 0); /* no symrefs in the test repo */
-
- git_strarray_free(&ref_list);
- git_repository_free(repo);
-END_TEST
-
-static const char *new_ref = "refs/heads/test-reflog";
-#define commit_msg "commit: bla bla"
-
-static int assert_signature(git_signature *expected, git_signature *actual)
-{
- if (actual == NULL)
- return GIT_ERROR;
-
- if (strcmp(expected->name, actual->name) != 0)
- return GIT_ERROR;
-
- if (strcmp(expected->email, actual->email) != 0)
- return GIT_ERROR;
-
- if (expected->when.offset != actual->when.offset)
- return GIT_ERROR;
-
- if (expected->when.time != actual->when.time)
- return GIT_ERROR;
-
- return GIT_SUCCESS;
-}
-
-BEGIN_TEST(reflog0, "write a reflog for a given reference and ensure it can be read back")
- git_repository *repo, *repo2;
- git_reference *ref, *lookedup_ref;
- git_oid oid;
- git_signature *committer;
- git_reflog *reflog;
- git_reflog_entry *entry;
- char oid_str[GIT_OID_HEXSZ+1];
-
- must_pass(open_temp_repo(&repo, REPOSITORY_FOLDER));
-
- /* Create a new branch pointing at the HEAD */
- git_oid_fromstr(&oid, current_master_tip);
- must_pass(git_reference_create_oid(&ref, repo, new_ref, &oid, 0));
- git_reference_free(ref);
- must_pass(git_reference_lookup(&ref, repo, new_ref));
-
- must_pass(git_signature_now(&committer, "foo", "foo@bar"));
-
- must_pass(git_reflog_write(ref, NULL, committer, NULL));
- must_fail(git_reflog_write(ref, NULL, committer, "no ancestor NULL for an existing reflog"));
- must_fail(git_reflog_write(ref, NULL, committer, "no\nnewline"));
- must_pass(git_reflog_write(ref, &oid, committer, commit_msg));
-
- git_repository_free(repo);
-
- /* Reopen a new instance of the repository */
- must_pass(git_repository_open(&repo2, TEMP_REPO_FOLDER));
-
- /* Lookup the preivously created branch */
- must_pass(git_reference_lookup(&lookedup_ref, repo2, new_ref));
-
- /* Read and parse the reflog for this branch */
- must_pass(git_reflog_read(&reflog, lookedup_ref));
- must_be_true(reflog->entries.length == 2);
-
- entry = (git_reflog_entry *)git_vector_get(&reflog->entries, 0);
- must_pass(assert_signature(committer, entry->committer));
- git_oid_tostr(oid_str, GIT_OID_HEXSZ+1, &entry->oid_old);
- must_be_true(strcmp("0000000000000000000000000000000000000000", oid_str) == 0);
- git_oid_tostr(oid_str, GIT_OID_HEXSZ+1, &entry->oid_cur);
- must_be_true(strcmp(current_master_tip, oid_str) == 0);
- must_be_true(entry->msg == NULL);
-
- entry = (git_reflog_entry *)git_vector_get(&reflog->entries, 1);
- must_pass(assert_signature(committer, entry->committer));
- git_oid_tostr(oid_str, GIT_OID_HEXSZ+1, &entry->oid_old);
- must_be_true(strcmp(current_master_tip, oid_str) == 0);
- git_oid_tostr(oid_str, GIT_OID_HEXSZ+1, &entry->oid_cur);
- must_be_true(strcmp(current_master_tip, oid_str) == 0);
- must_be_true(strcmp(commit_msg, entry->msg) == 0);
-
- git_signature_free(committer);
- git_reflog_free(reflog);
- close_temp_repo(repo2);
-
- git_reference_free(ref);
- git_reference_free(lookedup_ref);
-END_TEST
-
-BEGIN_TEST(reflog1, "avoid writing an obviously wrong reflog")
- git_repository *repo;
- git_reference *ref;
- git_oid oid;
- git_signature *committer;
-
- must_pass(open_temp_repo(&repo, REPOSITORY_FOLDER));
-
- /* Create a new branch pointing at the HEAD */
- git_oid_fromstr(&oid, current_master_tip);
- must_pass(git_reference_create_oid(&ref, repo, new_ref, &oid, 0));
- git_reference_free(ref);
- must_pass(git_reference_lookup(&ref, repo, new_ref));
-
- must_pass(git_signature_now(&committer, "foo", "foo@bar"));
-
- /* Write the reflog for the new branch */
- must_pass(git_reflog_write(ref, NULL, committer, NULL));
-
- /* Try to update the reflog with wrong information:
- * It's no new reference, so the ancestor OID cannot
- * be NULL. */
- must_fail(git_reflog_write(ref, NULL, committer, NULL));
-
- git_signature_free(committer);
-
- close_temp_repo(repo);
-
- git_reference_free(ref);
-END_TEST
-
-BEGIN_SUITE(refs)
- ADD_TEST(readtag0);
- ADD_TEST(readtag1);
-
- ADD_TEST(readsym0);
- ADD_TEST(readsym1);
- ADD_TEST(readsym2);
- ADD_TEST(readsym3);
-
- ADD_TEST(readpacked0);
- ADD_TEST(readpacked1);
-
- ADD_TEST(create0);
- ADD_TEST(create1);
- ADD_TEST(create2);
- ADD_TEST(create3);
-
- ADD_TEST(overwrite0);
- ADD_TEST(overwrite1);
- ADD_TEST(overwrite2);
- ADD_TEST(overwrite3);
-
- ADD_TEST(normalize0);
- ADD_TEST(normalize1);
- ADD_TEST(normalize2);
-
- ADD_TEST(pack0);
- ADD_TEST(pack1);
-
- ADD_TEST(rename0);
- ADD_TEST(rename1);
- ADD_TEST(rename2);
- ADD_TEST(rename3);
- ADD_TEST(rename4);
- ADD_TEST(rename5);
- ADD_TEST(rename6);
- ADD_TEST(rename7);
- ADD_TEST(rename8);
- ADD_TEST(rename9);
-
- ADD_TEST(delete0);
- ADD_TEST(delete1);
-
- ADD_TEST(list0);
- ADD_TEST(list1);
-
- ADD_TEST(reflog0);
- ADD_TEST(reflog1);
-END_SUITE
diff --git a/tests/t12-repo.c b/tests/t12-repo.c
deleted file mode 100644
index 6a080ec..0000000
--- a/tests/t12-repo.c
+++ /dev/null
@@ -1,183 +0,0 @@
-/*
- * This file is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License, version 2,
- * as published by the Free Software Foundation.
- *
- * In addition to the permissions in the GNU General Public License,
- * the authors give you unlimited permission to link the compiled
- * version of this file into combinations with other programs,
- * and to distribute those combinations without any restriction
- * coming from the use of this file. (The General Public License
- * restrictions do apply in other respects; for example, they cover
- * modification of the file, and distribution when not linked into
- * a combined executable.)
- *
- * This file is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; see the file COPYING. If not, write to
- * the Free Software Foundation, 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-#include "test_lib.h"
-#include "test_helpers.h"
-
-#include "odb.h"
-#include "git2/odb_backend.h"
-#include "repository.h"
-
-#define EMPTY_BARE_REPOSITORY_FOLDER TEST_RESOURCES "/empty_bare.git/"
-
-#define DISCOVER_FOLDER TEMP_REPO_FOLDER "discover.git"
-
-#define SUB_REPOSITORY_FOLDER_NAME "sub_repo"
-#define SUB_REPOSITORY_FOLDER DISCOVER_FOLDER "/" SUB_REPOSITORY_FOLDER_NAME
-#define SUB_REPOSITORY_FOLDER_SUB SUB_REPOSITORY_FOLDER "/sub"
-#define SUB_REPOSITORY_FOLDER_SUB_SUB SUB_REPOSITORY_FOLDER_SUB "/subsub"
-#define SUB_REPOSITORY_FOLDER_SUB_SUB_SUB SUB_REPOSITORY_FOLDER_SUB_SUB "/subsubsub"
-
-#define REPOSITORY_ALTERNATE_FOLDER DISCOVER_FOLDER "/alternate_sub_repo"
-#define REPOSITORY_ALTERNATE_FOLDER_SUB REPOSITORY_ALTERNATE_FOLDER "/sub"
-#define REPOSITORY_ALTERNATE_FOLDER_SUB_SUB REPOSITORY_ALTERNATE_FOLDER_SUB "/subsub"
-#define REPOSITORY_ALTERNATE_FOLDER_SUB_SUB_SUB REPOSITORY_ALTERNATE_FOLDER_SUB_SUB "/subsubsub"
-
-#define ALTERNATE_MALFORMED_FOLDER1 DISCOVER_FOLDER "/alternate_malformed_repo1"
-#define ALTERNATE_MALFORMED_FOLDER2 DISCOVER_FOLDER "/alternate_malformed_repo2"
-#define ALTERNATE_MALFORMED_FOLDER3 DISCOVER_FOLDER "/alternate_malformed_repo3"
-#define ALTERNATE_NOT_FOUND_FOLDER DISCOVER_FOLDER "/alternate_not_found_repo"
-
-static int ensure_repository_discover(const char *start_path, const char *ceiling_dirs, const char *expected_path)
-{
- int error;
- char found_path[GIT_PATH_MAX];
-
- error = git_repository_discover(found_path, sizeof(found_path), start_path, 0, ceiling_dirs);
- //across_fs is always 0 as we can't automate the filesystem change tests
-
- if (error < GIT_SUCCESS)
- return error;
-
- return strcmp(found_path, expected_path) ? GIT_ERROR : GIT_SUCCESS;
-}
-
-static int write_file(const char *path, const char *content)
-{
- int error;
- git_file file;
-
- if (git_path_exists(path) == GIT_SUCCESS) {
- error = p_unlink(path);
-
- if (error < GIT_SUCCESS)
- return error;
- }
-
- file = git_futils_creat_withpath(path, 0777, 0666);
- if (file < GIT_SUCCESS)
- return file;
-
- error = p_write(file, content, strlen(content) * sizeof(char));
-
- p_close(file);
-
- return error;
-}
-
-//no check is performed on ceiling_dirs length, so be sure it's long enough
-static int append_ceiling_dir(git_buf *ceiling_dirs, const char *path)
-{
- git_buf pretty_path = GIT_BUF_INIT;
- int error;
- char ceiling_separator[2] = { GIT_PATH_LIST_SEPARATOR, '\0' };
-
- error = git_path_prettify_dir(&pretty_path, path, NULL);
- if (error < GIT_SUCCESS)
- return git__rethrow(error, "Failed to append ceiling directory.");
-
- if (ceiling_dirs->size > 0)
- git_buf_puts(ceiling_dirs, ceiling_separator);
- git_buf_puts(ceiling_dirs, pretty_path.ptr);
-
- git_buf_free(&pretty_path);
-
- return git_buf_lasterror(ceiling_dirs);
-}
-
-BEGIN_TEST(discover0, "test discover")
- git_repository *repo;
- git_buf ceiling_dirs_buf = GIT_BUF_INIT;
- const char *ceiling_dirs;
- char repository_path[GIT_PATH_MAX];
- char sub_repository_path[GIT_PATH_MAX];
- char found_path[GIT_PATH_MAX];
- const mode_t mode = 0777;
-
- git_futils_mkdir_r(DISCOVER_FOLDER, NULL, mode);
- must_pass(append_ceiling_dir(&ceiling_dirs_buf, TEMP_REPO_FOLDER));
- ceiling_dirs = git_buf_cstr(&ceiling_dirs_buf);
-
- must_be_true(git_repository_discover(repository_path, sizeof(repository_path), DISCOVER_FOLDER, 0, ceiling_dirs) == GIT_ENOTAREPO);
-
- must_pass(git_repository_init(&repo, DISCOVER_FOLDER, 1));
- must_pass(git_repository_discover(repository_path, sizeof(repository_path), DISCOVER_FOLDER, 0, ceiling_dirs));
- git_repository_free(repo);
-
- must_pass(git_repository_init(&repo, SUB_REPOSITORY_FOLDER, 0));
- must_pass(git_futils_mkdir_r(SUB_REPOSITORY_FOLDER_SUB_SUB_SUB, NULL, mode));
- must_pass(git_repository_discover(sub_repository_path, sizeof(sub_repository_path), SUB_REPOSITORY_FOLDER, 0, ceiling_dirs));
-
- must_pass(git_futils_mkdir_r(SUB_REPOSITORY_FOLDER_SUB_SUB_SUB, NULL, mode));
- must_pass(ensure_repository_discover(SUB_REPOSITORY_FOLDER_SUB, ceiling_dirs, sub_repository_path));
- must_pass(ensure_repository_discover(SUB_REPOSITORY_FOLDER_SUB_SUB, ceiling_dirs, sub_repository_path));
- must_pass(ensure_repository_discover(SUB_REPOSITORY_FOLDER_SUB_SUB_SUB, ceiling_dirs, sub_repository_path));
-
- must_pass(git_futils_mkdir_r(REPOSITORY_ALTERNATE_FOLDER_SUB_SUB_SUB, NULL, mode));
- must_pass(write_file(REPOSITORY_ALTERNATE_FOLDER "/" DOT_GIT, "gitdir: ../" SUB_REPOSITORY_FOLDER_NAME "/" DOT_GIT));
- must_pass(write_file(REPOSITORY_ALTERNATE_FOLDER_SUB_SUB "/" DOT_GIT, "gitdir: ../../../" SUB_REPOSITORY_FOLDER_NAME "/" DOT_GIT));
- must_pass(write_file(REPOSITORY_ALTERNATE_FOLDER_SUB_SUB_SUB "/" DOT_GIT, "gitdir: ../../../../"));
- must_pass(ensure_repository_discover(REPOSITORY_ALTERNATE_FOLDER, ceiling_dirs, sub_repository_path));
- must_pass(ensure_repository_discover(REPOSITORY_ALTERNATE_FOLDER_SUB, ceiling_dirs, sub_repository_path));
- must_pass(ensure_repository_discover(REPOSITORY_ALTERNATE_FOLDER_SUB_SUB, ceiling_dirs, sub_repository_path));
- must_pass(ensure_repository_discover(REPOSITORY_ALTERNATE_FOLDER_SUB_SUB_SUB, ceiling_dirs, repository_path));
-
- must_pass(git_futils_mkdir_r(ALTERNATE_MALFORMED_FOLDER1, NULL, mode));
- must_pass(write_file(ALTERNATE_MALFORMED_FOLDER1 "/" DOT_GIT, "Anything but not gitdir:"));
- must_pass(git_futils_mkdir_r(ALTERNATE_MALFORMED_FOLDER2, NULL, mode));
- must_pass(write_file(ALTERNATE_MALFORMED_FOLDER2 "/" DOT_GIT, "gitdir:"));
- must_pass(git_futils_mkdir_r(ALTERNATE_MALFORMED_FOLDER3, NULL, mode));
- must_pass(write_file(ALTERNATE_MALFORMED_FOLDER3 "/" DOT_GIT, "gitdir: \n\n\n"));
- must_pass(git_futils_mkdir_r(ALTERNATE_NOT_FOUND_FOLDER, NULL, mode));
- must_pass(write_file(ALTERNATE_NOT_FOUND_FOLDER "/" DOT_GIT, "gitdir: a_repository_that_surely_does_not_exist"));
- must_fail(git_repository_discover(found_path, sizeof(found_path), ALTERNATE_MALFORMED_FOLDER1, 0, ceiling_dirs));
- must_fail(git_repository_discover(found_path, sizeof(found_path), ALTERNATE_MALFORMED_FOLDER2, 0, ceiling_dirs));
- must_fail(git_repository_discover(found_path, sizeof(found_path), ALTERNATE_MALFORMED_FOLDER3, 0, ceiling_dirs));
- must_fail(git_repository_discover(found_path, sizeof(found_path), ALTERNATE_NOT_FOUND_FOLDER, 0, ceiling_dirs));
-
- must_pass(append_ceiling_dir(&ceiling_dirs_buf, SUB_REPOSITORY_FOLDER));
- ceiling_dirs = git_buf_cstr(&ceiling_dirs_buf);
-
- //this must pass as ceiling_directories cannot predent the current
- //working directory to be checked
- must_pass(git_repository_discover(found_path, sizeof(found_path), SUB_REPOSITORY_FOLDER, 0, ceiling_dirs));
- must_fail(git_repository_discover(found_path, sizeof(found_path), SUB_REPOSITORY_FOLDER_SUB, 0, ceiling_dirs));
- must_fail(git_repository_discover(found_path, sizeof(found_path), SUB_REPOSITORY_FOLDER_SUB_SUB, 0, ceiling_dirs));
- must_fail(git_repository_discover(found_path, sizeof(found_path), SUB_REPOSITORY_FOLDER_SUB_SUB_SUB, 0, ceiling_dirs));
-
- //.gitfile redirection should not be affected by ceiling directories
- must_pass(ensure_repository_discover(REPOSITORY_ALTERNATE_FOLDER, ceiling_dirs, sub_repository_path));
- must_pass(ensure_repository_discover(REPOSITORY_ALTERNATE_FOLDER_SUB, ceiling_dirs, sub_repository_path));
- must_pass(ensure_repository_discover(REPOSITORY_ALTERNATE_FOLDER_SUB_SUB, ceiling_dirs, sub_repository_path));
- must_pass(ensure_repository_discover(REPOSITORY_ALTERNATE_FOLDER_SUB_SUB_SUB, ceiling_dirs, repository_path));
-
- must_pass(git_futils_rmdir_r(TEMP_REPO_FOLDER, 1));
- git_repository_free(repo);
- git_buf_free(&ceiling_dirs_buf);
-END_TEST
-
-BEGIN_SUITE(repository)
- ADD_TEST(discover0);
-END_SUITE
-
diff --git a/tests/t13-threads.c b/tests/t13-threads.c
deleted file mode 100644
index 3888b70..0000000
--- a/tests/t13-threads.c
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * This file is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License, version 2,
- * as published by the Free Software Foundation.
- *
- * In addition to the permissions in the GNU General Public License,
- * the authors give you unlimited permission to link the compiled
- * version of this file into combinations with other programs,
- * and to distribute those combinations without any restriction
- * coming from the use of this file. (The General Public License
- * restrictions do apply in other respects; for example, they cover
- * modification of the file, and distribution when not linked into
- * a combined executable.)
- *
- * This file is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; see the file COPYING. If not, write to
- * the Free Software Foundation, 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-#include "test_lib.h"
-#include "test_helpers.h"
-#include "cache.h"
-
-
-typedef struct {
- git_cached_obj cached;
- unsigned int __dummy;
-} ttest_obj;
-
-BEGIN_TEST(cache0, "run several threads polling the cache at the same time")
-
-END_TEST
-
-BEGIN_SUITE(threads)
- ADD_TEST(cache0);
-END_SUITE
diff --git a/tests/t17-bufs.c b/tests/t17-bufs.c
deleted file mode 100644
index 2cbd8c8..0000000
--- a/tests/t17-bufs.c
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * This file is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License, version 2,
- * as published by the Free Software Foundation.
- *
- * In addition to the permissions in the GNU General Public License,
- * the authors give you unlimited permission to link the compiled
- * version of this file into combinations with other programs,
- * and to distribute those combinations without any restriction
- * coming from the use of this file. (The General Public License
- * restrictions do apply in other respects; for example, they cover
- * modification of the file, and distribution when not linked into
- * a combined executable.)
- *
- * This file is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; see the file COPYING. If not, write to
- * the Free Software Foundation, 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-#include "test_lib.h"
-#include "test_helpers.h"
-
-#include <git2.h>
-#include "buffer.h"
-
-const char *test_string = "Have you seen that? Have you seeeen that??";
-
-BEGIN_TEST(buf0, "check that resizing works properly")
- git_buf buf = GIT_BUF_INIT;
- git_buf_puts(&buf, test_string);
-
- must_be_true(git_buf_oom(&buf) == 0);
- must_be_true(strcmp(git_buf_cstr(&buf), test_string) == 0);
-
- git_buf_puts(&buf, test_string);
- must_be_true(strlen(git_buf_cstr(&buf)) == strlen(test_string) * 2);
- git_buf_free(&buf);
-END_TEST
-
-BEGIN_TEST(buf1, "check that printf works properly")
- git_buf buf = GIT_BUF_INIT;
-
- git_buf_printf(&buf, "%s %s %d ", "shoop", "da", 23);
- must_be_true(git_buf_oom(&buf) == 0);
- must_be_true(strcmp(git_buf_cstr(&buf), "shoop da 23 ") == 0);
-
- git_buf_printf(&buf, "%s %d", "woop", 42);
- must_be_true(git_buf_oom(&buf) == 0);
- must_be_true(strcmp(git_buf_cstr(&buf), "shoop da 23 woop 42") == 0);
- git_buf_free(&buf);
-END_TEST
-
-BEGIN_SUITE(buffers)
- ADD_TEST(buf0)
- ADD_TEST(buf1)
-END_SUITE
diff --git a/tests/t18-status.c b/tests/t18-status.c
deleted file mode 100644
index 2b90ac6..0000000
--- a/tests/t18-status.c
+++ /dev/null
@@ -1,455 +0,0 @@
-/*
- * This file is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License, version 2,
- * as published by the Free Software Foundation.
- *
- * In addition to the permissions in the GNU General Public License,
- * the authors give you unlimited permission to link the compiled
- * version of this file into combinations with other programs,
- * and to distribute those combinations without any restriction
- * coming from the use of this file. (The General Public License
- * restrictions do apply in other respects; for example, they cover
- * modification of the file, and distribution when not linked into
- * a combined executable.)
- *
- * This file is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; see the file COPYING. If not, write to
- * the Free Software Foundation, 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#include "test_lib.h"
-#include "test_helpers.h"
-#include "fileops.h"
-#include "git2/status.h"
-
-static const char *test_blob_oid = "d4fa8600b4f37d7516bef4816ae2c64dbf029e3a";
-
-#define STATUS_WORKDIR_FOLDER TEST_RESOURCES "/status/"
-#define STATUS_REPOSITORY_TEMP_FOLDER TEMP_REPO_FOLDER ".gitted/"
-
-static int file_create(const char *filename, const char *content)
-{
- int fd;
-
- fd = p_creat(filename, 0666);
- if (fd == 0)
- return GIT_ERROR;
- if (p_write(fd, content, strlen(content)) != 0)
- return GIT_ERROR;
- if (p_close(fd) != 0)
- return GIT_ERROR;
-
- return GIT_SUCCESS;
-}
-
-BEGIN_TEST(file0, "test retrieving OID from a file apart from the ODB")
- git_oid expected_id, actual_id;
- char filename[] = "new_file";
-
- must_pass(file_create(filename, "new_file\n\0"));
-
- must_pass(git_odb_hashfile(&actual_id, filename, GIT_OBJ_BLOB));
-
- must_pass(git_oid_fromstr(&expected_id, test_blob_oid));
- must_be_true(git_oid_cmp(&expected_id, &actual_id) == 0);
-
- must_pass(p_unlink(filename));
-END_TEST
-
-static const char *entry_paths0[] = {
- "file_deleted",
- "ignored_file",
- "modified_file",
- "new_file",
- "staged_changes",
- "staged_changes_file_deleted",
- "staged_changes_modified_file",
- "staged_delete_file_deleted",
- "staged_delete_modified_file",
- "staged_new_file",
- "staged_new_file_deleted_file",
- "staged_new_file_modified_file",
-
- "subdir/deleted_file",
- "subdir/modified_file",
- "subdir/new_file",
-};
-
-static const unsigned int entry_statuses0[] = {
- GIT_STATUS_WT_DELETED,
- GIT_STATUS_IGNORED,
- GIT_STATUS_WT_MODIFIED,
- GIT_STATUS_WT_NEW,
- GIT_STATUS_INDEX_MODIFIED,
- GIT_STATUS_INDEX_MODIFIED | GIT_STATUS_WT_DELETED,
- GIT_STATUS_INDEX_MODIFIED | GIT_STATUS_WT_MODIFIED,
- GIT_STATUS_INDEX_DELETED,
- GIT_STATUS_INDEX_DELETED | GIT_STATUS_WT_NEW,
- GIT_STATUS_INDEX_NEW,
- GIT_STATUS_INDEX_NEW | GIT_STATUS_WT_DELETED,
- GIT_STATUS_INDEX_NEW | GIT_STATUS_WT_MODIFIED,
-
- GIT_STATUS_WT_DELETED,
- GIT_STATUS_WT_MODIFIED,
- GIT_STATUS_WT_NEW,
-};
-
-#define ENTRY_COUNT0 15
-
-struct status_entry_counts {
- int wrong_status_flags_count;
- int wrong_sorted_path;
- int entry_count;
- const unsigned int* expected_statuses;
- const char** expected_paths;
- int expected_entry_count;
-};
-
-static int status_cb(const char *path, unsigned int status_flags, void *payload)
-{
- struct status_entry_counts *counts = (struct status_entry_counts *)payload;
-
- if (counts->entry_count >= counts->expected_entry_count) {
- counts->wrong_status_flags_count++;
- goto exit;
- }
-
- if (strcmp(path, counts->expected_paths[counts->entry_count])) {
- counts->wrong_sorted_path++;
- goto exit;
- }
-
- if (status_flags != counts->expected_statuses[counts->entry_count])
- counts->wrong_status_flags_count++;
-
-exit:
- counts->entry_count++;
- return GIT_SUCCESS;
-}
-
-BEGIN_TEST(statuscb0, "test retrieving status for worktree of repository")
- git_repository *repo;
- struct status_entry_counts counts;
-
- must_pass(copydir_recurs(STATUS_WORKDIR_FOLDER, TEMP_REPO_FOLDER));
- must_pass(p_rename(STATUS_REPOSITORY_TEMP_FOLDER, TEST_STD_REPO_FOLDER));
- must_pass(git_repository_open(&repo, TEST_STD_REPO_FOLDER));
-
- memset(&counts, 0x0, sizeof(struct status_entry_counts));
- counts.expected_entry_count = ENTRY_COUNT0;
- counts.expected_paths = entry_paths0;
- counts.expected_statuses = entry_statuses0;
-
- must_pass(git_status_foreach(repo, status_cb, &counts));
- must_be_true(counts.entry_count == counts.expected_entry_count);
- must_be_true(counts.wrong_status_flags_count == 0);
- must_be_true(counts.wrong_sorted_path == 0);
-
- git_repository_free(repo);
-
- git_futils_rmdir_r(TEMP_REPO_FOLDER, 1);
-END_TEST
-
-static int status_cb1(const char *path, unsigned int status_flags, void *payload)
-{
- int *count = (int *)payload;;
-
- GIT_UNUSED(path);
- GIT_UNUSED(status_flags);
-
- (*count)++;
-
- return GIT_SUCCESS;
-}
-
-BEGIN_TEST(statuscb1, "test retrieving status for a worktree of an empty repository")
- git_repository *repo;
- int count = 0;
-
- must_pass(copydir_recurs(EMPTY_REPOSITORY_FOLDER, TEST_STD_REPO_FOLDER));
- must_pass(remove_placeholders(TEST_STD_REPO_FOLDER, "dummy-marker.txt"));
- must_pass(git_repository_open(&repo, TEST_STD_REPO_FOLDER));
-
- must_pass(git_status_foreach(repo, status_cb1, &count));
- must_be_true(count == 0);
-
- git_repository_free(repo);
-
- git_futils_rmdir_r(TEMP_REPO_FOLDER, 1);
-END_TEST
-
-static const char *entry_paths2[] = {
- "current_file",
- "file_deleted",
- "ignored_file",
- "modified_file",
- "staged_changes",
- "staged_changes_file_deleted",
- "staged_changes_modified_file",
- "staged_delete_file_deleted",
- "staged_delete_modified_file",
- "staged_new_file",
- "staged_new_file_deleted_file",
- "staged_new_file_modified_file",
- "subdir/current_file",
- "subdir/deleted_file",
- "subdir/modified_file",
-};
-
-static const unsigned int entry_statuses2[] = {
- GIT_STATUS_WT_DELETED,
- GIT_STATUS_WT_DELETED,
- GIT_STATUS_IGNORED,
- GIT_STATUS_WT_DELETED,
- GIT_STATUS_WT_DELETED | GIT_STATUS_INDEX_MODIFIED,
- GIT_STATUS_WT_DELETED | GIT_STATUS_INDEX_MODIFIED,
- GIT_STATUS_WT_DELETED | GIT_STATUS_INDEX_MODIFIED,
- GIT_STATUS_INDEX_DELETED,
- GIT_STATUS_INDEX_DELETED,
- GIT_STATUS_WT_DELETED | GIT_STATUS_INDEX_NEW,
- GIT_STATUS_WT_DELETED | GIT_STATUS_INDEX_NEW,
- GIT_STATUS_WT_DELETED | GIT_STATUS_INDEX_NEW,
- GIT_STATUS_WT_DELETED,
- GIT_STATUS_WT_DELETED,
- GIT_STATUS_WT_DELETED,
-};
-
-#define ENTRY_COUNT2 15
-
-BEGIN_TEST(statuscb2, "test retrieving status for a purged worktree of an valid repository")
- git_repository *repo;
- struct status_entry_counts counts;
-
- must_pass(copydir_recurs(STATUS_WORKDIR_FOLDER, TEMP_REPO_FOLDER));
- must_pass(p_rename(STATUS_REPOSITORY_TEMP_FOLDER, TEST_STD_REPO_FOLDER));
- must_pass(git_repository_open(&repo, TEST_STD_REPO_FOLDER));
-
- /* Purging the working */
- must_pass(p_unlink(TEMP_REPO_FOLDER "current_file"));
- must_pass(p_unlink(TEMP_REPO_FOLDER "modified_file"));
- must_pass(p_unlink(TEMP_REPO_FOLDER "new_file"));
- must_pass(p_unlink(TEMP_REPO_FOLDER "staged_changes"));
- must_pass(p_unlink(TEMP_REPO_FOLDER "staged_changes_modified_file"));
- must_pass(p_unlink(TEMP_REPO_FOLDER "staged_delete_modified_file"));
- must_pass(p_unlink(TEMP_REPO_FOLDER "staged_new_file"));
- must_pass(p_unlink(TEMP_REPO_FOLDER "staged_new_file_modified_file"));
- must_pass(git_futils_rmdir_r(TEMP_REPO_FOLDER "subdir", 1));
-
- memset(&counts, 0x0, sizeof(struct status_entry_counts));
- counts.expected_entry_count = ENTRY_COUNT2;
- counts.expected_paths = entry_paths2;
- counts.expected_statuses = entry_statuses2;
-
- must_pass(git_status_foreach(repo, status_cb, &counts));
- must_be_true(counts.entry_count == counts.expected_entry_count);
- must_be_true(counts.wrong_status_flags_count == 0);
- must_be_true(counts.wrong_sorted_path == 0);
-
- git_repository_free(repo);
-
- git_futils_rmdir_r(TEMP_REPO_FOLDER, 1);
-END_TEST
-
-static const char *entry_paths3[] = {
- ".HEADER",
- "42-is-not-prime.sigh",
- "README.md",
- "current_file",
- "current_file/current_file",
- "current_file/modified_file",
- "current_file/new_file",
- "file_deleted",
- "ignored_file",
- "modified_file",
- "new_file",
- "staged_changes",
- "staged_changes_file_deleted",
- "staged_changes_modified_file",
- "staged_delete_file_deleted",
- "staged_delete_modified_file",
- "staged_new_file",
- "staged_new_file_deleted_file",
- "staged_new_file_modified_file",
- "subdir",
- "subdir/current_file",
- "subdir/deleted_file",
- "subdir/modified_file",
-};
-
-static const unsigned int entry_statuses3[] = {
- GIT_STATUS_WT_NEW,
- GIT_STATUS_WT_NEW,
- GIT_STATUS_WT_NEW,
- GIT_STATUS_WT_DELETED,
- GIT_STATUS_WT_NEW,
- GIT_STATUS_WT_NEW,
- GIT_STATUS_WT_NEW,
- GIT_STATUS_WT_DELETED,
- GIT_STATUS_IGNORED,
- GIT_STATUS_WT_MODIFIED,
- GIT_STATUS_WT_NEW,
- GIT_STATUS_INDEX_MODIFIED,
- GIT_STATUS_WT_DELETED | GIT_STATUS_INDEX_MODIFIED,
- GIT_STATUS_WT_MODIFIED | GIT_STATUS_INDEX_MODIFIED,
- GIT_STATUS_INDEX_DELETED,
- GIT_STATUS_WT_NEW | GIT_STATUS_INDEX_DELETED,
- GIT_STATUS_INDEX_NEW,
- GIT_STATUS_WT_DELETED | GIT_STATUS_INDEX_NEW,
- GIT_STATUS_WT_MODIFIED | GIT_STATUS_INDEX_NEW,
- GIT_STATUS_WT_NEW,
- GIT_STATUS_WT_DELETED,
- GIT_STATUS_WT_DELETED,
- GIT_STATUS_WT_DELETED,
-};
-
-#define ENTRY_COUNT3 23
-
-BEGIN_TEST(statuscb3, "test retrieving status for a worktree where a file and a subdir have been renamed and some files have been added")
- git_repository *repo;
- struct status_entry_counts counts;
-
- must_pass(copydir_recurs(STATUS_WORKDIR_FOLDER, TEMP_REPO_FOLDER));
- must_pass(p_rename(STATUS_REPOSITORY_TEMP_FOLDER, TEST_STD_REPO_FOLDER));
- must_pass(git_repository_open(&repo, TEST_STD_REPO_FOLDER));
-
- must_pass(p_rename(TEMP_REPO_FOLDER "current_file", TEMP_REPO_FOLDER "swap"));
- must_pass(p_rename(TEMP_REPO_FOLDER "subdir", TEMP_REPO_FOLDER "current_file"));
- must_pass(p_rename(TEMP_REPO_FOLDER "swap", TEMP_REPO_FOLDER "subdir"));
-
- must_pass(file_create(TEMP_REPO_FOLDER ".HEADER", "dummy"));
- must_pass(file_create(TEMP_REPO_FOLDER "42-is-not-prime.sigh", "dummy"));
- must_pass(file_create(TEMP_REPO_FOLDER "README.md", "dummy"));
-
- memset(&counts, 0x0, sizeof(struct status_entry_counts));
- counts.expected_entry_count = ENTRY_COUNT3;
- counts.expected_paths = entry_paths3;
- counts.expected_statuses = entry_statuses3;
-
- must_pass(git_status_foreach(repo, status_cb, &counts));
- must_be_true(counts.entry_count == counts.expected_entry_count);
- must_be_true(counts.wrong_status_flags_count == 0);
- must_be_true(counts.wrong_sorted_path == 0);
-
- git_repository_free(repo);
-
- git_futils_rmdir_r(TEMP_REPO_FOLDER, 1);
-END_TEST
-
-BEGIN_TEST(singlestatus0, "test retrieving status for single file")
- git_repository *repo;
- unsigned int status_flags;
- int i;
-
- must_pass(copydir_recurs(STATUS_WORKDIR_FOLDER, TEMP_REPO_FOLDER));
- must_pass(p_rename(STATUS_REPOSITORY_TEMP_FOLDER, TEST_STD_REPO_FOLDER));
- must_pass(git_repository_open(&repo, TEST_STD_REPO_FOLDER));
-
- for (i = 0; i < ENTRY_COUNT0; ++i) {
- must_pass(git_status_file(&status_flags, repo, entry_paths0[i]));
- must_be_true(status_flags == entry_statuses0[i]);
- }
-
- git_repository_free(repo);
-
- git_futils_rmdir_r(TEMP_REPO_FOLDER, 1);
-END_TEST
-
-BEGIN_TEST(singlestatus1, "test retrieving status for nonexistent file")
- git_repository *repo;
- unsigned int status_flags;
- int error;
-
- must_pass(copydir_recurs(STATUS_WORKDIR_FOLDER, TEMP_REPO_FOLDER));
- must_pass(p_rename(STATUS_REPOSITORY_TEMP_FOLDER, TEST_STD_REPO_FOLDER));
- must_pass(git_repository_open(&repo, TEST_STD_REPO_FOLDER));
-
- // "nonexistent" does not exist in HEAD, Index or the worktree
- error = git_status_file(&status_flags, repo, "nonexistent");
- must_be_true(error == GIT_ENOTFOUND);
-
- git_repository_free(repo);
-
- git_futils_rmdir_r(TEMP_REPO_FOLDER, 1);
-END_TEST
-
-BEGIN_TEST(singlestatus2, "test retrieving status for a non existent file in an empty repository")
- git_repository *repo;
- unsigned int status_flags;
- int error;
-
- must_pass(copydir_recurs(EMPTY_REPOSITORY_FOLDER, TEST_STD_REPO_FOLDER));
- must_pass(remove_placeholders(TEST_STD_REPO_FOLDER, "dummy-marker.txt"));
- must_pass(git_repository_open(&repo, TEST_STD_REPO_FOLDER));
-
- error = git_status_file(&status_flags, repo, "nonexistent");
- must_be_true(error == GIT_ENOTFOUND);
-
- git_repository_free(repo);
-
- git_futils_rmdir_r(TEMP_REPO_FOLDER, 1);
-END_TEST
-
-BEGIN_TEST(singlestatus3, "test retrieving status for a new file in an empty repository")
- git_repository *repo;
- unsigned int status_flags;
- git_buf file_path = GIT_BUF_INIT;
- char filename[] = "new_file";
- int fd;
-
- must_pass(copydir_recurs(EMPTY_REPOSITORY_FOLDER, TEST_STD_REPO_FOLDER));
- must_pass(remove_placeholders(TEST_STD_REPO_FOLDER, "dummy-marker.txt"));
-
- must_pass(git_buf_joinpath(&file_path, TEMP_REPO_FOLDER, filename));
- fd = p_creat(file_path.ptr, 0666);
- must_pass(fd);
- must_pass(p_write(fd, "new_file\n", 9));
- must_pass(p_close(fd));
-
- must_pass(git_repository_open(&repo, TEST_STD_REPO_FOLDER));
-
- must_pass(git_status_file(&status_flags, repo, filename));
- must_be_true(status_flags == GIT_STATUS_WT_NEW);
-
- git_repository_free(repo);
- git_buf_free(&file_path);
-
- git_futils_rmdir_r(TEMP_REPO_FOLDER, 1);
-END_TEST
-
-BEGIN_TEST(singlestatus4, "can't determine the status for a folder")
- git_repository *repo;
- unsigned int status_flags;
- int error;
-
- must_pass(copydir_recurs(STATUS_WORKDIR_FOLDER, TEMP_REPO_FOLDER));
- must_pass(p_rename(STATUS_REPOSITORY_TEMP_FOLDER, TEST_STD_REPO_FOLDER));
- must_pass(git_repository_open(&repo, TEST_STD_REPO_FOLDER));
-
- error = git_status_file(&status_flags, repo, "subdir");
- must_be_true(error == GIT_EINVALIDPATH);
-
- git_repository_free(repo);
-
- git_futils_rmdir_r(TEMP_REPO_FOLDER, 1);
-END_TEST
-
-BEGIN_SUITE(status)
- ADD_TEST(file0);
-
- ADD_TEST(statuscb0);
- ADD_TEST(statuscb1);
- ADD_TEST(statuscb2);
- ADD_TEST(statuscb3);
-
- ADD_TEST(singlestatus0);
- ADD_TEST(singlestatus1);
- ADD_TEST(singlestatus2);
- ADD_TEST(singlestatus3);
- ADD_TEST(singlestatus4);
-END_SUITE
diff --git a/tests/test_helpers.c b/tests/test_helpers.c
deleted file mode 100644
index 8373584..0000000
--- a/tests/test_helpers.c
+++ /dev/null
@@ -1,339 +0,0 @@
-/*
- * This file is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License, version 2,
- * as published by the Free Software Foundation.
- *
- * In addition to the permissions in the GNU General Public License,
- * the authors give you unlimited permission to link the compiled
- * version of this file into combinations with other programs,
- * and to distribute those combinations without any restriction
- * coming from the use of this file. (The General Public License
- * restrictions do apply in other respects; for example, they cover
- * modification of the file, and distribution when not linked into
- * a combined executable.)
- *
- * This file is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; see the file COPYING. If not, write to
- * the Free Software Foundation, 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#include "common.h"
-#include "test_helpers.h"
-#include "fileops.h"
-
-int write_object_data(char *file, void *data, size_t len)
-{
- git_file fd;
- int ret;
-
- if ((fd = p_creat(file, S_IREAD | S_IWRITE)) < 0)
- return -1;
- ret = p_write(fd, data, len);
- p_close(fd);
-
- return ret;
-}
-
-int write_object_files(const char *odb_dir, object_data *d)
-{
- if (p_mkdir(odb_dir, GIT_OBJECT_DIR_MODE) < 0) {
- int err = errno;
- fprintf(stderr, "can't make directory \"%s\"", odb_dir);
- if (err == EEXIST)
- fprintf(stderr, " (already exists)");
- fprintf(stderr, "\n");
- return -1;
- }
-
- if ((p_mkdir(d->dir, GIT_OBJECT_DIR_MODE) < 0) && (errno != EEXIST)) {
- fprintf(stderr, "can't make object directory \"%s\"\n", d->dir);
- return -1;
- }
- if (write_object_data(d->file, d->bytes, d->blen) < 0) {
- fprintf(stderr, "can't write object file \"%s\"\n", d->file);
- return -1;
- }
-
- return 0;
-}
-
-int remove_object_files(const char *odb_dir, object_data *d)
-{
- if (p_unlink(d->file) < 0) {
- fprintf(stderr, "can't delete object file \"%s\"\n", d->file);
- return -1;
- }
- if ((p_rmdir(d->dir) < 0) && (errno != ENOTEMPTY)) {
- fprintf(stderr, "can't remove object directory \"%s\"\n", d->dir);
- return -1;
- }
-
- if (p_rmdir(odb_dir) < 0) {
- fprintf(stderr, "can't remove directory \"%s\"\n", odb_dir);
- return -1;
- }
-
- return 0;
-}
-
-void locate_loose_object(const char *repository_folder, git_object *object, char **out, char **out_folder)
-{
- static const char *objects_folder = "objects/";
-
- char *ptr, *full_path, *top_folder;
- int path_length, objects_length;
-
- assert(repository_folder && object);
-
- objects_length = strlen(objects_folder);
- path_length = strlen(repository_folder);
- ptr = full_path = git__malloc(path_length + objects_length + GIT_OID_HEXSZ + 3);
-
- strcpy(ptr, repository_folder);
- strcpy(ptr + path_length, objects_folder);
-
- ptr = top_folder = ptr + path_length + objects_length;
- *ptr++ = '/';
- git_oid_pathfmt(ptr, git_object_id(object));
- ptr += GIT_OID_HEXSZ + 1;
- *ptr = 0;
-
- *out = full_path;
-
- if (out_folder)
- *out_folder = top_folder;
-}
-
-int loose_object_mode(const char *repository_folder, git_object *object)
-{
- char *object_path;
- struct stat st;
-
- locate_loose_object(repository_folder, object, &object_path, NULL);
- if (p_stat(object_path, &st) < 0)
- return 0;
- free(object_path);
-
- return st.st_mode;
-}
-
-int loose_object_dir_mode(const char *repository_folder, git_object *object)
-{
- char *object_path;
- size_t pos;
- struct stat st;
-
- locate_loose_object(repository_folder, object, &object_path, NULL);
-
- pos = strlen(object_path);
- while (pos--) {
- if (object_path[pos] == '/') {
- object_path[pos] = 0;
- break;
- }
- }
-
- if (p_stat(object_path, &st) < 0)
- return 0;
- free(object_path);
-
- return st.st_mode;
-}
-
-int remove_loose_object(const char *repository_folder, git_object *object)
-{
- char *full_path, *top_folder;
-
- locate_loose_object(repository_folder, object, &full_path, &top_folder);
-
- if (p_unlink(full_path) < 0) {
- fprintf(stderr, "can't delete object file \"%s\"\n", full_path);
- return -1;
- }
-
- *top_folder = 0;
-
- if ((p_rmdir(full_path) < 0) && (errno != ENOTEMPTY)) {
- fprintf(stderr, "can't remove object directory \"%s\"\n", full_path);
- return -1;
- }
-
- git__free(full_path);
-
- return GIT_SUCCESS;
-}
-
-int cmp_objects(git_rawobj *o, object_data *d)
-{
- if (o->type != git_object_string2type(d->type))
- return -1;
- if (o->len != d->dlen)
- return -1;
- if ((o->len > 0) && (memcmp(o->data, d->data, o->len) != 0))
- return -1;
- return 0;
-}
-
-int copy_file(const char *src, const char *dst)
-{
- git_buf source_buf = GIT_BUF_INIT;
- git_file dst_fd;
- int error = GIT_ERROR;
-
- if (git_futils_readbuffer(&source_buf, src) < GIT_SUCCESS)
- return GIT_ENOTFOUND;
-
- dst_fd = git_futils_creat_withpath(dst, 0777, 0666);
- if (dst_fd < 0)
- goto cleanup;
-
- error = p_write(dst_fd, source_buf.ptr, source_buf.size);
-
-cleanup:
- git_buf_free(&source_buf);
- p_close(dst_fd);
-
- return error;
-}
-
-int cmp_files(const char *a, const char *b)
-{
- git_buf buf_a = GIT_BUF_INIT;
- git_buf buf_b = GIT_BUF_INIT;
- int error = GIT_ERROR;
-
- if (git_futils_readbuffer(&buf_a, a) < GIT_SUCCESS)
- return GIT_ERROR;
-
- if (git_futils_readbuffer(&buf_b, b) < GIT_SUCCESS) {
- git_buf_free(&buf_a);
- return GIT_ERROR;
- }
-
- if (buf_a.size == buf_b.size && !memcmp(buf_a.ptr, buf_b.ptr, buf_a.size))
- error = GIT_SUCCESS;
-
- git_buf_free(&buf_a);
- git_buf_free(&buf_b);
-
- return error;
-}
-
-typedef struct {
- git_buf src;
- size_t src_baselen;
- git_buf dst;
- size_t dst_baselen;
-} copydir_data;
-
-static int copy_filesystem_element_recurs(void *_data, git_buf *source)
-{
- copydir_data *data = (copydir_data *)_data;
-
- git_buf_truncate(&data->dst, data->dst_baselen);
- git_buf_puts(&data->dst, source->ptr + data->src_baselen);
-
- if (git_path_isdir(source->ptr) == GIT_SUCCESS)
- return git_path_direach(source, copy_filesystem_element_recurs, _data);
- else
- return copy_file(source->ptr, data->dst.ptr);
-}
-
-int copydir_recurs(
- const char *source_directory_path,
- const char *destination_directory_path)
-{
- int error;
- copydir_data data = { GIT_BUF_INIT, 0, GIT_BUF_INIT, 0 };
-
- /* Source has to exist, Destination hast to _not_ exist */
- if (git_path_isdir(source_directory_path) != GIT_SUCCESS ||
- git_path_isdir(destination_directory_path) == GIT_SUCCESS)
- return GIT_EINVALIDPATH;
-
- git_buf_joinpath(&data.src, source_directory_path, "");
- data.src_baselen = data.src.size;
-
- git_buf_joinpath(&data.dst, destination_directory_path, "");
- data.dst_baselen = data.dst.size;
-
- error = copy_filesystem_element_recurs(&data, &data.src);
-
- git_buf_free(&data.src);
- git_buf_free(&data.dst);
-
- return error;
-}
-
-int open_temp_repo(git_repository **repo, const char *path)
-{
- int error;
- if ((error = copydir_recurs(path, TEMP_REPO_FOLDER)) < GIT_SUCCESS)
- return error;
-
- return git_repository_open(repo, TEMP_REPO_FOLDER);
-}
-
-void close_temp_repo(git_repository *repo)
-{
- git_repository_free(repo);
- if (git_futils_rmdir_r(TEMP_REPO_FOLDER, 1) < GIT_SUCCESS) {
- printf("\nFailed to remove temporary folder. Aborting test suite.\n");
- exit(-1);
- }
-}
-
-typedef struct {
- const char *filename;
- size_t filename_len;
-} remove_data;
-
-static int remove_placeholders_recurs(void *_data, git_buf *path)
-{
- remove_data *data = (remove_data *)_data;
- size_t pathlen;
-
- if (!git_path_isdir(path->ptr))
- return git_path_direach(path, remove_placeholders_recurs, data);
-
- pathlen = path->size;
-
- if (pathlen < data->filename_len)
- return GIT_SUCCESS;
-
- /* if path ends in '/'+filename (or equals filename) */
- if (!strcmp(data->filename, path->ptr + pathlen - data->filename_len) &&
- (pathlen == data->filename_len ||
- path->ptr[pathlen - data->filename_len - 1] == '/'))
- return p_unlink(path->ptr);
-
- return GIT_SUCCESS;
-}
-
-int remove_placeholders(const char *directory_path, const char *filename)
-{
- int error;
- remove_data data;
- git_buf buffer = GIT_BUF_INIT;
-
- if (git_path_isdir(directory_path))
- return GIT_EINVALIDPATH;
-
- if ((error = git_buf_sets(&buffer, directory_path)) < GIT_SUCCESS)
- return error;
-
- data.filename = filename;
- data.filename_len = strlen(filename);
-
- error = remove_placeholders_recurs(&data, &buffer);
-
- git_buf_free(&buffer);
-
- return error;
-}
diff --git a/tests/test_helpers.h b/tests/test_helpers.h
deleted file mode 100644
index a475f66..0000000
--- a/tests/test_helpers.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * This file is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License, version 2,
- * as published by the Free Software Foundation.
- *
- * In addition to the permissions in the GNU General Public License,
- * the authors give you unlimited permission to link the compiled
- * version of this file into combinations with other programs,
- * and to distribute those combinations without any restriction
- * coming from the use of this file. (The General Public License
- * restrictions do apply in other respects; for example, they cover
- * modification of the file, and distribution when not linked into
- * a combined executable.)
- *
- * This file is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; see the file COPYING. If not, write to
- * the Free Software Foundation, 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef INCLUDE_test_helpers_h__
-#define INCLUDE_test_helpers_h__
-
-#include "test_lib.h"
-#include <git2.h>
-
-#include "odb.h"
-
-#define TEST_REPOSITORY_NAME "testrepo.git"
-#define REPOSITORY_FOLDER TEST_RESOURCES "/" TEST_REPOSITORY_NAME "/"
-#define ODB_FOLDER (REPOSITORY_FOLDER "objects/")
-#define TEST_INDEX_PATH (REPOSITORY_FOLDER "index")
-#define TEST_INDEX2_PATH (TEST_RESOURCES "/gitgit.index")
-#define TEST_INDEXBIG_PATH (TEST_RESOURCES "/big.index")
-#define EMPTY_REPOSITORY_FOLDER TEST_RESOURCES "/empty_standard_repo/.gitted/"
-
-#define TEMP_FOLDER ""
-#define TEMP_REPO_FOLDER TEMP_FOLDER TEST_REPOSITORY_NAME "/"
-#define TEMP_REPO_FOLDER_NS TEMP_FOLDER TEST_REPOSITORY_NAME
-#define TEST_STD_REPO_FOLDER TEMP_REPO_FOLDER ".git/"
-
-typedef struct object_data {
- unsigned char *bytes; /* (compressed) bytes stored in object store */
- size_t blen; /* length of data in object store */
- char *id; /* object id (sha1) */
- char *type; /* object type */
- char *dir; /* object store (fan-out) directory name */
- char *file; /* object store filename */
- unsigned char *data; /* (uncompressed) object data */
- size_t dlen; /* length of (uncompressed) object data */
-} object_data;
-
-extern int write_object_data(char *file, void *data, size_t len);
-
-extern int write_object_files(const char *odb_dir, object_data *d);
-
-extern int remove_object_files(const char *odb_dir, object_data *d);
-
-extern int cmp_objects(git_rawobj *o, object_data *d);
-
-extern void locate_loose_object(const char *odb_dir, git_object *object, char **out, char **out_folder);
-
-extern int loose_object_mode(const char *odb_dir, git_object *object);
-extern int loose_object_dir_mode(const char *odb_dir, git_object *object);
-
-extern int remove_loose_object(const char *odb_dir, git_object *object);
-
-extern int cmp_files(const char *a, const char *b);
-extern int copy_file(const char *source, const char *dest);
-extern int rmdir_recurs(const char *directory_path);
-extern int copydir_recurs(const char *source_directory_path, const char *destination_directory_path);
-extern int remove_placeholders(const char *directory_path, const char *filename);
-
-extern int open_temp_repo(git_repository **repo, const char *path);
-extern void close_temp_repo(git_repository *repo);
-
-#endif
-/* INCLUDE_test_helpers_h__ */
diff --git a/tests/test_lib.c b/tests/test_lib.c
deleted file mode 100755
index a4c39df..0000000
--- a/tests/test_lib.c
+++ /dev/null
@@ -1,198 +0,0 @@
-#include <assert.h>
-#include <setjmp.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <math.h>
-
-#include "test_lib.h"
-
-#define DO_ALLOC(TYPE) ((TYPE*) malloc(sizeof(TYPE)))
-#define GIT_MAX_TEST_CASES 64
-
-struct git_test {
- char *name;
- char *message;
- char *failed_pos;
- char *description;
- char *error_message;
-
- git_testfunc function;
- unsigned failed:1, ran:1;
- jmp_buf *jump;
-};
-
-struct git_testsuite {
- char *name;
- int count, fail_count;
- git_test *list[GIT_MAX_TEST_CASES];
-};
-
-static void test_free(git_test *t)
-{
- if (t) {
- free(t->name);
- free(t->description);
- free(t->failed_pos);
- free(t->message);
- free(t->error_message);
- free(t);
- }
-}
-
-static void test_run(git_test *tc)
-{
- jmp_buf buf;
- tc->jump = &buf;
-
- if (setjmp(buf) == 0) {
- tc->ran = 1;
- (tc->function)(tc);
- }
-
- tc->jump = 0;
-}
-
-static git_test *create_test(git_testfunc function)
-{
- git_test *t = DO_ALLOC(git_test);
-
- memset(t, 0x0, sizeof(git_test));
- t->function = function;
-
- return t;
-}
-
-void git_test__init(git_test *t, const char *name, const char *description)
-{
- t->name = strdup(name);
- t->description = strdup(description);
-}
-
-
-/*-------------------------------------------------------------------------*
- * Public assert methods
- *-------------------------------------------------------------------------*/
-
-static void fail_test(git_test *tc, const char *file, int line, const char *message)
-{
- char buf[1024];
- const char *last_error = git_lasterror();
-
- snprintf(buf, 1024, "%s:%d", file, line);
-
- tc->failed = 1;
- tc->message = strdup(message);
- tc->failed_pos = strdup(buf);
-
- if (last_error)
- tc->error_message = strdup(last_error);
-
- if (tc->jump != 0)
- longjmp(*(tc->jump), 0);
-}
-
-void git_test__fail(git_test *tc, const char *file, int line, const char *message)
-{
- fail_test(tc, file, line, message);
-}
-
-void git_test__assert(git_test *tc, const char *file, int line, const char *message, int condition)
-{
- if (condition == 0)
- fail_test(tc, file, line, message);
-}
-
-void git_test__assert_pass(git_test *tc, const char *file, int line, const char *message, int ret_value)
-{
- if (ret_value < 0)
- fail_test(tc, file, line, message);
-}
-
-/*-------------------------------------------------------------------------*
- * Test Suite
- *-------------------------------------------------------------------------*/
-
-static void testsuite_init(git_testsuite *ts)
-{
- ts->count = 0;
- ts->fail_count = 0;
- memset(ts->list, 0, sizeof(ts->list));
-}
-
-git_testsuite *git_testsuite_new(const char *name)
-{
- git_testsuite *ts = DO_ALLOC(git_testsuite);
- testsuite_init(ts);
- ts->name = strdup(name);
- return ts;
-}
-
-static void free_suite(git_testsuite *ts)
-{
- unsigned int n;
-
- for (n = 0; n < GIT_MAX_TEST_CASES; n++)
- if (ts->list[n])
- test_free(ts->list[n]);
-
- free(ts->name);
- free(ts);
-}
-
-void git_testsuite_add(git_testsuite *ts, git_testfunc test)
-{
- assert(ts->count < GIT_MAX_TEST_CASES);
- ts->list[ts->count++] = create_test(test);
-}
-
-static void print_details(git_testsuite *ts)
-{
- int i;
- int failCount = 0;
-
- if (ts->fail_count == 0) {
- const char *testWord = ts->count == 1 ? "test" : "tests";
- printf("OK (%d %s)\n", ts->count, testWord);
- } else {
- printf("Failed (%d failures):\n", ts->fail_count);
-
- for (i = 0 ; i < ts->count ; ++i) {
- git_test *tc = ts->list[i];
- if (tc->failed) {
- failCount++;
- printf(" %d) \"%s\" [test %s @ %s]\n\t%s\n",
- failCount, tc->description, tc->name, tc->failed_pos, tc->message);
- if (tc->error_message)
- printf("\tError: %s\n", tc->error_message);
- }
- }
- }
-}
-
-int git_testsuite_run(git_testsuite *ts)
-{
- int i, fail_count;
-
- printf("Suite \"%s\": ", ts->name);
-
- for (i = 0 ; i < ts->count ; ++i) {
- git_test *tc = ts->list[i];
-
- test_run(tc);
- if (tc->failed) {
- ts->fail_count++;
- putchar('F');
- } else
- putchar('.');
-
- fflush(stdout);
- }
- printf("\n ");
- print_details(ts);
- fail_count = ts->fail_count;
-
- free_suite(ts);
- return fail_count;
-}
-
diff --git a/tests/test_lib.h b/tests/test_lib.h
deleted file mode 100755
index 9d90e48..0000000
--- a/tests/test_lib.h
+++ /dev/null
@@ -1,54 +0,0 @@
-#ifndef __LIBGIT2_TEST_H__
-#define __LIBGIT2_TEST_H__
-
-#include <stdarg.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "common.h"
-#include <git2.h>
-
-#define DECLARE_SUITE(SNAME) extern git_testsuite *libgit2_suite_##SNAME(void)
-#define SUITE_NAME(SNAME) libgit2_suite_##SNAME
-
-#define BEGIN_SUITE(SNAME) \
- git_testsuite *libgit2_suite_##SNAME(void);\
- git_testsuite *libgit2_suite_##SNAME(void) {\
- git_testsuite *_gitsuite = git_testsuite_new(#SNAME);
-
-#define ADD_TEST(TNAME) \
- git_testsuite_add(_gitsuite, _gittest__##TNAME);
-
-#define END_SUITE \
- return _gitsuite;\
- }
-
-#define BEGIN_TEST(TNAME, DESC) \
- static void _gittest__##TNAME(git_test *_gittest) { \
- git_test__init(_gittest, #TNAME, DESC); \
- git_clearerror();\
- {\
-
-#define END_TEST }}
-
-typedef struct git_test git_test;
-typedef struct git_testsuite git_testsuite;
-typedef void (*git_testfunc)(git_test *);
-typedef git_testsuite *(*libgit2_suite)(void);
-
-void git_test__init(git_test *t, const char *name, const char *description);
-void git_test__fail(git_test *tc, const char *file, int line, const char *message);
-void git_test__assert(git_test *tc, const char *file, int line, const char *message, int condition);
-void git_test__assert_pass(git_test *tc, const char *file, int line, const char *message, int ret_value);
-
-#define must_pass(expr) git_test__assert_pass(_gittest, __FILE__, __LINE__, "Method failed: " #expr, (expr))
-#define must_fail(expr) git_test__assert(_gittest, __FILE__, __LINE__, "Expected method to fail: " #expr, (expr) < 0)
-#define must_be_true(expr) git_test__assert(_gittest, __FILE__, __LINE__, "Expression is not true: " #expr, !!(expr))
-
-git_testsuite *git_testsuite_new(const char *name);
-void git_testsuite_add(git_testsuite *ts, git_testfunc test);
-int git_testsuite_run(git_testsuite *ts);
-
-#endif
-
diff --git a/tests/test_main.c b/tests/test_main.c
deleted file mode 100644
index 50256e9..0000000
--- a/tests/test_main.c
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * This file is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License, version 2,
- * as published by the Free Software Foundation.
- *
- * In addition to the permissions in the GNU General Public License,
- * the authors give you unlimited permission to link the compiled
- * version of this file into combinations with other programs,
- * and to distribute those combinations without any restriction
- * coming from the use of this file. (The General Public License
- * restrictions do apply in other respects; for example, they cover
- * modification of the file, and distribution when not linked into
- * a combined executable.)
- *
- * This file is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; see the file COPYING. If not, write to
- * the Free Software Foundation, 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#include <string.h>
-#include <git2.h>
-
-#include "posix.h"
-
-#include "test_lib.h"
-#include "test_helpers.h"
-
-DECLARE_SUITE(core);
-DECLARE_SUITE(rawobjects);
-DECLARE_SUITE(objwrite);
-DECLARE_SUITE(commit);
-DECLARE_SUITE(revwalk);
-DECLARE_SUITE(index);
-DECLARE_SUITE(hashtable);
-DECLARE_SUITE(tag);
-DECLARE_SUITE(tree);
-DECLARE_SUITE(refs);
-DECLARE_SUITE(repository);
-DECLARE_SUITE(threads);
-DECLARE_SUITE(buffers);
-DECLARE_SUITE(status);
-
-static libgit2_suite suite_methods[]= {
- SUITE_NAME(core),
- SUITE_NAME(rawobjects),
- SUITE_NAME(objwrite),
- SUITE_NAME(commit),
- SUITE_NAME(revwalk),
- SUITE_NAME(index),
- SUITE_NAME(hashtable),
- SUITE_NAME(tag),
- SUITE_NAME(tree),
- SUITE_NAME(refs),
- SUITE_NAME(repository),
- SUITE_NAME(threads),
- SUITE_NAME(buffers),
- SUITE_NAME(status),
-};
-
-#define GIT_SUITE_COUNT (ARRAY_SIZE(suite_methods))
-
-#ifdef GIT_WIN32
-int __cdecl
-#else
-int
-#endif
-main(int argc, char *argv[])
-{
- unsigned int i, failures;
-
- GIT_UNUSED(argc);
- GIT_UNUSED(argv);
-
- git_threads_init();
-
- p_umask(0);
-
- failures = 0;
-
- for (i = 0; i < GIT_SUITE_COUNT; ++i)
- failures += git_testsuite_run(suite_methods[i]());
-
- git_threads_shutdown();
-
- return failures ? -1 : 0;
-}
-
diff --git a/tests/tests.supp b/tests/tests.supp
deleted file mode 100644
index fe9d965..0000000
--- a/tests/tests.supp
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- ignore-zlib-cond
- Memcheck:Cond
- obj:*libz.so*
-}
-