Merge pull request #1578 from nulltoken/fix/whitespaces Fix trailing whitespaces
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300
diff --git a/examples/rev-list.c b/examples/rev-list.c
index d9ec15f..1fb7ebf 100644
--- a/examples/rev-list.c
+++ b/examples/rev-list.c
@@ -117,4 +117,3 @@ int main (int argc, char **argv)
return 0;
}
-
diff --git a/include/git2/merge.h b/include/git2/merge.h
index 738d8e0..9558405 100644
--- a/include/git2/merge.h
+++ b/include/git2/merge.h
@@ -33,7 +33,7 @@ typedef enum {
/**
* Automerge options for `git_merge_trees_opts`.
- */
+ */
typedef enum {
GIT_MERGE_AUTOMERGE_NORMAL = 0,
GIT_MERGE_AUTOMERGE_NONE = 1,
@@ -45,10 +45,10 @@ typedef enum {
typedef struct {
unsigned int version;
git_merge_tree_flags flags;
-
+
/** Similarity to consider a file renamed (default 50) */
unsigned int rename_threshold;
-
+
/** Maximum similarity sources to examine (overrides the
* `merge.renameLimit` config) (default 200)
*/
@@ -56,7 +56,7 @@ typedef struct {
/** Pluggable similarity metric; pass NULL to use internal metric */
git_diff_similarity_metric *metric;
-
+
/** Flags for automerging content. */
git_merge_automerge_flags automerge_flags;
} git_merge_tree_opts;
diff --git a/include/git2/pack.h b/include/git2/pack.h
index 118b8d5..5e431e6 100644
--- a/include/git2/pack.h
+++ b/include/git2/pack.h
@@ -96,12 +96,12 @@ GIT_EXTERN(int) git_packbuilder_insert_tree(git_packbuilder *pb, const git_oid *
/**
* Insert a commit object
- *
+ *
* This will add a commit as well as the completed referenced tree.
- *
+ *
* @param pb The packbuilder
* @param id The oid of the commit
- *
+ *
* @return 0 or an error code
*/
GIT_EXTERN(int) git_packbuilder_insert_commit(git_packbuilder *pb, const git_oid *id);
diff --git a/include/git2/sys/index.h b/include/git2/sys/index.h
index f74637f..a32e070 100644
--- a/include/git2/sys/index.h
+++ b/include/git2/sys/index.h
@@ -177,4 +177,3 @@ GIT_EXTERN(void) git_index_reuc_clear(git_index *index);
/** @} */
GIT_END_DECL
#endif
-
diff --git a/include/git2/trace.h b/include/git2/trace.h
index 7409b03..f9b4d6f 100644
--- a/include/git2/trace.h
+++ b/include/git2/trace.h
@@ -32,7 +32,7 @@ typedef enum {
/** Errors that do not impact the program's execution */
GIT_TRACE_ERROR = 2,
-
+
/** Warnings that suggest abnormal data */
GIT_TRACE_WARN = 3,
@@ -65,4 +65,3 @@ GIT_EXTERN(int) git_trace_set(git_trace_level_t level, git_trace_callback cb);
/** @} */
GIT_END_DECL
#endif
-
diff --git a/src/checkout.c b/src/checkout.c
index 68028df..8f55757 100644
--- a/src/checkout.c
+++ b/src/checkout.c
@@ -771,7 +771,7 @@ static int blob_content_to_link(
if ((error = git_futils_mkpath2file(path, dir_mode)) < 0)
return error;
-
+
if ((error = git_blob__getbuf(&linktarget, blob)) < 0)
return error;
diff --git a/src/clone.c b/src/clone.c
index 499195d..7ebdb57 100644
--- a/src/clone.c
+++ b/src/clone.c
@@ -274,7 +274,7 @@ static int update_head_to_branch(
int retcode;
git_buf remote_branch_name = GIT_BUF_INIT;
git_reference* remote_ref = NULL;
-
+
assert(options->checkout_branch);
if ((retcode = git_buf_printf(&remote_branch_name, GIT_REFS_REMOTES_DIR "%s/%s",
diff --git a/src/diff_tform.c b/src/diff_tform.c
index 201a0e8..e885256 100644
--- a/src/diff_tform.c
+++ b/src/diff_tform.c
@@ -178,7 +178,7 @@ int git_diff_find_similar__hashsig_for_file(
GIT_UNUSED(f);
error = git_hashsig_create_fromfile((git_hashsig **)out, path, opt);
-
+
if (error == GIT_EBUFS) {
error = 0;
giterr_clear();
@@ -195,7 +195,7 @@ int git_diff_find_similar__hashsig_for_buf(
GIT_UNUSED(f);
error = git_hashsig_create((git_hashsig **)out, buf, len, opt);
-
+
if (error == GIT_EBUFS) {
error = 0;
giterr_clear();
@@ -437,7 +437,7 @@ static int similarity_measure(
return -1;
if (!cache[b_idx] && similarity_calc(diff, opts, b_idx, cache) < 0)
return -1;
-
+
/* some metrics may not wish to process this file (too big / too small) */
if (!cache[a_idx] || !cache[b_idx])
return 0;
diff --git a/src/hashsig.c b/src/hashsig.c
index 3a75aaa..ab8d8b3 100644
--- a/src/hashsig.c
+++ b/src/hashsig.c
@@ -365,4 +365,3 @@ int git_hashsig_compare(const git_hashsig *a, const git_hashsig *b)
return (hashsig_heap_compare(&a->mins, &b->mins) +
hashsig_heap_compare(&a->maxs, &b->maxs)) / 2;
}
-
diff --git a/src/index.c b/src/index.c
index 53edb48..4b3c2bb 100644
--- a/src/index.c
+++ b/src/index.c
@@ -381,7 +381,7 @@ void git_index_clear(git_index *index)
git_index_reuc_clear(index);
git_index_name_clear(index);
-
+
git_futils_filestamp_set(&index->stamp, NULL);
git_tree_cache_free(index->tree);
@@ -1108,7 +1108,7 @@ const git_index_name_entry *git_index_name_get_byindex(
git_index *index, size_t n)
{
assert(index);
-
+
git_vector_sort(&index->names);
return git_vector_get(&index->names, n);
}
@@ -1122,7 +1122,7 @@ int git_index_name_add(git_index *index,
conflict_name = git__calloc(1, sizeof(git_index_name_entry));
GITERR_CHECK_ALLOC(conflict_name);
-
+
if (ancestor) {
conflict_name->ancestor = git__strdup(ancestor);
GITERR_CHECK_ALLOC(conflict_name->ancestor);
@@ -1137,7 +1137,7 @@ int git_index_name_add(git_index *index,
conflict_name->theirs = git__strdup(theirs);
GITERR_CHECK_ALLOC(conflict_name->theirs);
}
-
+
return git_vector_insert(&index->names, conflict_name);
}
@@ -1147,7 +1147,7 @@ void git_index_name_clear(git_index *index)
git_index_name_entry *conflict_name;
assert(index);
-
+
git_vector_foreach(&index->names, i, conflict_name) {
if (conflict_name->ancestor)
git__free(conflict_name->ancestor);
@@ -1160,7 +1160,7 @@ void git_index_name_clear(git_index *index)
git__free(conflict_name);
}
-
+
git_vector_clear(&index->names);
}
@@ -1354,7 +1354,7 @@ static int read_reuc(git_index *index, const char *buffer, size_t size)
static int read_conflict_names(git_index *index, const char *buffer, size_t size)
{
size_t len;
-
+
/* This gets called multiple times, the vector might already be initialized */
if (index->names._alloc_size == 0 &&
git_vector_init(&index->names, 16, conflict_name_cmp) < 0)
@@ -1375,7 +1375,7 @@ static int read_conflict_names(git_index *index, const char *buffer, size_t size
\
buffer += len; \
size -= len;
-
+
while (size) {
git_index_name_entry *conflict_name = git__calloc(1, sizeof(git_index_name_entry));
GITERR_CHECK_ALLOC(conflict_name);
@@ -1383,17 +1383,17 @@ static int read_conflict_names(git_index *index, const char *buffer, size_t size
read_conflict_name(conflict_name->ancestor);
read_conflict_name(conflict_name->ours);
read_conflict_name(conflict_name->theirs);
-
+
if (git_vector_insert(&index->names, conflict_name) < 0)
return -1;
}
#undef read_conflict_name
-
+
/* entries are guaranteed to be sorted on-disk */
index->names.sorted = 1;
-
- return 0;
+
+ return 0;
}
static size_t read_entry(git_index_entry *dest, const void *buffer, size_t buffer_size)
@@ -1724,7 +1724,7 @@ static int create_name_extension_data(git_buf *name_buf, git_index_name_entry *c
error = git_buf_put(name_buf, "\0", 1);
else
error = git_buf_put(name_buf, conflict_name->ancestor, strlen(conflict_name->ancestor) + 1);
-
+
if (error != 0)
goto on_error;
@@ -1753,20 +1753,20 @@ static int write_name_extension(git_index *index, git_filebuf *file)
struct index_extension extension;
size_t i;
int error = 0;
-
+
git_vector_foreach(out, i, conflict_name) {
if ((error = create_name_extension_data(&name_buf, conflict_name)) < 0)
goto done;
}
-
+
memset(&extension, 0x0, sizeof(struct index_extension));
memcpy(&extension.signature, INDEX_EXT_CONFLICT_NAME_SIG, 4);
extension.extension_size = (uint32_t)name_buf.size;
-
+
error = write_extension(file, &extension, &name_buf);
-
+
git_buf_free(&name_buf);
-
+
done:
return error;
}
@@ -1844,7 +1844,7 @@ static int write_index(git_index *index, git_filebuf *file)
/* write the rename conflict extension */
if (index->names.length > 0 && write_name_extension(index, file) < 0)
return -1;
-
+
/* write the reuc extension */
if (index->reuc.length > 0 && write_reuc_extension(index, file) < 0)
return -1;
diff --git a/src/merge.c b/src/merge.c
index 117af81..de5d65a 100644
--- a/src/merge.c
+++ b/src/merge.c
@@ -370,14 +370,14 @@ static int merge_conflict_resolve_trivial(
if (conflict->type == GIT_MERGE_DIFF_DIRECTORY_FILE ||
conflict->type == GIT_MERGE_DIFF_RENAMED_ADDED)
return 0;
-
+
if (conflict->our_status == GIT_DELTA_RENAMED ||
conflict->their_status == GIT_DELTA_RENAMED)
return 0;
ours_empty = !GIT_MERGE_INDEX_ENTRY_EXISTS(conflict->our_entry);
theirs_empty = !GIT_MERGE_INDEX_ENTRY_EXISTS(conflict->their_entry);
-
+
ours_changed = (conflict->our_status != GIT_DELTA_UNMODIFIED);
theirs_changed = (conflict->their_status != GIT_DELTA_UNMODIFIED);
ours_theirs_differ = ours_changed && theirs_changed &&
@@ -433,7 +433,7 @@ static int merge_conflict_resolve_trivial(
*resolved = 1;
/* Note: trivial resolution does not update the REUC. */
-
+
return error;
}
@@ -486,9 +486,9 @@ static int merge_conflict_resolve_one_renamed(
int ours_changed, theirs_changed;
git_index_entry *merged;
int error = 0;
-
+
assert(resolved && diff_list && conflict);
-
+
*resolved = 0;
if (!GIT_MERGE_INDEX_ENTRY_EXISTS(conflict->our_entry) ||
@@ -497,7 +497,7 @@ static int merge_conflict_resolve_one_renamed(
ours_renamed = (conflict->our_status == GIT_DELTA_RENAMED);
theirs_renamed = (conflict->their_status == GIT_DELTA_RENAMED);
-
+
if (!ours_renamed && !theirs_renamed)
return 0;
@@ -509,7 +509,7 @@ static int merge_conflict_resolve_one_renamed(
ours_changed = (git_oid__cmp(&conflict->ancestor_entry.oid, &conflict->our_entry.oid) != 0);
theirs_changed = (git_oid__cmp(&conflict->ancestor_entry.oid, &conflict->their_entry.oid) != 0);
-
+
/* if both are modified (and not to a common target) require a merge */
if (ours_changed && theirs_changed &&
git_oid__cmp(&conflict->our_entry.oid, &conflict->their_entry.oid) != 0)
@@ -517,7 +517,7 @@ static int merge_conflict_resolve_one_renamed(
if ((merged = git_pool_malloc(&diff_list->pool, sizeof(git_index_entry))) == NULL)
return -1;
-
+
if (ours_changed)
memcpy(merged, &conflict->our_entry, sizeof(git_index_entry));
else
@@ -527,12 +527,12 @@ static int merge_conflict_resolve_one_renamed(
merged->path = conflict->our_entry.path;
else
merged->path = conflict->their_entry.path;
-
+
*resolved = 1;
-
+
git_vector_insert(&diff_list->staged, merged);
git_vector_insert(&diff_list->resolved, (git_merge_diff *)conflict);
-
+
return error;
}
@@ -550,11 +550,11 @@ static int merge_conflict_resolve_automerge(
git_odb *odb = NULL;
git_oid automerge_oid;
int error = 0;
-
+
assert(resolved && diff_list && conflict);
-
+
*resolved = 0;
-
+
if (automerge_flags == GIT_MERGE_AUTOMERGE_NONE)
return 0;
@@ -585,7 +585,7 @@ static int merge_conflict_resolve_automerge(
!result.automergeable ||
(error = git_odb_write(&automerge_oid, odb, result.data, result.len, GIT_OBJ_BLOB)) < 0)
goto done;
-
+
if ((index_entry = git_pool_malloc(&diff_list->pool, sizeof(git_index_entry))) == NULL)
GITERR_CHECK_ALLOC(index_entry);
@@ -595,7 +595,7 @@ static int merge_conflict_resolve_automerge(
index_entry->file_size = result.len;
index_entry->mode = result.mode;
git_oid_cpy(&index_entry->oid, &automerge_oid);
-
+
git_vector_insert(&diff_list->staged, index_entry);
git_vector_insert(&diff_list->resolved, (git_merge_diff *)conflict);
@@ -607,7 +607,7 @@ done:
git_merge_file_input_free(&theirs);
git_merge_file_result_free(&result);
git_odb_free(odb);
-
+
return error;
}
@@ -619,16 +619,16 @@ static int merge_conflict_resolve(
{
int resolved = 0;
int error = 0;
-
+
*out = 0;
-
+
if ((error = merge_conflict_resolve_trivial(&resolved, diff_list, conflict)) < 0)
goto done;
if (automerge_flags != GIT_MERGE_AUTOMERGE_NONE) {
if (!resolved && (error = merge_conflict_resolve_one_removed(&resolved, diff_list, conflict)) < 0)
goto done;
-
+
if (!resolved && (error = merge_conflict_resolve_one_renamed(&resolved, diff_list, conflict)) < 0)
goto done;
@@ -637,7 +637,7 @@ static int merge_conflict_resolve(
}
*out = resolved;
-
+
done:
return error;
}
@@ -666,7 +666,7 @@ static int index_entry_similarity_exact(
if (git_oid__cmp(&a->oid, &b->oid) == 0)
return 100;
-
+
return 0;
}
@@ -680,28 +680,28 @@ static int index_entry_similarity_calc(
git_diff_file diff_file = {{{0}}};
git_off_t blobsize;
int error;
-
+
*out = NULL;
if ((error = git_blob_lookup(&blob, repo, &entry->oid)) < 0)
return error;
-
+
git_oid_cpy(&diff_file.oid, &entry->oid);
diff_file.path = entry->path;
diff_file.size = entry->file_size;
diff_file.mode = entry->mode;
diff_file.flags = 0;
-
+
blobsize = git_blob_rawsize(blob);
/* file too big for rename processing */
if (!git__is_sizet(blobsize))
return 0;
-
+
error = opts->metric->buffer_signature(out, &diff_file,
git_blob_rawcontent(blob), (size_t)blobsize,
opts->metric->payload);
-
+
git_blob_free(blob);
return error;
@@ -718,16 +718,16 @@ static int index_entry_similarity_inexact(
{
int score = 0;
int error = 0;
-
+
if (GIT_MODE_TYPE(a->mode) != GIT_MODE_TYPE(b->mode))
return 0;
-
+
/* update signature cache if needed */
if (!cache[a_idx] && (error = index_entry_similarity_calc(&cache[a_idx], repo, a, opts)) < 0)
return error;
if (!cache[b_idx] && (error = index_entry_similarity_calc(&cache[b_idx], repo, b, opts)) < 0)
return error;
-
+
/* some metrics may not wish to process this file (too big / too small) */
if (!cache[a_idx] || !cache[b_idx])
return 0;
@@ -736,13 +736,13 @@ static int index_entry_similarity_inexact(
if (opts->metric->similarity(
&score, cache[a_idx], cache[b_idx], opts->metric->payload) < 0)
return -1;
-
+
/* clip score */
if (score < 0)
score = 0;
else if (score > 100)
score = 100;
-
+
return score;
}
@@ -758,7 +758,7 @@ static int merge_diff_mark_similarity(
size_t i, j;
git_merge_diff *conflict_src, *conflict_tgt;
int similarity;
-
+
git_vector_foreach(&diff_list->conflicts, i, conflict_src) {
/* Items can be the source of a rename iff they have an item in the
* ancestor slot and lack an item in the ours or theirs slot. */
@@ -766,63 +766,63 @@ static int merge_diff_mark_similarity(
(GIT_MERGE_INDEX_ENTRY_EXISTS(conflict_src->our_entry) &&
GIT_MERGE_INDEX_ENTRY_EXISTS(conflict_src->their_entry)))
continue;
-
+
git_vector_foreach(&diff_list->conflicts, j, conflict_tgt) {
size_t our_idx = diff_list->conflicts.length + j;
size_t their_idx = (diff_list->conflicts.length * 2) + j;
-
+
if (GIT_MERGE_INDEX_ENTRY_EXISTS(conflict_tgt->ancestor_entry))
continue;
-
+
if (GIT_MERGE_INDEX_ENTRY_EXISTS(conflict_tgt->our_entry) &&
!GIT_MERGE_INDEX_ENTRY_EXISTS(conflict_src->our_entry)) {
similarity = similarity_fn(repo, &conflict_src->ancestor_entry, i, &conflict_tgt->our_entry, our_idx, cache, opts);
-
+
if (similarity == GIT_EBUFS)
- continue;
+ continue;
else if (similarity < 0)
return similarity;
-
+
if (similarity > similarity_ours[i].similarity &&
similarity > similarity_ours[j].similarity) {
/* Clear previous best similarity */
if (similarity_ours[i].similarity > 0)
similarity_ours[similarity_ours[i].other_idx].similarity = 0;
-
+
if (similarity_ours[j].similarity > 0)
similarity_ours[similarity_ours[j].other_idx].similarity = 0;
-
+
similarity_ours[i].similarity = similarity;
similarity_ours[i].other_idx = j;
-
+
similarity_ours[j].similarity = similarity;
similarity_ours[j].other_idx = i;
}
}
-
+
if (GIT_MERGE_INDEX_ENTRY_EXISTS(conflict_tgt->their_entry) &&
!GIT_MERGE_INDEX_ENTRY_EXISTS(conflict_src->their_entry)) {
similarity = similarity_fn(repo, &conflict_src->ancestor_entry, i, &conflict_tgt->their_entry, their_idx, cache, opts);
-
+
if (similarity > similarity_theirs[i].similarity &&
similarity > similarity_theirs[j].similarity) {
/* Clear previous best similarity */
if (similarity_theirs[i].similarity > 0)
similarity_theirs[similarity_theirs[i].other_idx].similarity = 0;
-
+
if (similarity_theirs[j].similarity > 0)
similarity_theirs[similarity_theirs[j].other_idx].similarity = 0;
-
+
similarity_theirs[i].similarity = similarity;
similarity_theirs[i].other_idx = j;
-
+
similarity_theirs[j].similarity = similarity;
similarity_theirs[j].other_idx = i;
}
}
}
}
-
+
return 0;
}
@@ -857,13 +857,13 @@ static void merge_diff_mark_rename_conflict(
const git_merge_tree_opts *opts)
{
git_merge_diff *ours_source = NULL, *theirs_source = NULL;
-
+
if (ours_renamed)
ours_source = diff_list->conflicts.contents[ours_source_idx];
-
+
if (theirs_renamed)
theirs_source = diff_list->conflicts.contents[theirs_source_idx];
-
+
/* Detect 2->1 conflicts */
if (ours_renamed && theirs_renamed) {
/* Both renamed to the same target name. */
@@ -877,30 +877,30 @@ static void merge_diff_mark_rename_conflict(
/* If our source was also renamed in theirs, this is a 1->2 */
if (similarity_theirs[ours_source_idx].similarity >= opts->rename_threshold)
ours_source->type = GIT_MERGE_DIFF_BOTH_RENAMED_1_TO_2;
-
+
else if (GIT_MERGE_INDEX_ENTRY_EXISTS(target->their_entry)) {
ours_source->type = GIT_MERGE_DIFF_RENAMED_ADDED;
target->type = GIT_MERGE_DIFF_RENAMED_ADDED;
}
-
+
else if (!GIT_MERGE_INDEX_ENTRY_EXISTS(ours_source->their_entry))
ours_source->type = GIT_MERGE_DIFF_RENAMED_DELETED;
-
+
else if (ours_source->type == GIT_MERGE_DIFF_MODIFIED_DELETED)
ours_source->type = GIT_MERGE_DIFF_RENAMED_MODIFIED;
} else if (theirs_renamed) {
/* If their source was also renamed in ours, this is a 1->2 */
if (similarity_ours[theirs_source_idx].similarity >= opts->rename_threshold)
theirs_source->type = GIT_MERGE_DIFF_BOTH_RENAMED_1_TO_2;
-
+
else if (GIT_MERGE_INDEX_ENTRY_EXISTS(target->our_entry)) {
theirs_source->type = GIT_MERGE_DIFF_RENAMED_ADDED;
target->type = GIT_MERGE_DIFF_RENAMED_ADDED;
}
-
+
else if (!GIT_MERGE_INDEX_ENTRY_EXISTS(theirs_source->our_entry))
theirs_source->type = GIT_MERGE_DIFF_RENAMED_DELETED;
-
+
else if (theirs_source->type == GIT_MERGE_DIFF_MODIFIED_DELETED)
theirs_source->type = GIT_MERGE_DIFF_RENAMED_MODIFIED;
}
@@ -915,7 +915,7 @@ GIT_INLINE(void) merge_diff_coalesce_rename(
/* Coalesce the rename target into the rename source. */
memcpy(source_entry, target_entry, sizeof(git_index_entry));
*source_status = GIT_DELTA_RENAMED;
-
+
memset(target_entry, 0x0, sizeof(git_index_entry));
*target_status = GIT_DELTA_UNMODIFIED;
}
@@ -930,50 +930,50 @@ static void merge_diff_list_coalesce_renames(
bool ours_renamed = 0, theirs_renamed = 0;
size_t ours_source_idx = 0, theirs_source_idx = 0;
git_merge_diff *ours_source, *theirs_source, *target;
-
+
for (i = 0; i < diff_list->conflicts.length; i++) {
target = diff_list->conflicts.contents[i];
-
+
ours_renamed = 0;
theirs_renamed = 0;
-
+
if (GIT_MERGE_INDEX_ENTRY_EXISTS(target->our_entry) &&
similarity_ours[i].similarity >= opts->rename_threshold) {
ours_source_idx = similarity_ours[i].other_idx;
-
+
ours_source = diff_list->conflicts.contents[ours_source_idx];
-
+
merge_diff_coalesce_rename(
&ours_source->our_entry,
&ours_source->our_status,
&target->our_entry,
&target->our_status);
-
+
similarity_ours[ours_source_idx].similarity = 0;
similarity_ours[i].similarity = 0;
-
+
ours_renamed = 1;
}
-
+
/* insufficient to determine direction */
if (GIT_MERGE_INDEX_ENTRY_EXISTS(target->their_entry) &&
similarity_theirs[i].similarity >= opts->rename_threshold) {
theirs_source_idx = similarity_theirs[i].other_idx;
-
+
theirs_source = diff_list->conflicts.contents[theirs_source_idx];
-
+
merge_diff_coalesce_rename(
&theirs_source->their_entry,
&theirs_source->their_status,
&target->their_entry,
&target->their_status);
-
+
similarity_theirs[theirs_source_idx].similarity = 0;
similarity_theirs[i].similarity = 0;
-
+
theirs_renamed = 1;
}
-
+
merge_diff_mark_rename_conflict(diff_list,
similarity_ours, ours_renamed, ours_source_idx,
similarity_theirs, theirs_renamed, theirs_source_idx,
@@ -984,7 +984,7 @@ static void merge_diff_list_coalesce_renames(
static int merge_diff_empty(const git_vector *conflicts, size_t idx)
{
git_merge_diff *conflict = conflicts->contents[idx];
-
+
return (!GIT_MERGE_INDEX_ENTRY_EXISTS(conflict->ancestor_entry) &&
!GIT_MERGE_INDEX_ENTRY_EXISTS(conflict->our_entry) &&
!GIT_MERGE_INDEX_ENTRY_EXISTS(conflict->their_entry));
@@ -1000,7 +1000,7 @@ static void merge_diff_list_count_candidates(
*src_count = 0;
*tgt_count = 0;
-
+
git_vector_foreach(&diff_list->conflicts, i, entry) {
if (GIT_MERGE_INDEX_ENTRY_EXISTS(entry->ancestor_entry) &&
(!GIT_MERGE_INDEX_ENTRY_EXISTS(entry->our_entry) ||
@@ -1021,20 +1021,20 @@ int git_merge_diff_list__find_renames(
size_t cache_size = 0;
size_t src_count, tgt_count, i;
int error = 0;
-
+
assert(diff_list && opts);
-
+
if ((opts->flags & GIT_MERGE_TREE_FIND_RENAMES) == 0)
return 0;
-
+
similarity_ours = git__calloc(diff_list->conflicts.length,
sizeof(struct merge_diff_similarity));
GITERR_CHECK_ALLOC(similarity_ours);
-
+
similarity_theirs = git__calloc(diff_list->conflicts.length,
sizeof(struct merge_diff_similarity));
GITERR_CHECK_ALLOC(similarity_theirs);
-
+
/* Calculate similarity between items that were deleted from the ancestor
* and added in the other branch.
*/
@@ -1048,7 +1048,7 @@ int git_merge_diff_list__find_renames(
GITERR_CHECK_ALLOC(cache);
merge_diff_list_count_candidates(diff_list, &src_count, &tgt_count);
-
+
if (src_count > opts->target_limit || tgt_count > opts->target_limit) {
/* TODO: report! */
} else {
@@ -1063,7 +1063,7 @@ int git_merge_diff_list__find_renames(
* into the old name.
*/
merge_diff_list_coalesce_renames(diff_list, similarity_ours, similarity_theirs, opts);
-
+
/* And remove any entries that were merged and are now empty. */
git_vector_remove_matching(&diff_list->conflicts, merge_diff_empty);
@@ -1094,7 +1094,7 @@ GIT_INLINE(const char *) merge_diff_path(
return conflict->our_entry.path;
else if (GIT_MERGE_INDEX_ENTRY_EXISTS(conflict->their_entry))
return conflict->their_entry.path;
-
+
return NULL;
}
@@ -1106,7 +1106,7 @@ GIT_INLINE(bool) merge_diff_any_side_added_or_modified(
conflict->their_status == GIT_DELTA_ADDED ||
conflict->their_status == GIT_DELTA_MODIFIED)
return true;
-
+
return false;
}
@@ -1114,11 +1114,11 @@ GIT_INLINE(bool) path_is_prefixed(const char *parent, const char *child)
{
size_t child_len = strlen(child);
size_t parent_len = strlen(parent);
-
+
if (child_len < parent_len ||
strncmp(parent, child, parent_len) != 0)
return 0;
-
+
return (child[parent_len] == '/');
}
@@ -1127,7 +1127,7 @@ GIT_INLINE(int) merge_diff_detect_df_conflict(
git_merge_diff *conflict)
{
const char *cur_path = merge_diff_path(conflict);
-
+
/* Determine if this is a D/F conflict or the child of one */
if (df_data->df_path &&
path_is_prefixed(df_data->df_path, cur_path))
@@ -1139,14 +1139,14 @@ GIT_INLINE(int) merge_diff_detect_df_conflict(
merge_diff_any_side_added_or_modified(conflict) &&
path_is_prefixed(df_data->prev_path, cur_path)) {
conflict->type = GIT_MERGE_DIFF_DF_CHILD;
-
+
df_data->prev_conflict->type = GIT_MERGE_DIFF_DIRECTORY_FILE;
df_data->df_path = df_data->prev_path;
}
-
+
df_data->prev_path = cur_path;
df_data->prev_conflict = conflict;
-
+
return 0;
}
@@ -1172,7 +1172,7 @@ GIT_INLINE(int) merge_diff_detect_type(
conflict->type = GIT_MERGE_DIFF_MODIFIED_DELETED;
else
conflict->type = GIT_MERGE_DIFF_NONE;
-
+
return 0;
}
@@ -1183,11 +1183,11 @@ GIT_INLINE(int) index_entry_dup(
{
if (src != NULL) {
memcpy(out, src, sizeof(git_index_entry));
-
+
if ((out->path = git_pool_strdup(pool, src->path)) == NULL)
return -1;
}
-
+
return 0;
}
@@ -1208,7 +1208,7 @@ GIT_INLINE(int) merge_delta_type_from_index_entries(
else if (git_oid__cmp(&ancestor->oid, &other->oid) ||
ancestor->mode != other->mode)
return GIT_DELTA_MODIFIED;
-
+
return GIT_DELTA_UNMODIFIED;
}
@@ -1218,20 +1218,20 @@ static git_merge_diff *merge_diff_from_index_entries(
{
git_merge_diff *conflict;
git_pool *pool = &diff_list->pool;
-
+
if ((conflict = git_pool_malloc(pool, sizeof(git_merge_diff))) == NULL)
return NULL;
-
+
if (index_entry_dup(&conflict->ancestor_entry, pool, entries[TREE_IDX_ANCESTOR]) < 0 ||
index_entry_dup(&conflict->our_entry, pool, entries[TREE_IDX_OURS]) < 0 ||
index_entry_dup(&conflict->their_entry, pool, entries[TREE_IDX_THEIRS]) < 0)
return NULL;
-
+
conflict->our_status = merge_delta_type_from_index_entries(
entries[TREE_IDX_ANCESTOR], entries[TREE_IDX_OURS]);
conflict->their_status = merge_delta_type_from_index_entries(
entries[TREE_IDX_ANCESTOR], entries[TREE_IDX_THEIRS]);
-
+
return conflict;
}
@@ -1243,13 +1243,13 @@ static int merge_index_insert_conflict(
const git_index_entry *tree_items[3])
{
git_merge_diff *conflict;
-
+
if ((conflict = merge_diff_from_index_entries(diff_list, tree_items)) == NULL ||
merge_diff_detect_type(conflict) < 0 ||
merge_diff_detect_df_conflict(merge_df_data, conflict) < 0 ||
git_vector_insert(&diff_list->conflicts, conflict) < 0)
return -1;
-
+
return 0;
}
@@ -1259,13 +1259,13 @@ static int merge_index_insert_unmodified(
{
int error = 0;
git_index_entry *entry;
-
+
entry = git_pool_malloc(&diff_list->pool, sizeof(git_index_entry));
GITERR_CHECK_ALLOC(entry);
-
+
if ((error = index_entry_dup(entry, &diff_list->pool, tree_items[0])) >= 0)
error = git_vector_insert(&diff_list->staged, entry);
-
+
return error;
}
@@ -1282,40 +1282,40 @@ int git_merge_diff_list__find_differences(
int cur_item_modified;
size_t i, j;
int error = 0;
-
+
assert(diff_list && our_tree && their_tree);
if ((error = git_iterator_for_tree(&iterators[TREE_IDX_ANCESTOR], (git_tree *)ancestor_tree, GIT_ITERATOR_DONT_IGNORE_CASE, NULL, NULL)) < 0 ||
(error = git_iterator_for_tree(&iterators[TREE_IDX_OURS], (git_tree *)our_tree, GIT_ITERATOR_DONT_IGNORE_CASE, NULL, NULL)) < 0 ||
(error = git_iterator_for_tree(&iterators[TREE_IDX_THEIRS], (git_tree *)their_tree, GIT_ITERATOR_DONT_IGNORE_CASE, NULL, NULL)) < 0)
goto done;
-
+
/* Set up the iterators */
for (i = 0; i < 3; i++) {
if ((error = git_iterator_current(&items[i], iterators[i])) < 0)
goto done;
}
-
+
while (true) {
for (i = 0; i < 3; i++)
cur_items[i] = NULL;
best_cur_item = NULL;
cur_item_modified = 0;
-
+
/* Find the next path(s) to consume from each iterator */
for (i = 0; i < 3; i++) {
if (items[i] == NULL) {
cur_item_modified = 1;
continue;
}
-
+
if (best_cur_item == NULL) {
best_cur_item = items[i];
cur_items[i] = items[i];
} else {
int path_diff = entry_compare(items[i], best_cur_item);
-
+
if (path_diff < 0) {
/*
* Found an item that sorts before our current item, make
@@ -1332,21 +1332,21 @@ int git_merge_diff_list__find_differences(
cur_item_modified = 1;
} else if (path_diff == 0) {
cur_items[i] = items[i];
-
+
if (!cur_item_modified)
cur_item_modified = index_entry_cmp(best_cur_item, items[i]);
}
}
}
-
+
if (best_cur_item == NULL)
break;
-
+
if (cur_item_modified)
error = merge_index_insert_conflict(diff_list, &df_data, cur_items);
else
error = merge_index_insert_unmodified(diff_list, cur_items);
-
+
/* Advance each iterator that participated */
for (i = 0; i < 3; i++) {
if (cur_items[i] != NULL &&
@@ -1354,29 +1354,29 @@ int git_merge_diff_list__find_differences(
goto done;
}
}
-
+
done:
for (i = 0; i < 3; i++)
git_iterator_free(iterators[i]);
-
+
return error;
}
git_merge_diff_list *git_merge_diff_list__alloc(git_repository *repo)
{
git_merge_diff_list *diff_list = git__calloc(1, sizeof(git_merge_diff_list));
-
+
if (diff_list == NULL)
return NULL;
-
+
diff_list->repo = repo;
-
+
if (git_vector_init(&diff_list->staged, 0, NULL) < 0 ||
git_vector_init(&diff_list->conflicts, 0, NULL) < 0 ||
git_vector_init(&diff_list->resolved, 0, NULL) < 0 ||
git_pool_init(&diff_list->pool, 1, 0) < 0)
return NULL;
-
+
return diff_list;
}
@@ -1387,48 +1387,48 @@ static int merge_tree_normalize_opts(
{
git_config *cfg = NULL;
int error = 0;
-
+
assert(repo && opts);
-
+
if ((error = git_repository_config__weakptr(&cfg, repo)) < 0)
return error;
-
+
if (given != NULL)
memcpy(opts, given, sizeof(git_merge_tree_opts));
else {
git_merge_tree_opts init = GIT_MERGE_TREE_OPTS_INIT;
memcpy(opts, &init, sizeof(init));
-
+
opts->flags = GIT_MERGE_TREE_FIND_RENAMES;
opts->rename_threshold = GIT_MERGE_TREE_RENAME_THRESHOLD;
}
-
+
if (!opts->target_limit) {
int32_t limit = 0;
-
+
opts->target_limit = GIT_MERGE_TREE_TARGET_LIMIT;
-
+
if (git_config_get_int32(&limit, cfg, "merge.renameLimit") < 0) {
giterr_clear();
-
+
if (git_config_get_int32(&limit, cfg, "diff.renameLimit") < 0)
giterr_clear();
}
-
+
if (limit > 0)
opts->target_limit = limit;
}
-
+
/* assign the internal metric with whitespace flag as payload */
if (!opts->metric) {
opts->metric = git__malloc(sizeof(git_diff_similarity_metric));
GITERR_CHECK_ALLOC(opts->metric);
-
+
opts->metric->file_signature = git_diff_find_similar__hashsig_for_file;
opts->metric->buffer_signature = git_diff_find_similar__hashsig_for_buf;
opts->metric->free_signature = git_diff_find_similar__hashsig_free;
opts->metric->similarity = git_diff_find_similar__calc_similarity;
-
+
if (opts->flags & GIT_DIFF_FIND_IGNORE_WHITESPACE)
opts->metric->payload = (void *)GIT_HASHSIG_IGNORE_WHITESPACE;
else if (opts->flags & GIT_DIFF_FIND_DONT_IGNORE_WHITESPACE)
@@ -1436,7 +1436,7 @@ static int merge_tree_normalize_opts(
else
opts->metric->payload = (void *)GIT_HASHSIG_SMART_WHITESPACE;
}
-
+
return 0;
}
@@ -1450,20 +1450,20 @@ static int merge_index_insert_reuc(
int mode[3] = { 0, 0, 0 };
git_oid const *oid[3] = { NULL, NULL, NULL };
size_t i;
-
+
if (!GIT_MERGE_INDEX_ENTRY_EXISTS(*entry))
return 0;
-
+
if ((reuc = git_index_reuc_get_bypath(index, entry->path)) != NULL) {
for (i = 0; i < 3; i++) {
mode[i] = reuc->mode[i];
oid[i] = &reuc->oid[i];
}
}
-
+
mode[idx] = entry->mode;
oid[idx] = &entry->oid;
-
+
return git_index_reuc_add(index, entry->path,
mode[0], oid[0], mode[1], oid[1], mode[2], oid[2]);
}
@@ -1475,58 +1475,58 @@ int index_from_diff_list(git_index **out, git_merge_diff_list *diff_list)
git_index_entry *entry;
git_merge_diff *conflict;
int error = 0;
-
+
*out = NULL;
-
+
if ((error = git_index_new(&index)) < 0)
return error;
-
+
git_vector_foreach(&diff_list->staged, i, entry) {
if ((error = git_index_add(index, entry)) < 0)
goto on_error;
}
-
+
git_vector_foreach(&diff_list->conflicts, i, conflict) {
const git_index_entry *ancestor =
GIT_MERGE_INDEX_ENTRY_EXISTS(conflict->ancestor_entry) ?
&conflict->ancestor_entry : NULL;
-
+
const git_index_entry *ours =
GIT_MERGE_INDEX_ENTRY_EXISTS(conflict->our_entry) ?
&conflict->our_entry : NULL;
-
+
const git_index_entry *theirs =
GIT_MERGE_INDEX_ENTRY_EXISTS(conflict->their_entry) ?
&conflict->their_entry : NULL;
-
+
if ((error = git_index_conflict_add(index, ancestor, ours, theirs)) < 0)
goto on_error;
}
-
+
/* Add each rename entry to the rename portion of the index. */
git_vector_foreach(&diff_list->conflicts, i, conflict) {
const char *ancestor_path, *our_path, *their_path;
-
+
if (!GIT_MERGE_INDEX_ENTRY_EXISTS(conflict->ancestor_entry))
continue;
-
+
ancestor_path = conflict->ancestor_entry.path;
-
+
our_path =
GIT_MERGE_INDEX_ENTRY_EXISTS(conflict->our_entry) ?
conflict->our_entry.path : NULL;
-
+
their_path =
GIT_MERGE_INDEX_ENTRY_EXISTS(conflict->their_entry) ?
conflict->their_entry.path : NULL;
-
+
if ((our_path && strcmp(ancestor_path, our_path) != 0) ||
(their_path && strcmp(ancestor_path, their_path) != 0)) {
if ((error = git_index_name_add(index, ancestor_path, our_path, their_path)) < 0)
goto on_error;
}
}
-
+
/* Add each entry in the resolved conflict to the REUC independently, since
* the paths may differ due to renames. */
git_vector_foreach(&diff_list->resolved, i, conflict) {
@@ -1537,7 +1537,7 @@ int index_from_diff_list(git_index **out, git_merge_diff_list *diff_list)
const git_index_entry *ours =
GIT_MERGE_INDEX_ENTRY_EXISTS(conflict->our_entry) ?
&conflict->our_entry : NULL;
-
+
const git_index_entry *theirs =
GIT_MERGE_INDEX_ENTRY_EXISTS(conflict->their_entry) ?
&conflict->their_entry : NULL;
@@ -1545,22 +1545,22 @@ int index_from_diff_list(git_index **out, git_merge_diff_list *diff_list)
if (ancestor != NULL &&
(error = merge_index_insert_reuc(index, TREE_IDX_ANCESTOR, ancestor)) < 0)
goto on_error;
-
+
if (ours != NULL &&
(error = merge_index_insert_reuc(index, TREE_IDX_OURS, ours)) < 0)
goto on_error;
-
+
if (theirs != NULL &&
(error = merge_index_insert_reuc(index, TREE_IDX_THEIRS, theirs)) < 0)
goto on_error;
}
-
+
*out = index;
return 0;
-
+
on_error:
git_index_free(index);
-
+
return error;
}
@@ -1582,33 +1582,33 @@ int git_merge_trees(
assert(out && repo && our_tree && their_tree);
*out = NULL;
-
+
if ((error = merge_tree_normalize_opts(repo, &opts, given_opts)) < 0)
return error;
diff_list = git_merge_diff_list__alloc(repo);
GITERR_CHECK_ALLOC(diff_list);
-
+
if ((error = git_merge_diff_list__find_differences(diff_list, ancestor_tree, our_tree, their_tree)) < 0 ||
(error = git_merge_diff_list__find_renames(repo, diff_list, &opts)) < 0)
goto done;
-
+
memcpy(&changes, &diff_list->conflicts, sizeof(git_vector));
git_vector_clear(&diff_list->conflicts);
-
+
git_vector_foreach(&changes, i, conflict) {
int resolved = 0;
-
+
if ((error = merge_conflict_resolve(&resolved, diff_list, conflict, opts.automerge_flags)) < 0)
goto done;
-
+
if (!resolved)
git_vector_insert(&diff_list->conflicts, conflict);
}
-
+
if (!given_opts || !given_opts->metric)
git__free(opts.metric);
-
+
error = index_from_diff_list(out, diff_list);
done:
@@ -1621,11 +1621,10 @@ void git_merge_diff_list__free(git_merge_diff_list *diff_list)
{
if (!diff_list)
return;
-
+
git_vector_free(&diff_list->staged);
git_vector_free(&diff_list->conflicts);
git_vector_free(&diff_list->resolved);
git_pool_clear(&diff_list->pool);
git__free(diff_list);
}
-
diff --git a/src/merge.h b/src/merge.h
index da1fdf4..50538b1 100644
--- a/src/merge.h
+++ b/src/merge.h
@@ -24,46 +24,46 @@
typedef enum {
/* No conflict - a change only occurs in one branch. */
GIT_MERGE_DIFF_NONE = 0,
-
+
/* Occurs when a file is modified in both branches. */
GIT_MERGE_DIFF_BOTH_MODIFIED = (1 << 0),
-
+
/* Occurs when a file is added in both branches. */
GIT_MERGE_DIFF_BOTH_ADDED = (1 << 1),
-
+
/* Occurs when a file is deleted in both branches. */
GIT_MERGE_DIFF_BOTH_DELETED = (1 << 2),
-
+
/* Occurs when a file is modified in one branch and deleted in the other. */
GIT_MERGE_DIFF_MODIFIED_DELETED = (1 << 3),
-
+
/* Occurs when a file is renamed in one branch and modified in the other. */
GIT_MERGE_DIFF_RENAMED_MODIFIED = (1 << 4),
-
+
/* Occurs when a file is renamed in one branch and deleted in the other. */
GIT_MERGE_DIFF_RENAMED_DELETED = (1 << 5),
-
+
/* Occurs when a file is renamed in one branch and a file with the same
* name is added in the other. Eg, A->B and new file B. Core git calls
* this a "rename/delete". */
GIT_MERGE_DIFF_RENAMED_ADDED = (1 << 6),
-
+
/* Occurs when both a file is renamed to the same name in the ours and
* theirs branches. Eg, A->B and A->B in both. Automergeable. */
GIT_MERGE_DIFF_BOTH_RENAMED = (1 << 7),
-
+
/* Occurs when a file is renamed to different names in the ours and theirs
* branches. Eg, A->B and A->C. */
GIT_MERGE_DIFF_BOTH_RENAMED_1_TO_2 = (1 << 8),
-
+
/* Occurs when two files are renamed to the same name in the ours and
* theirs branches. Eg, A->C and B->C. */
GIT_MERGE_DIFF_BOTH_RENAMED_2_TO_1 = (1 << 9),
-
+
/* Occurs when an item at a path in one branch is a directory, and an
* item at the same path in a different branch is a file. */
GIT_MERGE_DIFF_DIRECTORY_FILE = (1 << 10),
-
+
/* The child of a folder that is in a directory/file conflict. */
GIT_MERGE_DIFF_DF_CHILD = (1 << 11),
} git_merge_diff_type_t;
@@ -72,20 +72,20 @@ typedef enum {
typedef struct {
git_repository *repo;
git_pool pool;
-
+
/* Vector of git_index_entry that represent the merged items that
* have been staged, either because only one side changed, or because
* the two changes were non-conflicting and mergeable. These items
* will be written as staged entries in the main index.
*/
git_vector staged;
-
+
/* Vector of git_merge_diff entries that represent the conflicts that
* have not been automerged. These items will be written to high-stage
* entries in the main index.
*/
git_vector conflicts;
-
+
/* Vector of git_merge_diff that have been automerged. These items
* will be written to the REUC when the index is produced.
*/
@@ -97,12 +97,12 @@ typedef struct {
*/
typedef struct {
git_merge_diff_type_t type;
-
+
git_index_entry ancestor_entry;
-
+
git_index_entry our_entry;
git_delta_t our_status;
-
+
git_index_entry their_entry;
git_delta_t their_status;
} git_merge_diff;
diff --git a/src/merge_file.c b/src/merge_file.c
index 4b3f373..c3477cc 100644
--- a/src/merge_file.c
+++ b/src/merge_file.c
@@ -28,12 +28,12 @@ GIT_INLINE(const char *) merge_file_best_path(
return NULL;
}
-
+
if (strcmp(ancestor->path, ours->path) == 0)
return theirs->path;
else if(strcmp(ancestor->path, theirs->path) == 0)
return ours->path;
-
+
return NULL;
}
@@ -51,15 +51,15 @@ GIT_INLINE(int) merge_file_best_mode(
if (ours->mode == GIT_FILEMODE_BLOB_EXECUTABLE ||
theirs->mode == GIT_FILEMODE_BLOB_EXECUTABLE)
return GIT_FILEMODE_BLOB_EXECUTABLE;
-
+
return GIT_FILEMODE_BLOB;
}
-
+
if (ancestor->mode == ours->mode)
return theirs->mode;
else if(ancestor->mode == theirs->mode)
return ours->mode;
-
+
return 0;
}
@@ -70,27 +70,27 @@ int git_merge_file_input_from_index_entry(
{
git_odb *odb = NULL;
int error = 0;
-
+
assert(input && repo && entry);
-
+
if (entry->mode == 0)
return 0;
-
+
if ((error = git_repository_odb(&odb, repo)) < 0 ||
(error = git_odb_read(&input->odb_object, odb, &entry->oid)) < 0)
goto done;
-
+
input->mode = entry->mode;
input->path = git__strdup(entry->path);
input->mmfile.size = git_odb_object_size(input->odb_object);
input->mmfile.ptr = (char *)git_odb_object_data(input->odb_object);
-
+
if (input->label == NULL)
input->label = entry->path;
-
+
done:
git_odb_free(odb);
-
+
return error;
}
@@ -101,27 +101,27 @@ int git_merge_file_input_from_diff_file(
{
git_odb *odb = NULL;
int error = 0;
-
+
assert(input && repo && file);
-
+
if (file->mode == 0)
return 0;
-
+
if ((error = git_repository_odb(&odb, repo)) < 0 ||
(error = git_odb_read(&input->odb_object, odb, &file->oid)) < 0)
goto done;
-
+
input->mode = file->mode;
input->path = git__strdup(file->path);
input->mmfile.size = git_odb_object_size(input->odb_object);
input->mmfile.ptr = (char *)git_odb_object_data(input->odb_object);
-
+
if (input->label == NULL)
input->label = file->path;
-
+
done:
git_odb_free(odb);
-
+
return error;
}
@@ -138,12 +138,12 @@ int git_merge_files(
int error = 0;
assert(out && ancestor && ours && theirs);
-
+
memset(out, 0x0, sizeof(git_merge_file_result));
if (!GIT_MERGE_FILE_SIDE_EXISTS(ours) || !GIT_MERGE_FILE_SIDE_EXISTS(theirs))
return 0;
-
+
memset(&xmparam, 0x0, sizeof(xmparam_t));
xmparam.ancestor = ancestor->label;
xmparam.file1 = ours->label;
@@ -154,7 +154,7 @@ int git_merge_files(
if (flags == GIT_MERGE_AUTOMERGE_FAVOR_OURS)
xmparam.favor = XDL_MERGE_FAVOR_OURS;
-
+
if (flags == GIT_MERGE_AUTOMERGE_FAVOR_THEIRS)
xmparam.favor = XDL_MERGE_FAVOR_THEIRS;
@@ -164,7 +164,7 @@ int git_merge_files(
error = -1;
goto done;
}
-
+
out->automergeable = (xdl_result == 0);
out->data = (unsigned char *)mmbuffer.ptr;
out->len = mmbuffer.size;
@@ -172,4 +172,3 @@ int git_merge_files(
done:
return error;
}
-
diff --git a/src/merge_file.h b/src/merge_file.h
index 1aa3489..0af2f0a 100644
--- a/src/merge_file.h
+++ b/src/merge_file.h
@@ -16,7 +16,7 @@ typedef struct {
char *path;
unsigned int mode;
mmfile_t mmfile;
-
+
git_odb_object *odb_object;
} git_merge_file_input;
@@ -24,10 +24,10 @@ typedef struct {
typedef struct {
bool automergeable;
-
+
const char *path;
int mode;
-
+
unsigned char *data;
size_t len;
} git_merge_file_result;
diff --git a/src/pathspec.c b/src/pathspec.c
index d4eb125..35c79ce 100644
--- a/src/pathspec.c
+++ b/src/pathspec.c
@@ -141,7 +141,7 @@ bool git_pathspec_match_path(
git_vector_foreach(vspec, i, match) {
int result = (match->flags & GIT_ATTR_FNMATCH_MATCH_ALL) ? 0 : FNM_NOMATCH;
-
+
if (result == FNM_NOMATCH)
result = use_strcmp(match->pattern, path) ? FNM_NOMATCH : 0;
diff --git a/src/refdb_fs.c b/src/refdb_fs.c
index b9df83f..f964c41 100644
--- a/src/refdb_fs.c
+++ b/src/refdb_fs.c
@@ -217,7 +217,7 @@ static int packed_load(refdb_fs_backend *backend)
backend->peeling_mode = PEELING_NONE;
if (buffer_start[0] == '#') {
- static const char *traits_header = "# pack-refs with: ";
+ static const char *traits_header = "# pack-refs with: ";
if (git__prefixcmp(buffer_start, traits_header) == 0) {
char *traits = (char *)buffer_start + strlen(traits_header);
@@ -1060,7 +1060,7 @@ static void refdb_fs_backend__free(git_refdb_backend *_backend)
static int setup_namespace(git_buf *path, git_repository *repo)
{
- char *parts, *start, *end;
+ char *parts, *start, *end;
/* Not all repositories have a path */
if (repo->path_repository == NULL)
@@ -1091,7 +1091,7 @@ static int setup_namespace(git_buf *path, git_repository *repo)
free(parts);
/* Make sure that the folder with the namespace exists */
- if (git_futils_mkdir_r(git_buf_cstr(path), repo->path_repository, 0777) < 0)
+ if (git_futils_mkdir_r(git_buf_cstr(path), repo->path_repository, 0777) < 0)
return -1;
/* Return the root of the namespaced path, i.e. without the trailing '/refs' */
diff --git a/src/reset.c b/src/reset.c
index c1e1f86..cea212a 100644
--- a/src/reset.c
+++ b/src/reset.c
@@ -32,7 +32,7 @@ int git_reset_default(
int error;
git_index *index = NULL;
- assert(pathspecs != NULL && pathspecs->count > 0);
+ assert(pathspecs != NULL && pathspecs->count > 0);
memset(&entry, 0, sizeof(git_index_entry));
diff --git a/src/revparse.c b/src/revparse.c
index 05231e3..97fc91b 100644
--- a/src/revparse.c
+++ b/src/revparse.c
@@ -855,4 +855,3 @@ int git_revparse(
return error;
}
-
diff --git a/src/signature.c b/src/signature.c
index 48bdd81..1131fb7 100644
--- a/src/signature.c
+++ b/src/signature.c
@@ -173,7 +173,7 @@ int git_signature__parse(git_signature *sig, const char **buffer_out,
tz_start = time_end + 1;
- if ((tz_start[0] != '-' && tz_start[0] != '+') ||
+ if ((tz_start[0] != '-' && tz_start[0] != '+') ||
git__strtol32(&offset, tz_start + 1, &tz_end, 10) < 0)
return signature_error("malformed timezone");
diff --git a/src/trace.c b/src/trace.c
index 159ac91..ee5039f 100644
--- a/src/trace.c
+++ b/src/trace.c
@@ -25,7 +25,7 @@ int git_trace_set(git_trace_level_t level, git_trace_callback callback)
git_trace__data.level = level;
git_trace__data.callback = callback;
GIT_MEMORY_BARRIER;
-
+
return 0;
#else
GIT_UNUSED(level);
@@ -36,4 +36,3 @@ int git_trace_set(git_trace_level_t level, git_trace_callback callback)
return -1;
#endif
}
-
diff --git a/src/trace.h b/src/trace.h
index f4bdff8..77b1e03 100644
--- a/src/trace.h
+++ b/src/trace.h
@@ -25,14 +25,14 @@ GIT_INLINE(void) git_trace__write_fmt(
git_trace_level_t level,
const char *fmt, ...)
{
- git_trace_callback callback = git_trace__data.callback;
+ git_trace_callback callback = git_trace__data.callback;
git_buf message = GIT_BUF_INIT;
va_list ap;
-
+
va_start(ap, fmt);
git_buf_vprintf(&message, fmt, ap);
va_end(ap);
-
+
callback(level, git_buf_cstr(&message));
git_buf_free(&message);
diff --git a/src/transports/local.c b/src/transports/local.c
index 2530a84..4bf1c87 100644
--- a/src/transports/local.c
+++ b/src/transports/local.c
@@ -348,7 +348,7 @@ static int local_push(
if ((error = git_repository_open(&remote_repo, push->remote->url)) < 0)
return error;
- /* We don't currently support pushing locally to non-bare repos. Proper
+ /* We don't currently support pushing locally to non-bare repos. Proper
non-bare repo push support would require checking configs to see if
we should override the default 'don't let this happen' behavior */
if (!remote_repo->is_bare) {
diff --git a/src/win32/findfile.c b/src/win32/findfile.c
index bc36b6b..5dd3de1 100644
--- a/src/win32/findfile.c
+++ b/src/win32/findfile.c
@@ -235,4 +235,3 @@ int git_win32__find_xdg_dirs(git_buf *out)
return win32_find_existing_dirs(out, global_tmpls, temp);
}
-
diff --git a/src/win32/posix_w32.c b/src/win32/posix_w32.c
index b911583..f9967e0 100644
--- a/src/win32/posix_w32.c
+++ b/src/win32/posix_w32.c
@@ -535,7 +535,7 @@ int p_gettimeofday(struct timeval *tv, struct timezone *tz)
/*converting file time to unix epoch*/
tmpres /= 10; /*convert into microseconds*/
- tmpres -= DELTA_EPOCH_IN_MICROSECS;
+ tmpres -= DELTA_EPOCH_IN_MICROSECS;
tv->tv_sec = (long)(tmpres / 1000000UL);
tv->tv_usec = (long)(tmpres % 1000000UL);
}
diff --git a/tests-clar/checkout/tree.c b/tests-clar/checkout/tree.c
index 67357a9..462a46c 100644
--- a/tests-clar/checkout/tree.c
+++ b/tests-clar/checkout/tree.c
@@ -363,7 +363,7 @@ void assert_conflict(
git_index *index;
git_object *hack_tree;
git_reference *branch, *head;
- git_buf file_path = GIT_BUF_INIT;
+ git_buf file_path = GIT_BUF_INIT;
cl_git_pass(git_repository_index(&index, g_repo));
diff --git a/tests-clar/clone/empty.c b/tests-clar/clone/empty.c
index f190523..f92fa6c 100644
--- a/tests-clar/clone/empty.c
+++ b/tests-clar/clone/empty.c
@@ -48,13 +48,13 @@ void test_clone_empty__can_clone_an_empty_local_repo_barely(void)
cl_assert_equal_i(GIT_ENOTFOUND, git_reference_lookup(&ref, g_repo_cloned, local_name));
/* ...one can still retrieve the name of the remote tracking reference */
- cl_assert_equal_i((int)strlen(expected_tracked_branch_name) + 1,
+ cl_assert_equal_i((int)strlen(expected_tracked_branch_name) + 1,
git_branch_upstream_name(buffer, 1024, g_repo_cloned, local_name));
cl_assert_equal_s(expected_tracked_branch_name, buffer);
/* ...and the name of the remote... */
- cl_assert_equal_i((int)strlen(expected_remote_name) + 1,
+ cl_assert_equal_i((int)strlen(expected_remote_name) + 1,
git_branch_remote_name(buffer, 1024, g_repo_cloned, expected_tracked_branch_name));
cl_assert_equal_s(expected_remote_name, buffer);
diff --git a/tests-clar/commit/write.c b/tests-clar/commit/write.c
index e9946af..73436b7 100644
--- a/tests-clar/commit/write.c
+++ b/tests-clar/commit/write.c
@@ -115,7 +115,7 @@ void test_commit_write__root(void)
head_old = git__strdup(git_reference_symbolic_target(head));
cl_assert(head_old != NULL);
git_reference_free(head);
-
+
cl_git_pass(git_reference_symbolic_create(&head, g_repo, "HEAD", branch_name, 1));
cl_git_pass(git_commit_create_v(
diff --git a/tests-clar/index/names.c b/tests-clar/index/names.c
index 6861553..95a560e 100644
--- a/tests-clar/index/names.c
+++ b/tests-clar/index/names.c
@@ -21,7 +21,7 @@ void test_index_names__cleanup(void)
{
git_index_free(repo_index);
repo_index = NULL;
-
+
cl_git_sandbox_cleanup();
}
@@ -32,14 +32,14 @@ void test_index_names__add(void)
cl_git_pass(git_index_name_add(repo_index, "ancestor", "ours", "theirs"));
cl_git_pass(git_index_name_add(repo_index, "ancestor2", "ours2", NULL));
cl_git_pass(git_index_name_add(repo_index, "ancestor3", NULL, "theirs3"));
-
+
cl_assert(git_index_name_entrycount(repo_index) == 3);
-
+
conflict_name = git_index_name_get_byindex(repo_index, 0);
cl_assert(strcmp(conflict_name->ancestor, "ancestor") == 0);
cl_assert(strcmp(conflict_name->ours, "ours") == 0);
cl_assert(strcmp(conflict_name->theirs, "theirs") == 0);
-
+
conflict_name = git_index_name_get_byindex(repo_index, 1);
cl_assert(strcmp(conflict_name->ancestor, "ancestor2") == 0);
cl_assert(strcmp(conflict_name->ours, "ours2") == 0);
@@ -54,31 +54,31 @@ void test_index_names__add(void)
void test_index_names__roundtrip(void)
{
const git_index_name_entry *conflict_name;
-
+
cl_git_pass(git_index_name_add(repo_index, "ancestor", "ours", "theirs"));
cl_git_pass(git_index_name_add(repo_index, "ancestor2", "ours2", NULL));
cl_git_pass(git_index_name_add(repo_index, "ancestor3", NULL, "theirs3"));
-
+
cl_git_pass(git_index_write(repo_index));
git_index_clear(repo_index);
cl_assert(git_index_name_entrycount(repo_index) == 0);
-
+
cl_git_pass(git_index_read(repo_index));
cl_assert(git_index_name_entrycount(repo_index) == 3);
-
+
conflict_name = git_index_name_get_byindex(repo_index, 0);
cl_assert(strcmp(conflict_name->ancestor, "ancestor") == 0);
cl_assert(strcmp(conflict_name->ours, "ours") == 0);
cl_assert(strcmp(conflict_name->theirs, "theirs") == 0);
-
+
conflict_name = git_index_name_get_byindex(repo_index, 1);
cl_assert(strcmp(conflict_name->ancestor, "ancestor2") == 0);
cl_assert(strcmp(conflict_name->ours, "ours2") == 0);
cl_assert(conflict_name->theirs == NULL);
-
+
conflict_name = git_index_name_get_byindex(repo_index, 2);
cl_assert(strcmp(conflict_name->ancestor, "ancestor3") == 0);
cl_assert(conflict_name->ours == NULL);
cl_assert(strcmp(conflict_name->theirs, "theirs3") == 0);
-
+
}
diff --git a/tests-clar/index/reuc.c b/tests-clar/index/reuc.c
index 0e38a92..69ed4a9 100644
--- a/tests-clar/index/reuc.c
+++ b/tests-clar/index/reuc.c
@@ -232,7 +232,7 @@ void test_index_reuc__remove(void)
cl_git_pass(git_index_reuc_remove(repo_index, 0));
cl_git_fail(git_index_reuc_remove(repo_index, 1));
-
+
cl_assert_equal_i(1, git_index_reuc_entrycount(repo_index));
cl_assert(reuc = git_index_reuc_get_byindex(repo_index, 0));
@@ -283,7 +283,7 @@ void test_index_reuc__write(void)
/* ensure sort order was round-tripped correct */
cl_assert(reuc = git_index_reuc_get_byindex(repo_index, 0));
cl_assert_equal_s("one.txt", reuc->path);
-
+
cl_assert(reuc = git_index_reuc_get_byindex(repo_index, 1));
cl_assert_equal_s("two.txt", reuc->path);
}
@@ -296,41 +296,41 @@ static int reuc_entry_exists(void)
void test_index_reuc__cleaned_on_reset_hard(void)
{
git_object *target;
-
+
retrieve_target_from_oid(&target, repo, "3a34580a35add43a4cf361e8e9a30060a905c876");
-
+
test_index_reuc__add();
cl_git_pass(git_reset(repo, target, GIT_RESET_HARD));
cl_assert(reuc_entry_exists() == false);
-
+
git_object_free(target);
}
void test_index_reuc__cleaned_on_reset_mixed(void)
{
git_object *target;
-
+
retrieve_target_from_oid(&target, repo, "3a34580a35add43a4cf361e8e9a30060a905c876");
- test_index_reuc__add();
+ test_index_reuc__add();
cl_git_pass(git_reset(repo, target, GIT_RESET_MIXED));
cl_assert(reuc_entry_exists() == false);
-
+
git_object_free(target);
}
void test_index_reuc__retained_on_reset_soft(void)
{
git_object *target;
-
+
retrieve_target_from_oid(&target, repo, "3a34580a35add43a4cf361e8e9a30060a905c876");
-
+
git_reset(repo, target, GIT_RESET_HARD);
test_index_reuc__add();
cl_git_pass(git_reset(repo, target, GIT_RESET_SOFT));
cl_assert(reuc_entry_exists() == true);
-
+
git_object_free(target);
}
@@ -339,7 +339,7 @@ void test_index_reuc__cleaned_on_checkout_tree(void)
git_oid oid;
git_object *obj;
git_checkout_opts opts = GIT_CHECKOUT_OPTS_INIT;
-
+
opts.checkout_strategy = GIT_CHECKOUT_SAFE | GIT_CHECKOUT_UPDATE_ONLY;
test_index_reuc__add();
@@ -347,16 +347,16 @@ void test_index_reuc__cleaned_on_checkout_tree(void)
git_object_lookup(&obj, repo, &oid, GIT_OBJ_ANY);
git_checkout_tree(repo, obj, &opts);
cl_assert(reuc_entry_exists() == false);
-
+
git_object_free(obj);
}
void test_index_reuc__cleaned_on_checkout_head(void)
{
git_checkout_opts opts = GIT_CHECKOUT_OPTS_INIT;
-
+
opts.checkout_strategy = GIT_CHECKOUT_SAFE | GIT_CHECKOUT_UPDATE_ONLY;
-
+
test_index_reuc__add();
git_checkout_head(repo, &opts);
cl_assert(reuc_entry_exists() == false);
@@ -365,9 +365,9 @@ void test_index_reuc__cleaned_on_checkout_head(void)
void test_index_reuc__retained_on_checkout_index(void)
{
git_checkout_opts opts = GIT_CHECKOUT_OPTS_INIT;
-
+
opts.checkout_strategy = GIT_CHECKOUT_SAFE | GIT_CHECKOUT_UPDATE_ONLY;
-
+
test_index_reuc__add();
git_checkout_index(repo, repo_index, &opts);
cl_assert(reuc_entry_exists() == true);
diff --git a/tests-clar/merge/merge_helpers.c b/tests-clar/merge/merge_helpers.c
index 71bb967..bc31b1f 100644
--- a/tests-clar/merge/merge_helpers.c
+++ b/tests-clar/merge/merge_helpers.c
@@ -56,11 +56,11 @@ void merge__dump_index_entries(git_vector *index_entries)
{
size_t i;
const git_index_entry *index_entry;
-
+
printf ("\nINDEX [%d]:\n", (int)index_entries->length);
for (i = 0; i < index_entries->length; i++) {
index_entry = index_entries->contents[i];
-
+
printf("%o ", index_entry->mode);
printf("%s ", git_oid_allocfmt(&index_entry->oid));
printf("%d ", git_index_entry_stage(index_entry));
@@ -77,7 +77,7 @@ void merge__dump_names(git_index *index)
for (i = 0; i < git_index_name_entrycount(index); i++) {
conflict_name = git_index_name_get_byindex(index, i);
-
+
printf("%s %s %s\n", conflict_name->ancestor, conflict_name->ours, conflict_name->theirs);
}
printf("\n");
@@ -91,7 +91,7 @@ void merge__dump_reuc(git_index *index)
printf ("\nREUC:\n");
for (i = 0; i < git_index_reuc_entrycount(index); i++) {
reuc = git_index_reuc_get_byindex(index, i);
-
+
printf("%s ", reuc->path);
printf("%o ", reuc->mode[0]);
printf("%s\n", git_oid_allocfmt(&reuc->oid[0]));
@@ -114,18 +114,18 @@ static int index_entry_eq_merge_index_entry(const struct merge_index_entry *expe
test_oid = 1;
} else
test_oid = 0;
-
+
if (actual->mode != expected->mode ||
(test_oid && git_oid_cmp(&actual->oid, &expected_oid) != 0) ||
git_index_entry_stage(actual) != expected->stage)
return 0;
-
+
if (actual->mode == 0 && (actual->path != NULL || strlen(expected->path) > 0))
return 0;
if (actual->mode != 0 && (strcmp(actual->path, expected->path) != 0))
return 0;
-
+
return 1;
}
@@ -133,7 +133,7 @@ static int name_entry_eq(const char *expected, const char *actual)
{
if (strlen(expected) == 0)
return (actual == NULL) ? 1 : 0;
-
+
return (strcmp(expected, actual) == 0) ? 1 : 0;
}
@@ -153,11 +153,11 @@ static int index_conflict_data_eq_merge_diff(const struct merge_index_conflict_d
!index_entry_eq_merge_index_entry(&expected->ours.entry, &actual->our_entry) ||
!index_entry_eq_merge_index_entry(&expected->theirs.entry, &actual->their_entry))
return 0;
-
+
if (expected->ours.status != actual->our_status ||
expected->theirs.status != actual->their_status)
return 0;
-
+
return 1;
}
@@ -165,48 +165,48 @@ int merge_test_merge_conflicts(git_vector *conflicts, const struct merge_index_c
{
git_merge_diff *actual;
size_t i;
-
+
if (conflicts->length != expected_len)
return 0;
for (i = 0; i < expected_len; i++) {
actual = conflicts->contents[i];
-
+
if (!index_conflict_data_eq_merge_diff(&expected[i], actual))
return 0;
}
- return 1;
+ return 1;
}
int merge_test_index(git_index *index, const struct merge_index_entry expected[], size_t expected_len)
{
- size_t i;
- const git_index_entry *index_entry;
-
+ size_t i;
+ const git_index_entry *index_entry;
+
/*
dump_index_entries(&index->entries);
*/
- if (git_index_entrycount(index) != expected_len)
- return 0;
-
- for (i = 0; i < expected_len; i++) {
- if ((index_entry = git_index_get_byindex(index, i)) == NULL)
- return 0;
-
+ if (git_index_entrycount(index) != expected_len)
+ return 0;
+
+ for (i = 0; i < expected_len; i++) {
+ if ((index_entry = git_index_get_byindex(index, i)) == NULL)
+ return 0;
+
if (!index_entry_eq_merge_index_entry(&expected[i], index_entry))
return 0;
- }
-
- return 1;
+ }
+
+ return 1;
}
int merge_test_names(git_index *index, const struct merge_name_entry expected[], size_t expected_len)
{
size_t i;
const git_index_name_entry *name_entry;
-
+
/*
dump_names(index);
*/
@@ -221,26 +221,26 @@ int merge_test_names(git_index *index, const struct merge_name_entry expected[],
if (! name_entry_eq_merge_name_entry(&expected[i], name_entry))
return 0;
}
-
+
return 1;
}
int merge_test_reuc(git_index *index, const struct merge_reuc_entry expected[], size_t expected_len)
{
- size_t i;
+ size_t i;
const git_index_reuc_entry *reuc_entry;
- git_oid expected_oid;
-
+ git_oid expected_oid;
+
/*
dump_reuc(index);
*/
-
- if (git_index_reuc_entrycount(index) != expected_len)
- return 0;
-
- for (i = 0; i < expected_len; i++) {
- if ((reuc_entry = git_index_reuc_get_byindex(index, i)) == NULL)
- return 0;
+
+ if (git_index_reuc_entrycount(index) != expected_len)
+ return 0;
+
+ for (i = 0; i < expected_len; i++) {
+ if ((reuc_entry = git_index_reuc_get_byindex(index, i)) == NULL)
+ return 0;
if (strcmp(reuc_entry->path, expected[i].path) != 0 ||
reuc_entry->mode[0] != expected[i].ancestor_mode ||
@@ -268,19 +268,19 @@ int merge_test_reuc(git_index *index, const struct merge_reuc_entry expected[],
if (git_oid_cmp(&reuc_entry->oid[2], &expected_oid) != 0)
return 0;
}
- }
-
- return 1;
+ }
+
+ return 1;
}
int dircount(void *payload, git_buf *pathbuf)
{
int *entries = payload;
size_t len = git_buf_len(pathbuf);
-
+
if (len < 5 || strcmp(pathbuf->ptr + (git_buf_len(pathbuf) - 5), "/.git") != 0)
(*entries)++;
-
+
return 0;
}
@@ -289,22 +289,22 @@ int merge_test_workdir(git_repository *repo, const struct merge_index_entry expe
size_t actual_len = 0, i;
git_oid actual_oid, expected_oid;
git_buf wd = GIT_BUF_INIT;
-
- git_buf_puts(&wd, repo->workdir);
+
+ git_buf_puts(&wd, repo->workdir);
git_path_direach(&wd, dircount, &actual_len);
-
+
if (actual_len != expected_len)
return 0;
-
+
for (i = 0; i < expected_len; i++) {
git_blob_create_fromworkdir(&actual_oid, repo, expected[i].path);
git_oid_fromstr(&expected_oid, expected[i].oid_str);
-
+
if (git_oid_cmp(&actual_oid, &expected_oid) != 0)
return 0;
}
-
+
git_buf_free(&wd);
-
+
return 1;
}
diff --git a/tests-clar/merge/trees/automerge.c b/tests-clar/merge/trees/automerge.c
index 7592a92..04a7bef 100644
--- a/tests-clar/merge/trees/automerge.c
+++ b/tests-clar/merge/trees/automerge.c
@@ -93,7 +93,7 @@ void test_merge_trees_automerge__automerge(void)
const git_index_entry *entry;
git_merge_tree_opts opts = GIT_MERGE_TREE_OPTS_INIT;
git_blob *blob;
-
+
struct merge_index_entry merge_index_entries[] = {
ADDED_IN_MASTER_INDEX_ENTRY,
AUTOMERGEABLE_INDEX_ENTRY,
@@ -105,7 +105,7 @@ void test_merge_trees_automerge__automerge(void)
{ 0100644, "2bd0a343aeef7a2cf0d158478966a6e587ff3863", 3, "conflicting.txt" },
UNCHANGED_INDEX_ENTRY,
- };
+ };
struct merge_reuc_entry merge_reuc_entries[] = {
AUTOMERGEABLE_REUC_ENTRY,
@@ -120,10 +120,10 @@ void test_merge_trees_automerge__automerge(void)
cl_assert((entry = git_index_get_bypath(index, "automergeable.txt", 0)) != NULL);
cl_assert(entry->file_size == strlen(AUTOMERGEABLE_MERGED_FILE));
-
+
cl_git_pass(git_object_lookup((git_object **)&blob, repo, &entry->oid, GIT_OBJ_BLOB));
cl_assert(memcmp(git_blob_rawcontent(blob), AUTOMERGEABLE_MERGED_FILE, entry->file_size) == 0);
-
+
git_index_free(index);
git_blob_free(blob);
}
@@ -132,7 +132,7 @@ void test_merge_trees_automerge__favor_ours(void)
{
git_index *index;
git_merge_tree_opts opts = GIT_MERGE_TREE_OPTS_INIT;
-
+
struct merge_index_entry merge_index_entries[] = {
ADDED_IN_MASTER_INDEX_ENTRY,
AUTOMERGEABLE_INDEX_ENTRY,
@@ -148,9 +148,9 @@ void test_merge_trees_automerge__favor_ours(void)
REMOVED_IN_BRANCH_REUC_ENTRY,
REMOVED_IN_MASTER_REUC_ENTRY,
};
-
+
opts.automerge_flags = GIT_MERGE_AUTOMERGE_FAVOR_OURS;
-
+
cl_git_pass(merge_trees_from_branches(&index, repo, "master", THEIRS_AUTOMERGE_BRANCH, &opts));
cl_assert(merge_test_index(index, merge_index_entries, 6));
@@ -163,7 +163,7 @@ void test_merge_trees_automerge__favor_theirs(void)
{
git_index *index;
git_merge_tree_opts opts = GIT_MERGE_TREE_OPTS_INIT;
-
+
struct merge_index_entry merge_index_entries[] = {
ADDED_IN_MASTER_INDEX_ENTRY,
AUTOMERGEABLE_INDEX_ENTRY,
@@ -181,12 +181,12 @@ void test_merge_trees_automerge__favor_theirs(void)
};
opts.automerge_flags = GIT_MERGE_AUTOMERGE_FAVOR_THEIRS;
-
+
cl_git_pass(merge_trees_from_branches(&index, repo, "master", THEIRS_AUTOMERGE_BRANCH, &opts));
cl_assert(merge_test_index(index, merge_index_entries, 6));
cl_assert(merge_test_reuc(index, merge_reuc_entries, 4));
-
+
git_index_free(index);
}
@@ -194,7 +194,7 @@ void test_merge_trees_automerge__unrelated(void)
{
git_index *index;
git_merge_tree_opts opts = GIT_MERGE_TREE_OPTS_INIT;
-
+
struct merge_index_entry merge_index_entries[] = {
{ 0100644, "233c0919c998ed110a4b6ff36f353aec8b713487", 0, "added-in-master.txt" },
{ 0100644, "ee3fa1b8c00aff7fe02065fdb50864bb0d932ccf", 2, "automergeable.txt" },
@@ -208,10 +208,10 @@ void test_merge_trees_automerge__unrelated(void)
{ 0100644, "dfe3f22baa1f6fce5447901c3086bae368de6bdd", 0, "removed-in-branch.txt" },
{ 0100644, "c8f06f2e3bb2964174677e91f0abead0e43c9e5d", 0, "unchanged.txt" },
};
-
+
cl_git_pass(merge_trees_from_branches(&index, repo, "master", THEIRS_UNRELATED_BRANCH, &opts));
-
+
cl_assert(merge_test_index(index, merge_index_entries, 11));
-
+
git_index_free(index);
}
diff --git a/tests-clar/merge/trees/modeconflict.c b/tests-clar/merge/trees/modeconflict.c
index 0661ce5..d858b8f 100644
--- a/tests-clar/merge/trees/modeconflict.c
+++ b/tests-clar/merge/trees/modeconflict.c
@@ -27,7 +27,7 @@ void test_merge_trees_modeconflict__cleanup(void)
void test_merge_trees_modeconflict__df_conflict(void)
{
git_index *index;
-
+
struct merge_index_entry merge_index_entries[] = {
{ 0100644, "49130a28ef567af9a6a6104c38773fedfa5f9742", 2, "dir-10" },
{ 0100644, "6c06dcd163587c2cc18be44857e0b71116382aeb", 3, "dir-10" },
@@ -49,7 +49,7 @@ void test_merge_trees_modeconflict__df_conflict(void)
{ 0100644, "e49f917b448d1340b31d76e54ba388268fd4c922", 0, "file-4/new" },
{ 0100644, "cab2cf23998b40f1af2d9d9a756dc9e285a8df4b", 2, "file-5/new" },
{ 0100644, "f5504f36e6f4eb797a56fc5bac6c6c7f32969bf2", 3, "file-5/new" },
- };
+ };
cl_git_pass(merge_trees_from_branches(&index, repo, DF_SIDE1_BRANCH, DF_SIDE2_BRANCH, NULL));
diff --git a/tests-clar/merge/trees/renames.c b/tests-clar/merge/trees/renames.c
index dc0564b..427b6bd 100644
--- a/tests-clar/merge/trees/renames.c
+++ b/tests-clar/merge/trees/renames.c
@@ -72,14 +72,14 @@ void test_merge_trees_renames__index(void)
{ 0100644, "b42712cfe99a1a500b2a51fe984e0b8a7702ba11", 2, "7-both-renamed.txt" },
{ 0100644, "b69fe837e4cecfd4c9a40cdca7c138468687df07", 3, "7-both-renamed.txt" },
};
-
+
struct merge_name_entry merge_name_entries[] = {
{
"3a-renamed-in-ours-deleted-in-theirs.txt",
"3a-newname-in-ours-deleted-in-theirs.txt",
""
},
-
+
{
"3b-renamed-in-theirs-deleted-in-ours.txt",
"",
@@ -97,7 +97,7 @@ void test_merge_trees_renames__index(void)
"",
"4b-newname-in-theirs-added-in-ours.txt",
},
-
+
{
"5a-renamed-in-ours-added-in-theirs.txt",
"5a-newname-in-ours-added-in-theirs.txt",
@@ -115,13 +115,13 @@ void test_merge_trees_renames__index(void)
"6-both-renamed-1-to-2-ours.txt",
"6-both-renamed-1-to-2-theirs.txt",
},
-
+
{
"7-both-renamed-side-1.txt",
"7-both-renamed.txt",
"7-both-renamed-side-1.txt",
},
-
+
{
"7-both-renamed-side-2.txt",
"7-both-renamed-side-2.txt",
@@ -159,7 +159,7 @@ void test_merge_trees_renames__index(void)
"",
"",
"241a1005cd9b980732741b74385b891142bcba28" },
-
+
{ "1b-newname-in-theirs.txt",
0, 0, 0100644,
"",
@@ -194,11 +194,11 @@ void test_merge_trees_renames__index(void)
cl_git_pass(merge_trees_from_branches(&index, repo,
BRANCH_RENAME_OURS, BRANCH_RENAME_THEIRS,
opts));
-
+
cl_assert(merge_test_index(index, merge_index_entries, 41));
cl_assert(merge_test_names(index, merge_name_entries, 9));
cl_assert(merge_test_reuc(index, merge_reuc_entries, 10));
-
+
git_index_free(index);
}
@@ -206,7 +206,7 @@ void test_merge_trees_renames__no_rename_index(void)
{
git_index *index;
git_merge_tree_opts opts = GIT_MERGE_TREE_OPTS_INIT;
-
+
struct merge_index_entry merge_index_entries[] = {
{ 0100644, "68c6c84b091926c7d90aa6a79b2bc3bb6adccd8e", 0, "0a-no-change.txt" },
{ 0100644, "f0ce2b8e4986084d9b308fb72709e414c23eb5e6", 0, "0b-duplicated-in-ours.txt" },
@@ -241,13 +241,12 @@ void test_merge_trees_renames__no_rename_index(void)
{ 0100644, "b42712cfe99a1a500b2a51fe984e0b8a7702ba11", 2, "7-both-renamed.txt" },
{ 0100644, "b69fe837e4cecfd4c9a40cdca7c138468687df07", 3, "7-both-renamed.txt" },
};
-
+
cl_git_pass(merge_trees_from_branches(&index, repo,
BRANCH_RENAME_OURS, BRANCH_RENAME_THEIRS,
&opts));
-
+
cl_assert(merge_test_index(index, merge_index_entries, 32));
-
+
git_index_free(index);
}
-
diff --git a/tests-clar/merge/trees/treediff.c b/tests-clar/merge/trees/treediff.c
index 06ea94e..357859d 100644
--- a/tests-clar/merge/trees/treediff.c
+++ b/tests-clar/merge/trees/treediff.c
@@ -58,37 +58,37 @@ static void test_find_differences(
opts.metric->similarity = git_diff_find_similar__calc_similarity;
opts.metric->payload = (void *)GIT_HASHSIG_SMART_WHITESPACE;
- cl_git_pass(git_oid_fromstr(&ancestor_oid, ancestor_oidstr));
- cl_git_pass(git_oid_fromstr(&ours_oid, ours_oidstr));
- cl_git_pass(git_oid_fromstr(&theirs_oid, theirs_oidstr));
-
- cl_git_pass(git_tree_lookup(&ancestor_tree, repo, &ancestor_oid));
- cl_git_pass(git_tree_lookup(&ours_tree, repo, &ours_oid));
- cl_git_pass(git_tree_lookup(&theirs_tree, repo, &theirs_oid));
-
+ cl_git_pass(git_oid_fromstr(&ancestor_oid, ancestor_oidstr));
+ cl_git_pass(git_oid_fromstr(&ours_oid, ours_oidstr));
+ cl_git_pass(git_oid_fromstr(&theirs_oid, theirs_oidstr));
+
+ cl_git_pass(git_tree_lookup(&ancestor_tree, repo, &ancestor_oid));
+ cl_git_pass(git_tree_lookup(&ours_tree, repo, &ours_oid));
+ cl_git_pass(git_tree_lookup(&theirs_tree, repo, &theirs_oid));
+
cl_git_pass(git_merge_diff_list__find_differences(merge_diff_list, ancestor_tree, ours_tree, theirs_tree));
cl_git_pass(git_merge_diff_list__find_renames(repo, merge_diff_list, &opts));
/*
dump_merge_index(merge_index);
*/
-
- cl_assert(treediff_conflict_data_len == merge_diff_list->conflicts.length);
+
+ cl_assert(treediff_conflict_data_len == merge_diff_list->conflicts.length);
cl_assert(merge_test_merge_conflicts(&merge_diff_list->conflicts, treediff_conflict_data, treediff_conflict_data_len));
- git_tree_free(ancestor_tree);
- git_tree_free(ours_tree);
- git_tree_free(theirs_tree);
-
+ git_tree_free(ancestor_tree);
+ git_tree_free(ours_tree);
+ git_tree_free(theirs_tree);
+
git_merge_diff_list__free(merge_diff_list);
-
+
git__free(opts.metric);
}
void test_merge_trees_treediff__simple(void)
{
- struct merge_index_conflict_data treediff_conflict_data[] = {
+ struct merge_index_conflict_data treediff_conflict_data[] = {
{
{ { 0, "", 0, "" }, GIT_DELTA_UNMODIFIED },
{ { 0100644, "233c0919c998ed110a4b6ff36f353aec8b713487", 0, "added-in-master.txt" }, GIT_DELTA_ADDED },
@@ -96,41 +96,41 @@ void test_merge_trees_treediff__simple(void)
GIT_MERGE_DIFF_NONE
},
- {
+ {
{ { 0100644, "6212c31dab5e482247d7977e4f0dd3601decf13b", 0, "automergeable.txt" }, GIT_DELTA_UNMODIFIED },
{ { 0100644, "ee3fa1b8c00aff7fe02065fdb50864bb0d932ccf", 0, "automergeable.txt" }, GIT_DELTA_MODIFIED },
{ { 0100644, "058541fc37114bfc1dddf6bd6bffc7fae5c2e6fe", 0, "automergeable.txt" }, GIT_DELTA_MODIFIED },
GIT_MERGE_DIFF_BOTH_MODIFIED
},
-
+
{
{ { 0100644, "ab6c44a2e84492ad4b41bb6bac87353e9d02ac8b", 0, "changed-in-branch.txt" }, GIT_DELTA_UNMODIFIED },
{ { 0100644, "ab6c44a2e84492ad4b41bb6bac87353e9d02ac8b", 0, "changed-in-branch.txt" }, GIT_DELTA_UNMODIFIED },
{ { 0100644, "4eb04c9e79e88f6640d01ff5b25ca2a60764f216", 0, "changed-in-branch.txt" }, GIT_DELTA_MODIFIED },
GIT_MERGE_DIFF_NONE
},
-
+
{
{ { 0100644, "ab6c44a2e84492ad4b41bb6bac87353e9d02ac8b", 0, "changed-in-master.txt" }, GIT_DELTA_UNMODIFIED },
{ { 0100644, "11deab00b2d3a6f5a3073988ac050c2d7b6655e2", 0, "changed-in-master.txt" }, GIT_DELTA_MODIFIED },
{ { 0100644, "ab6c44a2e84492ad4b41bb6bac87353e9d02ac8b", 0, "changed-in-master.txt" }, GIT_DELTA_UNMODIFIED },
GIT_MERGE_DIFF_NONE
},
-
+
{
{ { 0100644, "d427e0b2e138501a3d15cc376077a3631e15bd46", 0, "conflicting.txt" }, GIT_DELTA_UNMODIFIED },
{ { 0100644, "4e886e602529caa9ab11d71f86634bd1b6e0de10", 0, "conflicting.txt" }, GIT_DELTA_MODIFIED },
{ { 0100644, "2bd0a343aeef7a2cf0d158478966a6e587ff3863", 0, "conflicting.txt" }, GIT_DELTA_MODIFIED },
GIT_MERGE_DIFF_BOTH_MODIFIED
},
-
+
{
{ { 0100644, "dfe3f22baa1f6fce5447901c3086bae368de6bdd", 0, "removed-in-branch.txt" }, GIT_DELTA_UNMODIFIED },
{ { 0100644, "dfe3f22baa1f6fce5447901c3086bae368de6bdd", 0, "removed-in-branch.txt" }, GIT_DELTA_UNMODIFIED },
{ { 0, "", 0, "" }, GIT_DELTA_DELETED },
GIT_MERGE_DIFF_NONE
},
-
+
{
{ { 0100644, "5c3b68a71fc4fa5d362fd3875e53137c6a5ab7a5", 0, "removed-in-master.txt" }, GIT_DELTA_UNMODIFIED },
{ { 0, "", 0, "" }, GIT_DELTA_DELETED },
@@ -138,13 +138,13 @@ void test_merge_trees_treediff__simple(void)
GIT_MERGE_DIFF_NONE
},
};
-
+
test_find_differences(TREE_OID_ANCESTOR, TREE_OID_MASTER, TREE_OID_BRANCH, treediff_conflict_data, 7);
}
void test_merge_trees_treediff__df_conflicts(void)
{
- struct merge_index_conflict_data treediff_conflict_data[] = {
+ struct merge_index_conflict_data treediff_conflict_data[] = {
{
{ { 0, "", 0, "" }, GIT_DELTA_UNMODIFIED },
{ { 0100644, "49130a28ef567af9a6a6104c38773fedfa5f9742", 0, "dir-10" }, GIT_DELTA_ADDED },
@@ -158,7 +158,7 @@ void test_merge_trees_treediff__df_conflicts(void)
{ { 0, "", 0, "" }, GIT_DELTA_DELETED },
GIT_MERGE_DIFF_BOTH_DELETED,
},
-
+
{
{ { 0, "", 0, "" }, GIT_DELTA_UNMODIFIED },
{ { 0, "", 0, "" }, GIT_DELTA_UNMODIFIED },
@@ -172,7 +172,7 @@ void test_merge_trees_treediff__df_conflicts(void)
{ { 0, "", 0, "" }, GIT_DELTA_DELETED },
GIT_MERGE_DIFF_NONE,
},
-
+
{
{ { 0, "", 0, "" }, GIT_DELTA_UNMODIFIED },
{ { 0, "", 0, "" }, GIT_DELTA_UNMODIFIED },
@@ -186,7 +186,7 @@ void test_merge_trees_treediff__df_conflicts(void)
{ { 0, "", 0, "" }, GIT_DELTA_DELETED },
GIT_MERGE_DIFF_DF_CHILD,
},
-
+
{
{ { 0, "", 0, "" }, GIT_DELTA_UNMODIFIED },
{ { 0100644, "e9ad6ec3e38364a3d07feda7c4197d4d845c53b5", 0, "dir-8" }, GIT_DELTA_ADDED },
@@ -200,7 +200,7 @@ void test_merge_trees_treediff__df_conflicts(void)
{ { 0100644, "f20c9063fa0bda9a397c96947a7b687305c49753", 0, "dir-8/file.txt" }, GIT_DELTA_UNMODIFIED },
GIT_MERGE_DIFF_NONE,
},
-
+
{
{ { 0, "", 0, "" }, GIT_DELTA_UNMODIFIED },
{ { 0100644, "3ef4d30382ca33fdeba9fda895a99e0891ba37aa", 0, "dir-9" }, GIT_DELTA_ADDED },
@@ -235,7 +235,7 @@ void test_merge_trees_treediff__df_conflicts(void)
{ { 0, "", 0, "" }, GIT_DELTA_DELETED },
GIT_MERGE_DIFF_DIRECTORY_FILE,
},
-
+
{
{ { 0, "", 0, "" }, GIT_DELTA_UNMODIFIED },
{ { 0, "", 0, "" }, GIT_DELTA_UNMODIFIED },
@@ -277,7 +277,7 @@ void test_merge_trees_treediff__df_conflicts(void)
{ { 0, "", 0, "" }, GIT_DELTA_DELETED },
GIT_MERGE_DIFF_BOTH_DELETED,
},
-
+
{
{ { 0, "", 0, "" }, GIT_DELTA_UNMODIFIED },
{ { 0100644, "cab2cf23998b40f1af2d9d9a756dc9e285a8df4b", 0, "file-5/new" }, GIT_DELTA_ADDED },
@@ -285,7 +285,7 @@ void test_merge_trees_treediff__df_conflicts(void)
GIT_MERGE_DIFF_BOTH_ADDED,
},
};
-
+
test_find_differences(TREE_OID_DF_ANCESTOR, TREE_OID_DF_SIDE1, TREE_OID_DF_SIDE2, treediff_conflict_data, 20);
}
@@ -298,7 +298,7 @@ void test_merge_trees_treediff__strict_renames(void)
{ { 0, "", 0, "" }, GIT_DELTA_UNMODIFIED },
GIT_MERGE_DIFF_NONE,
},
-
+
{
{ { 0100644, "6212c31dab5e482247d7977e4f0dd3601decf13b", 0, "automergeable.txt" }, GIT_DELTA_UNMODIFIED },
{ { 0100644, "ee3fa1b8c00aff7fe02065fdb50864bb0d932ccf", 0, "automergeable.txt" }, GIT_DELTA_MODIFIED },
@@ -348,8 +348,8 @@ void test_merge_trees_treediff__strict_renames(void)
GIT_MERGE_DIFF_NONE,
},
};
-
- test_find_differences(TREE_OID_ANCESTOR, TREE_OID_MASTER, TREE_OID_RENAMES1, treediff_conflict_data, 8);
+
+ test_find_differences(TREE_OID_ANCESTOR, TREE_OID_MASTER, TREE_OID_RENAMES1, treediff_conflict_data, 8);
}
void test_merge_trees_treediff__rename_conflicts(void)
@@ -375,7 +375,7 @@ void test_merge_trees_treediff__rename_conflicts(void)
{ { 0100644, "2f56120107d680129a5d9791b521cb1e73a2ed31", 0, "0c-duplicated-in-theirs.txt" }, GIT_DELTA_ADDED },
GIT_MERGE_DIFF_NONE,
},
-
+
{
{ { 0100644, "2f56120107d680129a5d9791b521cb1e73a2ed31", 0, "0c-rewritten-in-theirs.txt" }, GIT_DELTA_UNMODIFIED },
{ { 0100644, "efc9121fdedaf08ba180b53ebfbcf71bd488ed09", 0, "0c-rewritten-in-theirs.txt" }, GIT_DELTA_MODIFIED },
@@ -389,21 +389,21 @@ void test_merge_trees_treediff__rename_conflicts(void)
{ { 0100644, "0d872f8e871a30208305978ecbf9e66d864f1638", 0, "1a-renamed-in-ours-edited-in-theirs.txt" }, GIT_DELTA_MODIFIED },
GIT_MERGE_DIFF_RENAMED_MODIFIED,
},
-
+
{
{ { 0100644, "d0d4594e16f2e19107e3fa7ea63e7aaaff305ffb", 0, "1a-renamed-in-ours.txt" }, GIT_DELTA_UNMODIFIED },
{ { 0100644, "d0d4594e16f2e19107e3fa7ea63e7aaaff305ffb", 0, "1a-newname-in-ours.txt" }, GIT_DELTA_RENAMED },
{ { 0100644, "d0d4594e16f2e19107e3fa7ea63e7aaaff305ffb", 0, "1a-renamed-in-ours.txt" }, GIT_DELTA_UNMODIFIED },
GIT_MERGE_DIFF_NONE,
},
-
+
{
{ { 0100644, "241a1005cd9b980732741b74385b891142bcba28", 0, "1b-renamed-in-theirs-edited-in-ours.txt" }, GIT_DELTA_UNMODIFIED },
{ { 0100644, "ed9523e62e453e50dd9be1606af19399b96e397a", 0, "1b-renamed-in-theirs-edited-in-ours.txt" }, GIT_DELTA_MODIFIED },
{ { 0100644, "241a1005cd9b980732741b74385b891142bcba28", 0, "1b-newname-in-theirs-edited-in-ours.txt" }, GIT_DELTA_RENAMED },
GIT_MERGE_DIFF_RENAMED_MODIFIED,
},
-
+
{
{ { 0100644, "2b5f1f181ee3b58ea751f5dd5d8f9b445520a136", 0, "1b-renamed-in-theirs.txt" }, GIT_DELTA_UNMODIFIED },
{ { 0100644, "2b5f1f181ee3b58ea751f5dd5d8f9b445520a136", 0, "1b-renamed-in-theirs.txt" }, GIT_DELTA_UNMODIFIED },
@@ -417,28 +417,28 @@ void test_merge_trees_treediff__rename_conflicts(void)
{ { 0100644, "178940b450f238a56c0d75b7955cb57b38191982", 0, "2-newname-in-both.txt" }, GIT_DELTA_RENAMED },
GIT_MERGE_DIFF_BOTH_RENAMED,
},
-
+
{
{ { 0100644, "18cb316b1cefa0f8a6946f0e201a8e1a6f845ab9", 0, "3a-renamed-in-ours-deleted-in-theirs.txt" }, GIT_DELTA_UNMODIFIED },
{ { 0100644, "18cb316b1cefa0f8a6946f0e201a8e1a6f845ab9", 0, "3a-newname-in-ours-deleted-in-theirs.txt" }, GIT_DELTA_RENAMED },
{ { 0, "", 0, "" }, GIT_DELTA_DELETED },
GIT_MERGE_DIFF_RENAMED_DELETED,
},
-
+
{
{ { 0100644, "36219b49367146cb2e6a1555b5a9ebd4d0328495", 0, "3b-renamed-in-theirs-deleted-in-ours.txt" }, GIT_DELTA_UNMODIFIED },
{ { 0, "", 0, "" }, GIT_DELTA_DELETED },
{ { 0100644, "36219b49367146cb2e6a1555b5a9ebd4d0328495", 0, "3b-newname-in-theirs-deleted-in-ours.txt" }, GIT_DELTA_RENAMED },
GIT_MERGE_DIFF_RENAMED_DELETED,
},
-
+
{
{ { 0, "", 0, "" }, GIT_DELTA_UNMODIFIED },
{ { 0, "", 0, "" }, GIT_DELTA_UNMODIFIED },
{ { 0100644, "8b5b53cb2aa9ceb1139f5312fcfa3cc3c5a47c9a", 0, "4a-newname-in-ours-added-in-theirs.txt" }, GIT_DELTA_ADDED },
GIT_MERGE_DIFF_RENAMED_ADDED,
- },
-
+ },
+
{
{ { 0100644, "227792b52aaa0b238bea00ec7e509b02623f168c", 0, "4a-renamed-in-ours-added-in-theirs.txt" }, GIT_DELTA_UNMODIFIED },
{ { 0100644, "227792b52aaa0b238bea00ec7e509b02623f168c", 0, "4a-newname-in-ours-added-in-theirs.txt" }, GIT_DELTA_RENAMED },
@@ -459,21 +459,21 @@ void test_merge_trees_treediff__rename_conflicts(void)
{ { 0100644, "98d52d07c0b0bbf2b46548f6aa521295c2cb55db", 0, "4b-newname-in-theirs-added-in-ours.txt" }, GIT_DELTA_RENAMED },
GIT_MERGE_DIFF_RENAMED_ADDED,
},
-
+
{
{ { 0100644, "d8fa77b6833082c1ea36b7828a582d4c43882450", 0, "5-both-renamed-1-to-2.txt" }, GIT_DELTA_UNMODIFIED },
{ { 0100644, "d8fa77b6833082c1ea36b7828a582d4c43882450", 0, "5-both-renamed-1-to-2-ours.txt" }, GIT_DELTA_RENAMED },
{ { 0100644, "d8fa77b6833082c1ea36b7828a582d4c43882450", 0, "5-both-renamed-1-to-2-theirs.txt" }, GIT_DELTA_RENAMED },
GIT_MERGE_DIFF_BOTH_RENAMED_1_TO_2,
},
-
+
{
{ { 0100644, "b42712cfe99a1a500b2a51fe984e0b8a7702ba11", 0, "6-both-renamed-side-1.txt" }, GIT_DELTA_UNMODIFIED },
{ { 0100644, "b42712cfe99a1a500b2a51fe984e0b8a7702ba11", 0, "6-both-renamed.txt" }, GIT_DELTA_RENAMED },
{ { 0100644, "b42712cfe99a1a500b2a51fe984e0b8a7702ba11", 0, "6-both-renamed-side-1.txt" }, GIT_DELTA_UNMODIFIED },
GIT_MERGE_DIFF_BOTH_RENAMED_2_TO_1,
},
-
+
{
{ { 0100644, "b69fe837e4cecfd4c9a40cdca7c138468687df07", 0, "6-both-renamed-side-2.txt" }, GIT_DELTA_UNMODIFIED },
{ { 0100644, "b69fe837e4cecfd4c9a40cdca7c138468687df07", 0, "6-both-renamed-side-2.txt" }, GIT_DELTA_UNMODIFIED },
@@ -481,8 +481,7 @@ void test_merge_trees_treediff__rename_conflicts(void)
GIT_MERGE_DIFF_BOTH_RENAMED_2_TO_1,
},
};
-
- test_find_differences(TREE_OID_RENAME_CONFLICT_ANCESTOR,
+ test_find_differences(TREE_OID_RENAME_CONFLICT_ANCESTOR,
TREE_OID_RENAME_CONFLICT_OURS, TREE_OID_RENAME_CONFLICT_THEIRS, treediff_conflict_data, 18);
}
@@ -494,7 +493,7 @@ void test_merge_trees_treediff__best_renames(void)
{ { 0100644, "233c0919c998ed110a4b6ff36f353aec8b713487", 0, "added-in-master.txt" }, GIT_DELTA_ADDED },
{ { 0, "", 0, "" }, GIT_DELTA_UNMODIFIED },
GIT_MERGE_DIFF_NONE,
- },
+ },
{
{ { 0100644, "6212c31dab5e482247d7977e4f0dd3601decf13b", 0, "automergeable.txt" }, GIT_DELTA_UNMODIFIED },
@@ -502,7 +501,7 @@ void test_merge_trees_treediff__best_renames(void)
{ { 0100644, "45299c1ca5e07bba1fd90843056fb559f96b1f5a", 0, "renamed-90.txt" }, GIT_DELTA_RENAMED },
GIT_MERGE_DIFF_RENAMED_MODIFIED,
},
-
+
{
{ { 0100644, "ab6c44a2e84492ad4b41bb6bac87353e9d02ac8b", 0, "changed-in-master.txt" }, GIT_DELTA_UNMODIFIED },
{ { 0100644, "11deab00b2d3a6f5a3073988ac050c2d7b6655e2", 0, "changed-in-master.txt" }, GIT_DELTA_MODIFIED },
@@ -523,7 +522,7 @@ void test_merge_trees_treediff__best_renames(void)
{ { 0100644, "5c3b68a71fc4fa5d362fd3875e53137c6a5ab7a5", 0, "removed-in-master.txt" }, GIT_DELTA_UNMODIFIED },
GIT_MERGE_DIFF_MODIFIED_DELETED,
},
-
+
{
{ { 0, "", 0, "" }, GIT_DELTA_UNMODIFIED },
{ { 0, "", 0, "" }, GIT_DELTA_UNMODIFIED },
@@ -538,6 +537,6 @@ void test_merge_trees_treediff__best_renames(void)
GIT_MERGE_DIFF_NONE,
},
};
-
- test_find_differences(TREE_OID_ANCESTOR, TREE_OID_MASTER, TREE_OID_RENAMES2, treediff_conflict_data, 7);
+
+ test_find_differences(TREE_OID_ANCESTOR, TREE_OID_MASTER, TREE_OID_RENAMES2, treediff_conflict_data, 7);
}
diff --git a/tests-clar/merge/trees/trivial.c b/tests-clar/merge/trees/trivial.c
index e6096e2..bfd5dfe 100644
--- a/tests-clar/merge/trees/trivial.c
+++ b/tests-clar/merge/trees/trivial.c
@@ -34,7 +34,7 @@ static int merge_trivial(git_index **index, const char *ours, const char *theirs
git_merge_tree_opts opts = GIT_MERGE_TREE_OPTS_INIT;
opts.automerge_flags |= automerge ? 0 : GIT_MERGE_AUTOMERGE_NONE;
-
+
git_buf_printf(&branch_buf, "%s%s", GIT_REFS_HEADS_DIR, ours);
cl_git_pass(git_reference_name_to_id(&our_oid, repo, branch_buf.ptr));
cl_git_pass(git_commit_lookup(&our_commit, repo, &our_oid));
@@ -46,7 +46,7 @@ static int merge_trivial(git_index **index, const char *ours, const char *theirs
cl_git_pass(git_merge_base(&ancestor_oid, repo, git_commit_id(our_commit), git_commit_id(their_commit)));
cl_git_pass(git_commit_lookup(&ancestor_commit, repo, &ancestor_oid));
-
+
cl_git_pass(git_commit_tree(&ancestor_tree, ancestor_commit));
cl_git_pass(git_commit_tree(&our_tree, our_commit));
cl_git_pass(git_commit_tree(&their_tree, their_commit));
@@ -106,7 +106,7 @@ void test_merge_trees_trivial__3alt(void)
cl_assert(entry = git_index_get_bypath(result, "new-in-3alt.txt", 0));
cl_assert(git_index_reuc_entrycount(result) == 0);
cl_assert(merge_trivial_conflict_entrycount(result) == 0);
-
+
git_index_free(result);
}
@@ -124,7 +124,7 @@ void test_merge_trees_trivial__4(void)
cl_assert(merge_trivial_conflict_entrycount(result) == 2);
cl_assert(entry = git_index_get_bypath(result, "new-and-different.txt", 2));
cl_assert(entry = git_index_get_bypath(result, "new-and-different.txt", 3));
-
+
git_index_free(result);
}
@@ -139,7 +139,7 @@ void test_merge_trees_trivial__5alt_1(void)
cl_assert(entry = git_index_get_bypath(result, "new-and-same.txt", 0));
cl_assert(git_index_reuc_entrycount(result) == 0);
cl_assert(merge_trivial_conflict_entrycount(result) == 0);
-
+
git_index_free(result);
}
@@ -154,7 +154,7 @@ void test_merge_trees_trivial__5alt_2(void)
cl_assert(entry = git_index_get_bypath(result, "modified-to-same.txt", 0));
cl_assert(git_index_reuc_entrycount(result) == 0);
cl_assert(merge_trivial_conflict_entrycount(result) == 0);
-
+
git_index_free(result);
}
@@ -171,7 +171,7 @@ void test_merge_trees_trivial__6(void)
cl_assert(merge_trivial_conflict_entrycount(result) == 1);
cl_assert(entry = git_index_get_bypath(result, "removed-in-both.txt", 1));
-
+
git_index_free(result);
}
@@ -189,7 +189,7 @@ void test_merge_trees_trivial__6_automerge(void)
cl_assert(reuc = git_index_reuc_get_bypath(result, "removed-in-both.txt"));
cl_assert(merge_trivial_conflict_entrycount(result) == 0);
-
+
git_index_free(result);
}
@@ -207,7 +207,7 @@ void test_merge_trees_trivial__8(void)
cl_assert(merge_trivial_conflict_entrycount(result) == 2);
cl_assert(entry = git_index_get_bypath(result, "removed-in-8.txt", 1));
cl_assert(entry = git_index_get_bypath(result, "removed-in-8.txt", 3));
-
+
git_index_free(result);
}
@@ -226,7 +226,7 @@ void test_merge_trees_trivial__8_automerge(void)
cl_assert(reuc = git_index_reuc_get_bypath(result, "removed-in-8.txt"));
cl_assert(merge_trivial_conflict_entrycount(result) == 0);
-
+
git_index_free(result);
}
@@ -244,7 +244,7 @@ void test_merge_trees_trivial__7(void)
cl_assert(merge_trivial_conflict_entrycount(result) == 2);
cl_assert(entry = git_index_get_bypath(result, "removed-in-7.txt", 1));
cl_assert(entry = git_index_get_bypath(result, "removed-in-7.txt", 3));
-
+
git_index_free(result);
}
@@ -262,7 +262,7 @@ void test_merge_trees_trivial__7_automerge(void)
cl_assert(merge_trivial_conflict_entrycount(result) == 2);
cl_assert(entry = git_index_get_bypath(result, "removed-in-7.txt", 1));
cl_assert(entry = git_index_get_bypath(result, "removed-in-7.txt", 3));
-
+
git_index_free(result);
}
@@ -280,7 +280,7 @@ void test_merge_trees_trivial__10(void)
cl_assert(merge_trivial_conflict_entrycount(result) == 2);
cl_assert(entry = git_index_get_bypath(result, "removed-in-10-branch.txt", 1));
cl_assert(entry = git_index_get_bypath(result, "removed-in-10-branch.txt", 2));
-
+
git_index_free(result);
}
@@ -299,7 +299,7 @@ void test_merge_trees_trivial__10_automerge(void)
cl_assert(reuc = git_index_reuc_get_bypath(result, "removed-in-10-branch.txt"));
cl_assert(merge_trivial_conflict_entrycount(result) == 0);
-
+
git_index_free(result);
}
@@ -317,7 +317,7 @@ void test_merge_trees_trivial__9(void)
cl_assert(merge_trivial_conflict_entrycount(result) == 2);
cl_assert(entry = git_index_get_bypath(result, "removed-in-9-branch.txt", 1));
cl_assert(entry = git_index_get_bypath(result, "removed-in-9-branch.txt", 2));
-
+
git_index_free(result);
}
@@ -335,7 +335,7 @@ void test_merge_trees_trivial__9_automerge(void)
cl_assert(merge_trivial_conflict_entrycount(result) == 2);
cl_assert(entry = git_index_get_bypath(result, "removed-in-9-branch.txt", 1));
cl_assert(entry = git_index_get_bypath(result, "removed-in-9-branch.txt", 2));
-
+
git_index_free(result);
}
@@ -354,7 +354,7 @@ void test_merge_trees_trivial__13(void)
cl_assert(git_index_reuc_entrycount(result) == 0);
cl_assert(merge_trivial_conflict_entrycount(result) == 0);
-
+
git_index_free(result);
}
@@ -373,7 +373,7 @@ void test_merge_trees_trivial__14(void)
cl_assert(git_index_reuc_entrycount(result) == 0);
cl_assert(merge_trivial_conflict_entrycount(result) == 0);
-
+
git_index_free(result);
}
@@ -392,6 +392,6 @@ void test_merge_trees_trivial__11(void)
cl_assert(entry = git_index_get_bypath(result, "modified-in-both.txt", 1));
cl_assert(entry = git_index_get_bypath(result, "modified-in-both.txt", 2));
cl_assert(entry = git_index_get_bypath(result, "modified-in-both.txt", 3));
-
+
git_index_free(result);
}
diff --git a/tests-clar/refs/branches/move.c b/tests-clar/refs/branches/move.c
index 7267f94..ecf14e0 100644
--- a/tests-clar/refs/branches/move.c
+++ b/tests-clar/refs/branches/move.c
@@ -24,7 +24,7 @@ void test_refs_branches_move__can_move_a_local_branch(void)
cl_git_pass(git_branch_move(&new_ref, original_ref, NEW_BRANCH_NAME, 0));
cl_assert_equal_s(GIT_REFS_HEADS_DIR NEW_BRANCH_NAME, git_reference_name(new_ref));
-
+
git_reference_free(original_ref);
git_reference_free(new_ref);
}
@@ -32,7 +32,7 @@ void test_refs_branches_move__can_move_a_local_branch(void)
void test_refs_branches_move__can_move_a_local_branch_to_a_different_namespace(void)
{
git_reference *original_ref, *new_ref, *newer_ref;
-
+
cl_git_pass(git_reference_lookup(&original_ref, repo, "refs/heads/br2"));
/* Downward */
@@ -42,14 +42,14 @@ void test_refs_branches_move__can_move_a_local_branch_to_a_different_namespace(v
/* Upward */
cl_git_pass(git_branch_move(&newer_ref, new_ref, "br2", 0));
git_reference_free(new_ref);
-
+
git_reference_free(newer_ref);
}
void test_refs_branches_move__can_move_a_local_branch_to_a_partially_colliding_namespace(void)
{
git_reference *original_ref, *new_ref, *newer_ref;
-
+
cl_git_pass(git_reference_lookup(&original_ref, repo, "refs/heads/br2"));
/* Downward */
@@ -59,29 +59,29 @@ void test_refs_branches_move__can_move_a_local_branch_to_a_partially_colliding_n
/* Upward */
cl_git_pass(git_branch_move(&newer_ref, new_ref, "br2", 0));
git_reference_free(new_ref);
-
+
git_reference_free(newer_ref);
}
void test_refs_branches_move__can_not_move_a_branch_if_its_destination_name_collide_with_an_existing_one(void)
{
git_reference *original_ref, *new_ref;
-
+
cl_git_pass(git_reference_lookup(&original_ref, repo, "refs/heads/br2"));
cl_assert_equal_i(GIT_EEXISTS, git_branch_move(&new_ref, original_ref, "master", 0));
-
+
git_reference_free(original_ref);
}
void test_refs_branches_move__moving_a_branch_with_an_invalid_name_returns_EINVALIDSPEC(void)
{
git_reference *original_ref, *new_ref;
-
+
cl_git_pass(git_reference_lookup(&original_ref, repo, "refs/heads/br2"));
cl_assert_equal_i(GIT_EINVALIDSPEC, git_branch_move(&new_ref, original_ref, "Inv@{id", 0));
-
+
git_reference_free(original_ref);
}
@@ -98,11 +98,11 @@ void test_refs_branches_move__can_not_move_a_non_branch(void)
void test_refs_branches_move__can_force_move_over_an_existing_branch(void)
{
git_reference *original_ref, *new_ref;
-
+
cl_git_pass(git_reference_lookup(&original_ref, repo, "refs/heads/br2"));
cl_git_pass(git_branch_move(&new_ref, original_ref, "master", 1));
-
+
git_reference_free(original_ref);
git_reference_free(new_ref);
}
diff --git a/tests-clar/refs/ref_helpers.c b/tests-clar/refs/ref_helpers.c
index 16ab9e6..7676e65 100644
--- a/tests-clar/refs/ref_helpers.c
+++ b/tests-clar/refs/ref_helpers.c
@@ -11,15 +11,15 @@ int reference_is_packed(git_reference *ref)
int packed;
assert(ref);
-
+
if (git_buf_joinpath(&ref_path,
git_repository_path(git_reference_owner(ref)),
git_reference_name(ref)) < 0)
return -1;
packed = !git_path_isfile(ref_path.ptr);
-
+
git_buf_free(&ref_path);
-
+
return packed;
}
diff --git a/tests-clar/refs/revparse.c b/tests-clar/refs/revparse.c
index 74472b1..43406e2 100644
--- a/tests-clar/refs/revparse.c
+++ b/tests-clar/refs/revparse.c
@@ -557,12 +557,12 @@ void test_refs_revparse__issue_994(void)
/**
* $ git rev-parse blah-7-gc47800c
* c47800c7266a2be04c571c04d5a6614691ea99bd
- *
+ *
* $ git rev-parse HEAD~3
* 4a202b346bb0fb0db7eff3cffeb3c70babbd2045
- *
+ *
* $ git branch blah-7-gc47800c HEAD~3
- *
+ *
* $ git rev-parse blah-7-gc47800c
* 4a202b346bb0fb0db7eff3cffeb3c70babbd2045
*/
@@ -592,15 +592,15 @@ void test_refs_revparse__try_to_retrieve_branch_before_described_tag(void)
/**
* $ git rev-parse a65fedf39aefe402d3bb6e24df4d4f5fe4547750
* a65fedf39aefe402d3bb6e24df4d4f5fe4547750
- *
+ *
* $ git rev-parse HEAD~3
* 4a202b346bb0fb0db7eff3cffeb3c70babbd2045
- *
+ *
* $ git branch a65fedf39aefe402d3bb6e24df4d4f5fe4547750 HEAD~3
- *
+ *
* $ git rev-parse a65fedf39aefe402d3bb6e24df4d4f5fe4547750
* a65fedf39aefe402d3bb6e24df4d4f5fe4547750
- *
+ *
* $ git rev-parse heads/a65fedf39aefe402d3bb6e24df4d4f5fe4547750
* 4a202b346bb0fb0db7eff3cffeb3c70babbd2045
*/
@@ -631,12 +631,12 @@ void test_refs_revparse__try_to_retrieve_sha_before_branch(void)
/**
* $ git rev-parse c47800
* c47800c7266a2be04c571c04d5a6614691ea99bd
- *
+ *
* $ git rev-parse HEAD~3
* 4a202b346bb0fb0db7eff3cffeb3c70babbd2045
- *
+ *
* $ git branch c47800 HEAD~3
- *
+ *
* $ git rev-parse c47800
* 4a202b346bb0fb0db7eff3cffeb3c70babbd2045
*/
@@ -694,4 +694,3 @@ void test_refs_revparse__parses_range_operator(void)
"a65fedf39aefe402d3bb6e24df4d4f5fe4547750",
GIT_REVPARSE_RANGE | GIT_REVPARSE_MERGE_BASE);
}
-
diff --git a/tests-clar/refs/setter.c b/tests-clar/refs/setter.c
index 713af81..6d875f9 100644
--- a/tests-clar/refs/setter.c
+++ b/tests-clar/refs/setter.c
@@ -25,7 +25,7 @@ void test_refs_setter__update_direct(void)
{
git_reference *ref, *test_ref, *new_ref;
git_oid id;
-
+
cl_git_pass(git_reference_lookup(&ref, g_repo, ref_master_name));
cl_assert(git_reference_type(ref) == GIT_REF_OID);
git_oid_cpy(&id, git_reference_target(ref));
@@ -48,7 +48,7 @@ void test_refs_setter__update_direct(void)
void test_refs_setter__update_symbolic(void)
{
git_reference *head, *new_head;
-
+
cl_git_pass(git_reference_lookup(&head, g_repo, "HEAD"));
cl_assert(git_reference_type(head) == GIT_REF_SYMBOLIC);
cl_assert(strcmp(git_reference_symbolic_target(head), ref_master_name) == 0);
@@ -56,7 +56,7 @@ void test_refs_setter__update_symbolic(void)
cl_git_pass(git_reference_symbolic_set_target(&new_head, head, ref_test_name));
git_reference_free(new_head);
git_reference_free(head);
-
+
cl_git_pass(git_reference_lookup(&head, g_repo, "HEAD"));
cl_assert(git_reference_type(head) == GIT_REF_SYMBOLIC);
cl_assert(strcmp(git_reference_symbolic_target(head), ref_test_name) == 0);
@@ -68,13 +68,13 @@ void test_refs_setter__cant_update_direct_with_symbolic(void)
// Overwrite an existing object id reference with a symbolic one
git_reference *ref, *new;
git_oid id;
-
+
cl_git_pass(git_reference_lookup(&ref, g_repo, ref_master_name));
cl_assert(git_reference_type(ref) == GIT_REF_OID);
git_oid_cpy(&id, git_reference_target(ref));
-
+
cl_git_fail(git_reference_symbolic_set_target(&new, ref, ref_name));
-
+
git_reference_free(ref);
}
@@ -83,7 +83,7 @@ void test_refs_setter__cant_update_symbolic_with_direct(void)
// Overwrite an existing symbolic reference with an object id one
git_reference *ref, *new;
git_oid id;
-
+
cl_git_pass(git_reference_lookup(&ref, g_repo, ref_master_name));
cl_assert(git_reference_type(ref) == GIT_REF_OID);
git_oid_cpy(&id, git_reference_target(ref));
@@ -94,6 +94,6 @@ void test_refs_setter__cant_update_symbolic_with_direct(void)
/* Can't set an OID on a direct ref */
cl_git_fail(git_reference_set_target(&new, ref, &id));
-
+
git_reference_free(ref);
}
diff --git a/tests-clar/reset/hard.c b/tests-clar/reset/hard.c
index 62371f8..1c0c841 100644
--- a/tests-clar/reset/hard.c
+++ b/tests-clar/reset/hard.c
@@ -105,14 +105,14 @@ void test_reset_hard__cannot_reset_in_a_bare_repository(void)
static void index_entry_init(git_index *index, int side, git_oid *oid)
{
git_index_entry entry;
-
+
memset(&entry, 0x0, sizeof(git_index_entry));
-
+
entry.path = "conflicting_file";
entry.flags = (side << GIT_IDXENTRY_STAGESHIFT);
entry.mode = 0100644;
git_oid_cpy(&entry.oid, oid);
-
+
cl_git_pass(git_index_add(index, &entry));
}
@@ -122,19 +122,19 @@ static void unmerged_index_init(git_index *index, int entries)
int write_ours = 2;
int write_theirs = 4;
git_oid ancestor, ours, theirs;
-
+
git_oid_fromstr(&ancestor, "6bb0d9f700543ba3d318ba7075fc3bd696b4287b");
git_oid_fromstr(&ours, "b19a1e93bec1317dc6097229e12afaffbfa74dc2");
git_oid_fromstr(&theirs, "950b81b7eee953d050aa05a641f8e056c85dd1bd");
-
+
cl_git_rewritefile("status/conflicting_file", "conflicting file\n");
-
+
if (entries & write_ancestor)
index_entry_init(index, 1, &ancestor);
-
+
if (entries & write_ours)
index_entry_init(index, 2, &ours);
-
+
if (entries & write_theirs)
index_entry_init(index, 3, &theirs);
}
@@ -143,24 +143,24 @@ void test_reset_hard__resetting_reverts_unmerged(void)
{
git_index *index;
int entries;
-
+
/* Ensure every permutation of non-zero stage entries results in the
* path being cleaned up. */
for (entries = 1; entries < 8; entries++) {
cl_git_pass(git_repository_index(&index, repo));
-
+
unmerged_index_init(index, entries);
cl_git_pass(git_index_write(index));
-
+
retrieve_target_from_oid(&target, repo, "26a125ee1bfc5df1e1b2e9441bbe63c8a7ae989f");
cl_git_pass(git_reset(repo, target, GIT_RESET_HARD));
-
+
cl_assert(git_path_exists("status/conflicting_file") == 0);
-
+
git_object_free(target);
target = NULL;
-
- git_index_free(index);
+
+ git_index_free(index);
}
}
diff --git a/tests-clar/status/submodules.c b/tests-clar/status/submodules.c
index 8365a7f..af87077 100644
--- a/tests-clar/status/submodules.c
+++ b/tests-clar/status/submodules.c
@@ -219,4 +219,3 @@ void test_status_submodules__dirty_workdir_only(void)
git_status_foreach_ext(g_repo, &opts, cb_status__match, &counts));
cl_assert_equal_i(6, counts.entry_count);
}
-
diff --git a/tests-clar/trace/trace.c b/tests-clar/trace/trace.c
index cc99cd1..87b3253 100644
--- a/tests-clar/trace/trace.c
+++ b/tests-clar/trace/trace.c
@@ -85,4 +85,3 @@ void test_trace_trace__writes_lower_level(void)
cl_assert(written == 1);
#endif
}
-