Merge pull request #4475 from pks-t/pks/v0.26.1-backports v0.26.3 backports
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
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 9f12016..ef5347c 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,28 @@
+v0.26.3
+-------
+
+This is a bugfix release. It includes the following non-exclusive list of
+improvements, which have been backported from the master branch:
+
+* Fix cloning of the libgit2 project with `git clone --recursive` by removing an
+ invalid submodule from our testing data.
+
+* Fix endianness of the port in `p_getaddrinfo()`.
+
+* Fix handling of negative gitignore rules with wildcards.
+
+* Fix handling of case-insensitive negative gitignore rules.
+
+* Fix resolving references to a tag if the reference is stored with its fully
+ resolved OID in the packed-refs file.
+
+* Fix checkout not treating worktree files as modified when only their mode has
+ changed.
+
+* Fix rename detection with `GIT_DIFF_FIND_RENAMES_FROM_REWRITES`.
+
+* Enable Windows 7 and earlier to use TLS 1.2.
+
v0.26.2
-------
diff --git a/deps/winhttp/winhttp.h b/deps/winhttp/winhttp.h
index dd1986a..b7fef1c 100644
--- a/deps/winhttp/winhttp.h
+++ b/deps/winhttp/winhttp.h
@@ -437,10 +437,12 @@ typedef int INTERNET_SCHEME, *LPINTERNET_SCHEME;
#define WINHTTP_CALLBACK_STATUS_FLAG_CERT_WRONG_USAGE 0x00000040
#define WINHTTP_CALLBACK_STATUS_FLAG_SECURITY_CHANNEL_ERROR 0x80000000
-#define WINHTTP_FLAG_SECURE_PROTOCOL_SSL2 0x00000008
-#define WINHTTP_FLAG_SECURE_PROTOCOL_SSL3 0x00000020
-#define WINHTTP_FLAG_SECURE_PROTOCOL_TLS1 0x00000080
-#define WINHTTP_FLAG_SECURE_PROTOCOL_ALL (WINHTTP_FLAG_SECURE_PROTOCOL_SSL2 | WINHTTP_FLAG_SECURE_PROTOCOL_SSL3 | WINHTTP_FLAG_SECURE_PROTOCOL_TLS1)
+#define WINHTTP_FLAG_SECURE_PROTOCOL_SSL2 0x00000008
+#define WINHTTP_FLAG_SECURE_PROTOCOL_SSL3 0x00000020
+#define WINHTTP_FLAG_SECURE_PROTOCOL_TLS1 0x00000080
+#define WINHTTP_FLAG_SECURE_PROTOCOL_TLS1_1 0x00000200
+#define WINHTTP_FLAG_SECURE_PROTOCOL_TLS1_2 0x00000800
+#define WINHTTP_FLAG_SECURE_PROTOCOL_ALL (WINHTTP_FLAG_SECURE_PROTOCOL_SSL2 | WINHTTP_FLAG_SECURE_PROTOCOL_SSL3 | WINHTTP_FLAG_SECURE_PROTOCOL_TLS1)
#define WINHTTP_AUTH_SCHEME_BASIC 0x00000001
#define WINHTTP_AUTH_SCHEME_NTLM 0x00000002
diff --git a/include/git2.h b/include/git2.h
index bc4333c..5f6104e 100644
--- a/include/git2.h
+++ b/include/git2.h
@@ -62,5 +62,6 @@
#include "git2/tree.h"
#include "git2/types.h"
#include "git2/version.h"
+#include "git2/worktree.h"
#endif
diff --git a/include/git2/sys/mempack.h b/include/git2/sys/mempack.h
index 96074fb..490636b 100644
--- a/include/git2/sys/mempack.h
+++ b/include/git2/sys/mempack.h
@@ -11,6 +11,7 @@
#include "git2/types.h"
#include "git2/oid.h"
#include "git2/odb.h"
+#include "git2/buffer.h"
/**
* @file git2/sys/mempack.h
@@ -38,10 +39,10 @@ GIT_BEGIN_DECL
* Subsequent reads will also be served from the in-memory store
* to ensure consistency, until the memory store is dumped.
*
- * @param out Poiter where to store the ODB backend
+ * @param out Pointer where to store the ODB backend
* @return 0 on success; error code otherwise
*/
-int git_mempack_new(git_odb_backend **out);
+GIT_EXTERN(int) git_mempack_new(git_odb_backend **out);
/**
* Dump all the queued in-memory writes to a packfile.
@@ -64,7 +65,7 @@ int git_mempack_new(git_odb_backend **out);
* @param backend The mempack backend
* @return 0 on success; error code otherwise
*/
-int git_mempack_dump(git_buf *pack, git_repository *repo, git_odb_backend *backend);
+GIT_EXTERN(int) git_mempack_dump(git_buf *pack, git_repository *repo, git_odb_backend *backend);
/**
* Reset the memory packer by clearing all the queued objects.
@@ -78,7 +79,7 @@ int git_mempack_dump(git_buf *pack, git_repository *repo, git_odb_backend *backe
*
* @param backend The mempack backend
*/
-void git_mempack_reset(git_odb_backend *backend);
+GIT_EXTERN(void) git_mempack_reset(git_odb_backend *backend);
GIT_END_DECL
diff --git a/include/git2/version.h b/include/git2/version.h
index edb1dd5..689c51d 100644
--- a/include/git2/version.h
+++ b/include/git2/version.h
@@ -7,10 +7,10 @@
#ifndef INCLUDE_git_version_h__
#define INCLUDE_git_version_h__
-#define LIBGIT2_VERSION "0.26.2"
+#define LIBGIT2_VERSION "0.26.3"
#define LIBGIT2_VER_MAJOR 0
#define LIBGIT2_VER_MINOR 26
-#define LIBGIT2_VER_REVISION 2
+#define LIBGIT2_VER_REVISION 3
#define LIBGIT2_VER_PATCH 0
#define LIBGIT2_SOVERSION 26
diff --git a/src/checkout.c b/src/checkout.c
index 25018d2..cb9a7b3 100644
--- a/src/checkout.c
+++ b/src/checkout.c
@@ -159,6 +159,19 @@ GIT_INLINE(bool) is_workdir_base_or_new(
git_oid__cmp(&newitem->id, workdir_id) == 0);
}
+GIT_INLINE(bool) is_file_mode_changed(git_filemode_t a, git_filemode_t b)
+{
+#ifdef GIT_WIN32
+ /*
+ * On Win32 we do not support the executable bit; the file will
+ * always be 0100644 on disk, don't bother doing a test.
+ */
+ return false;
+#else
+ return (S_ISREG(a) && S_ISREG(b) && a != b);
+#endif
+}
+
static bool checkout_is_workdir_modified(
checkout_data *data,
const git_diff_file *baseitem,
@@ -192,16 +205,23 @@ static bool checkout_is_workdir_modified(
return rval;
}
- /* Look at the cache to decide if the workdir is modified. If not,
- * we can simply compare the oid in the cache to the baseitem instead
- * of hashing the file. If so, we allow the checkout to proceed if the
- * oid is identical (ie, the staged item is what we're trying to check
- * out.)
+ /*
+ * Look at the cache to decide if the workdir is modified: if the
+ * cache contents match the workdir contents, then we do not need
+ * to examine the working directory directly, instead we can
+ * examine the cache to see if _it_ has been modified. This allows
+ * us to avoid touching the disk.
*/
- if ((ie = git_index_get_bypath(data->index, wditem->path, 0)) != NULL) {
- if (git_index_time_eq(&wditem->mtime, &ie->mtime) &&
- wditem->file_size == ie->file_size)
- return !is_workdir_base_or_new(&ie->id, baseitem, newitem);
+ ie = git_index_get_bypath(data->index, wditem->path, 0);
+
+ if (ie != NULL &&
+ git_index_time_eq(&wditem->mtime, &ie->mtime) &&
+ wditem->file_size == ie->file_size &&
+ !is_file_mode_changed(wditem->mode, ie->mode)) {
+
+ /* The workdir is modified iff the index entry is modified */
+ return !is_workdir_base_or_new(&ie->id, baseitem, newitem) ||
+ is_file_mode_changed(baseitem->mode, ie->mode);
}
/* depending on where base is coming from, we may or may not know
@@ -214,6 +234,9 @@ static bool checkout_is_workdir_modified(
if (S_ISDIR(wditem->mode))
return false;
+ if (is_file_mode_changed(baseitem->mode, wditem->mode))
+ return true;
+
if (git_diff__oid_for_entry(&oid, data->diff, wditem, wditem->mode, NULL) < 0)
return false;
diff --git a/src/curl_stream.c b/src/curl_stream.c
index 4e0455c..f07370f 100644
--- a/src/curl_stream.c
+++ b/src/curl_stream.c
@@ -12,6 +12,7 @@
#include "stream.h"
#include "git2/transport.h"
#include "buffer.h"
+#include "global.h"
#include "vector.h"
#include "proxy.h"
@@ -36,6 +37,18 @@ typedef struct {
git_cred *proxy_cred;
} curl_stream;
+int git_curl_stream_global_init(void)
+{
+ if (curl_global_init(CURL_GLOBAL_ALL) != 0) {
+ giterr_set(GITERR_NET, "could not initialize curl");
+ return -1;
+ }
+
+ /* `curl_global_cleanup` is provided by libcurl */
+ git__on_shutdown(curl_global_cleanup);
+ return 0;
+}
+
static int seterr_curl(curl_stream *s)
{
giterr_set(GITERR_NET, "curl error: %s\n", s->curl_error);
@@ -193,6 +206,7 @@ static int curls_set_proxy(git_stream *stream, const git_proxy_options *proxy_op
CURLcode res;
curl_stream *s = (curl_stream *) stream;
+ git_proxy_options_clear(&s->proxy);
if ((error = git_proxy_options_dup(&s->proxy, proxy_opts)) < 0)
return error;
@@ -293,6 +307,8 @@ static void curls_free(git_stream *stream)
curls_close(stream);
git_strarray_free(&s->cert_info_strings);
+ git_proxy_options_clear(&s->proxy);
+ git_cred_free(s->proxy_cred);
git__free(s);
}
@@ -348,6 +364,11 @@ int git_curl_stream_new(git_stream **out, const char *host, const char *port)
#include "stream.h"
+int git_curl_stream_global_init(void)
+{
+ return 0;
+}
+
int git_curl_stream_new(git_stream **out, const char *host, const char *port)
{
GIT_UNUSED(out);
diff --git a/src/curl_stream.h b/src/curl_stream.h
index 283f0fe..6f192c5 100644
--- a/src/curl_stream.h
+++ b/src/curl_stream.h
@@ -9,6 +9,7 @@
#include "git2/sys/stream.h"
+extern int git_curl_stream_global_init(void);
extern int git_curl_stream_new(git_stream **out, const char *host, const char *port);
#endif
diff --git a/src/diff.c b/src/diff.c
index a93bd4c..65565fc 100644
--- a/src/diff.c
+++ b/src/diff.c
@@ -12,13 +12,6 @@
#include "commit.h"
#include "index.h"
-#define DIFF_FLAG_IS_SET(DIFF,FLAG) \
- (((DIFF)->opts.flags & (FLAG)) != 0)
-#define DIFF_FLAG_ISNT_SET(DIFF,FLAG) \
- (((DIFF)->opts.flags & (FLAG)) == 0)
-#define DIFF_FLAG_SET(DIFF,FLAG,VAL) (DIFF)->opts.flags = \
- (VAL) ? ((DIFF)->opts.flags | (FLAG)) : ((DIFF)->opts.flags & ~(VAL))
-
GIT_INLINE(const char *) diff_delta__path(const git_diff_delta *delta)
{
const char *str = delta->old_file.path;
diff --git a/src/diff_file.c b/src/diff_file.c
index d5fc5e9..0d4201f 100644
--- a/src/diff_file.c
+++ b/src/diff_file.c
@@ -138,7 +138,6 @@ int git_diff_file_content__init_from_src(
memset(fc, 0, sizeof(*fc));
fc->repo = repo;
fc->file = as_file;
- fc->blob = src->blob;
if (!src->blob && !src->buf) {
fc->flags |= GIT_DIFF_FLAG__NO_DATA;
@@ -148,12 +147,15 @@ int git_diff_file_content__init_from_src(
fc->file->mode = GIT_FILEMODE_BLOB;
if (src->blob) {
+ git_blob_dup((git_blob **)&fc->blob, (git_blob *) src->blob);
fc->file->size = git_blob_rawsize(src->blob);
git_oid_cpy(&fc->file->id, git_blob_id(src->blob));
fc->file->id_abbrev = GIT_OID_HEXSZ;
fc->map.len = (size_t)fc->file->size;
fc->map.data = (char *)git_blob_rawcontent(src->blob);
+
+ fc->flags |= GIT_DIFF_FLAG__FREE_BLOB;
} else {
fc->file->size = src->buflen;
git_odb_hash(&fc->file->id, src->buf, src->buflen, GIT_OBJ_BLOB);
diff --git a/src/diff_generate.c b/src/diff_generate.c
index f6cc04f..5d3e0c6 100644
--- a/src/diff_generate.c
+++ b/src/diff_generate.c
@@ -23,7 +23,7 @@
(((DIFF)->base.opts.flags & (FLAG)) == 0)
#define DIFF_FLAG_SET(DIFF,FLAG,VAL) (DIFF)->base.opts.flags = \
(VAL) ? ((DIFF)->base.opts.flags | (FLAG)) : \
- ((DIFF)->base.opts.flags & ~(VAL))
+ ((DIFF)->base.opts.flags & ~(FLAG))
typedef struct {
struct git_diff base;
diff --git a/src/diff_tform.c b/src/diff_tform.c
index b004ddd..5888bda 100644
--- a/src/diff_tform.c
+++ b/src/diff_tform.c
@@ -685,8 +685,10 @@ static bool is_rename_target(
break;
}
if (FLAG_SET(opts, GIT_DIFF_FIND_RENAMES_FROM_REWRITES) &&
- delta->similarity < opts->rename_from_rewrite_threshold)
+ delta->similarity < opts->rename_from_rewrite_threshold) {
+ delta->flags |= GIT_DIFF_FLAG__TO_SPLIT;
break;
+ }
return false;
diff --git a/src/global.c b/src/global.c
index afa57e1..0b347a3 100644
--- a/src/global.c
+++ b/src/global.c
@@ -10,6 +10,7 @@
#include "sysdir.h"
#include "filter.h"
#include "merge_driver.h"
+#include "curl_stream.h"
#include "openssl_stream.h"
#include "thread-utils.h"
#include "git2/global.h"
@@ -22,7 +23,7 @@
git_mutex git__mwindow_mutex;
-#define MAX_SHUTDOWN_CB 9
+#define MAX_SHUTDOWN_CB 10
static git_global_shutdown_fn git__shutdown_callbacks[MAX_SHUTDOWN_CB];
static git_atomic git__n_shutdown_callbacks;
@@ -62,7 +63,8 @@ static int init_common(void)
(ret = git_filter_global_init()) == 0 &&
(ret = git_merge_driver_global_init()) == 0 &&
(ret = git_transport_ssh_global_init()) == 0 &&
- (ret = git_openssl_stream_global_init()) == 0)
+ (ret = git_openssl_stream_global_init()) == 0 &&
+ (ret = git_curl_stream_global_init()) == 0)
ret = git_mwindow_global_init();
GIT_MEMORY_BARRIER;
diff --git a/src/hash/hash_openssl.h b/src/hash/hash_openssl.h
index 9a55d47..048c2bd 100644
--- a/src/hash/hash_openssl.h
+++ b/src/hash/hash_openssl.h
@@ -23,21 +23,36 @@ struct git_hash_ctx {
GIT_INLINE(int) git_hash_init(git_hash_ctx *ctx)
{
assert(ctx);
- SHA1_Init(&ctx->c);
+
+ if (SHA1_Init(&ctx->c) != 1) {
+ giterr_set(GITERR_SHA1, "hash_openssl: failed to initialize hash context");
+ return -1;
+ }
+
return 0;
}
GIT_INLINE(int) git_hash_update(git_hash_ctx *ctx, const void *data, size_t len)
{
assert(ctx);
- SHA1_Update(&ctx->c, data, len);
+
+ if (SHA1_Update(&ctx->c, data, len) != 1) {
+ giterr_set(GITERR_SHA1, "hash_openssl: failed to update hash");
+ return -1;
+ }
+
return 0;
}
GIT_INLINE(int) git_hash_final(git_oid *out, git_hash_ctx *ctx)
{
assert(ctx);
- SHA1_Final(out->id, &ctx->c);
+
+ if (SHA1_Final(out->id, &ctx->c) != 1) {
+ giterr_set(GITERR_SHA1, "hash_openssl: failed to finalize hash");
+ return -1;
+ }
+
return 0;
}
diff --git a/src/ignore.c b/src/ignore.c
index c324d4d..9e1619c 100644
--- a/src/ignore.c
+++ b/src/ignore.c
@@ -40,38 +40,42 @@
*/
static int does_negate_pattern(git_attr_fnmatch *rule, git_attr_fnmatch *neg)
{
+ int (*cmp)(const char *, const char *, size_t);
git_attr_fnmatch *longer, *shorter;
char *p;
- if ((rule->flags & GIT_ATTR_FNMATCH_NEGATIVE) == 0
- && (neg->flags & GIT_ATTR_FNMATCH_NEGATIVE) != 0) {
-
- /* If lengths match we need to have an exact match */
- if (rule->length == neg->length) {
- return strcmp(rule->pattern, neg->pattern) == 0;
- } else if (rule->length < neg->length) {
- shorter = rule;
- longer = neg;
- } else {
- shorter = neg;
- longer = rule;
- }
-
- /* Otherwise, we need to check if the shorter
- * rule is a basename only (that is, it contains
- * no path separator) and, if so, if it
- * matches the tail of the longer rule */
- p = longer->pattern + longer->length - shorter->length;
+ if ((rule->flags & GIT_ATTR_FNMATCH_NEGATIVE) != 0
+ || (neg->flags & GIT_ATTR_FNMATCH_NEGATIVE) == 0)
+ return false;
+
+ if (neg->flags & GIT_ATTR_FNMATCH_ICASE)
+ cmp = git__strncasecmp;
+ else
+ cmp = git__strncmp;
+
+ /* If lengths match we need to have an exact match */
+ if (rule->length == neg->length) {
+ return cmp(rule->pattern, neg->pattern, rule->length) == 0;
+ } else if (rule->length < neg->length) {
+ shorter = rule;
+ longer = neg;
+ } else {
+ shorter = neg;
+ longer = rule;
+ }
- if (p[-1] != '/')
- return false;
- if (memchr(shorter->pattern, '/', shorter->length) != NULL)
- return false;
+ /* Otherwise, we need to check if the shorter
+ * rule is a basename only (that is, it contains
+ * no path separator) and, if so, if it
+ * matches the tail of the longer rule */
+ p = longer->pattern + longer->length - shorter->length;
- return memcmp(p, shorter->pattern, shorter->length) == 0;
- }
+ if (p[-1] != '/')
+ return false;
+ if (memchr(shorter->pattern, '/', shorter->length) != NULL)
+ return false;
- return false;
+ return cmp(p, shorter->pattern, shorter->length) == 0;
}
/**
@@ -89,7 +93,7 @@ static int does_negate_pattern(git_attr_fnmatch *rule, git_attr_fnmatch *neg)
*/
static int does_negate_rule(int *out, git_vector *rules, git_attr_fnmatch *match)
{
- int error = 0;
+ int error = 0, fnflags;
size_t i;
git_attr_fnmatch *rule;
char *path;
@@ -97,6 +101,10 @@ static int does_negate_rule(int *out, git_vector *rules, git_attr_fnmatch *match
*out = 0;
+ fnflags = FNM_PATHNAME;
+ if (match->flags & GIT_ATTR_FNMATCH_ICASE)
+ fnflags |= FNM_IGNORECASE;
+
/* path of the file relative to the workdir, so we match the rules in subdirs */
if (match->containing_dir) {
git_buf_puts(&buf, match->containing_dir);
@@ -117,12 +125,12 @@ static int does_negate_rule(int *out, git_vector *rules, git_attr_fnmatch *match
continue;
}
- /*
- * When dealing with a directory, we add '/<star>' so
- * p_fnmatch() honours FNM_PATHNAME. Checking for LEADINGDIR
- * alone isn't enough as that's also set for nagations, so we
- * need to check that NEGATIVE is off.
- */
+ /*
+ * When dealing with a directory, we add '/<star>' so
+ * p_fnmatch() honours FNM_PATHNAME. Checking for LEADINGDIR
+ * alone isn't enough as that's also set for nagations, so we
+ * need to check that NEGATIVE is off.
+ */
git_buf_clear(&buf);
if (rule->containing_dir) {
git_buf_puts(&buf, rule->containing_dir);
@@ -136,7 +144,7 @@ static int does_negate_rule(int *out, git_vector *rules, git_attr_fnmatch *match
if (error < 0)
goto out;
- if ((error = p_fnmatch(git_buf_cstr(&buf), path, FNM_PATHNAME)) < 0) {
+ if ((error = p_fnmatch(git_buf_cstr(&buf), path, fnflags)) < 0) {
giterr_set(GITERR_INVALID, "error matching pattern");
goto out;
}
@@ -197,10 +205,26 @@ static int parse_ignore_file(
if (ignore_case)
match->flags |= GIT_ATTR_FNMATCH_ICASE;
+ while (match->length > 0) {
+ if (match->pattern[match->length - 1] == ' ' ||
+ match->pattern[match->length - 1] == '\t') {
+ match->pattern[match->length - 1] = 0;
+ match->length --;
+ } else {
+ break;
+ }
+ }
+
scan = git__next_line(scan);
- /* if a negative match doesn't actually do anything, throw it away */
- if (match->flags & GIT_ATTR_FNMATCH_NEGATIVE)
+ /*
+ * If a negative match doesn't actually do anything,
+ * throw it away. As we cannot always verify whether a
+ * rule containing wildcards negates another rule, we
+ * do not optimize away these rules, though.
+ * */
+ if (match->flags & GIT_ATTR_FNMATCH_NEGATIVE
+ && !(match->flags & GIT_ATTR_FNMATCH_HASWILD))
error = does_negate_rule(&valid_rule, &attrs->rules, match);
if (!error && valid_rule)
diff --git a/src/indexer.c b/src/indexer.c
index 15f6cc2..69ceea5 100644
--- a/src/indexer.c
+++ b/src/indexer.c
@@ -843,6 +843,7 @@ static int fix_thin_pack(git_indexer *idx, git_transfer_progress *stats)
static int resolve_deltas(git_indexer *idx, git_transfer_progress *stats)
{
unsigned int i;
+ int error;
struct delta_info *delta;
int progressed = 0, non_null = 0, progress_cb_result;
@@ -857,8 +858,13 @@ static int resolve_deltas(git_indexer *idx, git_transfer_progress *stats)
non_null = 1;
idx->off = delta->delta_off;
- if (git_packfile_unpack(&obj, idx->pack, &idx->off) < 0)
- continue;
+ if ((error = git_packfile_unpack(&obj, idx->pack, &idx->off)) < 0) {
+ if (error == GIT_PASSTHROUGH) {
+ /* We have not seen the base object, we'll try again later. */
+ continue;
+ }
+ return -1;
+ }
if (hash_and_save(idx, &obj, delta->delta_off) < 0)
continue;
@@ -950,6 +956,10 @@ int git_indexer_commit(git_indexer *idx, git_transfer_progress *stats)
giterr_set(GITERR_INDEXER, "unexpected data at the end of the pack");
return -1;
}
+ if (idx->off + 20 > idx->pack->mwf.size) {
+ giterr_set(GITERR_INDEXER, "missing trailer at the end of the pack");
+ return -1;
+ }
packfile_trailer = git_mwindow_open(&idx->pack->mwf, &w, idx->pack->mwf.size - GIT_OID_RAWSZ, GIT_OID_RAWSZ, &left);
if (packfile_trailer == NULL) {
@@ -1118,6 +1128,9 @@ void git_indexer_free(git_indexer *idx)
if (idx == NULL)
return;
+ if (idx->have_stream)
+ git_packfile_stream_free(&idx->stream);
+
git_vector_free_deep(&idx->objects);
if (idx->pack->idx_cache) {
diff --git a/src/merge.c b/src/merge.c
index 6e00b5a..a85b0a6 100644
--- a/src/merge.c
+++ b/src/merge.c
@@ -2141,7 +2141,7 @@ static int compute_base(
git_oidarray bases = {0};
git_annotated_commit *base = NULL, *other = NULL, *new_base = NULL;
git_merge_options opts = GIT_MERGE_OPTIONS_INIT;
- size_t i;
+ size_t i, base_count;
int error;
*out = NULL;
@@ -2149,17 +2149,27 @@ static int compute_base(
if (given_opts)
memcpy(&opts, given_opts, sizeof(git_merge_options));
- if ((error = insert_head_ids(&head_ids, one)) < 0 ||
- (error = insert_head_ids(&head_ids, two)) < 0)
+ /* With more than two commits, merge_bases_many finds the base of
+ * the first commit and a hypothetical merge of the others. Since
+ * "one" may itself be a virtual commit, which insert_head_ids
+ * substitutes multiple ancestors for, it needs to be added
+ * after "two" which is always a single real commit.
+ */
+ if ((error = insert_head_ids(&head_ids, two)) < 0 ||
+ (error = insert_head_ids(&head_ids, one)) < 0 ||
+ (error = git_merge_bases_many(&bases, repo,
+ head_ids.size, head_ids.ptr)) < 0)
goto done;
- if ((error = git_merge_bases_many(&bases, repo,
- head_ids.size, head_ids.ptr)) < 0 ||
- (error = git_annotated_commit_lookup(&base, repo, &bases.ids[0])) < 0 ||
- (opts.flags & GIT_MERGE_NO_RECURSIVE))
+ base_count = (opts.flags & GIT_MERGE_NO_RECURSIVE) ? 0 : bases.count;
+
+ if (base_count)
+ git_oidarray__reverse(&bases);
+
+ if ((error = git_annotated_commit_lookup(&base, repo, &bases.ids[0])) < 0)
goto done;
- for (i = 1; i < bases.count; i++) {
+ for (i = 1; i < base_count; i++) {
recursion_level++;
if (opts.recursion_limit && recursion_level > opts.recursion_limit)
diff --git a/src/odb_mempack.c b/src/odb_mempack.c
index d6f2fb4..98cc546 100644
--- a/src/odb_mempack.c
+++ b/src/odb_mempack.c
@@ -8,6 +8,7 @@
#include "common.h"
#include "git2/object.h"
#include "git2/sys/odb_backend.h"
+#include "git2/sys/mempack.h"
#include "fileops.h"
#include "hash.h"
#include "odb.h"
diff --git a/src/oidarray.c b/src/oidarray.c
index 1d51a29..99b7bd1 100644
--- a/src/oidarray.c
+++ b/src/oidarray.c
@@ -19,3 +19,15 @@ void git_oidarray__from_array(git_oidarray *arr, git_array_oid_t *array)
arr->count = array->size;
arr->ids = array->ptr;
}
+
+void git_oidarray__reverse(git_oidarray *arr)
+{
+ size_t i;
+ git_oid tmp;
+
+ for (i = 0; i < arr->count / 2; i++) {
+ git_oid_cpy(&tmp, &arr->ids[i]);
+ git_oid_cpy(&arr->ids[i], &arr->ids[(arr->count-1)-i]);
+ git_oid_cpy(&arr->ids[(arr->count-1)-i], &tmp);
+ }
+}
diff --git a/src/oidarray.h b/src/oidarray.h
index a7215ae..db7e1ac 100644
--- a/src/oidarray.h
+++ b/src/oidarray.h
@@ -13,6 +13,7 @@
typedef git_array_t(git_oid) git_array_oid_t;
+extern void git_oidarray__reverse(git_oidarray *arr);
extern void git_oidarray__from_array(git_oidarray *arr, git_array_oid_t *array);
#endif
diff --git a/src/openssl_stream.c b/src/openssl_stream.c
index 759c501..6bab6b5 100644
--- a/src/openssl_stream.c
+++ b/src/openssl_stream.c
@@ -149,11 +149,20 @@ int git_openssl_stream_global_init(void)
return 0;
}
+#if defined(GIT_THREADS)
+static void threadid_cb(CRYPTO_THREADID *threadid)
+{
+ CRYPTO_THREADID_set_numeric(threadid, git_thread_currentid());
+}
+#endif
+
int git_openssl_set_locking(void)
{
#if defined(GIT_THREADS) && OPENSSL_VERSION_NUMBER < 0x10100000L
int num_locks, i;
+ CRYPTO_THREADID_set_callback(threadid_cb);
+
num_locks = CRYPTO_num_locks();
openssl_locks = git__calloc(num_locks, sizeof(git_mutex));
GITERR_CHECK_ALLOC(openssl_locks);
@@ -272,8 +281,9 @@ static int ssl_set_error(SSL *ssl, int error)
case SSL_ERROR_SYSCALL:
e = ERR_get_error();
if (e > 0) {
- giterr_set(GITERR_NET, "SSL error: %s",
- ERR_error_string(e, NULL));
+ char errmsg[256];
+ ERR_error_string_n(e, errmsg, sizeof(errmsg));
+ giterr_set(GITERR_NET, "SSL error: %s", errmsg);
break;
} else if (error < 0) {
giterr_set(GITERR_OS, "SSL error: syscall failure");
@@ -283,10 +293,13 @@ static int ssl_set_error(SSL *ssl, int error)
return GIT_EEOF;
break;
case SSL_ERROR_SSL:
+ {
+ char errmsg[256];
e = ERR_get_error();
- giterr_set(GITERR_NET, "SSL error: %s",
- ERR_error_string(e, NULL));
+ ERR_error_string_n(e, errmsg, sizeof(errmsg));
+ giterr_set(GITERR_NET, "SSL error: %s", errmsg);
break;
+ }
case SSL_ERROR_NONE:
case SSL_ERROR_ZERO_RETURN:
default:
diff --git a/src/pack.c b/src/pack.c
index f8d0dc9..883f262 100644
--- a/src/pack.c
+++ b/src/pack.c
@@ -716,8 +716,11 @@ int git_packfile_unpack(
error = packfile_unpack_compressed(&delta, p, &w_curs, &curpos, elem->size, elem->type);
git_mwindow_close(&w_curs);
- if (error < 0)
+ if (error < 0) {
+ /* We have transferred ownership of the data to the cache. */
+ obj->data = NULL;
break;
+ }
/* the current object becomes the new base, on which we apply the delta */
base = *obj;
@@ -934,19 +937,19 @@ git_off_t get_delta_base(
if (type == GIT_OBJ_OFS_DELTA) {
unsigned used = 0;
unsigned char c = base_info[used++];
- base_offset = c & 127;
+ size_t unsigned_base_offset = c & 127;
while (c & 128) {
if (left <= used)
return GIT_EBUFS;
- base_offset += 1;
- if (!base_offset || MSB(base_offset, 7))
+ unsigned_base_offset += 1;
+ if (!unsigned_base_offset || MSB(unsigned_base_offset, 7))
return 0; /* overflow */
c = base_info[used++];
- base_offset = (base_offset << 7) + (c & 127);
+ unsigned_base_offset = (unsigned_base_offset << 7) + (c & 127);
}
- base_offset = delta_obj_offset - base_offset;
- if (base_offset <= 0 || base_offset >= delta_obj_offset)
+ if (unsigned_base_offset == 0 || (size_t)delta_obj_offset <= unsigned_base_offset)
return 0; /* out of bound */
+ base_offset = delta_obj_offset - unsigned_base_offset;
*curpos += used;
} else if (type == GIT_OBJ_REF_DELTA) {
/* If we have the cooperative cache, search in it first */
diff --git a/src/posix.c b/src/posix.c
index 94deb6a..fd9188a 100644
--- a/src/posix.c
+++ b/src/posix.c
@@ -40,7 +40,7 @@ int p_getaddrinfo(
if (ainfo->ai_servent)
ainfo->ai_port = ainfo->ai_servent->s_port;
else
- ainfo->ai_port = atol(port);
+ ainfo->ai_port = htons(atol(port));
memcpy(&ainfo->ai_addr_in.sin_addr,
ainfo->ai_hostent->h_addr_list[0],
diff --git a/src/posix.h b/src/posix.h
index d26371b..b48b410 100644
--- a/src/posix.h
+++ b/src/posix.h
@@ -59,6 +59,9 @@
#ifndef O_CLOEXEC
#define O_CLOEXEC 0
#endif
+#ifndef SOCK_CLOEXEC
+#define SOCK_CLOEXEC 0
+#endif
/* access() mode parameter #defines */
#ifndef F_OK
diff --git a/src/proxy.c b/src/proxy.c
index f53ac11..87c4a8d 100644
--- a/src/proxy.c
+++ b/src/proxy.c
@@ -30,3 +30,9 @@ int git_proxy_options_dup(git_proxy_options *tgt, const git_proxy_options *src)
return 0;
}
+
+void git_proxy_options_clear(git_proxy_options *opts)
+{
+ git__free((char *) opts->url);
+ opts->url = NULL;
+}
diff --git a/src/proxy.h b/src/proxy.h
index bf93827..840dd1f 100644
--- a/src/proxy.h
+++ b/src/proxy.h
@@ -10,5 +10,6 @@
#include "git2/proxy.h"
extern int git_proxy_options_dup(git_proxy_options *tgt, const git_proxy_options *src);
+extern void git_proxy_options_clear(git_proxy_options *opts);
#endif
\ No newline at end of file
diff --git a/src/push.c b/src/push.c
index 09c2340..433cc06 100644
--- a/src/push.c
+++ b/src/push.c
@@ -178,6 +178,9 @@ int git_push_update_tips(git_push *push, const git_remote_callbacks *callbacks)
if (!fetch_spec)
continue;
+ /* Clear the buffer which can be dirty from previous iteration */
+ git_buf_clear(&remote_ref_name);
+
if ((error = git_refspec_transform(&remote_ref_name, fetch_spec, status->ref)) < 0)
goto on_error;
diff --git a/src/refs.c b/src/refs.c
index f7120d9..bdc0765 100644
--- a/src/refs.c
+++ b/src/refs.c
@@ -1359,7 +1359,13 @@ int git_reference_peel(
return peel_error(error, ref, "Cannot resolve reference");
}
- if (!git_oid_iszero(&resolved->peel)) {
+ /*
+ * If we try to peel an object to a tag, we cannot use
+ * the fully peeled object, as that will always resolve
+ * to a commit. So we only want to use the peeled value
+ * if it is not zero and the target is not a tag.
+ */
+ if (target_type != GIT_OBJ_TAG && !git_oid_iszero(&resolved->peel)) {
error = git_object_lookup(&target,
git_reference_owner(ref), &resolved->peel, GIT_OBJ_ANY);
} else {
diff --git a/src/repository.c b/src/repository.c
index 7ecb00e..71f77ba 100644
--- a/src/repository.c
+++ b/src/repository.c
@@ -1235,7 +1235,7 @@ static int reserved_names_add8dot3(git_repository *repo, const char *path)
name_len = strlen(name);
- if ((name_len == def_len && memcmp(name, def, def_len) == 0) ||
+ if ((name_len == def_len && memcmp(name, def, def_len) == 0) ||
(name_len == def_dot_git_len && memcmp(name, def_dot_git, def_dot_git_len) == 0)) {
git__free(name);
return 0;
@@ -1784,7 +1784,13 @@ static int repo_init_structure(
default_template = true;
}
- if (tdir) {
+ /*
+ * If tdir was the empty string, treat it like tdir was a path to an
+ * empty directory (so, don't do any copying). This is the behavior
+ * that git(1) exhibits, although it doesn't seem to be officially
+ * documented.
+ */
+ if (tdir && git__strcmp(tdir, "") != 0) {
uint32_t cpflags = GIT_CPDIR_COPY_SYMLINKS |
GIT_CPDIR_SIMPLE_TO_MODE |
GIT_CPDIR_COPY_DOTFILES;
@@ -2762,7 +2768,7 @@ int git_repository__cleanup_files(
error = git_futils_rmdir_r(path, NULL,
GIT_RMDIR_REMOVE_FILES | GIT_RMDIR_REMOVE_BLOCKERS);
}
-
+
git_buf_clear(&buf);
}
diff --git a/src/sha1_lookup.c b/src/sha1_lookup.c
index ead26de..60a7444 100644
--- a/src/sha1_lookup.c
+++ b/src/sha1_lookup.c
@@ -232,7 +232,7 @@ int sha1_position(const void *table,
{
const unsigned char *base = table;
- do {
+ while (lo < hi) {
unsigned mi = (lo + hi) / 2;
int cmp = git_oid__hashcmp(base + mi * stride, key);
@@ -243,7 +243,7 @@ int sha1_position(const void *table,
hi = mi;
else
lo = mi+1;
- } while (lo < hi);
+ }
return -((int)lo)-1;
}
diff --git a/src/signature.c b/src/signature.c
index a56b8a2..25e0ee7 100644
--- a/src/signature.c
+++ b/src/signature.c
@@ -231,6 +231,7 @@ int git_signature__parse(git_signature *sig, const char **buffer_out,
if (git__strtol64(&sig->when.time, time_start, &time_end, 10) < 0) {
git__free(sig->name);
git__free(sig->email);
+ sig->name = sig->email = NULL;
return signature_error("invalid Unix timestamp");
}
diff --git a/src/socket_stream.c b/src/socket_stream.c
index c0a1684..96bd2b9 100644
--- a/src/socket_stream.c
+++ b/src/socket_stream.c
@@ -104,7 +104,7 @@ int socket_connect(git_stream *stream)
}
for (p = info; p != NULL; p = p->ai_next) {
- s = socket(p->ai_family, p->ai_socktype, p->ai_protocol);
+ s = socket(p->ai_family, p->ai_socktype | SOCK_CLOEXEC, p->ai_protocol);
if (s == INVALID_SOCKET)
continue;
diff --git a/src/stransport_stream.c b/src/stransport_stream.c
index 50ed945..a43f544 100644
--- a/src/stransport_stream.c
+++ b/src/stransport_stream.c
@@ -81,8 +81,10 @@ static int stransport_connect(git_stream *stream)
}
if (sec_res == kSecTrustResultDeny || sec_res == kSecTrustResultRecoverableTrustFailure ||
- sec_res == kSecTrustResultFatalTrustFailure)
+ sec_res == kSecTrustResultFatalTrustFailure) {
+ giterr_set(GITERR_SSL, "untrusted connection error");
return GIT_ECERTIFICATE;
+ }
return 0;
diff --git a/src/transports/smart_protocol.c b/src/transports/smart_protocol.c
index 8146fa1..eab10aa 100644
--- a/src/transports/smart_protocol.c
+++ b/src/transports/smart_protocol.c
@@ -270,7 +270,7 @@ static int fetch_setup_walk(git_revwalk **out, git_repository *repo)
git_revwalk *walk = NULL;
git_strarray refs;
unsigned int i;
- git_reference *ref;
+ git_reference *ref = NULL;
int error;
if ((error = git_reference_list(&refs, repo)) < 0)
@@ -282,6 +282,9 @@ static int fetch_setup_walk(git_revwalk **out, git_repository *repo)
git_revwalk_sorting(walk, GIT_SORT_TIME);
for (i = 0; i < refs.count; ++i) {
+ git_reference_free(ref);
+ ref = NULL;
+
/* No tags */
if (!git__prefixcmp(refs.strings[i], GIT_REFS_TAGS_DIR))
continue;
@@ -294,16 +297,13 @@ static int fetch_setup_walk(git_revwalk **out, git_repository *repo)
if ((error = git_revwalk_push(walk, git_reference_target(ref))) < 0)
goto on_error;
-
- git_reference_free(ref);
}
- git_strarray_free(&refs);
*out = walk;
- return 0;
on_error:
- git_revwalk_free(walk);
+ if (error)
+ git_revwalk_free(walk);
git_reference_free(ref);
git_strarray_free(&refs);
return error;
diff --git a/src/transports/winhttp.c b/src/transports/winhttp.c
index fb504c9..cf6445f 100644
--- a/src/transports/winhttp.c
+++ b/src/transports/winhttp.c
@@ -37,6 +37,14 @@
#define WINHTTP_IGNORE_REQUEST_TOTAL_LENGTH 0
#endif
+#ifndef WINHTTP_FLAG_SECURE_PROTOCOL_TLS_1_1
+# define WINHTTP_FLAG_SECURE_PROTOCOL_TLS1_1 0x00000200
+#endif
+
+#ifndef WINHTTP_FLAG_SECURE_PROTOCOL_TLS_1_2
+# define WINHTTP_FLAG_SECURE_PROTOCOL_TLS1_2 0x00000800
+#endif
+
static const char *prefix_https = "https://";
static const char *upload_pack_service = "upload-pack";
static const char *upload_pack_ls_service_url = "/info/refs?service=git-upload-pack";
@@ -747,6 +755,10 @@ static int winhttp_connect(
int error = -1;
int default_timeout = TIMEOUT_INFINITE;
int default_connect_timeout = DEFAULT_CONNECT_TIMEOUT;
+ DWORD protocols =
+ WINHTTP_FLAG_SECURE_PROTOCOL_TLS1 |
+ WINHTTP_FLAG_SECURE_PROTOCOL_TLS1_1 |
+ WINHTTP_FLAG_SECURE_PROTOCOL_TLS1_2;
t->session = NULL;
t->connection = NULL;
@@ -788,6 +800,16 @@ static int winhttp_connect(
goto on_error;
}
+ /*
+ * Do a best-effort attempt to enable TLS 1.2 but allow this to
+ * fail; if TLS 1.2 support is not available for some reason,
+ * ignore the failure (it will keep the default protocols).
+ */
+ WinHttpSetOption(t->session,
+ WINHTTP_OPTION_SECURE_PROTOCOLS,
+ &protocols,
+ sizeof(protocols));
+
if (!WinHttpSetTimeouts(t->session, default_timeout, default_connect_timeout, default_timeout, default_timeout)) {
giterr_set(GITERR_OS, "failed to set timeouts for WinHTTP");
goto on_error;
diff --git a/tests/attr/ignore.c b/tests/attr/ignore.c
index a089ee4..d241c03 100644
--- a/tests/attr/ignore.c
+++ b/tests/attr/ignore.c
@@ -51,6 +51,16 @@ void test_attr_ignore__allow_root(void)
assert_is_ignored(false, "NewFolder/NewFolder/File.txt");
}
+void test_attr_ignore__ignore_space(void)
+{
+ cl_git_rewritefile("attr/.gitignore", "/\n\n/NewFolder \n/NewFolder/NewFolder");
+
+ assert_is_ignored(false, "File.txt");
+ assert_is_ignored(true, "NewFolder");
+ assert_is_ignored(true, "NewFolder/NewFolder");
+ assert_is_ignored(true, "NewFolder/NewFolder/File.txt");
+}
+
void test_attr_ignore__ignore_root(void)
{
cl_git_rewritefile("attr/.gitignore", "/\n\n/NewFolder\n/NewFolder/NewFolder");
@@ -303,3 +313,46 @@ void test_attr_ignore__test(void)
assert_is_ignored(true, "dist/foo.o");
assert_is_ignored(true, "bin/foo");
}
+
+void test_attr_ignore__unignore_dir_succeeds(void)
+{
+ cl_git_rewritefile("attr/.gitignore",
+ "*.c\n"
+ "!src/*.c\n");
+ assert_is_ignored(false, "src/foo.c");
+ assert_is_ignored(true, "src/foo/foo.c");
+}
+
+void test_attr_ignore__case_insensitive_unignores_previous_rule(void)
+{
+ git_config *cfg;
+
+ cl_git_rewritefile("attr/.gitignore",
+ "/case\n"
+ "!/Case/\n");
+
+ cl_git_pass(git_repository_config(&cfg, g_repo));
+ cl_git_pass(git_config_set_bool(cfg, "core.ignorecase", true));
+
+ cl_must_pass(p_mkdir("attr/case", 0755));
+ cl_git_mkfile("attr/case/file", "content");
+
+ assert_is_ignored(false, "case/file");
+}
+
+void test_attr_ignore__case_sensitive_unignore_does_nothing(void)
+{
+ git_config *cfg;
+
+ cl_git_rewritefile("attr/.gitignore",
+ "/case\n"
+ "!/Case/\n");
+
+ cl_git_pass(git_repository_config(&cfg, g_repo));
+ cl_git_pass(git_config_set_bool(cfg, "core.ignorecase", false));
+
+ cl_must_pass(p_mkdir("attr/case", 0755));
+ cl_git_mkfile("attr/case/file", "content");
+
+ assert_is_ignored(true, "case/file");
+}
diff --git a/tests/checkout/head.c b/tests/checkout/head.c
index ded86df..46b2257 100644
--- a/tests/checkout/head.c
+++ b/tests/checkout/head.c
@@ -136,3 +136,48 @@ void test_checkout_head__do_remove_tracked_subdir(void)
cl_assert(!git_path_isfile("testrepo/subdir/tracked-file"));
cl_assert(git_path_isfile("testrepo/subdir/untracked-file"));
}
+
+void test_checkout_head__typechange_workdir(void)
+{
+ git_checkout_options opts = GIT_CHECKOUT_OPTIONS_INIT;
+ git_object *target;
+ struct stat st;
+
+ opts.checkout_strategy = GIT_CHECKOUT_FORCE;
+
+ cl_git_pass(git_revparse_single(&target, g_repo, "HEAD"));
+ cl_git_pass(git_reset(g_repo, target, GIT_RESET_HARD, NULL));
+
+ cl_must_pass(p_chmod("testrepo/new.txt", 0755));
+ cl_git_pass(git_checkout_head(g_repo, &opts));
+
+ cl_git_pass(p_stat("testrepo/new.txt", &st));
+ cl_assert(!GIT_PERMS_IS_EXEC(st.st_mode));
+
+ git_object_free(target);
+}
+
+void test_checkout_head__typechange_index_and_workdir(void)
+{
+ git_checkout_options opts = GIT_CHECKOUT_OPTIONS_INIT;
+ git_object *target;
+ git_index *index;
+ struct stat st;
+
+ opts.checkout_strategy = GIT_CHECKOUT_FORCE;
+
+ cl_git_pass(git_revparse_single(&target, g_repo, "HEAD"));
+ cl_git_pass(git_reset(g_repo, target, GIT_RESET_HARD, NULL));
+
+ cl_must_pass(p_chmod("testrepo/new.txt", 0755));
+ cl_git_pass(git_repository_index(&index, g_repo));
+ cl_git_pass(git_index_add_bypath(index, "new.txt"));
+ cl_git_pass(git_index_write(index));
+ cl_git_pass(git_checkout_head(g_repo, &opts));
+
+ cl_git_pass(p_stat("testrepo/new.txt", &st));
+ cl_assert(!GIT_PERMS_IS_EXEC(st.st_mode));
+
+ git_object_free(target);
+ git_index_free(index);
+}
diff --git a/tests/checkout/tree.c b/tests/checkout/tree.c
index b3b860c..c3475f4 100644
--- a/tests/checkout/tree.c
+++ b/tests/checkout/tree.c
@@ -1514,6 +1514,51 @@ void test_checkout_tree__baseline_is_empty_when_no_index(void)
git_reference_free(head);
}
+void test_checkout_tree__mode_change_is_force_updated(void)
+{
+ git_index *index;
+ git_reference *head;
+ git_object *obj;
+ git_status_list *status;
+
+ if (!cl_is_chmod_supported())
+ clar__skip();
+
+ assert_on_branch(g_repo, "master");
+ cl_git_pass(git_repository_index(&index, g_repo));
+ cl_git_pass(git_repository_head(&head, g_repo));
+ cl_git_pass(git_reference_peel(&obj, head, GIT_OBJ_COMMIT));
+
+ cl_git_pass(git_reset(g_repo, obj, GIT_RESET_HARD, NULL));
+
+ cl_git_pass(git_status_list_new(&status, g_repo, NULL));
+ cl_assert_equal_i(0, git_status_list_entrycount(status));
+ git_status_list_free(status);
+
+ /* update the mode on-disk */
+ cl_must_pass(p_chmod("testrepo/README", 0755));
+
+ cl_git_pass(git_checkout_tree(g_repo, obj, &g_opts));
+
+ cl_git_pass(git_status_list_new(&status, g_repo, NULL));
+ cl_assert_equal_i(0, git_status_list_entrycount(status));
+ git_status_list_free(status);
+
+ /* update the mode on-disk and in the index */
+ cl_must_pass(p_chmod("testrepo/README", 0755));
+ cl_must_pass(git_index_add_bypath(index, "README"));
+
+ cl_git_pass(git_checkout_tree(g_repo, obj, &g_opts));
+
+ cl_git_pass(git_status_list_new(&status, g_repo, NULL));
+ cl_assert_equal_i(0, git_status_list_entrycount(status));
+ git_status_list_free(status);
+
+ git_object_free(obj);
+ git_reference_free(head);
+ git_index_free(index);
+}
+
void test_checkout_tree__nullopts(void)
{
cl_git_pass(git_checkout_tree(g_repo, NULL, NULL));
diff --git a/tests/diff/blob.c b/tests/diff/blob.c
index c3933c3..05cc282 100644
--- a/tests/diff/blob.c
+++ b/tests/diff/blob.c
@@ -1,6 +1,19 @@
#include "clar_libgit2.h"
#include "diff_helpers.h"
+#define BLOB_DIFF \
+ "diff --git a/file b/file\n" \
+ "index 45141a7..4d713dc 100644\n" \
+ "--- a/file\n" \
+ "+++ b/file\n" \
+ "@@ -1 +1,6 @@\n" \
+ " Hello from the root\n" \
+ "+\n" \
+ "+Some additional lines\n" \
+ "+\n" \
+ "+Down here below\n" \
+ "+\n"
+
static git_repository *g_repo = NULL;
static diff_expects expected;
static git_diff_options opts;
@@ -65,6 +78,32 @@ static void assert_one_modified(
cl_assert_equal_i(dels, exp->line_dels);
}
+void test_diff_blob__patch_with_freed_blobs(void)
+{
+ git_oid a_oid, b_oid;
+ git_blob *a, *b;
+ git_patch *p;
+ git_buf buf = GIT_BUF_INIT;
+
+ /* tests/resources/attr/root_test1 */
+ cl_git_pass(git_oid_fromstrn(&a_oid, "45141a79", 8));
+ cl_git_pass(git_blob_lookup_prefix(&a, g_repo, &a_oid, 4));
+ /* tests/resources/attr/root_test2 */
+ cl_git_pass(git_oid_fromstrn(&b_oid, "4d713dc4", 8));
+ cl_git_pass(git_blob_lookup_prefix(&b, g_repo, &b_oid, 4));
+
+ cl_git_pass(git_patch_from_blobs(&p, a, NULL, b, NULL, NULL));
+
+ git_blob_free(a);
+ git_blob_free(b);
+
+ cl_git_pass(git_patch_to_buf(&buf, p));
+ cl_assert_equal_s(buf.ptr, BLOB_DIFF);
+
+ git_patch_free(p);
+ git_buf_free(&buf);
+}
+
void test_diff_blob__can_compare_text_blobs(void)
{
git_blob *a, *b, *c;
diff --git a/tests/diff/rename.c b/tests/diff/rename.c
index c1cd252..ddc1d5d 100644
--- a/tests/diff/rename.c
+++ b/tests/diff/rename.c
@@ -16,6 +16,13 @@ void test_diff_rename__cleanup(void)
cl_git_sandbox_cleanup();
}
+#define INITIAL_COMMIT "31e47d8c1fa36d7f8d537b96158e3f024de0a9f2"
+#define COPY_RENAME_COMMIT "2bc7f351d20b53f1c72c16c4b036e491c478c49a"
+#define REWRITE_COPY_COMMIT "1c068dee5790ef1580cfc4cd670915b48d790084"
+#define RENAME_MODIFICATION_COMMIT "19dd32dfb1520a64e5bbaae8dce6ef423dfa2f13"
+#define REWRITE_DELETE_COMMIT "84d8efa38af7ace2b302de0adbda16b1f1cd2e1b"
+#define DELETE_RENAME_COMMIT "be053a189b0bbde545e0a3f59ce00b46ad29ce0d"
+
/*
* Renames repo has:
*
@@ -36,12 +43,22 @@ void test_diff_rename__cleanup(void)
* ikeepsix.txt -> ikeepsix.txt (reorder sections in file)
* sixserving.txt -> sixserving.txt (whitespace change - not just indent)
* sevencities.txt -> songof7cities.txt (rename, small text changes)
+ * commit 84d8efa38af7ace2b302de0adbda16b1f1cd2e1b
+ * songof7cities.txt -> songof7citie.txt (major rewrite, <20% match)
+ * ikeepsix.txt -> (deleted)
+ * untimely.txt (no change)
+ * sixserving.txt (no change)
+ * commit be053a189b0bbde545e0a3f59ce00b46ad29ce0d
+ * ikeepsix.txt -> (deleted)
+ * songof7cities.txt -> ikeepsix.txt (rename, 100% match)
+ * untimely.txt (no change)
+ * sixserving.txt (no change)
*/
void test_diff_rename__match_oid(void)
{
- const char *old_sha = "31e47d8c1fa36d7f8d537b96158e3f024de0a9f2";
- const char *new_sha = "2bc7f351d20b53f1c72c16c4b036e491c478c49a";
+ const char *old_sha = INITIAL_COMMIT;
+ const char *new_sha = COPY_RENAME_COMMIT;
git_tree *old_tree, *new_tree;
git_diff *diff;
git_diff_options diffopts = GIT_DIFF_OPTIONS_INIT;
@@ -139,8 +156,8 @@ void test_diff_rename__match_oid(void)
void test_diff_rename__checks_options_version(void)
{
- const char *old_sha = "31e47d8c1fa36d7f8d537b96158e3f024de0a9f2";
- const char *new_sha = "2bc7f351d20b53f1c72c16c4b036e491c478c49a";
+ const char *old_sha = INITIAL_COMMIT;
+ const char *new_sha = COPY_RENAME_COMMIT;
git_tree *old_tree, *new_tree;
git_diff *diff;
git_diff_options diffopts = GIT_DIFF_OPTIONS_INIT;
@@ -171,9 +188,9 @@ void test_diff_rename__checks_options_version(void)
void test_diff_rename__not_exact_match(void)
{
- const char *sha0 = "2bc7f351d20b53f1c72c16c4b036e491c478c49a";
- const char *sha1 = "1c068dee5790ef1580cfc4cd670915b48d790084";
- const char *sha2 = "19dd32dfb1520a64e5bbaae8dce6ef423dfa2f13";
+ const char *sha0 = COPY_RENAME_COMMIT;
+ const char *sha1 = REWRITE_COPY_COMMIT;
+ const char *sha2 = RENAME_MODIFICATION_COMMIT;
git_tree *old_tree, *new_tree;
git_diff *diff;
git_diff_options diffopts = GIT_DIFF_OPTIONS_INIT;
@@ -433,7 +450,7 @@ void test_diff_rename__test_small_files(void)
void test_diff_rename__working_directory_changes(void)
{
- const char *sha0 = "2bc7f351d20b53f1c72c16c4b036e491c478c49a";
+ const char *sha0 = COPY_RENAME_COMMIT;
const char *blobsha = "66311f5cfbe7836c27510a3ba2f43e282e2c8bba";
git_oid id;
git_tree *tree;
@@ -592,8 +609,8 @@ void test_diff_rename__working_directory_changes(void)
void test_diff_rename__patch(void)
{
- const char *sha0 = "2bc7f351d20b53f1c72c16c4b036e491c478c49a";
- const char *sha1 = "1c068dee5790ef1580cfc4cd670915b48d790084";
+ const char *sha0 = COPY_RENAME_COMMIT;
+ const char *sha1 = REWRITE_COPY_COMMIT;
git_tree *old_tree, *new_tree;
git_diff *diff;
git_diff_options diffopts = GIT_DIFF_OPTIONS_INIT;
@@ -1425,9 +1442,9 @@ void test_diff_rename__can_delete_unmodified_deltas(void)
void test_diff_rename__matches_config_behavior(void)
{
- const char *sha0 = "31e47d8c1fa36d7f8d537b96158e3f024de0a9f2";
- const char *sha1 = "2bc7f351d20b53f1c72c16c4b036e491c478c49a";
- const char *sha2 = "1c068dee5790ef1580cfc4cd670915b48d790084";
+ const char *sha0 = INITIAL_COMMIT;
+ const char *sha1 = COPY_RENAME_COMMIT;
+ const char *sha2 = REWRITE_COPY_COMMIT;
git_tree *tree0, *tree1, *tree2;
git_config *cfg;
@@ -1508,8 +1525,8 @@ void test_diff_rename__matches_config_behavior(void)
void test_diff_rename__can_override_thresholds_when_obeying_config(void)
{
- const char *sha1 = "2bc7f351d20b53f1c72c16c4b036e491c478c49a";
- const char *sha2 = "1c068dee5790ef1580cfc4cd670915b48d790084";
+ const char *sha1 = COPY_RENAME_COMMIT;
+ const char *sha2 = REWRITE_COPY_COMMIT;
git_tree *tree1, *tree2;
git_config *cfg;
@@ -1563,8 +1580,8 @@ void test_diff_rename__can_override_thresholds_when_obeying_config(void)
void test_diff_rename__by_config_doesnt_mess_with_whitespace_settings(void)
{
- const char *sha1 = "1c068dee5790ef1580cfc4cd670915b48d790084";
- const char *sha2 = "19dd32dfb1520a64e5bbaae8dce6ef423dfa2f13";
+ const char *sha1 = REWRITE_COPY_COMMIT;
+ const char *sha2 = RENAME_MODIFICATION_COMMIT;
git_tree *tree1, *tree2;
git_config *cfg;
@@ -1710,8 +1727,8 @@ void test_diff_rename__blank_files_not_renamed_when_not_ignoring_whitespace(void
*/
void test_diff_rename__identical(void)
{
- const char *old_sha = "31e47d8c1fa36d7f8d537b96158e3f024de0a9f2";
- const char *new_sha = "2bc7f351d20b53f1c72c16c4b036e491c478c49a";
+ const char *old_sha = INITIAL_COMMIT;
+ const char *new_sha = COPY_RENAME_COMMIT;
git_tree *old_tree, *new_tree;
git_diff *diff;
git_diff_options diff_opts = GIT_DIFF_OPTIONS_INIT;
@@ -1748,3 +1765,216 @@ void test_diff_rename__identical(void)
git_tree_free(new_tree);
}
+void test_diff_rename__rewrite_and_delete(void)
+{
+ const char *old_sha = RENAME_MODIFICATION_COMMIT;
+ const char *new_sha = REWRITE_DELETE_COMMIT;
+ git_tree *old_tree, *new_tree;
+ git_diff *diff;
+ git_diff_find_options find_opts = GIT_DIFF_FIND_OPTIONS_INIT;
+ git_buf diff_buf = GIT_BUF_INIT;
+ const char *expected =
+ "diff --git a/ikeepsix.txt b/ikeepsix.txt\n"
+ "deleted file mode 100644\n"
+ "index eaf4a3e..0000000\n"
+ "--- a/ikeepsix.txt\n"
+ "+++ /dev/null\n"
+ "@@ -1,27 +0,0 @@\n"
+ "-I Keep Six Honest Serving-Men\n"
+ "-=============================\n"
+ "-\n"
+ "-She sends'em abroad on her own affairs,\n"
+ "- From the second she opens her eyes—\n"
+ "-One million Hows, two million Wheres,\n"
+ "-And seven million Whys!\n"
+ "-\n"
+ "-I let them rest from nine till five,\n"
+ "- For I am busy then,\n"
+ "-As well as breakfast, lunch, and tea,\n"
+ "- For they are hungry men.\n"
+ "-But different folk have different views;\n"
+ "-I know a person small—\n"
+ "-She keeps ten million serving-men,\n"
+ "-Who get no rest at all!\n"
+ "-\n"
+ "- -- Rudyard Kipling\n"
+ "-\n"
+ "-I KEEP six honest serving-men\n"
+ "- (They taught me all I knew);\n"
+ "-Their names are What and Why and When\n"
+ "- And How and Where and Who.\n"
+ "-I send them over land and sea,\n"
+ "- I send them east and west;\n"
+ "-But after they have worked for me,\n"
+ "- I give them all a rest.\n"
+ "diff --git a/songof7cities.txt b/songof7cities.txt\n"
+ "index 4210ffd..95ceb12 100644\n"
+ "--- a/songof7cities.txt\n"
+ "+++ b/songof7cities.txt\n"
+ "@@ -1,45 +1,45 @@\n"
+ "-The Song of Seven Cities\n"
+ "+THE SONG OF SEVEN CITIES\n"
+ " ------------------------\n"
+ " \n"
+ "-I WAS Lord of Cities very sumptuously builded.\n"
+ "-Seven roaring Cities paid me tribute from afar.\n"
+ "-Ivory their outposts were--the guardrooms of them gilded,\n"
+ "-And garrisoned with Amazons invincible in war.\n"
+ "-\n"
+ "-All the world went softly when it walked before my Cities--\n"
+ "-Neither King nor Army vexed my peoples at their toil,\n"
+ "-Never horse nor chariot irked or overbore my Cities,\n"
+ "-Never Mob nor Ruler questioned whence they drew their spoil.\n"
+ "-\n"
+ "-Banded, mailed and arrogant from sunrise unto sunset;\n"
+ "-Singing while they sacked it, they possessed the land at large.\n"
+ "-Yet when men would rob them, they resisted, they made onset\n"
+ "-And pierced the smoke of battle with a thousand-sabred charge.\n"
+ "-\n"
+ "-So they warred and trafficked only yesterday, my Cities.\n"
+ "-To-day there is no mark or mound of where my Cities stood.\n"
+ "-For the River rose at midnight and it washed away my Cities.\n"
+ "-They are evened with Atlantis and the towns before the Flood.\n"
+ "-\n"
+ "-Rain on rain-gorged channels raised the water-levels round them,\n"
+ "-Freshet backed on freshet swelled and swept their world from sight,\n"
+ "-Till the emboldened floods linked arms and, flashing forward, drowned them--\n"
+ "-Drowned my Seven Cities and their peoples in one night!\n"
+ "-\n"
+ "-Low among the alders lie their derelict foundations,\n"
+ "-The beams wherein they trusted and the plinths whereon they built--\n"
+ "-My rulers and their treasure and their unborn populations,\n"
+ "-Dead, destroyed, aborted, and defiled with mud and silt!\n"
+ "-\n"
+ "-The Daughters of the Palace whom they cherished in my Cities,\n"
+ "-My silver-tongued Princesses, and the promise of their May--\n"
+ "-Their bridegrooms of the June-tide--all have perished in my Cities,\n"
+ "-With the harsh envenomed virgins that can neither love nor play.\n"
+ "-\n"
+ "-I was Lord of Cities--I will build anew my Cities,\n"
+ "-Seven, set on rocks, above the wrath of any flood.\n"
+ "-Nor will I rest from search till I have filled anew my Cities\n"
+ "-With peoples undefeated of the dark, enduring blood.\n"
+ "+I WAS LORD OF CITIES VERY SUMPTUOUSLY BUILDED.\n"
+ "+SEVEN ROARING CITIES PAID ME TRIBUTE FROM AFAR.\n"
+ "+IVORY THEIR OUTPOSTS WERE--THE GUARDROOMS OF THEM GILDED,\n"
+ "+AND GARRISONED WITH AMAZONS INVINCIBLE IN WAR.\n"
+ "+\n"
+ "+ALL THE WORLD WENT SOFTLY WHEN IT WALKED BEFORE MY CITIES--\n"
+ "+NEITHER KING NOR ARMY VEXED MY PEOPLES AT THEIR TOIL,\n"
+ "+NEVER HORSE NOR CHARIOT IRKED OR OVERBORE MY CITIES,\n"
+ "+NEVER MOB NOR RULER QUESTIONED WHENCE THEY DREW THEIR SPOIL.\n"
+ "+\n"
+ "+BANDED, MAILED AND ARROGANT FROM SUNRISE UNTO SUNSET;\n"
+ "+SINGING WHILE THEY SACKED IT, THEY POSSESSED THE LAND AT LARGE.\n"
+ "+YET WHEN MEN WOULD ROB THEM, THEY RESISTED, THEY MADE ONSET\n"
+ "+AND PIERCED THE SMOKE OF BATTLE WITH A THOUSAND-SABRED CHARGE.\n"
+ "+\n"
+ "+SO THEY WARRED AND TRAFFICKED ONLY YESTERDAY, MY CITIES.\n"
+ "+TO-DAY THERE IS NO MARK OR MOUND OF WHERE MY CITIES STOOD.\n"
+ "+FOR THE RIVER ROSE AT MIDNIGHT AND IT WASHED AWAY MY CITIES.\n"
+ "+THEY ARE EVENED WITH ATLANTIS AND THE TOWNS BEFORE THE FLOOD.\n"
+ "+\n"
+ "+RAIN ON RAIN-GORGED CHANNELS RAISED THE WATER-LEVELS ROUND THEM,\n"
+ "+FRESHET BACKED ON FRESHET SWELLED AND SWEPT THEIR WORLD FROM SIGHT,\n"
+ "+TILL THE EMBOLDENED FLOODS LINKED ARMS AND, FLASHING FORWARD, DROWNED THEM--\n"
+ "+DROWNED MY SEVEN CITIES AND THEIR PEOPLES IN ONE NIGHT!\n"
+ "+\n"
+ "+LOW AMONG THE ALDERS LIE THEIR DERELICT FOUNDATIONS,\n"
+ "+THE BEAMS WHEREIN THEY TRUSTED AND THE PLINTHS WHEREON THEY BUILT--\n"
+ "+MY RULERS AND THEIR TREASURE AND THEIR UNBORN POPULATIONS,\n"
+ "+DEAD, DESTROYED, ABORTED, AND DEFILED WITH MUD AND SILT!\n"
+ "+\n"
+ "+THE DAUGHTERS OF THE PALACE WHOM THEY CHERISHED IN MY CITIES,\n"
+ "+MY SILVER-TONGUED PRINCESSES, AND THE PROMISE OF THEIR MAY--\n"
+ "+THEIR BRIDEGROOMS OF THE JUNE-TIDE--ALL HAVE PERISHED IN MY CITIES,\n"
+ "+WITH THE HARSH ENVENOMED VIRGINS THAT CAN NEITHER LOVE NOR PLAY.\n"
+ "+\n"
+ "+I WAS LORD OF CITIES--I WILL BUILD ANEW MY CITIES,\n"
+ "+SEVEN, SET ON ROCKS, ABOVE THE WRATH OF ANY FLOOD.\n"
+ "+NOR WILL I REST FROM SEARCH TILL I HAVE FILLED ANEW MY CITIES\n"
+ "+WITH PEOPLES UNDEFEATED OF THE DARK, ENDURING BLOOD.\n"
+ " \n"
+ " To the sound of trumpets shall their seed restore my Cities\n"
+ " Wealthy and well-weaponed, that once more may I behold\n";
+
+ old_tree = resolve_commit_oid_to_tree(g_repo, old_sha);
+ new_tree = resolve_commit_oid_to_tree(g_repo, new_sha);
+
+ find_opts.flags = GIT_DIFF_FIND_RENAMES_FROM_REWRITES;
+
+ cl_git_pass(git_diff_tree_to_tree(&diff, g_repo, old_tree, new_tree, NULL));
+ cl_git_pass(git_diff_find_similar(diff, &find_opts));
+
+ cl_git_pass(git_diff_to_buf(&diff_buf, diff, GIT_DIFF_FORMAT_PATCH));
+
+ cl_assert_equal_s(expected, diff_buf.ptr);
+
+ git_buf_free(&diff_buf);
+ git_diff_free(diff);
+ git_tree_free(old_tree);
+ git_tree_free(new_tree);
+}
+
+void test_diff_rename__delete_and_rename(void)
+{
+ const char *old_sha = RENAME_MODIFICATION_COMMIT;
+ const char *new_sha = DELETE_RENAME_COMMIT;
+ git_tree *old_tree, *new_tree;
+ git_diff *diff;
+ git_diff_find_options find_opts = GIT_DIFF_FIND_OPTIONS_INIT;
+ git_buf diff_buf = GIT_BUF_INIT;
+ const char *expected =
+ "diff --git a/sixserving.txt b/sixserving.txt\n"
+ "deleted file mode 100644\n"
+ "index f90d4fc..0000000\n"
+ "--- a/sixserving.txt\n"
+ "+++ /dev/null\n"
+ "@@ -1,25 +0,0 @@\n"
+ "-I KEEP six honest serving-men\n"
+ "- (They taught me all I knew);\n"
+ "-Their names are What and Why and When\n"
+ "- And How and Where and Who.\n"
+ "-I send them over land and sea,\n"
+ "- I send them east and west;\n"
+ "-But after they have worked for me,\n"
+ "- I give them all a rest.\n"
+ "-\n"
+ "-I let them rest from nine till five,\n"
+ "- For I am busy then,\n"
+ "-As well as breakfast, lunch, and tea,\n"
+ "- For they are hungry men.\n"
+ "-But different folk have different views;\n"
+ "-I know a person small—\n"
+ "-She keeps ten million serving-men,\n"
+ "-Who get no rest at all!\n"
+ "-\n"
+ "-She sends'em abroad on her own affairs,\n"
+ "- From the second she opens her eyes—\n"
+ "-One million Hows, two million Wheres,\n"
+ "-And seven million Whys!\n"
+ "-\n"
+ "- -- Rudyard Kipling\n"
+ "-\n"
+ "diff --git a/songof7cities.txt b/sixserving.txt\n"
+ "similarity index 100%\n"
+ "rename from songof7cities.txt\n"
+ "rename to sixserving.txt\n";
+
+ old_tree = resolve_commit_oid_to_tree(g_repo, old_sha);
+ new_tree = resolve_commit_oid_to_tree(g_repo, new_sha);
+
+ find_opts.flags = GIT_DIFF_FIND_RENAMES_FROM_REWRITES;
+
+ cl_git_pass(git_diff_tree_to_tree(&diff, g_repo, old_tree, new_tree, NULL));
+ cl_git_pass(git_diff_find_similar(diff, &find_opts));
+
+ cl_git_pass(git_diff_to_buf(&diff_buf, diff, GIT_DIFF_FORMAT_PATCH));
+
+ cl_assert_equal_s(expected, diff_buf.ptr);
+
+ git_buf_free(&diff_buf);
+ git_diff_free(diff);
+ git_tree_free(old_tree);
+ git_tree_free(new_tree);
+}
diff --git a/tests/merge/conflict_data.h b/tests/merge/conflict_data.h
index e6394a9..d6243fc 100644
--- a/tests/merge/conflict_data.h
+++ b/tests/merge/conflict_data.h
@@ -70,22 +70,22 @@
"This is a mighty fine recipe!\n" \
">>>>>>> branchF-2\n"
-#define CONFLICTING_RECURSIVE_H1_TO_H2_WITH_DIFF3 \
+#define CONFLICTING_RECURSIVE_H2_TO_H1_WITH_DIFF3 \
"VEAL SOUP.\n" \
"\n" \
"<<<<<<< HEAD\n" \
- "put into a pot three quarts of water, three onions cut small, one\n" \
+ "Put Into A Pot Three Quarts of Water, Three Onions Cut Small, One\n" \
"||||||| merged common ancestors\n" \
"<<<<<<< Temporary merge branch 1\n" \
- "Put into a pot three quarts of water, THREE ONIONS CUT SMALL, one\n" \
+ "PUT INTO A POT three quarts of water, three onions cut small, one\n" \
"||||||| merged common ancestors\n" \
"Put into a pot three quarts of water, three onions cut small, one\n" \
"=======\n" \
- "PUT INTO A POT three quarts of water, three onions cut small, one\n" \
+ "Put into a pot three quarts of water, THREE ONIONS CUT SMALL, one\n" \
">>>>>>> Temporary merge branch 2\n" \
"=======\n" \
- "Put Into A Pot Three Quarts of Water, Three Onions Cut Small, One\n" \
- ">>>>>>> branchH-2\n" \
+ "put into a pot three quarts of water, three onions cut small, one\n" \
+ ">>>>>>> branchH-1\n" \
"spoonful of black pepper pounded, and two of salt, with two or three\n" \
"slices of lean ham; let it boil steadily two hours; skim it\n" \
"occasionally, then put into it a shin of veal, let it boil two hours\n" \
diff --git a/tests/merge/trees/recursive.c b/tests/merge/trees/recursive.c
index c5b129b..d4defb8 100644
--- a/tests/merge/trees/recursive.c
+++ b/tests/merge/trees/recursive.c
@@ -312,7 +312,7 @@ void test_merge_trees_recursive__conflicting_merge_base(void)
{ 0100644, "4b7c5650008b2e747fe1809eeb5a1dde0e80850a", 0, "bouilli.txt" },
{ 0100644, "c4e6cca3ec6ae0148ed231f97257df8c311e015f", 0, "gravy.txt" },
{ 0100644, "68af1fc7407fd9addf1701a87eb1c95c7494c598", 0, "oyster.txt" },
- { 0100644, "3a66812fed1e03ea4a6a7ee28d8a57aec1ca6537", 1, "veal.txt" },
+ { 0100644, "a13c307108cd1ac9d10a23bd2e8072c298570592", 1, "veal.txt" },
{ 0100644, "d604c75019c282144bdbbf3fd3462ba74b240efc", 2, "veal.txt" },
{ 0100644, "37a5054a9f9b4628e3924c5cb8f2147c6e2a3efc", 3, "veal.txt" },
};
@@ -339,14 +339,14 @@ void test_merge_trees_recursive__conflicting_merge_base_with_diff3(void)
{ 0100644, "4b7c5650008b2e747fe1809eeb5a1dde0e80850a", 0, "bouilli.txt" },
{ 0100644, "c4e6cca3ec6ae0148ed231f97257df8c311e015f", 0, "gravy.txt" },
{ 0100644, "68af1fc7407fd9addf1701a87eb1c95c7494c598", 0, "oyster.txt" },
- { 0100644, "cd17a91513f3aee9e44114d1ede67932dd41d2fc", 1, "veal.txt" },
- { 0100644, "d604c75019c282144bdbbf3fd3462ba74b240efc", 2, "veal.txt" },
- { 0100644, "37a5054a9f9b4628e3924c5cb8f2147c6e2a3efc", 3, "veal.txt" },
+ { 0100644, "43b17b0ba58cbf2ffd3a048c1d4c7bbbcb0b987e", 1, "veal.txt" },
+ { 0100644, "37a5054a9f9b4628e3924c5cb8f2147c6e2a3efc", 2, "veal.txt" },
+ { 0100644, "d604c75019c282144bdbbf3fd3462ba74b240efc", 3, "veal.txt" },
};
opts.file_flags |= GIT_MERGE_FILE_STYLE_DIFF3;
- cl_git_pass(merge_commits_from_branches(&index, repo, "branchH-1", "branchH-2", &opts));
+ cl_git_pass(merge_commits_from_branches(&index, repo, "branchH-2", "branchH-1", &opts));
cl_assert(merge_test_index(index, merge_index_entries, 8));
@@ -392,19 +392,67 @@ void test_merge_trees_recursive__recursionlimit(void)
{ 0100644, "ffb36e513f5fdf8a6ba850a20142676a2ac4807d", 0, "asparagus.txt" },
{ 0100644, "68f6182f4c85d39e1309d97c7e456156dc9c0096", 0, "beef.txt" },
{ 0100644, "4b7c5650008b2e747fe1809eeb5a1dde0e80850a", 0, "bouilli.txt" },
- { 0100644, "ce7e553c6feb6e5f3bd67e3c3be04182fe3094b4", 1, "gravy.txt" },
- { 0100644, "d8dd349b78f19a4ebe3357bacb8138f00bf5ed41", 2, "gravy.txt" },
- { 0100644, "e50fbbd701458757bdfe9815f58ed717c588d1b5", 3, "gravy.txt" },
+ { 0100644, "c4e6cca3ec6ae0148ed231f97257df8c311e015f", 0, "gravy.txt" },
{ 0100644, "68af1fc7407fd9addf1701a87eb1c95c7494c598", 0, "oyster.txt" },
- { 0100644, "a7b066537e6be7109abfe4ff97b675d4e077da20", 0, "veal.txt" },
+ { 0100644, "59bdc2a0bfc74c6d4f911e04bab6aa081efe40d1", 1, "veal.txt" },
+ { 0100644, "898d12687fb35be271c27c795a6b32c8b51da79e", 2, "veal.txt" },
+ { 0100644, "68a2e1ee61a23a4728fe6b35580fbbbf729df370", 3, "veal.txt" },
};
opts.recursion_limit = 1;
- cl_git_pass(merge_commits_from_branches(&index, repo, "branchE-1", "branchE-2", &opts));
+ cl_git_pass(merge_commits_from_branches(&index, repo, "branchC-1", "branchC-2", &opts));
cl_assert(merge_test_index(index, merge_index_entries, 8));
git_index_free(index);
}
+/* There are multiple levels of criss-cross merges. This ensures
+ * that the virtual merge base parents are compared in the same
+ * order as git. If the base parents are created in the order as
+ * git does, then the file `targetfile.txt` is automerged. If not,
+ * `targetfile.txt` will be in conflict due to the virtual merge
+ * base.
+ */
+void test_merge_trees_recursive__merge_base_for_virtual_commit(void)
+{
+ git_index *index;
+ git_merge_options opts = GIT_MERGE_OPTIONS_INIT;
+
+ struct merge_index_entry merge_index_entries[] = {
+ { 0100644, "1bde1883de4977ea3e664b315da951d1f614c3b1", 0, "targetfile.txt" },
+ { 0100644, "f66647f02d6779e119bd435fe2908867c64c265f", 1, "version.txt" },
+ { 0100644, "358efd6f589384fa8baf92234db9c7899a53916e", 2, "version.txt" },
+ { 0100644, "a664873b1c0b9a1ed300f8644dde536fdaa3a34f", 3, "version.txt" },
+ };
+
+ cl_git_pass(merge_commits_from_branches(&index, repo, "branchJ-1", "branchJ-2", &opts));
+
+ cl_assert(merge_test_index(index, merge_index_entries, 4));
+
+ git_index_free(index);
+}
+
+/* This test is the same as above, but the graph is constructed such
+ * that the 1st-recursion merge bases of the two heads are
+ * in a different order.
+ */
+void test_merge_trees_recursive__merge_base_for_virtual_commit_2(void)
+{
+ git_index *index;
+ git_merge_options opts = GIT_MERGE_OPTIONS_INIT;
+
+ struct merge_index_entry merge_index_entries[] = {
+ { 0100644, "4a06b258fed8a4d15967ec4253ae7366b70f727d", 0, "targetfile.txt" },
+ { 0100644, "16c5a7810777e1181709833cfe6931949259f802", 1, "version.txt" },
+ { 0100644, "f0856993e005c0d8ed2dc7cdc222cc1d89fb3c77", 2, "version.txt" },
+ { 0100644, "2cba583804a4a6fad1baf97c959be447238d1489", 3, "version.txt" },
+ };
+
+ cl_git_pass(merge_commits_from_branches(&index, repo, "branchK-1", "branchK-2", &opts));
+
+ cl_assert(merge_test_index(index, merge_index_entries, 4));
+
+ git_index_free(index);
+}
diff --git a/tests/merge/workdir/recursive.c b/tests/merge/workdir/recursive.c
index 7951262..78f3663 100644
--- a/tests/merge/workdir/recursive.c
+++ b/tests/merge/workdir/recursive.c
@@ -62,22 +62,22 @@ void test_merge_workdir_recursive__conflicting_merge_base_with_diff3(void)
{ 0100644, "4b7c5650008b2e747fe1809eeb5a1dde0e80850a", 0, "bouilli.txt" },
{ 0100644, "c4e6cca3ec6ae0148ed231f97257df8c311e015f", 0, "gravy.txt" },
{ 0100644, "68af1fc7407fd9addf1701a87eb1c95c7494c598", 0, "oyster.txt" },
- { 0100644, "cd17a91513f3aee9e44114d1ede67932dd41d2fc", 1, "veal.txt" },
- { 0100644, "d604c75019c282144bdbbf3fd3462ba74b240efc", 2, "veal.txt" },
- { 0100644, "37a5054a9f9b4628e3924c5cb8f2147c6e2a3efc", 3, "veal.txt" },
+ { 0100644, "43b17b0ba58cbf2ffd3a048c1d4c7bbbcb0b987e", 1, "veal.txt" },
+ { 0100644, "37a5054a9f9b4628e3924c5cb8f2147c6e2a3efc", 2, "veal.txt" },
+ { 0100644, "d604c75019c282144bdbbf3fd3462ba74b240efc", 3, "veal.txt" },
};
opts.file_flags |= GIT_MERGE_FILE_STYLE_DIFF3;
checkout_opts.checkout_strategy |= GIT_CHECKOUT_CONFLICT_STYLE_DIFF3;
- cl_git_pass(merge_branches(repo, GIT_REFS_HEADS_DIR "branchH-1", GIT_REFS_HEADS_DIR "branchH-2", &opts, &checkout_opts));
+ cl_git_pass(merge_branches(repo, GIT_REFS_HEADS_DIR "branchH-2", GIT_REFS_HEADS_DIR "branchH-1", &opts, &checkout_opts));
cl_git_pass(git_repository_index(&index, repo));
cl_assert(merge_test_index(index, merge_index_entries, 8));
cl_git_pass(git_futils_readbuffer(&conflicting_buf, "merge-recursive/veal.txt"));
- cl_assert_equal_s(CONFLICTING_RECURSIVE_H1_TO_H2_WITH_DIFF3, conflicting_buf.ptr);
+ cl_assert_equal_s(CONFLICTING_RECURSIVE_H2_TO_H1_WITH_DIFF3, conflicting_buf.ptr);
git_index_free(index);
git_buf_free(&conflicting_buf);
diff --git a/tests/object/tree/write.c b/tests/object/tree/write.c
index a9decf9..3dd1cbf 100644
--- a/tests/object/tree/write.c
+++ b/tests/object/tree/write.c
@@ -495,6 +495,7 @@ static void test_inserting_submodule(void)
git_treebuilder *bld;
git_oid sm_id;
+ cl_git_pass(git_oid_fromstr(&sm_id, "da39a3ee5e6b4b0d3255bfef95601890afd80709"));
cl_git_pass(git_treebuilder_new(&bld, g_repo, NULL));
cl_git_pass(git_treebuilder_insert(NULL, bld, "sm", &sm_id, GIT_FILEMODE_COMMIT));
git_treebuilder_free(bld);
diff --git a/tests/pack/indexer.c b/tests/pack/indexer.c
index c73d397..f3c2204 100644
--- a/tests/pack/indexer.c
+++ b/tests/pack/indexer.c
@@ -40,6 +40,40 @@ static const unsigned char thin_pack[] = {
};
static const unsigned int thin_pack_len = 78;
+/*
+ * Packfile with one object. It references an object which is not in the
+ * packfile and has a corrupt length (states the deltified stream is 1 byte
+ * long, where it is actually 6).
+ */
+static const unsigned char corrupt_thin_pack[] = {
+ 0x50, 0x41, 0x43, 0x4b, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01,
+ 0x71, 0xe6, 0x8f, 0xe8, 0x12, 0x9b, 0x54, 0x6b, 0x10, 0x1a, 0xee, 0x95,
+ 0x10, 0xc5, 0x32, 0x8e, 0x7f, 0x21, 0xca, 0x1d, 0x18, 0x78, 0x9c, 0x63,
+ 0x62, 0x66, 0x4e, 0xcb, 0xcf, 0x07, 0x00, 0x02, 0xac, 0x01, 0x4d, 0x07,
+ 0x67, 0x03, 0xc5, 0x40, 0x99, 0x49, 0xb1, 0x3b, 0x7d, 0xae, 0x9b, 0x0e,
+ 0xdd, 0xde, 0xc6, 0x76, 0x43, 0x24, 0x64
+};
+static const unsigned int corrupt_thin_pack_len = 67;
+
+/*
+ * Packfile with a missing trailer.
+ */
+static const unsigned char missing_trailer_pack[] = {
+ 0x50, 0x41, 0x43, 0x4b, 0x00, 0x00, 0x00, 0x03, 0x00, 0x50, 0xf4, 0x3b,
+};
+static const unsigned int missing_trailer_pack_len = 12;
+
+/*
+ * Packfile that causes the packfile stream to open in a way in which it leaks
+ * the stream reader.
+ */
+static const unsigned char leaky_pack[] = {
+ 0x50, 0x41, 0x43, 0x4b, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x03,
+ 0xf4, 0xbd, 0x51, 0x51, 0x51, 0x51, 0x51, 0x72, 0x65, 0x41, 0x4b, 0x63,
+ 0x5f, 0x64, 0x65, 0x70, 0x74, 0x68, 0xbd, 0x41, 0x4b
+};
+static const unsigned int leaky_pack_len = 33;
+
static const unsigned char base_obj[] = { 07, 076 };
static const unsigned int base_obj_len = 2;
@@ -60,6 +94,38 @@ void test_pack_indexer__out_of_order(void)
git_indexer_free(idx);
}
+void test_pack_indexer__missing_trailer(void)
+{
+ git_indexer *idx = 0;
+ git_transfer_progress stats = { 0 };
+
+ cl_git_pass(git_indexer_new(&idx, ".", 0, NULL, NULL, NULL));
+ cl_git_pass(git_indexer_append(
+ idx, missing_trailer_pack, missing_trailer_pack_len, &stats));
+ cl_git_fail(git_indexer_commit(idx, &stats));
+
+ cl_assert(giterr_last() != NULL);
+ cl_assert_equal_i(giterr_last()->klass, GITERR_INDEXER);
+
+ git_indexer_free(idx);
+}
+
+void test_pack_indexer__leaky(void)
+{
+ git_indexer *idx = 0;
+ git_transfer_progress stats = { 0 };
+
+ cl_git_pass(git_indexer_new(&idx, ".", 0, NULL, NULL, NULL));
+ cl_git_pass(git_indexer_append(
+ idx, leaky_pack, leaky_pack_len, &stats));
+ cl_git_fail(git_indexer_commit(idx, &stats));
+
+ cl_assert(giterr_last() != NULL);
+ cl_assert_equal_i(giterr_last()->klass, GITERR_INDEXER);
+
+ git_indexer_free(idx);
+}
+
void test_pack_indexer__fix_thin(void)
{
git_indexer *idx = NULL;
@@ -126,6 +192,35 @@ void test_pack_indexer__fix_thin(void)
}
}
+void test_pack_indexer__corrupt_length(void)
+{
+ git_indexer *idx = NULL;
+ git_transfer_progress stats = { 0 };
+ git_repository *repo;
+ git_odb *odb;
+ git_oid id, should_id;
+
+ cl_git_pass(git_repository_init(&repo, "thin.git", true));
+ cl_git_pass(git_repository_odb(&odb, repo));
+
+ /* Store the missing base into your ODB so the indexer can fix the pack */
+ cl_git_pass(git_odb_write(&id, odb, base_obj, base_obj_len, GIT_OBJ_BLOB));
+ git_oid_fromstr(&should_id, "e68fe8129b546b101aee9510c5328e7f21ca1d18");
+ cl_assert_equal_oid(&should_id, &id);
+
+ cl_git_pass(git_indexer_new(&idx, ".", 0, odb, NULL, NULL));
+ cl_git_pass(git_indexer_append(
+ idx, corrupt_thin_pack, corrupt_thin_pack_len, &stats));
+ cl_git_fail(git_indexer_commit(idx, &stats));
+
+ cl_assert(giterr_last() != NULL);
+ cl_assert_equal_i(giterr_last()->klass, GITERR_ZLIB);
+
+ git_indexer_free(idx);
+ git_odb_free(odb);
+ git_repository_free(repo);
+}
+
static int find_tmp_file_recurs(void *opaque, git_buf *path)
{
int error = 0;
diff --git a/tests/rebase/submodule.c b/tests/rebase/submodule.c
index 7a38ab8..93e6b40 100644
--- a/tests/rebase/submodule.c
+++ b/tests/rebase/submodule.c
@@ -3,6 +3,7 @@
#include "git2/rebase.h"
#include "posix.h"
#include "signature.h"
+#include "../submodule/submodule_helpers.h"
#include <fcntl.h>
@@ -12,9 +13,44 @@ static git_signature *signature;
// Fixture setup and teardown
void test_rebase_submodule__initialize(void)
{
+ git_index *index;
+ git_oid tree_oid, commit_id;
+ git_tree *tree;
+ git_commit *parent;
+ git_object *obj;
+ git_reference *master_ref;
+ git_checkout_options opts = GIT_CHECKOUT_OPTIONS_INIT;
+ opts.checkout_strategy = GIT_CHECKOUT_FORCE;
+
repo = cl_git_sandbox_init("rebase-submodule");
cl_git_pass(git_signature_new(&signature,
"Rebaser", "rebaser@rebaser.rb", 1405694510, 0));
+
+ rewrite_gitmodules(git_repository_workdir(repo));
+
+ git_submodule_set_url(repo, "my-submodule", git_repository_path(repo));
+
+ /* We have to commit the rewritten .gitmodules file */
+ git_repository_index(&index, repo);
+ git_index_add_bypath(index, ".gitmodules");
+ git_index_write_tree(&tree_oid, index);
+ git_index_free(index);
+
+ cl_git_pass(git_tree_lookup(&tree, repo, &tree_oid));
+
+ git_repository_head(&master_ref, repo);
+ cl_git_pass(git_commit_lookup(&parent, repo, git_reference_target(master_ref)));
+
+ cl_git_pass(git_commit_create_v(&commit_id, repo, git_reference_name(master_ref), signature, signature, NULL, "Fixup .gitmodules", tree, 1, parent));
+
+ /* And a final reset, for good measure */
+ git_object_lookup(&obj, repo, &commit_id, GIT_OBJ_COMMIT);
+ cl_git_pass(git_reset(repo, obj, GIT_RESET_HARD, &opts));
+
+ git_object_free(obj);
+ git_commit_free(parent);
+ git_reference_free(master_ref);
+ git_tree_free(tree);
}
void test_rebase_submodule__cleanup(void)
@@ -31,7 +67,6 @@ void test_rebase_submodule__init_untracked(void)
git_buf untracked_path = GIT_BUF_INIT;
FILE *fp;
git_submodule *submodule;
- git_config *config;
cl_git_pass(git_reference_lookup(&branch_ref, repo, "refs/heads/asparagus"));
cl_git_pass(git_reference_lookup(&upstream_ref, repo, "refs/heads/master"));
@@ -39,12 +74,6 @@ void test_rebase_submodule__init_untracked(void)
cl_git_pass(git_annotated_commit_from_ref(&branch_head, repo, branch_ref));
cl_git_pass(git_annotated_commit_from_ref(&upstream_head, repo, upstream_ref));
- git_repository_config(&config, repo);
-
- cl_git_pass(git_config_set_string(config, "submodule.my-submodule.url", git_repository_path(repo)));
-
- git_config_free(config);
-
cl_git_pass(git_submodule_lookup(&submodule, repo, "my-submodule"));
cl_git_pass(git_submodule_update(submodule, 1, NULL));
diff --git a/tests/refs/peel.c b/tests/refs/peel.c
index 83f6109..09809e1 100644
--- a/tests/refs/peel.c
+++ b/tests/refs/peel.c
@@ -117,3 +117,15 @@ void test_refs_peel__can_peel_fully_peeled_packed_refs(void)
"0df1a5865c8abfc09f1f2182e6a31be550e99f07",
GIT_OBJ_COMMIT);
}
+
+void test_refs_peel__can_peel_fully_peeled_tag_to_tag(void)
+{
+ assert_peel_generic(g_peel_repo,
+ "refs/tags/tag-inside-tags", GIT_OBJ_TAG,
+ "c2596aa0151888587ec5c0187f261e63412d9e11",
+ GIT_OBJ_TAG);
+ assert_peel_generic(g_peel_repo,
+ "refs/foo/tag-outside-tags", GIT_OBJ_TAG,
+ "c2596aa0151888587ec5c0187f261e63412d9e11",
+ GIT_OBJ_TAG);
+}
diff --git a/tests/repo/init.c b/tests/repo/init.c
index 04d4a5c..6a455bf 100644
--- a/tests/repo/init.c
+++ b/tests/repo/init.c
@@ -320,6 +320,17 @@ void test_repo_init__sets_logAllRefUpdates_according_to_type_of_repository(void)
assert_config_entry_on_init_bytype("core.logallrefupdates", true, false);
}
+void test_repo_init__empty_template_path(void)
+{
+ git_repository_init_options opts = GIT_REPOSITORY_INIT_OPTIONS_INIT;
+ opts.template_path = "";
+
+ cl_git_pass(git_futils_mkdir("foo", 0755, 0));
+ cl_git_pass(git_repository_init_ext(&_repo, "foo", &opts));
+
+ cleanup_repository("foo");
+}
+
void test_repo_init__extended_0(void)
{
git_repository_init_options opts = GIT_REPOSITORY_INIT_OPTIONS_INIT;
diff --git a/tests/resources/merge-recursive/.gitted/objects/03/9d0da126f24b819a5a38186249c7f96be3824c b/tests/resources/merge-recursive/.gitted/objects/03/9d0da126f24b819a5a38186249c7f96be3824c
new file mode 100644
index 0000000..79ad635
Binary files /dev/null and b/tests/resources/merge-recursive/.gitted/objects/03/9d0da126f24b819a5a38186249c7f96be3824c differ
diff --git a/tests/resources/merge-recursive/.gitted/objects/05/63b7706dcdcf94bc0c02cd96c137940278eca9 b/tests/resources/merge-recursive/.gitted/objects/05/63b7706dcdcf94bc0c02cd96c137940278eca9
new file mode 100644
index 0000000..c6d38a7
Binary files /dev/null and b/tests/resources/merge-recursive/.gitted/objects/05/63b7706dcdcf94bc0c02cd96c137940278eca9 differ
diff --git a/tests/resources/merge-recursive/.gitted/objects/08/f01e1bff7e442d574eb221913515b4bd27ccd6 b/tests/resources/merge-recursive/.gitted/objects/08/f01e1bff7e442d574eb221913515b4bd27ccd6
new file mode 100644
index 0000000..c2fbf5b
Binary files /dev/null and b/tests/resources/merge-recursive/.gitted/objects/08/f01e1bff7e442d574eb221913515b4bd27ccd6 differ
diff --git a/tests/resources/merge-recursive/.gitted/objects/0b/beee1982b493330e375a85bbfddaba3d561556 b/tests/resources/merge-recursive/.gitted/objects/0b/beee1982b493330e375a85bbfddaba3d561556
new file mode 100644
index 0000000..66b9272
Binary files /dev/null and b/tests/resources/merge-recursive/.gitted/objects/0b/beee1982b493330e375a85bbfddaba3d561556 differ
diff --git a/tests/resources/merge-recursive/.gitted/objects/0c/e202f64fa8356c1a32835fce4058ca76b0c7ed b/tests/resources/merge-recursive/.gitted/objects/0c/e202f64fa8356c1a32835fce4058ca76b0c7ed
new file mode 100644
index 0000000..9a84b71
Binary files /dev/null and b/tests/resources/merge-recursive/.gitted/objects/0c/e202f64fa8356c1a32835fce4058ca76b0c7ed differ
diff --git a/tests/resources/merge-recursive/.gitted/objects/0e/c39d71c1b074905350ce20ce3f0629f737a2a9 b/tests/resources/merge-recursive/.gitted/objects/0e/c39d71c1b074905350ce20ce3f0629f737a2a9
new file mode 100644
index 0000000..68808d2
Binary files /dev/null and b/tests/resources/merge-recursive/.gitted/objects/0e/c39d71c1b074905350ce20ce3f0629f737a2a9 differ
diff --git a/tests/resources/merge-recursive/.gitted/objects/17/946ad3088f931102e5d81f94cf2825fc188953 b/tests/resources/merge-recursive/.gitted/objects/17/946ad3088f931102e5d81f94cf2825fc188953
new file mode 100644
index 0000000..9cc133e
Binary files /dev/null and b/tests/resources/merge-recursive/.gitted/objects/17/946ad3088f931102e5d81f94cf2825fc188953 differ
diff --git a/tests/resources/merge-recursive/.gitted/objects/18/2d0d250d1d7adcc60c178be5be98358b3a2fd1 b/tests/resources/merge-recursive/.gitted/objects/18/2d0d250d1d7adcc60c178be5be98358b3a2fd1
new file mode 100644
index 0000000..96674c8
--- /dev/null
+++ b/tests/resources/merge-recursive/.gitted/objects/18/2d0d250d1d7adcc60c178be5be98358b3a2fd1
@@ -0,0 +1,5 @@
+xK
+1]_>@H
+^<j2i4Fg9ʼn
++3L6{vX
+`F:?CtM`y"*iT)R3M!{3+ךqϷ%@m9I
{ܫvpx/E
\ No newline at end of file
diff --git a/tests/resources/merge-recursive/.gitted/objects/1b/c7bcccf4bbdc8bfba2331a37ad5e9cf1dd321c b/tests/resources/merge-recursive/.gitted/objects/1b/c7bcccf4bbdc8bfba2331a37ad5e9cf1dd321c
new file mode 100644
index 0000000..8117167
Binary files /dev/null and b/tests/resources/merge-recursive/.gitted/objects/1b/c7bcccf4bbdc8bfba2331a37ad5e9cf1dd321c differ
diff --git a/tests/resources/merge-recursive/.gitted/objects/1b/de1883de4977ea3e664b315da951d1f614c3b1 b/tests/resources/merge-recursive/.gitted/objects/1b/de1883de4977ea3e664b315da951d1f614c3b1
new file mode 100644
index 0000000..67daf36
Binary files /dev/null and b/tests/resources/merge-recursive/.gitted/objects/1b/de1883de4977ea3e664b315da951d1f614c3b1 differ
diff --git a/tests/resources/merge-recursive/.gitted/objects/23/b427bf6278724433e64ef4cf6dc166c4f2e246 b/tests/resources/merge-recursive/.gitted/objects/23/b427bf6278724433e64ef4cf6dc166c4f2e246
new file mode 100644
index 0000000..03be909
Binary files /dev/null and b/tests/resources/merge-recursive/.gitted/objects/23/b427bf6278724433e64ef4cf6dc166c4f2e246 differ
diff --git a/tests/resources/merge-recursive/.gitted/objects/23/cf2687a9327d55abbbd788ff04fa932072aebc b/tests/resources/merge-recursive/.gitted/objects/23/cf2687a9327d55abbbd788ff04fa932072aebc
new file mode 100644
index 0000000..5cc665a
Binary files /dev/null and b/tests/resources/merge-recursive/.gitted/objects/23/cf2687a9327d55abbbd788ff04fa932072aebc differ
diff --git a/tests/resources/merge-recursive/.gitted/objects/26/d3c94459b4faa08f009b15867993ca34153592 b/tests/resources/merge-recursive/.gitted/objects/26/d3c94459b4faa08f009b15867993ca34153592
new file mode 100644
index 0000000..dd7b1a2
--- /dev/null
+++ b/tests/resources/merge-recursive/.gitted/objects/26/d3c94459b4faa08f009b15867993ca34153592
@@ -0,0 +1,2 @@
+xA
+1E]vڂ+O 3mF*x{\yZ܀7BH5Ț:sYB9D3Ohk1T-ؑpt>N"1[!#v_+\>uVo,ӭȼZ@2l1 N{`?Ts6_?B*
\ No newline at end of file
diff --git a/tests/resources/merge-recursive/.gitted/objects/2c/ba583804a4a6fad1baf97c959be447238d1489 b/tests/resources/merge-recursive/.gitted/objects/2c/ba583804a4a6fad1baf97c959be447238d1489
new file mode 100644
index 0000000..c0a60a1
Binary files /dev/null and b/tests/resources/merge-recursive/.gitted/objects/2c/ba583804a4a6fad1baf97c959be447238d1489 differ
diff --git a/tests/resources/merge-recursive/.gitted/objects/2e/7ae0d42fb7b6126f6a08ac6314ac07833a52f6 b/tests/resources/merge-recursive/.gitted/objects/2e/7ae0d42fb7b6126f6a08ac6314ac07833a52f6
new file mode 100644
index 0000000..6a9651c
Binary files /dev/null and b/tests/resources/merge-recursive/.gitted/objects/2e/7ae0d42fb7b6126f6a08ac6314ac07833a52f6 differ
diff --git a/tests/resources/merge-recursive/.gitted/objects/30/39c07db695c8c99d0a7c7e32f0afe40eae0be0 b/tests/resources/merge-recursive/.gitted/objects/30/39c07db695c8c99d0a7c7e32f0afe40eae0be0
new file mode 100644
index 0000000..cc21b5c
--- /dev/null
+++ b/tests/resources/merge-recursive/.gitted/objects/30/39c07db695c8c99d0a7c7e32f0afe40eae0be0
@@ -0,0 +1,3 @@
+xQ
+!@sB"茵mݾ
+}^^Z"(J8iŌI]98Xd)QNX"[2^t|,pZ }5./[V]B
\ No newline at end of file
diff --git a/tests/resources/merge-recursive/.gitted/objects/35/8efd6f589384fa8baf92234db9c7899a53916e b/tests/resources/merge-recursive/.gitted/objects/35/8efd6f589384fa8baf92234db9c7899a53916e
new file mode 100644
index 0000000..aefc81a
Binary files /dev/null and b/tests/resources/merge-recursive/.gitted/objects/35/8efd6f589384fa8baf92234db9c7899a53916e differ
diff --git a/tests/resources/merge-recursive/.gitted/objects/35/dda4f3f9b3794d92a46d908790e550ed100eae b/tests/resources/merge-recursive/.gitted/objects/35/dda4f3f9b3794d92a46d908790e550ed100eae
new file mode 100644
index 0000000..d6cabb4
Binary files /dev/null and b/tests/resources/merge-recursive/.gitted/objects/35/dda4f3f9b3794d92a46d908790e550ed100eae differ
diff --git a/tests/resources/merge-recursive/.gitted/objects/36/71e42c8c8302d1a71c0ed7bf2b0a938e9e20f9 b/tests/resources/merge-recursive/.gitted/objects/36/71e42c8c8302d1a71c0ed7bf2b0a938e9e20f9
new file mode 100644
index 0000000..4f70ad6
Binary files /dev/null and b/tests/resources/merge-recursive/.gitted/objects/36/71e42c8c8302d1a71c0ed7bf2b0a938e9e20f9 differ
diff --git a/tests/resources/merge-recursive/.gitted/objects/39/78944e4cd53edcc10a170ab2ff142f7295b958 b/tests/resources/merge-recursive/.gitted/objects/39/78944e4cd53edcc10a170ab2ff142f7295b958
new file mode 100644
index 0000000..b18fd48
Binary files /dev/null and b/tests/resources/merge-recursive/.gitted/objects/39/78944e4cd53edcc10a170ab2ff142f7295b958 differ
diff --git a/tests/resources/merge-recursive/.gitted/objects/3a/0dc89a8bd20e74fae69d2e038b47360fafb02e b/tests/resources/merge-recursive/.gitted/objects/3a/0dc89a8bd20e74fae69d2e038b47360fafb02e
new file mode 100644
index 0000000..fdff502
Binary files /dev/null and b/tests/resources/merge-recursive/.gitted/objects/3a/0dc89a8bd20e74fae69d2e038b47360fafb02e differ
diff --git a/tests/resources/merge-recursive/.gitted/objects/3a/8c70144d0334721154b1e0529716b368483d6f b/tests/resources/merge-recursive/.gitted/objects/3a/8c70144d0334721154b1e0529716b368483d6f
new file mode 100644
index 0000000..958d17d
Binary files /dev/null and b/tests/resources/merge-recursive/.gitted/objects/3a/8c70144d0334721154b1e0529716b368483d6f differ
diff --git a/tests/resources/merge-recursive/.gitted/objects/3e/eff81b57a0ac15a5ab6bb3a8e92511a01a429c b/tests/resources/merge-recursive/.gitted/objects/3e/eff81b57a0ac15a5ab6bb3a8e92511a01a429c
new file mode 100644
index 0000000..6a6c654
Binary files /dev/null and b/tests/resources/merge-recursive/.gitted/objects/3e/eff81b57a0ac15a5ab6bb3a8e92511a01a429c differ
diff --git a/tests/resources/merge-recursive/.gitted/objects/40/9f5d072decec684331672f2d6c0a9bc3640adb b/tests/resources/merge-recursive/.gitted/objects/40/9f5d072decec684331672f2d6c0a9bc3640adb
new file mode 100644
index 0000000..b4c9005
Binary files /dev/null and b/tests/resources/merge-recursive/.gitted/objects/40/9f5d072decec684331672f2d6c0a9bc3640adb differ
diff --git a/tests/resources/merge-recursive/.gitted/objects/44/faf5fba1af850dae54f8b2345938d3c7ae479f b/tests/resources/merge-recursive/.gitted/objects/44/faf5fba1af850dae54f8b2345938d3c7ae479f
new file mode 100644
index 0000000..d0bc099
Binary files /dev/null and b/tests/resources/merge-recursive/.gitted/objects/44/faf5fba1af850dae54f8b2345938d3c7ae479f differ
diff --git a/tests/resources/merge-recursive/.gitted/objects/4a/06b258fed8a4d15967ec4253ae7366b70f727d b/tests/resources/merge-recursive/.gitted/objects/4a/06b258fed8a4d15967ec4253ae7366b70f727d
new file mode 100644
index 0000000..d3e1815
Binary files /dev/null and b/tests/resources/merge-recursive/.gitted/objects/4a/06b258fed8a4d15967ec4253ae7366b70f727d differ
diff --git a/tests/resources/merge-recursive/.gitted/objects/4b/825dc642cb6eb9a060e54bf8d69288fbee4904 b/tests/resources/merge-recursive/.gitted/objects/4b/825dc642cb6eb9a060e54bf8d69288fbee4904
new file mode 100644
index 0000000..adf6411
Binary files /dev/null and b/tests/resources/merge-recursive/.gitted/objects/4b/825dc642cb6eb9a060e54bf8d69288fbee4904 differ
diff --git a/tests/resources/merge-recursive/.gitted/objects/4c/62e9482ed42c1a6d08891906b26126daa4a8f5 b/tests/resources/merge-recursive/.gitted/objects/4c/62e9482ed42c1a6d08891906b26126daa4a8f5
new file mode 100644
index 0000000..f3cee9a
Binary files /dev/null and b/tests/resources/merge-recursive/.gitted/objects/4c/62e9482ed42c1a6d08891906b26126daa4a8f5 differ
diff --git a/tests/resources/merge-recursive/.gitted/objects/50/4dd93fb5b9c2a28c094c6e84ef0606de1e9b5c b/tests/resources/merge-recursive/.gitted/objects/50/4dd93fb5b9c2a28c094c6e84ef0606de1e9b5c
new file mode 100644
index 0000000..214d307
Binary files /dev/null and b/tests/resources/merge-recursive/.gitted/objects/50/4dd93fb5b9c2a28c094c6e84ef0606de1e9b5c differ
diff --git a/tests/resources/merge-recursive/.gitted/objects/50/dfa64a56b488fe8082371b182c8a3e3c942332 b/tests/resources/merge-recursive/.gitted/objects/50/dfa64a56b488fe8082371b182c8a3e3c942332
new file mode 100644
index 0000000..7c90c99
Binary files /dev/null and b/tests/resources/merge-recursive/.gitted/objects/50/dfa64a56b488fe8082371b182c8a3e3c942332 differ
diff --git a/tests/resources/merge-recursive/.gitted/objects/51/135c5884d7dd132fef3b432cca5826bab98f37 b/tests/resources/merge-recursive/.gitted/objects/51/135c5884d7dd132fef3b432cca5826bab98f37
new file mode 100644
index 0000000..95818f1
Binary files /dev/null and b/tests/resources/merge-recursive/.gitted/objects/51/135c5884d7dd132fef3b432cca5826bab98f37 differ
diff --git a/tests/resources/merge-recursive/.gitted/objects/51/60ab78c1973dcd7cdebe2345dc8fcfc755e76d b/tests/resources/merge-recursive/.gitted/objects/51/60ab78c1973dcd7cdebe2345dc8fcfc755e76d
new file mode 100644
index 0000000..f3f99d7
Binary files /dev/null and b/tests/resources/merge-recursive/.gitted/objects/51/60ab78c1973dcd7cdebe2345dc8fcfc755e76d differ
diff --git a/tests/resources/merge-recursive/.gitted/objects/56/fcbad344aafe519bafcc33c87b8e64849d82ab b/tests/resources/merge-recursive/.gitted/objects/56/fcbad344aafe519bafcc33c87b8e64849d82ab
new file mode 100644
index 0000000..06bea32
Binary files /dev/null and b/tests/resources/merge-recursive/.gitted/objects/56/fcbad344aafe519bafcc33c87b8e64849d82ab differ
diff --git a/tests/resources/merge-recursive/.gitted/objects/5a/47615db824433f816ba62217dda6d46c5a7640 b/tests/resources/merge-recursive/.gitted/objects/5a/47615db824433f816ba62217dda6d46c5a7640
new file mode 100644
index 0000000..c1e30ce
Binary files /dev/null and b/tests/resources/merge-recursive/.gitted/objects/5a/47615db824433f816ba62217dda6d46c5a7640 differ
diff --git a/tests/resources/merge-recursive/.gitted/objects/5c/27b5f7c6f6dd4e5b4d64976741d56c2df8f48a b/tests/resources/merge-recursive/.gitted/objects/5c/27b5f7c6f6dd4e5b4d64976741d56c2df8f48a
new file mode 100644
index 0000000..783d085
Binary files /dev/null and b/tests/resources/merge-recursive/.gitted/objects/5c/27b5f7c6f6dd4e5b4d64976741d56c2df8f48a differ
diff --git a/tests/resources/merge-recursive/.gitted/objects/5d/998d5f278aff5693711bc48f6852aac4b603ad b/tests/resources/merge-recursive/.gitted/objects/5d/998d5f278aff5693711bc48f6852aac4b603ad
new file mode 100644
index 0000000..a7795f5
Binary files /dev/null and b/tests/resources/merge-recursive/.gitted/objects/5d/998d5f278aff5693711bc48f6852aac4b603ad differ
diff --git a/tests/resources/merge-recursive/.gitted/objects/61/6d1209afac499b005f68309e1593b44899b054 b/tests/resources/merge-recursive/.gitted/objects/61/6d1209afac499b005f68309e1593b44899b054
new file mode 100644
index 0000000..6a06214
Binary files /dev/null and b/tests/resources/merge-recursive/.gitted/objects/61/6d1209afac499b005f68309e1593b44899b054 differ
diff --git a/tests/resources/merge-recursive/.gitted/objects/71/c50785d8d512293bd3af838b131f3da5829ebc b/tests/resources/merge-recursive/.gitted/objects/71/c50785d8d512293bd3af838b131f3da5829ebc
new file mode 100644
index 0000000..23c4033
Binary files /dev/null and b/tests/resources/merge-recursive/.gitted/objects/71/c50785d8d512293bd3af838b131f3da5829ebc differ
diff --git a/tests/resources/merge-recursive/.gitted/objects/75/afa96db00c26c6ebf3b377615b4e2a20563ee4 b/tests/resources/merge-recursive/.gitted/objects/75/afa96db00c26c6ebf3b377615b4e2a20563ee4
new file mode 100644
index 0000000..11d7f94
Binary files /dev/null and b/tests/resources/merge-recursive/.gitted/objects/75/afa96db00c26c6ebf3b377615b4e2a20563ee4 differ
diff --git a/tests/resources/merge-recursive/.gitted/objects/76/6afbfd7d42f757f1fac9ea550c9fcbc8041b89 b/tests/resources/merge-recursive/.gitted/objects/76/6afbfd7d42f757f1fac9ea550c9fcbc8041b89
new file mode 100644
index 0000000..a5af383
Binary files /dev/null and b/tests/resources/merge-recursive/.gitted/objects/76/6afbfd7d42f757f1fac9ea550c9fcbc8041b89 differ
diff --git a/tests/resources/merge-recursive/.gitted/objects/7c/61830f8b8632665bb44ae5d219f520f5aa5bb4 b/tests/resources/merge-recursive/.gitted/objects/7c/61830f8b8632665bb44ae5d219f520f5aa5bb4
new file mode 100644
index 0000000..04b10f7
Binary files /dev/null and b/tests/resources/merge-recursive/.gitted/objects/7c/61830f8b8632665bb44ae5d219f520f5aa5bb4 differ
diff --git a/tests/resources/merge-recursive/.gitted/objects/7c/9a30d8dcee320a3b1f9ed10b582479faa9d3a1 b/tests/resources/merge-recursive/.gitted/objects/7c/9a30d8dcee320a3b1f9ed10b582479faa9d3a1
new file mode 100644
index 0000000..7500a24
Binary files /dev/null and b/tests/resources/merge-recursive/.gitted/objects/7c/9a30d8dcee320a3b1f9ed10b582479faa9d3a1 differ
diff --git a/tests/resources/merge-recursive/.gitted/objects/7e/2d2bad4fc21f2832ca2afd48b1f95ab37ffb92 b/tests/resources/merge-recursive/.gitted/objects/7e/2d2bad4fc21f2832ca2afd48b1f95ab37ffb92
new file mode 100644
index 0000000..11f96c9
Binary files /dev/null and b/tests/resources/merge-recursive/.gitted/objects/7e/2d2bad4fc21f2832ca2afd48b1f95ab37ffb92 differ
diff --git a/tests/resources/merge-recursive/.gitted/objects/7e/70a7872576bba7e299cde45abb7da1e4d7ba81 b/tests/resources/merge-recursive/.gitted/objects/7e/70a7872576bba7e299cde45abb7da1e4d7ba81
new file mode 100644
index 0000000..cab4639
Binary files /dev/null and b/tests/resources/merge-recursive/.gitted/objects/7e/70a7872576bba7e299cde45abb7da1e4d7ba81 differ
diff --git a/tests/resources/merge-recursive/.gitted/objects/7f/9c1d78d760cbfa99273bc1ef642d994c6baa5c b/tests/resources/merge-recursive/.gitted/objects/7f/9c1d78d760cbfa99273bc1ef642d994c6baa5c
new file mode 100644
index 0000000..46c8e85
Binary files /dev/null and b/tests/resources/merge-recursive/.gitted/objects/7f/9c1d78d760cbfa99273bc1ef642d994c6baa5c differ
diff --git a/tests/resources/merge-recursive/.gitted/objects/81/60cb53660b86c954144b8dbbb0b6e4db4ba6ba b/tests/resources/merge-recursive/.gitted/objects/81/60cb53660b86c954144b8dbbb0b6e4db4ba6ba
new file mode 100644
index 0000000..19d32c7
Binary files /dev/null and b/tests/resources/merge-recursive/.gitted/objects/81/60cb53660b86c954144b8dbbb0b6e4db4ba6ba differ
diff --git a/tests/resources/merge-recursive/.gitted/objects/8f/1b918542a5fe9b3bb7a8770a7525ad5b3b5864 b/tests/resources/merge-recursive/.gitted/objects/8f/1b918542a5fe9b3bb7a8770a7525ad5b3b5864
new file mode 100644
index 0000000..5ecb3e5
Binary files /dev/null and b/tests/resources/merge-recursive/.gitted/objects/8f/1b918542a5fe9b3bb7a8770a7525ad5b3b5864 differ
diff --git a/tests/resources/merge-recursive/.gitted/objects/97/5dd228fd1b0cacf2988167088fd1190c9ac0f5 b/tests/resources/merge-recursive/.gitted/objects/97/5dd228fd1b0cacf2988167088fd1190c9ac0f5
new file mode 100644
index 0000000..96658c4
Binary files /dev/null and b/tests/resources/merge-recursive/.gitted/objects/97/5dd228fd1b0cacf2988167088fd1190c9ac0f5 differ
diff --git a/tests/resources/merge-recursive/.gitted/objects/98/5b725cf91c6861b5e7a419415d03cbcf5f16ca b/tests/resources/merge-recursive/.gitted/objects/98/5b725cf91c6861b5e7a419415d03cbcf5f16ca
new file mode 100644
index 0000000..bc95c6f
Binary files /dev/null and b/tests/resources/merge-recursive/.gitted/objects/98/5b725cf91c6861b5e7a419415d03cbcf5f16ca differ
diff --git a/tests/resources/merge-recursive/.gitted/objects/98/cacbdd1fac7bbab54a6c7c97aa2103219e08b8 b/tests/resources/merge-recursive/.gitted/objects/98/cacbdd1fac7bbab54a6c7c97aa2103219e08b8
new file mode 100644
index 0000000..13344d8
Binary files /dev/null and b/tests/resources/merge-recursive/.gitted/objects/98/cacbdd1fac7bbab54a6c7c97aa2103219e08b8 differ
diff --git a/tests/resources/merge-recursive/.gitted/objects/99/754e36599906b81b917447280c4918269e14ff b/tests/resources/merge-recursive/.gitted/objects/99/754e36599906b81b917447280c4918269e14ff
new file mode 100644
index 0000000..40455ef
Binary files /dev/null and b/tests/resources/merge-recursive/.gitted/objects/99/754e36599906b81b917447280c4918269e14ff differ
diff --git a/tests/resources/merge-recursive/.gitted/objects/9a/228c1ee87f286202ec9a25de837a18550013b5 b/tests/resources/merge-recursive/.gitted/objects/9a/228c1ee87f286202ec9a25de837a18550013b5
new file mode 100644
index 0000000..d6bcd52
Binary files /dev/null and b/tests/resources/merge-recursive/.gitted/objects/9a/228c1ee87f286202ec9a25de837a18550013b5 differ
diff --git a/tests/resources/merge-recursive/.gitted/objects/9c/dde216049c6a5ccddac0ad81f604419d8990ed b/tests/resources/merge-recursive/.gitted/objects/9c/dde216049c6a5ccddac0ad81f604419d8990ed
new file mode 100644
index 0000000..9f2c928
--- /dev/null
+++ b/tests/resources/merge-recursive/.gitted/objects/9c/dde216049c6a5ccddac0ad81f604419d8990ed
@@ -0,0 +1,2 @@
+xQ
+B!EvnPDbA϶繜Z箝Mo"7)Hvdq0!S,T( J𬞩ɣ8q`8>*}mi,K҇}4/;ZQѻzk1j#WuvCN
\ No newline at end of file
diff --git a/tests/resources/merge-recursive/.gitted/objects/a0/ce8909834f389b4f8be6a6ec420868422d40a1 b/tests/resources/merge-recursive/.gitted/objects/a0/ce8909834f389b4f8be6a6ec420868422d40a1
new file mode 100644
index 0000000..5f6643c
Binary files /dev/null and b/tests/resources/merge-recursive/.gitted/objects/a0/ce8909834f389b4f8be6a6ec420868422d40a1 differ
diff --git a/tests/resources/merge-recursive/.gitted/objects/a2/817ed0e8ca6fe52bf0a20b2f50eb94b9ea5415 b/tests/resources/merge-recursive/.gitted/objects/a2/817ed0e8ca6fe52bf0a20b2f50eb94b9ea5415
new file mode 100644
index 0000000..a043a8e
Binary files /dev/null and b/tests/resources/merge-recursive/.gitted/objects/a2/817ed0e8ca6fe52bf0a20b2f50eb94b9ea5415 differ
diff --git a/tests/resources/merge-recursive/.gitted/objects/a3/5aa65d86215fce909fc0bcce8949d12becba44 b/tests/resources/merge-recursive/.gitted/objects/a3/5aa65d86215fce909fc0bcce8949d12becba44
new file mode 100644
index 0000000..e71e9ec
Binary files /dev/null and b/tests/resources/merge-recursive/.gitted/objects/a3/5aa65d86215fce909fc0bcce8949d12becba44 differ
diff --git a/tests/resources/merge-recursive/.gitted/objects/a3/ca4c462e93fee824c8ad500917ae34b800dea4 b/tests/resources/merge-recursive/.gitted/objects/a3/ca4c462e93fee824c8ad500917ae34b800dea4
new file mode 100644
index 0000000..dff9e97
Binary files /dev/null and b/tests/resources/merge-recursive/.gitted/objects/a3/ca4c462e93fee824c8ad500917ae34b800dea4 differ
diff --git a/tests/resources/merge-recursive/.gitted/objects/a6/64873b1c0b9a1ed300f8644dde536fdaa3a34f b/tests/resources/merge-recursive/.gitted/objects/a6/64873b1c0b9a1ed300f8644dde536fdaa3a34f
new file mode 100644
index 0000000..f6b66da
Binary files /dev/null and b/tests/resources/merge-recursive/.gitted/objects/a6/64873b1c0b9a1ed300f8644dde536fdaa3a34f differ
diff --git a/tests/resources/merge-recursive/.gitted/objects/a9/9bf55117ab1958171fccfeb19885f707bd08fd b/tests/resources/merge-recursive/.gitted/objects/a9/9bf55117ab1958171fccfeb19885f707bd08fd
new file mode 100644
index 0000000..9c3a3ec
Binary files /dev/null and b/tests/resources/merge-recursive/.gitted/objects/a9/9bf55117ab1958171fccfeb19885f707bd08fd differ
diff --git a/tests/resources/merge-recursive/.gitted/objects/b0/1de62cf11945685c98ec671edabdff3e90ddc5 b/tests/resources/merge-recursive/.gitted/objects/b0/1de62cf11945685c98ec671edabdff3e90ddc5
new file mode 100644
index 0000000..786c9a5
Binary files /dev/null and b/tests/resources/merge-recursive/.gitted/objects/b0/1de62cf11945685c98ec671edabdff3e90ddc5 differ
diff --git a/tests/resources/merge-recursive/.gitted/objects/b0/4823b75c8220b89c2f8da54709cda262304cd3 b/tests/resources/merge-recursive/.gitted/objects/b0/4823b75c8220b89c2f8da54709cda262304cd3
new file mode 100644
index 0000000..81714b0
Binary files /dev/null and b/tests/resources/merge-recursive/.gitted/objects/b0/4823b75c8220b89c2f8da54709cda262304cd3 differ
diff --git a/tests/resources/merge-recursive/.gitted/objects/b1/71224a4f604b6091072007765419b14c232c1d b/tests/resources/merge-recursive/.gitted/objects/b1/71224a4f604b6091072007765419b14c232c1d
new file mode 100644
index 0000000..987d5fe
Binary files /dev/null and b/tests/resources/merge-recursive/.gitted/objects/b1/71224a4f604b6091072007765419b14c232c1d differ
diff --git a/tests/resources/merge-recursive/.gitted/objects/b2/908343e3c16249d0036dd444fc0d4662cd8c0e b/tests/resources/merge-recursive/.gitted/objects/b2/908343e3c16249d0036dd444fc0d4662cd8c0e
new file mode 100644
index 0000000..7f0e0ab
Binary files /dev/null and b/tests/resources/merge-recursive/.gitted/objects/b2/908343e3c16249d0036dd444fc0d4662cd8c0e differ
diff --git a/tests/resources/merge-recursive/.gitted/objects/b6/bd0f9952f396e757d3f91e08c59a7e91707201 b/tests/resources/merge-recursive/.gitted/objects/b6/bd0f9952f396e757d3f91e08c59a7e91707201
new file mode 100644
index 0000000..87cb8fa
Binary files /dev/null and b/tests/resources/merge-recursive/.gitted/objects/b6/bd0f9952f396e757d3f91e08c59a7e91707201 differ
diff --git a/tests/resources/merge-recursive/.gitted/objects/b7/de2b52ba055688061355fad1599a5d214ce8f8 b/tests/resources/merge-recursive/.gitted/objects/b7/de2b52ba055688061355fad1599a5d214ce8f8
new file mode 100644
index 0000000..6fbf581
Binary files /dev/null and b/tests/resources/merge-recursive/.gitted/objects/b7/de2b52ba055688061355fad1599a5d214ce8f8 differ
diff --git a/tests/resources/merge-recursive/.gitted/objects/b8/a3b657edcf31e6365a2f1c45d45e6c9ebe8f02 b/tests/resources/merge-recursive/.gitted/objects/b8/a3b657edcf31e6365a2f1c45d45e6c9ebe8f02
new file mode 100644
index 0000000..0b8404b
Binary files /dev/null and b/tests/resources/merge-recursive/.gitted/objects/b8/a3b657edcf31e6365a2f1c45d45e6c9ebe8f02 differ
diff --git a/tests/resources/merge-recursive/.gitted/objects/ba/9dcfe079848e8e5c1b53bc3b6e47ff57f6e481 b/tests/resources/merge-recursive/.gitted/objects/ba/9dcfe079848e8e5c1b53bc3b6e47ff57f6e481
new file mode 100644
index 0000000..c43b79d
Binary files /dev/null and b/tests/resources/merge-recursive/.gitted/objects/ba/9dcfe079848e8e5c1b53bc3b6e47ff57f6e481 differ
diff --git a/tests/resources/merge-recursive/.gitted/objects/bb/4e0014fb09d24312f0af37c7a45e5488f19510 b/tests/resources/merge-recursive/.gitted/objects/bb/4e0014fb09d24312f0af37c7a45e5488f19510
new file mode 100644
index 0000000..ca45760
--- /dev/null
+++ b/tests/resources/merge-recursive/.gitted/objects/bb/4e0014fb09d24312f0af37c7a45e5488f19510
@@ -0,0 +1,4 @@
+xKj1)tVs}ղf2f'_WT-2
cSK v&8)`#
+*ssMI (J%5BUx
+!R
JbInMju~1OQd]t 1
+~h2OP#
\ No newline at end of file
diff --git a/tests/resources/merge-recursive/.gitted/objects/c0/dcb4bfcd86e65a822090aa7a0455413828886b b/tests/resources/merge-recursive/.gitted/objects/c0/dcb4bfcd86e65a822090aa7a0455413828886b
new file mode 100644
index 0000000..f8fe201
Binary files /dev/null and b/tests/resources/merge-recursive/.gitted/objects/c0/dcb4bfcd86e65a822090aa7a0455413828886b differ
diff --git a/tests/resources/merge-recursive/.gitted/objects/c4/44758b02d4af6e3145ac2fc0e3ed02199cf7ec b/tests/resources/merge-recursive/.gitted/objects/c4/44758b02d4af6e3145ac2fc0e3ed02199cf7ec
new file mode 100644
index 0000000..b2f6662
Binary files /dev/null and b/tests/resources/merge-recursive/.gitted/objects/c4/44758b02d4af6e3145ac2fc0e3ed02199cf7ec differ
diff --git a/tests/resources/merge-recursive/.gitted/objects/c7/f3257db72e885d6612080c003e0f2ef480e0c4 b/tests/resources/merge-recursive/.gitted/objects/c7/f3257db72e885d6612080c003e0f2ef480e0c4
new file mode 100644
index 0000000..255624e
Binary files /dev/null and b/tests/resources/merge-recursive/.gitted/objects/c7/f3257db72e885d6612080c003e0f2ef480e0c4 differ
diff --git a/tests/resources/merge-recursive/.gitted/objects/ce/0d744cd2e18eacf883d43471636f231c0995e3 b/tests/resources/merge-recursive/.gitted/objects/ce/0d744cd2e18eacf883d43471636f231c0995e3
new file mode 100644
index 0000000..63c457a
Binary files /dev/null and b/tests/resources/merge-recursive/.gitted/objects/ce/0d744cd2e18eacf883d43471636f231c0995e3 differ
diff --git a/tests/resources/merge-recursive/.gitted/objects/d0/97bcf99adb1022a6b7d2e94fed2031ebd9d89c b/tests/resources/merge-recursive/.gitted/objects/d0/97bcf99adb1022a6b7d2e94fed2031ebd9d89c
new file mode 100644
index 0000000..51ffec0
Binary files /dev/null and b/tests/resources/merge-recursive/.gitted/objects/d0/97bcf99adb1022a6b7d2e94fed2031ebd9d89c differ
diff --git a/tests/resources/merge-recursive/.gitted/objects/d0/c9bd6e2a3e327d81a32de51201d3bd58909f7c b/tests/resources/merge-recursive/.gitted/objects/d0/c9bd6e2a3e327d81a32de51201d3bd58909f7c
new file mode 100644
index 0000000..5a0508c
Binary files /dev/null and b/tests/resources/merge-recursive/.gitted/objects/d0/c9bd6e2a3e327d81a32de51201d3bd58909f7c differ
diff --git a/tests/resources/merge-recursive/.gitted/objects/d3/482dbdca5bb83aaf3e3768359855d55aef84d7 b/tests/resources/merge-recursive/.gitted/objects/d3/482dbdca5bb83aaf3e3768359855d55aef84d7
new file mode 100644
index 0000000..8442948
Binary files /dev/null and b/tests/resources/merge-recursive/.gitted/objects/d3/482dbdca5bb83aaf3e3768359855d55aef84d7 differ
diff --git a/tests/resources/merge-recursive/.gitted/objects/d5/015f9436b2d8c842bf6616e7cf5bc54eb79ced b/tests/resources/merge-recursive/.gitted/objects/d5/015f9436b2d8c842bf6616e7cf5bc54eb79ced
new file mode 100644
index 0000000..6d4446e
Binary files /dev/null and b/tests/resources/merge-recursive/.gitted/objects/d5/015f9436b2d8c842bf6616e7cf5bc54eb79ced differ
diff --git a/tests/resources/merge-recursive/.gitted/objects/db/51adf2b699eed93e883d6425f5e6c50165a9c2 b/tests/resources/merge-recursive/.gitted/objects/db/51adf2b699eed93e883d6425f5e6c50165a9c2
new file mode 100644
index 0000000..41b481e
Binary files /dev/null and b/tests/resources/merge-recursive/.gitted/objects/db/51adf2b699eed93e883d6425f5e6c50165a9c2 differ
diff --git a/tests/resources/merge-recursive/.gitted/objects/db/7e2af8ca83b8943adce7ba37d85f8fe7d7d2a9 b/tests/resources/merge-recursive/.gitted/objects/db/7e2af8ca83b8943adce7ba37d85f8fe7d7d2a9
new file mode 100644
index 0000000..0a0ad65
Binary files /dev/null and b/tests/resources/merge-recursive/.gitted/objects/db/7e2af8ca83b8943adce7ba37d85f8fe7d7d2a9 differ
diff --git a/tests/resources/merge-recursive/.gitted/objects/de/de92a05a0841faa8e4ad6700285cd208184458 b/tests/resources/merge-recursive/.gitted/objects/de/de92a05a0841faa8e4ad6700285cd208184458
new file mode 100644
index 0000000..c275071
Binary files /dev/null and b/tests/resources/merge-recursive/.gitted/objects/de/de92a05a0841faa8e4ad6700285cd208184458 differ
diff --git a/tests/resources/merge-recursive/.gitted/objects/e0/15ebd79a72a88b9291df11771caf56f463e8f9 b/tests/resources/merge-recursive/.gitted/objects/e0/15ebd79a72a88b9291df11771caf56f463e8f9
new file mode 100644
index 0000000..a75a6b6
Binary files /dev/null and b/tests/resources/merge-recursive/.gitted/objects/e0/15ebd79a72a88b9291df11771caf56f463e8f9 differ
diff --git a/tests/resources/merge-recursive/.gitted/objects/e5/20e6aaf8d1e68a433e29d4360c1e74aa4b24d1 b/tests/resources/merge-recursive/.gitted/objects/e5/20e6aaf8d1e68a433e29d4360c1e74aa4b24d1
new file mode 100644
index 0000000..bcf2dcf
Binary files /dev/null and b/tests/resources/merge-recursive/.gitted/objects/e5/20e6aaf8d1e68a433e29d4360c1e74aa4b24d1 differ
diff --git a/tests/resources/merge-recursive/.gitted/objects/e6/269ce9017816d67c7189a58b6d0d22bf4b8a1a b/tests/resources/merge-recursive/.gitted/objects/e6/269ce9017816d67c7189a58b6d0d22bf4b8a1a
new file mode 100644
index 0000000..f9a0a27
Binary files /dev/null and b/tests/resources/merge-recursive/.gitted/objects/e6/269ce9017816d67c7189a58b6d0d22bf4b8a1a differ
diff --git a/tests/resources/merge-recursive/.gitted/objects/e9/30c8c67848df4aa66319c5752fab6b8fdec765 b/tests/resources/merge-recursive/.gitted/objects/e9/30c8c67848df4aa66319c5752fab6b8fdec765
new file mode 100644
index 0000000..c0ba76d
Binary files /dev/null and b/tests/resources/merge-recursive/.gitted/objects/e9/30c8c67848df4aa66319c5752fab6b8fdec765 differ
diff --git a/tests/resources/merge-recursive/.gitted/objects/ea/3521485adfa0b0373deaaa06db9218a22edae8 b/tests/resources/merge-recursive/.gitted/objects/ea/3521485adfa0b0373deaaa06db9218a22edae8
new file mode 100644
index 0000000..40d8984
Binary files /dev/null and b/tests/resources/merge-recursive/.gitted/objects/ea/3521485adfa0b0373deaaa06db9218a22edae8 differ
diff --git a/tests/resources/merge-recursive/.gitted/objects/f0/856993e005c0d8ed2dc7cdc222cc1d89fb3c77 b/tests/resources/merge-recursive/.gitted/objects/f0/856993e005c0d8ed2dc7cdc222cc1d89fb3c77
new file mode 100644
index 0000000..22b1ad9
Binary files /dev/null and b/tests/resources/merge-recursive/.gitted/objects/f0/856993e005c0d8ed2dc7cdc222cc1d89fb3c77 differ
diff --git a/tests/resources/merge-recursive/.gitted/objects/f2/9ccca75754d8476e5dad8cf250e03d43fe9e6c b/tests/resources/merge-recursive/.gitted/objects/f2/9ccca75754d8476e5dad8cf250e03d43fe9e6c
new file mode 100644
index 0000000..b918729
Binary files /dev/null and b/tests/resources/merge-recursive/.gitted/objects/f2/9ccca75754d8476e5dad8cf250e03d43fe9e6c differ
diff --git a/tests/resources/merge-recursive/.gitted/objects/f3/2c284f537ff1a55d3cbfe9a37d431b6edfadc2 b/tests/resources/merge-recursive/.gitted/objects/f3/2c284f537ff1a55d3cbfe9a37d431b6edfadc2
new file mode 100644
index 0000000..be3cecc
Binary files /dev/null and b/tests/resources/merge-recursive/.gitted/objects/f3/2c284f537ff1a55d3cbfe9a37d431b6edfadc2 differ
diff --git a/tests/resources/merge-recursive/.gitted/objects/f4/c149e7d0983e90e9ee802ff57ae3c905ba63da b/tests/resources/merge-recursive/.gitted/objects/f4/c149e7d0983e90e9ee802ff57ae3c905ba63da
new file mode 100644
index 0000000..e9c675b
Binary files /dev/null and b/tests/resources/merge-recursive/.gitted/objects/f4/c149e7d0983e90e9ee802ff57ae3c905ba63da differ
diff --git a/tests/resources/merge-recursive/.gitted/objects/f6/5de1834f57708e76d8dc25502b7f1ecbcce162 b/tests/resources/merge-recursive/.gitted/objects/f6/5de1834f57708e76d8dc25502b7f1ecbcce162
new file mode 100644
index 0000000..3d238fd
Binary files /dev/null and b/tests/resources/merge-recursive/.gitted/objects/f6/5de1834f57708e76d8dc25502b7f1ecbcce162 differ
diff --git a/tests/resources/merge-recursive/.gitted/objects/f9/c04e4e9d4aaf1e6fe7478a7cc0756554974c2b b/tests/resources/merge-recursive/.gitted/objects/f9/c04e4e9d4aaf1e6fe7478a7cc0756554974c2b
new file mode 100644
index 0000000..bc44fa7
Binary files /dev/null and b/tests/resources/merge-recursive/.gitted/objects/f9/c04e4e9d4aaf1e6fe7478a7cc0756554974c2b differ
diff --git a/tests/resources/merge-recursive/.gitted/refs/heads/branchJ-1 b/tests/resources/merge-recursive/.gitted/refs/heads/branchJ-1
new file mode 100644
index 0000000..64612d4
--- /dev/null
+++ b/tests/resources/merge-recursive/.gitted/refs/heads/branchJ-1
@@ -0,0 +1 @@
+f65de1834f57708e76d8dc25502b7f1ecbcce162
diff --git a/tests/resources/merge-recursive/.gitted/refs/heads/branchJ-2 b/tests/resources/merge-recursive/.gitted/refs/heads/branchJ-2
new file mode 100644
index 0000000..bea6748
--- /dev/null
+++ b/tests/resources/merge-recursive/.gitted/refs/heads/branchJ-2
@@ -0,0 +1 @@
+b01de62cf11945685c98ec671edabdff3e90ddc5
diff --git a/tests/resources/merge-recursive/.gitted/refs/heads/branchK-1 b/tests/resources/merge-recursive/.gitted/refs/heads/branchK-1
new file mode 100644
index 0000000..309b388
--- /dev/null
+++ b/tests/resources/merge-recursive/.gitted/refs/heads/branchK-1
@@ -0,0 +1 @@
+182d0d250d1d7adcc60c178be5be98358b3a2fd1
diff --git a/tests/resources/merge-recursive/.gitted/refs/heads/branchK-2 b/tests/resources/merge-recursive/.gitted/refs/heads/branchK-2
new file mode 100644
index 0000000..f958f13
--- /dev/null
+++ b/tests/resources/merge-recursive/.gitted/refs/heads/branchK-2
@@ -0,0 +1 @@
+0ce202f64fa8356c1a32835fce4058ca76b0c7ed
diff --git a/tests/resources/rebase-submodule/.gitmodules b/tests/resources/rebase-submodule/.gitmodules
deleted file mode 100644
index f36de77..0000000
--- a/tests/resources/rebase-submodule/.gitmodules
+++ /dev/null
@@ -1,3 +0,0 @@
-[submodule "my-submodule"]
- path = my-submodule
- url = bogus
diff --git a/tests/resources/rebase-submodule/gitmodules b/tests/resources/rebase-submodule/gitmodules
new file mode 100644
index 0000000..f36de77
--- /dev/null
+++ b/tests/resources/rebase-submodule/gitmodules
@@ -0,0 +1,3 @@
+[submodule "my-submodule"]
+ path = my-submodule
+ url = bogus
diff --git a/tests/resources/rebase-submodule/my-submodule b/tests/resources/rebase-submodule/my-submodule
deleted file mode 160000
index efad0b1..0000000
--- a/tests/resources/rebase-submodule/my-submodule
+++ /dev/null
@@ -1 +0,0 @@
-Subproject commit efad0b11c47cb2f0220cbd6f5b0f93bb99064b00
diff --git a/tests/resources/renames/.gitted/objects/2c/136d294960f7d939f1ed1903f1ced78b874c87 b/tests/resources/renames/.gitted/objects/2c/136d294960f7d939f1ed1903f1ced78b874c87
new file mode 100644
index 0000000..51b7cea
Binary files /dev/null and b/tests/resources/renames/.gitted/objects/2c/136d294960f7d939f1ed1903f1ced78b874c87 differ
diff --git a/tests/resources/renames/.gitted/objects/84/d8efa38af7ace2b302de0adbda16b1f1cd2e1b b/tests/resources/renames/.gitted/objects/84/d8efa38af7ace2b302de0adbda16b1f1cd2e1b
new file mode 100644
index 0000000..56f98fe
--- /dev/null
+++ b/tests/resources/renames/.gitted/objects/84/d8efa38af7ace2b302de0adbda16b1f1cd2e1b
@@ -0,0 +1 @@
+xQj0SX+۲ !4'XiHeCߐtgr_fZRT%*!q.&40.Of? )g,Z0>8y$[жt5:l'<BWH6%
uJI
\ No newline at end of file
diff --git a/tests/resources/renames/.gitted/objects/89/7dda8ecb7fa2e092bc3f9e2a179d7c1b0364db b/tests/resources/renames/.gitted/objects/89/7dda8ecb7fa2e092bc3f9e2a179d7c1b0364db
new file mode 100644
index 0000000..d104e66
Binary files /dev/null and b/tests/resources/renames/.gitted/objects/89/7dda8ecb7fa2e092bc3f9e2a179d7c1b0364db differ
diff --git a/tests/resources/renames/.gitted/objects/95/ceb126bf79e76020d8879a8b0d50a73307a97f b/tests/resources/renames/.gitted/objects/95/ceb126bf79e76020d8879a8b0d50a73307a97f
new file mode 100644
index 0000000..0486ba5
Binary files /dev/null and b/tests/resources/renames/.gitted/objects/95/ceb126bf79e76020d8879a8b0d50a73307a97f differ
diff --git a/tests/resources/renames/.gitted/objects/be/053a189b0bbde545e0a3f59ce00b46ad29ce0d b/tests/resources/renames/.gitted/objects/be/053a189b0bbde545e0a3f59ce00b46ad29ce0d
new file mode 100644
index 0000000..de7aceb
Binary files /dev/null and b/tests/resources/renames/.gitted/objects/be/053a189b0bbde545e0a3f59ce00b46ad29ce0d differ
diff --git a/tests/resources/renames/.gitted/refs/heads/delete-and-rename b/tests/resources/renames/.gitted/refs/heads/delete-and-rename
new file mode 100644
index 0000000..f27fc21
--- /dev/null
+++ b/tests/resources/renames/.gitted/refs/heads/delete-and-rename
@@ -0,0 +1 @@
+be053a189b0bbde545e0a3f59ce00b46ad29ce0d
diff --git a/tests/resources/renames/.gitted/refs/heads/rewrite-and-delete b/tests/resources/renames/.gitted/refs/heads/rewrite-and-delete
new file mode 100644
index 0000000..0c0ecad
--- /dev/null
+++ b/tests/resources/renames/.gitted/refs/heads/rewrite-and-delete
@@ -0,0 +1 @@
+84d8efa38af7ace2b302de0adbda16b1f1cd2e1b
diff --git a/tests/status/ignore.c b/tests/status/ignore.c
index 23384fb..dc58e8b 100644
--- a/tests/status/ignore.c
+++ b/tests/status/ignore.c
@@ -1155,3 +1155,30 @@ void test_status_ignore__subdir_ignore_everything_except_certain_files(void)
refute_is_ignored("project/src/foo.c");
refute_is_ignored("project/src/foo/foo.c");
}
+
+void test_status_ignore__deeper(void)
+{
+ int ignored;
+
+ g_repo = cl_git_sandbox_init("empty_standard_repo");
+
+ cl_git_mkfile("empty_standard_repo/.gitignore",
+ "*.data\n"
+ "!dont_ignore/*.data\n");
+
+ cl_git_pass(p_mkdir("empty_standard_repo/dont_ignore", 0777));
+ cl_git_mkfile("empty_standard_repo/foo.data", "");
+ cl_git_mkfile("empty_standard_repo/bar.data", "");
+ cl_git_mkfile("empty_standard_repo/dont_ignore/foo.data", "");
+ cl_git_mkfile("empty_standard_repo/dont_ignore/bar.data", "");
+
+ cl_git_pass(git_ignore_path_is_ignored(&ignored, g_repo, "foo.data"));
+ cl_assert_equal_i(1, ignored);
+ cl_git_pass(git_ignore_path_is_ignored(&ignored, g_repo, "bar.data"));
+ cl_assert_equal_i(1, ignored);
+
+ cl_git_pass(git_ignore_path_is_ignored(&ignored, g_repo, "dont_ignore/foo.data"));
+ cl_assert_equal_i(0, ignored);
+ cl_git_pass(git_ignore_path_is_ignored(&ignored, g_repo, "dont_ignore/bar.data"));
+ cl_assert_equal_i(0, ignored);
+}