Merge pull request #4917 from libgit2/ethomson/giterr Move `giterr` to `git_error`
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 3314 3315 3316 3317 3318 3319 3320 3321 3322 3323 3324 3325 3326 3327 3328 3329 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 3419 3420 3421 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 3434 3435 3436 3437 3438 3439 3440 3441 3442 3443 3444 3445 3446 3447 3448 3449 3450 3451 3452 3453 3454 3455 3456 3457 3458 3459 3460 3461 3462 3463 3464 3465 3466 3467 3468 3469 3470 3471 3472 3473 3474 3475 3476 3477 3478 3479 3480 3481 3482 3483 3484 3485 3486 3487 3488 3489 3490 3491 3492 3493 3494 3495 3496 3497 3498 3499 3500 3501 3502 3503 3504 3505 3506 3507 3508 3509 3510 3511 3512 3513 3514 3515 3516 3517 3518 3519 3520 3521 3522 3523 3524 3525 3526 3527 3528 3529 3530 3531 3532 3533 3534 3535 3536 3537 3538 3539 3540 3541 3542 3543 3544 3545 3546 3547 3548 3549 3550 3551 3552 3553 3554 3555 3556 3557 3558 3559 3560 3561 3562 3563 3564 3565 3566 3567 3568 3569 3570 3571 3572 3573 3574 3575 3576 3577 3578 3579 3580 3581 3582 3583 3584 3585 3586 3587 3588 3589 3590 3591 3592 3593 3594 3595 3596 3597 3598 3599 3600 3601 3602 3603 3604 3605 3606 3607 3608 3609 3610 3611 3612 3613 3614 3615 3616 3617 3618 3619 3620 3621 3622 3623 3624 3625 3626 3627 3628 3629 3630 3631 3632 3633 3634 3635 3636 3637 3638 3639 3640 3641 3642 3643 3644 3645 3646 3647 3648 3649 3650 3651 3652 3653 3654 3655 3656 3657 3658 3659 3660 3661 3662 3663 3664 3665 3666 3667 3668 3669 3670 3671 3672 3673 3674 3675 3676 3677 3678 3679 3680 3681 3682 3683 3684 3685 3686 3687 3688 3689 3690 3691 3692 3693 3694 3695 3696 3697 3698 3699 3700 3701 3702 3703 3704 3705 3706 3707 3708 3709 3710 3711 3712 3713 3714 3715 3716 3717 3718 3719 3720 3721 3722 3723 3724 3725 3726 3727 3728 3729 3730 3731 3732 3733 3734 3735 3736 3737 3738 3739 3740 3741 3742 3743 3744 3745 3746 3747 3748 3749 3750 3751 3752 3753 3754 3755 3756 3757 3758 3759 3760 3761 3762 3763 3764 3765 3766 3767 3768 3769 3770 3771 3772 3773 3774 3775 3776 3777 3778 3779 3780 3781 3782 3783 3784 3785 3786 3787 3788 3789 3790 3791 3792 3793 3794 3795 3796 3797 3798 3799 3800 3801 3802 3803 3804 3805 3806 3807 3808 3809 3810 3811 3812 3813 3814 3815 3816 3817 3818 3819 3820 3821 3822 3823 3824 3825 3826 3827 3828 3829 3830 3831 3832 3833 3834 3835 3836 3837 3838 3839 3840 3841 3842 3843 3844 3845 3846 3847 3848 3849 3850 3851 3852 3853 3854 3855 3856 3857 3858 3859 3860 3861 3862 3863 3864 3865 3866 3867 3868 3869 3870 3871 3872 3873 3874 3875 3876 3877 3878 3879 3880 3881 3882 3883 3884 3885 3886 3887 3888 3889 3890 3891 3892 3893 3894 3895 3896 3897 3898 3899 3900 3901 3902 3903 3904 3905 3906 3907 3908 3909 3910 3911 3912 3913 3914 3915 3916 3917 3918 3919 3920 3921 3922 3923 3924 3925 3926 3927 3928 3929 3930 3931 3932 3933 3934 3935 3936 3937 3938 3939 3940 3941 3942 3943 3944 3945 3946 3947 3948 3949 3950 3951 3952 3953 3954 3955 3956 3957 3958 3959 3960 3961 3962 3963 3964 3965 3966 3967 3968 3969 3970 3971 3972 3973 3974 3975 3976 3977 3978 3979 3980 3981 3982 3983 3984 3985 3986 3987 3988 3989 3990 3991 3992 3993 3994 3995 3996 3997 3998 3999 4000 4001 4002 4003 4004 4005 4006 4007 4008 4009 4010 4011 4012 4013 4014 4015 4016 4017 4018 4019 4020 4021 4022 4023 4024 4025 4026 4027 4028 4029 4030 4031 4032 4033 4034 4035 4036 4037 4038 4039 4040 4041 4042 4043 4044 4045 4046 4047 4048 4049 4050 4051 4052 4053 4054 4055 4056 4057 4058 4059 4060 4061 4062 4063 4064 4065 4066 4067 4068 4069 4070 4071 4072 4073 4074 4075 4076 4077 4078 4079 4080 4081 4082 4083 4084 4085 4086 4087 4088 4089 4090 4091 4092 4093 4094 4095 4096 4097 4098 4099 4100 4101 4102 4103 4104 4105 4106 4107 4108 4109 4110 4111 4112 4113 4114 4115 4116 4117 4118 4119 4120 4121 4122 4123 4124 4125 4126 4127 4128 4129 4130 4131 4132 4133 4134 4135 4136 4137 4138 4139 4140 4141 4142 4143 4144 4145 4146 4147 4148 4149 4150 4151 4152 4153 4154 4155 4156 4157 4158 4159 4160 4161 4162 4163 4164 4165 4166 4167 4168 4169 4170 4171 4172 4173 4174 4175 4176 4177 4178 4179 4180 4181 4182 4183 4184 4185 4186 4187 4188 4189 4190 4191 4192 4193 4194 4195 4196 4197 4198 4199 4200 4201 4202 4203 4204 4205 4206 4207 4208 4209 4210 4211 4212 4213 4214 4215 4216 4217 4218 4219 4220 4221 4222 4223 4224 4225 4226 4227 4228 4229 4230 4231 4232 4233 4234 4235 4236 4237 4238 4239 4240 4241 4242 4243 4244 4245 4246 4247 4248 4249 4250 4251 4252 4253 4254 4255 4256 4257 4258 4259 4260 4261 4262 4263 4264 4265 4266 4267 4268 4269 4270 4271 4272 4273 4274 4275 4276 4277 4278 4279 4280 4281 4282 4283 4284 4285 4286 4287 4288 4289 4290 4291 4292 4293 4294 4295 4296 4297 4298 4299 4300 4301 4302 4303 4304 4305 4306 4307 4308 4309 4310 4311 4312 4313 4314 4315 4316 4317 4318 4319 4320 4321 4322 4323 4324 4325 4326 4327 4328 4329 4330 4331 4332 4333 4334 4335 4336 4337 4338 4339 4340 4341 4342 4343 4344 4345 4346 4347 4348 4349 4350 4351 4352 4353 4354 4355 4356 4357 4358 4359 4360 4361 4362 4363 4364 4365 4366 4367 4368 4369 4370 4371 4372 4373 4374 4375 4376 4377 4378 4379 4380 4381 4382 4383 4384 4385 4386 4387 4388 4389 4390 4391 4392 4393 4394 4395 4396 4397 4398 4399 4400 4401 4402 4403 4404 4405 4406 4407 4408 4409 4410 4411 4412 4413 4414 4415 4416 4417 4418 4419 4420 4421 4422 4423 4424 4425 4426 4427 4428 4429 4430 4431 4432 4433 4434 4435 4436 4437 4438 4439 4440 4441 4442 4443 4444 4445 4446 4447 4448 4449 4450 4451 4452 4453 4454 4455 4456 4457 4458 4459 4460 4461 4462 4463 4464 4465 4466 4467 4468 4469 4470 4471 4472 4473 4474 4475 4476 4477 4478 4479 4480 4481 4482 4483 4484 4485 4486 4487 4488 4489 4490 4491 4492 4493 4494 4495 4496 4497 4498 4499 4500 4501 4502 4503 4504 4505 4506 4507 4508 4509 4510 4511 4512 4513 4514 4515 4516 4517 4518 4519 4520 4521 4522 4523 4524 4525 4526 4527 4528 4529 4530 4531 4532 4533 4534 4535 4536 4537 4538 4539 4540 4541 4542 4543 4544 4545 4546 4547 4548 4549 4550 4551 4552 4553 4554 4555 4556 4557 4558 4559 4560 4561 4562 4563 4564 4565 4566 4567 4568 4569 4570 4571 4572 4573 4574 4575 4576 4577 4578 4579 4580 4581 4582 4583 4584 4585 4586 4587 4588 4589 4590 4591 4592 4593 4594 4595 4596 4597 4598 4599 4600 4601 4602 4603 4604 4605 4606 4607 4608 4609 4610 4611 4612 4613 4614 4615 4616 4617 4618 4619 4620 4621 4622 4623 4624 4625 4626 4627 4628 4629 4630 4631 4632 4633 4634 4635 4636 4637 4638 4639 4640 4641 4642 4643 4644 4645 4646 4647 4648 4649 4650 4651 4652 4653 4654 4655 4656 4657 4658 4659 4660 4661 4662 4663 4664 4665 4666 4667 4668 4669 4670 4671 4672 4673 4674 4675 4676 4677 4678 4679 4680 4681 4682 4683 4684 4685 4686 4687 4688 4689 4690 4691 4692 4693 4694 4695 4696 4697 4698 4699 4700 4701 4702 4703 4704 4705 4706 4707 4708 4709 4710 4711 4712 4713 4714 4715 4716 4717 4718 4719 4720 4721 4722 4723 4724 4725 4726 4727 4728 4729 4730 4731 4732 4733 4734 4735 4736 4737 4738 4739 4740 4741 4742 4743 4744 4745 4746 4747 4748 4749 4750 4751 4752 4753 4754 4755 4756 4757 4758 4759 4760 4761 4762 4763 4764 4765 4766 4767 4768 4769 4770 4771 4772 4773 4774 4775 4776 4777 4778 4779 4780 4781 4782 4783 4784 4785 4786 4787 4788 4789 4790 4791 4792 4793 4794 4795 4796 4797 4798 4799 4800 4801 4802 4803 4804 4805 4806 4807 4808 4809 4810 4811 4812 4813 4814 4815 4816 4817 4818 4819 4820 4821 4822 4823 4824 4825 4826 4827 4828 4829 4830 4831 4832 4833 4834 4835 4836 4837 4838 4839 4840 4841 4842 4843 4844 4845 4846 4847 4848 4849 4850 4851 4852 4853 4854 4855 4856 4857 4858 4859 4860 4861 4862 4863 4864 4865 4866 4867 4868 4869 4870 4871 4872 4873 4874 4875 4876 4877 4878 4879 4880 4881 4882 4883 4884 4885 4886 4887 4888 4889 4890 4891 4892 4893 4894 4895 4896 4897 4898 4899 4900 4901 4902 4903 4904 4905 4906 4907 4908 4909 4910 4911 4912 4913 4914 4915 4916 4917 4918 4919 4920 4921 4922 4923 4924 4925 4926 4927 4928 4929 4930 4931 4932 4933 4934 4935 4936 4937 4938 4939 4940 4941 4942 4943 4944 4945 4946 4947 4948 4949 4950 4951 4952 4953 4954 4955 4956 4957 4958 4959 4960 4961 4962 4963 4964 4965 4966 4967 4968 4969 4970 4971 4972 4973 4974 4975 4976 4977 4978 4979 4980 4981 4982 4983 4984 4985 4986 4987 4988 4989 4990 4991 4992 4993 4994 4995 4996 4997 4998 4999 5000 5001 5002 5003 5004 5005 5006 5007 5008 5009 5010 5011 5012 5013 5014 5015 5016 5017 5018 5019 5020 5021 5022 5023 5024 5025 5026 5027 5028 5029 5030 5031 5032 5033 5034 5035 5036 5037 5038 5039 5040 5041 5042 5043 5044 5045 5046 5047 5048 5049 5050 5051 5052 5053 5054 5055 5056 5057 5058 5059 5060 5061 5062 5063 5064 5065 5066 5067 5068 5069 5070 5071 5072 5073 5074 5075 5076 5077 5078 5079 5080 5081 5082 5083 5084 5085 5086 5087 5088 5089 5090 5091 5092 5093 5094 5095 5096 5097 5098 5099 5100 5101 5102 5103 5104 5105 5106 5107 5108 5109 5110 5111 5112 5113 5114 5115 5116 5117 5118 5119 5120 5121 5122 5123 5124 5125 5126 5127 5128 5129 5130 5131 5132 5133 5134 5135 5136 5137 5138 5139 5140 5141 5142 5143 5144 5145 5146 5147 5148 5149 5150 5151 5152 5153 5154 5155 5156 5157 5158 5159 5160 5161 5162 5163 5164 5165 5166 5167 5168 5169 5170 5171 5172 5173 5174 5175 5176 5177 5178 5179 5180 5181 5182 5183 5184 5185 5186 5187 5188 5189 5190 5191 5192 5193 5194 5195 5196 5197 5198 5199 5200 5201 5202 5203 5204 5205 5206 5207 5208 5209 5210 5211 5212 5213 5214 5215 5216 5217 5218 5219 5220 5221 5222 5223 5224 5225 5226 5227 5228 5229 5230 5231 5232 5233 5234 5235 5236 5237 5238 5239 5240 5241 5242 5243 5244 5245 5246 5247 5248 5249 5250 5251 5252 5253 5254 5255 5256 5257 5258 5259 5260 5261 5262 5263 5264 5265 5266 5267 5268 5269 5270 5271 5272 5273 5274 5275 5276 5277 5278 5279 5280 5281 5282 5283 5284 5285 5286 5287 5288 5289 5290 5291 5292 5293 5294 5295 5296 5297 5298 5299 5300 5301 5302 5303 5304 5305 5306 5307 5308 5309 5310 5311 5312 5313 5314 5315 5316 5317 5318 5319 5320 5321 5322 5323 5324 5325 5326 5327 5328 5329 5330 5331 5332 5333 5334 5335 5336 5337 5338 5339 5340 5341 5342 5343 5344 5345 5346 5347 5348 5349 5350 5351 5352 5353 5354 5355 5356 5357 5358 5359 5360 5361 5362 5363 5364 5365 5366 5367 5368 5369 5370 5371 5372 5373 5374 5375 5376 5377 5378 5379 5380 5381 5382 5383 5384 5385 5386 5387 5388 5389 5390 5391 5392 5393 5394 5395 5396 5397 5398 5399 5400 5401 5402 5403 5404 5405 5406 5407 5408 5409 5410 5411 5412 5413 5414 5415 5416 5417 5418 5419 5420 5421 5422 5423 5424 5425 5426 5427 5428 5429 5430 5431 5432 5433 5434 5435 5436 5437 5438 5439 5440 5441 5442 5443 5444 5445 5446 5447 5448 5449 5450 5451 5452 5453 5454 5455 5456 5457 5458 5459 5460 5461 5462 5463 5464 5465 5466 5467 5468 5469 5470 5471 5472 5473 5474 5475 5476 5477 5478 5479 5480 5481 5482 5483 5484 5485 5486 5487 5488 5489 5490 5491 5492 5493 5494 5495 5496 5497 5498 5499 5500 5501 5502 5503 5504 5505 5506 5507 5508 5509 5510 5511 5512 5513 5514 5515 5516 5517 5518 5519 5520 5521 5522 5523 5524 5525 5526 5527 5528 5529 5530 5531 5532 5533 5534 5535 5536 5537 5538 5539 5540 5541 5542 5543 5544 5545 5546 5547 5548 5549 5550 5551 5552 5553 5554 5555 5556 5557 5558 5559 5560 5561 5562 5563 5564 5565 5566 5567 5568 5569 5570 5571 5572 5573 5574 5575 5576 5577 5578 5579 5580 5581 5582 5583 5584 5585 5586 5587 5588 5589 5590 5591 5592 5593 5594 5595 5596 5597 5598 5599 5600 5601 5602 5603 5604 5605 5606 5607 5608 5609 5610 5611 5612 5613 5614 5615 5616 5617 5618 5619 5620 5621 5622 5623 5624 5625 5626 5627 5628 5629 5630 5631 5632 5633 5634 5635 5636 5637 5638 5639 5640 5641 5642 5643 5644 5645 5646 5647 5648 5649 5650 5651 5652 5653 5654 5655 5656 5657 5658 5659 5660 5661 5662 5663 5664 5665 5666 5667 5668 5669 5670 5671 5672 5673 5674 5675 5676 5677 5678 5679 5680 5681 5682 5683 5684 5685 5686 5687 5688 5689 5690 5691 5692 5693 5694 5695 5696 5697 5698 5699 5700 5701 5702 5703 5704 5705 5706 5707 5708 5709 5710 5711 5712 5713 5714 5715 5716 5717 5718 5719 5720 5721 5722 5723 5724 5725 5726 5727 5728 5729 5730 5731 5732 5733 5734 5735 5736 5737 5738 5739 5740 5741 5742 5743 5744 5745 5746 5747 5748 5749 5750 5751 5752 5753 5754 5755 5756 5757 5758 5759 5760 5761 5762 5763 5764 5765 5766 5767 5768 5769 5770 5771 5772 5773 5774 5775 5776 5777 5778 5779 5780 5781 5782 5783 5784 5785 5786 5787 5788 5789 5790 5791 5792 5793 5794 5795 5796 5797 5798 5799 5800 5801 5802 5803 5804 5805 5806 5807 5808 5809 5810 5811 5812 5813 5814 5815 5816 5817 5818 5819 5820 5821 5822 5823 5824 5825 5826 5827 5828 5829 5830 5831 5832 5833 5834 5835 5836 5837 5838 5839 5840 5841 5842 5843 5844 5845 5846 5847 5848 5849 5850 5851 5852 5853 5854 5855 5856 5857 5858 5859 5860 5861 5862 5863 5864 5865 5866 5867 5868 5869 5870 5871 5872 5873 5874 5875 5876 5877 5878 5879 5880 5881 5882 5883 5884 5885 5886 5887 5888 5889 5890 5891 5892 5893 5894 5895 5896 5897 5898 5899 5900 5901 5902 5903 5904 5905 5906 5907 5908 5909 5910 5911 5912 5913 5914 5915 5916 5917 5918 5919 5920 5921 5922 5923 5924 5925 5926 5927 5928 5929 5930 5931 5932 5933 5934 5935 5936 5937 5938 5939 5940 5941 5942 5943 5944 5945 5946 5947 5948 5949 5950 5951 5952 5953 5954 5955 5956 5957 5958 5959 5960 5961 5962 5963 5964 5965 5966 5967 5968 5969 5970 5971 5972 5973 5974 5975 5976 5977 5978 5979 5980 5981 5982 5983 5984 5985 5986 5987 5988 5989 5990 5991 5992 5993 5994 5995 5996 5997 5998 5999 6000 6001 6002 6003 6004 6005 6006 6007 6008 6009 6010 6011 6012 6013 6014 6015 6016 6017 6018 6019 6020 6021 6022 6023 6024 6025 6026 6027 6028 6029 6030 6031 6032 6033 6034 6035 6036 6037 6038 6039 6040 6041 6042 6043 6044 6045 6046 6047 6048 6049 6050 6051 6052 6053 6054 6055 6056 6057 6058 6059 6060 6061 6062 6063 6064 6065 6066 6067 6068 6069 6070 6071 6072 6073 6074 6075 6076 6077 6078 6079 6080 6081 6082 6083 6084 6085 6086 6087 6088 6089 6090 6091 6092 6093 6094 6095 6096 6097 6098 6099 6100 6101 6102 6103 6104 6105 6106 6107 6108 6109 6110 6111 6112 6113 6114 6115 6116 6117 6118 6119 6120 6121 6122 6123 6124 6125 6126 6127 6128 6129 6130 6131 6132 6133 6134 6135 6136 6137 6138 6139 6140 6141 6142 6143 6144 6145 6146 6147 6148 6149 6150 6151 6152 6153 6154 6155 6156 6157 6158 6159 6160 6161 6162 6163 6164 6165 6166 6167 6168 6169 6170 6171 6172 6173 6174 6175 6176 6177 6178 6179 6180 6181 6182 6183 6184 6185 6186 6187 6188 6189 6190 6191 6192 6193 6194 6195 6196 6197 6198 6199 6200 6201 6202 6203 6204 6205 6206 6207 6208 6209 6210 6211 6212 6213 6214 6215 6216 6217 6218 6219 6220 6221 6222 6223 6224 6225 6226 6227 6228 6229 6230 6231 6232 6233 6234 6235 6236 6237 6238 6239 6240 6241 6242 6243 6244 6245 6246 6247 6248 6249 6250 6251 6252 6253 6254 6255 6256 6257 6258 6259 6260 6261 6262 6263 6264 6265 6266 6267 6268 6269 6270 6271 6272 6273 6274 6275 6276 6277 6278 6279 6280 6281 6282 6283 6284 6285 6286 6287 6288 6289 6290 6291 6292 6293 6294 6295 6296 6297 6298 6299 6300 6301 6302 6303 6304 6305 6306 6307 6308 6309 6310 6311 6312 6313 6314 6315 6316 6317 6318 6319 6320 6321 6322 6323 6324 6325 6326 6327 6328 6329 6330 6331 6332 6333 6334 6335 6336 6337 6338 6339 6340 6341 6342 6343 6344 6345 6346 6347 6348 6349 6350 6351 6352 6353 6354 6355 6356 6357 6358 6359 6360 6361 6362 6363 6364 6365 6366 6367 6368 6369 6370 6371 6372 6373 6374 6375 6376 6377 6378 6379 6380 6381 6382 6383 6384 6385 6386 6387 6388 6389 6390 6391 6392 6393 6394 6395 6396 6397 6398 6399 6400 6401 6402 6403 6404 6405 6406 6407 6408 6409 6410 6411 6412 6413 6414 6415 6416 6417 6418 6419 6420 6421 6422 6423 6424 6425 6426 6427 6428 6429 6430 6431 6432 6433 6434 6435 6436 6437 6438 6439 6440 6441 6442 6443 6444 6445 6446 6447 6448 6449 6450 6451 6452 6453 6454 6455 6456 6457 6458 6459 6460 6461 6462 6463 6464 6465 6466 6467 6468 6469 6470 6471 6472 6473 6474 6475 6476 6477 6478 6479 6480 6481 6482 6483 6484 6485 6486 6487 6488 6489 6490 6491 6492 6493 6494 6495 6496 6497 6498 6499 6500 6501 6502 6503 6504 6505 6506 6507 6508 6509 6510 6511 6512 6513 6514 6515 6516 6517 6518 6519 6520 6521 6522 6523 6524 6525 6526 6527 6528 6529 6530 6531 6532 6533 6534 6535 6536 6537 6538 6539 6540 6541 6542 6543 6544 6545 6546 6547 6548 6549 6550 6551 6552 6553 6554 6555 6556 6557 6558 6559 6560 6561 6562 6563 6564 6565 6566 6567 6568 6569 6570 6571 6572 6573 6574 6575 6576 6577 6578 6579 6580 6581 6582 6583 6584 6585 6586 6587 6588 6589 6590 6591 6592 6593 6594 6595 6596 6597 6598 6599 6600 6601 6602 6603 6604 6605 6606 6607 6608 6609 6610 6611 6612 6613 6614 6615 6616 6617 6618 6619 6620 6621 6622 6623 6624 6625 6626 6627 6628 6629 6630 6631 6632 6633 6634 6635 6636 6637 6638 6639 6640 6641 6642 6643 6644 6645 6646 6647 6648 6649 6650 6651 6652 6653 6654 6655 6656 6657 6658 6659 6660 6661 6662 6663 6664 6665 6666 6667 6668 6669 6670 6671 6672 6673 6674 6675 6676 6677 6678 6679 6680 6681 6682 6683 6684 6685 6686 6687 6688 6689 6690 6691 6692 6693 6694 6695 6696 6697 6698 6699 6700 6701 6702 6703 6704 6705 6706 6707 6708 6709 6710 6711 6712 6713 6714 6715 6716 6717 6718 6719 6720 6721 6722 6723 6724 6725 6726 6727 6728 6729 6730 6731 6732 6733 6734 6735 6736 6737 6738 6739 6740 6741 6742 6743 6744 6745 6746 6747 6748 6749 6750 6751 6752 6753 6754 6755 6756 6757 6758 6759 6760 6761 6762 6763 6764 6765 6766 6767 6768 6769 6770 6771 6772 6773 6774 6775 6776 6777 6778 6779 6780 6781 6782 6783 6784 6785 6786 6787 6788 6789 6790 6791 6792 6793 6794 6795 6796 6797 6798 6799 6800 6801 6802 6803 6804 6805 6806 6807 6808 6809 6810 6811 6812 6813 6814 6815 6816 6817 6818 6819 6820 6821 6822 6823 6824 6825 6826 6827 6828 6829 6830 6831 6832 6833 6834 6835 6836 6837 6838 6839 6840 6841 6842 6843 6844 6845 6846 6847 6848 6849 6850 6851 6852 6853 6854 6855 6856 6857 6858 6859 6860 6861 6862 6863 6864 6865 6866 6867 6868 6869 6870 6871 6872 6873 6874 6875 6876 6877 6878 6879 6880 6881 6882 6883 6884 6885 6886 6887 6888 6889 6890 6891 6892 6893 6894 6895 6896 6897 6898 6899 6900 6901 6902 6903 6904 6905 6906 6907 6908 6909 6910 6911 6912 6913 6914 6915 6916 6917 6918 6919 6920 6921 6922 6923 6924 6925 6926 6927 6928 6929 6930 6931 6932 6933 6934 6935 6936 6937 6938 6939 6940 6941 6942 6943 6944 6945 6946 6947 6948 6949 6950 6951 6952 6953 6954 6955 6956 6957 6958 6959 6960 6961 6962 6963 6964 6965 6966 6967 6968 6969 6970 6971 6972 6973 6974 6975 6976 6977 6978 6979 6980 6981 6982 6983 6984 6985 6986 6987 6988 6989 6990 6991 6992 6993 6994 6995 6996 6997 6998 6999 7000 7001 7002 7003 7004 7005 7006 7007 7008 7009 7010 7011 7012 7013 7014 7015 7016 7017 7018 7019 7020 7021 7022 7023 7024 7025 7026 7027 7028 7029 7030 7031 7032 7033 7034 7035 7036 7037 7038 7039 7040 7041 7042 7043 7044 7045 7046 7047 7048 7049 7050 7051 7052 7053 7054 7055 7056 7057 7058 7059 7060 7061 7062 7063 7064 7065 7066 7067 7068 7069 7070 7071 7072 7073 7074 7075 7076 7077 7078 7079 7080 7081 7082 7083 7084 7085 7086 7087 7088 7089 7090 7091 7092 7093 7094 7095 7096 7097 7098 7099 7100 7101 7102 7103 7104 7105 7106 7107 7108 7109 7110 7111 7112 7113 7114 7115 7116 7117 7118 7119 7120 7121 7122 7123 7124 7125 7126 7127 7128 7129 7130 7131 7132 7133 7134 7135 7136 7137 7138 7139 7140 7141 7142 7143 7144 7145 7146 7147 7148 7149 7150 7151 7152 7153 7154 7155 7156 7157 7158 7159 7160 7161 7162 7163 7164 7165 7166 7167 7168 7169 7170 7171 7172 7173 7174 7175 7176 7177 7178 7179 7180 7181 7182 7183 7184 7185 7186 7187 7188 7189 7190 7191 7192 7193 7194 7195 7196 7197 7198 7199 7200 7201 7202 7203 7204 7205 7206 7207 7208 7209 7210 7211 7212 7213 7214 7215 7216 7217 7218 7219 7220 7221 7222 7223 7224 7225 7226 7227 7228 7229 7230 7231 7232 7233 7234 7235 7236 7237 7238 7239 7240 7241 7242 7243 7244 7245 7246 7247 7248 7249 7250 7251 7252 7253 7254 7255 7256 7257 7258 7259 7260 7261 7262 7263 7264 7265 7266 7267 7268 7269 7270 7271 7272 7273 7274 7275 7276 7277 7278 7279 7280 7281 7282 7283 7284 7285 7286 7287 7288 7289 7290 7291 7292 7293 7294 7295 7296 7297 7298 7299 7300 7301 7302 7303 7304 7305 7306 7307 7308 7309 7310 7311 7312 7313 7314 7315 7316 7317 7318 7319 7320 7321 7322 7323 7324 7325 7326 7327 7328 7329 7330 7331 7332 7333 7334 7335 7336 7337 7338 7339 7340 7341 7342 7343 7344 7345 7346 7347 7348 7349 7350 7351 7352 7353 7354 7355 7356 7357 7358 7359 7360 7361 7362 7363 7364 7365 7366 7367 7368 7369 7370 7371 7372 7373 7374 7375 7376 7377 7378 7379 7380 7381 7382 7383 7384 7385 7386 7387 7388 7389 7390 7391 7392 7393 7394 7395 7396 7397 7398 7399 7400 7401 7402 7403 7404 7405 7406 7407 7408 7409 7410 7411 7412 7413 7414 7415 7416 7417 7418 7419 7420 7421 7422 7423 7424 7425 7426 7427 7428 7429 7430 7431 7432 7433 7434 7435 7436 7437 7438 7439 7440 7441 7442 7443 7444 7445 7446 7447 7448 7449 7450 7451 7452 7453 7454 7455 7456 7457 7458 7459 7460 7461 7462 7463 7464 7465 7466 7467 7468 7469 7470 7471 7472 7473 7474 7475 7476 7477 7478 7479 7480 7481 7482 7483 7484 7485 7486 7487 7488 7489 7490 7491 7492 7493 7494 7495 7496 7497 7498 7499 7500 7501 7502 7503 7504 7505 7506 7507 7508 7509 7510 7511 7512 7513 7514 7515 7516 7517 7518 7519 7520 7521 7522 7523 7524 7525 7526 7527 7528 7529 7530 7531 7532 7533 7534 7535 7536 7537 7538 7539 7540 7541 7542 7543 7544 7545 7546 7547 7548 7549 7550 7551 7552 7553 7554 7555 7556 7557 7558 7559 7560 7561 7562 7563 7564 7565 7566 7567 7568 7569 7570 7571 7572 7573 7574 7575 7576 7577 7578 7579 7580 7581 7582 7583 7584 7585 7586 7587 7588 7589 7590 7591 7592 7593 7594 7595 7596 7597 7598 7599 7600 7601 7602 7603 7604 7605 7606 7607 7608 7609 7610 7611 7612 7613 7614 7615 7616 7617 7618 7619 7620 7621 7622 7623 7624 7625 7626 7627 7628 7629 7630 7631 7632 7633 7634 7635 7636 7637 7638 7639 7640 7641 7642 7643 7644 7645 7646 7647 7648 7649 7650 7651 7652 7653 7654 7655 7656 7657 7658 7659 7660 7661 7662 7663 7664 7665 7666 7667 7668 7669 7670 7671 7672 7673 7674 7675 7676 7677 7678 7679 7680 7681 7682 7683 7684 7685 7686 7687 7688 7689 7690 7691 7692 7693 7694 7695 7696 7697 7698 7699 7700 7701 7702 7703 7704 7705 7706 7707 7708 7709 7710 7711 7712 7713 7714 7715 7716 7717 7718 7719 7720 7721 7722 7723 7724 7725 7726 7727 7728 7729 7730 7731 7732 7733 7734 7735 7736 7737 7738 7739 7740 7741 7742 7743 7744 7745 7746 7747 7748 7749 7750 7751 7752 7753 7754 7755 7756 7757 7758 7759 7760 7761 7762 7763 7764 7765 7766 7767 7768 7769 7770 7771 7772 7773 7774 7775 7776 7777 7778 7779 7780 7781 7782 7783 7784 7785 7786 7787 7788 7789 7790 7791 7792 7793 7794 7795 7796 7797 7798 7799 7800 7801 7802 7803 7804 7805 7806 7807 7808 7809 7810 7811 7812 7813 7814 7815 7816 7817 7818 7819 7820 7821 7822 7823 7824 7825 7826 7827 7828 7829 7830 7831 7832 7833 7834 7835 7836 7837 7838 7839 7840 7841 7842 7843 7844 7845 7846 7847 7848 7849 7850 7851 7852 7853 7854 7855 7856 7857 7858 7859 7860 7861 7862 7863 7864 7865 7866 7867 7868 7869 7870 7871 7872 7873 7874 7875 7876 7877 7878 7879 7880 7881 7882 7883 7884 7885 7886 7887 7888 7889 7890 7891 7892 7893 7894 7895 7896 7897 7898 7899 7900 7901 7902 7903 7904 7905 7906 7907 7908 7909 7910 7911 7912 7913 7914 7915 7916 7917 7918 7919 7920 7921 7922 7923 7924 7925 7926 7927 7928 7929 7930 7931 7932 7933 7934 7935 7936 7937 7938 7939 7940 7941 7942 7943 7944 7945 7946 7947 7948 7949 7950 7951 7952 7953 7954 7955 7956 7957 7958 7959 7960 7961 7962 7963 7964 7965 7966 7967 7968 7969 7970 7971 7972 7973 7974 7975 7976 7977 7978 7979 7980 7981 7982 7983 7984 7985 7986 7987 7988 7989 7990 7991 7992 7993 7994 7995 7996 7997 7998 7999 8000 8001 8002 8003 8004 8005 8006 8007 8008 8009 8010 8011 8012 8013 8014 8015 8016 8017 8018 8019 8020 8021 8022 8023 8024 8025 8026 8027 8028 8029 8030 8031 8032 8033 8034 8035 8036 8037 8038 8039 8040 8041 8042 8043 8044 8045 8046 8047 8048 8049 8050 8051 8052 8053 8054 8055 8056 8057 8058 8059 8060 8061 8062 8063 8064 8065 8066 8067 8068 8069 8070 8071 8072 8073 8074 8075 8076 8077 8078 8079 8080 8081 8082 8083 8084 8085 8086 8087 8088 8089 8090 8091 8092 8093 8094 8095 8096 8097 8098 8099 8100 8101 8102 8103 8104 8105 8106 8107 8108 8109 8110 8111 8112 8113 8114 8115 8116 8117 8118 8119 8120 8121 8122 8123 8124 8125 8126 8127 8128 8129 8130 8131 8132 8133 8134 8135 8136 8137 8138 8139 8140 8141 8142 8143 8144 8145 8146 8147 8148 8149 8150 8151 8152 8153 8154 8155 8156 8157 8158 8159 8160 8161 8162 8163 8164 8165 8166 8167 8168 8169 8170 8171 8172 8173 8174 8175 8176 8177 8178 8179 8180 8181 8182 8183 8184 8185 8186 8187 8188 8189 8190 8191 8192 8193 8194 8195 8196 8197 8198 8199 8200 8201 8202 8203 8204 8205 8206 8207 8208 8209 8210 8211 8212 8213 8214 8215 8216 8217 8218 8219 8220 8221 8222 8223 8224 8225 8226 8227 8228 8229 8230 8231 8232 8233 8234 8235 8236 8237 8238 8239 8240 8241 8242 8243 8244 8245 8246 8247 8248 8249 8250 8251 8252 8253 8254 8255 8256 8257 8258 8259 8260 8261 8262 8263 8264 8265 8266 8267 8268 8269 8270 8271 8272 8273 8274 8275 8276 8277 8278 8279 8280 8281 8282 8283 8284 8285 8286 8287 8288 8289 8290 8291 8292 8293 8294 8295 8296 8297 8298 8299 8300 8301 8302 8303 8304 8305 8306 8307 8308 8309 8310 8311 8312 8313 8314 8315 8316 8317 8318 8319 8320 8321 8322 8323 8324 8325 8326 8327 8328 8329 8330 8331 8332 8333 8334 8335 8336 8337 8338 8339 8340 8341 8342 8343 8344 8345 8346 8347 8348 8349 8350 8351 8352 8353 8354 8355 8356 8357 8358 8359 8360 8361 8362 8363 8364 8365 8366 8367 8368 8369 8370 8371 8372 8373 8374 8375 8376 8377 8378 8379 8380 8381 8382 8383 8384 8385 8386 8387 8388 8389 8390 8391 8392 8393 8394 8395 8396 8397 8398 8399 8400 8401 8402 8403 8404 8405 8406 8407 8408 8409 8410 8411 8412 8413 8414 8415 8416 8417 8418 8419 8420 8421 8422 8423 8424 8425 8426 8427 8428 8429 8430 8431 8432 8433 8434 8435 8436 8437 8438 8439 8440 8441 8442 8443 8444 8445 8446 8447 8448 8449 8450 8451 8452 8453 8454 8455 8456 8457 8458 8459 8460 8461 8462 8463 8464 8465 8466 8467 8468 8469 8470 8471 8472 8473 8474 8475 8476 8477 8478 8479 8480 8481 8482 8483 8484 8485 8486 8487 8488 8489 8490 8491 8492 8493 8494 8495 8496 8497 8498 8499 8500 8501 8502 8503 8504 8505 8506 8507 8508 8509 8510 8511 8512 8513 8514 8515 8516 8517 8518 8519 8520 8521 8522 8523 8524 8525 8526 8527 8528 8529 8530 8531 8532 8533 8534 8535 8536 8537 8538 8539 8540 8541 8542 8543 8544 8545 8546 8547 8548 8549 8550 8551 8552 8553 8554 8555 8556 8557 8558 8559 8560 8561 8562 8563 8564 8565 8566 8567 8568 8569 8570 8571 8572 8573 8574 8575 8576 8577 8578 8579 8580 8581 8582 8583 8584 8585 8586 8587 8588 8589 8590 8591 8592 8593 8594 8595 8596 8597 8598 8599 8600 8601 8602 8603 8604 8605 8606 8607 8608 8609 8610 8611 8612 8613 8614 8615 8616 8617 8618 8619 8620 8621 8622 8623 8624 8625 8626 8627 8628 8629 8630 8631 8632 8633 8634 8635 8636 8637 8638 8639 8640 8641 8642 8643 8644 8645 8646 8647 8648 8649 8650 8651 8652 8653 8654 8655 8656 8657 8658 8659 8660 8661 8662 8663 8664 8665 8666 8667 8668 8669 8670 8671 8672 8673 8674 8675 8676 8677 8678 8679 8680 8681 8682 8683 8684 8685 8686 8687 8688 8689 8690 8691 8692 8693 8694 8695 8696 8697 8698 8699 8700 8701 8702 8703 8704 8705 8706 8707 8708 8709 8710 8711 8712 8713 8714 8715 8716 8717 8718 8719 8720 8721 8722 8723 8724 8725 8726 8727 8728 8729 8730 8731 8732 8733 8734 8735 8736 8737 8738 8739 8740 8741 8742 8743 8744 8745 8746 8747 8748 8749 8750 8751 8752 8753 8754 8755 8756 8757 8758 8759 8760 8761 8762 8763 8764 8765 8766 8767 8768 8769 8770 8771 8772 8773 8774 8775 8776 8777 8778 8779 8780 8781 8782 8783 8784 8785 8786 8787 8788 8789 8790 8791 8792 8793 8794 8795 8796 8797 8798 8799 8800 8801 8802 8803 8804 8805 8806 8807 8808 8809 8810 8811 8812 8813 8814 8815 8816 8817 8818 8819 8820 8821 8822 8823 8824 8825 8826 8827 8828 8829 8830 8831 8832 8833 8834 8835 8836 8837 8838 8839 8840 8841 8842 8843 8844 8845 8846 8847 8848 8849 8850 8851 8852 8853 8854 8855 8856 8857 8858 8859 8860 8861 8862 8863 8864 8865 8866 8867 8868 8869 8870 8871 8872 8873 8874 8875 8876 8877 8878 8879 8880 8881 8882 8883 8884 8885 8886 8887 8888 8889 8890 8891 8892 8893 8894 8895 8896 8897 8898 8899 8900 8901 8902 8903 8904 8905 8906 8907 8908 8909 8910 8911 8912 8913 8914 8915 8916 8917 8918 8919 8920 8921 8922 8923 8924 8925 8926 8927 8928 8929 8930 8931 8932 8933 8934 8935 8936 8937 8938 8939 8940 8941 8942 8943 8944 8945 8946 8947 8948 8949 8950 8951 8952 8953 8954 8955 8956 8957 8958 8959 8960 8961 8962 8963 8964 8965 8966 8967 8968 8969 8970 8971 8972 8973 8974 8975 8976 8977 8978 8979 8980 8981 8982 8983 8984 8985 8986 8987 8988 8989 8990 8991 8992 8993 8994 8995 8996 8997 8998 8999 9000 9001 9002 9003 9004 9005 9006 9007 9008 9009 9010 9011 9012 9013 9014 9015 9016 9017 9018 9019 9020 9021 9022 9023 9024 9025 9026 9027 9028 9029 9030 9031 9032 9033 9034 9035 9036 9037 9038 9039 9040 9041 9042 9043 9044 9045 9046 9047 9048 9049 9050 9051 9052 9053 9054 9055 9056 9057 9058 9059 9060 9061 9062 9063 9064 9065 9066 9067 9068 9069 9070 9071 9072 9073 9074 9075 9076 9077 9078 9079 9080 9081 9082 9083 9084 9085 9086 9087 9088 9089 9090 9091 9092 9093 9094 9095 9096 9097 9098 9099 9100 9101 9102 9103 9104 9105 9106 9107 9108 9109 9110 9111 9112 9113 9114 9115 9116 9117 9118 9119 9120 9121 9122 9123 9124 9125 9126 9127 9128 9129 9130 9131 9132 9133 9134 9135 9136 9137 9138 9139 9140 9141 9142 9143 9144 9145 9146 9147 9148 9149 9150 9151 9152 9153 9154 9155 9156 9157 9158 9159 9160 9161 9162 9163 9164 9165 9166 9167 9168 9169 9170 9171 9172 9173 9174 9175 9176 9177 9178 9179 9180 9181 9182 9183 9184 9185 9186 9187 9188 9189 9190 9191 9192 9193 9194 9195 9196 9197 9198 9199 9200 9201 9202 9203 9204 9205 9206 9207 9208 9209 9210 9211 9212 9213 9214 9215 9216 9217 9218 9219 9220 9221 9222 9223 9224 9225 9226 9227 9228 9229 9230 9231 9232 9233 9234 9235 9236 9237 9238 9239 9240 9241 9242 9243 9244 9245 9246 9247 9248 9249 9250 9251 9252 9253 9254 9255 9256 9257 9258 9259 9260 9261 9262 9263 9264 9265 9266 9267 9268 9269 9270 9271 9272 9273 9274 9275 9276 9277 9278 9279 9280 9281 9282 9283 9284 9285 9286 9287 9288 9289 9290 9291 9292 9293 9294 9295 9296 9297 9298 9299 9300 9301 9302 9303 9304 9305 9306 9307 9308 9309 9310 9311 9312 9313 9314 9315 9316 9317 9318 9319 9320 9321 9322 9323 9324 9325 9326 9327 9328 9329 9330 9331 9332 9333 9334 9335 9336 9337 9338 9339 9340 9341 9342 9343 9344 9345 9346 9347 9348 9349 9350 9351 9352 9353 9354 9355 9356 9357 9358 9359 9360 9361 9362 9363 9364 9365 9366 9367 9368 9369 9370 9371 9372 9373 9374 9375 9376 9377 9378 9379 9380 9381 9382 9383 9384 9385 9386 9387 9388 9389 9390 9391 9392 9393 9394 9395 9396 9397 9398 9399 9400 9401 9402 9403 9404 9405 9406 9407 9408 9409 9410 9411 9412 9413 9414 9415 9416 9417 9418 9419 9420 9421 9422 9423 9424 9425 9426 9427 9428 9429 9430 9431 9432 9433 9434 9435 9436 9437 9438 9439 9440 9441 9442 9443 9444 9445 9446 9447 9448 9449 9450 9451 9452 9453 9454 9455 9456 9457 9458 9459 9460 9461 9462 9463 9464 9465 9466 9467 9468 9469 9470 9471 9472 9473 9474 9475 9476 9477 9478 9479 9480 9481 9482 9483 9484 9485 9486 9487 9488 9489 9490 9491 9492 9493 9494 9495 9496 9497 9498 9499 9500 9501 9502 9503 9504 9505 9506 9507 9508 9509 9510 9511 9512 9513 9514 9515 9516 9517 9518 9519 9520 9521 9522 9523 9524 9525 9526 9527 9528 9529 9530 9531 9532 9533 9534 9535 9536 9537 9538 9539 9540 9541 9542 9543 9544 9545 9546 9547 9548 9549 9550 9551 9552 9553 9554 9555 9556 9557 9558 9559 9560 9561 9562 9563 9564 9565 9566 9567 9568 9569 9570 9571 9572 9573 9574 9575 9576 9577 9578 9579 9580 9581 9582 9583 9584 9585 9586 9587 9588 9589 9590 9591 9592 9593 9594 9595 9596 9597 9598 9599 9600 9601 9602 9603 9604 9605 9606 9607 9608 9609 9610 9611 9612 9613 9614 9615 9616 9617 9618 9619 9620 9621 9622 9623 9624 9625 9626 9627 9628 9629 9630 9631 9632 9633 9634 9635 9636 9637 9638 9639 9640 9641 9642 9643 9644 9645 9646 9647 9648 9649 9650 9651 9652 9653 9654 9655 9656 9657 9658 9659 9660 9661 9662 9663 9664 9665 9666 9667 9668 9669 9670 9671 9672 9673 9674 9675 9676 9677 9678 9679 9680 9681 9682 9683 9684 9685 9686 9687 9688 9689 9690 9691 9692 9693 9694 9695 9696 9697 9698 9699 9700 9701 9702 9703 9704 9705 9706 9707 9708 9709 9710 9711 9712 9713 9714 9715 9716 9717 9718 9719 9720 9721 9722 9723 9724 9725 9726 9727 9728 9729 9730 9731 9732 9733 9734 9735 9736 9737 9738 9739 9740 9741 9742 9743 9744 9745 9746 9747 9748 9749 9750 9751 9752 9753 9754 9755 9756 9757 9758 9759 9760 9761 9762 9763 9764 9765 9766 9767 9768 9769 9770 9771 9772 9773 9774 9775 9776 9777 9778 9779 9780 9781 9782 9783 9784 9785 9786 9787 9788 9789 9790 9791 9792 9793 9794 9795 9796 9797 9798 9799 9800 9801 9802 9803 9804 9805 9806 9807 9808 9809 9810 9811 9812 9813 9814 9815 9816 9817 9818 9819 9820 9821 9822 9823 9824 9825 9826 9827 9828 9829 9830 9831 9832 9833 9834 9835 9836 9837 9838 9839 9840 9841 9842 9843 9844 9845 9846 9847 9848 9849 9850 9851 9852 9853 9854 9855 9856 9857 9858 9859 9860 9861 9862 9863 9864 9865 9866 9867 9868 9869 9870 9871 9872 9873 9874 9875 9876 9877 9878 9879 9880 9881 9882 9883 9884 9885 9886 9887 9888 9889 9890 9891 9892 9893 9894 9895 9896 9897 9898 9899 9900 9901 9902 9903 9904 9905 9906 9907 9908 9909 9910 9911 9912 9913 9914 9915 9916 9917 9918 9919 9920 9921 9922 9923 9924 9925 9926 9927 9928 9929 9930 9931 9932 9933 9934 9935 9936 9937 9938 9939 9940 9941 9942 9943 9944 9945 9946 9947 9948 9949 9950 9951 9952 9953 9954 9955 9956 9957 9958 9959 9960 9961 9962 9963 9964 9965 9966 9967 9968 9969 9970 9971 9972 9973 9974 9975 9976 9977 9978 9979 9980 9981 9982 9983 9984 9985 9986 9987 9988 9989 9990 9991 9992 9993 9994 9995 9996 9997 9998 9999 10000 10001 10002 10003 10004 10005 10006 10007 10008 10009 10010 10011 10012 10013 10014 10015 10016 10017 10018 10019 10020 10021 10022 10023 10024 10025 10026 10027 10028 10029 10030 10031 10032 10033 10034 10035 10036 10037 10038 10039 10040 10041 10042 10043 10044 10045 10046 10047 10048 10049 10050 10051 10052 10053 10054 10055 10056 10057 10058 10059 10060 10061 10062 10063 10064 10065 10066 10067 10068 10069 10070 10071 10072 10073 10074 10075 10076 10077 10078 10079 10080 10081 10082 10083 10084 10085 10086 10087 10088 10089 10090 10091 10092 10093 10094 10095 10096 10097 10098 10099 10100 10101 10102 10103 10104 10105 10106 10107 10108 10109 10110 10111 10112 10113 10114 10115 10116 10117 10118 10119 10120 10121 10122 10123 10124 10125 10126 10127 10128 10129 10130 10131 10132 10133 10134 10135 10136 10137 10138 10139 10140 10141 10142 10143 10144 10145 10146 10147 10148 10149 10150 10151 10152 10153 10154 10155 10156 10157 10158 10159 10160 10161 10162 10163 10164 10165 10166 10167 10168 10169 10170 10171 10172 10173 10174 10175 10176 10177 10178 10179 10180 10181 10182 10183 10184 10185 10186 10187 10188 10189 10190 10191 10192 10193 10194 10195 10196 10197 10198 10199 10200 10201 10202 10203 10204 10205 10206 10207 10208 10209 10210 10211 10212 10213 10214 10215 10216 10217 10218 10219 10220 10221 10222 10223 10224 10225 10226 10227 10228 10229 10230 10231 10232 10233 10234 10235 10236 10237 10238 10239 10240 10241 10242 10243 10244 10245 10246 10247 10248 10249 10250 10251 10252 10253 10254 10255 10256 10257 10258 10259 10260 10261 10262 10263 10264 10265 10266 10267 10268 10269 10270 10271 10272 10273 10274 10275 10276 10277 10278 10279 10280 10281 10282 10283 10284 10285 10286 10287 10288 10289 10290 10291 10292 10293 10294 10295 10296 10297 10298 10299 10300 10301 10302 10303 10304 10305 10306 10307 10308 10309 10310 10311 10312 10313 10314 10315 10316 10317 10318 10319 10320 10321 10322 10323 10324 10325 10326 10327 10328 10329 10330 10331 10332 10333 10334 10335 10336 10337 10338 10339 10340 10341 10342 10343 10344 10345 10346 10347 10348 10349 10350 10351 10352 10353 10354 10355 10356 10357 10358 10359 10360 10361 10362 10363 10364 10365 10366 10367 10368 10369 10370 10371 10372 10373 10374 10375 10376 10377 10378 10379 10380 10381 10382 10383 10384 10385 10386 10387 10388 10389 10390 10391 10392 10393 10394 10395 10396 10397 10398 10399 10400 10401 10402 10403 10404 10405 10406 10407 10408 10409 10410 10411 10412 10413 10414 10415 10416 10417 10418 10419 10420 10421 10422 10423 10424 10425 10426 10427 10428 10429 10430 10431 10432 10433 10434 10435 10436 10437 10438 10439 10440 10441 10442 10443 10444 10445 10446 10447 10448 10449 10450 10451 10452 10453 10454 10455 10456 10457 10458 10459 10460 10461 10462 10463 10464 10465 10466 10467 10468 10469 10470 10471 10472 10473 10474 10475 10476 10477 10478 10479 10480 10481 10482 10483 10484 10485 10486 10487 10488 10489 10490 10491 10492 10493 10494 10495 10496 10497 10498 10499 10500 10501 10502 10503 10504 10505 10506 10507 10508 10509 10510 10511 10512 10513 10514 10515 10516 10517 10518 10519 10520 10521 10522 10523 10524 10525 10526 10527 10528 10529 10530 10531 10532 10533 10534 10535 10536 10537 10538 10539 10540 10541 10542 10543 10544 10545 10546 10547 10548 10549 10550 10551 10552 10553 10554 10555 10556 10557 10558 10559 10560 10561 10562 10563 10564 10565 10566 10567 10568 10569 10570 10571 10572 10573 10574 10575 10576 10577 10578 10579 10580 10581 10582 10583 10584 10585 10586 10587 10588 10589 10590 10591 10592 10593 10594 10595 10596 10597 10598 10599 10600 10601 10602 10603 10604 10605 10606 10607 10608 10609 10610 10611 10612 10613 10614 10615 10616 10617 10618 10619 10620 10621 10622 10623 10624 10625 10626 10627 10628 10629 10630 10631 10632 10633 10634 10635 10636 10637 10638 10639 10640 10641 10642 10643 10644 10645 10646 10647 10648 10649 10650 10651 10652 10653 10654 10655 10656 10657 10658 10659 10660 10661 10662 10663 10664 10665 10666 10667 10668 10669 10670 10671 10672 10673 10674 10675 10676 10677 10678 10679 10680 10681 10682 10683 10684 10685 10686 10687 10688 10689 10690 10691 10692 10693 10694 10695 10696 10697 10698 10699 10700 10701 10702 10703 10704 10705 10706 10707 10708 10709 10710 10711 10712 10713 10714 10715 10716 10717 10718 10719 10720 10721 10722 10723 10724 10725 10726 10727 10728 10729 10730 10731 10732 10733 10734 10735 10736 10737 10738 10739 10740 10741 10742 10743 10744 10745 10746 10747 10748 10749 10750 10751 10752 10753 10754 10755 10756 10757 10758 10759 10760 10761 10762 10763 10764 10765 10766 10767 10768 10769 10770 10771 10772 10773 10774 10775 10776 10777 10778 10779 10780 10781 10782 10783 10784 10785 10786 10787 10788 10789 10790 10791 10792 10793 10794 10795 10796 10797 10798 10799 10800 10801 10802 10803 10804 10805 10806 10807 10808 10809 10810 10811 10812 10813 10814 10815 10816 10817 10818 10819 10820 10821 10822 10823 10824 10825 10826 10827 10828 10829 10830 10831 10832 10833 10834 10835 10836 10837 10838 10839 10840 10841 10842 10843 10844 10845 10846 10847 10848 10849 10850 10851 10852 10853 10854 10855 10856 10857 10858 10859 10860 10861 10862 10863 10864 10865 10866 10867 10868 10869 10870 10871 10872 10873 10874 10875 10876 10877 10878 10879 10880 10881 10882 10883 10884 10885 10886 10887 10888 10889 10890 10891 10892 10893 10894 10895 10896 10897 10898 10899 10900 10901 10902 10903 10904 10905 10906 10907 10908 10909 10910 10911 10912 10913 10914 10915 10916 10917 10918 10919 10920 10921 10922 10923 10924 10925 10926 10927 10928 10929 10930 10931 10932 10933 10934 10935 10936 10937 10938 10939 10940 10941 10942 10943 10944 10945 10946 10947 10948 10949 10950 10951 10952 10953 10954 10955 10956 10957 10958 10959 10960 10961 10962 10963 10964 10965 10966 10967 10968 10969 10970 10971 10972 10973 10974 10975 10976 10977 10978 10979 10980 10981 10982 10983 10984 10985 10986 10987 10988 10989 10990 10991 10992 10993 10994 10995 10996 10997 10998 10999 11000 11001 11002 11003 11004 11005 11006 11007 11008 11009 11010 11011 11012 11013 11014 11015 11016 11017 11018 11019 11020 11021 11022 11023 11024 11025 11026 11027 11028 11029 11030 11031 11032 11033 11034 11035 11036 11037 11038 11039 11040 11041 11042 11043 11044 11045 11046 11047 11048 11049 11050 11051 11052 11053 11054 11055 11056 11057 11058 11059 11060 11061 11062 11063 11064 11065 11066 11067 11068 11069 11070 11071 11072 11073 11074 11075 11076 11077 11078 11079 11080 11081 11082 11083 11084 11085 11086 11087 11088 11089 11090 11091 11092 11093 11094 11095 11096 11097 11098 11099 11100 11101 11102 11103 11104 11105 11106 11107 11108 11109 11110 11111 11112 11113 11114 11115 11116 11117 11118 11119 11120 11121 11122 11123 11124 11125 11126 11127 11128 11129 11130 11131 11132 11133 11134 11135 11136 11137 11138 11139 11140 11141 11142 11143 11144 11145 11146 11147 11148 11149 11150 11151 11152 11153 11154 11155 11156 11157 11158 11159 11160 11161 11162 11163 11164 11165 11166 11167 11168 11169 11170 11171 11172 11173 11174 11175 11176 11177 11178 11179 11180 11181 11182 11183 11184 11185 11186 11187 11188 11189 11190 11191 11192 11193 11194 11195 11196 11197 11198 11199 11200 11201 11202 11203 11204 11205 11206 11207 11208 11209 11210 11211 11212 11213 11214 11215 11216 11217 11218 11219 11220 11221 11222 11223 11224 11225 11226 11227 11228 11229 11230 11231 11232 11233 11234 11235 11236 11237 11238 11239 11240 11241 11242 11243 11244 11245 11246 11247 11248 11249 11250 11251 11252 11253 11254 11255 11256 11257 11258 11259 11260 11261 11262 11263 11264 11265 11266 11267 11268 11269 11270 11271 11272 11273 11274 11275 11276 11277 11278 11279 11280 11281 11282 11283 11284 11285 11286 11287 11288 11289 11290 11291 11292 11293 11294 11295 11296 11297 11298 11299 11300 11301 11302 11303 11304 11305 11306 11307 11308 11309 11310 11311 11312 11313 11314 11315 11316 11317 11318 11319 11320 11321 11322 11323 11324 11325 11326 11327 11328 11329 11330 11331 11332 11333 11334 11335 11336 11337 11338 11339 11340 11341 11342 11343 11344 11345 11346 11347 11348 11349 11350 11351 11352 11353 11354 11355 11356 11357 11358 11359 11360 11361 11362 11363 11364 11365 11366 11367 11368 11369 11370 11371 11372 11373 11374 11375 11376 11377 11378 11379 11380 11381 11382 11383 11384 11385 11386 11387 11388 11389 11390 11391 11392 11393 11394 11395 11396 11397 11398 11399 11400 11401 11402 11403 11404 11405 11406 11407 11408 11409 11410 11411 11412 11413 11414 11415 11416 11417 11418 11419 11420 11421 11422 11423 11424 11425 11426 11427 11428 11429 11430 11431 11432 11433 11434 11435 11436 11437 11438 11439 11440 11441 11442 11443 11444 11445 11446 11447 11448 11449 11450 11451 11452 11453 11454 11455 11456 11457 11458 11459 11460 11461 11462 11463 11464 11465 11466 11467 11468 11469 11470 11471 11472 11473 11474 11475 11476 11477 11478 11479 11480 11481 11482 11483 11484 11485 11486 11487 11488 11489 11490 11491 11492 11493 11494 11495 11496 11497 11498 11499 11500 11501 11502 11503 11504 11505 11506 11507 11508 11509 11510 11511 11512 11513 11514 11515 11516 11517 11518 11519 11520 11521 11522 11523 11524 11525 11526 11527 11528 11529 11530 11531 11532 11533 11534 11535 11536 11537 11538 11539 11540 11541 11542 11543 11544 11545 11546 11547 11548 11549 11550 11551 11552 11553 11554 11555 11556 11557 11558 11559 11560 11561 11562 11563 11564 11565 11566 11567 11568 11569 11570 11571 11572 11573 11574 11575 11576 11577 11578 11579 11580 11581 11582 11583 11584 11585 11586 11587 11588 11589 11590 11591 11592 11593 11594 11595 11596 11597 11598 11599 11600 11601 11602 11603 11604 11605 11606 11607 11608 11609 11610 11611 11612 11613 11614 11615 11616 11617 11618 11619 11620 11621 11622 11623 11624 11625 11626 11627 11628 11629 11630 11631 11632 11633 11634 11635 11636 11637 11638 11639 11640 11641 11642 11643 11644 11645 11646 11647 11648 11649 11650 11651 11652 11653 11654 11655 11656 11657 11658 11659 11660 11661 11662 11663 11664 11665 11666 11667 11668 11669 11670 11671 11672 11673 11674 11675 11676 11677 11678 11679 11680 11681 11682 11683 11684 11685 11686 11687 11688 11689 11690 11691 11692 11693 11694 11695 11696 11697 11698 11699 11700 11701 11702 11703 11704 11705 11706 11707 11708 11709 11710 11711 11712 11713 11714 11715 11716 11717 11718 11719 11720 11721 11722 11723 11724 11725 11726 11727 11728 11729 11730 11731 11732 11733 11734 11735 11736 11737 11738 11739 11740 11741 11742 11743 11744 11745 11746 11747 11748 11749 11750 11751 11752 11753 11754 11755 11756 11757 11758 11759 11760 11761 11762 11763 11764 11765 11766 11767 11768 11769 11770 11771 11772 11773 11774 11775 11776 11777 11778 11779 11780 11781 11782 11783 11784 11785 11786 11787 11788 11789 11790 11791 11792 11793 11794 11795 11796 11797 11798 11799 11800 11801 11802 11803 11804 11805 11806 11807 11808 11809 11810 11811 11812 11813 11814 11815 11816 11817 11818 11819 11820 11821 11822 11823 11824 11825 11826 11827 11828 11829 11830 11831 11832 11833 11834 11835 11836 11837 11838 11839 11840 11841 11842 11843 11844 11845 11846 11847 11848 11849 11850 11851 11852 11853 11854 11855 11856 11857 11858 11859 11860 11861 11862 11863 11864 11865 11866 11867 11868 11869 11870 11871 11872 11873 11874 11875 11876 11877 11878 11879 11880 11881 11882 11883 11884 11885 11886 11887 11888 11889 11890 11891 11892 11893 11894 11895 11896 11897 11898 11899 11900 11901 11902 11903 11904 11905 11906 11907 11908 11909 11910 11911 11912 11913 11914 11915 11916 11917 11918 11919 11920 11921 11922 11923 11924 11925 11926 11927 11928 11929 11930 11931 11932 11933 11934 11935 11936 11937 11938 11939 11940 11941 11942 11943 11944 11945 11946 11947 11948 11949 11950 11951 11952 11953 11954 11955 11956 11957 11958 11959 11960 11961 11962 11963 11964 11965 11966 11967 11968 11969 11970 11971 11972 11973 11974 11975 11976 11977 11978 11979 11980 11981 11982 11983 11984 11985 11986 11987 11988 11989 11990 11991 11992 11993 11994 11995 11996 11997 11998 11999 12000 12001 12002 12003 12004 12005 12006 12007 12008 12009 12010 12011 12012 12013 12014 12015 12016 12017 12018 12019 12020 12021 12022 12023 12024 12025 12026 12027 12028 12029 12030 12031 12032 12033 12034 12035 12036 12037 12038 12039 12040 12041 12042 12043 12044 12045 12046 12047 12048 12049 12050 12051 12052 12053 12054 12055 12056 12057 12058 12059 12060 12061 12062 12063 12064 12065 12066 12067 12068 12069 12070 12071 12072 12073 12074 12075 12076 12077 12078 12079 12080 12081 12082 12083 12084 12085 12086 12087 12088 12089 12090 12091 12092 12093 12094 12095 12096 12097 12098 12099 12100 12101 12102 12103 12104 12105 12106 12107 12108 12109 12110 12111 12112 12113 12114 12115 12116 12117 12118 12119 12120 12121 12122 12123 12124 12125 12126 12127 12128 12129 12130 12131 12132 12133 12134 12135 12136 12137 12138 12139 12140 12141 12142 12143 12144 12145 12146 12147 12148 12149 12150 12151 12152 12153 12154 12155 12156 12157 12158 12159 12160 12161 12162 12163 12164 12165 12166 12167 12168 12169 12170 12171 12172 12173 12174 12175 12176 12177 12178 12179 12180 12181 12182 12183 12184 12185 12186 12187 12188 12189 12190 12191 12192 12193 12194 12195 12196 12197 12198 12199 12200 12201 12202 12203 12204 12205 12206 12207 12208 12209 12210 12211 12212 12213 12214 12215 12216 12217 12218 12219 12220 12221 12222 12223 12224 12225 12226 12227 12228 12229 12230 12231 12232 12233 12234 12235 12236 12237 12238 12239 12240 12241 12242 12243 12244 12245 12246 12247 12248 12249 12250 12251 12252 12253 12254 12255 12256 12257 12258 12259 12260 12261 12262 12263 12264 12265 12266 12267 12268 12269 12270 12271 12272 12273 12274 12275 12276 12277 12278 12279 12280 12281 12282 12283 12284 12285 12286 12287 12288 12289 12290 12291 12292 12293 12294 12295 12296 12297 12298 12299 12300 12301 12302 12303 12304 12305 12306 12307 12308 12309 12310 12311 12312 12313 12314 12315 12316 12317 12318 12319 12320 12321 12322 12323 12324 12325 12326 12327 12328 12329 12330 12331 12332 12333 12334 12335 12336 12337 12338 12339 12340 12341 12342 12343 12344 12345 12346 12347 12348 12349 12350 12351 12352 12353 12354 12355 12356 12357 12358 12359 12360 12361 12362 12363 12364 12365 12366 12367 12368 12369 12370 12371 12372 12373 12374 12375 12376 12377 12378 12379 12380 12381 12382 12383 12384 12385 12386 12387 12388 12389 12390 12391 12392 12393 12394 12395 12396 12397 12398 12399 12400 12401 12402 12403 12404 12405 12406 12407 12408 12409 12410 12411 12412 12413 12414 12415 12416 12417 12418 12419 12420 12421 12422 12423 12424 12425 12426 12427 12428 12429 12430 12431 12432 12433 12434 12435 12436 12437 12438 12439 12440 12441 12442 12443 12444 12445 12446 12447 12448 12449 12450 12451 12452 12453 12454 12455 12456 12457 12458 12459 12460 12461 12462 12463 12464 12465 12466 12467 12468 12469 12470 12471 12472 12473 12474 12475 12476 12477 12478 12479 12480 12481 12482 12483 12484 12485 12486 12487 12488 12489 12490 12491 12492 12493 12494 12495 12496 12497 12498 12499 12500 12501 12502 12503 12504 12505 12506 12507 12508 12509 12510 12511 12512 12513 12514 12515 12516 12517 12518 12519 12520 12521 12522 12523 12524 12525 12526 12527 12528 12529 12530 12531 12532 12533 12534 12535 12536 12537 12538 12539 12540 12541 12542 12543 12544 12545 12546 12547 12548 12549 12550 12551 12552 12553 12554 12555 12556 12557 12558 12559 12560 12561 12562 12563 12564 12565 12566 12567 12568 12569 12570 12571 12572 12573 12574 12575 12576 12577 12578 12579 12580 12581 12582 12583 12584 12585 12586 12587 12588 12589 12590 12591 12592 12593 12594 12595 12596 12597 12598 12599 12600 12601 12602 12603 12604 12605 12606 12607 12608 12609 12610 12611 12612 12613 12614 12615 12616 12617 12618 12619 12620 12621 12622 12623 12624 12625 12626 12627 12628 12629 12630 12631 12632 12633 12634 12635 12636 12637 12638 12639 12640 12641 12642 12643 12644 12645 12646 12647 12648 12649 12650 12651 12652 12653 12654 12655 12656 12657 12658 12659 12660 12661 12662 12663 12664 12665 12666 12667 12668 12669 12670 12671 12672 12673 12674 12675 12676 12677 12678 12679 12680 12681 12682 12683 12684 12685 12686 12687 12688 12689 12690 12691 12692 12693 12694 12695 12696 12697 12698 12699 12700 12701 12702 12703 12704 12705 12706 12707 12708 12709 12710 12711 12712 12713 12714 12715 12716 12717 12718 12719 12720 12721 12722 12723 12724 12725 12726 12727 12728 12729 12730 12731 12732 12733 12734 12735 12736 12737 12738 12739 12740 12741 12742 12743 12744 12745 12746 12747 12748 12749 12750 12751 12752 12753 12754 12755 12756 12757 12758 12759 12760 12761 12762 12763 12764 12765 12766 12767 12768 12769 12770 12771 12772 12773 12774 12775 12776 12777 12778 12779 12780 12781 12782 12783 12784 12785 12786 12787 12788 12789 12790 12791 12792 12793 12794 12795 12796 12797 12798 12799 12800 12801 12802 12803 12804 12805 12806 12807 12808 12809 12810 12811 12812 12813 12814 12815 12816 12817 12818 12819 12820 12821 12822 12823 12824 12825 12826 12827 12828 12829 12830 12831 12832 12833 12834 12835 12836 12837 12838 12839 12840 12841 12842 12843 12844 12845 12846 12847 12848 12849 12850 12851 12852 12853 12854 12855 12856 12857 12858 12859 12860 12861 12862 12863 12864 12865 12866 12867 12868 12869 12870 12871 12872 12873 12874 12875 12876 12877 12878 12879 12880 12881 12882 12883 12884 12885 12886 12887 12888 12889 12890 12891 12892 12893 12894 12895 12896 12897 12898 12899 12900 12901 12902 12903 12904 12905 12906 12907 12908 12909 12910 12911 12912 12913 12914 12915 12916 12917 12918 12919 12920 12921 12922 12923 12924 12925 12926 12927 12928 12929 12930 12931 12932 12933 12934 12935 12936 12937 12938 12939 12940 12941 12942 12943 12944 12945 12946 12947 12948 12949 12950 12951 12952 12953 12954 12955 12956 12957 12958 12959 12960 12961 12962 12963 12964 12965 12966 12967 12968 12969 12970 12971 12972 12973 12974 12975 12976 12977 12978 12979 12980 12981 12982 12983 12984 12985 12986 12987 12988 12989 12990 12991 12992 12993 12994 12995 12996 12997 12998 12999 13000 13001 13002 13003 13004 13005 13006 13007 13008 13009 13010 13011 13012 13013 13014 13015 13016 13017 13018 13019 13020 13021 13022 13023 13024 13025 13026 13027 13028 13029 13030 13031 13032 13033 13034 13035 13036 13037 13038 13039 13040 13041 13042 13043 13044 13045 13046 13047 13048 13049 13050 13051 13052 13053 13054 13055 13056 13057 13058 13059 13060 13061 13062 13063 13064 13065 13066 13067 13068 13069 13070 13071 13072 13073 13074 13075 13076 13077 13078 13079 13080 13081 13082 13083 13084 13085 13086 13087 13088 13089 13090 13091 13092 13093 13094 13095 13096 13097 13098 13099 13100 13101 13102 13103 13104 13105 13106 13107 13108 13109 13110 13111 13112 13113 13114 13115 13116 13117 13118 13119 13120 13121 13122 13123 13124 13125 13126 13127 13128 13129 13130 13131 13132 13133 13134 13135 13136 13137 13138 13139 13140 13141 13142 13143 13144 13145 13146 13147 13148 13149 13150 13151 13152 13153 13154 13155 13156 13157 13158 13159 13160 13161 13162 13163 13164 13165 13166 13167 13168 13169 13170 13171 13172 13173 13174 13175 13176 13177 13178 13179 13180 13181 13182 13183 13184 13185 13186 13187 13188 13189 13190 13191 13192 13193 13194 13195 13196 13197 13198 13199 13200 13201 13202 13203 13204 13205 13206 13207 13208 13209 13210 13211 13212 13213 13214 13215 13216 13217 13218 13219 13220 13221 13222 13223 13224 13225 13226 13227 13228 13229 13230 13231 13232 13233 13234 13235 13236 13237 13238 13239 13240 13241 13242 13243 13244 13245 13246 13247 13248 13249 13250 13251 13252 13253 13254 13255 13256 13257 13258 13259 13260 13261 13262 13263 13264 13265 13266 13267 13268 13269 13270 13271 13272 13273 13274 13275 13276 13277 13278 13279 13280 13281 13282 13283 13284 13285 13286 13287 13288 13289 13290 13291 13292 13293 13294 13295 13296 13297 13298 13299 13300 13301 13302 13303 13304 13305 13306 13307 13308 13309 13310 13311 13312 13313 13314 13315 13316 13317 13318 13319 13320 13321 13322 13323 13324 13325 13326 13327 13328 13329 13330 13331 13332 13333 13334 13335 13336 13337 13338 13339 13340 13341 13342 13343 13344 13345 13346 13347 13348 13349 13350 13351 13352 13353 13354 13355 13356 13357 13358 13359 13360 13361 13362 13363 13364 13365 13366 13367 13368 13369 13370 13371 13372 13373 13374 13375 13376 13377 13378 13379 13380 13381 13382 13383 13384 13385 13386 13387 13388 13389 13390 13391 13392 13393 13394 13395 13396 13397 13398 13399 13400 13401 13402 13403 13404 13405 13406 13407 13408 13409 13410 13411 13412 13413 13414 13415 13416 13417 13418 13419 13420 13421 13422 13423 13424 13425 13426 13427 13428 13429 13430 13431 13432 13433 13434 13435 13436 13437 13438 13439 13440 13441 13442 13443 13444 13445 13446 13447 13448 13449 13450 13451 13452 13453 13454 13455 13456 13457 13458 13459 13460 13461 13462 13463 13464 13465 13466 13467 13468 13469 13470 13471 13472 13473 13474 13475 13476 13477 13478 13479 13480 13481 13482 13483 13484 13485 13486 13487 13488 13489 13490 13491 13492 13493 13494 13495 13496 13497 13498 13499 13500 13501 13502 13503 13504 13505 13506 13507 13508 13509 13510 13511 13512 13513 13514 13515 13516 13517 13518 13519 13520 13521 13522 13523 13524 13525 13526 13527 13528 13529 13530 13531 13532 13533 13534 13535 13536 13537 13538 13539 13540 13541 13542 13543 13544 13545 13546 13547 13548 13549 13550 13551 13552 13553 13554 13555 13556 13557 13558 13559 13560 13561 13562 13563 13564 13565 13566 13567 13568 13569 13570 13571 13572 13573 13574 13575 13576 13577 13578 13579 13580 13581 13582 13583 13584 13585 13586 13587 13588 13589 13590 13591 13592 13593 13594 13595 13596 13597 13598 13599 13600 13601 13602 13603 13604 13605 13606 13607 13608 13609 13610 13611 13612 13613 13614 13615 13616 13617 13618 13619 13620 13621 13622 13623 13624 13625 13626 13627 13628 13629 13630 13631 13632 13633 13634 13635 13636 13637 13638 13639 13640 13641 13642 13643 13644 13645 13646 13647 13648 13649 13650 13651 13652 13653 13654 13655 13656 13657 13658 13659 13660 13661 13662 13663 13664 13665 13666 13667 13668 13669 13670 13671 13672 13673 13674 13675 13676 13677 13678 13679 13680 13681 13682 13683 13684 13685 13686 13687 13688 13689 13690 13691 13692 13693 13694 13695 13696 13697 13698 13699 13700 13701 13702 13703 13704 13705 13706 13707 13708 13709 13710 13711 13712 13713 13714 13715 13716 13717 13718 13719 13720 13721 13722 13723 13724 13725 13726 13727 13728 13729 13730 13731 13732 13733 13734 13735 13736 13737 13738 13739 13740 13741 13742 13743 13744 13745 13746 13747 13748 13749 13750 13751 13752 13753 13754 13755 13756 13757 13758 13759 13760 13761 13762 13763 13764 13765 13766 13767 13768 13769 13770 13771 13772 13773 13774 13775 13776 13777 13778 13779 13780 13781 13782 13783 13784 13785 13786 13787 13788 13789 13790 13791 13792 13793 13794 13795 13796 13797 13798 13799 13800 13801 13802 13803 13804 13805 13806 13807 13808 13809 13810 13811 13812 13813 13814 13815 13816 13817 13818 13819 13820 13821 13822 13823 13824 13825 13826 13827 13828 13829 13830 13831 13832 13833 13834 13835 13836 13837 13838 13839 13840 13841 13842 13843 13844 13845 13846 13847 13848 13849 13850 13851 13852 13853 13854 13855 13856 13857 13858 13859 13860 13861 13862 13863 13864 13865 13866 13867 13868 13869 13870 13871 13872 13873 13874 13875 13876 13877 13878 13879 13880 13881 13882 13883 13884 13885 13886 13887 13888 13889 13890 13891 13892 13893 13894 13895 13896 13897 13898 13899 13900 13901 13902 13903 13904 13905 13906 13907 13908 13909 13910 13911 13912 13913 13914 13915 13916 13917 13918 13919 13920 13921 13922 13923 13924 13925 13926 13927 13928 13929 13930 13931 13932 13933 13934 13935 13936 13937 13938 13939 13940 13941 13942 13943 13944 13945 13946 13947 13948 13949 13950 13951 13952 13953 13954 13955 13956 13957 13958 13959 13960 13961 13962 13963 13964 13965 13966 13967 13968 13969 13970 13971 13972 13973 13974 13975 13976 13977 13978 13979 13980 13981 13982 13983 13984 13985 13986 13987 13988 13989 13990 13991 13992 13993 13994 13995 13996 13997 13998 13999 14000 14001 14002 14003 14004 14005 14006 14007 14008 14009 14010 14011 14012 14013 14014 14015 14016 14017 14018 14019 14020 14021 14022 14023 14024 14025 14026 14027 14028 14029 14030 14031 14032 14033 14034 14035 14036 14037 14038 14039 14040 14041 14042 14043 14044 14045 14046 14047 14048 14049 14050 14051 14052 14053 14054 14055 14056 14057 14058 14059 14060 14061 14062 14063 14064 14065 14066 14067 14068 14069 14070 14071 14072 14073 14074 14075 14076 14077 14078 14079 14080 14081 14082 14083 14084 14085 14086 14087 14088 14089 14090 14091 14092 14093 14094 14095 14096 14097 14098 14099 14100 14101 14102 14103 14104 14105 14106 14107 14108 14109 14110 14111 14112 14113 14114 14115 14116 14117 14118 14119 14120 14121 14122 14123 14124 14125 14126 14127 14128 14129 14130 14131 14132 14133 14134 14135 14136 14137 14138 14139 14140 14141 14142 14143 14144 14145 14146 14147 14148 14149 14150 14151 14152 14153 14154 14155 14156 14157 14158 14159 14160 14161 14162 14163 14164 14165 14166 14167 14168 14169 14170 14171 14172 14173 14174 14175 14176 14177 14178 14179 14180 14181 14182 14183 14184 14185 14186 14187 14188 14189 14190 14191 14192 14193 14194 14195 14196 14197 14198 14199 14200 14201 14202 14203 14204 14205 14206 14207 14208 14209 14210 14211 14212 14213 14214 14215 14216 14217 14218 14219 14220 14221 14222 14223 14224 14225 14226 14227 14228 14229 14230 14231 14232 14233 14234 14235 14236 14237 14238 14239 14240 14241 14242 14243 14244 14245 14246 14247 14248 14249 14250 14251 14252 14253 14254 14255 14256 14257 14258 14259 14260 14261 14262 14263 14264 14265 14266 14267 14268 14269 14270 14271 14272 14273 14274 14275 14276 14277 14278 14279 14280 14281 14282 14283 14284 14285 14286 14287 14288 14289 14290 14291 14292 14293 14294 14295 14296 14297 14298 14299 14300 14301 14302 14303 14304 14305 14306 14307 14308 14309 14310 14311 14312 14313 14314 14315 14316 14317 14318 14319 14320 14321 14322 14323 14324 14325 14326 14327 14328 14329 14330 14331 14332 14333 14334 14335 14336 14337 14338 14339 14340 14341 14342 14343 14344 14345 14346 14347 14348 14349 14350 14351 14352 14353 14354 14355 14356 14357 14358 14359 14360 14361 14362 14363 14364 14365 14366 14367 14368 14369 14370 14371 14372 14373 14374 14375 14376 14377 14378 14379 14380 14381 14382 14383 14384 14385 14386 14387 14388 14389 14390 14391 14392 14393 14394 14395 14396 14397 14398 14399 14400 14401 14402 14403 14404 14405 14406 14407 14408 14409 14410 14411 14412 14413 14414 14415 14416 14417 14418 14419 14420 14421 14422 14423 14424 14425 14426 14427 14428 14429 14430 14431 14432 14433 14434 14435 14436 14437 14438 14439 14440 14441 14442 14443 14444 14445 14446 14447 14448 14449 14450 14451 14452 14453 14454 14455 14456 14457 14458 14459 14460 14461 14462 14463 14464 14465 14466 14467 14468 14469 14470 14471 14472 14473 14474 14475 14476 14477 14478 14479 14480 14481 14482 14483 14484 14485 14486 14487 14488 14489 14490 14491 14492 14493 14494 14495 14496 14497 14498 14499 14500 14501 14502 14503 14504 14505 14506 14507 14508 14509 14510 14511 14512 14513 14514 14515 14516 14517 14518 14519 14520 14521 14522 14523 14524 14525 14526 14527 14528 14529 14530 14531 14532 14533 14534 14535 14536 14537 14538 14539 14540 14541 14542 14543 14544 14545 14546 14547 14548 14549 14550 14551 14552 14553 14554 14555 14556 14557 14558 14559 14560 14561 14562 14563 14564 14565 14566 14567 14568 14569 14570 14571 14572 14573 14574 14575 14576 14577 14578 14579 14580 14581 14582 14583 14584 14585 14586 14587 14588 14589 14590 14591 14592 14593 14594 14595 14596 14597 14598 14599 14600 14601 14602 14603 14604 14605 14606 14607 14608 14609 14610 14611 14612 14613 14614 14615 14616 14617 14618 14619 14620 14621 14622 14623 14624 14625 14626 14627 14628 14629 14630 14631 14632 14633 14634 14635 14636 14637 14638 14639 14640 14641 14642 14643 14644 14645 14646 14647 14648 14649 14650 14651 14652 14653 14654 14655 14656 14657 14658 14659 14660 14661 14662 14663 14664 14665 14666 14667 14668 14669 14670 14671 14672 14673 14674 14675 14676 14677 14678 14679 14680 14681 14682 14683 14684 14685 14686 14687 14688 14689 14690 14691 14692 14693 14694 14695 14696 14697 14698 14699 14700 14701 14702 14703 14704 14705 14706 14707 14708 14709 14710 14711 14712 14713 14714 14715 14716 14717 14718 14719 14720 14721 14722 14723 14724 14725 14726 14727 14728 14729 14730 14731 14732 14733 14734 14735 14736 14737 14738 14739 14740 14741 14742 14743 14744 14745 14746 14747 14748 14749 14750 14751 14752 14753 14754 14755 14756 14757 14758 14759 14760 14761 14762 14763 14764 14765 14766 14767 14768 14769 14770 14771 14772 14773 14774 14775 14776 14777 14778 14779 14780 14781 14782 14783 14784 14785 14786 14787 14788 14789 14790 14791 14792 14793 14794 14795 14796 14797 14798 14799 14800 14801 14802 14803 14804 14805 14806 14807 14808 14809 14810 14811 14812 14813 14814 14815 14816 14817 14818 14819 14820 14821 14822 14823 14824 14825 14826 14827 14828 14829 14830 14831 14832 14833 14834 14835 14836 14837 14838 14839 14840 14841 14842 14843 14844 14845 14846 14847 14848 14849 14850 14851 14852 14853 14854 14855 14856 14857 14858 14859 14860 14861 14862 14863 14864 14865 14866 14867 14868 14869 14870 14871 14872 14873 14874 14875 14876 14877 14878 14879 14880 14881 14882 14883 14884 14885 14886 14887 14888 14889 14890 14891 14892 14893 14894 14895 14896 14897 14898 14899 14900 14901 14902 14903 14904 14905 14906 14907 14908 14909 14910 14911 14912 14913 14914 14915 14916 14917 14918 14919 14920 14921 14922 14923 14924 14925 14926 14927 14928 14929 14930 14931 14932 14933 14934 14935 14936 14937 14938 14939 14940 14941 14942 14943 14944 14945 14946 14947 14948 14949 14950 14951 14952 14953 14954 14955 14956 14957 14958 14959 14960 14961 14962 14963 14964 14965 14966 14967 14968 14969 14970 14971 14972 14973 14974 14975 14976 14977 14978 14979 14980 14981 14982 14983 14984 14985 14986 14987 14988 14989 14990 14991 14992 14993 14994 14995 14996 14997 14998 14999 15000 15001 15002 15003 15004 15005 15006 15007 15008 15009 15010 15011 15012 15013 15014 15015 15016 15017 15018 15019 15020 15021 15022 15023 15024 15025 15026 15027 15028 15029 15030 15031 15032 15033 15034 15035 15036 15037 15038 15039 15040 15041 15042 15043 15044 15045 15046 15047 15048 15049 15050 15051 15052 15053 15054 15055 15056 15057 15058 15059 15060 15061 15062 15063 15064 15065 15066 15067 15068 15069 15070 15071 15072 15073 15074 15075 15076 15077 15078 15079 15080 15081 15082 15083 15084 15085 15086 15087 15088 15089 15090 15091 15092 15093 15094 15095 15096 15097 15098 15099 15100 15101 15102 15103 15104 15105 15106 15107 15108 15109 15110 15111 15112 15113 15114 15115 15116 15117 15118 15119 15120 15121 15122 15123 15124 15125 15126 15127 15128 15129 15130 15131 15132 15133 15134 15135 15136 15137 15138 15139 15140 15141 15142 15143 15144 15145 15146 15147 15148 15149 15150 15151 15152 15153 15154 15155 15156 15157 15158 15159 15160 15161 15162 15163 15164 15165 15166 15167 15168 15169 15170 15171 15172 15173 15174 15175 15176 15177 15178 15179 15180 15181 15182 15183 15184 15185 15186 15187 15188 15189 15190 15191 15192 15193 15194 15195 15196 15197 15198 15199 15200 15201 15202 15203 15204 15205 15206 15207 15208 15209 15210 15211 15212 15213 15214 15215 15216 15217 15218 15219 15220 15221 15222 15223 15224 15225 15226 15227 15228 15229 15230 15231 15232 15233 15234 15235 15236 15237 15238 15239 15240 15241 15242 15243 15244 15245 15246 15247 15248 15249 15250 15251 15252 15253 15254 15255 15256 15257 15258 15259 15260 15261 15262 15263 15264 15265 15266 15267 15268 15269 15270 15271 15272 15273 15274 15275 15276 15277 15278 15279 15280 15281 15282 15283 15284 15285 15286 15287 15288 15289 15290 15291 15292 15293 15294 15295 15296 15297 15298 15299 15300 15301 15302 15303 15304 15305 15306 15307 15308 15309 15310 15311 15312 15313 15314 15315 15316 15317 15318 15319 15320 15321 15322 15323 15324 15325 15326 15327 15328 15329 15330 15331 15332 15333 15334 15335 15336 15337 15338 15339 15340 15341 15342 15343 15344 15345 15346 15347 15348 15349 15350 15351 15352 15353 15354 15355 15356 15357 15358 15359 15360 15361 15362 15363 15364 15365 15366 15367 15368 15369 15370 15371 15372 15373 15374 15375 15376 15377 15378 15379 15380 15381 15382 15383 15384 15385 15386 15387 15388 15389 15390 15391 15392 15393 15394 15395 15396 15397 15398 15399 15400 15401 15402 15403 15404 15405 15406 15407 15408 15409 15410 15411 15412 15413 15414 15415 15416 15417 15418 15419 15420 15421 15422 15423 15424 15425 15426 15427 15428 15429 15430 15431 15432 15433 15434 15435 15436 15437 15438 15439 15440 15441 15442 15443 15444 15445 15446 15447 15448 15449 15450 15451 15452 15453 15454 15455 15456 15457 15458 15459 15460 15461 15462 15463 15464 15465 15466 15467 15468 15469 15470 15471 15472 15473 15474 15475 15476 15477 15478 15479 15480 15481 15482 15483 15484 15485 15486 15487 15488 15489 15490 15491 15492 15493 15494 15495 15496 15497 15498 15499 15500 15501 15502 15503 15504 15505 15506 15507 15508 15509 15510 15511 15512 15513 15514 15515 15516 15517 15518 15519 15520 15521 15522 15523 15524 15525 15526 15527 15528 15529 15530 15531 15532 15533 15534 15535 15536 15537 15538 15539 15540 15541 15542 15543 15544 15545 15546 15547 15548 15549 15550 15551 15552 15553 15554 15555 15556 15557 15558 15559 15560 15561 15562 15563 15564 15565 15566 15567 15568 15569 15570 15571 15572 15573 15574 15575 15576 15577 15578 15579 15580 15581 15582 15583 15584 15585 15586 15587 15588 15589 15590 15591 15592 15593 15594 15595 15596 15597 15598 15599 15600 15601 15602 15603 15604 15605 15606 15607 15608 15609 15610 15611 15612 15613 15614 15615 15616 15617 15618 15619 15620 15621 15622 15623 15624 15625 15626 15627 15628 15629 15630 15631 15632 15633 15634 15635 15636 15637 15638 15639 15640 15641 15642 15643 15644 15645 15646 15647 15648 15649 15650 15651 15652 15653 15654 15655 15656 15657 15658 15659 15660 15661 15662 15663 15664 15665 15666 15667 15668 15669 15670 15671 15672 15673 15674 15675 15676 15677 15678 15679 15680 15681 15682 15683 15684 15685 15686 15687 15688 15689 15690 15691 15692 15693 15694 15695 15696 15697 15698 15699 15700 15701 15702 15703 15704 15705 15706 15707 15708 15709 15710 15711 15712 15713 15714 15715 15716 15717 15718 15719 15720 15721 15722 15723 15724 15725 15726 15727 15728 15729 15730 15731 15732 15733 15734 15735 15736 15737 15738 15739 15740 15741 15742 15743 15744 15745 15746 15747 15748 15749 15750 15751 15752 15753 15754 15755 15756 15757 15758 15759 15760 15761 15762 15763 15764 15765 15766 15767 15768 15769 15770 15771 15772 15773 15774 15775 15776 15777 15778 15779 15780 15781 15782 15783 15784 15785 15786 15787 15788 15789 15790 15791 15792 15793 15794 15795 15796 15797 15798 15799 15800 15801 15802 15803 15804 15805 15806 15807 15808 15809 15810 15811 15812 15813 15814 15815 15816 15817 15818 15819 15820 15821 15822 15823 15824 15825 15826 15827 15828 15829 15830 15831 15832 15833 15834 15835 15836 15837 15838 15839 15840 15841 15842 15843 15844 15845 15846 15847 15848 15849 15850 15851 15852 15853 15854 15855 15856 15857 15858 15859 15860 15861 15862 15863 15864 15865 15866 15867 15868 15869 15870 15871 15872 15873 15874 15875 15876 15877 15878 15879 15880 15881 15882 15883 15884 15885 15886 15887 15888 15889 15890 15891 15892 15893 15894 15895 15896 15897 15898 15899 15900 15901 15902 15903 15904 15905 15906 15907 15908 15909 15910 15911 15912 15913 15914 15915 15916 15917 15918 15919 15920 15921 15922 15923 15924 15925 15926 15927 15928 15929 15930 15931 15932 15933 15934 15935 15936 15937 15938 15939 15940 15941 15942 15943 15944 15945 15946 15947 15948 15949 15950 15951 15952 15953 15954 15955 15956 15957 15958 15959 15960 15961 15962 15963 15964 15965 15966 15967 15968 15969 15970 15971 15972 15973 15974 15975 15976 15977 15978 15979 15980 15981 15982 15983 15984 15985 15986 15987 15988 15989 15990 15991 15992 15993 15994 15995 15996 15997 15998 15999 16000 16001 16002 16003 16004 16005 16006 16007 16008 16009 16010 16011 16012 16013 16014 16015 16016 16017 16018 16019 16020 16021 16022 16023 16024 16025 16026 16027 16028 16029 16030 16031 16032 16033 16034 16035 16036 16037 16038 16039 16040 16041 16042 16043 16044 16045 16046 16047 16048 16049 16050 16051 16052 16053 16054 16055 16056 16057 16058 16059 16060 16061 16062 16063 16064 16065 16066 16067 16068 16069 16070 16071 16072 16073 16074 16075 16076 16077 16078 16079 16080 16081 16082 16083 16084 16085 16086 16087 16088 16089 16090 16091 16092 16093 16094 16095 16096 16097 16098 16099 16100 16101 16102 16103 16104 16105 16106 16107 16108 16109 16110 16111 16112 16113 16114 16115 16116 16117 16118 16119 16120 16121 16122 16123 16124 16125 16126 16127 16128 16129 16130 16131 16132 16133 16134 16135 16136 16137 16138 16139 16140 16141 16142 16143 16144 16145 16146 16147 16148 16149 16150 16151 16152 16153 16154 16155 16156 16157 16158 16159 16160 16161 16162 16163 16164 16165 16166 16167 16168 16169 16170 16171 16172 16173 16174 16175 16176 16177 16178 16179 16180 16181 16182 16183 16184 16185 16186 16187 16188 16189 16190 16191 16192 16193 16194 16195 16196 16197 16198 16199 16200 16201 16202 16203 16204 16205 16206 16207 16208 16209 16210 16211 16212 16213 16214 16215 16216 16217 16218 16219 16220 16221 16222 16223 16224 16225 16226 16227 16228 16229 16230 16231 16232 16233 16234 16235 16236 16237 16238 16239 16240 16241 16242 16243 16244 16245 16246 16247 16248 16249 16250 16251 16252 16253 16254 16255 16256 16257 16258 16259 16260 16261 16262 16263 16264 16265 16266 16267 16268 16269 16270 16271 16272 16273 16274 16275 16276 16277 16278 16279 16280 16281 16282 16283 16284 16285 16286 16287 16288 16289 16290 16291 16292 16293 16294 16295 16296 16297 16298 16299 16300 16301
diff --git a/docs/conventions.md b/docs/conventions.md
index c8a39dd..a017db1 100644
--- a/docs/conventions.md
+++ b/docs/conventions.md
@@ -136,11 +136,11 @@ Check
[`include/git2/errors.h`](https://github.com/libgit2/libgit2/blob/development/include/git2/errors.h)
for the return codes already defined.
-In your implementation, use `giterr_set()` to provide extended error
+In your implementation, use `git_error_set()` to provide extended error
information to callers.
If a `libgit2` function internally invokes another function that reports an
-error, but the error is not propagated up, use `giterr_clear()` to prevent
+error, but the error is not propagated up, use `git_error_clear()` to prevent
callers from getting the wrong error message later on.
diff --git a/docs/error-handling.md b/docs/error-handling.md
index 0dba01c..8df9a40 100644
--- a/docs/error-handling.md
+++ b/docs/error-handling.md
@@ -9,7 +9,7 @@ and a generic error code (-1) for all critical or non-specific failures
(e.g. running out of memory or system corruption).
When a negative value is returned, an error message is also set. The
-message can be accessed via the `giterr_last` function which will return a
+message can be accessed via the `git_error_last` function which will return a
pointer to a `git_error` structure containing the error message text and
the class of error (i.e. what part of the library generated the error).
@@ -51,7 +51,7 @@ look at the error message that was generated.
int error = git_repository_open(&repo, "path/to/repo");
if (error < 0) {
- fprintf(stderr, "Could not open repository: %s\n", giterr_last()->message);
+ fprintf(stderr, "Could not open repository: %s\n", git_error_last()->message);
exit(1);
}
@@ -75,7 +75,7 @@ at the specific error values to decide what to do.
fprintf(stderr, "Could not find repository at path '%s'\n", path);
else
fprintf(stderr, "Unable to open repository: %s\n",
- giterr_last()->message);
+ git_error_last()->message);
exit(1);
}
@@ -86,7 +86,7 @@ at the specific error values to decide what to do.
Some of the higher-level language bindings may use a range of information
from libgit2 to convert error return codes into exceptions, including the
specific error return codes and even the class of error and the error
-message returned by `giterr_last`, but the full range of that logic is
+message returned by `git_error_last`, but the full range of that logic is
beyond the scope of this document.
Example internal implementation
@@ -102,7 +102,7 @@ int git_repository_open(git_repository **repository, const char *path)
{
/* perform some logic to open the repository */
if (p_exists(path) < 0) {
- giterr_set(GITERR_REPOSITORY, "The path '%s' doesn't exist", path);
+ git_error_set(GIT_ERROR_REPOSITORY, "The path '%s' doesn't exist", path);
return GIT_ENOTFOUND;
}
@@ -113,7 +113,7 @@ int git_repository_open(git_repository **repository, const char *path)
The public error API
--------------------
-- `const git_error *giterr_last(void)`: The main function used to look up
+- `const git_error *git_error_last(void)`: The main function used to look up
the last error. This may return NULL if no error has occurred.
Otherwise this should return a `git_error` object indicating the class
of error and the error message that was generated by the library.
@@ -133,7 +133,7 @@ The public error API
bugs, but in the meantime, please code defensively and check for NULL
when calling this function.
-- `void giterr_clear(void)`: This function clears the last error. The
+- `void git_error_clear(void)`: This function clears the last error. The
library will call this when an error is generated by low level function
and the higher level function handles the error.
@@ -141,14 +141,14 @@ The public error API
function's error message is not cleared by higher level code that
handles the error and returns zero. Please report these as bugs, but in
the meantime, a zero return value from a libgit2 API does not guarantee
- that `giterr_last()` will return NULL.
+ that `git_error_last()` will return NULL.
-- `void giterr_set_str(int error_class, const char *message)`: This
+- `void git_error_set(int error_class, const char *message)`: This
function can be used when writing a custom backend module to set the
libgit2 error message. See the documentation on this function for its
use. Normal usage of libgit2 will probably never need to call this API.
-- `void giterr_set_oom(void)`: This is a standard function for reporting
+- `void git_error_set_oom(void)`: This is a standard function for reporting
an out-of-memory error. It is written in a manner that it doesn't have
to allocate any extra memory in order to record the error, so this is
the best way to report that scenario.
@@ -182,18 +182,18 @@ There are some known bugs in the library where some functions may return a
negative value but not set an error message and some other functions may
return zero (no error) and yet leave an error message set. Please report
these cases as issues and they will be fixed. In the meanwhile, please
-code defensively, checking that the return value of `giterr_last` is not
-NULL before using it, and not relying on `giterr_last` to return NULL when
+code defensively, checking that the return value of `git_error_last` is not
+NULL before using it, and not relying on `git_error_last` to return NULL when
a function returns 0 for success.
The internal error API
----------------------
-- `void giterr_set(int error_class, const char *fmt, ...)`: This is the
+- `void git_error_set(int error_class, const char *fmt, ...)`: This is the
main internal function for setting an error. It works like `printf` to
- format the error message. See the notes of `giterr_set_str` for a
+ format the error message. See the notes of `git_error_set_str` for a
general description of how error messages are stored (and also about
- special handling for `error_class` of `GITERR_OS`).
+ special handling for `error_class` of `GIT_ERROR_OS`).
Writing error messages
----------------------
@@ -248,7 +248,7 @@ General guidelines for error reporting
...
if (git_commit_lookup(parent, repo, parent_id) < 0) {
- giterr_set(GITERR_COMMIT, "Overwrite lookup error message");
+ git_error_set(GIT_ERROR_COMMIT, "Overwrite lookup error message");
return -1; /* mask error code */
}
diff --git a/docs/threading.md b/docs/threading.md
index 430bca8..7dd3744 100644
--- a/docs/threading.md
+++ b/docs/threading.md
@@ -22,7 +22,7 @@ snapshots.
Error messages
--------------
-The error message is thread-local. The `giterr_last()` call must
+The error message is thread-local. The `git_error_last()` call must
happen on the same thread as the error in order to get the
message. Often this will be the case regardless, but if you use
something like the [GCD](http://en.wikipedia.org/wiki/Grand_Central_Dispatch)
diff --git a/examples/checkout.c b/examples/checkout.c
index f92ad73..9119d65 100644
--- a/examples/checkout.c
+++ b/examples/checkout.c
@@ -132,7 +132,7 @@ static int perform_checkout_ref(git_repository *repo, git_annotated_commit *targ
/** Grab the commit we're interested to move to */
err = git_commit_lookup(&target_commit, repo, git_annotated_commit_id(target));
if (err != 0) {
- fprintf(stderr, "failed to lookup commit: %s\n", giterr_last()->message);
+ fprintf(stderr, "failed to lookup commit: %s\n", git_error_last()->message);
goto cleanup;
}
@@ -140,12 +140,12 @@ static int perform_checkout_ref(git_repository *repo, git_annotated_commit *targ
* Perform the checkout so the workdir corresponds to what target_commit
* contains.
*
- * Note that it's okay to pass a git_commit here, because it will be
+ * Note that it's okay to pass a git_commit here, because it will be
* peeled to a tree.
*/
err = git_checkout_tree(repo, (const git_object *)target_commit, &checkout_opts);
if (err != 0) {
- fprintf(stderr, "failed to checkout tree: %s\n", giterr_last()->message);
+ fprintf(stderr, "failed to checkout tree: %s\n", git_error_last()->message);
goto cleanup;
}
@@ -161,7 +161,7 @@ static int perform_checkout_ref(git_repository *repo, git_annotated_commit *targ
err = git_repository_set_head_detached_from_annotated(repo, target);
}
if (err != 0) {
- fprintf(stderr, "failed to update HEAD reference: %s\n", giterr_last()->message);
+ fprintf(stderr, "failed to update HEAD reference: %s\n", git_error_last()->message);
goto cleanup;
}
@@ -219,7 +219,7 @@ int main(int argc, char **argv)
*/
err = resolve_refish(&checkout_target, repo, args.argv[args.pos]);
if (err != 0) {
- fprintf(stderr, "failed to resolve %s: %s\n", args.argv[args.pos], giterr_last()->message);
+ fprintf(stderr, "failed to resolve %s: %s\n", args.argv[args.pos], git_error_last()->message);
goto cleanup;
}
err = perform_checkout_ref(repo, checkout_target, &opts);
diff --git a/examples/common.c b/examples/common.c
index 4e0949b..e20767a 100644
--- a/examples/common.c
+++ b/examples/common.c
@@ -24,7 +24,7 @@ void check_lg2(int error, const char *message, const char *extra)
if (!error)
return;
- if ((lg2err = giterr_last()) != NULL && lg2err->message != NULL) {
+ if ((lg2err = git_error_last()) != NULL && lg2err->message != NULL) {
lg2msg = lg2err->message;
lg2spacer = " - ";
}
diff --git a/examples/general.c b/examples/general.c
index 7080cde..0b93a2e 100644
--- a/examples/general.c
+++ b/examples/general.c
@@ -66,7 +66,7 @@ static void config_files(const char *repo_path, git_repository *repo);
*/
static void check_error(int error_code, const char *action)
{
- const git_error *error = giterr_last();
+ const git_error *error = git_error_last();
if (!error_code)
return;
diff --git a/examples/merge.c b/examples/merge.c
index 761bd3a..13e3f96 100644
--- a/examples/merge.c
+++ b/examples/merge.c
@@ -96,7 +96,7 @@ static int resolve_heads(git_repository *repo, merge_options *opts)
for (i = 0; i < opts->heads_count; i++) {
err = resolve_refish(&annotated[annotated_count++], repo, opts->heads[i]);
if (err != 0) {
- fprintf(stderr, "failed to resolve refish %s: %s\n", opts->heads[i], giterr_last()->message);
+ fprintf(stderr, "failed to resolve refish %s: %s\n", opts->heads[i], git_error_last()->message);
annotated_count--;
continue;
}
@@ -229,7 +229,7 @@ static int create_merge_commit(git_repository *repo, git_index *index, merge_opt
/* Maybe that's a ref, so DWIM it */
err = git_reference_dwim(&merge_ref, repo, opts->heads[0]);
- check_lg2(err, "failed to DWIM reference", giterr_last()->message);
+ check_lg2(err, "failed to DWIM reference", git_error_last()->message);
/* Grab a signature */
check_lg2(git_signature_now(&sign, "Me", "me@example.com"), "failed to create signature", NULL);
diff --git a/examples/network/clone.c b/examples/network/clone.c
index ce4b6ae..bbcd2e8 100644
--- a/examples/network/clone.c
+++ b/examples/network/clone.c
@@ -104,7 +104,7 @@ int do_clone(git_repository *repo, int argc, char **argv)
error = git_clone(&cloned_repo, url, path, &clone_opts);
printf("\n");
if (error != 0) {
- const git_error *err = giterr_last();
+ const git_error *err = git_error_last();
if (err) printf("ERROR %d: %s\n", err->klass, err->message);
else printf("ERROR %d: no detailed info\n", error);
}
diff --git a/examples/network/git2.c b/examples/network/git2.c
index 1d3d27b..d0d0eb6 100644
--- a/examples/network/git2.c
+++ b/examples/network/git2.c
@@ -26,10 +26,10 @@ static int run_command(git_cb fn, git_repository *repo, struct args_info args)
/* Run the command. If something goes wrong, print the error message to stderr */
error = fn(repo, args.argc - args.pos, &args.argv[args.pos]);
if (error < 0) {
- if (giterr_last() == NULL)
+ if (git_error_last() == NULL)
fprintf(stderr, "Error without message");
else
- fprintf(stderr, "Bad news:\n %s\n", giterr_last()->message);
+ fprintf(stderr, "Bad news:\n %s\n", git_error_last()->message);
}
return !!error;
diff --git a/fuzzers/download_refs_fuzzer.c b/fuzzers/download_refs_fuzzer.c
index 3807c09..93f1b49 100644
--- a/fuzzers/download_refs_fuzzer.c
+++ b/fuzzers/download_refs_fuzzer.c
@@ -158,7 +158,7 @@ int fuzzer_transport_cb(git_transport **out, git_remote *owner, void *param)
void fuzzer_git_abort(const char *op)
{
- const git_error *err = giterr_last();
+ const git_error *err = git_error_last();
fprintf(stderr, "unexpected libgit error: %s: %s\n",
op, err ? err->message : "<none>");
abort();
diff --git a/fuzzers/packfile_fuzzer.c b/fuzzers/packfile_fuzzer.c
index e70c6c9..a448233 100644
--- a/fuzzers/packfile_fuzzer.c
+++ b/fuzzers/packfile_fuzzer.c
@@ -77,7 +77,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
if (git_indexer_new(&indexer, ".", 0, odb, NULL) < 0) {
fprintf(stderr, "Failed to create the indexer: %s\n",
- giterr_last()->message);
+ git_error_last()->message);
abort();
}
diff --git a/include/git2/blame.h b/include/git2/blame.h
index cc91317..eef863f 100644
--- a/include/git2/blame.h
+++ b/include/git2/blame.h
@@ -183,7 +183,7 @@ GIT_EXTERN(const git_blame_hunk*) git_blame_get_hunk_byline(
* @param path path to file to consider
* @param options options for the blame operation. If NULL, this is treated as
* though GIT_BLAME_OPTIONS_INIT were passed.
- * @return 0 on success, or an error code. (use giterr_last for information
+ * @return 0 on success, or an error code. (use git_error_last for information
* about the error.)
*/
GIT_EXTERN(int) git_blame_file(
@@ -207,7 +207,7 @@ GIT_EXTERN(int) git_blame_file(
* from git_blame_file)
* @param buffer the (possibly) modified contents of the file
* @param buffer_len number of valid bytes in the buffer
- * @return 0 on success, or an error code. (use giterr_last for information
+ * @return 0 on success, or an error code. (use git_error_last for information
* about the error)
*/
GIT_EXTERN(int) git_blame_buffer(
diff --git a/include/git2/checkout.h b/include/git2/checkout.h
index 2953637..3fb3fc1 100644
--- a/include/git2/checkout.h
+++ b/include/git2/checkout.h
@@ -325,7 +325,7 @@ GIT_EXTERN(int) git_checkout_init_options(
* @param opts specifies checkout options (may be NULL)
* @return 0 on success, GIT_EUNBORNBRANCH if HEAD points to a non
* existing branch, non-zero value returned by `notify_cb`, or
- * other error code < 0 (use giterr_last for error details)
+ * other error code < 0 (use git_error_last for error details)
*/
GIT_EXTERN(int) git_checkout_head(
git_repository *repo,
@@ -338,7 +338,7 @@ GIT_EXTERN(int) git_checkout_head(
* @param index index to be checked out (or NULL to use repository index)
* @param opts specifies checkout options (may be NULL)
* @return 0 on success, non-zero return value from `notify_cb`, or error
- * code < 0 (use giterr_last for error details)
+ * code < 0 (use git_error_last for error details)
*/
GIT_EXTERN(int) git_checkout_index(
git_repository *repo,
@@ -354,7 +354,7 @@ GIT_EXTERN(int) git_checkout_index(
* the working directory (or NULL to use HEAD)
* @param opts specifies checkout options (may be NULL)
* @return 0 on success, non-zero return value from `notify_cb`, or error
- * code < 0 (use giterr_last for error details)
+ * code < 0 (use git_error_last for error details)
*/
GIT_EXTERN(int) git_checkout_tree(
git_repository *repo,
diff --git a/include/git2/clone.h b/include/git2/clone.h
index 4a64aac..790a828 100644
--- a/include/git2/clone.h
+++ b/include/git2/clone.h
@@ -196,7 +196,7 @@ GIT_EXTERN(int) git_clone_init_options(
* function works as though GIT_OPTIONS_INIT were passed.
* @return 0 on success, any non-zero return value from a callback
* function, or a negative value to indicate an error (use
- * `giterr_last` for a detailed error message)
+ * `git_error_last` for a detailed error message)
*/
GIT_EXTERN(int) git_clone(
git_repository **out,
diff --git a/include/git2/commit.h b/include/git2/commit.h
index 50f2fc9..7e0409c 100644
--- a/include/git2/commit.h
+++ b/include/git2/commit.h
@@ -296,8 +296,8 @@ GIT_EXTERN(int) git_commit_header_field(git_buf *out, const git_commit *commit,
* Extract the signature from a commit
*
* If the id is not for a commit, the error class will be
- * `GITERR_INVALID`. If the commit does not have a signature, the
- * error class will be `GITERR_OBJECT`.
+ * `GIT_ERROR_INVALID`. If the commit does not have a signature, the
+ * error class will be `GIT_ERROR_OBJECT`.
*
* @param signature the signature block; existing content will be
* overwritten
diff --git a/include/git2/errors.h b/include/git2/errors.h
index 2c0ac1c..f00385b 100644
--- a/include/git2/errors.h
+++ b/include/git2/errors.h
@@ -73,42 +73,48 @@ typedef struct {
/** Error classes */
typedef enum {
- GITERR_NONE = 0,
- GITERR_NOMEMORY,
- GITERR_OS,
- GITERR_INVALID,
- GITERR_REFERENCE,
- GITERR_ZLIB,
- GITERR_REPOSITORY,
- GITERR_CONFIG,
- GITERR_REGEX,
- GITERR_ODB,
- GITERR_INDEX,
- GITERR_OBJECT,
- GITERR_NET,
- GITERR_TAG,
- GITERR_TREE,
- GITERR_INDEXER,
- GITERR_SSL,
- GITERR_SUBMODULE,
- GITERR_THREAD,
- GITERR_STASH,
- GITERR_CHECKOUT,
- GITERR_FETCHHEAD,
- GITERR_MERGE,
- GITERR_SSH,
- GITERR_FILTER,
- GITERR_REVERT,
- GITERR_CALLBACK,
- GITERR_CHERRYPICK,
- GITERR_DESCRIBE,
- GITERR_REBASE,
- GITERR_FILESYSTEM,
- GITERR_PATCH,
- GITERR_WORKTREE,
- GITERR_SHA1
+ GIT_ERROR_NONE = 0,
+ GIT_ERROR_NOMEMORY,
+ GIT_ERROR_OS,
+ GIT_ERROR_INVALID,
+ GIT_ERROR_REFERENCE,
+ GIT_ERROR_ZLIB,
+ GIT_ERROR_REPOSITORY,
+ GIT_ERROR_CONFIG,
+ GIT_ERROR_REGEX,
+ GIT_ERROR_ODB,
+ GIT_ERROR_INDEX,
+ GIT_ERROR_OBJECT,
+ GIT_ERROR_NET,
+ GIT_ERROR_TAG,
+ GIT_ERROR_TREE,
+ GIT_ERROR_INDEXER,
+ GIT_ERROR_SSL,
+ GIT_ERROR_SUBMODULE,
+ GIT_ERROR_THREAD,
+ GIT_ERROR_STASH,
+ GIT_ERROR_CHECKOUT,
+ GIT_ERROR_FETCHHEAD,
+ GIT_ERROR_MERGE,
+ GIT_ERROR_SSH,
+ GIT_ERROR_FILTER,
+ GIT_ERROR_REVERT,
+ GIT_ERROR_CALLBACK,
+ GIT_ERROR_CHERRYPICK,
+ GIT_ERROR_DESCRIBE,
+ GIT_ERROR_REBASE,
+ GIT_ERROR_FILESYSTEM,
+ GIT_ERROR_PATCH,
+ GIT_ERROR_WORKTREE,
+ GIT_ERROR_SHA1
} git_error_t;
+/** @name Error Functions
+ *
+ * These functions report or set error information.
+ */
+/**@{*/
+
/**
* Return the last `git_error` object that was generated for the
* current thread.
@@ -120,12 +126,12 @@ typedef enum {
*
* @return A git_error object.
*/
-GIT_EXTERN(const git_error *) giterr_last(void);
+GIT_EXTERN(const git_error *) git_error_last(void);
/**
* Clear the last library error that occurred for this thread.
*/
-GIT_EXTERN(void) giterr_clear(void);
+GIT_EXTERN(void) git_error_clear(void);
/**
* Set the error message string for this thread.
@@ -143,18 +149,100 @@ GIT_EXTERN(void) giterr_clear(void);
* general subsystem that is responsible for the error.
* @param string The formatted error message to keep
*/
-GIT_EXTERN(void) giterr_set_str(int error_class, const char *string);
+GIT_EXTERN(void) git_error_set_str(int error_class, const char *string);
/**
* Set the error message to a special value for memory allocation failure.
*
- * The normal `giterr_set_str()` function attempts to `strdup()` the string
- * that is passed in. This is not a good idea when the error in question
- * is a memory allocation failure. That circumstance has a special setter
- * function that sets the error string to a known and statically allocated
- * internal value.
+ * The normal `git_error_set_str()` function attempts to `strdup()` the
+ * string that is passed in. This is not a good idea when the error in
+ * question is a memory allocation failure. That circumstance has a
+ * special setter function that sets the error string to a known and
+ * statically allocated internal value.
+ */
+GIT_EXTERN(void) git_error_set_oom(void);
+
+/**@}*/
+
+/** @name Deprecated Error Functions
+ *
+ * These functions and enumeration values are retained for backward
+ * compatibility. The newer versions of these functions should be
+ * preferred in all new code.
+ */
+/**@{*/
+
+GIT_DEPRECATED(static const int) GITERR_NONE = GIT_ERROR_NONE;
+GIT_DEPRECATED(static const int) GITERR_NOMEMORY = GIT_ERROR_NOMEMORY;
+GIT_DEPRECATED(static const int) GITERR_OS = GIT_ERROR_OS;
+GIT_DEPRECATED(static const int) GITERR_INVALID = GIT_ERROR_INVALID;
+GIT_DEPRECATED(static const int) GITERR_REFERENCE = GIT_ERROR_REFERENCE;
+GIT_DEPRECATED(static const int) GITERR_ZLIB = GIT_ERROR_ZLIB;
+GIT_DEPRECATED(static const int) GITERR_REPOSITORY = GIT_ERROR_REPOSITORY;
+GIT_DEPRECATED(static const int) GITERR_CONFIG = GIT_ERROR_CONFIG;
+GIT_DEPRECATED(static const int) GITERR_REGEX = GIT_ERROR_REGEX;
+GIT_DEPRECATED(static const int) GITERR_ODB = GIT_ERROR_ODB;
+GIT_DEPRECATED(static const int) GITERR_INDEX = GIT_ERROR_INDEX;
+GIT_DEPRECATED(static const int) GITERR_OBJECT = GIT_ERROR_OBJECT;
+GIT_DEPRECATED(static const int) GITERR_NET = GIT_ERROR_NET;
+GIT_DEPRECATED(static const int) GITERR_TAG = GIT_ERROR_TAG;
+GIT_DEPRECATED(static const int) GITERR_TREE = GIT_ERROR_TREE;
+GIT_DEPRECATED(static const int) GITERR_INDEXER = GIT_ERROR_INDEXER;
+GIT_DEPRECATED(static const int) GITERR_SSL = GIT_ERROR_SSL;
+GIT_DEPRECATED(static const int) GITERR_SUBMODULE = GIT_ERROR_SUBMODULE;
+GIT_DEPRECATED(static const int) GITERR_THREAD = GIT_ERROR_THREAD;
+GIT_DEPRECATED(static const int) GITERR_STASH = GIT_ERROR_STASH;
+GIT_DEPRECATED(static const int) GITERR_CHECKOUT = GIT_ERROR_CHECKOUT;
+GIT_DEPRECATED(static const int) GITERR_FETCHHEAD = GIT_ERROR_FETCHHEAD;
+GIT_DEPRECATED(static const int) GITERR_MERGE = GIT_ERROR_MERGE;
+GIT_DEPRECATED(static const int) GITERR_SSH = GIT_ERROR_SSH;
+GIT_DEPRECATED(static const int) GITERR_FILTER = GIT_ERROR_FILTER;
+GIT_DEPRECATED(static const int) GITERR_REVERT = GIT_ERROR_REVERT;
+GIT_DEPRECATED(static const int) GITERR_CALLBACK = GIT_ERROR_CALLBACK;
+GIT_DEPRECATED(static const int) GITERR_CHERRYPICK = GIT_ERROR_CHERRYPICK;
+GIT_DEPRECATED(static const int) GITERR_DESCRIBE = GIT_ERROR_DESCRIBE;
+GIT_DEPRECATED(static const int) GITERR_REBASE = GIT_ERROR_REBASE;
+GIT_DEPRECATED(static const int) GITERR_FILESYSTEM = GIT_ERROR_FILESYSTEM;
+GIT_DEPRECATED(static const int) GITERR_PATCH = GIT_ERROR_PATCH;
+GIT_DEPRECATED(static const int) GITERR_WORKTREE = GIT_ERROR_WORKTREE;
+GIT_DEPRECATED(static const int) GITERR_SHA1 = GIT_ERROR_SHA1;
+
+/**
+ * Return the last `git_error` object that was generated for the
+ * current thread. This function is deprecated and will be removed
+ * in a future release; `git_error_last` should be used instead.
+ *
+ * @see git_error_last
*/
-GIT_EXTERN(void) giterr_set_oom(void);
+GIT_DEPRECATED(GIT_EXTERN(const git_error *)) giterr_last(void);
+
+/**
+ * Clear the last error. This function is deprecated and will be
+ * removed in a future release; `giterr_clear` should be used instead.
+ *
+ * @see git_error_last
+ */
+GIT_DEPRECATED(GIT_EXTERN(void)) giterr_clear(void);
+
+/**
+ * Sets the error message to the given string. This function is
+ * deprecated and will be removed in a future release; `giterr_clear`
+ * should be used instead.
+ *
+ * @see git_error_set_str
+ */
+GIT_DEPRECATED(GIT_EXTERN(void)) giterr_set_str(int error_class, const char *string);
+
+/**
+ * Indicates that an out-of-memory situation occured. This function
+ * is deprecated and will be removed in a future release; `giterr_clear`
+ * should be used instead.
+ *
+ * @see git_error_set_oom
+ */
+GIT_DEPRECATED(GIT_EXTERN(void)) giterr_set_oom(void);
+
+/**@}*/
/** @} */
GIT_END_DECL
diff --git a/include/git2/oid.h b/include/git2/oid.h
index aaa678c..7e071ba 100644
--- a/include/git2/oid.h
+++ b/include/git2/oid.h
@@ -246,7 +246,7 @@ GIT_EXTERN(git_oid_shorten *) git_oid_shorten_new(size_t min_length);
* memory-efficient.
*
* Attempting to add more than those OIDs will result in a
- * GITERR_INVALID error
+ * GIT_ERROR_INVALID error
*
* @param os a `git_oid_shorten` instance
* @param text_id an OID in text form
diff --git a/include/git2/submodule.h b/include/git2/submodule.h
index ac6344e..efb3b75 100644
--- a/include/git2/submodule.h
+++ b/include/git2/submodule.h
@@ -133,7 +133,7 @@ typedef struct git_submodule_update_options {
* checkout, set the `checkout_strategy` to
* `GIT_CHECKOUT_NONE`. Generally you will want the use
* GIT_CHECKOUT_SAFE to update files in the working
- * directory.
+ * directory.
*/
git_checkout_options checkout_opts;
@@ -187,7 +187,7 @@ GIT_EXTERN(int) git_submodule_update_init_options(
* function works as though GIT_SUBMODULE_UPDATE_OPTIONS_INIT was passed.
* @return 0 on success, any non-zero return value from a callback
* function, or a negative value to indicate an error (use
- * `giterr_last` for a detailed error message).
+ * `git_error_last` for a detailed error message).
*/
GIT_EXTERN(int) git_submodule_update(git_submodule *submodule, int init, git_submodule_update_options *options);
diff --git a/libgit2_clar.supp b/libgit2_clar.supp
index abd1117..b747919 100644
--- a/libgit2_clar.supp
+++ b/libgit2_clar.supp
@@ -5,10 +5,10 @@
}
{
- ignore-giterr-set-leak
+ ignore-giterror-set-leak
Memcheck:Leak
...
- fun:giterr_set
+ fun:giterror_set
}
{
diff --git a/script/user_nodefs.h b/script/user_nodefs.h
index 3c06a70..b6e2df3 100644
--- a/script/user_nodefs.h
+++ b/script/user_nodefs.h
@@ -5,8 +5,8 @@
* a Linking Exception. For full terms see the included COPYING file.
*/
-#nodef GITERR_CHECK_ALLOC(ptr) if (ptr == NULL) { __coverity_panic__(); }
-#nodef GITERR_CHECK_ALLOC_BUF(buf) if (buf == NULL || git_buf_oom(buf)) { __coverity_panic__(); }
+#nodef GIT_ERROR_CHECK_ALLOC(ptr) if (ptr == NULL) { __coverity_panic__(); }
+#nodef GIT_ERROR_CHECK_ALLOC_BUF(buf) if (buf == NULL || git_buf_oom(buf)) { __coverity_panic__(); }
#nodef GITERR_CHECK_ALLOC_ADD(out, one, two) \
if (GIT_ADD_SIZET_OVERFLOW(out, one, two)) { __coverity_panic__(); }
@@ -23,7 +23,7 @@
#nodef GITERR_CHECK_ALLOC_MULTIPLY(out, nelem, elsize) \
if (GIT_MULTIPLY_SIZET_OVERFLOW(out, nelem, elsize)) { __coverity_panic__(); }
-#nodef GITERR_CHECK_VERSION(S,V,N) if (giterr__check_version(S,V,N) < 0) { __coverity_panic__(); }
+#nodef GIT_ERROR_CHECK_VERSION(S,V,N) if (git_error__check_version(S,V,N) < 0) { __coverity_panic__(); }
#nodef LOOKS_LIKE_DRIVE_PREFIX(S) (strlen(S) >= 2 && git__isalpha((S)[0]) && (S)[1] == ':')
diff --git a/src/alloc.c b/src/alloc.c
index 0cac457..8d4a194 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -49,7 +49,7 @@ int git_allocator_setup(git_allocator *allocator)
int git_win32_crtdbg_init_allocator(git_allocator *allocator)
{
GIT_UNUSED(allocator);
- giterr_set(GIT_EINVALID, "crtdbg memory allocator not available");
+ git_error_set(GIT_EINVALID, "crtdbg memory allocator not available");
return -1;
}
#endif
diff --git a/src/annotated_commit.c b/src/annotated_commit.c
index 5ef2bab..5d4f370 100644
--- a/src/annotated_commit.c
+++ b/src/annotated_commit.c
@@ -31,7 +31,7 @@ static int annotated_commit_init(
*out = NULL;
annotated_commit = git__calloc(1, sizeof(git_annotated_commit));
- GITERR_CHECK_ALLOC(annotated_commit);
+ GIT_ERROR_CHECK_ALLOC(annotated_commit);
annotated_commit->type = GIT_ANNOTATED_COMMIT_REAL;
@@ -45,7 +45,7 @@ static int annotated_commit_init(
description = annotated_commit->id_str;
annotated_commit->description = git__strdup(description);
- GITERR_CHECK_ALLOC(annotated_commit->description);
+ GIT_ERROR_CHECK_ALLOC(annotated_commit->description);
done:
if (!error)
@@ -140,7 +140,7 @@ int git_annotated_commit_from_ref(
if (!error) {
(*out)->ref_name = git__strdup(git_reference_name(ref));
- GITERR_CHECK_ALLOC((*out)->ref_name);
+ GIT_ERROR_CHECK_ALLOC((*out)->ref_name);
}
git_object_free(peeled);
@@ -180,10 +180,10 @@ int git_annotated_commit_from_fetchhead(
return -1;
(*out)->ref_name = git__strdup(branch_name);
- GITERR_CHECK_ALLOC((*out)->ref_name);
+ GIT_ERROR_CHECK_ALLOC((*out)->ref_name);
(*out)->remote_url = git__strdup(remote_url);
- GITERR_CHECK_ALLOC((*out)->remote_url);
+ GIT_ERROR_CHECK_ALLOC((*out)->remote_url);
return 0;
}
diff --git a/src/apply.c b/src/apply.c
index b21d838..bd0ba6a 100644
--- a/src/apply.c
+++ b/src/apply.c
@@ -25,7 +25,7 @@
#include "index.h"
#define apply_err(...) \
- ( giterr_set(GITERR_PATCH, __VA_ARGS__), GIT_EAPPLYFAIL )
+ ( git_error_set(GIT_ERROR_PATCH, __VA_ARGS__), GIT_EAPPLYFAIL )
typedef struct {
/* The lines that we allocate ourself are allocated out of the pool.
@@ -68,7 +68,7 @@ static int patch_image_init_fromstr(
end++;
line = git_pool_mallocz(&out->pool, 1);
- GITERR_CHECK_ALLOC(line);
+ GIT_ERROR_CHECK_ALLOC(line);
if (git_vector_insert(&out->lines, line) < 0)
return -1;
@@ -155,7 +155,7 @@ static int update_hunk(
&image->lines, linenum, (prelen - postlen));
if (error) {
- giterr_set_oom();
+ git_error_set_oom();
return -1;
}
@@ -483,7 +483,7 @@ static int apply_one(
postimage_reader, delta->old_file.path)) == 0) {
skip_preimage = true;
} else if (error == GIT_ENOTFOUND) {
- giterr_clear();
+ git_error_clear();
error = 0;
} else {
goto done;
@@ -777,7 +777,7 @@ int git_apply(
assert(repo && diff);
- GITERR_CHECK_VERSION(
+ GIT_ERROR_CHECK_VERSION(
given_opts, GIT_APPLY_OPTIONS_VERSION, "git_apply_options");
if (given_opts)
diff --git a/src/array.h b/src/array.h
index 1d8a01c..03537e7 100644
--- a/src/array.h
+++ b/src/array.h
@@ -15,7 +15,7 @@
* git_array_t(int) my_ints = GIT_ARRAY_INIT;
* ...
* int *i = git_array_alloc(my_ints);
- * GITERR_CHECK_ALLOC(i);
+ * GIT_ERROR_CHECK_ALLOC(i);
* ...
* git_array_clear(my_ints);
*
@@ -36,7 +36,7 @@
#define git_array_clear(a) \
do { git__free((a).ptr); git_array_init(a); } while (0)
-#define GITERR_CHECK_ARRAY(a) GITERR_CHECK_ALLOC((a).ptr)
+#define GIT_ERROR_CHECK_ARRAY(a) GIT_ERROR_CHECK_ALLOC((a).ptr)
typedef git_array_t(char) git_array_generic_t;
diff --git a/src/attr.c b/src/attr.c
index 9950e6f..1f26433 100644
--- a/src/attr.c
+++ b/src/attr.c
@@ -135,7 +135,7 @@ int git_attr_get_many_with_session(
goto cleanup;
info = git__calloc(num_attr, sizeof(attr_get_many_info));
- GITERR_CHECK_ALLOC(info);
+ GIT_ERROR_CHECK_ALLOC(info);
git_vector_foreach(&files, i, file) {
@@ -233,7 +233,7 @@ int git_attr_foreach(
error = callback(assign->name, assign->value, payload);
if (error) {
- giterr_set_after_callback(error);
+ git_error_set_after_callback(error);
goto cleanup;
}
}
@@ -277,7 +277,7 @@ static int system_attr_file(
error = git_sysdir_find_system_file(out, GIT_ATTR_FILE_SYSTEM);
if (error == GIT_ENOTFOUND)
- giterr_clear();
+ git_error_clear();
return error;
}
@@ -286,7 +286,7 @@ static int system_attr_file(
error = git_sysdir_find_system_file(&attr_session->sysdir, GIT_ATTR_FILE_SYSTEM);
if (error == GIT_ENOTFOUND)
- giterr_clear();
+ git_error_clear();
else if (error)
return error;
@@ -377,12 +377,12 @@ int git_attr_add_macro(
return error;
macro = git__calloc(1, sizeof(git_attr_rule));
- GITERR_CHECK_ALLOC(macro);
+ GIT_ERROR_CHECK_ALLOC(macro);
pool = &git_repository_attr_cache(repo)->pool;
macro->match.pattern = git_pool_strdup(pool, name);
- GITERR_CHECK_ALLOC(macro->match.pattern);
+ GIT_ERROR_CHECK_ALLOC(macro->match.pattern);
macro->match.length = strlen(macro->match.pattern);
macro->match.flags = GIT_ATTR_FNMATCH_MACRO;
@@ -532,7 +532,7 @@ static int collect_attr_files(
info.flags = flags;
info.workdir = workdir;
if (git_repository_index__weakptr(&info.index, repo) < 0)
- giterr_clear(); /* no error even if there is no index */
+ git_error_clear(); /* no error even if there is no index */
info.files = files;
if (!strcmp(dir.ptr, "."))
diff --git a/src/attr_file.c b/src/attr_file.c
index f433755..bd69c63 100644
--- a/src/attr_file.c
+++ b/src/attr_file.c
@@ -34,10 +34,10 @@ int git_attr_file__new(
git_attr_file_source source)
{
git_attr_file *attrs = git__calloc(1, sizeof(git_attr_file));
- GITERR_CHECK_ALLOC(attrs);
+ GIT_ERROR_CHECK_ALLOC(attrs);
if (git_mutex_init(&attrs->lock) < 0) {
- giterr_set(GITERR_OS, "failed to initialize lock");
+ git_error_set(GIT_ERROR_OS, "failed to initialize lock");
git__free(attrs);
return -1;
}
@@ -56,7 +56,7 @@ int git_attr_file__clear_rules(git_attr_file *file, bool need_lock)
git_attr_rule *rule;
if (need_lock && git_mutex_lock(&file->lock) < 0) {
- giterr_set(GITERR_OS, "failed to lock attribute file");
+ git_error_set(GIT_ERROR_OS, "failed to lock attribute file");
return -1;
}
@@ -147,7 +147,7 @@ int git_attr_file__load(
break;
}
default:
- giterr_set(GITERR_INVALID, "unknown file source %d", source);
+ git_error_set(GIT_ERROR_INVALID, "unknown file source %d", source);
return -1;
}
@@ -219,7 +219,7 @@ int git_attr_file__out_of_date(
}
default:
- giterr_set(GITERR_INVALID, "invalid file type %d", file->source);
+ git_error_set(GIT_ERROR_INVALID, "invalid file type %d", file->source);
return -1;
}
}
@@ -245,7 +245,7 @@ int git_attr_file__parse_buffer(
context = attrs->entry->path;
if (git_mutex_lock(&attrs->lock) < 0) {
- giterr_set(GITERR_OS, "failed to lock attribute file");
+ git_error_set(GIT_ERROR_OS, "failed to lock attribute file");
return -1;
}
@@ -751,7 +751,7 @@ int git_attr_assignment__parse(
/* allocate assign if needed */
if (!assign) {
assign = git__calloc(1, sizeof(git_attr_assignment));
- GITERR_CHECK_ALLOC(assign);
+ GIT_ERROR_CHECK_ALLOC(assign);
GIT_REFCOUNT_INC(assign);
}
@@ -785,7 +785,7 @@ int git_attr_assignment__parse(
/* allocate permanent storage for name */
assign->name = git_pool_strndup(pool, name_start, scan - name_start);
- GITERR_CHECK_ALLOC(assign->name);
+ GIT_ERROR_CHECK_ALLOC(assign->name);
/* if there is an equals sign, find the value */
if (*scan == '=') {
@@ -794,7 +794,7 @@ int git_attr_assignment__parse(
/* if we found a value, allocate permanent storage for it */
if (scan > value_start) {
assign->value = git_pool_strndup(pool, value_start, scan - value_start);
- GITERR_CHECK_ALLOC(assign->value);
+ GIT_ERROR_CHECK_ALLOC(assign->value);
}
}
diff --git a/src/attrcache.c b/src/attrcache.c
index 0f3e525..cb8a4a4 100644
--- a/src/attrcache.c
+++ b/src/attrcache.c
@@ -18,7 +18,7 @@ GIT_INLINE(int) attr_cache_lock(git_attr_cache *cache)
GIT_UNUSED(cache); /* avoid warning if threading is off */
if (git_mutex_lock(&cache->lock) < 0) {
- giterr_set(GITERR_OS, "unable to get attr cache lock");
+ git_error_set(GIT_ERROR_OS, "unable to get attr cache lock");
return -1;
}
return 0;
@@ -60,7 +60,7 @@ int git_attr_cache__alloc_file_entry(
}
ce = git_pool_mallocz(pool, (uint32_t)cachesize);
- GITERR_CHECK_ALLOC(ce);
+ GIT_ERROR_CHECK_ALLOC(ce);
if (baselen) {
memcpy(ce->fullpath, base, baselen);
@@ -250,7 +250,7 @@ int git_attr_cache__get(
}
/* no error if file simply doesn't exist */
if (error == GIT_ENOTFOUND) {
- giterr_clear();
+ git_error_clear();
error = 0;
}
}
@@ -374,11 +374,11 @@ int git_attr_cache__init(git_repository *repo)
return 0;
cache = git__calloc(1, sizeof(git_attr_cache));
- GITERR_CHECK_ALLOC(cache);
+ GIT_ERROR_CHECK_ALLOC(cache);
/* set up lock */
if (git_mutex_init(&cache->lock) < 0) {
- giterr_set(GITERR_OS, "unable to initialize lock for attr cache");
+ git_error_set(GIT_ERROR_OS, "unable to initialize lock for attr cache");
git__free(cache);
return -1;
}
@@ -443,7 +443,7 @@ int git_attr_cache__insert_macro(git_repository *repo, git_attr_rule *macro)
return 0;
if (attr_cache_lock(cache) < 0) {
- giterr_set(GITERR_OS, "unable to get attr cache lock");
+ git_error_set(GIT_ERROR_OS, "unable to get attr cache lock");
error = -1;
} else {
git_strmap_insert(macros, macro->match.pattern, macro, &error);
diff --git a/src/blame.c b/src/blame.c
index 78b3988..4e98295 100644
--- a/src/blame.c
+++ b/src/blame.c
@@ -272,7 +272,7 @@ static int index_blob_lines(git_blame *blame)
while (len--) {
if (bol) {
i = git_array_alloc(blame->line_index);
- GITERR_CHECK_ALLOC(i);
+ GIT_ERROR_CHECK_ALLOC(i);
*i = buf - blame->final_buf;
bol = 0;
}
@@ -282,7 +282,7 @@ static int index_blob_lines(git_blame *blame)
}
}
i = git_array_alloc(blame->line_index);
- GITERR_CHECK_ALLOC(i);
+ GIT_ERROR_CHECK_ALLOC(i);
*i = buf - blame->final_buf;
blame->num_lines = num + incomplete;
return blame->num_lines;
@@ -334,7 +334,7 @@ static int blame_internal(git_blame *blame)
blame->final_buf_size = git_blob_rawsize(blame->final_blob);
ent = git__calloc(1, sizeof(git_blame__entry));
- GITERR_CHECK_ALLOC(ent);
+ GIT_ERROR_CHECK_ALLOC(ent);
ent->num_lines = index_blob_lines(blame);
ent->lno = blame->options.min_line - 1;
@@ -381,7 +381,7 @@ int git_blame_file(
goto on_error;
blame = git_blame__alloc(repo, normOptions, path);
- GITERR_CHECK_ALLOC(blame);
+ GIT_ERROR_CHECK_ALLOC(blame);
if ((error = load_blob(blame)) < 0)
goto on_error;
@@ -423,14 +423,14 @@ static int buffer_hunk_cb(
if (!blame->current_hunk) {
/* Line added at the end of the file */
blame->current_hunk = new_hunk(wedge_line, 0, wedge_line, blame->path);
- GITERR_CHECK_ALLOC(blame->current_hunk);
+ GIT_ERROR_CHECK_ALLOC(blame->current_hunk);
git_vector_insert(&blame->hunks, blame->current_hunk);
} else if (!hunk_starts_at_or_after_line(blame->current_hunk, wedge_line)){
/* If this hunk doesn't start between existing hunks, split a hunk up so it does */
blame->current_hunk = split_hunk_in_vector(&blame->hunks, blame->current_hunk,
wedge_line - blame->current_hunk->orig_start_line_number, true);
- GITERR_CHECK_ALLOC(blame->current_hunk);
+ GIT_ERROR_CHECK_ALLOC(blame->current_hunk);
}
return 0;
@@ -459,7 +459,7 @@ static int buffer_line_cb(
/* Create a new buffer-blame hunk with this line */
shift_hunks_by(&blame->hunks, blame->current_diff_line, 1);
blame->current_hunk = new_hunk(blame->current_diff_line, 1, 0, blame->path);
- GITERR_CHECK_ALLOC(blame->current_hunk);
+ GIT_ERROR_CHECK_ALLOC(blame->current_hunk);
git_vector_insert_sorted(&blame->hunks, blame->current_hunk, NULL);
}
@@ -500,12 +500,12 @@ int git_blame_buffer(
assert(out && reference && buffer && buffer_len);
blame = git_blame__alloc(reference->repository, reference->options, reference->path);
- GITERR_CHECK_ALLOC(blame);
+ GIT_ERROR_CHECK_ALLOC(blame);
/* Duplicate all of the hunk structures in the reference blame */
git_vector_foreach(&reference->hunks, i, hunk) {
git_blame_hunk *h = dup_hunk(hunk);
- GITERR_CHECK_ALLOC(h);
+ GIT_ERROR_CHECK_ALLOC(h);
git_vector_insert(&blame->hunks, h);
}
diff --git a/src/blame_git.c b/src/blame_git.c
index 552f3f3..06e7d64 100644
--- a/src/blame_git.c
+++ b/src/blame_git.c
@@ -46,10 +46,10 @@ static int make_origin(git_blame__origin **out, git_commit *commit, const char *
path, GIT_OBJECT_BLOB)) < 0)
return error;
- GITERR_CHECK_ALLOC_ADD(&alloc_len, sizeof(*o), path_len);
- GITERR_CHECK_ALLOC_ADD(&alloc_len, alloc_len, 1);
+ GIT_ERROR_CHECK_ALLOC_ADD(&alloc_len, sizeof(*o), path_len);
+ GIT_ERROR_CHECK_ALLOC_ADD(&alloc_len, alloc_len, 1);
o = git__calloc(1, alloc_len);
- GITERR_CHECK_ALLOC(o);
+ GIT_ERROR_CHECK_ALLOC(o);
o->commit = commit;
o->blob = (git_blob *) blob;
@@ -365,7 +365,7 @@ static int diff_hunks(mmfile_t file_a, mmfile_t file_b, void *cb_data)
if (file_a.size > GIT_XDIFF_MAX_SIZE ||
file_b.size > GIT_XDIFF_MAX_SIZE) {
- giterr_set(GITERR_INVALID, "file too large to blame");
+ git_error_set(GIT_ERROR_INVALID, "file too large to blame");
return -1;
}
@@ -522,7 +522,7 @@ static int pass_blame(git_blame *blame, git_blame__origin *origin, uint32_t opt)
memset(sg_buf, 0, sizeof(sg_buf));
else {
sg_origin = git__calloc(num_parents, sizeof(*sg_origin));
- GITERR_CHECK_ALLOC(sg_origin);
+ GIT_ERROR_CHECK_ALLOC(sg_origin);
}
for (i=0; i<num_parents; i++) {
diff --git a/src/blob.c b/src/blob.c
index ef8a004..79748af 100644
--- a/src/blob.c
+++ b/src/blob.c
@@ -116,7 +116,7 @@ static int write_file_stream(
p_close(fd);
if (written != file_size || read_len < 0) {
- giterr_set(GITERR_OS, "failed to read file into stream");
+ git_error_set(GIT_ERROR_OS, "failed to read file into stream");
error = -1;
}
@@ -158,11 +158,11 @@ static int write_symlink(
int error;
link_data = git__malloc(link_size);
- GITERR_CHECK_ALLOC(link_data);
+ GIT_ERROR_CHECK_ALLOC(link_data);
read_len = p_readlink(path, link_data, link_size);
if (read_len != (ssize_t)link_size) {
- giterr_set(GITERR_OS, "failed to create blob: cannot read symlink '%s'", path);
+ git_error_set(GIT_ERROR_OS, "failed to create blob: cannot read symlink '%s'", path);
git__free(link_data);
return -1;
}
@@ -206,7 +206,7 @@ int git_blob__create_from_paths(
goto done;
if (S_ISDIR(st.st_mode)) {
- giterr_set(GITERR_ODB, "cannot create blob from '%s': it is a directory", content_path);
+ git_error_set(GIT_ERROR_ODB, "cannot create blob from '%s': it is a directory", content_path);
error = GIT_EDIRECTORY;
goto done;
}
@@ -334,11 +334,11 @@ int git_blob_create_fromstream(git_writestream **out, git_repository *repo, cons
assert(out && repo);
stream = git__calloc(1, sizeof(blob_writestream));
- GITERR_CHECK_ALLOC(stream);
+ GIT_ERROR_CHECK_ALLOC(stream);
if (hintpath) {
stream->hintpath = git__strdup(hintpath);
- GITERR_CHECK_ALLOC(stream->hintpath);
+ GIT_ERROR_CHECK_ALLOC(stream->hintpath);
}
stream->repo = repo;
diff --git a/src/branch.c b/src/branch.c
index c5d9152..61ed03e 100644
--- a/src/branch.c
+++ b/src/branch.c
@@ -34,8 +34,8 @@ static int retrieve_branch_reference(
if ((error = git_buf_joinpath(&ref_name, prefix, branch_name)) < 0)
/* OOM */;
else if ((error = git_reference_lookup(&branch, repo, ref_name.ptr)) < 0)
- giterr_set(
- GITERR_REFERENCE, "cannot locate %s branch '%s'",
+ git_error_set(
+ GIT_ERROR_REFERENCE, "cannot locate %s branch '%s'",
is_remote ? "remote-tracking" : "local", branch_name);
*branch_reference_out = branch; /* will be NULL on error */
@@ -46,8 +46,8 @@ static int retrieve_branch_reference(
static int not_a_local_branch(const char *reference_name)
{
- giterr_set(
- GITERR_INVALID,
+ git_error_set(
+ GIT_ERROR_INVALID,
"reference '%s' is not a local branch.", reference_name);
return -1;
}
@@ -71,7 +71,7 @@ static int create_branch(
assert(git_object_owner((const git_object *)commit) == repository);
if (!git__strcmp(branch_name, "HEAD")) {
- giterr_set(GITERR_REFERENCE, "'HEAD' is not a valid branch name");
+ git_error_set(GIT_ERROR_REFERENCE, "'HEAD' is not a valid branch name");
error = -1;
goto cleanup;
}
@@ -88,7 +88,7 @@ static int create_branch(
}
if (is_unmovable_head && force) {
- giterr_set(GITERR_REFERENCE, "cannot force update branch '%s' as it is "
+ git_error_set(GIT_ERROR_REFERENCE, "cannot force update branch '%s' as it is "
"the current HEAD of the repository.", branch_name);
error = -1;
goto cleanup;
@@ -168,7 +168,7 @@ int git_branch_delete(git_reference *branch)
assert(branch);
if (!git_reference_is_branch(branch) && !git_reference_is_remote(branch)) {
- giterr_set(GITERR_INVALID, "reference '%s' is not a valid branch.",
+ git_error_set(GIT_ERROR_INVALID, "reference '%s' is not a valid branch.",
git_reference_name(branch));
return GIT_ENOTFOUND;
}
@@ -177,13 +177,13 @@ int git_branch_delete(git_reference *branch)
return is_head;
if (is_head) {
- giterr_set(GITERR_REFERENCE, "cannot delete branch '%s' as it is "
+ git_error_set(GIT_ERROR_REFERENCE, "cannot delete branch '%s' as it is "
"the current HEAD of the repository.", git_reference_name(branch));
return -1;
}
if (git_reference_is_branch(branch) && git_branch_is_checked_out(branch)) {
- giterr_set(GITERR_REFERENCE, "Cannot delete branch '%s' as it is "
+ git_error_set(GIT_ERROR_REFERENCE, "Cannot delete branch '%s' as it is "
"the current HEAD of a linked repository.", git_reference_name(branch));
return -1;
}
@@ -243,7 +243,7 @@ int git_branch_iterator_new(
branch_iter *iter;
iter = git__calloc(1, sizeof(branch_iter));
- GITERR_CHECK_ALLOC(iter);
+ GIT_ERROR_CHECK_ALLOC(iter);
iter->flags = list_flags;
@@ -344,7 +344,7 @@ int git_branch_name(
} else if (git_reference_is_remote(ref)) {
branch_name += strlen(GIT_REFS_REMOTES_DIR);
} else {
- giterr_set(GITERR_INVALID,
+ git_error_set(GIT_ERROR_INVALID,
"reference '%s' is neither a local nor a remote branch.", ref->name);
return -1;
}
@@ -402,7 +402,7 @@ int git_branch_upstream_name(
goto cleanup;
if (git_buf_len(&remote_name) == 0 || git_buf_len(&merge_name) == 0) {
- giterr_set(GITERR_REFERENCE,
+ git_error_set(GIT_ERROR_REFERENCE,
"branch '%s' does not have an upstream", refname);
error = GIT_ENOTFOUND;
goto cleanup;
@@ -452,7 +452,7 @@ int git_branch_upstream_remote(git_buf *buf, git_repository *repo, const char *r
return error;
if (git_buf_len(buf) == 0) {
- giterr_set(GITERR_REFERENCE, "branch '%s' does not have an upstream remote", refname);
+ git_error_set(GIT_ERROR_REFERENCE, "branch '%s' does not have an upstream remote", refname);
error = GIT_ENOTFOUND;
git_buf_clear(buf);
}
@@ -475,7 +475,7 @@ int git_branch_remote_name(git_buf *buf, git_repository *repo, const char *refna
/* Verify that this is a remote branch */
if (!git_reference__is_remote(refname)) {
- giterr_set(GITERR_INVALID, "reference '%s' is not a remote branch.",
+ git_error_set(GIT_ERROR_INVALID, "reference '%s' is not a remote branch.",
refname);
error = GIT_ERROR;
goto cleanup;
@@ -501,7 +501,7 @@ int git_branch_remote_name(git_buf *buf, git_repository *repo, const char *refna
} else {
git_remote_free(remote);
- giterr_set(GITERR_REFERENCE,
+ git_error_set(GIT_ERROR_REFERENCE,
"reference '%s' is ambiguous", refname);
error = GIT_EAMBIGUOUS;
goto cleanup;
@@ -515,7 +515,7 @@ int git_branch_remote_name(git_buf *buf, git_repository *repo, const char *refna
git_buf_clear(buf);
error = git_buf_puts(buf, remote_name);
} else {
- giterr_set(GITERR_REFERENCE,
+ git_error_set(GIT_ERROR_REFERENCE,
"could not determine remote for '%s'", refname);
error = GIT_ENOTFOUND;
}
@@ -604,7 +604,7 @@ int git_branch_set_upstream(git_reference *branch, const char *upstream_name)
else if (git_branch_lookup(&upstream, repo, upstream_name, GIT_BRANCH_REMOTE) == 0)
local = 0;
else {
- giterr_set(GITERR_REFERENCE,
+ git_error_set(GIT_ERROR_REFERENCE,
"cannot set upstream for branch '%s'", shortname);
return GIT_ENOTFOUND;
}
diff --git a/src/buf_text.c b/src/buf_text.c
index fa7f16b..88fcb87 100644
--- a/src/buf_text.c
+++ b/src/buf_text.c
@@ -29,7 +29,7 @@ int git_buf_text_puts_escaped(
scan += count;
}
- GITERR_CHECK_ALLOC_ADD(&alloclen, total, 1);
+ GIT_ERROR_CHECK_ALLOC_ADD(&alloclen, total, 1);
if (git_buf_grow_by(buf, alloclen) < 0)
return -1;
@@ -75,7 +75,7 @@ int git_buf_text_crlf_to_lf(git_buf *tgt, const git_buf *src)
return git_buf_set(tgt, src->ptr, src->size);
/* reduce reallocs while in the loop */
- GITERR_CHECK_ALLOC_ADD(&new_size, src->size, 1);
+ GIT_ERROR_CHECK_ALLOC_ADD(&new_size, src->size, 1);
if (git_buf_grow(tgt, new_size) < 0)
return -1;
@@ -122,8 +122,8 @@ int git_buf_text_lf_to_crlf(git_buf *tgt, const git_buf *src)
return git_buf_set(tgt, src->ptr, src->size);
/* attempt to reduce reallocs while in the loop */
- GITERR_CHECK_ALLOC_ADD(&alloclen, src->size, src->size >> 4);
- GITERR_CHECK_ALLOC_ADD(&alloclen, alloclen, 1);
+ GIT_ERROR_CHECK_ALLOC_ADD(&alloclen, src->size, src->size >> 4);
+ GIT_ERROR_CHECK_ALLOC_ADD(&alloclen, alloclen, 1);
if (git_buf_grow(tgt, alloclen) < 0)
return -1;
tgt->size = 0;
@@ -135,7 +135,7 @@ int git_buf_text_lf_to_crlf(git_buf *tgt, const git_buf *src)
if (copylen && next[-1] == '\r')
copylen--;
- GITERR_CHECK_ALLOC_ADD(&alloclen, copylen, 3);
+ GIT_ERROR_CHECK_ALLOC_ADD(&alloclen, copylen, 3);
if (git_buf_grow_by(tgt, alloclen) < 0)
return -1;
diff --git a/src/buffer.c b/src/buffer.c
index 1361bc0..0cc7f2b 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -43,7 +43,7 @@ int git_buf_try_grow(
return -1;
if (buf->asize == 0 && buf->size != 0) {
- giterr_set(GITERR_INVALID, "cannot grow a borrowed buffer");
+ git_error_set(GIT_ERROR_INVALID, "cannot grow a borrowed buffer");
return GIT_EINVALID;
}
@@ -73,7 +73,7 @@ int git_buf_try_grow(
if (mark_oom)
buf->ptr = git_buf__oom;
- giterr_set_oom();
+ git_error_set_oom();
return -1;
}
@@ -161,7 +161,7 @@ int git_buf_set(git_buf *buf, const void *data, size_t len)
git_buf_clear(buf);
} else {
if (data != buf->ptr) {
- GITERR_CHECK_ALLOC_ADD(&alloclen, len, 1);
+ GIT_ERROR_CHECK_ALLOC_ADD(&alloclen, len, 1);
ENSURE_SIZE(buf, alloclen);
memmove(buf->ptr, data, len);
}
@@ -192,7 +192,7 @@ int git_buf_sets(git_buf *buf, const char *string)
int git_buf_putc(git_buf *buf, char c)
{
size_t new_size;
- GITERR_CHECK_ALLOC_ADD(&new_size, buf->size, 2);
+ GIT_ERROR_CHECK_ALLOC_ADD(&new_size, buf->size, 2);
ENSURE_SIZE(buf, new_size);
buf->ptr[buf->size++] = c;
buf->ptr[buf->size] = '\0';
@@ -202,8 +202,8 @@ int git_buf_putc(git_buf *buf, char c)
int git_buf_putcn(git_buf *buf, char c, size_t len)
{
size_t new_size;
- GITERR_CHECK_ALLOC_ADD(&new_size, buf->size, len);
- GITERR_CHECK_ALLOC_ADD(&new_size, new_size, 1);
+ GIT_ERROR_CHECK_ALLOC_ADD(&new_size, buf->size, len);
+ GIT_ERROR_CHECK_ALLOC_ADD(&new_size, new_size, 1);
ENSURE_SIZE(buf, new_size);
memset(buf->ptr + buf->size, c, len);
buf->size += len;
@@ -218,8 +218,8 @@ int git_buf_put(git_buf *buf, const char *data, size_t len)
assert(data);
- GITERR_CHECK_ALLOC_ADD(&new_size, buf->size, len);
- GITERR_CHECK_ALLOC_ADD(&new_size, new_size, 1);
+ GIT_ERROR_CHECK_ALLOC_ADD(&new_size, buf->size, len);
+ GIT_ERROR_CHECK_ALLOC_ADD(&new_size, new_size, 1);
ENSURE_SIZE(buf, new_size);
memmove(buf->ptr + buf->size, data, len);
buf->size += len;
@@ -244,9 +244,9 @@ int git_buf_encode_base64(git_buf *buf, const char *data, size_t len)
const uint8_t *read = (const uint8_t *)data;
size_t blocks = (len / 3) + !!extra, alloclen;
- GITERR_CHECK_ALLOC_ADD(&blocks, blocks, 1);
- GITERR_CHECK_ALLOC_MULTIPLY(&alloclen, blocks, 4);
- GITERR_CHECK_ALLOC_ADD(&alloclen, alloclen, buf->size);
+ GIT_ERROR_CHECK_ALLOC_ADD(&blocks, blocks, 1);
+ GIT_ERROR_CHECK_ALLOC_MULTIPLY(&alloclen, blocks, 4);
+ GIT_ERROR_CHECK_ALLOC_ADD(&alloclen, alloclen, buf->size);
ENSURE_SIZE(buf, alloclen);
write = (uint8_t *)&buf->ptr[buf->size];
@@ -306,13 +306,13 @@ int git_buf_decode_base64(git_buf *buf, const char *base64, size_t len)
size_t orig_size = buf->size, new_size;
if (len % 4) {
- giterr_set(GITERR_INVALID, "invalid base64 input");
+ git_error_set(GIT_ERROR_INVALID, "invalid base64 input");
return -1;
}
assert(len % 4 == 0);
- GITERR_CHECK_ALLOC_ADD(&new_size, (len / 4 * 3), buf->size);
- GITERR_CHECK_ALLOC_ADD(&new_size, new_size, 1);
+ GIT_ERROR_CHECK_ALLOC_ADD(&new_size, (len / 4 * 3), buf->size);
+ GIT_ERROR_CHECK_ALLOC_ADD(&new_size, new_size, 1);
ENSURE_SIZE(buf, new_size);
for (i = 0; i < len; i += 4) {
@@ -323,7 +323,7 @@ int git_buf_decode_base64(git_buf *buf, const char *base64, size_t len)
buf->size = orig_size;
buf->ptr[buf->size] = '\0';
- giterr_set(GITERR_INVALID, "invalid base64 input");
+ git_error_set(GIT_ERROR_INVALID, "invalid base64 input");
return -1;
}
@@ -343,9 +343,9 @@ int git_buf_encode_base85(git_buf *buf, const char *data, size_t len)
{
size_t blocks = (len / 4) + !!(len % 4), alloclen;
- GITERR_CHECK_ALLOC_MULTIPLY(&alloclen, blocks, 5);
- GITERR_CHECK_ALLOC_ADD(&alloclen, alloclen, buf->size);
- GITERR_CHECK_ALLOC_ADD(&alloclen, alloclen, 1);
+ GIT_ERROR_CHECK_ALLOC_MULTIPLY(&alloclen, blocks, 5);
+ GIT_ERROR_CHECK_ALLOC_ADD(&alloclen, alloclen, buf->size);
+ GIT_ERROR_CHECK_ALLOC_ADD(&alloclen, alloclen, 1);
ENSURE_SIZE(buf, alloclen);
@@ -408,12 +408,12 @@ int git_buf_decode_base85(
if (base85_len % 5 ||
output_len > base85_len * 4 / 5) {
- giterr_set(GITERR_INVALID, "invalid base85 input");
+ git_error_set(GIT_ERROR_INVALID, "invalid base85 input");
return -1;
}
- GITERR_CHECK_ALLOC_ADD(&new_size, output_len, buf->size);
- GITERR_CHECK_ALLOC_ADD(&new_size, new_size, 1);
+ GIT_ERROR_CHECK_ALLOC_ADD(&new_size, output_len, buf->size);
+ GIT_ERROR_CHECK_ALLOC_ADD(&new_size, new_size, 1);
ENSURE_SIZE(buf, new_size);
while (output_len) {
@@ -456,7 +456,7 @@ on_error:
buf->size = orig_size;
buf->ptr[buf->size] = '\0';
- giterr_set(GITERR_INVALID, "invalid base85 input");
+ git_error_set(GIT_ERROR_INVALID, "invalid base85 input");
return -1;
}
@@ -469,8 +469,8 @@ int git_buf_decode_percent(
{
size_t str_pos, new_size;
- GITERR_CHECK_ALLOC_ADD(&new_size, buf->size, str_len);
- GITERR_CHECK_ALLOC_ADD(&new_size, new_size, 1);
+ GIT_ERROR_CHECK_ALLOC_ADD(&new_size, buf->size, str_len);
+ GIT_ERROR_CHECK_ALLOC_ADD(&new_size, new_size, 1);
ENSURE_SIZE(buf, new_size);
for (str_pos = 0; str_pos < str_len; buf->size++, str_pos++) {
@@ -495,8 +495,8 @@ int git_buf_vprintf(git_buf *buf, const char *format, va_list ap)
size_t expected_size, new_size;
int len;
- GITERR_CHECK_ALLOC_MULTIPLY(&expected_size, strlen(format), 2);
- GITERR_CHECK_ALLOC_ADD(&expected_size, expected_size, buf->size);
+ GIT_ERROR_CHECK_ALLOC_MULTIPLY(&expected_size, strlen(format), 2);
+ GIT_ERROR_CHECK_ALLOC_ADD(&expected_size, expected_size, buf->size);
ENSURE_SIZE(buf, expected_size);
while (1) {
@@ -522,8 +522,8 @@ int git_buf_vprintf(git_buf *buf, const char *format, va_list ap)
break;
}
- GITERR_CHECK_ALLOC_ADD(&new_size, buf->size, len);
- GITERR_CHECK_ALLOC_ADD(&new_size, new_size, 1);
+ GIT_ERROR_CHECK_ALLOC_ADD(&new_size, buf->size, len);
+ GIT_ERROR_CHECK_ALLOC_ADD(&new_size, new_size, 1);
ENSURE_SIZE(buf, new_size);
}
@@ -667,10 +667,10 @@ int git_buf_join_n(git_buf *buf, char separator, int nbuf, ...)
segment_len = strlen(segment);
- GITERR_CHECK_ALLOC_ADD(&total_size, total_size, segment_len);
+ GIT_ERROR_CHECK_ALLOC_ADD(&total_size, total_size, segment_len);
if (segment_len == 0 || segment[segment_len - 1] != separator)
- GITERR_CHECK_ALLOC_ADD(&total_size, total_size, 1);
+ GIT_ERROR_CHECK_ALLOC_ADD(&total_size, total_size, 1);
}
va_end(ap);
@@ -678,7 +678,7 @@ int git_buf_join_n(git_buf *buf, char separator, int nbuf, ...)
if (total_size == 0)
return 0;
- GITERR_CHECK_ALLOC_ADD(&total_size, total_size, 1);
+ GIT_ERROR_CHECK_ALLOC_ADD(&total_size, total_size, 1);
if (git_buf_grow_by(buf, total_size) < 0)
return -1;
@@ -758,9 +758,9 @@ int git_buf_join(
if (str_a >= buf->ptr && str_a < buf->ptr + buf->size)
offset_a = str_a - buf->ptr;
- GITERR_CHECK_ALLOC_ADD(&alloc_len, strlen_a, strlen_b);
- GITERR_CHECK_ALLOC_ADD(&alloc_len, alloc_len, need_sep);
- GITERR_CHECK_ALLOC_ADD(&alloc_len, alloc_len, 1);
+ GIT_ERROR_CHECK_ALLOC_ADD(&alloc_len, strlen_a, strlen_b);
+ GIT_ERROR_CHECK_ALLOC_ADD(&alloc_len, alloc_len, need_sep);
+ GIT_ERROR_CHECK_ALLOC_ADD(&alloc_len, alloc_len, 1);
ENSURE_SIZE(buf, alloc_len);
/* fix up internal pointers */
@@ -810,11 +810,11 @@ int git_buf_join3(
sep_b = (str_b[len_b - 1] != separator);
}
- GITERR_CHECK_ALLOC_ADD(&len_total, len_a, sep_a);
- GITERR_CHECK_ALLOC_ADD(&len_total, len_total, len_b);
- GITERR_CHECK_ALLOC_ADD(&len_total, len_total, sep_b);
- GITERR_CHECK_ALLOC_ADD(&len_total, len_total, len_c);
- GITERR_CHECK_ALLOC_ADD(&len_total, len_total, 1);
+ GIT_ERROR_CHECK_ALLOC_ADD(&len_total, len_a, sep_a);
+ GIT_ERROR_CHECK_ALLOC_ADD(&len_total, len_total, len_b);
+ GIT_ERROR_CHECK_ALLOC_ADD(&len_total, len_total, sep_b);
+ GIT_ERROR_CHECK_ALLOC_ADD(&len_total, len_total, len_c);
+ GIT_ERROR_CHECK_ALLOC_ADD(&len_total, len_total, 1);
ENSURE_SIZE(buf, len_total);
tgt = buf->ptr;
@@ -877,8 +877,8 @@ int git_buf_splice(
/* Ported from git.git
* https://github.com/git/git/blob/16eed7c/strbuf.c#L159-176
*/
- GITERR_CHECK_ALLOC_ADD(&new_size, (buf->size - nb_to_remove), nb_to_insert);
- GITERR_CHECK_ALLOC_ADD(&alloc_size, new_size, 1);
+ GIT_ERROR_CHECK_ALLOC_ADD(&new_size, (buf->size - nb_to_remove), nb_to_insert);
+ GIT_ERROR_CHECK_ALLOC_ADD(&alloc_size, new_size, 1);
ENSURE_SIZE(buf, alloc_size);
memmove(splice_loc + nb_to_insert,
@@ -995,14 +995,14 @@ int git_buf_unquote(git_buf *buf)
/* \xyz digits convert to the char*/
case '0': case '1': case '2': case '3':
if (j == buf->size-3) {
- giterr_set(GITERR_INVALID,
+ git_error_set(GIT_ERROR_INVALID,
"truncated quoted character \\%c", ch);
return -1;
}
if (buf->ptr[j+1] < '0' || buf->ptr[j+1] > '7' ||
buf->ptr[j+2] < '0' || buf->ptr[j+2] > '7') {
- giterr_set(GITERR_INVALID,
+ git_error_set(GIT_ERROR_INVALID,
"truncated quoted character \\%c%c%c",
buf->ptr[j], buf->ptr[j+1], buf->ptr[j+2]);
return -1;
@@ -1015,7 +1015,7 @@ int git_buf_unquote(git_buf *buf)
break;
default:
- giterr_set(GITERR_INVALID, "invalid quoted character \\%c", ch);
+ git_error_set(GIT_ERROR_INVALID, "invalid quoted character \\%c", ch);
return -1;
}
}
@@ -1029,6 +1029,6 @@ int git_buf_unquote(git_buf *buf)
return 0;
invalid:
- giterr_set(GITERR_INVALID, "invalid quoted line");
+ git_error_set(GIT_ERROR_INVALID, "invalid quoted line");
return -1;
}
diff --git a/src/cache.c b/src/cache.c
index d786104..66107ea 100644
--- a/src/cache.c
+++ b/src/cache.c
@@ -33,7 +33,7 @@ static size_t git_cache__max_object_size[8] = {
int git_cache_set_max_object_size(git_object_t type, size_t size)
{
if (type < 0 || (size_t)type >= ARRAY_SIZE(git_cache__max_object_size)) {
- giterr_set(GITERR_INVALID, "type out of range");
+ git_error_set(GIT_ERROR_INVALID, "type out of range");
return -1;
}
@@ -66,9 +66,9 @@ int git_cache_init(git_cache *cache)
{
memset(cache, 0, sizeof(*cache));
cache->map = git_oidmap_alloc();
- GITERR_CHECK_ALLOC(cache->map);
+ GIT_ERROR_CHECK_ALLOC(cache->map);
if (git_rwlock_init(&cache->lock)) {
- giterr_set(GITERR_OS, "failed to initialize cache rwlock");
+ git_error_set(GIT_ERROR_OS, "failed to initialize cache rwlock");
return -1;
}
return 0;
diff --git a/src/checkout.c b/src/checkout.c
index a57e919..fe02089 100644
--- a/src/checkout.c
+++ b/src/checkout.c
@@ -146,7 +146,7 @@ static int checkout_notify(
int error = data->opts.notify_cb(
why, path, baseline, target, workdir, data->opts.notify_payload);
- return giterr_set_after_callback_function(
+ return git_error_set_after_callback_function(
error, "git_checkout notification");
}
}
@@ -193,7 +193,7 @@ static bool checkout_is_workdir_modified(
bool rval = false;
if (git_submodule_lookup(&sm, data->repo, wditem->path) < 0) {
- giterr_clear();
+ git_error_clear();
return true;
}
@@ -354,7 +354,7 @@ static bool wd_item_is_removable(
static int checkout_queue_remove(checkout_data *data, const char *path)
{
char *copy = git_pool_strdup(&data->pool, path);
- GITERR_CHECK_ALLOC(copy);
+ GIT_ERROR_CHECK_ALLOC(copy);
return git_vector_insert(&data->removes, copy);
}
@@ -492,7 +492,7 @@ static int checkout_action_with_wd(
switch (delta->status) {
case GIT_DELTA_UNMODIFIED: /* case 14/15 or 33 */
if (checkout_is_workdir_modified(data, &delta->old_file, &delta->new_file, wd)) {
- GITERR_CHECK_ERROR(
+ GIT_ERROR_CHECK_ERROR(
checkout_notify(data, GIT_CHECKOUT_NOTIFY_DIRTY, delta, wd) );
*action = CHECKOUT_ACTION_IF(FORCE, UPDATE_BLOB, NONE);
}
@@ -561,7 +561,7 @@ static int checkout_action_with_wd_blocker(
switch (delta->status) {
case GIT_DELTA_UNMODIFIED:
/* should show delta as dirty / deleted */
- GITERR_CHECK_ERROR(
+ GIT_ERROR_CHECK_ERROR(
checkout_notify(data, GIT_CHECKOUT_NOTIFY_DIRTY, delta, wd) );
*action = CHECKOUT_ACTION_IF(FORCE, REMOVE_AND_UPDATE, NONE);
break;
@@ -594,9 +594,9 @@ static int checkout_action_with_wd_dir(
switch (delta->status) {
case GIT_DELTA_UNMODIFIED: /* case 19 or 24 (or 34 but not really) */
- GITERR_CHECK_ERROR(
+ GIT_ERROR_CHECK_ERROR(
checkout_notify(data, GIT_CHECKOUT_NOTIFY_DIRTY, delta, NULL));
- GITERR_CHECK_ERROR(
+ GIT_ERROR_CHECK_ERROR(
checkout_notify(data, GIT_CHECKOUT_NOTIFY_UNTRACKED, NULL, wd));
*action = CHECKOUT_ACTION_IF(FORCE, REMOVE_AND_UPDATE, NONE);
break;
@@ -611,7 +611,7 @@ static int checkout_action_with_wd_dir(
break;
case GIT_DELTA_DELETED: /* case 11 (and 27 for dir) */
if (delta->old_file.mode != GIT_FILEMODE_TREE)
- GITERR_CHECK_ERROR(
+ GIT_ERROR_CHECK_ERROR(
checkout_notify(data, GIT_CHECKOUT_NOTIFY_UNTRACKED, NULL, wd));
break;
case GIT_DELTA_TYPECHANGE: /* case 24 or 31 */
@@ -902,7 +902,7 @@ static int checkout_conflict_append_update(
int error;
conflict = git__calloc(1, sizeof(checkout_conflictdata));
- GITERR_CHECK_ALLOC(conflict);
+ GIT_ERROR_CHECK_ALLOC(conflict);
conflict->ancestor = ancestor;
conflict->ours = ours;
@@ -1044,20 +1044,20 @@ static int checkout_conflicts_load_byname_entry(
*theirs_out = NULL;
if (!name_entry->ancestor) {
- giterr_set(GITERR_INDEX, "a NAME entry exists without an ancestor");
+ git_error_set(GIT_ERROR_INDEX, "a NAME entry exists without an ancestor");
error = -1;
goto done;
}
if (!name_entry->ours && !name_entry->theirs) {
- giterr_set(GITERR_INDEX, "a NAME entry exists without an ours or theirs");
+ git_error_set(GIT_ERROR_INDEX, "a NAME entry exists without an ours or theirs");
error = -1;
goto done;
}
if ((ancestor = checkout_conflicts_search_ancestor(data,
name_entry->ancestor)) == NULL) {
- giterr_set(GITERR_INDEX,
+ git_error_set(GIT_ERROR_INDEX,
"a NAME entry referenced ancestor entry '%s' which does not exist in the main index",
name_entry->ancestor);
error = -1;
@@ -1069,7 +1069,7 @@ static int checkout_conflicts_load_byname_entry(
ours = ancestor;
else if ((ours = checkout_conflicts_search_branch(data, name_entry->ours)) == NULL ||
ours->ours == NULL) {
- giterr_set(GITERR_INDEX,
+ git_error_set(GIT_ERROR_INDEX,
"a NAME entry referenced our entry '%s' which does not exist in the main index",
name_entry->ours);
error = -1;
@@ -1084,7 +1084,7 @@ static int checkout_conflicts_load_byname_entry(
theirs = ours;
else if ((theirs = checkout_conflicts_search_branch(data, name_entry->theirs)) == NULL ||
theirs->theirs == NULL) {
- giterr_set(GITERR_INDEX,
+ git_error_set(GIT_ERROR_INDEX,
"a NAME entry referenced their entry '%s' which does not exist in the main index",
name_entry->theirs);
error = -1;
@@ -1183,7 +1183,7 @@ static int checkout_conflicts_mark_directoryfile(
if ((error = git_index_find(&j, index, path)) < 0) {
if (error == GIT_ENOTFOUND)
- giterr_set(GITERR_INDEX,
+ git_error_set(GIT_ERROR_INDEX,
"index inconsistency, could not find entry for expected conflict '%s'", path);
goto done;
@@ -1191,7 +1191,7 @@ static int checkout_conflicts_mark_directoryfile(
for (; j < len; j++) {
if ((entry = git_index_get_byindex(index, j)) == NULL) {
- giterr_set(GITERR_INDEX,
+ git_error_set(GIT_ERROR_INDEX,
"index inconsistency, truncated index while loading expected conflict '%s'", path);
error = -1;
goto done;
@@ -1252,7 +1252,7 @@ static int checkout_conflict_append_remove(
else
abort();
- GITERR_CHECK_ALLOC(name);
+ GIT_ERROR_CHECK_ALLOC(name);
return git_vector_insert(&data->remove_conflicts, (char *)name);
}
@@ -1277,14 +1277,14 @@ static int checkout_verify_paths(
if (action & CHECKOUT_ACTION__REMOVE) {
if (!git_path_isvalid(repo, delta->old_file.path, delta->old_file.mode, flags)) {
- giterr_set(GITERR_CHECKOUT, "cannot remove invalid path '%s'", delta->old_file.path);
+ git_error_set(GIT_ERROR_CHECKOUT, "cannot remove invalid path '%s'", delta->old_file.path);
return -1;
}
}
if (action & ~CHECKOUT_ACTION__REMOVE) {
if (!git_path_isvalid(repo, delta->new_file.path, delta->new_file.mode, flags)) {
- giterr_set(GITERR_CHECKOUT, "cannot checkout to invalid path '%s'", delta->new_file.path);
+ git_error_set(GIT_ERROR_CHECKOUT, "cannot checkout to invalid path '%s'", delta->new_file.path);
return -1;
}
}
@@ -1354,7 +1354,7 @@ static int checkout_get_actions(
if (counts[CHECKOUT_ACTION__CONFLICT] > 0 &&
(data->strategy & GIT_CHECKOUT_ALLOW_CONFLICTS) == 0)
{
- giterr_set(GITERR_CHECKOUT, "%"PRIuZ" %s checkout",
+ git_error_set(GIT_ERROR_CHECKOUT, "%"PRIuZ" %s checkout",
counts[CHECKOUT_ACTION__CONFLICT],
counts[CHECKOUT_ACTION__CONFLICT] == 1 ?
"conflict prevents" : "conflicts prevent");
@@ -1453,10 +1453,10 @@ static int mkpath2file(
*/
error = git_futils_rmdir_r(path, NULL, GIT_RMDIR_REMOVE_FILES);
} else if (errno != ENOENT) {
- giterr_set(GITERR_OS, "failed to stat '%s'", path);
+ git_error_set(GIT_ERROR_OS, "failed to stat '%s'", path);
return GIT_EEXISTS;
} else {
- giterr_clear();
+ git_error_clear();
}
}
@@ -1477,7 +1477,7 @@ static int checkout_stream_write(
int ret;
if ((ret = p_write(stream->fd, buffer, len)) < 0)
- giterr_set(GITERR_OS, "could not write to '%s'", stream->path);
+ git_error_set(GIT_ERROR_OS, "could not write to '%s'", stream->path);
return ret;
}
@@ -1526,7 +1526,7 @@ static int blob_content_to_file(
mode = GIT_FILEMODE_BLOB;
if ((fd = p_open(path, flags, mode)) < 0) {
- giterr_set(GITERR_OS, "could not open '%s' for writing", path);
+ git_error_set(GIT_ERROR_OS, "could not open '%s' for writing", path);
return fd;
}
@@ -1563,7 +1563,7 @@ static int blob_content_to_file(
data->perfdata.stat_calls++;
if ((error = p_stat(path, st)) < 0) {
- giterr_set(GITERR_OS, "failed to stat '%s'", path);
+ git_error_set(GIT_ERROR_OS, "failed to stat '%s'", path);
return error;
}
@@ -1590,7 +1590,7 @@ static int blob_content_to_link(
if (data->can_symlink) {
if ((error = p_symlink(git_buf_cstr(&linktarget), path)) < 0)
- giterr_set(GITERR_OS, "could not create symlink %s", path);
+ git_error_set(GIT_ERROR_OS, "could not create symlink %s", path);
} else {
error = git_futils_fake_symlink(git_buf_cstr(&linktarget), path);
}
@@ -1599,7 +1599,7 @@ static int blob_content_to_link(
data->perfdata.stat_calls++;
if ((error = p_lstat(path, st)) < 0)
- giterr_set(GITERR_CHECKOUT, "could not stat symlink %s", path);
+ git_error_set(GIT_ERROR_CHECKOUT, "could not stat symlink %s", path);
st->st_mode = GIT_FILEMODE_LINK;
}
@@ -1643,8 +1643,8 @@ static int checkout_submodule_update_index(
data->perfdata.stat_calls++;
if (p_stat(fullpath->ptr, &st) < 0) {
- giterr_set(
- GITERR_CHECKOUT, "could not stat submodule %s\n", file->path);
+ git_error_set(
+ GIT_ERROR_CHECKOUT, "could not stat submodule %s\n", file->path);
return GIT_ENOTFOUND;
}
@@ -1675,7 +1675,7 @@ static int checkout_submodule(
* have a .gitmodules - core Git just makes an empty directory
*/
if (error == GIT_ENOTFOUND) {
- giterr_clear();
+ git_error_clear();
return checkout_submodule_update_index(data, file);
}
@@ -1717,7 +1717,7 @@ static int checkout_safe_for_update_only(
return 0;
/* otherwise, stat error and no update */
- giterr_set(GITERR_OS, "failed to stat '%s'", path);
+ git_error_set(GIT_ERROR_OS, "failed to stat '%s'", path);
return -1;
}
@@ -1756,7 +1756,7 @@ static int checkout_write_content(
if ((data->strategy & GIT_CHECKOUT_ALLOW_CONFLICTS) != 0 &&
(error == GIT_ENOTFOUND || error == GIT_EEXISTS))
{
- giterr_clear();
+ git_error_clear();
error = 0;
}
@@ -1863,7 +1863,7 @@ static int checkout_deferred_remove(git_repository *repo, const char *path)
if (error == GIT_ENOTFOUND) {
error = 0;
- giterr_clear();
+ git_error_clear();
}
return error;
@@ -1989,7 +1989,7 @@ static int checkout_path_suffixed(git_buf *path, const char *suffix)
if (i == INT_MAX) {
git_buf_truncate(path, path_len);
- giterr_set(GITERR_CHECKOUT, "could not write '%s': working directory file exists", path->ptr);
+ git_error_set(GIT_ERROR_CHECKOUT, "could not write '%s': working directory file exists", path->ptr);
return GIT_EEXISTS;
}
@@ -2123,7 +2123,7 @@ static int checkout_write_merge(
goto done;
if (result.path == NULL || result.mode == 0) {
- giterr_set(GITERR_CHECKOUT, "could not merge contents of file");
+ git_error_set(GIT_ERROR_CHECKOUT, "could not merge contents of file");
error = GIT_ECONFLICT;
goto done;
}
@@ -2179,7 +2179,7 @@ static int checkout_conflict_add(
int error = git_index_remove(data->index, conflict->path, 0);
if (error == GIT_ENOTFOUND)
- giterr_clear();
+ git_error_clear();
else if (error < 0)
return error;
@@ -2370,7 +2370,7 @@ static int checkout_data_init(
memset(data, 0, sizeof(*data));
if (!repo) {
- giterr_set(GITERR_CHECKOUT, "cannot checkout nothing");
+ git_error_set(GIT_ERROR_CHECKOUT, "cannot checkout nothing");
return -1;
}
@@ -2381,7 +2381,7 @@ static int checkout_data_init(
data->repo = repo;
data->target = target;
- GITERR_CHECK_VERSION(
+ GIT_ERROR_CHECK_VERSION(
proposed, GIT_CHECKOUT_OPTIONS_VERSION, "git_checkout_options");
if (!proposed)
@@ -2424,7 +2424,7 @@ static int checkout_data_init(
*/
if (git_index_has_conflicts(data->index)) {
error = GIT_ECONFLICT;
- giterr_set(GITERR_CHECKOUT,
+ git_error_set(GIT_ERROR_CHECKOUT,
"unresolved conflicts exist in the index");
goto cleanup;
}
@@ -2483,7 +2483,7 @@ static int checkout_data_init(
if (error == GIT_EUNBORNBRANCH) {
error = 0;
- giterr_clear();
+ git_error_clear();
}
if (error < 0)
@@ -2506,7 +2506,7 @@ static int checkout_data_init(
else if (strcmp(conflict_style->value, "diff3") == 0)
data->opts.checkout_strategy |= GIT_CHECKOUT_CONFLICT_STYLE_DIFF3;
else {
- giterr_set(GITERR_CHECKOUT, "unknown style '%s' given for 'merge.conflictstyle'",
+ git_error_set(GIT_ERROR_CHECKOUT, "unknown style '%s' given for 'merge.conflictstyle'",
conflict_style->value);
error = -1;
git_config_entry_free(conflict_style);
@@ -2688,7 +2688,7 @@ int git_checkout_index(
git_iterator *index_i;
if (!index && !repo) {
- giterr_set(GITERR_CHECKOUT,
+ git_error_set(GIT_ERROR_CHECKOUT,
"must provide either repository or index to checkout");
return -1;
}
@@ -2696,7 +2696,7 @@ int git_checkout_index(
if (index && repo &&
git_index_owner(index) &&
git_index_owner(index) != repo) {
- giterr_set(GITERR_CHECKOUT,
+ git_error_set(GIT_ERROR_CHECKOUT,
"index to checkout does not match repository");
return -1;
} else if(index && repo && !git_index_owner(index)) {
@@ -2735,12 +2735,12 @@ int git_checkout_tree(
git_iterator_options iter_opts = GIT_ITERATOR_OPTIONS_INIT;
if (!treeish && !repo) {
- giterr_set(GITERR_CHECKOUT,
+ git_error_set(GIT_ERROR_CHECKOUT,
"must provide either repository or tree to checkout");
return -1;
}
if (treeish && repo && git_object_owner(treeish) != repo) {
- giterr_set(GITERR_CHECKOUT,
+ git_error_set(GIT_ERROR_CHECKOUT,
"object to checkout does not match repository");
return -1;
}
@@ -2750,16 +2750,16 @@ int git_checkout_tree(
if (treeish) {
if (git_object_peel((git_object **)&tree, treeish, GIT_OBJECT_TREE) < 0) {
- giterr_set(
- GITERR_CHECKOUT, "provided object cannot be peeled to a tree");
+ git_error_set(
+ GIT_ERROR_CHECKOUT, "provided object cannot be peeled to a tree");
return -1;
}
}
else {
if ((error = checkout_lookup_head_tree(&tree, repo)) < 0) {
if (error != GIT_EUNBORNBRANCH)
- giterr_set(
- GITERR_CHECKOUT,
+ git_error_set(
+ GIT_ERROR_CHECKOUT,
"HEAD could not be peeled to a tree and no treeish given");
return error;
}
diff --git a/src/cherrypick.c b/src/cherrypick.c
index ba404ac..26935c6 100644
--- a/src/cherrypick.c
+++ b/src/cherrypick.c
@@ -108,7 +108,7 @@ static int cherrypick_seterr(git_commit *commit, const char *fmt)
{
char commit_oidstr[GIT_OID_HEXSZ + 1];
- giterr_set(GITERR_CHERRYPICK, fmt,
+ git_error_set(GIT_ERROR_CHERRYPICK, fmt,
git_oid_tostr(commit_oidstr, GIT_OID_HEXSZ + 1, git_commit_id(commit)));
return -1;
@@ -179,7 +179,7 @@ int git_cherrypick(
assert(repo && commit);
- GITERR_CHECK_VERSION(given_opts, GIT_CHERRYPICK_OPTIONS_VERSION, "git_cherrypick_options");
+ GIT_ERROR_CHECK_VERSION(given_opts, GIT_CHERRYPICK_OPTIONS_VERSION, "git_cherrypick_options");
if ((error = git_repository__ensure_not_bare(repo, "cherry-pick")) < 0)
return error;
diff --git a/src/clone.c b/src/clone.c
index e2bf320..8688da9 100644
--- a/src/clone.c
+++ b/src/clone.c
@@ -176,7 +176,7 @@ static int update_head_to_remote(
refspec = git_remote__matching_refspec(remote, git_buf_cstr(&branch));
if (refspec == NULL) {
- giterr_set(GITERR_NET, "the remote's default branch does not fit the refspec configuration");
+ git_error_set(GIT_ERROR_NET, "the remote's default branch does not fit the refspec configuration");
error = GIT_EINVALIDSPEC;
goto cleanup;
}
@@ -332,7 +332,7 @@ static int clone_into(git_repository *repo, git_remote *_remote, const git_fetch
assert(repo && _remote);
if (!git_repository_is_empty(repo)) {
- giterr_set(GITERR_INVALID, "the repository is not empty");
+ git_error_set(GIT_ERROR_INVALID, "the repository is not empty");
return -1;
}
@@ -400,11 +400,11 @@ int git_clone(
if (_options)
memcpy(&options, _options, sizeof(git_clone_options));
- GITERR_CHECK_VERSION(&options, GIT_CLONE_OPTIONS_VERSION, "git_clone_options");
+ GIT_ERROR_CHECK_VERSION(&options, GIT_CLONE_OPTIONS_VERSION, "git_clone_options");
/* Only clone to a new directory or an empty directory */
if (git_path_exists(local_path) && !git_path_is_empty_dir(local_path)) {
- giterr_set(GITERR_INVALID,
+ git_error_set(GIT_ERROR_INVALID,
"'%s' exists and is not an empty directory", local_path);
return GIT_EEXISTS;
}
@@ -441,14 +441,14 @@ int git_clone(
if (error != 0) {
git_error_state last_error = {0};
- giterr_state_capture(&last_error, error);
+ git_error_state_capture(&last_error, error);
git_repository_free(repo);
repo = NULL;
(void)git_futils_rmdir_r(local_path, NULL, rmdir_flags);
- giterr_state_restore(&last_error);
+ git_error_state_restore(&last_error);
}
*out = repo;
@@ -496,7 +496,7 @@ static int clone_local_into(git_repository *repo, git_remote *remote, const git_
assert(repo && remote);
if (!git_repository_is_empty(repo)) {
- giterr_set(GITERR_INVALID, "the repository is not empty");
+ git_error_set(GIT_ERROR_INVALID, "the repository is not empty");
return -1;
}
diff --git a/src/commit.c b/src/commit.c
index 3338b17..513fdcc 100644
--- a/src/commit.c
+++ b/src/commit.c
@@ -99,14 +99,14 @@ static int validate_tree_and_parents(git_array_oid_t *parents, git_repository *r
}
parent_cpy = git_array_alloc(*parents);
- GITERR_CHECK_ALLOC(parent_cpy);
+ GIT_ERROR_CHECK_ALLOC(parent_cpy);
git_oid_cpy(parent_cpy, parent);
i++;
}
if (current_id && (parents->size == 0 || git_oid_cmp(current_id, git_array_get(*parents, 0)))) {
- giterr_set(GITERR_OBJECT, "failed to create commit: current tip is not the first parent");
+ git_error_set(GIT_ERROR_OBJECT, "failed to create commit: current tip is not the first parent");
error = GIT_EMODIFIED;
goto on_error;
}
@@ -143,7 +143,7 @@ static int git_commit__create_internal(
if (error < 0 && error != GIT_ENOTFOUND)
return error;
}
- giterr_clear();
+ git_error_clear();
if (ref)
current_id = git_reference_target(ref);
@@ -351,7 +351,7 @@ int git_commit_amend(
if (!tree) {
git_tree *old_tree;
- GITERR_CHECK_ERROR( git_commit_tree(&old_tree, commit_to_amend) );
+ GIT_ERROR_CHECK_ERROR( git_commit_tree(&old_tree, commit_to_amend) );
git_oid_cpy(&tree_id, git_tree_id(old_tree));
git_tree_free(old_tree);
} else {
@@ -365,7 +365,7 @@ int git_commit_amend(
if (git_oid_cmp(git_commit_id(commit_to_amend), git_reference_target(ref))) {
git_reference_free(ref);
- giterr_set(GITERR_REFERENCE, "commit to amend is not the tip of the given branch");
+ git_error_set(GIT_ERROR_REFERENCE, "commit to amend is not the tip of the given branch");
return -1;
}
}
@@ -396,7 +396,7 @@ int git_commit__parse_raw(void *_commit, const char *data, size_t size)
/* Allocate for one, which will allow not to realloc 90% of the time */
git_array_init_to_size(commit->parent_ids, 1);
- GITERR_CHECK_ARRAY(commit->parent_ids);
+ GIT_ERROR_CHECK_ARRAY(commit->parent_ids);
/* The tree is always the first field */
if (git_oid__parse(&commit->tree_id, &buffer, buffer_end, "tree ") < 0)
@@ -408,13 +408,13 @@ int git_commit__parse_raw(void *_commit, const char *data, size_t size)
while (git_oid__parse(&parent_id, &buffer, buffer_end, "parent ") == 0) {
git_oid *new_id = git_array_alloc(commit->parent_ids);
- GITERR_CHECK_ALLOC(new_id);
+ GIT_ERROR_CHECK_ALLOC(new_id);
git_oid_cpy(new_id, &parent_id);
}
commit->author = git__malloc(sizeof(git_signature));
- GITERR_CHECK_ALLOC(commit->author);
+ GIT_ERROR_CHECK_ALLOC(commit->author);
if (git_signature__parse(commit->author, &buffer, buffer_end, "author ", '\n') < 0)
return -1;
@@ -430,7 +430,7 @@ int git_commit__parse_raw(void *_commit, const char *data, size_t size)
/* Always parse the committer; we need the commit time */
commit->committer = git__malloc(sizeof(git_signature));
- GITERR_CHECK_ALLOC(commit->committer);
+ GIT_ERROR_CHECK_ALLOC(commit->committer);
if (git_signature__parse(commit->committer, &buffer, buffer_end, "committer ", '\n') < 0)
return -1;
@@ -448,7 +448,7 @@ int git_commit__parse_raw(void *_commit, const char *data, size_t size)
buffer += strlen("encoding ");
commit->message_encoding = git__strndup(buffer, eoln - buffer);
- GITERR_CHECK_ALLOC(commit->message_encoding);
+ GIT_ERROR_CHECK_ALLOC(commit->message_encoding);
}
if (eoln < buffer_end && *eoln == '\n')
@@ -458,7 +458,7 @@ int git_commit__parse_raw(void *_commit, const char *data, size_t size)
header_len = buffer - buffer_start;
commit->raw_header = git__strndup(buffer_start, header_len);
- GITERR_CHECK_ALLOC(commit->raw_header);
+ GIT_ERROR_CHECK_ALLOC(commit->raw_header);
/* point "buffer" to data after header, +1 for the final LF */
buffer = buffer_start + header_len + 1;
@@ -468,12 +468,12 @@ int git_commit__parse_raw(void *_commit, const char *data, size_t size)
commit->raw_message = git__strndup(buffer, buffer_end - buffer);
else
commit->raw_message = git__strdup("");
- GITERR_CHECK_ALLOC(commit->raw_message);
+ GIT_ERROR_CHECK_ALLOC(commit->raw_message);
return 0;
bad_buffer:
- giterr_set(GITERR_OBJECT, "failed to parse bad commit object");
+ git_error_set(GIT_ERROR_OBJECT, "failed to parse bad commit object");
return -1;
}
@@ -610,7 +610,7 @@ int git_commit_parent(
parent_id = git_commit_parent_id(commit, n);
if (parent_id == NULL) {
- giterr_set(GITERR_INVALID, "parent %u does not exist", n);
+ git_error_set(GIT_ERROR_INVALID, "parent %u does not exist", n);
return GIT_ENOTFOUND;
}
@@ -699,14 +699,14 @@ int git_commit_header_field(git_buf *out, const git_commit *commit, const char *
return 0;
}
- giterr_set(GITERR_OBJECT, "no such field '%s'", field);
+ git_error_set(GIT_ERROR_OBJECT, "no such field '%s'", field);
return GIT_ENOTFOUND;
malformed:
- giterr_set(GITERR_OBJECT, "malformed header");
+ git_error_set(GIT_ERROR_OBJECT, "malformed header");
return -1;
oom:
- giterr_set_oom();
+ git_error_set_oom();
return -1;
}
@@ -731,7 +731,7 @@ int git_commit_extract_signature(git_buf *signature, git_buf *signed_data, git_r
return error;
if (obj->cached.type != GIT_OBJECT_COMMIT) {
- giterr_set(GITERR_INVALID, "the requested type does not match the type in ODB");
+ git_error_set(GIT_ERROR_INVALID, "the requested type does not match the type in ODB");
error = GIT_ENOTFOUND;
goto cleanup;
}
@@ -783,16 +783,16 @@ int git_commit_extract_signature(git_buf *signature, git_buf *signed_data, git_r
return error;
}
- giterr_set(GITERR_OBJECT, "this commit is not signed");
+ git_error_set(GIT_ERROR_OBJECT, "this commit is not signed");
error = GIT_ENOTFOUND;
goto cleanup;
malformed:
- giterr_set(GITERR_OBJECT, "malformed header");
+ git_error_set(GIT_ERROR_OBJECT, "malformed header");
error = -1;
goto cleanup;
oom:
- giterr_set_oom();
+ git_error_set_oom();
error = -1;
goto cleanup;
@@ -872,7 +872,7 @@ int git_commit_create_with_signature(
/* We start by identifying the end of the commit header */
header_end = strstr(commit_content, "\n\n");
if (!header_end) {
- giterr_set(GITERR_INVALID, "malformed commit contents");
+ git_error_set(GIT_ERROR_INVALID, "malformed commit contents");
return -1;
}
diff --git a/src/commit_list.c b/src/commit_list.c
index 078a87b..5496dca 100644
--- a/src/commit_list.c
+++ b/src/commit_list.c
@@ -61,7 +61,7 @@ static int commit_error(git_commit_list_node *commit, const char *msg)
git_oid_fmt(commit_oid, &commit->oid);
commit_oid[GIT_OID_HEXSZ] = '\0';
- giterr_set(GITERR_ODB, "failed to parse commit %s - %s", commit_oid, msg);
+ git_error_set(GIT_ERROR_ODB, "failed to parse commit %s - %s", commit_oid, msg);
return -1;
}
@@ -126,7 +126,7 @@ static int commit_quick_parse(
}
commit->parents = alloc_parents(walk, commit, parents);
- GITERR_CHECK_ALLOC(commit->parents);
+ GIT_ERROR_CHECK_ALLOC(commit->parents);
buffer = parents_start;
for (i = 0; i < parents; ++i) {
@@ -193,7 +193,7 @@ int git_commit_list_parse(git_revwalk *walk, git_commit_list_node *commit)
return error;
if (obj->cached.type != GIT_OBJECT_COMMIT) {
- giterr_set(GITERR_INVALID, "object is no commit object");
+ git_error_set(GIT_ERROR_INVALID, "object is no commit object");
error = -1;
} else
error = commit_quick_parse(
diff --git a/src/common.h b/src/common.h
index cb980c1..6e1eac8 100644
--- a/src/common.h
+++ b/src/common.h
@@ -89,30 +89,30 @@
/**
* Check a pointer allocation result, returning -1 if it failed.
*/
-#define GITERR_CHECK_ALLOC(ptr) if (ptr == NULL) { return -1; }
+#define GIT_ERROR_CHECK_ALLOC(ptr) if (ptr == NULL) { return -1; }
/**
* Check a buffer allocation result, returning -1 if it failed.
*/
-#define GITERR_CHECK_ALLOC_BUF(buf) if ((void *)(buf) == NULL || git_buf_oom(buf)) { return -1; }
+#define GIT_ERROR_CHECK_ALLOC_BUF(buf) if ((void *)(buf) == NULL || git_buf_oom(buf)) { return -1; }
/**
* Check a return value and propagate result if non-zero.
*/
-#define GITERR_CHECK_ERROR(code) \
+#define GIT_ERROR_CHECK_ERROR(code) \
do { int _err = (code); if (_err) return _err; } while (0)
/**
* Set the error message for this thread, formatting as needed.
*/
-void giterr_set(int error_class, const char *string, ...) GIT_FORMAT_PRINTF(2, 3);
+void git_error_set(int error_class, const char *string, ...) GIT_FORMAT_PRINTF(2, 3);
/**
* Set the error message for a regex failure, using the internal regex
* error code lookup and return a libgit error code.
*/
-int giterr_set_regex(const regex_t *regex, int error_code);
+int git_error_set_regex(const regex_t *regex, int error_code);
/**
* Set error message for user callback if needed.
@@ -122,35 +122,35 @@ int giterr_set_regex(const regex_t *regex, int error_code);
*
* @return This always returns the `error_code` parameter.
*/
-GIT_INLINE(int) giterr_set_after_callback_function(
+GIT_INLINE(int) git_error_set_after_callback_function(
int error_code, const char *action)
{
if (error_code) {
- const git_error *e = giterr_last();
+ const git_error *e = git_error_last();
if (!e || !e->message)
- giterr_set(e ? e->klass : GITERR_CALLBACK,
+ git_error_set(e ? e->klass : GIT_ERROR_CALLBACK,
"%s callback returned %d", action, error_code);
}
return error_code;
}
#ifdef GIT_WIN32
-#define giterr_set_after_callback(code) \
- giterr_set_after_callback_function((code), __FUNCTION__)
+#define git_error_set_after_callback(code) \
+ git_error_set_after_callback_function((code), __FUNCTION__)
#else
-#define giterr_set_after_callback(code) \
- giterr_set_after_callback_function((code), __func__)
+#define git_error_set_after_callback(code) \
+ git_error_set_after_callback_function((code), __func__)
#endif
/**
* Gets the system error code for this thread.
*/
-int giterr_system_last(void);
+int git_error_system_last(void);
/**
* Sets the system error code for this thread.
*/
-void giterr_system_set(int code);
+void git_error_system_set(int code);
/**
* Structure to preserve libgit2 error state
@@ -166,20 +166,20 @@ typedef struct {
* If `error_code` is zero, this does not clear the current error state.
* You must either restore this error state, or free it.
*/
-extern int giterr_state_capture(git_error_state *state, int error_code);
+extern int git_error_state_capture(git_error_state *state, int error_code);
/**
* Restore error state to a previous value, returning saved error code.
*/
-extern int giterr_state_restore(git_error_state *state);
+extern int git_error_state_restore(git_error_state *state);
/** Free an error state. */
-extern void giterr_state_free(git_error_state *state);
+extern void git_error_state_free(git_error_state *state);
/**
* Check a versioned structure for validity
*/
-GIT_INLINE(int) giterr__check_version(const void *structure, unsigned int expected_max, const char *name)
+GIT_INLINE(int) git_error__check_version(const void *structure, unsigned int expected_max, const char *name)
{
unsigned int actual;
@@ -190,10 +190,10 @@ GIT_INLINE(int) giterr__check_version(const void *structure, unsigned int expect
if (actual > 0 && actual <= expected_max)
return 0;
- giterr_set(GITERR_INVALID, "invalid version %d on %s", actual, name);
+ git_error_set(GIT_ERROR_INVALID, "invalid version %d on %s", actual, name);
return -1;
}
-#define GITERR_CHECK_VERSION(S,V,N) if (giterr__check_version(S,V,N) < 0) return -1
+#define GIT_ERROR_CHECK_VERSION(S,V,N) if (git_error__check_version(S,V,N) < 0) return -1
/**
* Initialize a structure with a version.
@@ -207,42 +207,42 @@ GIT_INLINE(void) git__init_structure(void *structure, size_t len, unsigned int v
#define GIT_INIT_STRUCTURE_FROM_TEMPLATE(PTR,VERSION,TYPE,TPL) do { \
TYPE _tmpl = TPL; \
- GITERR_CHECK_VERSION(&(VERSION), _tmpl.version, #TYPE); \
+ GIT_ERROR_CHECK_VERSION(&(VERSION), _tmpl.version, #TYPE); \
memcpy((PTR), &_tmpl, sizeof(_tmpl)); } while (0)
/** Check for additive overflow, setting an error if would occur. */
#define GIT_ADD_SIZET_OVERFLOW(out, one, two) \
- (git__add_sizet_overflow(out, one, two) ? (giterr_set_oom(), 1) : 0)
+ (git__add_sizet_overflow(out, one, two) ? (git_error_set_oom(), 1) : 0)
/** Check for additive overflow, setting an error if would occur. */
#define GIT_MULTIPLY_SIZET_OVERFLOW(out, nelem, elsize) \
- (git__multiply_sizet_overflow(out, nelem, elsize) ? (giterr_set_oom(), 1) : 0)
+ (git__multiply_sizet_overflow(out, nelem, elsize) ? (git_error_set_oom(), 1) : 0)
/** Check for additive overflow, failing if it would occur. */
-#define GITERR_CHECK_ALLOC_ADD(out, one, two) \
+#define GIT_ERROR_CHECK_ALLOC_ADD(out, one, two) \
if (GIT_ADD_SIZET_OVERFLOW(out, one, two)) { return -1; }
-#define GITERR_CHECK_ALLOC_ADD3(out, one, two, three) \
+#define GIT_ERROR_CHECK_ALLOC_ADD3(out, one, two, three) \
if (GIT_ADD_SIZET_OVERFLOW(out, one, two) || \
GIT_ADD_SIZET_OVERFLOW(out, *(out), three)) { return -1; }
-#define GITERR_CHECK_ALLOC_ADD4(out, one, two, three, four) \
+#define GIT_ERROR_CHECK_ALLOC_ADD4(out, one, two, three, four) \
if (GIT_ADD_SIZET_OVERFLOW(out, one, two) || \
GIT_ADD_SIZET_OVERFLOW(out, *(out), three) || \
GIT_ADD_SIZET_OVERFLOW(out, *(out), four)) { return -1; }
-#define GITERR_CHECK_ALLOC_ADD5(out, one, two, three, four, five) \
+#define GIT_ERROR_CHECK_ALLOC_ADD5(out, one, two, three, four, five) \
if (GIT_ADD_SIZET_OVERFLOW(out, one, two) || \
GIT_ADD_SIZET_OVERFLOW(out, *(out), three) || \
GIT_ADD_SIZET_OVERFLOW(out, *(out), four) || \
GIT_ADD_SIZET_OVERFLOW(out, *(out), five)) { return -1; }
/** Check for multiplicative overflow, failing if it would occur. */
-#define GITERR_CHECK_ALLOC_MULTIPLY(out, nelem, elsize) \
+#define GIT_ERROR_CHECK_ALLOC_MULTIPLY(out, nelem, elsize) \
if (GIT_MULTIPLY_SIZET_OVERFLOW(out, nelem, elsize)) { return -1; }
-/* NOTE: other giterr functions are in the public errors.h header file */
+/* NOTE: other git_error functions are in the public errors.h header file */
#include "util.h"
diff --git a/src/config.c b/src/config.c
index 30d9730..fce1aad 100644
--- a/src/config.c
+++ b/src/config.c
@@ -81,7 +81,7 @@ int git_config_new(git_config **out)
git_config *cfg;
cfg = git__malloc(sizeof(git_config));
- GITERR_CHECK_ALLOC(cfg);
+ GIT_ERROR_CHECK_ALLOC(cfg);
memset(cfg, 0x0, sizeof(git_config));
@@ -110,7 +110,7 @@ int git_config_add_file_ondisk(
res = p_stat(path, &st);
if (res < 0 && errno != ENOENT && errno != ENOTDIR) {
- giterr_set(GITERR_CONFIG, "failed to stat '%s'", path);
+ git_error_set(GIT_ERROR_CONFIG, "failed to stat '%s'", path);
return -1;
}
@@ -203,7 +203,7 @@ static int find_backend_by_level(
}
if (pos == -1) {
- giterr_set(GITERR_CONFIG,
+ git_error_set(GIT_ERROR_CONFIG,
"no configuration exists for the given level '%i'", (int)level);
return GIT_ENOTFOUND;
}
@@ -219,7 +219,7 @@ static int duplicate_level(void **old_raw, void *new_raw)
GIT_UNUSED(new_raw);
- giterr_set(GITERR_CONFIG, "there already exists a configuration for the given level (%i)", (int)(*old)->level);
+ git_error_set(GIT_ERROR_CONFIG, "there already exists a configuration for the given level (%i)", (int)(*old)->level);
return GIT_EEXISTS;
}
@@ -316,13 +316,13 @@ int git_config_add_backend(
assert(cfg && backend);
- GITERR_CHECK_VERSION(backend, GIT_CONFIG_BACKEND_VERSION, "git_config_backend");
+ GIT_ERROR_CHECK_VERSION(backend, GIT_CONFIG_BACKEND_VERSION, "git_config_backend");
if ((result = backend->open(backend, level, repo)) < 0)
return result;
internal = git__malloc(sizeof(backend_internal));
- GITERR_CHECK_ALLOC(internal);
+ GIT_ERROR_CHECK_ALLOC(internal);
memset(internal, 0x0, sizeof(backend_internal));
@@ -456,7 +456,7 @@ int git_config_iterator_new(git_config_iterator **out, const git_config *cfg)
all_iter *iter;
iter = git__calloc(1, sizeof(all_iter));
- GITERR_CHECK_ALLOC(iter);
+ GIT_ERROR_CHECK_ALLOC(iter);
iter->parent.free = all_iter_free;
iter->parent.next = all_iter_next;
@@ -478,10 +478,10 @@ int git_config_iterator_glob_new(git_config_iterator **out, const git_config *cf
return git_config_iterator_new(out, cfg);
iter = git__calloc(1, sizeof(all_iter));
- GITERR_CHECK_ALLOC(iter);
+ GIT_ERROR_CHECK_ALLOC(iter);
if ((result = p_regcomp(&iter->regex, regexp, REG_EXTENDED)) != 0) {
- giterr_set_regex(&iter->regex, result);
+ git_error_set_regex(&iter->regex, result);
git__free(iter);
return -1;
}
@@ -517,7 +517,7 @@ int git_config_backend_foreach_match(
if (regexp != NULL) {
if ((error = p_regcomp(®ex, regexp, REG_EXTENDED)) != 0) {
- giterr_set_regex(®ex, error);
+ git_error_set_regex(®ex, error);
regfree(®ex);
return -1;
}
@@ -535,7 +535,7 @@ int git_config_backend_foreach_match(
/* abort iterator on non-zero return value */
if ((error = cb(entry, payload)) != 0) {
- giterr_set_after_callback(error);
+ git_error_set_after_callback(error);
break;
}
}
@@ -563,7 +563,7 @@ int git_config_foreach_match(
while (!(error = git_config_next(&entry, iter))) {
if ((error = cb(entry, payload)) != 0) {
- giterr_set_after_callback(error);
+ git_error_set_after_callback(error);
break;
}
}
@@ -599,7 +599,7 @@ static int get_backend_for_use(git_config_backend **out,
*out = NULL;
if (git_vector_length(&cfg->backends) == 0) {
- giterr_set(GITERR_CONFIG,
+ git_error_set(GIT_ERROR_CONFIG,
"cannot %s value for '%s' when no config backends exist",
uses[use], name);
return GIT_ENOTFOUND;
@@ -612,7 +612,7 @@ static int get_backend_for_use(git_config_backend **out,
}
}
- giterr_set(GITERR_CONFIG,
+ git_error_set(GIT_ERROR_CONFIG,
"cannot %s value for '%s' when all config backends are readonly",
uses[use], name);
return GIT_ENOTFOUND;
@@ -651,7 +651,7 @@ int git_config_set_string(git_config *cfg, const char *name, const char *value)
git_config_backend *backend;
if (!value) {
- giterr_set(GITERR_CONFIG, "the value to set cannot be NULL");
+ git_error_set(GIT_ERROR_CONFIG, "the value to set cannot be NULL");
return -1;
}
@@ -703,7 +703,7 @@ int git_config__update_entry(
static int config_error_notfound(const char *name)
{
- giterr_set(GITERR_CONFIG, "config value '%s' was not found", name);
+ git_error_set(GIT_ERROR_CONFIG, "config value '%s' was not found", name);
return GIT_ENOTFOUND;
}
@@ -750,7 +750,7 @@ cleanup:
if (res == GIT_ENOTFOUND)
res = (want_errors > GET_ALL_ERRORS) ? 0 : config_error_notfound(name);
else if (res && (want_errors == GET_NO_ERRORS)) {
- giterr_clear();
+ git_error_clear();
res = 0;
}
@@ -871,7 +871,7 @@ int git_config_get_string(
int ret;
if (!is_readonly(cfg)) {
- giterr_set(GITERR_CONFIG, "get_string called on a live config object");
+ git_error_set(GIT_ERROR_CONFIG, "get_string called on a live config object");
return -1;
}
@@ -925,7 +925,7 @@ int git_config__get_bool_force(
get_entry(&entry, cfg, key, false, GET_NO_ERRORS);
if (entry && git_config_parse_bool(&val, entry->value) < 0)
- giterr_clear();
+ git_error_clear();
git_config_entry_free(entry);
return val;
@@ -940,7 +940,7 @@ int git_config__get_int_force(
get_entry(&entry, cfg, key, false, GET_NO_ERRORS);
if (entry && git_config_parse_int32(&val, entry->value) < 0)
- giterr_clear();
+ git_error_clear();
git_config_entry_free(entry);
return (int)val;
@@ -962,7 +962,7 @@ int git_config_get_multivar_foreach(
found = 1;
if ((err = cb(entry, payload)) != 0) {
- giterr_set_after_callback(err);
+ git_error_set_after_callback(err);
break;
}
}
@@ -1026,7 +1026,7 @@ int git_config_multivar_iterator_new(git_config_iterator **out, const git_config
return error;
iter = git__calloc(1, sizeof(multivar_iter));
- GITERR_CHECK_ALLOC(iter);
+ GIT_ERROR_CHECK_ALLOC(iter);
if ((error = git_config__normalize_name(name, &iter->name)) < 0)
goto on_error;
@@ -1034,7 +1034,7 @@ int git_config_multivar_iterator_new(git_config_iterator **out, const git_config
if (regexp != NULL) {
error = p_regcomp(&iter->regex, regexp, REG_EXTENDED);
if (error != 0) {
- giterr_set_regex(&iter->regex, error);
+ git_error_set_regex(&iter->regex, error);
error = -1;
regfree(&iter->regex);
goto on_error;
@@ -1188,7 +1188,7 @@ int git_config_lock(git_transaction **out, git_config *cfg)
internal = git_vector_get(&cfg->backends, 0);
if (!internal || !internal->backend) {
- giterr_set(GITERR_CONFIG, "cannot lock; the config has no backends");
+ git_error_set(GIT_ERROR_CONFIG, "cannot lock; the config has no backends");
return -1;
}
backend = internal->backend;
@@ -1208,7 +1208,7 @@ int git_config_unlock(git_config *cfg, int commit)
internal = git_vector_get(&cfg->backends, 0);
if (!internal || !internal->backend) {
- giterr_set(GITERR_CONFIG, "cannot lock; the config has no backends");
+ git_error_set(GIT_ERROR_CONFIG, "cannot lock; the config has no backends");
return -1;
}
@@ -1263,7 +1263,7 @@ int git_config_lookup_map_value(
}
fail_parse:
- giterr_set(GITERR_CONFIG, "failed to map '%s'", value);
+ git_error_set(GIT_ERROR_CONFIG, "failed to map '%s'", value);
return -1;
}
@@ -1283,7 +1283,7 @@ int git_config_lookup_map_enum(git_cvar_t *type_out, const char **str_out,
return 0;
}
- giterr_set(GITERR_CONFIG, "invalid enum value");
+ git_error_set(GIT_ERROR_CONFIG, "invalid enum value");
return GIT_ENOTFOUND;
}
@@ -1297,7 +1297,7 @@ int git_config_parse_bool(int *out, const char *value)
return 0;
}
- giterr_set(GITERR_CONFIG, "failed to parse '%s' as a boolean value", value);
+ git_error_set(GIT_ERROR_CONFIG, "failed to parse '%s' as a boolean value", value);
return -1;
}
@@ -1340,7 +1340,7 @@ int git_config_parse_int64(int64_t *out, const char *value)
}
fail_parse:
- giterr_set(GITERR_CONFIG, "failed to parse '%s' as an integer", value ? value : "(null)");
+ git_error_set(GIT_ERROR_CONFIG, "failed to parse '%s' as an integer", value ? value : "(null)");
return -1;
}
@@ -1360,7 +1360,7 @@ int git_config_parse_int32(int32_t *out, const char *value)
return 0;
fail_parse:
- giterr_set(GITERR_CONFIG, "failed to parse '%s' as a 32-bit integer", value ? value : "(null)");
+ git_error_set(GIT_ERROR_CONFIG, "failed to parse '%s' as a 32-bit integer", value ? value : "(null)");
return -1;
}
@@ -1372,7 +1372,7 @@ int git_config_parse_path(git_buf *out, const char *value)
if (value[0] == '~') {
if (value[1] != '\0' && value[1] != '/') {
- giterr_set(GITERR_CONFIG, "retrieving a homedir by name is not supported");
+ git_error_set(GIT_ERROR_CONFIG, "retrieving a homedir by name is not supported");
return -1;
}
@@ -1414,7 +1414,7 @@ int git_config__normalize_name(const char *in, char **out)
assert(in && out);
name = git__strdup(in);
- GITERR_CHECK_ALLOC(name);
+ GIT_ERROR_CHECK_ALLOC(name);
fdot = strchr(name, '.');
ldot = strrchr(name, '.');
@@ -1437,7 +1437,7 @@ int git_config__normalize_name(const char *in, char **out)
invalid:
git__free(name);
- giterr_set(GITERR_CONFIG, "invalid config item name '%s'", in);
+ git_error_set(GIT_ERROR_CONFIG, "invalid config item name '%s'", in);
return GIT_EINVALIDSPEC;
}
@@ -1498,8 +1498,8 @@ int git_config_rename_section(
if (new_section_name != NULL &&
(error = normalize_section(replace.ptr, strchr(replace.ptr, '.'))) < 0)
{
- giterr_set(
- GITERR_CONFIG, "invalid config section '%s'", new_section_name);
+ git_error_set(
+ GIT_ERROR_CONFIG, "invalid config section '%s'", new_section_name);
goto cleanup;
}
diff --git a/src/config_entries.c b/src/config_entries.c
index fdbf798..f6277bc 100644
--- a/src/config_entries.c
+++ b/src/config_entries.c
@@ -56,7 +56,7 @@ int git_config_entries_new(git_config_entries **out)
int error;
entries = git__calloc(1, sizeof(git_config_entries));
- GITERR_CHECK_ALLOC(entries);
+ GIT_ERROR_CHECK_ALLOC(entries);
GIT_REFCOUNT_INC(entries);
if ((error = git_strmap_alloc(&entries->map)) < 0)
@@ -81,10 +81,10 @@ int git_config_entries_dup(git_config_entries **out, git_config_entries *entries
dup = git__calloc(1, sizeof(git_config_entry));
dup->name = git__strdup(head->entry->name);
- GITERR_CHECK_ALLOC(dup->name);
+ GIT_ERROR_CHECK_ALLOC(dup->name);
if (head->entry->value) {
dup->value = git__strdup(head->entry->value);
- GITERR_CHECK_ALLOC(dup->value);
+ GIT_ERROR_CHECK_ALLOC(dup->value);
}
dup->level = head->entry->level;
dup->include_depth = head->entry->include_depth;
@@ -136,7 +136,7 @@ int git_config_entries_append(git_config_entries *entries, git_config_entry *ent
size_t pos;
var = git__calloc(1, sizeof(config_entry_list));
- GITERR_CHECK_ALLOC(var);
+ GIT_ERROR_CHECK_ALLOC(var);
var->entry = entry;
pos = git_strmap_lookup_index(entries->map, entry->name);
@@ -162,7 +162,7 @@ int git_config_entries_append(git_config_entries *entries, git_config_entry *ent
}
var = git__calloc(1, sizeof(config_entry_list));
- GITERR_CHECK_ALLOC(var);
+ GIT_ERROR_CHECK_ALLOC(var);
var->entry = entry;
config_entry_list_append(&entries->list, var);
@@ -205,12 +205,12 @@ int git_config_entries_get_unique(git_config_entry **out, git_config_entries *en
return error;
if (entry->next != NULL) {
- giterr_set(GITERR_CONFIG, "entry is not unique due to being a multivar");
+ git_error_set(GIT_ERROR_CONFIG, "entry is not unique due to being a multivar");
return -1;
}
if (entry->entry->include_depth) {
- giterr_set(GITERR_CONFIG, "entry is not unique due to being included");
+ git_error_set(GIT_ERROR_CONFIG, "entry is not unique due to being included");
return -1;
}
@@ -246,7 +246,7 @@ int git_config_entries_iterator_new(git_config_iterator **out, git_config_entrie
config_entries_iterator *it;
it = git__calloc(1, sizeof(config_entries_iterator));
- GITERR_CHECK_ALLOC(it);
+ GIT_ERROR_CHECK_ALLOC(it);
it->parent.next = config_iterator_next;
it->parent.free = config_iterator_free;
it->head = entries->list;
diff --git a/src/config_file.c b/src/config_file.c
index 57db97d..26c9e5e 100644
--- a/src/config_file.c
+++ b/src/config_file.c
@@ -69,7 +69,7 @@ static int config_snapshot(git_config_backend **out, git_config_backend *in);
static int config_error_readonly(void)
{
- giterr_set(GITERR_CONFIG, "this backend is read-only");
+ git_error_set(GIT_ERROR_CONFIG, "this backend is read-only");
return -1;
}
@@ -83,7 +83,7 @@ static git_config_entries *diskfile_entries_take(diskfile_header *h)
git_config_entries *entries;
if (git_mutex_lock(&h->values_mutex) < 0) {
- giterr_set(GITERR_OS, "failed to lock config backend");
+ git_error_set(GIT_ERROR_OS, "failed to lock config backend");
return NULL;
}
@@ -196,7 +196,7 @@ static int config_refresh(git_config_backend *cfg)
goto out;
if ((error = git_mutex_lock(&b->header.values_mutex)) < 0) {
- giterr_set(GITERR_OS, "failed to lock config backend");
+ git_error_set(GIT_ERROR_OS, "failed to lock config backend");
goto out;
}
@@ -274,7 +274,7 @@ static int config_set(git_config_backend *cfg, const char *name, const char *val
/* No early returns due to sanity checks, let's write it out and refresh */
if (value) {
esc_value = escape_value(value);
- GITERR_CHECK_ALLOC(esc_value);
+ GIT_ERROR_CHECK_ALLOC(esc_value);
}
if ((error = config_write(b, name, key, NULL, esc_value)) < 0)
@@ -339,7 +339,7 @@ static int config_set_multivar(
result = p_regcomp(&preg, regexp, REG_EXTENDED);
if (result != 0) {
- giterr_set_regex(&preg, result);
+ git_error_set_regex(&preg, result);
result = -1;
goto out;
}
@@ -374,7 +374,7 @@ static int config_delete(git_config_backend *cfg, const char *name)
/* Check whether we'd be modifying an included or multivar key */
if ((error = git_config_entries_get_unique(&entry, entries, key)) < 0) {
if (error == GIT_ENOTFOUND)
- giterr_set(GITERR_CONFIG, "could not find key '%s' to delete", name);
+ git_error_set(GIT_ERROR_CONFIG, "could not find key '%s' to delete", name);
goto out;
}
@@ -409,12 +409,12 @@ static int config_delete_multivar(git_config_backend *cfg, const char *name, con
if ((result = git_config_entries_get(&entry, entries, key)) < 0) {
if (result == GIT_ENOTFOUND)
- giterr_set(GITERR_CONFIG, "could not find key '%s' to delete", name);
+ git_error_set(GIT_ERROR_CONFIG, "could not find key '%s' to delete", name);
goto out;
}
if ((result = p_regcomp(&preg, regexp, REG_EXTENDED)) != 0) {
- giterr_set_regex(&preg, result);
+ git_error_set_regex(&preg, result);
result = -1;
goto out;
}
@@ -473,13 +473,13 @@ int git_config_backend_from_file(git_config_backend **out, const char *path)
diskfile_backend *backend;
backend = git__calloc(1, sizeof(diskfile_backend));
- GITERR_CHECK_ALLOC(backend);
+ GIT_ERROR_CHECK_ALLOC(backend);
backend->header.parent.version = GIT_CONFIG_BACKEND_VERSION;
git_mutex_init(&backend->header.values_mutex);
backend->file.path = git__strdup(path);
- GITERR_CHECK_ALLOC(backend->file.path);
+ GIT_ERROR_CHECK_ALLOC(backend->file.path);
git_array_init(backend->file.includes);
backend->header.parent.open = config_open;
@@ -590,7 +590,7 @@ static int config_snapshot(git_config_backend **out, git_config_backend *in)
diskfile_readonly_backend *backend;
backend = git__calloc(1, sizeof(diskfile_readonly_backend));
- GITERR_CHECK_ALLOC(backend);
+ GIT_ERROR_CHECK_ALLOC(backend);
backend->header.parent.version = GIT_CONFIG_BACKEND_VERSION;
git_mutex_init(&backend->header.values_mutex);
@@ -686,7 +686,7 @@ static int parse_include(git_config_parser *reader,
include, parse_data->level, parse_data->depth+1);
if (result == GIT_ENOTFOUND) {
- giterr_clear();
+ git_error_clear();
result = 0;
}
@@ -828,7 +828,7 @@ static int read_on_variable(
return -1;
entry = git__calloc(1, sizeof(git_config_entry));
- GITERR_CHECK_ALLOC(entry);
+ GIT_ERROR_CHECK_ALLOC(entry);
entry->name = git_buf_detach(&buf);
entry->value = var_value ? git__strdup(var_value) : NULL;
entry->level = parse_data->level;
@@ -863,7 +863,7 @@ static int config_read(
int error;
if (depth >= MAX_INCLUDE_DEPTH) {
- giterr_set(GITERR_CONFIG, "maximum config include depth reached");
+ git_error_set(GIT_ERROR_CONFIG, "maximum config include depth reached");
return -1;
}
@@ -911,7 +911,7 @@ static int write_section(git_buf *fbuf, const char *key)
char *escaped;
git_buf_put(&buf, key, dot - key);
escaped = escape_value(dot + 1);
- GITERR_CHECK_ALLOC(escaped);
+ GIT_ERROR_CHECK_ALLOC(escaped);
git_buf_printf(&buf, " \"%s\"", escaped);
git__free(escaped);
}
@@ -1156,12 +1156,12 @@ static int config_write(diskfile_backend *cfg, const char *orig_key, const char
ldot = strrchr(key, '.');
name = ldot + 1;
section = git__strndup(key, ldot - key);
- GITERR_CHECK_ALLOC(section);
+ GIT_ERROR_CHECK_ALLOC(section);
ldot = strrchr(orig_key, '.');
orig_name = ldot + 1;
orig_section = git__strndup(orig_key, ldot - orig_key);
- GITERR_CHECK_ALLOC(orig_section);
+ GIT_ERROR_CHECK_ALLOC(orig_section);
write_data.buf = &buf;
git_buf_init(&write_data.buffered_comment, 0);
diff --git a/src/config_mem.c b/src/config_mem.c
index 18e405a..c2ecfda 100644
--- a/src/config_mem.c
+++ b/src/config_mem.c
@@ -24,7 +24,7 @@ typedef struct {
static int config_error_readonly(void)
{
- giterr_set(GITERR_CONFIG, "this backend is read-only");
+ git_error_set(GIT_ERROR_CONFIG, "this backend is read-only");
return -1;
}
@@ -63,7 +63,7 @@ static int read_variable_cb(
return -1;
entry = git__calloc(1, sizeof(git_config_entry));
- GITERR_CHECK_ALLOC(entry);
+ GIT_ERROR_CHECK_ALLOC(entry);
entry->name = git_buf_detach(&buf);
entry->value = var_value ? git__strdup(var_value) : NULL;
entry->level = parse_data->level;
@@ -170,7 +170,7 @@ static int config_memory_snapshot(git_config_backend **out, git_config_backend *
{
GIT_UNUSED(out);
GIT_UNUSED(backend);
- giterr_set(GITERR_CONFIG, "this backend does not support snapshots");
+ git_error_set(GIT_ERROR_CONFIG, "this backend does not support snapshots");
return -1;
}
@@ -191,7 +191,7 @@ int git_config_backend_from_string(git_config_backend **out, const char *cfg, si
config_memory_backend *backend;
backend = git__calloc(1, sizeof(config_memory_backend));
- GITERR_CHECK_ALLOC(backend);
+ GIT_ERROR_CHECK_ALLOC(backend);
if (git_config_entries_new(&backend->entries) < 0) {
git__free(backend);
diff --git a/src/config_parse.c b/src/config_parse.c
index a9c7c52..ab2fb98 100644
--- a/src/config_parse.c
+++ b/src/config_parse.c
@@ -17,7 +17,7 @@ const char *git_config_escaped = "\n\t\b\"\\";
static void set_parse_error(git_config_parser *reader, int col, const char *error_str)
{
const char *file = reader->file ? reader->file->path : "in-memory";
- giterr_set(GITERR_CONFIG, "failed to parse config file: %s (in %s:%"PRIuZ", column %d)",
+ git_error_set(GIT_ERROR_CONFIG, "failed to parse config file: %s (in %s:%"PRIuZ", column %d)",
error_str, file, reader->ctx.line_num, col);
}
@@ -87,8 +87,8 @@ static int parse_section_header_ext(git_config_parser *reader, const char *line,
goto end_error;
}
- GITERR_CHECK_ALLOC_ADD(&alloc_len, base_name_len, quoted_len);
- GITERR_CHECK_ALLOC_ADD(&alloc_len, alloc_len, 2);
+ GIT_ERROR_CHECK_ALLOC_ADD(&alloc_len, base_name_len, quoted_len);
+ GIT_ERROR_CHECK_ALLOC_ADD(&alloc_len, alloc_len, 2);
if (git_buf_grow(&buf, alloc_len) < 0 ||
git_buf_printf(&buf, "%s.", base_name) < 0)
@@ -169,9 +169,9 @@ static int parse_section_header(git_config_parser *reader, char **section_out)
return -1;
}
- GITERR_CHECK_ALLOC_ADD(&line_len, (size_t)(name_end - line), 1);
+ GIT_ERROR_CHECK_ALLOC_ADD(&line_len, (size_t)(name_end - line), 1);
name = git__malloc(line_len);
- GITERR_CHECK_ALLOC(name);
+ GIT_ERROR_CHECK_ALLOC(name);
name_length = 0;
pos = 0;
@@ -304,7 +304,7 @@ static int unescape_line(
*fixed++ = git_config_escaped[esc - git_config_escapes];
} else {
git__free(str);
- giterr_set(GITERR_CONFIG, "invalid escape at %s", ptr);
+ git_error_set(GIT_ERROR_CONFIG, "invalid escape at %s", ptr);
return -1;
}
}
@@ -330,7 +330,7 @@ static int parse_multiline_variable(git_config_parser *reader, git_buf *value, i
/* Check that the next line exists */
git_parse_advance_line(&reader->ctx);
line = git__strndup(reader->ctx.line, reader->ctx.line_len);
- GITERR_CHECK_ALLOC(line);
+ GIT_ERROR_CHECK_ALLOC(line);
/*
* We've reached the end of the file, there is no continuation.
@@ -420,7 +420,7 @@ static int parse_variable(git_config_parser *reader, char **var_name, char **var
git_parse_advance_ws(&reader->ctx);
line = git__strndup(reader->ctx.line, reader->ctx.line_len);
- GITERR_CHECK_ALLOC(line);
+ GIT_ERROR_CHECK_ALLOC(line);
quote_count = strip_comments(line, 0);
diff --git a/src/crlf.c b/src/crlf.c
index df8806f..80441e7 100644
--- a/src/crlf.c
+++ b/src/crlf.c
@@ -85,7 +85,7 @@ static int has_cr_in_index(const git_filter_source *src)
return false;
if (git_repository_index__weakptr(&index, repo) < 0) {
- giterr_clear();
+ git_error_clear();
return false;
}
@@ -170,12 +170,12 @@ GIT_INLINE(int) check_safecrlf(
/* TODO: issue a warning when available */
} else {
if (filename && *filename)
- giterr_set(
- GITERR_FILTER, "CRLF would be replaced by LF in '%s'",
+ git_error_set(
+ GIT_ERROR_FILTER, "CRLF would be replaced by LF in '%s'",
filename);
else
- giterr_set(
- GITERR_FILTER, "CRLF would be replaced by LF");
+ git_error_set(
+ GIT_ERROR_FILTER, "CRLF would be replaced by LF");
return -1;
}
@@ -190,12 +190,12 @@ GIT_INLINE(int) check_safecrlf(
/* TODO: issue a warning when available */
} else {
if (filename && *filename)
- giterr_set(
- GITERR_FILTER, "LF would be replaced by CRLF in '%s'",
+ git_error_set(
+ GIT_ERROR_FILTER, "LF would be replaced by CRLF in '%s'",
filename);
else
- giterr_set(
- GITERR_FILTER, "LF would be replaced by CRLF");
+ git_error_set(
+ GIT_ERROR_FILTER, "LF would be replaced by CRLF");
return -1;
}
@@ -360,7 +360,7 @@ static int crlf_check(
return GIT_PASSTHROUGH;
*payload = git__malloc(sizeof(ca));
- GITERR_CHECK_ALLOC(*payload);
+ GIT_ERROR_CHECK_ALLOC(*payload);
memcpy(*payload, &ca, sizeof(ca));
return 0;
diff --git a/src/delta.c b/src/delta.c
index b9352b8..9e8d1c0 100644
--- a/src/delta.c
+++ b/src/delta.c
@@ -124,19 +124,19 @@ static int lookup_index_alloc(
{
size_t entries_len, hash_len, index_len;
- GITERR_CHECK_ALLOC_MULTIPLY(&entries_len, entries, sizeof(struct index_entry));
- GITERR_CHECK_ALLOC_MULTIPLY(&hash_len, hash_count, sizeof(struct index_entry *));
+ GIT_ERROR_CHECK_ALLOC_MULTIPLY(&entries_len, entries, sizeof(struct index_entry));
+ GIT_ERROR_CHECK_ALLOC_MULTIPLY(&hash_len, hash_count, sizeof(struct index_entry *));
- GITERR_CHECK_ALLOC_ADD(&index_len, sizeof(struct git_delta_index), entries_len);
- GITERR_CHECK_ALLOC_ADD(&index_len, index_len, hash_len);
+ GIT_ERROR_CHECK_ALLOC_ADD(&index_len, sizeof(struct git_delta_index), entries_len);
+ GIT_ERROR_CHECK_ALLOC_ADD(&index_len, index_len, hash_len);
if (!git__is_ulong(index_len)) {
- giterr_set(GITERR_NOMEMORY, "overly large delta");
+ git_error_set(GIT_ERROR_NOMEMORY, "overly large delta");
return -1;
}
*out = git__malloc(index_len);
- GITERR_CHECK_ALLOC(*out);
+ GIT_ERROR_CHECK_ALLOC(*out);
*out_len = index_len;
return 0;
@@ -291,7 +291,7 @@ int git_delta_create_from_index(
if (max_size && bufsize >= max_size)
bufsize = (unsigned int)(max_size + MAX_OP_SIZE + 1);
buf = git__malloc(bufsize);
- GITERR_CHECK_ALLOC(buf);
+ GIT_ERROR_CHECK_ALLOC(buf);
/* store reference buffer size */
i = index->src_size;
@@ -438,7 +438,7 @@ int git_delta_create_from_index(
buf[bufpos - inscnt - 1] = inscnt;
if (max_size && bufpos > max_size) {
- giterr_set(GITERR_NOMEMORY, "delta would be larger than maximum size");
+ git_error_set(GIT_ERROR_NOMEMORY, "delta would be larger than maximum size");
git__free(buf);
return GIT_EBUFS;
}
@@ -466,7 +466,7 @@ static int hdr_sz(
do {
if (d == end) {
- giterr_set(GITERR_INVALID, "truncated delta");
+ git_error_set(GIT_ERROR_INVALID, "truncated delta");
return -1;
}
@@ -545,18 +545,18 @@ int git_delta_apply(
* base object, resulting in data corruption or segfault.
*/
if ((hdr_sz(&base_sz, &delta, delta_end) < 0) || (base_sz != base_len)) {
- giterr_set(GITERR_INVALID, "failed to apply delta: base size does not match given data");
+ git_error_set(GIT_ERROR_INVALID, "failed to apply delta: base size does not match given data");
return -1;
}
if (hdr_sz(&res_sz, &delta, delta_end) < 0) {
- giterr_set(GITERR_INVALID, "failed to apply delta: base size does not match given data");
+ git_error_set(GIT_ERROR_INVALID, "failed to apply delta: base size does not match given data");
return -1;
}
- GITERR_CHECK_ALLOC_ADD(&alloc_sz, res_sz, 1);
+ GIT_ERROR_CHECK_ALLOC_ADD(&alloc_sz, res_sz, 1);
res_dp = git__malloc(alloc_sz);
- GITERR_CHECK_ALLOC(res_dp);
+ GIT_ERROR_CHECK_ALLOC(res_dp);
res_dp[res_sz] = '\0';
*out = res_dp;
@@ -616,6 +616,6 @@ fail:
*out = NULL;
*out_len = 0;
- giterr_set(GITERR_INVALID, "failed to apply delta");
+ git_error_set(GIT_ERROR_INVALID, "failed to apply delta");
return -1;
}
diff --git a/src/describe.c b/src/describe.c
index cf2c728..7e57d64 100644
--- a/src/describe.c
+++ b/src/describe.c
@@ -108,7 +108,7 @@ static int add_to_known_names(
if (replace_name(&tag, repo, e, prio, sha1)) {
if (!found) {
e = git__malloc(sizeof(struct commit_name));
- GITERR_CHECK_ALLOC(e);
+ GIT_ERROR_CHECK_ALLOC(e);
e->path = NULL;
e->tag = NULL;
@@ -191,7 +191,7 @@ static int commit_name_dup(struct commit_name **out, struct commit_name *in)
struct commit_name *name;
name = git__malloc(sizeof(struct commit_name));
- GITERR_CHECK_ALLOC(name);
+ GIT_ERROR_CHECK_ALLOC(name);
memcpy(name, in, sizeof(struct commit_name));
name->tag = NULL;
@@ -201,7 +201,7 @@ static int commit_name_dup(struct commit_name **out, struct commit_name *in)
return -1;
name->path = git__strdup(in->path);
- GITERR_CHECK_ALLOC(name->path);
+ GIT_ERROR_CHECK_ALLOC(name->path);
*out = name;
return 0;
@@ -267,7 +267,7 @@ static int possible_tag_dup(struct possible_tag **out, struct possible_tag *in)
int error;
tag = git__malloc(sizeof(struct possible_tag));
- GITERR_CHECK_ALLOC(tag);
+ GIT_ERROR_CHECK_ALLOC(tag);
memcpy(tag, in, sizeof(struct possible_tag));
tag->name = NULL;
@@ -335,14 +335,14 @@ static int display_name(git_buf *buf, git_repository *repo, struct commit_name *
{
if (n->prio == 2 && !n->tag) {
if (git_tag_lookup(&n->tag, repo, &n->sha1) < 0) {
- giterr_set(GITERR_TAG, "annotated tag '%s' not available", n->path);
+ git_error_set(GIT_ERROR_TAG, "annotated tag '%s' not available", n->path);
return -1;
}
}
if (n->tag && !n->name_checked) {
if (!git_tag_name(n->tag)) {
- giterr_set(GITERR_TAG, "annotated tag '%s' has no embedded name", n->path);
+ git_error_set(GIT_ERROR_TAG, "annotated tag '%s' has no embedded name", n->path);
return -1;
}
@@ -425,7 +425,7 @@ static int describe_not_found(const git_oid *oid, const char *message_format) {
char oid_str[GIT_OID_HEXSZ + 1];
git_oid_tostr(oid_str, sizeof(oid_str), oid);
- giterr_set(GITERR_DESCRIBE, message_format, oid_str);
+ git_error_set(GIT_ERROR_DESCRIBE, message_format, oid_str);
return GIT_ENOTFOUND;
}
@@ -504,7 +504,7 @@ static int describe(
unannotated_cnt++;
} else if (match_cnt < data->opts->max_candidates_tags) {
struct possible_tag *t = git__malloc(sizeof(struct commit_name));
- GITERR_CHECK_ALLOC(t);
+ GIT_ERROR_CHECK_ALLOC(t);
if ((error = git_vector_insert(&all_matches, t)) < 0)
goto cleanup;
@@ -667,7 +667,7 @@ int git_describe_commit(
assert(committish);
data.result = git__calloc(1, sizeof(git_describe_result));
- GITERR_CHECK_ALLOC(data.result);
+ GIT_ERROR_CHECK_ALLOC(data.result);
data.result->repo = git_object_owner(committish);
data.repo = git_object_owner(committish);
@@ -675,14 +675,14 @@ int git_describe_commit(
if ((error = normalize_options(&normalized, opts)) < 0)
return error;
- GITERR_CHECK_VERSION(
+ GIT_ERROR_CHECK_VERSION(
&normalized,
GIT_DESCRIBE_OPTIONS_VERSION,
"git_describe_options");
data.opts = &normalized;
data.names = git_oidmap_alloc();
- GITERR_CHECK_ALLOC(data.names);
+ GIT_ERROR_CHECK_ALLOC(data.names);
/** TODO: contains to be implemented */
@@ -695,7 +695,7 @@ int git_describe_commit(
goto cleanup;
if (git_oidmap_size(data.names) == 0 && !opts->show_commit_oid_as_fallback) {
- giterr_set(GITERR_DESCRIBE, "cannot describe - "
+ git_error_set(GIT_ERROR_DESCRIBE, "cannot describe - "
"no reference found, cannot describe anything.");
error = -1;
goto cleanup;
@@ -786,14 +786,14 @@ int git_describe_format(git_buf *out, const git_describe_result *result, const g
assert(out && result);
- GITERR_CHECK_VERSION(given, GIT_DESCRIBE_FORMAT_OPTIONS_VERSION, "git_describe_format_options");
+ GIT_ERROR_CHECK_VERSION(given, GIT_DESCRIBE_FORMAT_OPTIONS_VERSION, "git_describe_format_options");
normalize_format_options(&opts, given);
git_buf_sanitize(out);
if (opts.always_use_long_format && opts.abbreviated_size == 0) {
- giterr_set(GITERR_DESCRIBE, "cannot describe - "
+ git_error_set(GIT_ERROR_DESCRIBE, "cannot describe - "
"'always_use_long_format' is incompatible with a zero"
"'abbreviated_size'");
return -1;
diff --git a/src/diff.c b/src/diff.c
index c93e36b..5abb4d1 100644
--- a/src/diff.c
+++ b/src/diff.c
@@ -114,7 +114,7 @@ int git_diff_is_sorted_icase(const git_diff *diff)
int git_diff_get_perfdata(git_diff_perfdata *out, const git_diff *diff)
{
assert(out);
- GITERR_CHECK_VERSION(out, GIT_DIFF_PERFDATA_VERSION, "git_diff_perfdata");
+ GIT_ERROR_CHECK_VERSION(out, GIT_DIFF_PERFDATA_VERSION, "git_diff_perfdata");
out->stat_calls = diff->perf.stat_calls;
out->oid_calculations = diff->perf.oid_calculations;
return 0;
@@ -251,7 +251,7 @@ int git_diff_format_email(
assert(out && diff && opts);
assert(opts->summary && opts->id && opts->author);
- GITERR_CHECK_VERSION(opts,
+ GIT_ERROR_CHECK_VERSION(opts,
GIT_DIFF_FORMAT_EMAIL_OPTIONS_VERSION,
"git_format_email_options");
@@ -260,14 +260,14 @@ int git_diff_format_email(
if (!ignore_marker) {
if (opts->patch_no > opts->total_patches) {
- giterr_set(GITERR_INVALID,
+ git_error_set(GIT_ERROR_INVALID,
"patch %"PRIuZ" out of range. max %"PRIuZ,
opts->patch_no, opts->total_patches);
return -1;
}
if (opts->patch_no == 0) {
- giterr_set(GITERR_INVALID,
+ git_error_set(GIT_ERROR_INVALID,
"invalid patch no %"PRIuZ". should be >0", opts->patch_no);
return -1;
}
@@ -280,14 +280,14 @@ int git_diff_format_email(
size_t offset = 0;
if ((offset = (loc - opts->summary)) == 0) {
- giterr_set(GITERR_INVALID, "summary is empty");
+ git_error_set(GIT_ERROR_INVALID, "summary is empty");
error = -1;
goto on_error;
}
- GITERR_CHECK_ALLOC_ADD(&allocsize, offset, 1);
+ GIT_ERROR_CHECK_ALLOC_ADD(&allocsize, offset, 1);
summary = git__calloc(allocsize, sizeof(char));
- GITERR_CHECK_ALLOC(summary);
+ GIT_ERROR_CHECK_ALLOC(summary);
strncpy(summary, opts->summary, offset);
}
@@ -466,7 +466,7 @@ static int line_cb(
case GIT_DIFF_LINE_CONTEXT:
break;
default:
- giterr_set(GITERR_PATCH, "invalid line origin for patch");
+ git_error_set(GIT_ERROR_PATCH, "invalid line origin for patch");
return -1;
}
@@ -493,7 +493,7 @@ int git_diff_patchid(git_oid *out, git_diff *diff, git_diff_patchid_options *opt
struct patch_id_args args;
int error;
- GITERR_CHECK_VERSION(
+ GIT_ERROR_CHECK_VERSION(
opts, GIT_DIFF_PATCHID_OPTIONS_VERSION, "git_diff_patchid_options");
memset(&args, 0, sizeof(args));
diff --git a/src/diff_driver.c b/src/diff_driver.c
index 31bb5a9..05246df 100644
--- a/src/diff_driver.c
+++ b/src/diff_driver.c
@@ -149,7 +149,7 @@ static git_diff_driver_registry *git_repository_driver_registry(
}
if (!repo->diff_drivers)
- giterr_set(GITERR_REPOSITORY, "unable to create diff driver registry");
+ git_error_set(GIT_ERROR_REPOSITORY, "unable to create diff driver registry");
return repo->diff_drivers;
}
@@ -162,11 +162,11 @@ static int diff_driver_alloc(
namelen = strlen(name),
alloclen;
- GITERR_CHECK_ALLOC_ADD(&alloclen, driverlen, namelen);
- GITERR_CHECK_ALLOC_ADD(&alloclen, alloclen, 1);
+ GIT_ERROR_CHECK_ALLOC_ADD(&alloclen, driverlen, namelen);
+ GIT_ERROR_CHECK_ALLOC_ADD(&alloclen, alloclen, 1);
driver = git__calloc(1, alloclen);
- GITERR_CHECK_ALLOC(driver);
+ GIT_ERROR_CHECK_ALLOC(driver);
memcpy(driver->name, name, namelen);
@@ -211,7 +211,7 @@ static int git_diff_driver_builtin(
(error = p_regcomp(
&drv->word_pattern, ddef->words, ddef->flags | REG_EXTENDED)))
{
- error = giterr_set_regex(&drv->word_pattern, error);
+ error = git_error_set_regex(&drv->word_pattern, error);
goto done;
}
@@ -256,7 +256,7 @@ static int git_diff_driver_load(
/* if you can't read config for repo, just use default driver */
if (git_repository_config_snapshot(&cfg, repo) < 0) {
- giterr_clear();
+ git_error_clear();
goto done;
}
@@ -287,7 +287,7 @@ static int git_diff_driver_load(
cfg, name.ptr, NULL, diff_driver_xfuncname, drv)) < 0) {
if (error != GIT_ENOTFOUND)
goto done;
- giterr_clear(); /* no diff.<driver>.xfuncname, so just continue */
+ git_error_clear(); /* no diff.<driver>.xfuncname, so just continue */
}
git_buf_truncate(&name, namelen + strlen("diff.."));
@@ -296,7 +296,7 @@ static int git_diff_driver_load(
cfg, name.ptr, NULL, diff_driver_funcname, drv)) < 0) {
if (error != GIT_ENOTFOUND)
goto done;
- giterr_clear(); /* no diff.<driver>.funcname, so just continue */
+ git_error_clear(); /* no diff.<driver>.funcname, so just continue */
}
/* if we found any patterns, set driver type to use correct callback */
@@ -315,7 +315,7 @@ static int git_diff_driver_load(
found_driver = true;
else {
/* TODO: warn about bad regex instead of failure */
- error = giterr_set_regex(&drv->word_pattern, error);
+ error = git_error_set_regex(&drv->word_pattern, error);
goto done;
}
@@ -379,7 +379,7 @@ int git_diff_driver_lookup(
else if ((error = git_diff_driver_load(out, repo, values[0])) < 0) {
if (error == GIT_ENOTFOUND) {
error = 0;
- giterr_clear();
+ git_error_clear();
}
}
diff --git a/src/diff_file.c b/src/diff_file.c
index b4ccec8..ae1016d 100644
--- a/src/diff_file.c
+++ b/src/diff_file.c
@@ -188,7 +188,7 @@ static int diff_file_content_commit_to_str(
if ((error = git_submodule_lookup(&sm, fc->repo, fc->file->path)) < 0) {
/* GIT_EEXISTS means a "submodule" that has not been git added */
if (error == GIT_EEXISTS) {
- giterr_clear();
+ git_error_clear();
error = 0;
}
return error;
@@ -303,13 +303,13 @@ static int diff_file_content_load_workdir_symlink(
alloc_len = (ssize_t)(fc->file->size * 2) + 1;
fc->map.data = git__calloc(alloc_len, sizeof(char));
- GITERR_CHECK_ALLOC(fc->map.data);
+ GIT_ERROR_CHECK_ALLOC(fc->map.data);
fc->flags |= GIT_DIFF_FLAG__FREE_DATA;
read_len = p_readlink(git_buf_cstr(path), fc->map.data, alloc_len);
if (read_len < 0) {
- giterr_set(GITERR_OS, "failed to read symlink '%s'", fc->file->path);
+ git_error_set(GIT_ERROR_OS, "failed to read symlink '%s'", fc->file->path);
return -1;
}
@@ -352,7 +352,7 @@ static int diff_file_content_load_workdir_file(
}
/* if mmap failed, fall through to try readbuffer below */
- giterr_clear();
+ git_error_clear();
}
if (!(error = git_futils_readbuffer_fd(&raw, fd, (size_t)fc->file->size))) {
diff --git a/src/diff_generate.c b/src/diff_generate.c
index ffe6d80..acc6c34 100644
--- a/src/diff_generate.c
+++ b/src/diff_generate.c
@@ -81,7 +81,7 @@ static int diff_insert_delta(
if (error > 0) /* positive value means to skip this delta */
return 0;
else /* negative value means to cancel diff */
- return giterr_set_after_callback_function(error, "git_diff");
+ return git_error_set_after_callback_function(error, "git_diff");
}
}
@@ -157,7 +157,7 @@ static int diff_delta__from_one(
return 0;
delta = diff_delta__alloc(diff, status, entry->path);
- GITERR_CHECK_ALLOC(delta);
+ GIT_ERROR_CHECK_ALLOC(delta);
/* This fn is just for single-sided diffs */
assert(status != GIT_DELTA_MODIFIED);
@@ -220,7 +220,7 @@ static int diff_delta__from_two(
}
delta = diff_delta__alloc(diff, status, canonical_path);
- GITERR_CHECK_ALLOC(delta);
+ GIT_ERROR_CHECK_ALLOC(delta);
delta->nfiles = 2;
if (!git_index_entry_is_conflict(old_entry)) {
@@ -517,7 +517,7 @@ static int diff_generated_apply_options(
if (entry && git_submodule_parse_ignore(
&diff->base.opts.ignore_submodules, entry->value) < 0)
- giterr_clear();
+ git_error_clear();
git_config_entry_free(entry);
}
@@ -622,13 +622,13 @@ int git_diff__oid_for_entry(
/* if submodule lookup failed probably just in an intermediate
* state where some init hasn't happened, so ignore the error
*/
- giterr_clear();
+ git_error_clear();
}
} else if (S_ISLNK(mode)) {
error = git_odb__hashlink(out, full_path.ptr);
diff->base.perf.oid_calculations++;
} else if (!git__is_sizet(entry.file_size)) {
- giterr_set(GITERR_OS, "file size overflow (for 32-bits) on '%s'",
+ git_error_set(GIT_ERROR_OS, "file size overflow (for 32-bits) on '%s'",
entry.path);
error = -1;
} else if (!(error = git_filter_list_load(&fl,
@@ -700,7 +700,7 @@ static int maybe_modified_submodule(
/* GIT_EEXISTS means dir with .git in it was found - ignore it */
if (error == GIT_EEXISTS) {
- giterr_clear();
+ git_error_clear();
error = 0;
}
return error;
@@ -1060,7 +1060,7 @@ static int handle_unmatched_new_item(
/* if directory is empty, can't advance into it, so skip it */
if (error == GIT_ENOTFOUND) {
- giterr_clear();
+ git_error_clear();
error = iterator_advance(&info->nitem, info->new_iter);
}
@@ -1082,7 +1082,7 @@ static int handle_unmatched_new_item(
else if (nitem->mode == GIT_FILEMODE_COMMIT) {
/* ignore things that are not actual submodules */
if (git_submodule_lookup(NULL, info->repo, nitem->path) != 0) {
- giterr_clear();
+ git_error_clear();
delta_type = GIT_DELTA_IGNORED;
/* if this contains a tracked item, treat as normal TREE */
@@ -1091,7 +1091,7 @@ static int handle_unmatched_new_item(
if (error != GIT_ENOTFOUND)
return error;
- giterr_clear();
+ git_error_clear();
return iterator_advance(&info->nitem, info->new_iter);
}
}
@@ -1192,7 +1192,7 @@ int git_diff__from_iterators(
*out = NULL;
diff = diff_generated_alloc(repo, old_iter, new_iter);
- GITERR_CHECK_ALLOC(diff);
+ GIT_ERROR_CHECK_ALLOC(diff);
info.repo = repo;
info.old_iter = old_iter;
@@ -1269,7 +1269,7 @@ cleanup:
b_opts.flags = FLAGS_SECOND; \
b_opts.start = pfx; \
b_opts.end = pfx; \
- GITERR_CHECK_VERSION(opts, GIT_DIFF_OPTIONS_VERSION, "git_diff_options"); \
+ GIT_ERROR_CHECK_VERSION(opts, GIT_DIFF_OPTIONS_VERSION, "git_diff_options"); \
if (opts && (opts->flags & GIT_DIFF_DISABLE_PATHSPEC_MATCH)) { \
a_opts.pathlist.strings = opts->pathspec.strings; \
a_opts.pathlist.count = opts->pathspec.count; \
@@ -1320,7 +1320,7 @@ static int diff_load_index(git_index **index, git_repository *repo)
/* reload the repository index when user did not pass one in */
if (!error && git_index_read(*index, false) < 0)
- giterr_clear();
+ git_error_clear();
return error;
}
@@ -1552,7 +1552,7 @@ int git_diff__paired_foreach(
}
if ((error = cb(h2i, i2w, payload)) != 0) {
- giterr_set_after_callback(error);
+ git_error_set_after_callback(error);
break;
}
}
@@ -1591,7 +1591,7 @@ int git_diff__commit(
char commit_oidstr[GIT_OID_HEXSZ + 1];
error = -1;
- giterr_set(GITERR_INVALID, "commit %s is a merge commit",
+ git_error_set(GIT_ERROR_INVALID, "commit %s is a merge commit",
git_oid_tostr(commit_oidstr, GIT_OID_HEXSZ + 1, git_commit_id(commit)));
goto on_error;
}
diff --git a/src/diff_parse.c b/src/diff_parse.c
index 59fd861..b4c76a3 100644
--- a/src/diff_parse.c
+++ b/src/diff_parse.c
@@ -78,10 +78,10 @@ int git_diff_from_buffer(
*out = NULL;
diff = diff_parsed_alloc();
- GITERR_CHECK_ALLOC(diff);
+ GIT_ERROR_CHECK_ALLOC(diff);
ctx = git_patch_parse_ctx_init(content, content_len, NULL);
- GITERR_CHECK_ALLOC(ctx);
+ GIT_ERROR_CHECK_ALLOC(ctx);
while (ctx->parse_ctx.remain_len) {
if ((error = git_patch_parse(&patch, ctx)) < 0)
@@ -92,7 +92,7 @@ int git_diff_from_buffer(
}
if (error == GIT_ENOTFOUND && git_vector_length(&diff->patches) > 0) {
- giterr_clear();
+ git_error_clear();
error = 0;
}
diff --git a/src/diff_print.c b/src/diff_print.c
index 090b4e8..8705615 100644
--- a/src/diff_print.c
+++ b/src/diff_print.c
@@ -224,7 +224,7 @@ static int diff_print_one_raw(
delta->new_file.id_abbrev;
if (pi->id_strlen > id_abbrev) {
- giterr_set(GITERR_PATCH,
+ git_error_set(GIT_ERROR_PATCH,
"the patch input contains %d id characters (cannot print %d)",
id_abbrev, pi->id_strlen);
return -1;
@@ -275,7 +275,7 @@ static int diff_print_oid_range(
if (delta->old_file.mode &&
id_strlen > delta->old_file.id_abbrev) {
- giterr_set(GITERR_PATCH,
+ git_error_set(GIT_ERROR_PATCH,
"the patch input contains %d id characters (cannot print %d)",
delta->old_file.id_abbrev, id_strlen);
return -1;
@@ -283,7 +283,7 @@ static int diff_print_oid_range(
if ((delta->new_file.mode &&
id_strlen > delta->new_file.id_abbrev)) {
- giterr_set(GITERR_PATCH,
+ git_error_set(GIT_ERROR_PATCH,
"the patch input contains %d id characters (cannot print %d)",
delta->new_file.id_abbrev, id_strlen);
return -1;
@@ -343,7 +343,7 @@ int diff_delta_format_similarity_header(
int error = 0;
if (delta->similarity > 100) {
- giterr_set(GITERR_PATCH, "invalid similarity %d", delta->similarity);
+ git_error_set(GIT_ERROR_PATCH, "invalid similarity %d", delta->similarity);
error = -1;
goto done;
}
@@ -540,7 +540,7 @@ static int diff_print_patch_file_binary(
binary->old_file.datalen, binary->old_file.inflatedlen)) < 0) {
if (error == GIT_EBUFS) {
- giterr_clear();
+ git_error_clear();
git_buf_truncate(pi->buf, pre_binary_size);
return diff_print_patch_file_binary_noshow(
@@ -683,7 +683,7 @@ int git_diff_print(
print_file = diff_print_one_name_status;
break;
default:
- giterr_set(GITERR_INVALID, "unknown diff output format (%d)", format);
+ git_error_set(GIT_ERROR_INVALID, "unknown diff output format (%d)", format);
return -1;
}
@@ -693,7 +693,7 @@ int git_diff_print(
diff, print_file, print_binary, print_hunk, print_line, &pi);
if (error) /* make sure error message is set */
- giterr_set_after_callback_function(error, "git_diff_print");
+ git_error_set_after_callback_function(error, "git_diff_print");
}
git_buf_dispose(&buf);
@@ -711,7 +711,7 @@ int git_diff_print_callback__to_buf(
GIT_UNUSED(delta); GIT_UNUSED(hunk);
if (!output) {
- giterr_set(GITERR_INVALID, "buffer pointer must be provided");
+ git_error_set(GIT_ERROR_INVALID, "buffer pointer must be provided");
return -1;
}
@@ -773,7 +773,7 @@ int git_patch_print(
&pi);
if (error) /* make sure error message is set */
- giterr_set_after_callback_function(error, "git_patch_print");
+ git_error_set_after_callback_function(error, "git_patch_print");
}
git_buf_dispose(&temp);
diff --git a/src/diff_stats.c b/src/diff_stats.c
index 3af5914..9cd8006 100644
--- a/src/diff_stats.c
+++ b/src/diff_stats.c
@@ -184,7 +184,7 @@ int git_diff_get_stats(
assert(out && diff);
stats = git__calloc(1, sizeof(git_diff_stats));
- GITERR_CHECK_ALLOC(stats);
+ GIT_ERROR_CHECK_ALLOC(stats);
deltas = git_diff_num_deltas(diff);
diff --git a/src/diff_tform.c b/src/diff_tform.c
index 3a8924d..00ce1cb 100644
--- a/src/diff_tform.c
+++ b/src/diff_tform.c
@@ -131,7 +131,7 @@ int git_diff__merge(
if (ignore_case != ((from->opts.flags & GIT_DIFF_IGNORE_CASE) != 0) ||
reversed != ((from->opts.flags & GIT_DIFF_REVERSE) != 0)) {
- giterr_set(GITERR_INVALID,
+ git_error_set(GIT_ERROR_INVALID,
"attempt to merge diffs created with conflicting options");
return -1;
}
@@ -251,7 +251,7 @@ static int normalize_find_opts(
git_config *cfg = NULL;
git_hashsig_option_t hashsig_opts;
- GITERR_CHECK_VERSION(given, GIT_DIFF_FIND_OPTIONS_VERSION, "git_diff_find_options");
+ GIT_ERROR_CHECK_VERSION(given, GIT_DIFF_FIND_OPTIONS_VERSION, "git_diff_find_options");
if (diff->repo != NULL &&
git_repository_config__weakptr(&cfg, diff->repo) < 0)
@@ -332,7 +332,7 @@ static int normalize_find_opts(
/* 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);
+ GIT_ERROR_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;
@@ -357,7 +357,7 @@ static int insert_delete_side_of_split(
{
/* make new record for DELETED side of split */
git_diff_delta *deleted = git_diff__delta_dup(delta, &diff->pool);
- GITERR_CHECK_ALLOC(deleted);
+ GIT_ERROR_CHECK_ALLOC(deleted);
deleted->status = GIT_DELTA_DELETED;
deleted->nfiles = 1;
@@ -502,7 +502,7 @@ static int similarity_sig(
if (error < 0) {
/* if lookup fails, just skip this item in similarity calc */
- giterr_clear();
+ git_error_clear();
} else {
size_t sz;
@@ -831,9 +831,9 @@ int git_diff_find_similar(
if ((opts.flags & GIT_DIFF_FIND_ALL) == 0)
goto cleanup;
- GITERR_CHECK_ALLOC_MULTIPLY(&sigcache_size, num_deltas, 2);
+ GIT_ERROR_CHECK_ALLOC_MULTIPLY(&sigcache_size, num_deltas, 2);
sigcache = git__calloc(sigcache_size, sizeof(void *));
- GITERR_CHECK_ALLOC(sigcache);
+ GIT_ERROR_CHECK_ALLOC(sigcache);
/* Label rename sources and targets
*
@@ -856,13 +856,13 @@ int git_diff_find_similar(
goto cleanup;
src2tgt = git__calloc(num_deltas, sizeof(diff_find_match));
- GITERR_CHECK_ALLOC(src2tgt);
+ GIT_ERROR_CHECK_ALLOC(src2tgt);
tgt2src = git__calloc(num_deltas, sizeof(diff_find_match));
- GITERR_CHECK_ALLOC(tgt2src);
+ GIT_ERROR_CHECK_ALLOC(tgt2src);
if (FLAG_SET(&opts, GIT_DIFF_FIND_COPIES)) {
tgt2src_copy = git__calloc(num_deltas, sizeof(diff_find_match));
- GITERR_CHECK_ALLOC(tgt2src_copy);
+ GIT_ERROR_CHECK_ALLOC(tgt2src_copy);
}
/*
diff --git a/src/diff_xdiff.c b/src/diff_xdiff.c
index 6907e52..c4668fa 100644
--- a/src/diff_xdiff.c
+++ b/src/diff_xdiff.c
@@ -52,7 +52,7 @@ static int git_xdiff_parse_hunk(git_diff_hunk *hunk, const char *header)
return 0;
fail:
- giterr_set(GITERR_INVALID, "malformed hunk header from xdiff");
+ git_error_set(GIT_ERROR_INVALID, "malformed hunk header from xdiff");
return -1;
}
@@ -101,7 +101,7 @@ static int diff_update_lines(
info->new_lineno += (int)line->num_lines;
break;
default:
- giterr_set(GITERR_INVALID, "unknown diff line origin %02x",
+ git_error_set(GIT_ERROR_INVALID, "unknown diff line origin %02x",
(unsigned int)line->origin);
return -1;
}
@@ -224,7 +224,7 @@ static int git_xdiff(git_patch_generated_output *output, git_patch_generated *pa
if (info.xd_old_data.size > GIT_XDIFF_MAX_SIZE ||
info.xd_new_data.size > GIT_XDIFF_MAX_SIZE) {
- giterr_set(GITERR_INVALID, "files too large for diff");
+ git_error_set(GIT_ERROR_INVALID, "files too large for diff");
return -1;
}
diff --git a/src/errors.c b/src/errors.c
index a874163..03097dd 100644
--- a/src/errors.c
+++ b/src/errors.c
@@ -17,7 +17,7 @@
static git_error g_git_oom_error = {
"Out of memory",
- GITERR_NOMEMORY
+ GIT_ERROR_NOMEMORY
};
static void set_error_from_buffer(int error_class)
@@ -44,18 +44,18 @@ static void set_error(int error_class, char *string)
set_error_from_buffer(error_class);
}
-void giterr_set_oom(void)
+void git_error_set_oom(void)
{
GIT_GLOBAL->last_error = &g_git_oom_error;
}
-void giterr_set(int error_class, const char *string, ...)
+void git_error_set(int error_class, const char *string, ...)
{
va_list arglist;
#ifdef GIT_WIN32
- DWORD win32_error_code = (error_class == GITERR_OS) ? GetLastError() : 0;
+ DWORD win32_error_code = (error_class == GIT_ERROR_OS) ? GetLastError() : 0;
#endif
- int error_code = (error_class == GITERR_OS) ? errno : 0;
+ int error_code = (error_class == GIT_ERROR_OS) ? errno : 0;
git_buf *buf = &GIT_GLOBAL->error_buf;
git_buf_clear(buf);
@@ -64,11 +64,11 @@ void giterr_set(int error_class, const char *string, ...)
git_buf_vprintf(buf, string, arglist);
va_end(arglist);
- if (error_class == GITERR_OS)
+ if (error_class == GIT_ERROR_OS)
git_buf_PUTS(buf, ": ");
}
- if (error_class == GITERR_OS) {
+ if (error_class == GIT_ERROR_OS) {
#ifdef GIT_WIN32
char * win32_error = git_win32_get_error_message(win32_error_code);
if (win32_error) {
@@ -90,7 +90,7 @@ void giterr_set(int error_class, const char *string, ...)
set_error_from_buffer(error_class);
}
-void giterr_set_str(int error_class, const char *string)
+void git_error_set_str(int error_class, const char *string)
{
git_buf *buf = &GIT_GLOBAL->error_buf;
@@ -105,14 +105,14 @@ void giterr_set_str(int error_class, const char *string)
set_error_from_buffer(error_class);
}
-int giterr_set_regex(const regex_t *regex, int error_code)
+int git_error_set_regex(const regex_t *regex, int error_code)
{
char error_buf[1024];
assert(error_code);
regerror(error_code, regex, error_buf, sizeof(error_buf));
- giterr_set_str(GITERR_REGEX, error_buf);
+ git_error_set_str(GIT_ERROR_REGEX, error_buf);
if (error_code == REG_NOMATCH)
return GIT_ENOTFOUND;
@@ -120,7 +120,7 @@ int giterr_set_regex(const regex_t *regex, int error_code)
return GIT_EINVALIDSPEC;
}
-void giterr_clear(void)
+void git_error_clear(void)
{
if (GIT_GLOBAL->last_error != NULL) {
set_error(0, NULL);
@@ -133,12 +133,12 @@ void giterr_clear(void)
#endif
}
-const git_error *giterr_last(void)
+const git_error *git_error_last(void)
{
return GIT_GLOBAL->last_error;
}
-int giterr_state_capture(git_error_state *state, int error_code)
+int git_error_state_capture(git_error_state *state, int error_code)
{
git_error *error = GIT_GLOBAL->last_error;
git_buf *error_buf = &GIT_GLOBAL->error_buf;
@@ -160,19 +160,19 @@ int giterr_state_capture(git_error_state *state, int error_code)
state->error_msg.message = git_buf_detach(error_buf);
}
- giterr_clear();
+ git_error_clear();
return error_code;
}
-int giterr_state_restore(git_error_state *state)
+int git_error_state_restore(git_error_state *state)
{
int ret = 0;
- giterr_clear();
+ git_error_clear();
if (state && state->error_msg.message) {
if (state->oom)
- giterr_set_oom();
+ git_error_set_oom();
else
set_error(state->error_msg.klass, state->error_msg.message);
@@ -183,7 +183,7 @@ int giterr_state_restore(git_error_state *state)
return ret;
}
-void giterr_state_free(git_error_state *state)
+void git_error_state_free(git_error_state *state)
{
if (!state)
return;
@@ -194,7 +194,7 @@ void giterr_state_free(git_error_state *state)
memset(state, 0, sizeof(git_error_state));
}
-int giterr_system_last(void)
+int git_error_system_last(void)
{
#ifdef GIT_WIN32
return GetLastError();
@@ -203,7 +203,7 @@ int giterr_system_last(void)
#endif
}
-void giterr_system_set(int code)
+void git_error_system_set(int code)
{
#ifdef GIT_WIN32
SetLastError(code);
@@ -211,3 +211,25 @@ void giterr_system_set(int code)
errno = code;
#endif
}
+
+/* Deprecated error values and functions */
+
+const git_error *giterr_last(void)
+{
+ return git_error_last();
+}
+
+void giterr_clear(void)
+{
+ git_error_clear();
+}
+
+void giterr_set_str(int error_class, const char *string)
+{
+ return git_error_set_str(error_class, string);
+}
+
+void giterr_set_oom(void)
+{
+ git_error_set_oom();
+}
diff --git a/src/fetch.c b/src/fetch.c
index d68df88..d29341b 100644
--- a/src/fetch.c
+++ b/src/fetch.c
@@ -113,7 +113,7 @@ int git_fetch_negotiate(git_remote *remote, const git_fetch_options *opts)
remote->need_pack = 0;
if (filter_wants(remote, opts) < 0) {
- giterr_set(GITERR_NET, "failed to filter the reference list for wants");
+ git_error_set(GIT_ERROR_NET, "failed to filter the reference list for wants");
return -1;
}
diff --git a/src/fetchhead.c b/src/fetchhead.c
index e710216..bdded02 100644
--- a/src/fetchhead.c
+++ b/src/fetchhead.c
@@ -50,7 +50,7 @@ int git_fetchhead_ref_create(
*out = NULL;
fetchhead_ref = git__malloc(sizeof(git_fetchhead_ref));
- GITERR_CHECK_ALLOC(fetchhead_ref);
+ GIT_ERROR_CHECK_ALLOC(fetchhead_ref);
memset(fetchhead_ref, 0x0, sizeof(git_fetchhead_ref));
@@ -148,7 +148,7 @@ static int fetchhead_ref_parse(
*remote_url = NULL;
if (!*line) {
- giterr_set(GITERR_FETCHHEAD,
+ git_error_set(GIT_ERROR_FETCHHEAD,
"empty line in FETCH_HEAD line %"PRIuZ, line_num);
return -1;
}
@@ -162,16 +162,16 @@ static int fetchhead_ref_parse(
}
if (strlen(oid_str) != GIT_OID_HEXSZ) {
- giterr_set(GITERR_FETCHHEAD,
+ git_error_set(GIT_ERROR_FETCHHEAD,
"invalid object ID in FETCH_HEAD line %"PRIuZ, line_num);
return -1;
}
if (git_oid_fromstr(oid, oid_str) < 0) {
- const git_error *oid_err = giterr_last();
+ const git_error *oid_err = git_error_last();
const char *err_msg = oid_err ? oid_err->message : "invalid object ID";
- giterr_set(GITERR_FETCHHEAD, "%s in FETCH_HEAD line %"PRIuZ,
+ git_error_set(GIT_ERROR_FETCHHEAD, "%s in FETCH_HEAD line %"PRIuZ,
err_msg, line_num);
return -1;
}
@@ -179,7 +179,7 @@ static int fetchhead_ref_parse(
/* Parse new data from newer git clients */
if (*line) {
if ((is_merge_str = git__strsep(&line, "\t")) == NULL) {
- giterr_set(GITERR_FETCHHEAD,
+ git_error_set(GIT_ERROR_FETCHHEAD,
"invalid description data in FETCH_HEAD line %"PRIuZ, line_num);
return -1;
}
@@ -189,13 +189,13 @@ static int fetchhead_ref_parse(
else if (strcmp(is_merge_str, "not-for-merge") == 0)
*is_merge = 0;
else {
- giterr_set(GITERR_FETCHHEAD,
+ git_error_set(GIT_ERROR_FETCHHEAD,
"invalid for-merge entry in FETCH_HEAD line %"PRIuZ, line_num);
return -1;
}
if ((desc = line) == NULL) {
- giterr_set(GITERR_FETCHHEAD,
+ git_error_set(GIT_ERROR_FETCHHEAD,
"invalid description in FETCH_HEAD line %"PRIuZ, line_num);
return -1;
}
@@ -212,7 +212,7 @@ static int fetchhead_ref_parse(
if (name) {
if ((desc = strstr(name, "' ")) == NULL ||
git__prefixcmp(desc, "' of ") != 0) {
- giterr_set(GITERR_FETCHHEAD,
+ git_error_set(GIT_ERROR_FETCHHEAD,
"invalid description in FETCH_HEAD line %"PRIuZ, line_num);
return -1;
}
@@ -271,13 +271,13 @@ int git_repository_fetchhead_foreach(git_repository *repo,
error = cb(ref_name, remote_url, &oid, is_merge, payload);
if (error) {
- giterr_set_after_callback(error);
+ git_error_set_after_callback(error);
goto done;
}
}
if (*buffer) {
- giterr_set(GITERR_FETCHHEAD, "no EOL at line %"PRIuZ, line_num+1);
+ git_error_set(GIT_ERROR_FETCHHEAD, "no EOL at line %"PRIuZ, line_num+1);
error = -1;
goto done;
}
diff --git a/src/filebuf.c b/src/filebuf.c
index 401910c..8a70bcd 100644
--- a/src/filebuf.c
+++ b/src/filebuf.c
@@ -24,15 +24,15 @@ static int verify_last_error(git_filebuf *file)
{
switch (file->last_error) {
case BUFERR_WRITE:
- giterr_set(GITERR_OS, "failed to write out file");
+ git_error_set(GIT_ERROR_OS, "failed to write out file");
return -1;
case BUFERR_MEM:
- giterr_set_oom();
+ git_error_set_oom();
return -1;
case BUFERR_ZLIB:
- giterr_set(GITERR_ZLIB,
+ git_error_set(GIT_ERROR_ZLIB,
"Buffer error when writing out ZLib data");
return -1;
@@ -47,8 +47,8 @@ static int lock_file(git_filebuf *file, int flags, mode_t mode)
if (flags & GIT_FILEBUF_FORCE)
p_unlink(file->path_lock);
else {
- giterr_clear(); /* actual OS error code just confuses */
- giterr_set(GITERR_OS,
+ git_error_clear(); /* actual OS error code just confuses */
+ git_error_set(GIT_ERROR_OS,
"failed to lock file '%s' for writing", file->path_lock);
return GIT_ELOCKED;
}
@@ -75,7 +75,7 @@ static int lock_file(git_filebuf *file, int flags, mode_t mode)
source = p_open(file->path_original, O_RDONLY);
if (source < 0) {
- giterr_set(GITERR_OS,
+ git_error_set(GIT_ERROR_OS,
"failed to open file '%s' for reading",
file->path_original);
return -1;
@@ -91,10 +91,10 @@ static int lock_file(git_filebuf *file, int flags, mode_t mode)
p_close(source);
if (read_bytes < 0) {
- giterr_set(GITERR_OS, "failed to read file '%s'", file->path_original);
+ git_error_set(GIT_ERROR_OS, "failed to read file '%s'", file->path_original);
return -1;
} else if (error < 0) {
- giterr_set(GITERR_OS, "failed to write file '%s'", file->path_lock);
+ git_error_set(GIT_ERROR_OS, "failed to write file '%s'", file->path_lock);
return -1;
}
}
@@ -218,7 +218,7 @@ static int resolve_symlink(git_buf *out, const char *path)
}
if (error < 0) {
- giterr_set(GITERR_OS, "failed to stat '%s'", curpath.ptr);
+ git_error_set(GIT_ERROR_OS, "failed to stat '%s'", curpath.ptr);
error = -1;
goto cleanup;
}
@@ -230,13 +230,13 @@ static int resolve_symlink(git_buf *out, const char *path)
ret = p_readlink(curpath.ptr, target.ptr, GIT_PATH_MAX);
if (ret < 0) {
- giterr_set(GITERR_OS, "failed to read symlink '%s'", curpath.ptr);
+ git_error_set(GIT_ERROR_OS, "failed to read symlink '%s'", curpath.ptr);
error = -1;
goto cleanup;
}
if (ret == GIT_PATH_MAX) {
- giterr_set(GITERR_INVALID, "symlink target too long");
+ git_error_set(GIT_ERROR_INVALID, "symlink target too long");
error = -1;
goto cleanup;
}
@@ -263,7 +263,7 @@ static int resolve_symlink(git_buf *out, const char *path)
}
}
- giterr_set(GITERR_INVALID, "maximum symlink depth reached");
+ git_error_set(GIT_ERROR_INVALID, "maximum symlink depth reached");
error = -1;
cleanup:
@@ -303,7 +303,7 @@ int git_filebuf_open_withsize(git_filebuf *file, const char *path, int flags, mo
/* Allocate the main cache buffer */
if (!file->do_not_buffer) {
file->buffer = git__malloc(file->buf_size);
- GITERR_CHECK_ALLOC(file->buffer);
+ GIT_ERROR_CHECK_ALLOC(file->buffer);
}
/* If we are hashing on-write, allocate a new hash context */
@@ -320,13 +320,13 @@ int git_filebuf_open_withsize(git_filebuf *file, const char *path, int flags, mo
if (compression != 0) {
/* Initialize the ZLib stream */
if (deflateInit(&file->zs, compression) != Z_OK) {
- giterr_set(GITERR_ZLIB, "failed to initialize zlib");
+ git_error_set(GIT_ERROR_ZLIB, "failed to initialize zlib");
goto cleanup;
}
/* Allocate the Zlib cache buffer */
file->z_buf = git__malloc(file->buf_size);
- GITERR_CHECK_ALLOC(file->z_buf);
+ GIT_ERROR_CHECK_ALLOC(file->z_buf);
/* Never flush */
file->flush_mode = Z_NO_FLUSH;
@@ -352,7 +352,7 @@ int git_filebuf_open_withsize(git_filebuf *file, const char *path, int flags, mo
/* No original path */
file->path_original = NULL;
file->path_lock = git_buf_detach(&tmp_path);
- GITERR_CHECK_ALLOC(file->path_lock);
+ GIT_ERROR_CHECK_ALLOC(file->path_lock);
} else {
git_buf resolved_path = GIT_BUF_INIT;
@@ -364,15 +364,15 @@ int git_filebuf_open_withsize(git_filebuf *file, const char *path, int flags, mo
file->path_original = git_buf_detach(&resolved_path);
/* create the locking path by appending ".lock" to the original */
- GITERR_CHECK_ALLOC_ADD(&alloc_len, path_len, GIT_FILELOCK_EXTLENGTH);
+ GIT_ERROR_CHECK_ALLOC_ADD(&alloc_len, path_len, GIT_FILELOCK_EXTLENGTH);
file->path_lock = git__malloc(alloc_len);
- GITERR_CHECK_ALLOC(file->path_lock);
+ GIT_ERROR_CHECK_ALLOC(file->path_lock);
memcpy(file->path_lock, file->path_original, path_len);
memcpy(file->path_lock + path_len, GIT_FILELOCK_EXTENSION, GIT_FILELOCK_EXTLENGTH);
if (git_path_isdir(file->path_original)) {
- giterr_set(GITERR_FILESYSTEM, "path '%s' is a directory", file->path_original);
+ git_error_set(GIT_ERROR_FILESYSTEM, "path '%s' is a directory", file->path_original);
error = GIT_EDIRECTORY;
goto cleanup;
}
@@ -411,7 +411,7 @@ int git_filebuf_commit_at(git_filebuf *file, const char *path)
{
git__free(file->path_original);
file->path_original = git__strdup(path);
- GITERR_CHECK_ALLOC(file->path_original);
+ GIT_ERROR_CHECK_ALLOC(file->path_original);
return git_filebuf_commit(file);
}
@@ -430,19 +430,19 @@ int git_filebuf_commit(git_filebuf *file)
file->fd_is_open = false;
if (file->do_fsync && p_fsync(file->fd) < 0) {
- giterr_set(GITERR_OS, "failed to fsync '%s'", file->path_lock);
+ git_error_set(GIT_ERROR_OS, "failed to fsync '%s'", file->path_lock);
goto on_error;
}
if (p_close(file->fd) < 0) {
- giterr_set(GITERR_OS, "failed to close file at '%s'", file->path_lock);
+ git_error_set(GIT_ERROR_OS, "failed to close file at '%s'", file->path_lock);
goto on_error;
}
file->fd = -1;
if (p_rename(file->path_lock, file->path_original) < 0) {
- giterr_set(GITERR_OS, "failed to rename lockfile to '%s'", file->path_original);
+ git_error_set(GIT_ERROR_OS, "failed to rename lockfile to '%s'", file->path_original);
goto on_error;
}
@@ -583,7 +583,7 @@ int git_filebuf_stats(time_t *mtime, size_t *size, git_filebuf *file)
res = p_stat(file->path_original, &st);
if (res < 0) {
- giterr_set(GITERR_OS, "could not get stat info for '%s'",
+ git_error_set(GIT_ERROR_OS, "could not get stat info for '%s'",
file->path_original);
return res;
}
diff --git a/src/fileops.c b/src/fileops.c
index b1a9f03..988ea0f 100644
--- a/src/fileops.c
+++ b/src/fileops.c
@@ -35,13 +35,13 @@ int git_futils_mktmp(git_buf *path_out, const char *filename, mode_t mode)
return -1;
if ((fd = p_mkstemp(path_out->ptr)) < 0) {
- giterr_set(GITERR_OS,
+ git_error_set(GIT_ERROR_OS,
"failed to create temporary file '%s'", path_out->ptr);
return -1;
}
if (p_chmod(path_out->ptr, (mode & ~mask))) {
- giterr_set(GITERR_OS,
+ git_error_set(GIT_ERROR_OS,
"failed to set permissions on file '%s'", path_out->ptr);
return -1;
}
@@ -58,7 +58,7 @@ int git_futils_creat_withpath(const char *path, const mode_t dirmode, const mode
fd = p_creat(path, mode);
if (fd < 0) {
- giterr_set(GITERR_OS, "failed to create file '%s'", path);
+ git_error_set(GIT_ERROR_OS, "failed to create file '%s'", path);
return -1;
}
@@ -72,7 +72,7 @@ int git_futils_creat_locked(const char *path, const mode_t mode)
if (fd < 0) {
int error = errno;
- giterr_set(GITERR_OS, "failed to create locked file '%s'", path);
+ git_error_set(GIT_ERROR_OS, "failed to create locked file '%s'", path);
switch (error) {
case EEXIST:
return GIT_ELOCKED;
@@ -117,7 +117,7 @@ git_off_t git_futils_filesize(git_file fd)
struct stat sb;
if (p_fstat(fd, &sb)) {
- giterr_set(GITERR_OS, "failed to stat file descriptor");
+ git_error_set(GIT_ERROR_OS, "failed to stat file descriptor");
return -1;
}
@@ -146,11 +146,11 @@ int git_futils_readbuffer_fd(git_buf *buf, git_file fd, size_t len)
git_buf_clear(buf);
if (!git__is_ssizet(len)) {
- giterr_set(GITERR_INVALID, "read too large");
+ git_error_set(GIT_ERROR_INVALID, "read too large");
return -1;
}
- GITERR_CHECK_ALLOC_ADD(&alloc_len, len, 1);
+ GIT_ERROR_CHECK_ALLOC_ADD(&alloc_len, len, 1);
if (git_buf_grow(buf, alloc_len) < 0)
return -1;
@@ -158,7 +158,7 @@ int git_futils_readbuffer_fd(git_buf *buf, git_file fd, size_t len)
read_size = p_read(fd, buf->ptr, len);
if (read_size != (ssize_t)len) {
- giterr_set(GITERR_OS, "failed to read descriptor");
+ git_error_set(GIT_ERROR_OS, "failed to read descriptor");
git_buf_dispose(buf);
return -1;
}
@@ -188,12 +188,12 @@ int git_futils_readbuffer_updated(
if (S_ISDIR(st.st_mode)) {
- giterr_set(GITERR_INVALID, "requested file is a directory");
+ git_error_set(GIT_ERROR_INVALID, "requested file is a directory");
return GIT_ENOTFOUND;
}
if (!git__is_sizet(st.st_size+1)) {
- giterr_set(GITERR_OS, "invalid regular file stat for '%s'", path);
+ git_error_set(GIT_ERROR_OS, "invalid regular file stat for '%s'", path);
return -1;
}
@@ -261,24 +261,24 @@ int git_futils_writebuffer(
mode = GIT_FILEMODE_BLOB;
if ((fd = p_open(path, flags, mode)) < 0) {
- giterr_set(GITERR_OS, "could not open '%s' for writing", path);
+ git_error_set(GIT_ERROR_OS, "could not open '%s' for writing", path);
return fd;
}
if ((error = p_write(fd, git_buf_cstr(buf), git_buf_len(buf))) < 0) {
- giterr_set(GITERR_OS, "could not write to '%s'", path);
+ git_error_set(GIT_ERROR_OS, "could not write to '%s'", path);
(void)p_close(fd);
return error;
}
if (do_fsync && (error = p_fsync(fd)) < 0) {
- giterr_set(GITERR_OS, "could not fsync '%s'", path);
+ git_error_set(GIT_ERROR_OS, "could not fsync '%s'", path);
p_close(fd);
return error;
}
if ((error = p_close(fd)) < 0) {
- giterr_set(GITERR_OS, "error while closing '%s'", path);
+ git_error_set(GIT_ERROR_OS, "error while closing '%s'", path);
return error;
}
@@ -294,7 +294,7 @@ int git_futils_mv_withpath(const char *from, const char *to, const mode_t dirmod
return -1;
if (p_rename(from, to) < 0) {
- giterr_set(GITERR_OS, "failed to rename '%s' to '%s'", from, to);
+ git_error_set(GIT_ERROR_OS, "failed to rename '%s' to '%s'", from, to);
return -1;
}
@@ -321,7 +321,7 @@ int git_futils_mmap_ro_file(git_map *out, const char *path)
}
if (!git__is_sizet(len)) {
- giterr_set(GITERR_OS, "file `%s` too large to mmap", path);
+ git_error_set(GIT_ERROR_OS, "file `%s` too large to mmap", path);
result = -1;
goto out;
}
@@ -346,7 +346,7 @@ GIT_INLINE(int) mkdir_validate_dir(
{
/* with exclusive create, existing dir is an error */
if ((flags & GIT_MKDIR_EXCL) != 0) {
- giterr_set(GITERR_FILESYSTEM,
+ git_error_set(GIT_ERROR_FILESYSTEM,
"failed to make directory '%s': directory exists", path);
return GIT_EEXISTS;
}
@@ -354,7 +354,7 @@ GIT_INLINE(int) mkdir_validate_dir(
if ((S_ISREG(st->st_mode) && (flags & GIT_MKDIR_REMOVE_FILES)) ||
(S_ISLNK(st->st_mode) && (flags & GIT_MKDIR_REMOVE_SYMLINKS))) {
if (p_unlink(path) < 0) {
- giterr_set(GITERR_OS, "failed to remove %s '%s'",
+ git_error_set(GIT_ERROR_OS, "failed to remove %s '%s'",
S_ISLNK(st->st_mode) ? "symlink" : "file", path);
return GIT_EEXISTS;
}
@@ -362,7 +362,7 @@ GIT_INLINE(int) mkdir_validate_dir(
opts->perfdata.mkdir_calls++;
if (p_mkdir(path, mode) < 0) {
- giterr_set(GITERR_OS, "failed to make directory '%s'", path);
+ git_error_set(GIT_ERROR_OS, "failed to make directory '%s'", path);
return GIT_EEXISTS;
}
}
@@ -372,13 +372,13 @@ GIT_INLINE(int) mkdir_validate_dir(
opts->perfdata.stat_calls++;
if (p_stat(path, st) < 0) {
- giterr_set(GITERR_OS, "failed to make directory '%s'", path);
+ git_error_set(GIT_ERROR_OS, "failed to make directory '%s'", path);
return GIT_EEXISTS;
}
}
else if (!S_ISDIR(st->st_mode)) {
- giterr_set(GITERR_FILESYSTEM,
+ git_error_set(GIT_ERROR_FILESYSTEM,
"failed to make directory '%s': directory exists", path);
return GIT_EEXISTS;
}
@@ -400,7 +400,7 @@ GIT_INLINE(int) mkdir_validate_mode(
opts->perfdata.chmod_calls++;
if (p_chmod(path, mode) < 0) {
- giterr_set(GITERR_OS, "failed to set permissions on '%s'", path);
+ git_error_set(GIT_ERROR_OS, "failed to set permissions on '%s'", path);
return -1;
}
}
@@ -415,7 +415,7 @@ GIT_INLINE(int) mkdir_canonicalize(
ssize_t root_len;
if (path->size == 0) {
- giterr_set(GITERR_OS, "attempt to create empty path");
+ git_error_set(GIT_ERROR_OS, "attempt to create empty path");
return -1;
}
@@ -475,7 +475,7 @@ int git_futils_mkdir(
if (error == 0) {
break;
} else if (errno != ENOENT) {
- giterr_set(GITERR_OS, "failed to stat '%s'", parent_path.ptr);
+ git_error_set(GIT_ERROR_OS, "failed to stat '%s'", parent_path.ptr);
goto done;
}
@@ -602,18 +602,18 @@ int git_futils_mkdir_relative(
retry_lstat:
if (p_lstat(make_path.ptr, &st) < 0) {
if (mkdir_attempted || errno != ENOENT) {
- giterr_set(GITERR_OS, "cannot access component in path '%s'", make_path.ptr);
+ git_error_set(GIT_ERROR_OS, "cannot access component in path '%s'", make_path.ptr);
error = -1;
goto done;
}
- giterr_clear();
+ git_error_clear();
opts->perfdata.mkdir_calls++;
mkdir_attempted = true;
if (p_mkdir(make_path.ptr, mode) < 0) {
if (errno == EEXIST)
goto retry_lstat;
- giterr_set(GITERR_OS, "failed to make directory '%s'", make_path.ptr);
+ git_error_set(GIT_ERROR_OS, "failed to make directory '%s'", make_path.ptr);
error = -1;
goto done;
}
@@ -632,11 +632,11 @@ retry_lstat:
char *cache_path;
size_t alloc_size;
- GITERR_CHECK_ALLOC_ADD(&alloc_size, make_path.size, 1);
+ GIT_ERROR_CHECK_ALLOC_ADD(&alloc_size, make_path.size, 1);
if (!git__is_uint32(alloc_size))
return -1;
cache_path = git_pool_malloc(opts->pool, (uint32_t)alloc_size);
- GITERR_CHECK_ALLOC(cache_path);
+ GIT_ERROR_CHECK_ALLOC(cache_path);
memcpy(cache_path, make_path.ptr, make_path.size + 1);
@@ -654,7 +654,7 @@ retry_lstat:
opts->perfdata.stat_calls++;
if (p_stat(make_path.ptr, &st) < 0 || !S_ISDIR(st.st_mode)) {
- giterr_set(GITERR_OS, "path is not a directory '%s'",
+ git_error_set(GIT_ERROR_OS, "path is not a directory '%s'",
make_path.ptr);
error = GIT_ENOTFOUND;
}
@@ -677,10 +677,10 @@ typedef struct {
static int futils__error_cannot_rmdir(const char *path, const char *filemsg)
{
if (filemsg)
- giterr_set(GITERR_OS, "could not remove directory '%s': %s",
+ git_error_set(GIT_ERROR_OS, "could not remove directory '%s': %s",
path, filemsg);
else
- giterr_set(GITERR_OS, "could not remove directory '%s'", path);
+ git_error_set(GIT_ERROR_OS, "could not remove directory '%s'", path);
return -1;
}
@@ -818,7 +818,7 @@ int git_futils_rmdir_r(
&fullpath, base, futils__rmdir_empty_parent, &data);
if (error == GIT_ITEROVER) {
- giterr_clear();
+ git_error_clear();
error = 0;
}
@@ -851,12 +851,12 @@ static int cp_by_fd(int ifd, int ofd, bool close_fd_when_done)
error = p_write(ofd, buffer, len);
if (len < 0) {
- giterr_set(GITERR_OS, "read error while copying file");
+ git_error_set(GIT_ERROR_OS, "read error while copying file");
error = (int)len;
}
if (error < 0)
- giterr_set(GITERR_OS, "write error while copying file");
+ git_error_set(GIT_ERROR_OS, "write error while copying file");
if (close_fd_when_done) {
p_close(ifd);
@@ -901,20 +901,20 @@ static int cp_link(const char *from, const char *to, size_t link_size)
char *link_data;
size_t alloc_size;
- GITERR_CHECK_ALLOC_ADD(&alloc_size, link_size, 1);
+ GIT_ERROR_CHECK_ALLOC_ADD(&alloc_size, link_size, 1);
link_data = git__malloc(alloc_size);
- GITERR_CHECK_ALLOC(link_data);
+ GIT_ERROR_CHECK_ALLOC(link_data);
read_len = p_readlink(from, link_data, link_size);
if (read_len != (ssize_t)link_size) {
- giterr_set(GITERR_OS, "failed to read symlink data for '%s'", from);
+ git_error_set(GIT_ERROR_OS, "failed to read symlink data for '%s'", from);
error = -1;
}
else {
link_data[read_len] = '\0';
if (p_symlink(link_data, to) < 0) {
- giterr_set(GITERR_OS, "could not symlink '%s' as '%s'",
+ git_error_set(GIT_ERROR_OS, "could not symlink '%s' as '%s'",
link_data, to);
error = -1;
}
@@ -977,7 +977,7 @@ static int _cp_r_callback(void *ref, git_buf *from)
else if (error != GIT_ENOTFOUND)
return error;
else {
- giterr_clear();
+ git_error_clear();
error = 0;
}
@@ -1010,7 +1010,7 @@ static int _cp_r_callback(void *ref, git_buf *from)
return 0;
if (p_unlink(info->to.ptr) < 0) {
- giterr_set(GITERR_OS, "cannot overwrite existing file '%s'",
+ git_error_set(GIT_ERROR_OS, "cannot overwrite existing file '%s'",
info->to.ptr);
return GIT_EEXISTS;
}
@@ -1030,7 +1030,7 @@ static int _cp_r_callback(void *ref, git_buf *from)
/* make symlink or regular file */
if (info->flags & GIT_CPDIR_LINK_FILES) {
if ((error = p_link(from->ptr, info->to.ptr)) < 0)
- giterr_set(GITERR_OS, "failed to link '%s'", from->ptr);
+ git_error_set(GIT_ERROR_OS, "failed to link '%s'", from->ptr);
} else if (S_ISLNK(from_st.st_mode)) {
error = cp_link(from->ptr, info->to.ptr, (size_t)from_st.st_size);
} else {
@@ -1155,12 +1155,12 @@ int git_futils_fsync_dir(const char *path)
int fd, error = -1;
if ((fd = p_open(path, O_RDONLY)) < 0) {
- giterr_set(GITERR_OS, "failed to open directory '%s' for fsync", path);
+ git_error_set(GIT_ERROR_OS, "failed to open directory '%s' for fsync", path);
return -1;
}
if ((error = p_fsync(fd)) < 0)
- giterr_set(GITERR_OS, "failed to fsync directory '%s'", path);
+ git_error_set(GIT_ERROR_OS, "failed to fsync directory '%s'", path);
p_close(fd);
return error;
diff --git a/src/fileops.h b/src/fileops.h
index 2844ece..85131f8 100644
--- a/src/fileops.h
+++ b/src/fileops.h
@@ -340,7 +340,7 @@ typedef struct {
* This function updates the file stamp to current data for the given path
* and returns 0 if the file is up-to-date relative to the prior setting,
* 1 if the file has been changed, or GIT_ENOTFOUND if the file doesn't
- * exist. This will not call giterr_set, so you must set the error if you
+ * exist. This will not call git_error_set, so you must set the error if you
* plan to return an error.
*
* @param stamp File stamp to be checked
diff --git a/src/filter.c b/src/filter.c
index 90cc551..4c9c741 100644
--- a/src/filter.c
+++ b/src/filter.c
@@ -157,15 +157,15 @@ static int filter_registry_insert(
if (filter_def_scan_attrs(&attrs, &nattr, &nmatch, filter->attributes) < 0)
return -1;
- GITERR_CHECK_ALLOC_MULTIPLY(&alloc_len, nattr, 2);
- GITERR_CHECK_ALLOC_MULTIPLY(&alloc_len, alloc_len, sizeof(char *));
- GITERR_CHECK_ALLOC_ADD(&alloc_len, alloc_len, sizeof(git_filter_def));
+ GIT_ERROR_CHECK_ALLOC_MULTIPLY(&alloc_len, nattr, 2);
+ GIT_ERROR_CHECK_ALLOC_MULTIPLY(&alloc_len, alloc_len, sizeof(char *));
+ GIT_ERROR_CHECK_ALLOC_ADD(&alloc_len, alloc_len, sizeof(git_filter_def));
fdef = git__calloc(1, alloc_len);
- GITERR_CHECK_ALLOC(fdef);
+ GIT_ERROR_CHECK_ALLOC(fdef);
fdef->filter_name = git__strdup(name);
- GITERR_CHECK_ALLOC(fdef->filter_name);
+ GIT_ERROR_CHECK_ALLOC(fdef->filter_name);
fdef->filter = filter;
fdef->priority = priority;
@@ -269,13 +269,13 @@ int git_filter_register(
assert(name && filter);
if (git_rwlock_wrlock(&filter_registry.lock) < 0) {
- giterr_set(GITERR_OS, "failed to lock filter registry");
+ git_error_set(GIT_ERROR_OS, "failed to lock filter registry");
return -1;
}
if (!filter_registry_find(NULL, name)) {
- giterr_set(
- GITERR_FILTER, "attempt to reregister existing filter '%s'", name);
+ git_error_set(
+ GIT_ERROR_FILTER, "attempt to reregister existing filter '%s'", name);
error = GIT_EEXISTS;
goto done;
}
@@ -297,17 +297,17 @@ int git_filter_unregister(const char *name)
/* cannot unregister default filters */
if (!strcmp(GIT_FILTER_CRLF, name) || !strcmp(GIT_FILTER_IDENT, name)) {
- giterr_set(GITERR_FILTER, "cannot unregister filter '%s'", name);
+ git_error_set(GIT_ERROR_FILTER, "cannot unregister filter '%s'", name);
return -1;
}
if (git_rwlock_wrlock(&filter_registry.lock) < 0) {
- giterr_set(GITERR_OS, "failed to lock filter registry");
+ git_error_set(GIT_ERROR_OS, "failed to lock filter registry");
return -1;
}
if ((fdef = filter_registry_lookup(&pos, name)) == NULL) {
- giterr_set(GITERR_FILTER, "cannot find filter '%s' to unregister", name);
+ git_error_set(GIT_ERROR_FILTER, "cannot find filter '%s' to unregister", name);
error = GIT_ENOTFOUND;
goto done;
}
@@ -348,7 +348,7 @@ git_filter *git_filter_lookup(const char *name)
git_filter *filter = NULL;
if (git_rwlock_rdlock(&filter_registry.lock) < 0) {
- giterr_set(GITERR_OS, "failed to lock filter registry");
+ git_error_set(GIT_ERROR_OS, "failed to lock filter registry");
return NULL;
}
@@ -404,11 +404,11 @@ static int filter_list_new(
git_filter_list *fl = NULL;
size_t pathlen = src->path ? strlen(src->path) : 0, alloclen;
- GITERR_CHECK_ALLOC_ADD(&alloclen, sizeof(git_filter_list), pathlen);
- GITERR_CHECK_ALLOC_ADD(&alloclen, alloclen, 1);
+ GIT_ERROR_CHECK_ALLOC_ADD(&alloclen, sizeof(git_filter_list), pathlen);
+ GIT_ERROR_CHECK_ALLOC_ADD(&alloclen, alloclen, 1);
fl = git__calloc(1, alloclen);
- GITERR_CHECK_ALLOC(fl);
+ GIT_ERROR_CHECK_ALLOC(fl);
if (src->path)
memcpy(fl->path, src->path, pathlen);
@@ -431,14 +431,14 @@ static int filter_list_check_attributes(
int error;
size_t i;
const char **strs = git__calloc(fdef->nattrs, sizeof(const char *));
- GITERR_CHECK_ALLOC(strs);
+ GIT_ERROR_CHECK_ALLOC(strs);
error = git_attr_get_many_with_session(
strs, repo, attr_session, 0, src->path, fdef->nattrs, fdef->attrs);
/* if no values were found but no matches are needed, it's okay! */
if (error == GIT_ENOTFOUND && !fdef->nmatches) {
- giterr_clear();
+ git_error_clear();
git__free((void *)strs);
return 0;
}
@@ -499,7 +499,7 @@ int git_filter_list__load_ext(
git_filter_def *fdef;
if (git_rwlock_rdlock(&filter_registry.lock) < 0) {
- giterr_set(GITERR_OS, "failed to lock filter registry");
+ git_error_set(GIT_ERROR_OS, "failed to lock filter registry");
return -1;
}
@@ -551,7 +551,7 @@ int git_filter_list__load_ext(
}
fe = git_array_alloc(fl->filters);
- GITERR_CHECK_ALLOC(fe);
+ GIT_ERROR_CHECK_ALLOC(fe);
fe->filter = fdef->filter;
fe->filter_name = fdef->filter_name;
@@ -634,7 +634,7 @@ int git_filter_list_push(
assert(fl && filter);
if (git_rwlock_rdlock(&filter_registry.lock) < 0) {
- giterr_set(GITERR_OS, "failed to lock filter registry");
+ git_error_set(GIT_ERROR_OS, "failed to lock filter registry");
return -1;
}
@@ -646,7 +646,7 @@ int git_filter_list_push(
git_rwlock_rdunlock(&filter_registry.lock);
if (fdef == NULL) {
- giterr_set(GITERR_FILTER, "cannot use an unregistered filter");
+ git_error_set(GIT_ERROR_FILTER, "cannot use an unregistered filter");
return -1;
}
@@ -654,7 +654,7 @@ int git_filter_list_push(
return error;
fe = git_array_alloc(fl->filters);
- GITERR_CHECK_ALLOC(fe);
+ GIT_ERROR_CHECK_ALLOC(fe);
fe->filter = filter;
fe->payload = payload;
@@ -759,7 +759,7 @@ static int buf_from_blob(git_buf *out, git_blob *blob)
git_off_t rawsize = git_blob_rawsize(blob);
if (!git__is_sizet(rawsize)) {
- giterr_set(GITERR_OS, "blob is too large to filter");
+ git_error_set(GIT_ERROR_OS, "blob is too large to filter");
return -1;
}
@@ -829,9 +829,9 @@ static int proxy_stream_close(git_writestream *s)
} else {
/* close stream before erroring out taking care
* to preserve the original error */
- giterr_state_capture(&error_state, error);
+ git_error_state_capture(&error_state, error);
proxy_stream->target->close(proxy_stream->target);
- giterr_state_restore(&error_state);
+ git_error_state_restore(&error_state);
return error;
}
@@ -861,7 +861,7 @@ static int proxy_stream_init(
git_writestream *target)
{
struct proxy_stream *proxy_stream = git__calloc(1, sizeof(struct proxy_stream));
- GITERR_CHECK_ALLOC(proxy_stream);
+ GIT_ERROR_CHECK_ALLOC(proxy_stream);
proxy_stream->parent.write = proxy_stream_write;
proxy_stream->parent.close = proxy_stream_close;
diff --git a/src/hash/hash_collisiondetect.h b/src/hash/hash_collisiondetect.h
index 4e4c7da..7432098 100644
--- a/src/hash/hash_collisiondetect.h
+++ b/src/hash/hash_collisiondetect.h
@@ -41,7 +41,7 @@ GIT_INLINE(int) git_hash_final(git_oid *out, git_hash_ctx *ctx)
{
assert(ctx);
if (SHA1DCFinal(out->id, &ctx->c)) {
- giterr_set(GITERR_SHA1, "SHA1 collision attack detected");
+ git_error_set(GIT_ERROR_SHA1, "SHA1 collision attack detected");
return -1;
}
diff --git a/src/hash/hash_openssl.h b/src/hash/hash_openssl.h
index 9a32cba..8dbfd5a 100644
--- a/src/hash/hash_openssl.h
+++ b/src/hash/hash_openssl.h
@@ -29,7 +29,7 @@ GIT_INLINE(int) git_hash_init(git_hash_ctx *ctx)
assert(ctx);
if (SHA1_Init(&ctx->c) != 1) {
- giterr_set(GITERR_SHA1, "hash_openssl: failed to initialize hash context");
+ git_error_set(GIT_ERROR_SHA1, "hash_openssl: failed to initialize hash context");
return -1;
}
@@ -41,7 +41,7 @@ GIT_INLINE(int) git_hash_update(git_hash_ctx *ctx, const void *data, size_t len)
assert(ctx);
if (SHA1_Update(&ctx->c, data, len) != 1) {
- giterr_set(GITERR_SHA1, "hash_openssl: failed to update hash");
+ git_error_set(GIT_ERROR_SHA1, "hash_openssl: failed to update hash");
return -1;
}
@@ -53,7 +53,7 @@ GIT_INLINE(int) git_hash_final(git_oid *out, git_hash_ctx *ctx)
assert(ctx);
if (SHA1_Final(out->id, &ctx->c) != 1) {
- giterr_set(GITERR_SHA1, "hash_openssl: failed to finalize hash");
+ git_error_set(GIT_ERROR_SHA1, "hash_openssl: failed to finalize hash");
return -1;
}
diff --git a/src/hash/hash_win32.c b/src/hash/hash_win32.c
index 779802c..4b68303 100644
--- a/src/hash/hash_win32.c
+++ b/src/hash/hash_win32.c
@@ -25,7 +25,7 @@ GIT_INLINE(int) hash_cng_prov_init(void)
/* Only use CNG on Windows 2008 / Vista SP1 or better (Windows 6.0 SP1) */
if (!git_has_win32_version(6, 0, 1)) {
- giterr_set(GITERR_SHA1, "CryptoNG is not supported on this platform");
+ git_error_set(GIT_ERROR_SHA1, "CryptoNG is not supported on this platform");
return -1;
}
@@ -35,7 +35,7 @@ GIT_INLINE(int) hash_cng_prov_init(void)
StringCchCat(dll_path, MAX_PATH, "\\") < 0 ||
StringCchCat(dll_path, MAX_PATH, GIT_HASH_CNG_DLL_NAME) < 0 ||
(hash_prov.prov.cng.dll = LoadLibrary(dll_path)) == NULL) {
- giterr_set(GITERR_SHA1, "CryptoNG library could not be loaded");
+ git_error_set(GIT_ERROR_SHA1, "CryptoNG library could not be loaded");
return -1;
}
@@ -49,7 +49,7 @@ GIT_INLINE(int) hash_cng_prov_init(void)
(hash_prov.prov.cng.close_algorithm_provider = (hash_win32_cng_close_algorithm_provider_fn)GetProcAddress(hash_prov.prov.cng.dll, "BCryptCloseAlgorithmProvider")) == NULL) {
FreeLibrary(hash_prov.prov.cng.dll);
- giterr_set(GITERR_OS, "CryptoNG functions could not be loaded");
+ git_error_set(GIT_ERROR_OS, "CryptoNG functions could not be loaded");
return -1;
}
@@ -57,7 +57,7 @@ GIT_INLINE(int) hash_cng_prov_init(void)
if (hash_prov.prov.cng.open_algorithm_provider(&hash_prov.prov.cng.handle, GIT_HASH_CNG_HASH_TYPE, NULL, GIT_HASH_CNG_HASH_REUSABLE) < 0) {
FreeLibrary(hash_prov.prov.cng.dll);
- giterr_set(GITERR_OS, "algorithm provider could not be initialized");
+ git_error_set(GIT_ERROR_OS, "algorithm provider could not be initialized");
return -1;
}
@@ -66,7 +66,7 @@ GIT_INLINE(int) hash_cng_prov_init(void)
hash_prov.prov.cng.close_algorithm_provider(hash_prov.prov.cng.handle, 0);
FreeLibrary(hash_prov.prov.cng.dll);
- giterr_set(GITERR_OS, "algorithm handle could not be found");
+ git_error_set(GIT_ERROR_OS, "algorithm handle could not be found");
return -1;
}
@@ -86,7 +86,7 @@ GIT_INLINE(void) hash_cng_prov_shutdown(void)
GIT_INLINE(int) hash_cryptoapi_prov_init()
{
if (!CryptAcquireContext(&hash_prov.prov.cryptoapi.handle, NULL, 0, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT)) {
- giterr_set(GITERR_OS, "legacy hash context could not be started");
+ git_error_set(GIT_ERROR_OS, "legacy hash context could not be started");
return -1;
}
@@ -141,7 +141,7 @@ GIT_INLINE(int) hash_cryptoapi_init(git_hash_ctx *ctx)
if (!CryptCreateHash(ctx->prov->prov.cryptoapi.handle, CALG_SHA1, 0, 0, &ctx->ctx.cryptoapi.hash_handle)) {
ctx->ctx.cryptoapi.valid = 0;
- giterr_set(GITERR_OS, "legacy hash implementation could not be created");
+ git_error_set(GIT_ERROR_OS, "legacy hash implementation could not be created");
return -1;
}
@@ -159,7 +159,7 @@ GIT_INLINE(int) hash_cryptoapi_update(git_hash_ctx *ctx, const void *_data, size
DWORD chunk = (len > MAXDWORD) ? MAXDWORD : (DWORD)len;
if (!CryptHashData(ctx->ctx.cryptoapi.hash_handle, data, chunk, 0)) {
- giterr_set(GITERR_OS, "legacy hash data could not be updated");
+ git_error_set(GIT_ERROR_OS, "legacy hash data could not be updated");
return -1;
}
@@ -178,7 +178,7 @@ GIT_INLINE(int) hash_cryptoapi_final(git_oid *out, git_hash_ctx *ctx)
assert(ctx->ctx.cryptoapi.valid);
if (!CryptGetHashParam(ctx->ctx.cryptoapi.hash_handle, HP_HASHVAL, out->id, &len, 0)) {
- giterr_set(GITERR_OS, "legacy hash data could not be finished");
+ git_error_set(GIT_ERROR_OS, "legacy hash data could not be finished");
error = -1;
}
@@ -204,7 +204,7 @@ GIT_INLINE(int) hash_ctx_cng_init(git_hash_ctx *ctx)
if (hash_prov.prov.cng.create_hash(hash_prov.prov.cng.handle, &ctx->ctx.cng.hash_handle, ctx->ctx.cng.hash_object, hash_prov.prov.cng.hash_object_size, NULL, 0, 0) < 0) {
git__free(ctx->ctx.cng.hash_object);
- giterr_set(GITERR_OS, "hash implementation could not be created");
+ git_error_set(GIT_ERROR_OS, "hash implementation could not be created");
return -1;
}
@@ -223,7 +223,7 @@ GIT_INLINE(int) hash_cng_init(git_hash_ctx *ctx)
/* CNG needs to be finished to restart */
if (ctx->prov->prov.cng.finish_hash(ctx->ctx.cng.hash_handle, hash, GIT_OID_RAWSZ, 0) < 0) {
- giterr_set(GITERR_OS, "hash implementation could not be finished");
+ git_error_set(GIT_ERROR_OS, "hash implementation could not be finished");
return -1;
}
@@ -240,7 +240,7 @@ GIT_INLINE(int) hash_cng_update(git_hash_ctx *ctx, const void *_data, size_t len
ULONG chunk = (len > ULONG_MAX) ? ULONG_MAX : (ULONG)len;
if (ctx->prov->prov.cng.hash_data(ctx->ctx.cng.hash_handle, data, chunk, 0) < 0) {
- giterr_set(GITERR_OS, "hash could not be updated");
+ git_error_set(GIT_ERROR_OS, "hash could not be updated");
return -1;
}
@@ -254,7 +254,7 @@ GIT_INLINE(int) hash_cng_update(git_hash_ctx *ctx, const void *_data, size_t len
GIT_INLINE(int) hash_cng_final(git_oid *out, git_hash_ctx *ctx)
{
if (ctx->prov->prov.cng.finish_hash(ctx->ctx.cng.hash_handle, out->id, GIT_OID_RAWSZ, 0) < 0) {
- giterr_set(GITERR_OS, "hash could not be finished");
+ git_error_set(GIT_ERROR_OS, "hash could not be finished");
return -1;
}
diff --git a/src/hashsig.c b/src/hashsig.c
index 30d0594..abebd7a 100644
--- a/src/hashsig.c
+++ b/src/hashsig.c
@@ -216,7 +216,7 @@ static int hashsig_finalize_hashes(git_hashsig *sig)
{
if (sig->mins.size < HASHSIG_HEAP_MIN_SIZE &&
!(sig->opt & GIT_HASHSIG_ALLOW_SMALL_FILES)) {
- giterr_set(GITERR_INVALID,
+ git_error_set(GIT_ERROR_INVALID,
"file too small for similarity signature calculation");
return GIT_EBUFS;
}
@@ -249,7 +249,7 @@ int git_hashsig_create(
int error;
hashsig_in_progress prog;
git_hashsig *sig = hashsig_alloc(opts);
- GITERR_CHECK_ALLOC(sig);
+ GIT_ERROR_CHECK_ALLOC(sig);
hashsig_in_progress_init(&prog, sig);
@@ -276,7 +276,7 @@ int git_hashsig_create_fromfile(
int error = 0, fd;
hashsig_in_progress prog;
git_hashsig *sig = hashsig_alloc(opts);
- GITERR_CHECK_ALLOC(sig);
+ GIT_ERROR_CHECK_ALLOC(sig);
if ((fd = git_futils_open_ro(path)) < 0) {
git__free(sig);
@@ -288,7 +288,7 @@ int git_hashsig_create_fromfile(
while (!error) {
if ((buflen = p_read(fd, buf, sizeof(buf))) <= 0) {
if ((error = (int)buflen) < 0)
- giterr_set(GITERR_OS,
+ git_error_set(GIT_ERROR_OS,
"read error on '%s' calculating similarity hashes", path);
break;
}
diff --git a/src/idxmap.c b/src/idxmap.c
index edf8fff..3a5fc10 100644
--- a/src/idxmap.c
+++ b/src/idxmap.c
@@ -35,7 +35,7 @@ __KHASH_IMPL(idxicase, static kh_inline, const git_index_entry *, git_index_entr
int git_idxmap_alloc(git_idxmap **map)
{
if ((*map = kh_init(idx)) == NULL) {
- giterr_set_oom();
+ git_error_set_oom();
return -1;
}
@@ -45,7 +45,7 @@ int git_idxmap_alloc(git_idxmap **map)
int git_idxmap_icase_alloc(git_idxmap_icase **map)
{
if ((*map = kh_init(idxicase)) == NULL) {
- giterr_set_oom();
+ git_error_set_oom();
return -1;
}
diff --git a/src/ignore.c b/src/ignore.c
index e1d5fc9..c6e4da7 100644
--- a/src/ignore.c
+++ b/src/ignore.c
@@ -142,7 +142,7 @@ static int does_negate_rule(int *out, git_vector *rules, git_attr_fnmatch *match
goto out;
if ((error = p_fnmatch(git_buf_cstr(&buf), path, fnflags)) < 0) {
- giterr_set(GITERR_INVALID, "error matching pattern");
+ git_error_set(GIT_ERROR_INVALID, "error matching pattern");
goto out;
}
@@ -171,7 +171,7 @@ static int parse_ignore_file(
git_attr_fnmatch *match = NULL;
if (git_repository__cvar(&ignore_case, repo, GIT_CVAR_IGNORECASE) < 0)
- giterr_clear();
+ git_error_clear();
/* if subdir file path, convert context for file paths */
if (attrs->entry &&
@@ -180,7 +180,7 @@ static int parse_ignore_file(
context = attrs->entry->path;
if (git_mutex_lock(&attrs->lock) < 0) {
- giterr_set(GITERR_OS, "failed to lock ignore file");
+ git_error_set(GIT_ERROR_OS, "failed to lock ignore file");
return -1;
}
@@ -624,7 +624,7 @@ int git_ignore__check_pathspec_for_exact_ignores(
break;
if (ignored) {
- giterr_set(GITERR_INVALID, "pathspec contains ignored file '%s'",
+ git_error_set(GIT_ERROR_INVALID, "pathspec contains ignored file '%s'",
filename);
error = GIT_EINVALIDSPEC;
break;
diff --git a/src/index.c b/src/index.c
index e4f0338..677faea 100644
--- a/src/index.c
+++ b/src/index.c
@@ -408,7 +408,7 @@ int git_index_open(git_index **index_out, const char *index_path)
assert(index_out);
index = git__calloc(1, sizeof(git_index));
- GITERR_CHECK_ALLOC(index);
+ GIT_ERROR_CHECK_ALLOC(index);
git_pool_init(&index->tree_pool, 1);
@@ -550,7 +550,7 @@ int git_index_clear(git_index *index)
static int create_index_error(int error, const char *msg)
{
- giterr_set_str(GITERR_INDEX, msg);
+ git_error_set_str(GIT_ERROR_INDEX, msg);
return error;
}
@@ -616,7 +616,7 @@ static int compare_checksum(git_index *index)
if (p_lseek(fd, -20, SEEK_END) < 0) {
p_close(fd);
- giterr_set(GITERR_OS, "failed to seek to end of file");
+ git_error_set(GIT_ERROR_OS, "failed to seek to end of file");
return -1;
}
@@ -651,8 +651,8 @@ int git_index_read(git_index *index, int force)
if ((updated = git_futils_filestamp_check(&stamp, index->index_file_path) < 0) ||
((updated = compare_checksum(index)) < 0)) {
- giterr_set(
- GITERR_INDEX,
+ git_error_set(
+ GIT_ERROR_INDEX,
"failed to read index: '%s' no longer exists",
index->index_file_path);
return updated;
@@ -685,7 +685,7 @@ int git_index_read(git_index *index, int force)
int git_index_read_safely(git_index *index)
{
if (git_index__enforce_unsaved_safety && index->dirty) {
- giterr_set(GITERR_INDEX,
+ git_error_set(GIT_ERROR_INDEX,
"the index has unsaved changes that would be overwritten by this operation");
return GIT_EINDEXDIRTY;
}
@@ -698,7 +698,7 @@ int git_index__changed_relative_to(
{
/* attempt to update index (ignoring errors) */
if (git_index_read(index, false) < 0)
- giterr_clear();
+ git_error_clear();
return !!git_oid_cmp(&index->checksum, checksum);
}
@@ -781,7 +781,7 @@ int git_index_set_version(git_index *index, unsigned int version)
if (version < INDEX_VERSION_NUMBER_LB ||
version > INDEX_VERSION_NUMBER_UB) {
- giterr_set(GITERR_INDEX, "invalid version number");
+ git_error_set(GIT_ERROR_INDEX, "invalid version number");
return -1;
}
@@ -864,7 +864,7 @@ const git_index_entry *git_index_get_bypath(
if (git_idxmap_valid_index(index->entries_map, pos))
return git_idxmap_value_at(index->entries_map, pos);
- giterr_set(GITERR_INDEX, "index does not contain '%s'", path);
+ git_error_set(GIT_ERROR_INDEX, "index does not contain '%s'", path);
return NULL;
}
@@ -926,14 +926,14 @@ static int index_entry_create(
mode = st->st_mode;
if (!git_path_isvalid(repo, path, mode, path_valid_flags)) {
- giterr_set(GITERR_INDEX, "invalid path: '%s'", path);
+ git_error_set(GIT_ERROR_INDEX, "invalid path: '%s'", path);
return -1;
}
- GITERR_CHECK_ALLOC_ADD(&alloclen, sizeof(struct entry_internal), pathlen);
- GITERR_CHECK_ALLOC_ADD(&alloclen, alloclen, 1);
+ GIT_ERROR_CHECK_ALLOC_ADD(&alloclen, sizeof(struct entry_internal), pathlen);
+ GIT_ERROR_CHECK_ALLOC_ADD(&alloclen, alloclen, 1);
entry = git__calloc(1, alloclen);
- GITERR_CHECK_ALLOC(entry);
+ GIT_ERROR_CHECK_ALLOC(entry);
entry->pathlen = pathlen;
memcpy(entry->path, path, pathlen);
@@ -1030,7 +1030,7 @@ static int index_entry_reuc_init(git_index_reuc_entry **reuc_out,
assert(reuc_out && path);
*reuc_out = reuc = reuc_entry_alloc(path);
- GITERR_CHECK_ALLOC(reuc);
+ GIT_ERROR_CHECK_ALLOC(reuc);
if ((reuc->mode[0] = ancestor_mode) > 0) {
assert(ancestor_oid);
@@ -1177,7 +1177,7 @@ static int check_file_directory_collision(git_index *index,
{
if (has_file_name(index, entry, pos, ok_to_replace) < 0 ||
has_dir_name(index, entry, ok_to_replace) < 0) {
- giterr_set(GITERR_INDEX,
+ git_error_set(GIT_ERROR_INDEX,
"'%s' appears as both a file and a directory", entry->path);
return -1;
}
@@ -1259,7 +1259,7 @@ static int index_no_dups(void **old, void *new)
{
const git_index_entry *entry = new;
GIT_UNUSED(old);
- giterr_set(GITERR_INDEX, "'%s' appears multiple times at stage %d",
+ git_error_set(GIT_ERROR_INDEX, "'%s' appears multiple times at stage %d",
entry->path, GIT_INDEX_ENTRY_STAGE(entry));
return GIT_EEXISTS;
}
@@ -1469,7 +1469,7 @@ int git_index_add_frombuffer(
"Index is not backed up by an existing repository.");
if (!is_file_or_link(source_entry->mode)) {
- giterr_set(GITERR_INDEX, "invalid filemode");
+ git_error_set(GIT_ERROR_INDEX, "invalid filemode");
return -1;
}
@@ -1510,7 +1510,7 @@ static int add_repo_as_submodule(git_index_entry **out, git_index *index, const
return error;
if ((error = p_stat(abspath.ptr, &st)) < 0) {
- giterr_set(GITERR_OS, "failed to stat repository dir");
+ git_error_set(GIT_ERROR_OS, "failed to stat repository dir");
return -1;
}
@@ -1554,13 +1554,13 @@ int git_index_add_bypath(git_index *index, const char *path)
git_submodule *sm;
git_error_state err;
- giterr_state_capture(&err, ret);
+ git_error_state_capture(&err, ret);
ret = git_submodule_lookup(&sm, INDEX_OWNER(index), path);
if (ret == GIT_ENOTFOUND)
- return giterr_state_restore(&err);
+ return git_error_state_restore(&err);
- giterr_state_free(&err);
+ git_error_state_free(&err);
/*
* EEXISTS means that there is a repository at that path, but it's not known
@@ -1602,7 +1602,7 @@ int git_index_remove_bypath(git_index *index, const char *path)
return ret;
if (ret == GIT_ENOTFOUND)
- giterr_clear();
+ git_error_clear();
return 0;
}
@@ -1656,7 +1656,7 @@ int git_index_add(git_index *index, const git_index_entry *source_entry)
assert(index && source_entry && source_entry->path);
if (!valid_filemode(source_entry->mode)) {
- giterr_set(GITERR_INDEX, "invalid entry mode");
+ git_error_set(GIT_ERROR_INDEX, "invalid entry mode");
return -1;
}
@@ -1680,8 +1680,8 @@ int git_index_remove(git_index *index, const char *path, int stage)
DELETE_IN_MAP(index, &remove_key);
if (index_find(&position, index, path, 0, stage) < 0) {
- giterr_set(
- GITERR_INDEX, "index does not contain %s at stage %d", path, stage);
+ git_error_set(
+ GIT_ERROR_INDEX, "index does not contain %s at stage %d", path, stage);
error = GIT_ENOTFOUND;
} else {
error = index_remove_entry(index, position);
@@ -1753,7 +1753,7 @@ int git_index_find(size_t *at_pos, git_index *index, const char *path)
if (git_vector_bsearch2(
&pos, &index->entries, index->entries_search_path, path) < 0) {
- giterr_set(GITERR_INDEX, "index does not contain %s", path);
+ git_error_set(GIT_ERROR_INDEX, "index does not contain %s", path);
return GIT_ENOTFOUND;
}
@@ -1795,7 +1795,7 @@ int git_index_conflict_add(git_index *index,
/* Validate entries */
for (i = 0; i < 3; i++) {
if (entries[i] && !valid_filemode(entries[i]->mode)) {
- giterr_set(GITERR_INDEX, "invalid filemode for stage %d entry",
+ git_error_set(GIT_ERROR_INDEX, "invalid filemode for stage %d entry",
i + 1);
ret = -1;
goto on_error;
@@ -1811,7 +1811,7 @@ int git_index_conflict_add(git_index *index,
if (ret != GIT_ENOTFOUND)
goto on_error;
- giterr_clear();
+ git_error_clear();
ret = 0;
}
}
@@ -1981,7 +1981,7 @@ int git_index_iterator_new(
assert(iterator_out && index);
it = git__calloc(1, sizeof(git_index_iterator));
- GITERR_CHECK_ALLOC(it);
+ GIT_ERROR_CHECK_ALLOC(it);
if ((error = git_index_snapshot_new(&it->snap, index)) < 0) {
git__free(it);
@@ -2025,7 +2025,7 @@ int git_index_conflict_iterator_new(
assert(iterator_out && index);
it = git__calloc(1, sizeof(git_index_conflict_iterator));
- GITERR_CHECK_ALLOC(it);
+ GIT_ERROR_CHECK_ALLOC(it);
it->index = index;
@@ -2111,7 +2111,7 @@ int git_index_name_add(git_index *index,
assert((ancestor && ours) || (ancestor && theirs) || (ours && theirs));
conflict_name = git__calloc(1, sizeof(git_index_name_entry));
- GITERR_CHECK_ALLOC(conflict_name);
+ GIT_ERROR_CHECK_ALLOC(conflict_name);
if ((ancestor && !(conflict_name->ancestor = git__strdup(ancestor))) ||
(ours && !(conflict_name->ours = git__strdup(ours))) ||
@@ -2251,7 +2251,7 @@ void git_index_reuc_clear(git_index *index)
static int index_error_invalid(const char *message)
{
- giterr_set(GITERR_INDEX, "invalid data in index - %s", message);
+ git_error_set(GIT_ERROR_INDEX, "invalid data in index - %s", message);
return -1;
}
@@ -2274,7 +2274,7 @@ static int read_reuc(git_index *index, const char *buffer, size_t size)
return index_error_invalid("reading reuc entries");
lost = reuc_entry_alloc(buffer);
- GITERR_CHECK_ALLOC(lost);
+ GIT_ERROR_CHECK_ALLOC(lost);
size -= len;
buffer += len;
@@ -2347,7 +2347,7 @@ static int read_conflict_names(git_index *index, const char *buffer, size_t size
ptr = NULL; \
else { \
ptr = git__malloc(len); \
- GITERR_CHECK_ALLOC(ptr); \
+ GIT_ERROR_CHECK_ALLOC(ptr); \
memcpy(ptr, buffer, len); \
} \
\
@@ -2356,7 +2356,7 @@ static int read_conflict_names(git_index *index, const char *buffer, size_t size
while (size) {
git_index_name_entry *conflict_name = git__calloc(1, sizeof(git_index_name_entry));
- GITERR_CHECK_ALLOC(conflict_name);
+ GIT_ERROR_CHECK_ALLOC(conflict_name);
read_conflict_name(conflict_name->ancestor);
read_conflict_name(conflict_name->ours);
@@ -2478,14 +2478,14 @@ static int read_entry(
prefix_len = last_len - strip_len;
suffix_len = strlen(path_ptr + varint_len);
- GITERR_CHECK_ALLOC_ADD(&path_len, prefix_len, suffix_len);
- GITERR_CHECK_ALLOC_ADD(&path_len, path_len, 1);
+ GIT_ERROR_CHECK_ALLOC_ADD(&path_len, prefix_len, suffix_len);
+ GIT_ERROR_CHECK_ALLOC_ADD(&path_len, path_len, 1);
if (path_len > GIT_PATH_MAX)
return index_error_invalid("unreasonable path length");
tmp_path = git__malloc(path_len);
- GITERR_CHECK_ALLOC(tmp_path);
+ GIT_ERROR_CHECK_ALLOC(tmp_path);
memcpy(tmp_path, last, prefix_len);
memcpy(tmp_path + prefix_len, path_ptr + varint_len, suffix_len + 1);
@@ -3132,7 +3132,7 @@ int git_index_read_tree(git_index *index, const git_tree *tree)
INSERT_IN_MAP_EX(index, entries_map, e, &error);
if (error < 0) {
- giterr_set(GITERR_INDEX, "failed to insert entry into map");
+ git_error_set(GIT_ERROR_INDEX, "failed to insert entry into map");
return error;
}
}
@@ -3257,7 +3257,7 @@ static int git_index_read_iterator(
error = git_vector_insert(&remove_entries, remove_entry);
if (error < 0) {
- giterr_set(GITERR_INDEX, "failed to insert entry");
+ git_error_set(GIT_ERROR_INDEX, "failed to insert entry");
goto done;
}
@@ -3366,7 +3366,7 @@ int git_index_add_all(
error = index_apply_to_wd_diff(index, INDEX_ACTION_ADDALL, paths, flags, cb, payload);
if (error)
- giterr_set_after_callback(error);
+ git_error_set_after_callback(error);
cleanup:
git_iterator_free(wditer);
@@ -3468,7 +3468,7 @@ static int index_apply_to_wd_diff(git_index *index, int action, const git_strarr
git_diff_free(diff);
if (error) /* make sure error is set if callback stopped iteration */
- giterr_set_after_callback(error);
+ git_error_set_after_callback(error);
cleanup:
git_pathspec__clear(&ps);
@@ -3525,7 +3525,7 @@ static int index_apply_to_all(
error = git_index_add_bypath(index, path.ptr);
if (error == GIT_ENOTFOUND) {
- giterr_clear();
+ git_error_clear();
error = git_index_remove_bypath(index, path.ptr);
@@ -3538,7 +3538,7 @@ static int index_apply_to_all(
i--; /* back up foreach if we removed this */
break;
default:
- giterr_set(GITERR_INVALID, "unknown index action %d", action);
+ git_error_set(GIT_ERROR_INVALID, "unknown index action %d", action);
error = -1;
break;
}
@@ -3560,7 +3560,7 @@ int git_index_remove_all(
index, INDEX_ACTION_REMOVE, pathspec, cb, payload);
if (error) /* make sure error is set if callback stopped iteration */
- giterr_set_after_callback(error);
+ git_error_set_after_callback(error);
return error;
}
@@ -3573,7 +3573,7 @@ int git_index_update_all(
{
int error = index_apply_to_wd_diff(index, INDEX_ACTION_UPDATE, pathspec, 0, cb, payload);
if (error) /* make sure error is set if callback stopped iteration */
- giterr_set_after_callback(error);
+ git_error_set_after_callback(error);
return error;
}
@@ -3629,7 +3629,7 @@ int git_indexwriter_init(
&writer->file, index->index_file_path, GIT_FILEBUF_HASH_CONTENTS, GIT_INDEX_FILE_MODE)) < 0) {
if (error == GIT_ELOCKED)
- giterr_set(GITERR_INDEX, "the index is locked; this might be due to a concurrent or crashed process");
+ git_error_set(GIT_ERROR_INDEX, "the index is locked; this might be due to a concurrent or crashed process");
return error;
}
@@ -3678,7 +3678,7 @@ int git_indexwriter_commit(git_indexwriter *writer)
if ((error = git_futils_filestamp_check(
&writer->index->stamp, writer->index->index_file_path)) < 0) {
- giterr_set(GITERR_OS, "could not read index timestamp");
+ git_error_set(GIT_ERROR_OS, "could not read index timestamp");
return -1;
}
diff --git a/src/indexer.c b/src/indexer.c
index dd99904..27b7637 100644
--- a/src/indexer.c
+++ b/src/indexer.c
@@ -95,12 +95,12 @@ static int parse_header(struct git_pack_header *hdr, struct git_pack_file *pack)
/* Verify we recognize this pack file format. */
if (hdr->hdr_signature != ntohl(PACK_SIGNATURE)) {
- giterr_set(GITERR_INDEXER, "wrong pack signature");
+ git_error_set(GIT_ERROR_INDEXER, "wrong pack signature");
return -1;
}
if (!pack_version_ok(hdr->hdr_version)) {
- giterr_set(GITERR_INDEXER, "wrong pack version");
+ git_error_set(GIT_ERROR_INDEXER, "wrong pack version");
return -1;
}
@@ -139,7 +139,7 @@ int git_indexer_new(
memcpy(&opts, in_opts, sizeof(opts));
idx = git__calloc(1, sizeof(git_indexer));
- GITERR_CHECK_ALLOC(idx);
+ GIT_ERROR_CHECK_ALLOC(idx);
idx->odb = odb;
idx->progress_cb = opts.progress_cb;
idx->progress_payload = opts.progress_cb_payload;
@@ -148,7 +148,7 @@ int git_indexer_new(
git_hash_ctx_init(&idx->trailer);
git_buf_init(&idx->entry_data, 0);
idx->expected_oids = git_oidmap_alloc();
- GITERR_CHECK_ALLOC(idx->expected_oids);
+ GIT_ERROR_CHECK_ALLOC(idx->expected_oids);
idx->do_verify = opts.verify;
@@ -204,7 +204,7 @@ static int store_delta(git_indexer *idx)
struct delta_info *delta;
delta = git__calloc(1, sizeof(struct delta_info));
- GITERR_CHECK_ALLOC(delta);
+ GIT_ERROR_CHECK_ALLOC(delta);
delta->delta_off = idx->entry_start;
if (git_vector_insert(&idx->deltas, delta) < 0)
@@ -410,10 +410,10 @@ static int store_object(git_indexer *idx)
git_off_t entry_start = idx->entry_start;
entry = git__calloc(1, sizeof(*entry));
- GITERR_CHECK_ALLOC(entry);
+ GIT_ERROR_CHECK_ALLOC(entry);
pentry = git__calloc(1, sizeof(struct git_pack_entry));
- GITERR_CHECK_ALLOC(pentry);
+ GIT_ERROR_CHECK_ALLOC(pentry);
git_hash_final(&oid, &idx->hash_ctx);
entry_size = idx->off - entry_start;
@@ -441,12 +441,12 @@ static int store_object(git_indexer *idx)
k = git_oidmap_put(idx->pack->idx_cache, &pentry->sha1, &error);
if (error == -1) {
git__free(pentry);
- giterr_set_oom();
+ git_error_set_oom();
goto on_error;
}
if (error == 0) {
- giterr_set(GITERR_INDEXER, "duplicate object %s found in pack", git_oid_tostr_s(&pentry->sha1));
+ git_error_set(GIT_ERROR_INDEXER, "duplicate object %s found in pack", git_oid_tostr_s(&pentry->sha1));
git__free(pentry);
goto on_error;
}
@@ -496,7 +496,7 @@ static int save_entry(git_indexer *idx, struct entry *entry, struct git_pack_ent
k = git_oidmap_put(idx->pack->idx_cache, &pentry->sha1, &error);
if (error <= 0) {
- giterr_set(GITERR_INDEXER, "cannot insert object into pack");
+ git_error_set(GIT_ERROR_INDEXER, "cannot insert object into pack");
return -1;
}
@@ -521,15 +521,15 @@ static int hash_and_save(git_indexer *idx, git_rawobj *obj, git_off_t entry_star
struct git_pack_entry *pentry = NULL;
entry = git__calloc(1, sizeof(*entry));
- GITERR_CHECK_ALLOC(entry);
+ GIT_ERROR_CHECK_ALLOC(entry);
if (git_odb__hashobj(&oid, obj) < 0) {
- giterr_set(GITERR_INDEXER, "failed to hash object");
+ git_error_set(GIT_ERROR_INDEXER, "failed to hash object");
goto on_error;
}
pentry = git__calloc(1, sizeof(struct git_pack_entry));
- GITERR_CHECK_ALLOC(pentry);
+ GIT_ERROR_CHECK_ALLOC(pentry);
git_oid_cpy(&pentry->sha1, &oid);
git_oid_cpy(&entry->oid, &oid);
@@ -551,7 +551,7 @@ on_error:
static int do_progress_callback(git_indexer *idx, git_transfer_progress *stats)
{
if (idx->progress_cb)
- return giterr_set_after_callback_function(
+ return git_error_set_after_callback_function(
idx->progress_cb(stats, idx->progress_payload),
"indexer progress");
return 0;
@@ -649,7 +649,7 @@ static int append_to_pack(git_indexer *idx, const void *data, size_t size)
if (p_lseek(fd, page_start + mmap_alignment - 1, SEEK_SET) < 0 ||
p_write(idx->pack->mwf.fd, data, 1) < 0) {
- giterr_set(GITERR_OS, "cannot extend packfile '%s'", idx->pack->pack_name);
+ git_error_set(GIT_ERROR_OS, "cannot extend packfile '%s'", idx->pack->pack_name);
return -1;
}
@@ -777,12 +777,12 @@ int git_indexer_append(git_indexer *idx, const void *data, size_t size, git_tran
if (idx->nr_objects <= git_indexer__max_objects) {
total_objects = (unsigned int)idx->nr_objects;
} else {
- giterr_set(GITERR_INDEXER, "too many objects");
+ git_error_set(GIT_ERROR_INDEXER, "too many objects");
return -1;
}
idx->pack->idx_cache = git_oidmap_alloc();
- GITERR_CHECK_ALLOC(idx->pack->idx_cache);
+ GIT_ERROR_CHECK_ALLOC(idx->pack->idx_cache);
idx->pack->has_cache = 1;
if (git_vector_init(&idx->objects, total_objects, objects_cmp) < 0)
@@ -872,7 +872,7 @@ static int inject_object(git_indexer *idx, git_oid *id)
entry_start = idx->pack->mwf.size;
if (git_odb_read(&obj, idx->odb, id) < 0) {
- giterr_set(GITERR_INDEXER, "missing delta bases");
+ git_error_set(GIT_ERROR_INDEXER, "missing delta bases");
return -1;
}
@@ -880,7 +880,7 @@ static int inject_object(git_indexer *idx, git_oid *id)
len = git_odb_object_size(obj);
entry = git__calloc(1, sizeof(*entry));
- GITERR_CHECK_ALLOC(entry);
+ GIT_ERROR_CHECK_ALLOC(entry);
entry->crc = crc32(0L, Z_NULL, 0);
@@ -911,7 +911,7 @@ static int inject_object(git_indexer *idx, git_oid *id)
idx->pack->mwf.size += GIT_OID_RAWSZ;
pentry = git__calloc(1, sizeof(struct git_pack_entry));
- GITERR_CHECK_ALLOC(pentry);
+ GIT_ERROR_CHECK_ALLOC(pentry);
git_oid_cpy(&pentry->sha1, id);
git_oid_cpy(&entry->oid, id);
@@ -945,7 +945,7 @@ static int fix_thin_pack(git_indexer *idx, git_transfer_progress *stats)
assert(git_vector_length(&idx->deltas) > 0);
if (idx->odb == NULL) {
- giterr_set(GITERR_INDEXER, "cannot fix a thin pack without an ODB");
+ git_error_set(GIT_ERROR_INDEXER, "cannot fix a thin pack without an ODB");
return -1;
}
@@ -966,14 +966,14 @@ static int fix_thin_pack(git_indexer *idx, git_transfer_progress *stats)
}
if (!found_ref_delta) {
- giterr_set(GITERR_INDEXER, "no REF_DELTA found, cannot inject object");
+ git_error_set(GIT_ERROR_INDEXER, "no REF_DELTA found, cannot inject object");
return -1;
}
/* curpos now points to the base information, which is an OID */
base_info = git_mwindow_open(&idx->pack->mwf, &w, curpos, GIT_OID_RAWSZ, &left);
if (base_info == NULL) {
- giterr_set(GITERR_INDEXER, "failed to map delta information");
+ git_error_set(GIT_ERROR_INDEXER, "failed to map delta information");
return -1;
}
@@ -1102,17 +1102,17 @@ int git_indexer_commit(git_indexer *idx, git_transfer_progress *stats)
void *packfile_trailer;
if (!idx->parsed_header) {
- giterr_set(GITERR_INDEXER, "incomplete pack header");
+ git_error_set(GIT_ERROR_INDEXER, "incomplete pack header");
return -1;
}
/* Test for this before resolve_deltas(), as it plays with idx->off */
if (idx->off + 20 < idx->pack->mwf.size) {
- giterr_set(GITERR_INDEXER, "unexpected data at the end of the pack");
+ git_error_set(GIT_ERROR_INDEXER, "unexpected data at the end of the pack");
return -1;
}
if (idx->off + 20 > idx->pack->mwf.size) {
- giterr_set(GITERR_INDEXER, "missing trailer at the end of the pack");
+ git_error_set(GIT_ERROR_INDEXER, "missing trailer at the end of the pack");
return -1;
}
@@ -1128,7 +1128,7 @@ int git_indexer_commit(git_indexer *idx, git_transfer_progress *stats)
git_hash_final(&trailer_hash, &idx->trailer);
if (git_oid_cmp(&file_hash, &trailer_hash)) {
- giterr_set(GITERR_INDEXER, "packfile trailer mismatch");
+ git_error_set(GIT_ERROR_INDEXER, "packfile trailer mismatch");
return -1;
}
@@ -1139,7 +1139,7 @@ int git_indexer_commit(git_indexer *idx, git_transfer_progress *stats)
return error;
if (stats->indexed_objects != stats->total_objects) {
- giterr_set(GITERR_INDEXER, "early EOF");
+ git_error_set(GIT_ERROR_INDEXER, "early EOF");
return -1;
}
@@ -1158,7 +1158,7 @@ int git_indexer_commit(git_indexer *idx, git_transfer_progress *stats)
* packfile.
*/
if (git_oidmap_size(idx->expected_oids) > 0) {
- giterr_set(GITERR_INDEXER, "packfile is missing %"PRIuZ" objects",
+ git_error_set(GIT_ERROR_INDEXER, "packfile is missing %"PRIuZ" objects",
git_oidmap_size(idx->expected_oids));
return -1;
}
@@ -1249,18 +1249,18 @@ int git_indexer_commit(git_indexer *idx, git_transfer_progress *stats)
/* Truncate file to undo rounding up to next page_size in append_to_pack */
if (p_ftruncate(idx->pack->mwf.fd, idx->pack->mwf.size) < 0) {
- giterr_set(GITERR_OS, "failed to truncate pack file '%s'", idx->pack->pack_name);
+ git_error_set(GIT_ERROR_OS, "failed to truncate pack file '%s'", idx->pack->pack_name);
return -1;
}
if (idx->do_fsync && p_fsync(idx->pack->mwf.fd) < 0) {
- giterr_set(GITERR_OS, "failed to fsync packfile");
+ git_error_set(GIT_ERROR_OS, "failed to fsync packfile");
goto on_error;
}
/* We need to close the descriptor here so Windows doesn't choke on commit_at */
if (p_close(idx->pack->mwf.fd) < 0) {
- giterr_set(GITERR_OS, "failed to close packfile");
+ git_error_set(GIT_ERROR_OS, "failed to close packfile");
goto on_error;
}
diff --git a/src/iterator.c b/src/iterator.c
index b12c8ff..90bbb81 100644
--- a/src/iterator.c
+++ b/src/iterator.c
@@ -46,14 +46,14 @@ static int iterator_range_init(
{
if (start && *start) {
iter->start = git__strdup(start);
- GITERR_CHECK_ALLOC(iter->start);
+ GIT_ERROR_CHECK_ALLOC(iter->start);
iter->start_len = strlen(iter->start);
}
if (end && *end) {
iter->end = git__strdup(end);
- GITERR_CHECK_ALLOC(iter->end);
+ GIT_ERROR_CHECK_ALLOC(iter->end);
iter->end_len = strlen(iter->end);
}
@@ -146,7 +146,7 @@ static int iterator_init_common(
(iter->flags & GIT_ITERATOR_DONT_PRECOMPOSE_UNICODE) == 0) {
if (git_repository__cvar(&precompose, repo, GIT_CVAR_PRECOMPOSE) < 0)
- giterr_clear();
+ git_error_clear();
else if (precompose)
iter->flags |= GIT_ITERATOR_PRECOMPOSE_UNICODE;
}
@@ -403,7 +403,7 @@ int git_iterator_for_nothing(
*out = NULL;
iter = git__calloc(1, sizeof(empty_iterator));
- GITERR_CHECK_ALLOC(iter);
+ GIT_ERROR_CHECK_ALLOC(iter);
iter->base.type = GIT_ITERATOR_TYPE_EMPTY;
iter->base.cb = &callbacks;
@@ -541,7 +541,7 @@ static int tree_iterator_frame_init(
int error = 0;
new_frame = git_array_alloc(iter->frames);
- GITERR_CHECK_ALLOC(new_frame);
+ GIT_ERROR_CHECK_ALLOC(new_frame);
memset(new_frame, 0, sizeof(tree_iterator_frame));
@@ -564,7 +564,7 @@ static int tree_iterator_frame_init(
git_array_foreach(dup->entries, i, tree_entry) {
new_entry = git_pool_malloc(&iter->entry_pool, 1);
- GITERR_CHECK_ALLOC(new_entry);
+ GIT_ERROR_CHECK_ALLOC(new_entry);
new_entry->tree_entry = tree_entry;
new_entry->parent_path = new_frame->path.ptr;
@@ -618,20 +618,20 @@ GIT_INLINE(int) tree_iterator_frame_push_neighbors(
break;
path = git_array_alloc(parent_frame->similar_paths);
- GITERR_CHECK_ALLOC(path);
+ GIT_ERROR_CHECK_ALLOC(path);
memset(path, 0, sizeof(git_buf));
if ((error = tree_iterator_compute_path(path, entry)) < 0)
break;
- GITERR_CHECK_ALLOC_ADD(&new_size,
+ GIT_ERROR_CHECK_ALLOC_ADD(&new_size,
frame->entries.length, tree->entries.size);
git_vector_size_hint(&frame->entries, new_size);
git_array_foreach(tree->entries, i, tree_entry) {
new_entry = git_pool_malloc(&iter->entry_pool, 1);
- GITERR_CHECK_ALLOC(new_entry);
+ GIT_ERROR_CHECK_ALLOC(new_entry);
new_entry->tree_entry = tree_entry;
new_entry->parent_path = path->ptr;
@@ -947,7 +947,7 @@ int git_iterator_for_tree(
return git_iterator_for_nothing(out, options);
iter = git__calloc(1, sizeof(tree_iterator));
- GITERR_CHECK_ALLOC(iter);
+ GIT_ERROR_CHECK_ALLOC(iter);
iter->base.type = GIT_ITERATOR_TYPE_TREE;
iter->base.cb = &callbacks;
@@ -1143,7 +1143,7 @@ static void filesystem_iterator_frame_push_ignores(
if (git_ignore__lookup(&new_frame->is_ignored,
&iter->ignores, path, GIT_DIR_FLAG_TRUE) < 0) {
- giterr_clear();
+ git_error_clear();
new_frame->is_ignored = GIT_IGNORE_NOTFOUND;
}
@@ -1299,12 +1299,12 @@ static int filesystem_iterator_entry_init(
/* Make sure to append two bytes, one for the path's null
* termination, one for a possible trailing '/' for folders.
*/
- GITERR_CHECK_ALLOC_ADD(&entry_size,
+ GIT_ERROR_CHECK_ALLOC_ADD(&entry_size,
sizeof(filesystem_iterator_entry), path_len);
- GITERR_CHECK_ALLOC_ADD(&entry_size, entry_size, 2);
+ GIT_ERROR_CHECK_ALLOC_ADD(&entry_size, entry_size, 2);
entry = git_pool_malloc(&frame->entry_pool, entry_size);
- GITERR_CHECK_ALLOC(entry);
+ GIT_ERROR_CHECK_ALLOC(entry);
entry->path_len = path_len;
entry->match = pathlist_match;
@@ -1340,13 +1340,13 @@ static int filesystem_iterator_frame_push(
int error;
if (iter->frames.size == FILESYSTEM_MAX_DEPTH) {
- giterr_set(GITERR_REPOSITORY,
+ git_error_set(GIT_ERROR_REPOSITORY,
"directory nesting too deep (%"PRIuZ")", iter->frames.size);
return -1;
}
new_frame = git_array_alloc(iter->frames);
- GITERR_CHECK_ALLOC(new_frame);
+ GIT_ERROR_CHECK_ALLOC(new_frame);
memset(new_frame, 0, sizeof(filesystem_iterator_frame));
@@ -1695,7 +1695,7 @@ static void filesystem_iterator_update_ignored(filesystem_iterator *iter)
if (git_ignore__lookup(&iter->current_is_ignored,
&iter->ignores, iter->entry.path, dir_flag) < 0) {
- giterr_clear();
+ git_error_clear();
iter->current_is_ignored = GIT_IGNORE_NOTFOUND;
}
@@ -1904,7 +1904,7 @@ static int iterator_for_filesystem(
return git_iterator_for_nothing(out, options);
iter = git__calloc(1, sizeof(filesystem_iterator));
- GITERR_CHECK_ALLOC(iter);
+ GIT_ERROR_CHECK_ALLOC(iter);
iter->base.type = type;
iter->base.cb = &callbacks;
@@ -1912,7 +1912,7 @@ static int iterator_for_filesystem(
root_len = strlen(root);
iter->root = git__malloc(root_len+2);
- GITERR_CHECK_ALLOC(iter->root);
+ GIT_ERROR_CHECK_ALLOC(iter->root);
memcpy(iter->root, root, root_len);
@@ -2234,7 +2234,7 @@ int git_iterator_for_index(
return git_iterator_for_nothing(out, options);
iter = git__calloc(1, sizeof(index_iterator));
- GITERR_CHECK_ALLOC(iter);
+ GIT_ERROR_CHECK_ALLOC(iter);
iter->base.type = GIT_ITERATOR_TYPE_INDEX;
iter->base.cb = &callbacks;
@@ -2334,8 +2334,8 @@ int git_iterator_walk(
iterator_item = git__calloc(cnt, sizeof(git_index_entry *));
cur_items = git__calloc(cnt, sizeof(git_index_entry *));
- GITERR_CHECK_ALLOC(iterator_item);
- GITERR_CHECK_ALLOC(cur_items);
+ GIT_ERROR_CHECK_ALLOC(iterator_item);
+ GIT_ERROR_CHECK_ALLOC(cur_items);
/* Set up the iterators */
for (i = 0; i < cnt; i++) {
diff --git a/src/mailmap.c b/src/mailmap.c
index ba4d4ce..409cdbd 100644
--- a/src/mailmap.c
+++ b/src/mailmap.c
@@ -149,7 +149,7 @@ int git_mailmap_new(git_mailmap **out)
{
int error;
git_mailmap *mm = git__calloc(1, sizeof(git_mailmap));
- GITERR_CHECK_ALLOC(mm);
+ GIT_ERROR_CHECK_ALLOC(mm);
error = git_vector_init(&mm->entries, 0, mailmap_entry_cmp);
if (error < 0) {
@@ -183,24 +183,24 @@ static int mailmap_add_entry_unterminated(
{
int error;
git_mailmap_entry *entry = git__calloc(1, sizeof(git_mailmap_entry));
- GITERR_CHECK_ALLOC(entry);
+ GIT_ERROR_CHECK_ALLOC(entry);
assert(mm && replace_email && *replace_email);
if (real_name_size > 0) {
entry->real_name = git__substrdup(real_name, real_name_size);
- GITERR_CHECK_ALLOC(entry->real_name);
+ GIT_ERROR_CHECK_ALLOC(entry->real_name);
}
if (real_email_size > 0) {
entry->real_email = git__substrdup(real_email, real_email_size);
- GITERR_CHECK_ALLOC(entry->real_email);
+ GIT_ERROR_CHECK_ALLOC(entry->real_email);
}
if (replace_name_size > 0) {
entry->replace_name = git__substrdup(replace_name, replace_name_size);
- GITERR_CHECK_ALLOC(entry->replace_name);
+ GIT_ERROR_CHECK_ALLOC(entry->replace_name);
}
entry->replace_email = git__substrdup(replace_email, replace_email_size);
- GITERR_CHECK_ALLOC(entry->replace_email);
+ GIT_ERROR_CHECK_ALLOC(entry->replace_email);
error = git_vector_insert_sorted(&mm->entries, entry, mailmap_entry_replace);
if (error == GIT_EEXISTS)
diff --git a/src/merge.c b/src/merge.c
index 754b089..14b76fa 100644
--- a/src/merge.c
+++ b/src/merge.c
@@ -80,7 +80,7 @@ int merge_bases_many(git_commit_list **out, git_revwalk **walk_out, git_reposito
unsigned int i;
if (length < 2) {
- giterr_set(GITERR_INVALID, "at least two commits are required to find an ancestor");
+ git_error_set(GIT_ERROR_INVALID, "at least two commits are required to find an ancestor");
return -1;
}
@@ -106,7 +106,7 @@ int merge_bases_many(git_commit_list **out, git_revwalk **walk_out, git_reposito
goto on_error;
if (!result) {
- giterr_set(GITERR_MERGE, "no merge base found");
+ git_error_set(GIT_ERROR_MERGE, "no merge base found");
error = GIT_ENOTFOUND;
goto on_error;
}
@@ -186,7 +186,7 @@ int git_merge_base_octopus(git_oid *out, git_repository *repo, size_t length, co
assert(out && repo && input_array);
if (length < 2) {
- giterr_set(GITERR_INVALID, "at least two commits are required to find an ancestor");
+ git_error_set(GIT_ERROR_INVALID, "at least two commits are required to find an ancestor");
return -1;
}
@@ -232,7 +232,7 @@ static int merge_bases(git_commit_list **out, git_revwalk **walk_out, git_reposi
if (!result) {
git_revwalk_free(walk);
- giterr_set(GITERR_MERGE, "no merge base found");
+ git_error_set(GIT_ERROR_MERGE, "no merge base found");
return GIT_ENOTFOUND;
}
@@ -426,9 +426,9 @@ static int remove_redundant(git_revwalk *walk, git_vector *commits)
int error = 0;
redundant = git__calloc(commits->length, 1);
- GITERR_CHECK_ALLOC(redundant);
+ GIT_ERROR_CHECK_ALLOC(redundant);
filled_index = git__calloc((commits->length - 1), sizeof(unsigned int));
- GITERR_CHECK_ALLOC(filled_index);
+ GIT_ERROR_CHECK_ALLOC(filled_index);
for (i = 0; i < commits->length; ++i) {
if ((error = git_commit_list_parse(walk, commits->contents[i])) < 0)
@@ -576,7 +576,7 @@ int git_repository_mergehead_foreach(
while ((line = git__strsep(&buffer, "\n")) != NULL) {
if (strlen(line) != GIT_OID_HEXSZ) {
- giterr_set(GITERR_INVALID, "unable to parse OID - invalid length");
+ git_error_set(GIT_ERROR_INVALID, "unable to parse OID - invalid length");
error = -1;
goto cleanup;
}
@@ -585,7 +585,7 @@ int git_repository_mergehead_foreach(
goto cleanup;
if ((error = cb(&oid, payload)) != 0) {
- giterr_set_after_callback(error);
+ git_error_set_after_callback(error);
goto cleanup;
}
@@ -593,7 +593,7 @@ int git_repository_mergehead_foreach(
}
if (*buffer) {
- giterr_set(GITERR_MERGE, "no EOL at line %"PRIuZ, line_num);
+ git_error_set(GIT_ERROR_MERGE, "no EOL at line %"PRIuZ, line_num);
error = -1;
goto cleanup;
}
@@ -863,14 +863,14 @@ static int merge_conflict_invoke_driver(
goto done;
result = git_pool_mallocz(&diff_list->pool, sizeof(git_index_entry));
- GITERR_CHECK_ALLOC(result);
+ GIT_ERROR_CHECK_ALLOC(result);
git_oid_cpy(&result->id, &oid);
result->mode = mode;
result->file_size = buf.size;
result->path = git_pool_strdup(&diff_list->pool, path);
- GITERR_CHECK_ALLOC(result->path);
+ GIT_ERROR_CHECK_ALLOC(result->path);
*out = result;
@@ -1113,7 +1113,7 @@ static int deletes_by_oid_enqueue(git_oidmap *map, git_pool* pool, const git_oid
pos = git_oidmap_lookup_index(map, id);
if (!git_oidmap_valid_index(map, pos)) {
queue = git_pool_malloc(pool, sizeof(deletes_by_oid_queue));
- GITERR_CHECK_ALLOC(queue);
+ GIT_ERROR_CHECK_ALLOC(queue);
git_array_init(queue->arr);
queue->next_pos = 0;
@@ -1125,7 +1125,7 @@ static int deletes_by_oid_enqueue(git_oidmap *map, git_pool* pool, const git_oid
} else {
queue = git_oidmap_value_at(map, pos);
array_entry = git_array_alloc(queue->arr);
- GITERR_CHECK_ALLOC(array_entry);
+ GIT_ERROR_CHECK_ALLOC(array_entry);
*array_entry = idx;
}
@@ -1510,11 +1510,11 @@ int git_merge_diff_list__find_renames(
similarity_ours = git__calloc(diff_list->conflicts.length,
sizeof(struct merge_diff_similarity));
- GITERR_CHECK_ALLOC(similarity_ours);
+ GIT_ERROR_CHECK_ALLOC(similarity_ours);
similarity_theirs = git__calloc(diff_list->conflicts.length,
sizeof(struct merge_diff_similarity));
- GITERR_CHECK_ALLOC(similarity_theirs);
+ GIT_ERROR_CHECK_ALLOC(similarity_theirs);
/* Calculate similarity between items that were deleted from the ancestor
* and added in the other branch.
@@ -1523,9 +1523,9 @@ int git_merge_diff_list__find_renames(
goto done;
if (opts->rename_threshold < 100 && diff_list->conflicts.length <= opts->target_limit) {
- GITERR_CHECK_ALLOC_MULTIPLY(&cache_size, diff_list->conflicts.length, 3);
+ GIT_ERROR_CHECK_ALLOC_MULTIPLY(&cache_size, diff_list->conflicts.length, 3);
cache = git__calloc(cache_size, sizeof(void *));
- GITERR_CHECK_ALLOC(cache);
+ GIT_ERROR_CHECK_ALLOC(cache);
merge_diff_list_count_candidates(diff_list, &src_count, &tgt_count);
@@ -1739,7 +1739,7 @@ static int merge_diff_list_insert_unmodified(
git_index_entry *entry;
entry = git_pool_malloc(&diff_list->pool, sizeof(git_index_entry));
- GITERR_CHECK_ALLOC(entry);
+ GIT_ERROR_CHECK_ALLOC(entry);
if ((error = index_entry_dup_pool(entry, &diff_list->pool, tree_items[0])) >= 0)
error = git_vector_insert(&diff_list->staged, entry);
@@ -1846,13 +1846,13 @@ static int merge_normalize_opts(
if (given && given->default_driver) {
opts->default_driver = git__strdup(given->default_driver);
- GITERR_CHECK_ALLOC(opts->default_driver);
+ GIT_ERROR_CHECK_ALLOC(opts->default_driver);
} else {
error = git_config_get_entry(&entry, cfg, "merge.default");
if (error == 0) {
opts->default_driver = git__strdup(entry->value);
- GITERR_CHECK_ALLOC(opts->default_driver);
+ GIT_ERROR_CHECK_ALLOC(opts->default_driver);
} else if (error == GIT_ENOTFOUND) {
error = 0;
} else {
@@ -1873,7 +1873,7 @@ static int merge_normalize_opts(
/* 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);
+ GIT_ERROR_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;
@@ -2060,7 +2060,7 @@ int git_merge__iterators(
*out = NULL;
- GITERR_CHECK_VERSION(
+ GIT_ERROR_CHECK_VERSION(
given_opts, GIT_MERGE_OPTIONS_VERSION, "git_merge_options");
if ((error = merge_normalize_opts(repo, &opts, given_opts)) < 0)
@@ -2079,7 +2079,7 @@ int git_merge__iterators(
}
diff_list = git_merge_diff_list__alloc(repo);
- GITERR_CHECK_ALLOC(diff_list);
+ GIT_ERROR_CHECK_ALLOC(diff_list);
ancestor_iter = iterator_given_or_empty(&empty_ancestor, ancestor_iter);
our_iter = iterator_given_or_empty(&empty_ours, our_iter);
@@ -2102,7 +2102,7 @@ int git_merge__iterators(
if (!resolved) {
if ((opts.flags & GIT_MERGE_FAIL_ON_CONFLICT)) {
- giterr_set(GITERR_MERGE, "merge conflicts exist");
+ git_error_set(GIT_ERROR_MERGE, "merge conflicts exist");
error = GIT_EMERGECONFLICT;
goto done;
}
@@ -2199,13 +2199,13 @@ GIT_INLINE(int) insert_head_ids(
if (annotated_commit->type == GIT_ANNOTATED_COMMIT_REAL) {
id = git_array_alloc(*ids);
- GITERR_CHECK_ALLOC(id);
+ GIT_ERROR_CHECK_ALLOC(id);
git_oid_cpy(id, git_commit_id(annotated_commit->commit));
} else {
for (i = 0; i < annotated_commit->parents.size; i++) {
id = git_array_alloc(*ids);
- GITERR_CHECK_ALLOC(id);
+ GIT_ERROR_CHECK_ALLOC(id);
git_oid_cpy(id, &annotated_commit->parents.ptr[i]);
}
@@ -2240,7 +2240,7 @@ static int create_virtual_base(
return -1;
result = git__calloc(1, sizeof(git_annotated_commit));
- GITERR_CHECK_ALLOC(result);
+ GIT_ERROR_CHECK_ALLOC(result);
result->type = GIT_ANNOTATED_COMMIT_VIRTUAL;
result->index = index;
@@ -2368,7 +2368,7 @@ static int merge_annotated_commits(
if (error != GIT_ENOTFOUND)
goto done;
- giterr_clear();
+ git_error_clear();
}
if ((error = iterator_for_annotated_commit(&base_iter, base)) < 0 ||
@@ -2678,7 +2678,7 @@ static int write_merge_msg(
assert(repo && heads);
entries = git__calloc(heads_len, sizeof(struct merge_msg_entry));
- GITERR_CHECK_ALLOC(entries);
+ GIT_ERROR_CHECK_ALLOC(entries);
if (git_vector_init(&matching, heads_len, NULL) < 0) {
git__free(entries);
@@ -2812,9 +2812,9 @@ static int merge_ancestor_head(
assert(repo && our_head && their_heads);
- GITERR_CHECK_ALLOC_ADD(&alloc_len, their_heads_len, 1);
+ GIT_ERROR_CHECK_ALLOC_ADD(&alloc_len, their_heads_len, 1);
oids = git__calloc(alloc_len, sizeof(git_oid));
- GITERR_CHECK_ALLOC(oids);
+ GIT_ERROR_CHECK_ALLOC(oids);
git_oid_cpy(&oids[0], git_commit_id(our_head->commit));
@@ -3038,7 +3038,7 @@ int git_merge__check_result(git_repository *repo, git_index *index_new)
goto done;
if ((conflicts = index_conflicts + wd_conflicts) > 0) {
- giterr_set(GITERR_MERGE, "%" PRIuZ " uncommitted change%s would be overwritten by merge",
+ git_error_set(GIT_ERROR_MERGE, "%" PRIuZ " uncommitted change%s would be overwritten by merge",
conflicts, (conflicts != 1) ? "s" : "");
error = GIT_ECONFLICT;
}
@@ -3130,7 +3130,7 @@ static int merge_heads(
if (error != GIT_ENOTFOUND)
goto done;
- giterr_clear();
+ git_error_clear();
error = 0;
}
@@ -3159,7 +3159,7 @@ static int merge_preference(git_merge_preference_t *out, git_repository *repo)
if ((error = git_config_get_string(&value, config, "merge.ff")) < 0) {
if (error == GIT_ENOTFOUND) {
- giterr_clear();
+ git_error_clear();
error = 0;
}
@@ -3194,7 +3194,7 @@ int git_merge_analysis_for_ref(
assert(analysis_out && preference_out && repo && their_heads && their_heads_len > 0);
if (their_heads_len != 1) {
- giterr_set(GITERR_MERGE, "can only merge a single branch");
+ git_error_set(GIT_ERROR_MERGE, "can only merge a single branch");
error = -1;
goto done;
}
@@ -3247,7 +3247,7 @@ int git_merge_analysis(
int error = 0;
if ((error = git_reference_lookup(&head_ref, repo, GIT_HEAD_FILE)) < 0) {
- giterr_set(GITERR_MERGE, "failed to lookup HEAD reference");
+ git_error_set(GIT_ERROR_MERGE, "failed to lookup HEAD reference");
return error;
}
@@ -3276,7 +3276,7 @@ int git_merge(
assert(repo && their_heads && their_heads_len > 0);
if (their_heads_len != 1) {
- giterr_set(GITERR_MERGE, "can only merge a single branch");
+ git_error_set(GIT_ERROR_MERGE, "can only merge a single branch");
return -1;
}
diff --git a/src/merge_driver.c b/src/merge_driver.c
index ea4bd27..8b7e355 100644
--- a/src/merge_driver.c
+++ b/src/merge_driver.c
@@ -181,7 +181,7 @@ static int merge_driver_registry_insert(
git_merge_driver_entry *entry;
entry = git__calloc(1, sizeof(git_merge_driver_entry) + strlen(name) + 1);
- GITERR_CHECK_ALLOC(entry);
+ GIT_ERROR_CHECK_ALLOC(entry);
strcpy(entry->name, name);
entry->driver = driver;
@@ -265,12 +265,12 @@ int git_merge_driver_register(const char *name, git_merge_driver *driver)
assert(name && driver);
if (git_rwlock_wrlock(&merge_driver_registry.lock) < 0) {
- giterr_set(GITERR_OS, "failed to lock merge driver registry");
+ git_error_set(GIT_ERROR_OS, "failed to lock merge driver registry");
return -1;
}
if (!merge_driver_registry_find(NULL, name)) {
- giterr_set(GITERR_MERGE, "attempt to reregister existing driver '%s'",
+ git_error_set(GIT_ERROR_MERGE, "attempt to reregister existing driver '%s'",
name);
error = GIT_EEXISTS;
goto done;
@@ -290,12 +290,12 @@ int git_merge_driver_unregister(const char *name)
int error = 0;
if (git_rwlock_wrlock(&merge_driver_registry.lock) < 0) {
- giterr_set(GITERR_OS, "failed to lock merge driver registry");
+ git_error_set(GIT_ERROR_OS, "failed to lock merge driver registry");
return -1;
}
if ((entry = merge_driver_registry_lookup(&pos, name)) == NULL) {
- giterr_set(GITERR_MERGE, "cannot find merge driver '%s' to unregister",
+ git_error_set(GIT_ERROR_MERGE, "cannot find merge driver '%s' to unregister",
name);
error = GIT_ENOTFOUND;
goto done;
@@ -332,7 +332,7 @@ git_merge_driver *git_merge_driver_lookup(const char *name)
return &git_merge_driver__binary;
if (git_rwlock_rdlock(&merge_driver_registry.lock) < 0) {
- giterr_set(GITERR_OS, "failed to lock merge driver registry");
+ git_error_set(GIT_ERROR_OS, "failed to lock merge driver registry");
return NULL;
}
@@ -341,7 +341,7 @@ git_merge_driver *git_merge_driver_lookup(const char *name)
git_rwlock_rdunlock(&merge_driver_registry.lock);
if (entry == NULL) {
- giterr_set(GITERR_MERGE, "cannot use an unregistered filter");
+ git_error_set(GIT_ERROR_MERGE, "cannot use an unregistered filter");
return NULL;
}
diff --git a/src/merge_file.c b/src/merge_file.c
index a36c198..0647a5d 100644
--- a/src/merge_file.c
+++ b/src/merge_file.c
@@ -130,7 +130,7 @@ static int merge_file__xdiff(
if ((xdl_result = xdl_merge(&ancestor_mmfile, &our_mmfile,
&their_mmfile, &xmparam, &mmbuffer)) < 0) {
- giterr_set(GITERR_MERGE, "failed to merge files");
+ git_error_set(GIT_ERROR_MERGE, "failed to merge files");
error = -1;
goto done;
}
diff --git a/src/mwindow.c b/src/mwindow.c
index 16508c1..ffbee7d 100644
--- a/src/mwindow.c
+++ b/src/mwindow.c
@@ -58,7 +58,7 @@ int git_mwindow_get_pack(struct git_pack_file **out, const char *path)
return error;
if (git_mutex_lock(&git__mwindow_mutex) < 0) {
- giterr_set(GITERR_OS, "failed to lock mwindow mutex");
+ git_error_set(GIT_ERROR_OS, "failed to lock mwindow mutex");
return -1;
}
@@ -122,7 +122,7 @@ void git_mwindow_put_pack(struct git_pack_file *pack)
void git_mwindow_free_all(git_mwindow_file *mwf)
{
if (git_mutex_lock(&git__mwindow_mutex)) {
- giterr_set(GITERR_THREAD, "unable to lock mwindow mutex");
+ git_error_set(GIT_ERROR_THREAD, "unable to lock mwindow mutex");
return;
}
@@ -229,7 +229,7 @@ static int git_mwindow_close_lru(git_mwindow_file *mwf)
}
if (!lru_w) {
- giterr_set(GITERR_OS, "failed to close memory window; couldn't find LRU");
+ git_error_set(GIT_ERROR_OS, "failed to close memory window; couldn't find LRU");
return -1;
}
@@ -324,7 +324,7 @@ unsigned char *git_mwindow_open(
git_mwindow *w = *cursor;
if (git_mutex_lock(&git__mwindow_mutex)) {
- giterr_set(GITERR_THREAD, "unable to lock mwindow mutex");
+ git_error_set(GIT_ERROR_THREAD, "unable to lock mwindow mutex");
return NULL;
}
@@ -376,7 +376,7 @@ int git_mwindow_file_register(git_mwindow_file *mwf)
int ret;
if (git_mutex_lock(&git__mwindow_mutex)) {
- giterr_set(GITERR_THREAD, "unable to lock mwindow mutex");
+ git_error_set(GIT_ERROR_THREAD, "unable to lock mwindow mutex");
return -1;
}
@@ -416,7 +416,7 @@ void git_mwindow_close(git_mwindow **window)
git_mwindow *w = *window;
if (w) {
if (git_mutex_lock(&git__mwindow_mutex)) {
- giterr_set(GITERR_THREAD, "unable to lock mwindow mutex");
+ git_error_set(GIT_ERROR_THREAD, "unable to lock mwindow mutex");
return;
}
diff --git a/src/netops.c b/src/netops.c
index 272d0cc..ecbc2ae 100644
--- a/src/netops.c
+++ b/src/netops.c
@@ -153,7 +153,7 @@ int gitno_connection_data_from_url(
default_port = default_port_http;
if (data->use_ssl) {
- giterr_set(GITERR_NET, "redirect from HTTPS to HTTP is not allowed");
+ git_error_set(GIT_ERROR_NET, "redirect from HTTPS to HTTP is not allowed");
goto cleanup;
}
} else if (!git__prefixcmp(url, prefix_https)) {
@@ -164,7 +164,7 @@ int gitno_connection_data_from_url(
default_port = gitno__default_port(data);
if (!default_port) {
- giterr_set(GITERR_NET, "unrecognized URL prefix");
+ git_error_set(GIT_ERROR_NET, "unrecognized URL prefix");
goto cleanup;
}
@@ -196,7 +196,7 @@ int gitno_connection_data_from_url(
/* Check for errors in the resulting data */
if (original_host && url[0] != '/' && strcmp(original_host, data->host)) {
- giterr_set(GITERR_NET, "cross host redirect not allowed");
+ git_error_set(GIT_ERROR_NET, "cross host redirect not allowed");
error = -1;
}
}
@@ -234,7 +234,7 @@ int gitno_extract_url_parts(
int error = 0;
if (http_parser_parse_url(url, strlen(url), false, &u)) {
- giterr_set(GITERR_NET, "malformed URL '%s'", url);
+ git_error_set(GIT_ERROR_NET, "malformed URL '%s'", url);
error = GIT_EINVALIDSPEC;
goto done;
}
@@ -263,7 +263,7 @@ int gitno_extract_url_parts(
size_t url_path_len = u.field_data[UF_PATH].len;
git_buf_decode_percent(&path, url_path, url_path_len);
} else if (path_out) {
- giterr_set(GITERR_NET, "invalid url, missing path");
+ git_error_set(GIT_ERROR_NET, "invalid url, missing path");
error = GIT_EINVALIDSPEC;
goto done;
}
diff --git a/src/notes.c b/src/notes.c
index ebab0cd..2931353 100644
--- a/src/notes.c
+++ b/src/notes.c
@@ -15,7 +15,7 @@
static int note_error_notfound(void)
{
- giterr_set(GITERR_INVALID, "note could not be found");
+ git_error_set(GIT_ERROR_INVALID, "note could not be found");
return GIT_ENOTFOUND;
}
@@ -226,7 +226,7 @@ static int remove_note_in_tree_enotfound_cb(
GIT_UNUSED(note_oid);
GIT_UNUSED(fanout);
- giterr_set(GITERR_REPOSITORY, "object '%s' has no note", annotated_object_sha);
+ git_error_set(GIT_ERROR_REPOSITORY, "object '%s' has no note", annotated_object_sha);
return current_error;
}
@@ -244,7 +244,7 @@ static int insert_note_in_tree_eexists_cb(git_tree **out,
GIT_UNUSED(note_oid);
GIT_UNUSED(fanout);
- giterr_set(GITERR_REPOSITORY, "note for '%s' exists already", annotated_object_sha);
+ git_error_set(GIT_ERROR_REPOSITORY, "note for '%s' exists already", annotated_object_sha);
return current_error;
}
@@ -321,7 +321,7 @@ static int note_new(
git_note *note = NULL;
note = git__malloc(sizeof(git_note));
- GITERR_CHECK_ALLOC(note);
+ GIT_ERROR_CHECK_ALLOC(note);
git_oid_cpy(¬e->id, note_oid);
@@ -330,7 +330,7 @@ static int note_new(
return -1;
note->message = git__strndup(git_blob_rawcontent(blob), git_blob_rawsize(blob));
- GITERR_CHECK_ALLOC(note->message);
+ GIT_ERROR_CHECK_ALLOC(note->message);
*out = note;
return 0;
@@ -417,7 +417,7 @@ static int normalize_namespace(char **out, git_repository *repo, const char *not
{
if (notes_ref) {
*out = git__strdup(notes_ref);
- GITERR_CHECK_ALLOC(*out);
+ GIT_ERROR_CHECK_ALLOC(*out);
return 0;
}
@@ -729,7 +729,7 @@ int git_note_foreach(
while (!(error = git_note_next(¬e_id, &annotated_id, iter))) {
if ((error = note_cb(¬e_id, &annotated_id, payload)) != 0) {
- giterr_set_after_callback(error);
+ git_error_set_after_callback(error);
break;
}
}
diff --git a/src/object.c b/src/object.c
index ce43264..15f2722 100644
--- a/src/object.c
+++ b/src/object.c
@@ -71,18 +71,18 @@ int git_object__from_raw(
/* Validate type match */
if (type != GIT_OBJECT_BLOB && type != GIT_OBJECT_TREE && type != GIT_OBJECT_COMMIT && type != GIT_OBJECT_TAG) {
- giterr_set(GITERR_INVALID, "the requested type is invalid");
+ git_error_set(GIT_ERROR_INVALID, "the requested type is invalid");
return GIT_ENOTFOUND;
}
if ((object_size = git_object__size(type)) == 0) {
- giterr_set(GITERR_INVALID, "the requested type is invalid");
+ git_error_set(GIT_ERROR_INVALID, "the requested type is invalid");
return GIT_ENOTFOUND;
}
/* Allocate and initialize base object */
object = git__calloc(1, object_size);
- GITERR_CHECK_ALLOC(object);
+ GIT_ERROR_CHECK_ALLOC(object);
object->cached.flags = GIT_CACHE_STORE_PARSED;
object->cached.type = type;
git_odb_hash(&object->cached.oid, data, size, type);
@@ -118,19 +118,19 @@ int git_object__from_odb_object(
/* Validate type match */
if (type != GIT_OBJECT_ANY && type != odb_obj->cached.type) {
- giterr_set(GITERR_INVALID,
+ git_error_set(GIT_ERROR_INVALID,
"the requested type does not match the type in the ODB");
return GIT_ENOTFOUND;
}
if ((object_size = git_object__size(odb_obj->cached.type)) == 0) {
- giterr_set(GITERR_INVALID, "the requested type is invalid");
+ git_error_set(GIT_ERROR_INVALID, "the requested type is invalid");
return GIT_ENOTFOUND;
}
/* Allocate and initialize base object */
object = git__calloc(1, object_size);
- GITERR_CHECK_ALLOC(object);
+ GIT_ERROR_CHECK_ALLOC(object);
git_oid_cpy(&object->cached.oid, &odb_obj->cached.oid);
object->cached.type = odb_obj->cached.type;
@@ -175,7 +175,7 @@ int git_object_lookup_prefix(
assert(repo && object_out && id);
if (len < GIT_OID_MINPREFIXLEN) {
- giterr_set(GITERR_OBJECT, "ambiguous lookup - OID prefix is too short");
+ git_error_set(GIT_ERROR_OBJECT, "ambiguous lookup - OID prefix is too short");
return GIT_EAMBIGUOUS;
}
@@ -199,7 +199,7 @@ int git_object_lookup_prefix(
if (type != GIT_OBJECT_ANY && type != object->cached.type) {
git_object_free(object);
- giterr_set(GITERR_INVALID,
+ git_error_set(GIT_ERROR_INVALID,
"the requested type does not match the type in ODB");
return GIT_ENOTFOUND;
}
@@ -354,7 +354,7 @@ static int peel_error(int error, const git_oid *oid, git_object_t type)
git_oid_fmt(hex_oid, oid);
hex_oid[GIT_OID_HEXSZ] = '\0';
- giterr_set(GITERR_OBJECT, "the git_object of id '%s' can not be "
+ git_error_set(GIT_ERROR_OBJECT, "the git_object of id '%s' can not be "
"successfully peeled into a %s (git_object_t=%i).", hex_oid, type_name, type);
return error;
@@ -469,7 +469,7 @@ int git_object_lookup_bypath(
if (type != GIT_OBJECT_ANY && git_tree_entry_type(entry) != type)
{
- giterr_set(GITERR_OBJECT,
+ git_error_set(GIT_ERROR_OBJECT,
"object at path '%s' is not of the asked-for type %d",
path, type);
error = GIT_EINVALIDSPEC;
@@ -512,7 +512,7 @@ int git_object_short_id(git_buf *out, const git_object *obj)
if (error != GIT_EAMBIGUOUS)
break;
- giterr_clear();
+ git_error_clear();
len++;
}
@@ -542,7 +542,7 @@ bool git_object__is_valid(
return false;
if (expected_type != GIT_OBJECT_ANY && expected_type != actual_type) {
- giterr_set(GITERR_INVALID,
+ git_error_set(GIT_ERROR_INVALID,
"the requested type does not match the type in the ODB");
return false;
}
diff --git a/src/odb.c b/src/odb.c
index c0cd0ef..b74d42f 100644
--- a/src/odb.c
+++ b/src/odb.c
@@ -78,7 +78,7 @@ static int odb_read_hardcoded(bool *found, git_rawobj *raw, const git_oid *id)
raw->type = type;
raw->len = 0;
raw->data = git__calloc(1, sizeof(uint8_t));
- GITERR_CHECK_ALLOC(raw->data);
+ GIT_ERROR_CHECK_ALLOC(raw->data);
*found = true;
return 0;
@@ -98,7 +98,7 @@ int git_odb__format_object_header(
len = p_snprintf(hdr, hdr_max, "%s %"PRId64, type_str, (int64_t)obj_len);
if (len < 0 || len >= hdr_max) {
- giterr_set(GITERR_OS, "object header creation failed");
+ git_error_set(GIT_ERROR_OS, "object header creation failed");
return -1;
}
@@ -116,12 +116,12 @@ int git_odb__hashobj(git_oid *id, git_rawobj *obj)
assert(id && obj);
if (!git_object_typeisloose(obj->type)) {
- giterr_set(GITERR_INVALID, "invalid object type");
+ git_error_set(GIT_ERROR_INVALID, "invalid object type");
return -1;
}
if (!obj->data && obj->len != 0) {
- giterr_set(GITERR_INVALID, "invalid object");
+ git_error_set(GIT_ERROR_INVALID, "invalid object");
return -1;
}
@@ -204,7 +204,7 @@ int git_odb__hashfd(git_oid *out, git_file fd, size_t size, git_object_t type)
int error = 0;
if (!git_object_typeisloose(type)) {
- giterr_set(GITERR_INVALID, "invalid object type for hash");
+ git_error_set(GIT_ERROR_INVALID, "invalid object type for hash");
return -1;
}
@@ -229,7 +229,7 @@ int git_odb__hashfd(git_oid *out, git_file fd, size_t size, git_object_t type)
* If size is not zero, the file was truncated after we originally
* stat'd it, so we consider this a read failure too */
if (read_len < 0 || size > 0) {
- giterr_set(GITERR_OS, "error reading file for hashing");
+ git_error_set(GIT_ERROR_OS, "error reading file for hashing");
error = -1;
goto done;
@@ -281,7 +281,7 @@ int git_odb__hashlink(git_oid *out, const char *path)
return -1;
if (!git__is_int(st.st_size) || (int)st.st_size < 0) {
- giterr_set(GITERR_FILESYSTEM, "file size overflow for 32-bit systems");
+ git_error_set(GIT_ERROR_FILESYSTEM, "file size overflow for 32-bit systems");
return -1;
}
@@ -292,14 +292,14 @@ int git_odb__hashlink(git_oid *out, const char *path)
int read_len;
size_t alloc_size;
- GITERR_CHECK_ALLOC_ADD(&alloc_size, size, 1);
+ GIT_ERROR_CHECK_ALLOC_ADD(&alloc_size, size, 1);
link_data = git__malloc(alloc_size);
- GITERR_CHECK_ALLOC(link_data);
+ GIT_ERROR_CHECK_ALLOC(link_data);
read_len = p_readlink(path, link_data, size);
link_data[size] = '\0';
if (read_len != size) {
- giterr_set(GITERR_OS, "failed to read symlink data for '%s'", path);
+ git_error_set(GIT_ERROR_OS, "failed to read symlink data for '%s'", path);
git__free(link_data);
return -1;
}
@@ -325,7 +325,7 @@ int git_odb_hashfile(git_oid *out, const char *path, git_object_t type)
return fd;
if ((size = git_futils_filesize(fd)) < 0 || !git__is_sizet(size)) {
- giterr_set(GITERR_OS, "file size overflow for 32-bit systems");
+ git_error_set(GIT_ERROR_OS, "file size overflow for 32-bit systems");
p_close(fd);
return -1;
}
@@ -389,12 +389,12 @@ static int init_fake_wstream(git_odb_stream **stream_p, git_odb_backend *backend
fake_wstream *stream;
if (!git__is_ssizet(size)) {
- giterr_set(GITERR_ODB, "object size too large to keep in memory");
+ git_error_set(GIT_ERROR_ODB, "object size too large to keep in memory");
return -1;
}
stream = git__calloc(1, sizeof(fake_wstream));
- GITERR_CHECK_ALLOC(stream);
+ GIT_ERROR_CHECK_ALLOC(stream);
stream->size = size;
stream->type = type;
@@ -441,7 +441,7 @@ static int backend_sort_cmp(const void *a, const void *b)
int git_odb_new(git_odb **out)
{
git_odb *db = git__calloc(1, sizeof(*db));
- GITERR_CHECK_ALLOC(db);
+ GIT_ERROR_CHECK_ALLOC(db);
if (git_cache_init(&db->own_cache) < 0 ||
git_vector_init(&db->backends, 4, backend_sort_cmp) < 0) {
@@ -462,13 +462,13 @@ static int add_backend_internal(
assert(odb && backend);
- GITERR_CHECK_VERSION(backend, GIT_ODB_BACKEND_VERSION, "git_odb_backend");
+ GIT_ERROR_CHECK_VERSION(backend, GIT_ODB_BACKEND_VERSION, "git_odb_backend");
/* Check if the backend is already owned by another ODB */
assert(!backend->odb || backend->odb == odb);
internal = git__malloc(sizeof(backend_internal));
- GITERR_CHECK_ALLOC(internal);
+ GIT_ERROR_CHECK_ALLOC(internal);
internal->backend = backend;
internal->priority = priority;
@@ -503,7 +503,7 @@ size_t git_odb_num_backends(git_odb *odb)
static int git_odb__error_unsupported_in_backend(const char *action)
{
- giterr_set(GITERR_ODB,
+ git_error_set(GIT_ERROR_ODB,
"cannot %s - unsupported in the loaded odb backends", action);
return -1;
}
@@ -521,7 +521,7 @@ int git_odb_get_backend(git_odb_backend **out, git_odb *odb, size_t pos)
return 0;
}
- giterr_set(GITERR_ODB, "no ODB backend loaded at index %" PRIuZ, pos);
+ git_error_set(GIT_ERROR_ODB, "no ODB backend loaded at index %" PRIuZ, pos);
return GIT_ENOTFOUND;
}
@@ -546,7 +546,7 @@ int git_odb__add_default_backends(
if (as_alternates)
return 0;
- giterr_set(GITERR_ODB, "failed to load object database in '%s'", objects_dir);
+ git_error_set(GIT_ERROR_ODB, "failed to load object database in '%s'", objects_dir);
return -1;
}
@@ -657,7 +657,7 @@ int git_odb__set_caps(git_odb *odb, int caps)
int val;
if (!repo) {
- giterr_set(GITERR_ODB, "cannot access repository to set odb caps");
+ git_error_set(GIT_ERROR_ODB, "cannot access repository to set odb caps");
return -1;
}
@@ -919,7 +919,7 @@ int git_odb_expand_ids(
}
}
- giterr_clear();
+ git_error_clear();
return 0;
}
@@ -1075,7 +1075,7 @@ static int odb_read_1(git_odb_object **out, git_odb *db, const git_oid *id,
}
}
- giterr_clear();
+ git_error_clear();
if ((object = odb_object__alloc(id, &raw)) == NULL) {
error = -1;
goto out;
@@ -1362,7 +1362,7 @@ int git_odb_open_wstream(
}
ctx = git__malloc(sizeof(git_hash_ctx));
- GITERR_CHECK_ALLOC(ctx);
+ GIT_ERROR_CHECK_ALLOC(ctx);
if ((error = git_hash_ctx_init(ctx)) < 0 ||
(error = hash_header(ctx, size, type)) < 0)
@@ -1382,7 +1382,7 @@ static int git_odb_stream__invalid_length(
const git_odb_stream *stream,
const char *action)
{
- giterr_set(GITERR_ODB,
+ git_error_set(GIT_ERROR_ODB,
"cannot %s - "
"Invalid length. %"PRId64" was expected. The "
"total size of the received chunks amounts to %"PRId64".",
@@ -1524,7 +1524,7 @@ int git_odb__error_mismatch(const git_oid *expected, const git_oid *actual)
git_oid_tostr(expected_oid, sizeof(expected_oid), expected);
git_oid_tostr(actual_oid, sizeof(actual_oid), actual);
- giterr_set(GITERR_ODB, "object hash mismatch - expected %s but got %s",
+ git_error_set(GIT_ERROR_ODB, "object hash mismatch - expected %s but got %s",
expected_oid, actual_oid);
return GIT_EMISMATCH;
@@ -1536,23 +1536,23 @@ int git_odb__error_notfound(
if (oid != NULL) {
char oid_str[GIT_OID_HEXSZ + 1];
git_oid_tostr(oid_str, oid_len+1, oid);
- giterr_set(GITERR_ODB, "object not found - %s (%.*s)",
+ git_error_set(GIT_ERROR_ODB, "object not found - %s (%.*s)",
message, (int) oid_len, oid_str);
} else
- giterr_set(GITERR_ODB, "object not found - %s", message);
+ git_error_set(GIT_ERROR_ODB, "object not found - %s", message);
return GIT_ENOTFOUND;
}
static int error_null_oid(int error, const char *message)
{
- giterr_set(GITERR_ODB, "odb: %s: null OID cannot exist", message);
+ git_error_set(GIT_ERROR_ODB, "odb: %s: null OID cannot exist", message);
return error;
}
int git_odb__error_ambiguous(const char *message)
{
- giterr_set(GITERR_ODB, "ambiguous SHA1 prefix - %s", message);
+ git_error_set(GIT_ERROR_ODB, "ambiguous SHA1 prefix - %s", message);
return GIT_EAMBIGUOUS;
}
diff --git a/src/odb_loose.c b/src/odb_loose.c
index 616b8c8..649bc56 100644
--- a/src/odb_loose.c
+++ b/src/odb_loose.c
@@ -81,8 +81,8 @@ static int object_file_name(
size_t alloclen;
/* expand length for object root + 40 hex sha1 chars + 2 * '/' + '\0' */
- GITERR_CHECK_ALLOC_ADD(&alloclen, be->objects_dirlen, GIT_OID_HEXSZ);
- GITERR_CHECK_ALLOC_ADD(&alloclen, alloclen, 3);
+ GIT_ERROR_CHECK_ALLOC_ADD(&alloclen, be->objects_dirlen, GIT_OID_HEXSZ);
+ GIT_ERROR_CHECK_ALLOC_ADD(&alloclen, alloclen, 3);
if (git_buf_grow(name, alloclen) < 0)
return -1;
@@ -138,7 +138,7 @@ static int parse_header_packlike(
return 0;
on_error:
- giterr_set(GITERR_OBJECT, "failed to parse loose object: invalid header");
+ git_error_set(GIT_ERROR_OBJECT, "failed to parse loose object: invalid header");
return -1;
}
@@ -179,7 +179,7 @@ static int parse_header(
goto on_error;
if ((uint64_t)size > SIZE_MAX) {
- giterr_set(GITERR_OBJECT, "object is larger than available memory");
+ git_error_set(GIT_ERROR_OBJECT, "object is larger than available memory");
return -1;
}
@@ -191,7 +191,7 @@ static int parse_header(
return 0;
on_error:
- giterr_set(GITERR_OBJECT, "failed to parse loose object: invalid header");
+ git_error_set(GIT_ERROR_OBJECT, "failed to parse loose object: invalid header");
return -1;
}
@@ -241,7 +241,7 @@ static int read_loose_packlike(git_rawobj *out, git_buf *obj)
goto done;
if (!git_object_typeisloose(hdr.type) || head_len > obj_len) {
- giterr_set(GITERR_ODB, "failed to inflate loose object");
+ git_error_set(GIT_ERROR_ODB, "failed to inflate loose object");
error = -1;
goto done;
}
@@ -294,7 +294,7 @@ static int read_loose_standard(git_rawobj *out, git_buf *obj)
goto done;
if (!git_object_typeisloose(hdr.type)) {
- giterr_set(GITERR_ODB, "failed to inflate disk object");
+ git_error_set(GIT_ERROR_ODB, "failed to inflate disk object");
error = -1;
goto done;
}
@@ -320,7 +320,7 @@ static int read_loose_standard(git_rawobj *out, git_buf *obj)
goto done;
if (!git_zstream_done(&zstream)) {
- giterr_set(GITERR_ZLIB, "failed to finish zlib inflation: stream aborted prematurely");
+ git_error_set(GIT_ERROR_ZLIB, "failed to finish zlib inflation: stream aborted prematurely");
error = -1;
goto done;
}
@@ -427,7 +427,7 @@ static int read_header_loose(git_rawobj *out, git_buf *loc)
error = read_header_loose_standard(out, obj, (size_t)obj_len);
if (!error && !git_object_typeisloose(out->type)) {
- giterr_set(GITERR_ZLIB, "failed to read loose object header");
+ git_error_set(GIT_ERROR_ZLIB, "failed to read loose object header");
error = -1;
goto done;
}
@@ -496,8 +496,8 @@ static int locate_object_short_oid(
int error;
/* prealloc memory for OBJ_DIR/xx/xx..38x..xx */
- GITERR_CHECK_ALLOC_ADD(&alloc_len, dir_len, GIT_OID_HEXSZ);
- GITERR_CHECK_ALLOC_ADD(&alloc_len, alloc_len, 3);
+ GIT_ERROR_CHECK_ALLOC_ADD(&alloc_len, dir_len, GIT_OID_HEXSZ);
+ GIT_ERROR_CHECK_ALLOC_ADD(&alloc_len, alloc_len, 3);
if (git_buf_grow(object_location, alloc_len) < 0)
return -1;
@@ -543,8 +543,8 @@ static int locate_object_short_oid(
return error;
/* Update the location according to the oid obtained */
- GITERR_CHECK_ALLOC_ADD(&alloc_len, dir_len, GIT_OID_HEXSZ);
- GITERR_CHECK_ALLOC_ADD(&alloc_len, alloc_len, 2);
+ GIT_ERROR_CHECK_ALLOC_ADD(&alloc_len, dir_len, GIT_OID_HEXSZ);
+ GIT_ERROR_CHECK_ALLOC_ADD(&alloc_len, alloc_len, 2);
git_buf_truncate(object_location, dir_len);
if (git_buf_grow(object_location, alloc_len) < 0)
@@ -731,7 +731,7 @@ static int foreach_object_dir_cb(void *_state, git_buf *path)
if (filename_to_oid(&oid, path->ptr + state->dir_len) < 0)
return 0;
- return giterr_set_after_callback_function(
+ return git_error_set_after_callback_function(
state->cb(&oid, state->data), "git_odb_foreach");
}
@@ -838,7 +838,7 @@ static int loose_backend__writestream(git_odb_stream **stream_out, git_odb_backe
return error;
stream = git__calloc(1, sizeof(loose_writestream));
- GITERR_CHECK_ALLOC(stream);
+ GIT_ERROR_CHECK_ALLOC(stream);
stream->stream.backend = _backend;
stream->stream.read = NULL; /* read only */
@@ -926,7 +926,7 @@ static int loose_backend__readstream_packlike(
return error;
if (!git_object_typeisloose(hdr->type)) {
- giterr_set(GITERR_ODB, "failed to inflate loose object");
+ git_error_set(GIT_ERROR_ODB, "failed to inflate loose object");
return -1;
}
@@ -958,7 +958,7 @@ static int loose_backend__readstream_standard(
return error;
if (!git_object_typeisloose(hdr->type)) {
- giterr_set(GITERR_ODB, "failed to inflate disk object");
+ git_error_set(GIT_ERROR_ODB, "failed to inflate disk object");
return -1;
}
@@ -998,10 +998,10 @@ static int loose_backend__readstream(
}
stream = git__calloc(1, sizeof(loose_readstream));
- GITERR_CHECK_ALLOC(stream);
+ GIT_ERROR_CHECK_ALLOC(stream);
hash_ctx = git__malloc(sizeof(git_hash_ctx));
- GITERR_CHECK_ALLOC(hash_ctx);
+ GIT_ERROR_CHECK_ALLOC(hash_ctx);
if ((error = git_hash_ctx_init(hash_ctx)) < 0 ||
(error = git_futils_mmap_ro_file(&stream->map, object_path.ptr)) < 0 ||
@@ -1123,10 +1123,10 @@ int git_odb_backend_loose(
objects_dirlen = strlen(objects_dir);
- GITERR_CHECK_ALLOC_ADD(&alloclen, sizeof(loose_backend), objects_dirlen);
- GITERR_CHECK_ALLOC_ADD(&alloclen, alloclen, 2);
+ GIT_ERROR_CHECK_ALLOC_ADD(&alloclen, sizeof(loose_backend), objects_dirlen);
+ GIT_ERROR_CHECK_ALLOC_ADD(&alloclen, alloclen, 2);
backend = git__calloc(1, alloclen);
- GITERR_CHECK_ALLOC(backend);
+ GIT_ERROR_CHECK_ALLOC(backend);
backend->parent.version = GIT_ODB_BACKEND_VERSION;
backend->objects_dirlen = objects_dirlen;
diff --git a/src/odb_mempack.c b/src/odb_mempack.c
index 1086859..fb29ddd 100644
--- a/src/odb_mempack.c
+++ b/src/odb_mempack.c
@@ -48,9 +48,9 @@ static int impl__write(git_odb_backend *_backend, const git_oid *oid, const void
if (rval == 0)
return 0;
- GITERR_CHECK_ALLOC_ADD(&alloc_len, sizeof(struct memobject), len);
+ GIT_ERROR_CHECK_ALLOC_ADD(&alloc_len, sizeof(struct memobject), len);
obj = git__malloc(alloc_len);
- GITERR_CHECK_ALLOC(obj);
+ GIT_ERROR_CHECK_ALLOC(obj);
memcpy(obj->data, data, len);
git_oid_cpy(&obj->oid, oid);
@@ -62,7 +62,7 @@ static int impl__write(git_odb_backend *_backend, const git_oid *oid, const void
if (type == GIT_OBJECT_COMMIT) {
struct memobject **store = git_array_alloc(db->commits);
- GITERR_CHECK_ALLOC(store);
+ GIT_ERROR_CHECK_ALLOC(store);
*store = obj;
}
@@ -91,7 +91,7 @@ static int impl__read(void **buffer_p, size_t *len_p, git_object_t *type_p, git_
*len_p = obj->len;
*type_p = obj->type;
*buffer_p = git__malloc(obj->len);
- GITERR_CHECK_ALLOC(*buffer_p);
+ GIT_ERROR_CHECK_ALLOC(*buffer_p);
memcpy(*buffer_p, obj->data, obj->len);
return 0;
@@ -169,7 +169,7 @@ int git_mempack_new(git_odb_backend **out)
assert(out);
db = git__calloc(1, sizeof(struct memory_packer_db));
- GITERR_CHECK_ALLOC(db);
+ GIT_ERROR_CHECK_ALLOC(db);
db->objects = git_oidmap_alloc();
diff --git a/src/odb_pack.c b/src/odb_pack.c
index 6bdedec..beab37b 100644
--- a/src/odb_pack.c
+++ b/src/odb_pack.c
@@ -218,7 +218,7 @@ static int packfile_load__cb(void *data, git_buf *path)
/* ignore missing .pack file as git does */
if (error == GIT_ENOTFOUND) {
- giterr_clear();
+ git_error_clear();
return 0;
}
@@ -533,7 +533,7 @@ static int pack_backend__writepack(struct git_odb_writepack **out,
backend = (struct pack_backend *)_backend;
writepack = git__calloc(1, sizeof(struct pack_writepack));
- GITERR_CHECK_ALLOC(writepack);
+ GIT_ERROR_CHECK_ALLOC(writepack);
if (git_indexer_new(&writepack->indexer,
backend->pack_folder, 0, odb, &opts) < 0) {
@@ -573,7 +573,7 @@ static void pack_backend__free(git_odb_backend *_backend)
static int pack_backend__alloc(struct pack_backend **out, size_t initial_size)
{
struct pack_backend *backend = git__calloc(1, sizeof(struct pack_backend));
- GITERR_CHECK_ALLOC(backend);
+ GIT_ERROR_CHECK_ALLOC(backend);
if (git_vector_init(&backend->packs, initial_size, packfile_sort__cb) < 0) {
git__free(backend);
diff --git a/src/oid.c b/src/oid.c
index 0c63abb..8d45e4d 100644
--- a/src/oid.c
+++ b/src/oid.c
@@ -17,7 +17,7 @@ static char to_hex[] = "0123456789abcdef";
static int oid_error_invalid(const char *msg)
{
- giterr_set(GITERR_INVALID, "unable to parse OID - %s", msg);
+ git_error_set(GIT_ERROR_INVALID, "unable to parse OID - %s", msg);
return -1;
}
@@ -263,7 +263,7 @@ struct git_oid_shorten {
static int resize_trie(git_oid_shorten *self, size_t new_size)
{
self->nodes = git__reallocarray(self->nodes, new_size, sizeof(trie_node));
- GITERR_CHECK_ALLOC(self->nodes);
+ GIT_ERROR_CHECK_ALLOC(self->nodes);
if (new_size > self->size) {
memset(&self->nodes[self->size], 0x0, (new_size - self->size) * sizeof(trie_node));
@@ -381,7 +381,7 @@ int git_oid_shorten_add(git_oid_shorten *os, const char *text_oid)
node_index idx;
if (os->full) {
- giterr_set(GITERR_INVALID, "unable to shorten OID - OID set full");
+ git_error_set(GIT_ERROR_INVALID, "unable to shorten OID - OID set full");
return -1;
}
@@ -396,7 +396,7 @@ int git_oid_shorten_add(git_oid_shorten *os, const char *text_oid)
trie_node *node;
if (c == -1) {
- giterr_set(GITERR_INVALID, "unable to shorten OID - invalid hex value");
+ git_error_set(GIT_ERROR_INVALID, "unable to shorten OID - invalid hex value");
return -1;
}
@@ -411,7 +411,7 @@ int git_oid_shorten_add(git_oid_shorten *os, const char *text_oid)
node = push_leaf(os, idx, git__fromhex(tail[0]), &tail[1]);
if (node == NULL) {
if (os->full)
- giterr_set(GITERR_INVALID, "unable to shorten OID - OID set full");
+ git_error_set(GIT_ERROR_INVALID, "unable to shorten OID - OID set full");
return -1;
}
}
@@ -419,7 +419,7 @@ int git_oid_shorten_add(git_oid_shorten *os, const char *text_oid)
if (node->children[c] == 0) {
if (push_leaf(os, idx, c, &text_oid[i + 1]) == NULL) {
if (os->full)
- giterr_set(GITERR_INVALID, "unable to shorten OID - OID set full");
+ git_error_set(GIT_ERROR_INVALID, "unable to shorten OID - OID set full");
return -1;
}
break;
diff --git a/src/pack-objects.c b/src/pack-objects.c
index a57a6bb..e152864 100644
--- a/src/pack-objects.c
+++ b/src/pack-objects.c
@@ -105,7 +105,7 @@ static int packbuilder_config(git_packbuilder *pb)
ret = git_config_get_int64(&val, config, KEY); \
if (!ret) { \
if (!git__is_sizet(val)) { \
- giterr_set(GITERR_CONFIG, \
+ git_error_set(GIT_ERROR_CONFIG, \
"configuration value '%s' is too large", KEY); \
ret = -1; \
goto out; \
@@ -139,7 +139,7 @@ int git_packbuilder_new(git_packbuilder **out, git_repository *repo)
*out = NULL;
pb = git__calloc(1, sizeof(*pb));
- GITERR_CHECK_ALLOC(pb);
+ GIT_ERROR_CHECK_ALLOC(pb);
pb->object_ix = git_oidmap_alloc();
if (!pb->object_ix)
@@ -166,7 +166,7 @@ int git_packbuilder_new(git_packbuilder **out, git_repository *repo)
git_mutex_init(&pb->progress_mutex) ||
git_cond_init(&pb->progress_cond))
{
- giterr_set(GITERR_OS, "failed to initialize packbuilder mutex");
+ git_error_set(GIT_ERROR_OS, "failed to initialize packbuilder mutex");
goto on_error;
}
@@ -222,11 +222,11 @@ int git_packbuilder_insert(git_packbuilder *pb, const git_oid *oid,
return 0;
if (pb->nr_objects >= pb->nr_alloc) {
- GITERR_CHECK_ALLOC_ADD(&newsize, pb->nr_alloc, 1024);
- GITERR_CHECK_ALLOC_MULTIPLY(&newsize, newsize, 3 / 2);
+ GIT_ERROR_CHECK_ALLOC_ADD(&newsize, pb->nr_alloc, 1024);
+ GIT_ERROR_CHECK_ALLOC_MULTIPLY(&newsize, newsize, 3 / 2);
if (!git__is_uint32(newsize)) {
- giterr_set(GITERR_NOMEMORY, "packfile too large to fit in memory.");
+ git_error_set(GIT_ERROR_NOMEMORY, "packfile too large to fit in memory.");
return -1;
}
@@ -234,7 +234,7 @@ int git_packbuilder_insert(git_packbuilder *pb, const git_oid *oid,
pb->object_list = git__reallocarray(pb->object_list,
pb->nr_alloc, sizeof(*po));
- GITERR_CHECK_ALLOC(pb->object_list);
+ GIT_ERROR_CHECK_ALLOC(pb->object_list);
rehash(pb);
}
@@ -250,7 +250,7 @@ int git_packbuilder_insert(git_packbuilder *pb, const git_oid *oid,
pos = git_oidmap_put(pb->object_ix, &po->id, &ret);
if (ret < 0) {
- giterr_set_oom();
+ git_error_set_oom();
return ret;
}
assert(ret != 0);
@@ -270,7 +270,7 @@ int git_packbuilder_insert(git_packbuilder *pb, const git_oid *oid,
pb->nr_objects, 0, pb->progress_cb_payload);
if (ret)
- return giterr_set_after_callback(ret);
+ return git_error_set_after_callback(ret);
}
}
@@ -299,7 +299,7 @@ static int get_delta(void **out, git_odb *odb, git_pobject *po)
goto on_error;
if (error == GIT_EBUFS || delta_size != po->delta_size) {
- giterr_set(GITERR_INVALID, "delta size changed");
+ git_error_set(GIT_ERROR_INVALID, "delta size changed");
goto on_error;
}
@@ -372,7 +372,7 @@ static int write_object(
goto done;
} else {
zbuf = git__malloc(zbuf_len);
- GITERR_CHECK_ALLOC(zbuf);
+ GIT_ERROR_CHECK_ALLOC(zbuf);
git_zstream_reset(&pb->zstream);
git_zstream_set_input(&pb->zstream, data, data_len);
@@ -621,7 +621,7 @@ static git_pobject **compute_write_order(git_packbuilder *pb)
if (wo_end != pb->nr_objects) {
git__free(wo);
- giterr_set(GITERR_INVALID, "invalid write order");
+ git_error_set(GIT_ERROR_INVALID, "invalid write order");
return NULL;
}
@@ -645,7 +645,7 @@ static int write_pack(git_packbuilder *pb,
return -1;
if (!git__is_uint32(pb->nr_objects)) {
- giterr_set(GITERR_INVALID, "too many objects");
+ git_error_set(GIT_ERROR_INVALID, "too many objects");
return -1;
}
@@ -802,13 +802,13 @@ static int try_delta(git_packbuilder *pb, struct unpacked *trg,
sz = git_odb_object_size(obj);
trg->data = git__malloc(sz);
- GITERR_CHECK_ALLOC(trg->data);
+ GIT_ERROR_CHECK_ALLOC(trg->data);
memcpy(trg->data, git_odb_object_data(obj), sz);
git_odb_object_free(obj);
if (sz != trg_size) {
- giterr_set(GITERR_INVALID,
+ git_error_set(GIT_ERROR_INVALID,
"inconsistent target object length");
return -1;
}
@@ -824,13 +824,13 @@ static int try_delta(git_packbuilder *pb, struct unpacked *trg,
sz = obj_sz;
src->data = git__malloc(sz);
- GITERR_CHECK_ALLOC(src->data);
+ GIT_ERROR_CHECK_ALLOC(src->data);
memcpy(src->data, git_odb_object_data(obj), sz);
git_odb_object_free(obj);
if (sz != src_size) {
- giterr_set(GITERR_INVALID,
+ git_error_set(GIT_ERROR_INVALID,
"inconsistent source object length");
return -1;
}
@@ -876,7 +876,7 @@ static int try_delta(git_packbuilder *pb, struct unpacked *trg,
}
trg_object->delta_data = git__realloc(delta_buf, delta_size);
- GITERR_CHECK_ALLOC(trg_object->delta_data);
+ GIT_ERROR_CHECK_ALLOC(trg_object->delta_data);
} else {
/* create delta when writing the pack */
git_packbuilder__cache_unlock(pb);
@@ -942,7 +942,7 @@ static int report_delta_progress(
count, pb->nr_objects, pb->progress_cb_payload);
if (ret)
- return giterr_set_after_callback(ret);
+ return git_error_set_after_callback(ret);
}
}
@@ -961,7 +961,7 @@ static int find_deltas(git_packbuilder *pb, git_pobject **list,
int error = -1;
array = git__calloc(window, sizeof(struct unpacked));
- GITERR_CHECK_ALLOC(array);
+ GIT_ERROR_CHECK_ALLOC(array);
for (;;) {
struct unpacked *n = array + idx;
@@ -1047,7 +1047,7 @@ static int find_deltas(git_packbuilder *pb, git_pobject **list,
git__free(po->delta_data);
po->delta_data = git__malloc(zbuf.size);
- GITERR_CHECK_ALLOC(po->delta_data);
+ GIT_ERROR_CHECK_ALLOC(po->delta_data);
memcpy(po->delta_data, zbuf.ptr, zbuf.size);
po->z_delta_size = zbuf.size;
@@ -1140,7 +1140,7 @@ static void *threaded_find_deltas(void *arg)
git_packbuilder__progress_unlock(me->pb);
if (git_mutex_lock(&me->mutex)) {
- giterr_set(GITERR_THREAD, "unable to lock packfile condition mutex");
+ git_error_set(GIT_ERROR_THREAD, "unable to lock packfile condition mutex");
return NULL;
}
@@ -1178,7 +1178,7 @@ static int ll_find_deltas(git_packbuilder *pb, git_pobject **list,
}
p = git__mallocarray(pb->nr_threads, sizeof(*p));
- GITERR_CHECK_ALLOC(p);
+ GIT_ERROR_CHECK_ALLOC(p);
/* Partition the work among the threads */
for (i = 0; i < pb->nr_threads; ++i) {
@@ -1219,7 +1219,7 @@ static int ll_find_deltas(git_packbuilder *pb, git_pobject **list,
ret = git_thread_create(&p[i].thread,
threaded_find_deltas, &p[i]);
if (ret) {
- giterr_set(GITERR_THREAD, "unable to create thread");
+ git_error_set(GIT_ERROR_THREAD, "unable to create thread");
return -1;
}
active_threads++;
@@ -1288,7 +1288,7 @@ static int ll_find_deltas(git_packbuilder *pb, git_pobject **list,
git_packbuilder__progress_unlock(pb);
if (git_mutex_lock(&target->mutex)) {
- giterr_set(GITERR_THREAD, "unable to lock packfile condition mutex");
+ git_error_set(GIT_ERROR_THREAD, "unable to lock packfile condition mutex");
git__free(p);
return -1;
}
@@ -1329,7 +1329,7 @@ static int prepare_pack(git_packbuilder *pb)
pb->progress_cb(GIT_PACKBUILDER_DELTAFICATION, 0, pb->nr_objects, pb->progress_cb_payload);
delta_list = git__mallocarray(pb->nr_objects, sizeof(*delta_list));
- GITERR_CHECK_ALLOC(delta_list);
+ GIT_ERROR_CHECK_ALLOC(delta_list);
for (i = 0; i < pb->nr_objects; ++i) {
git_pobject *po = pb->object_list + i;
@@ -1502,7 +1502,7 @@ int git_packbuilder_insert_recur(git_packbuilder *pb, const git_oid *id, const c
break;
default:
- giterr_set(GITERR_INVALID, "unknown object type");
+ git_error_set(GIT_ERROR_INVALID, "unknown object type");
error = -1;
}
@@ -1527,7 +1527,7 @@ static int lookup_walk_object(struct walk_object **out, git_packbuilder *pb, con
obj = git_pool_mallocz(&pb->object_pool, 1);
if (!obj) {
- giterr_set_oom();
+ git_error_set_oom();
return -1;
}
diff --git a/src/pack.c b/src/pack.c
index 86c8c72..ef360a9 100644
--- a/src/pack.c
+++ b/src/pack.c
@@ -42,7 +42,7 @@ static int pack_entry_find_offset(
static int packfile_error(const char *message)
{
- giterr_set(GITERR_ODB, "invalid pack file - %s", message);
+ git_error_set(GIT_ERROR_ODB, "invalid pack file - %s", message);
return -1;
}
@@ -90,12 +90,12 @@ static void cache_free(git_pack_cache *cache)
static int cache_init(git_pack_cache *cache)
{
cache->entries = git_offmap_alloc();
- GITERR_CHECK_ALLOC(cache->entries);
+ GIT_ERROR_CHECK_ALLOC(cache->entries);
cache->memory_limit = GIT_PACK_CACHE_MEMORY_LIMIT;
if (git_mutex_init(&cache->lock)) {
- giterr_set(GITERR_OS, "failed to initialize pack cache mutex");
+ git_error_set(GIT_ERROR_OS, "failed to initialize pack cache mutex");
git__free(cache->entries);
cache->entries = NULL;
@@ -156,7 +156,7 @@ static int cache_add(
entry = new_cache_object(base);
if (entry) {
if (git_mutex_lock(&cache->lock) < 0) {
- giterr_set(GITERR_OS, "failed to lock cache");
+ git_error_set(GIT_ERROR_OS, "failed to lock cache");
git__free(entry);
return -1;
}
@@ -217,7 +217,7 @@ static int pack_index_check(const char *path, struct git_pack_file *p)
if (p_fstat(fd, &st) < 0) {
p_close(fd);
- giterr_set(GITERR_OS, "unable to stat pack index '%s'", path);
+ git_error_set(GIT_ERROR_OS, "unable to stat pack index '%s'", path);
return -1;
}
@@ -226,7 +226,7 @@ static int pack_index_check(const char *path, struct git_pack_file *p)
(idx_size = (size_t)st.st_size) < 4 * 256 + 20 + 20)
{
p_close(fd);
- giterr_set(GITERR_ODB, "invalid pack index '%s'", path);
+ git_error_set(GIT_ERROR_ODB, "invalid pack index '%s'", path);
return -1;
}
@@ -419,13 +419,13 @@ static int packfile_unpack_header1(
shift = 4;
while (c & 0x80) {
if (len <= used) {
- giterr_set(GITERR_ODB, "buffer too small");
+ git_error_set(GIT_ERROR_ODB, "buffer too small");
return GIT_EBUFS;
}
if (bitsizeof(long) <= shift) {
*usedp = 0;
- giterr_set(GITERR_ODB, "packfile corrupted");
+ git_error_set(GIT_ERROR_ODB, "packfile corrupted");
return -1;
}
@@ -557,7 +557,7 @@ static int pack_dependency_chain(git_dependency_chain *chain_out,
/* if we run out of space on the small stack, use the array */
if (elem_pos == SMALL_STACK_SIZE) {
git_array_init_to_size(chain, elem_pos);
- GITERR_CHECK_ARRAY(chain);
+ GIT_ERROR_CHECK_ARRAY(chain);
memcpy(chain.ptr, small_stack, elem_pos * sizeof(struct pack_chain_elem));
chain.size = elem_pos;
use_heap = 1;
@@ -691,9 +691,9 @@ int git_packfile_unpack(
if (cached && stack_size == 1) {
void *data = obj->data;
- GITERR_CHECK_ALLOC_ADD(&alloclen, obj->len, 1);
+ GIT_ERROR_CHECK_ALLOC_ADD(&alloclen, obj->len, 1);
obj->data = git__malloc(alloclen);
- GITERR_CHECK_ALLOC(obj->data);
+ GIT_ERROR_CHECK_ALLOC(obj->data);
memcpy(obj->data, data, obj->len + 1);
git_atomic_dec(&cached->refcount);
@@ -793,7 +793,7 @@ int git_packfile_stream_open(git_packfile_stream *obj, struct git_pack_file *p,
obj->zstream.next_out = Z_NULL;
st = inflateInit(&obj->zstream);
if (st != Z_OK) {
- giterr_set(GITERR_ZLIB, "failed to init packfile stream");
+ git_error_set(GIT_ERROR_ZLIB, "failed to init packfile stream");
return -1;
}
@@ -824,7 +824,7 @@ ssize_t git_packfile_stream_read(git_packfile_stream *obj, void *buffer, size_t
written = len - obj->zstream.avail_out;
if (st != Z_OK && st != Z_STREAM_END) {
- giterr_set(GITERR_ZLIB, "error reading from the zlib stream");
+ git_error_set(GIT_ERROR_ZLIB, "error reading from the zlib stream");
return -1;
}
@@ -858,9 +858,9 @@ static int packfile_unpack_compressed(
z_stream stream;
unsigned char *buffer, *in;
- GITERR_CHECK_ALLOC_ADD(&buf_size, size, 1);
+ GIT_ERROR_CHECK_ALLOC_ADD(&buf_size, size, 1);
buffer = git__calloc(1, buf_size);
- GITERR_CHECK_ALLOC(buffer);
+ GIT_ERROR_CHECK_ALLOC(buffer);
memset(&stream, 0, sizeof(stream));
stream.next_out = buffer;
@@ -871,7 +871,7 @@ static int packfile_unpack_compressed(
st = inflateInit(&stream);
if (st != Z_OK) {
git__free(buffer);
- giterr_set(GITERR_ZLIB, "failed to init zlib stream on unpack");
+ git_error_set(GIT_ERROR_ZLIB, "failed to init zlib stream on unpack");
return -1;
}
@@ -898,7 +898,7 @@ static int packfile_unpack_compressed(
if ((st != Z_STREAM_END) || stream.total_out != size) {
git__free(buffer);
- giterr_set(GITERR_ZLIB, "error inflating zlib stream");
+ git_error_set(GIT_ERROR_ZLIB, "error inflating zlib stream");
return -1;
}
@@ -1087,7 +1087,7 @@ static int packfile_open(struct git_pack_file *p)
return 0;
cleanup:
- giterr_set(GITERR_OS, "invalid packfile '%s'", p->pack_name);
+ git_error_set(GIT_ERROR_OS, "invalid packfile '%s'", p->pack_name);
if (p->mwf.fd >= 0)
p_close(p->mwf.fd);
@@ -1126,11 +1126,11 @@ int git_packfile_alloc(struct git_pack_file **pack_out, const char *path)
if (path_len < strlen(".idx"))
return git_odb__error_notfound("invalid packfile path", NULL, 0);
- GITERR_CHECK_ALLOC_ADD(&alloc_len, sizeof(*p), path_len);
- GITERR_CHECK_ALLOC_ADD(&alloc_len, alloc_len, 2);
+ GIT_ERROR_CHECK_ALLOC_ADD(&alloc_len, sizeof(*p), path_len);
+ GIT_ERROR_CHECK_ALLOC_ADD(&alloc_len, alloc_len, 2);
p = git__calloc(1, alloc_len);
- GITERR_CHECK_ALLOC(p);
+ GIT_ERROR_CHECK_ALLOC(p);
memcpy(p->pack_name, path, path_len + 1);
@@ -1163,7 +1163,7 @@ int git_packfile_alloc(struct git_pack_file **pack_out, const char *path)
p->index_version = -1;
if (git_mutex_init(&p->lock)) {
- giterr_set(GITERR_OS, "failed to initialize packfile mutex");
+ git_error_set(GIT_ERROR_OS, "failed to initialize packfile mutex");
git__free(p);
return -1;
}
@@ -1266,7 +1266,7 @@ int git_pack_foreach_entry(
for (i = 0; i < p->num_objects; i++)
if ((error = cb(p->oids[i], data)) != 0)
- return giterr_set_after_callback(error);
+ return git_error_set_after_callback(error);
return error;
}
@@ -1352,7 +1352,7 @@ static int pack_entry_find_offset(
return git_odb__error_ambiguous("found multiple offsets for pack entry");
if ((offset = nth_packed_object_offset(p, pos)) < 0) {
- giterr_set(GITERR_ODB, "packfile index is corrupt");
+ git_error_set(GIT_ERROR_ODB, "packfile index is corrupt");
return -1;
}
diff --git a/src/parse.h b/src/parse.h
index 46897e3..21dcf9b 100644
--- a/src/parse.h
+++ b/src/parse.h
@@ -27,7 +27,7 @@ int git_parse_ctx_init(git_parse_ctx *ctx, const char *content, size_t content_l
void git_parse_ctx_clear(git_parse_ctx *ctx);
#define git_parse_err(...) \
- ( giterr_set(GITERR_PATCH, __VA_ARGS__), -1 )
+ ( git_error_set(GIT_ERROR_PATCH, __VA_ARGS__), -1 )
#define git_parse_ctx_contains_s(ctx, str) \
git_parse_ctx_contains(ctx, str, sizeof(str) - 1)
diff --git a/src/patch.c b/src/patch.c
index 15d2ca8..d19e683 100644
--- a/src/patch.c
+++ b/src/patch.c
@@ -80,7 +80,7 @@ size_t git_patch_size(
if (git_diff_delta__format_file_header(
&file_header, patch->delta, NULL, NULL, 0) < 0)
- giterr_clear();
+ git_error_clear();
else
out += git_buf_len(&file_header);
@@ -141,7 +141,7 @@ size_t git_patch_num_hunks(const git_patch *patch)
static int patch_error_outofrange(const char *thing)
{
- giterr_set(GITERR_INVALID, "patch %s index out of range", thing);
+ git_error_set(GIT_ERROR_INVALID, "patch %s index out of range", thing);
return GIT_ENOTFOUND;
}
diff --git a/src/patch_generate.c b/src/patch_generate.c
index 800d0e2..80033ee 100644
--- a/src/patch_generate.c
+++ b/src/patch_generate.c
@@ -84,7 +84,7 @@ static int patch_generated_normalize_options(
const git_diff_options *opts)
{
if (opts) {
- GITERR_CHECK_VERSION(opts, GIT_DIFF_OPTIONS_VERSION, "git_diff_options");
+ GIT_ERROR_CHECK_VERSION(opts, GIT_DIFF_OPTIONS_VERSION, "git_diff_options");
memcpy(out, opts, sizeof(git_diff_options));
} else {
git_diff_options default_opts = GIT_DIFF_OPTIONS_INIT;
@@ -99,8 +99,8 @@ static int patch_generated_normalize_options(
git__strdup(opts->new_prefix) :
git__strdup(DIFF_NEW_PREFIX_DEFAULT);
- GITERR_CHECK_ALLOC(out->old_prefix);
- GITERR_CHECK_ALLOC(out->new_prefix);
+ GIT_ERROR_CHECK_ALLOC(out->old_prefix);
+ GIT_ERROR_CHECK_ALLOC(out->new_prefix);
return 0;
}
@@ -135,7 +135,7 @@ static int patch_generated_alloc_from_diff(
{
int error;
git_patch_generated *patch = git__calloc(1, sizeof(git_patch_generated));
- GITERR_CHECK_ALLOC(patch);
+ GIT_ERROR_CHECK_ALLOC(patch);
if (!(error = patch_generated_init(patch, diff, delta_index))) {
patch->flags |= GIT_PATCH_GENERATED_ALLOCATED;
@@ -248,7 +248,7 @@ static int patch_generated_invoke_file_callback(
if (!output->file_cb)
return 0;
- return giterr_set_after_callback_function(
+ return git_error_set_after_callback_function(
output->file_cb(patch->base.delta, progress, output->payload),
"git_patch");
}
@@ -350,7 +350,7 @@ static int diff_binary(git_patch_generated_output *output, git_patch_generated *
return error;
}
- error = giterr_set_after_callback_function(
+ error = git_error_set_after_callback_function(
output->binary_cb(patch->base.delta, &binary, output->payload),
"git_patch");
@@ -397,7 +397,7 @@ static int diff_required(git_diff *diff, const char *action)
{
if (diff)
return 0;
- giterr_set(GITERR_INVALID, "must provide valid diff to %s", action);
+ git_error_set(GIT_ERROR_INVALID, "must provide valid diff to %s", action);
return -1;
}
@@ -501,12 +501,12 @@ static int patch_generated_with_delta_alloc(
size_t new_len = *new_path ? strlen(*new_path) : 0;
size_t alloc_len;
- GITERR_CHECK_ALLOC_ADD(&alloc_len, sizeof(*pd), old_len);
- GITERR_CHECK_ALLOC_ADD(&alloc_len, alloc_len, new_len);
- GITERR_CHECK_ALLOC_ADD(&alloc_len, alloc_len, 2);
+ GIT_ERROR_CHECK_ALLOC_ADD(&alloc_len, sizeof(*pd), old_len);
+ GIT_ERROR_CHECK_ALLOC_ADD(&alloc_len, alloc_len, new_len);
+ GIT_ERROR_CHECK_ALLOC_ADD(&alloc_len, alloc_len, 2);
*out = pd = git__calloc(1, alloc_len);
- GITERR_CHECK_ALLOC(pd);
+ GIT_ERROR_CHECK_ALLOC(pd);
pd->patch.flags = GIT_PATCH_GENERATED_ALLOCATED;
@@ -708,7 +708,7 @@ int git_patch_generated_from_diff(
delta = git_vector_get(&diff->deltas, idx);
if (!delta) {
- giterr_set(GITERR_INVALID, "index out of range for delta in diff");
+ git_error_set(GIT_ERROR_INVALID, "index out of range for delta in diff");
return GIT_ENOTFOUND;
}
@@ -788,7 +788,7 @@ static int patch_generated_binary_cb(
if (binary->old_file.data) {
patch->binary.old_file.data = git__malloc(binary->old_file.datalen);
- GITERR_CHECK_ALLOC(patch->binary.old_file.data);
+ GIT_ERROR_CHECK_ALLOC(patch->binary.old_file.data);
memcpy((char *)patch->binary.old_file.data,
binary->old_file.data, binary->old_file.datalen);
@@ -796,7 +796,7 @@ static int patch_generated_binary_cb(
if (binary->new_file.data) {
patch->binary.new_file.data = git__malloc(binary->new_file.datalen);
- GITERR_CHECK_ALLOC(patch->binary.new_file.data);
+ GIT_ERROR_CHECK_ALLOC(patch->binary.new_file.data);
memcpy((char *)patch->binary.new_file.data,
binary->new_file.data, binary->new_file.datalen);
@@ -816,7 +816,7 @@ static int git_patch_hunk_cb(
GIT_UNUSED(delta);
hunk = git_array_alloc(patch->base.hunks);
- GITERR_CHECK_ALLOC(hunk);
+ GIT_ERROR_CHECK_ALLOC(hunk);
memcpy(&hunk->hunk, hunk_, sizeof(hunk->hunk));
@@ -845,7 +845,7 @@ static int patch_generated_line_cb(
assert(hunk); /* programmer error if no hunk is available */
line = git_array_alloc(patch->base.lines);
- GITERR_CHECK_ALLOC(line);
+ GIT_ERROR_CHECK_ALLOC(line);
memcpy(line, line_, sizeof(*line));
diff --git a/src/patch_parse.c b/src/patch_parse.c
index 0244dbb..1bf3ad8 100644
--- a/src/patch_parse.c
+++ b/src/patch_parse.c
@@ -518,7 +518,7 @@ static int parse_hunk_header(
return 0;
fail:
- giterr_set(GITERR_PATCH, "invalid patch hunk header at line %"PRIuZ,
+ git_error_set(GIT_ERROR_PATCH, "invalid patch hunk header at line %"PRIuZ,
ctx->parse_ctx.line_num);
return -1;
}
@@ -583,7 +583,7 @@ static int parse_hunk_body(
}
line = git_array_alloc(patch->base.lines);
- GITERR_CHECK_ALLOC(line);
+ GIT_ERROR_CHECK_ALLOC(line);
memset(line, 0x0, sizeof(git_diff_line));
@@ -650,7 +650,7 @@ static int parse_patch_header(
* noise, continue.
*/
if (parse_hunk_header(&hunk, ctx) < 0) {
- giterr_clear();
+ git_error_clear();
continue;
}
@@ -673,7 +673,7 @@ static int parse_patch_header(
continue;
}
- giterr_set(GITERR_PATCH, "no patch found");
+ git_error_set(GIT_ERROR_PATCH, "no patch found");
error = GIT_ENOTFOUND;
done:
@@ -821,7 +821,7 @@ static int parse_patch_hunks(
while (git_parse_ctx_contains_s(&ctx->parse_ctx, "@@ -")) {
hunk = git_array_alloc(patch->base.hunks);
- GITERR_CHECK_ALLOC(hunk);
+ GIT_ERROR_CHECK_ALLOC(hunk);
memset(hunk, 0, sizeof(git_patch_hunk));
@@ -1079,7 +1079,7 @@ int git_patch_parse(
*out = NULL;
patch = git__calloc(1, sizeof(git_patch_parsed));
- GITERR_CHECK_ALLOC(patch);
+ GIT_ERROR_CHECK_ALLOC(patch);
patch->ctx = ctx;
GIT_REFCOUNT_INC(patch->ctx);
@@ -1087,7 +1087,7 @@ int git_patch_parse(
patch->base.free_fn = patch_parsed__free;
patch->base.delta = git__calloc(1, sizeof(git_diff_delta));
- GITERR_CHECK_ALLOC(patch->base.delta);
+ GIT_ERROR_CHECK_ALLOC(patch->base.delta);
patch->base.delta->status = GIT_DELTA_MODIFIED;
patch->base.delta->nfiles = 2;
@@ -1126,7 +1126,7 @@ int git_patch_from_buffer(
int error;
ctx = git_patch_parse_ctx_init(content, content_len, opts);
- GITERR_CHECK_ALLOC(ctx);
+ GIT_ERROR_CHECK_ALLOC(ctx);
error = git_patch_parse(out, ctx);
diff --git a/src/path.c b/src/path.c
index 9fab29e..197efb7 100644
--- a/src/path.c
+++ b/src/path.c
@@ -361,9 +361,9 @@ int git_path_prettify(git_buf *path_out, const char *path, const char *base)
}
if (p_realpath(path, buf) == NULL) {
- /* giterr_set resets the errno when dealing with a GITERR_OS kind of error */
+ /* git_error_set resets the errno when dealing with a GIT_ERROR_OS kind of error */
int error = (errno == ENOENT || errno == ENOTDIR) ? GIT_ENOTFOUND : -1;
- giterr_set(GITERR_OS, "failed to resolve path '%s'", path);
+ git_error_set(GIT_ERROR_OS, "failed to resolve path '%s'", path);
git_buf_clear(path_out);
@@ -436,7 +436,7 @@ append:
static int error_invalid_local_file_uri(const char *uri)
{
- giterr_set(GITERR_CONFIG, "'%s' is not a valid local file URI", uri);
+ git_error_set(GIT_ERROR_CONFIG, "'%s' is not a valid local file URI", uri);
return -1;
}
@@ -502,7 +502,7 @@ int git_path_walk_up(
if (!scan) {
error = cb(data, "");
if (error)
- giterr_set_after_callback(error);
+ git_error_set_after_callback(error);
return error;
}
@@ -515,7 +515,7 @@ int git_path_walk_up(
iter.ptr[scan] = oldc;
if (error) {
- giterr_set_after_callback(error);
+ git_error_set_after_callback(error);
break;
}
@@ -535,7 +535,7 @@ int git_path_walk_up(
if (!error && stop == 0 && iter.ptr[0] != '/') {
error = cb(data, "");
if (error)
- giterr_set_after_callback(error);
+ git_error_set_after_callback(error);
}
return error;
@@ -638,7 +638,7 @@ bool git_path_is_empty_dir(const char *path)
return false;
if ((error = git_buf_sets(&dir, path)) != 0)
- giterr_clear();
+ git_error_clear();
else
error = git_path_direach(&dir, 0, path_found_entry, NULL);
@@ -654,24 +654,24 @@ int git_path_set_error(int errno_value, const char *path, const char *action)
switch (errno_value) {
case ENOENT:
case ENOTDIR:
- giterr_set(GITERR_OS, "could not find '%s' to %s", path, action);
+ git_error_set(GIT_ERROR_OS, "could not find '%s' to %s", path, action);
return GIT_ENOTFOUND;
case EINVAL:
case ENAMETOOLONG:
- giterr_set(GITERR_OS, "invalid path for filesystem '%s'", path);
+ git_error_set(GIT_ERROR_OS, "invalid path for filesystem '%s'", path);
return GIT_EINVALIDSPEC;
case EEXIST:
- giterr_set(GITERR_OS, "failed %s - '%s' already exists", action, path);
+ git_error_set(GIT_ERROR_OS, "failed %s - '%s' already exists", action, path);
return GIT_EEXISTS;
case EACCES:
- giterr_set(GITERR_OS, "failed %s - '%s' is locked", action, path);
+ git_error_set(GIT_ERROR_OS, "failed %s - '%s' is locked", action, path);
return GIT_ELOCKED;
default:
- giterr_set(GITERR_OS, "could not %s '%s'", action, path);
+ git_error_set(GIT_ERROR_OS, "could not %s '%s'", action, path);
return -1;
}
}
@@ -751,7 +751,7 @@ int git_path_resolve_relative(git_buf *path, size_t ceiling)
char *base, *to, *from, *next;
size_t len;
- GITERR_CHECK_ALLOC_BUF(path);
+ GIT_ERROR_CHECK_ALLOC_BUF(path);
if (ceiling > path->size)
ceiling = path->size;
@@ -780,7 +780,7 @@ int git_path_resolve_relative(git_buf *path, size_t ceiling)
else if (len == 2 && from[0] == '.' && from[1] == '.') {
/* error out if trying to up one from a hard base */
if (to == base && ceiling != 0) {
- giterr_set(GITERR_INVALID,
+ git_error_set(GIT_ERROR_INVALID,
"cannot strip root component off url");
return -1;
}
@@ -887,7 +887,7 @@ int git_path_make_relative(git_buf *path, const char *parent)
/* need at least 1 common path segment */
if ((p_dirsep == path->ptr || q_dirsep == parent) &&
(*p_dirsep != '/' || *q_dirsep != '/')) {
- giterr_set(GITERR_INVALID,
+ git_error_set(GIT_ERROR_INVALID,
"%s is not a parent of %s", parent, path->ptr);
return GIT_ENOTFOUND;
}
@@ -911,10 +911,10 @@ int git_path_make_relative(git_buf *path, const char *parent)
for (; (q = strchr(q, '/')) && *(q + 1); q++)
depth++;
- GITERR_CHECK_ALLOC_MULTIPLY(&newlen, depth, 3);
- GITERR_CHECK_ALLOC_ADD(&newlen, newlen, plen);
+ GIT_ERROR_CHECK_ALLOC_MULTIPLY(&newlen, depth, 3);
+ GIT_ERROR_CHECK_ALLOC_ADD(&newlen, newlen, plen);
- GITERR_CHECK_ALLOC_ADD(&alloclen, newlen, 1);
+ GIT_ERROR_CHECK_ALLOC_ADD(&alloclen, newlen, 1);
/* save the offset as we might realllocate the pointer */
offset = p - path->ptr;
@@ -973,7 +973,7 @@ int git_path_iconv(git_path_iconv_t *ic, const char **in, size_t *inlen)
git_buf_clear(&ic->buf);
while (1) {
- GITERR_CHECK_ALLOC_ADD(&alloclen, wantlen, 1);
+ GIT_ERROR_CHECK_ALLOC_ADD(&alloclen, wantlen, 1);
if (git_buf_grow(&ic->buf, alloclen) < 0)
return -1;
@@ -1010,7 +1010,7 @@ int git_path_iconv(git_path_iconv_t *ic, const char **in, size_t *inlen)
return 0;
fail:
- giterr_set(GITERR_OS, "unable to convert unicode path data");
+ git_error_set(GIT_ERROR_OS, "unable to convert unicode path data");
return -1;
}
@@ -1103,7 +1103,7 @@ int git_path_direach(
wd_len = git_buf_len(path);
if ((dir = opendir(path->ptr)) == NULL) {
- giterr_set(GITERR_OS, "failed to open directory '%s'", path->ptr);
+ git_error_set(GIT_ERROR_OS, "failed to open directory '%s'", path->ptr);
if (errno == ENOENT)
return GIT_ENOTFOUND;
@@ -1130,15 +1130,15 @@ int git_path_direach(
if ((error = git_buf_put(path, de_path, de_len)) < 0)
break;
- giterr_clear();
+ git_error_clear();
error = fn(arg, path);
git_buf_truncate(path, wd_len); /* restore path */
/* Only set our own error if the callback did not set one already */
if (error != 0) {
- if (!giterr_last())
- giterr_set_after_callback(error);
+ if (!git_error_last())
+ git_error_set_after_callback(error);
break;
}
@@ -1184,13 +1184,13 @@ int git_path_diriter_init(
git_path_trim_slashes(&diriter->path_utf8);
if (diriter->path_utf8.size == 0) {
- giterr_set(GITERR_FILESYSTEM, "could not open directory '%s'", path);
+ git_error_set(GIT_ERROR_FILESYSTEM, "could not open directory '%s'", path);
return -1;
}
if ((diriter->parent_len = git_win32_path_from_utf8(diriter->path, diriter->path_utf8.ptr)) < 0 ||
!git_win32__findfirstfile_filter(path_filter, diriter->path_utf8.ptr)) {
- giterr_set(GITERR_OS, "could not parse the directory path '%s'", path);
+ git_error_set(GIT_ERROR_OS, "could not parse the directory path '%s'", path);
return -1;
}
@@ -1203,7 +1203,7 @@ int git_path_diriter_init(
is_win7_or_later ? FIND_FIRST_EX_LARGE_FETCH : 0);
if (diriter->handle == INVALID_HANDLE_VALUE) {
- giterr_set(GITERR_OS, "could not open directory '%s'", path);
+ git_error_set(GIT_ERROR_OS, "could not open directory '%s'", path);
return -1;
}
@@ -1223,7 +1223,7 @@ static int diriter_update_paths(git_path_diriter *diriter)
return -1;
if (path_len > GIT_WIN_PATH_UTF16) {
- giterr_set(GITERR_FILESYSTEM,
+ git_error_set(GIT_ERROR_FILESYSTEM,
"invalid path '%.*ls\\%ls' (path too long)",
diriter->parent_len, diriter->path, diriter->current.cFileName);
return -1;
@@ -1333,14 +1333,14 @@ int git_path_diriter_init(
git_path_trim_slashes(&diriter->path);
if (diriter->path.size == 0) {
- giterr_set(GITERR_FILESYSTEM, "could not open directory '%s'", path);
+ git_error_set(GIT_ERROR_FILESYSTEM, "could not open directory '%s'", path);
return -1;
}
if ((diriter->dir = opendir(diriter->path.ptr)) == NULL) {
git_buf_dispose(&diriter->path);
- giterr_set(GITERR_OS, "failed to open directory '%s'", path);
+ git_error_set(GIT_ERROR_OS, "failed to open directory '%s'", path);
return -1;
}
@@ -1372,7 +1372,7 @@ int git_path_diriter_next(git_path_diriter *diriter)
if (!errno)
return GIT_ITEROVER;
- giterr_set(GITERR_OS,
+ git_error_set(GIT_ERROR_OS,
"could not read directory '%s'", diriter->path.ptr);
return -1;
}
@@ -1477,7 +1477,7 @@ int git_path_dirload(
assert(name_len > prefix_len);
dup = git__strndup(name + prefix_len, name_len - prefix_len);
- GITERR_CHECK_ALLOC(dup);
+ GIT_ERROR_CHECK_ALLOC(dup);
if ((error = git_vector_insert(contents, dup)) < 0)
break;
@@ -1888,7 +1888,7 @@ extern int git_path_is_gitfile(const char *path, size_t pathlen, git_path_gitfil
size_t filelen;
if (!(gitfile >= GIT_PATH_GITFILE_GITIGNORE && gitfile < ARRAY_SIZE(gitfiles))) {
- giterr_set(GITERR_OS, "invalid gitfile for path validation");
+ git_error_set(GIT_ERROR_OS, "invalid gitfile for path validation");
return -1;
}
@@ -1905,7 +1905,7 @@ extern int git_path_is_gitfile(const char *path, size_t pathlen, git_path_gitfil
case GIT_PATH_FS_HFS:
return !verify_dotgit_hfs_generic(path, pathlen, file, filelen);
default:
- giterr_set(GITERR_OS, "invalid filesystem for path validation");
+ git_error_set(GIT_ERROR_OS, "invalid filesystem for path validation");
return -1;
}
}
diff --git a/src/pathspec.c b/src/pathspec.c
index 3415f66..07795f2 100644
--- a/src/pathspec.c
+++ b/src/pathspec.c
@@ -258,7 +258,7 @@ int git_pathspec_new(git_pathspec **out, const git_strarray *pathspec)
{
int error = 0;
git_pathspec *ps = git__malloc(sizeof(git_pathspec));
- GITERR_CHECK_ALLOC(ps);
+ GIT_ERROR_CHECK_ALLOC(ps);
if ((error = git_pathspec__init(ps, pathspec)) < 0) {
git__free(ps);
@@ -416,7 +416,7 @@ static int pathspec_match_from_iterator(
if (out) {
*out = m = pathspec_match_alloc(ps, PATHSPEC_DATATYPE_STRINGS);
- GITERR_CHECK_ALLOC(m);
+ GIT_ERROR_CHECK_ALLOC(m);
}
if ((error = git_iterator_reset_range(iter, ps->prefix, ps->prefix)) < 0)
@@ -488,7 +488,7 @@ static int pathspec_match_from_iterator(
/* if every pattern failed to match, then we have failed */
if ((flags & GIT_PATHSPEC_NO_MATCH_ERROR) != 0 && !found_files) {
- giterr_set(GITERR_INVALID, "no matching files were found");
+ git_error_set(GIT_ERROR_INVALID, "no matching files were found");
error = GIT_ENOTFOUND;
}
@@ -604,7 +604,7 @@ int git_pathspec_match_diff(
if (out) {
*out = m = pathspec_match_alloc(ps, PATHSPEC_DATATYPE_DIFF);
- GITERR_CHECK_ALLOC(m);
+ GIT_ERROR_CHECK_ALLOC(m);
}
pathspec_match_context_init(
@@ -659,7 +659,7 @@ int git_pathspec_match_diff(
/* if every pattern failed to match, then we have failed */
if ((flags & GIT_PATHSPEC_NO_MATCH_ERROR) != 0 && !found_deltas) {
- giterr_set(GITERR_INVALID, "no matching deltas were found");
+ git_error_set(GIT_ERROR_INVALID, "no matching deltas were found");
error = GIT_ENOTFOUND;
}
diff --git a/src/posix.c b/src/posix.c
index 6e7985e..bffe02e 100644
--- a/src/posix.c
+++ b/src/posix.c
@@ -243,17 +243,17 @@ int p_mmap(git_map *out, size_t len, int prot, int flags, int fd, git_off_t offs
out->len = 0;
if ((prot & GIT_PROT_WRITE) && ((flags & GIT_MAP_TYPE) == GIT_MAP_SHARED)) {
- giterr_set(GITERR_OS, "trying to map shared-writeable");
+ git_error_set(GIT_ERROR_OS, "trying to map shared-writeable");
return -1;
}
out->data = malloc(len);
- GITERR_CHECK_ALLOC(out->data);
+ GIT_ERROR_CHECK_ALLOC(out->data);
if (!git__is_ssizet(len) ||
(p_lseek(fd, offset, SEEK_SET) < 0) ||
(p_read(fd, out->data, len) != (ssize_t)len)) {
- giterr_set(GITERR_OS, "mmap emulation failed");
+ git_error_set(GIT_ERROR_OS, "mmap emulation failed");
return -1;
}
diff --git a/src/proxy.c b/src/proxy.c
index 9bc2c7f..d025586 100644
--- a/src/proxy.c
+++ b/src/proxy.c
@@ -26,7 +26,7 @@ int git_proxy_options_dup(git_proxy_options *tgt, const git_proxy_options *src)
memcpy(tgt, src, sizeof(git_proxy_options));
if (src->url) {
tgt->url = git__strdup(src->url);
- GITERR_CHECK_ALLOC(tgt->url);
+ GIT_ERROR_CHECK_ALLOC(tgt->url);
}
return 0;
diff --git a/src/push.c b/src/push.c
index 0ba4d98..9d09e18 100644
--- a/src/push.c
+++ b/src/push.c
@@ -36,7 +36,7 @@ int git_push_new(git_push **out, git_remote *remote)
*out = NULL;
p = git__calloc(1, sizeof(*p));
- GITERR_CHECK_ALLOC(p);
+ GIT_ERROR_CHECK_ALLOC(p);
p->repo = remote->repo;
p->remote = remote;
@@ -70,7 +70,7 @@ int git_push_set_options(git_push *push, const git_push_options *opts)
if (!push || !opts)
return -1;
- GITERR_CHECK_VERSION(opts, GIT_PUSH_OPTIONS_VERSION, "git_push_options");
+ GIT_ERROR_CHECK_VERSION(opts, GIT_PUSH_OPTIONS_VERSION, "git_push_options");
push->pb_parallelism = opts->pb_parallelism;
push->connection.custom_headers = &opts->custom_headers;
@@ -91,7 +91,7 @@ static void free_refspec(push_spec *spec)
static int check_rref(char *ref)
{
if (git__prefixcmp(ref, "refs/")) {
- giterr_set(GITERR_INVALID, "not a valid reference '%s'", ref);
+ git_error_set(GIT_ERROR_INVALID, "not a valid reference '%s'", ref);
return -1;
}
@@ -109,10 +109,10 @@ static int check_lref(git_push *push, char *ref)
return 0;
if (error == GIT_ENOTFOUND)
- giterr_set(GITERR_REFERENCE,
+ git_error_set(GIT_ERROR_REFERENCE,
"src refspec '%s' does not match any existing object", ref);
else
- giterr_set(GITERR_INVALID, "not a valid reference '%s'", ref);
+ git_error_set(GIT_ERROR_INVALID, "not a valid reference '%s'", ref);
return -1;
}
@@ -123,10 +123,10 @@ static int parse_refspec(git_push *push, push_spec **spec, const char *str)
*spec = NULL;
s = git__calloc(1, sizeof(*s));
- GITERR_CHECK_ALLOC(s);
+ GIT_ERROR_CHECK_ALLOC(s);
if (git_refspec__parse(&s->refspec, str, false) < 0) {
- giterr_set(GITERR_INVALID, "invalid refspec %s", str);
+ git_error_set(GIT_ERROR_INVALID, "invalid refspec %s", str);
goto on_error;
}
@@ -213,7 +213,7 @@ int git_push_update_tips(git_push *push, const git_remote_callbacks *callbacks)
if (error != GIT_ENOTFOUND)
goto on_error;
- giterr_clear();
+ git_error_clear();
fire_callback = 0;
}
@@ -323,7 +323,7 @@ static int queue_objects(git_push *push)
continue;
if (!git_odb_exists(push->repo->_odb, &spec->roid)) {
- giterr_set(GITERR_REFERENCE,
+ git_error_set(GIT_ERROR_REFERENCE,
"cannot push because a reference that you are trying to update on the remote contains commits that are not present locally.");
error = GIT_ENONFASTFORWARD;
goto on_error;
@@ -334,7 +334,7 @@ static int queue_objects(git_push *push)
if (error == GIT_ENOTFOUND ||
(!error && !git_oid_equal(&base, &spec->roid))) {
- giterr_set(GITERR_REFERENCE,
+ git_error_set(GIT_ERROR_REFERENCE,
"cannot push non-fastforwardable reference");
error = GIT_ENONFASTFORWARD;
goto on_error;
@@ -363,13 +363,13 @@ on_error:
static int add_update(git_push *push, push_spec *spec)
{
git_push_update *u = git__calloc(1, sizeof(git_push_update));
- GITERR_CHECK_ALLOC(u);
+ GIT_ERROR_CHECK_ALLOC(u);
u->src_refname = git__strdup(spec->refspec.src);
- GITERR_CHECK_ALLOC(u->src_refname);
+ GIT_ERROR_CHECK_ALLOC(u->src_refname);
u->dst_refname = git__strdup(spec->refspec.dst);
- GITERR_CHECK_ALLOC(u->dst_refname);
+ GIT_ERROR_CHECK_ALLOC(u->dst_refname);
git_oid_cpy(&u->src, &spec->roid);
git_oid_cpy(&u->dst, &spec->loid);
@@ -390,7 +390,7 @@ static int calculate_work(git_push *push)
/* This is a create or update. Local ref must exist. */
if (git_reference_name_to_id(
&spec->loid, push->repo, spec->refspec.src) < 0) {
- giterr_set(GITERR_REFERENCE, "no such reference '%s'", spec->refspec.src);
+ git_error_set(GIT_ERROR_REFERENCE, "no such reference '%s'", spec->refspec.src);
return -1;
}
}
@@ -416,7 +416,7 @@ static int do_push(git_push *push, const git_remote_callbacks *callbacks)
git_transport *transport = push->remote->transport;
if (!transport->push) {
- giterr_set(GITERR_NET, "remote transport doesn't support push");
+ git_error_set(GIT_ERROR_NET, "remote transport doesn't support push");
error = -1;
goto on_error;
}
@@ -485,7 +485,7 @@ int git_push_finish(git_push *push, const git_remote_callbacks *callbacks)
if (!push->unpack_ok) {
error = -1;
- giterr_set(GITERR_NET, "unpacking the sent packfile failed on the remote");
+ git_error_set(GIT_ERROR_NET, "unpacking the sent packfile failed on the remote");
}
return error;
@@ -501,7 +501,7 @@ int git_push_status_foreach(git_push *push,
git_vector_foreach(&push->status, i, status) {
int error = cb(status->ref, status->msg, data);
if (error)
- return giterr_set_after_callback(error);
+ return git_error_set_after_callback(error);
}
return 0;
diff --git a/src/reader.c b/src/reader.c
index d819bb4..c374c46 100644
--- a/src/reader.c
+++ b/src/reader.c
@@ -58,7 +58,7 @@ int git_reader_for_tree(git_reader **out, git_tree *tree)
assert(out && tree);
reader = git__calloc(1, sizeof(tree_reader));
- GITERR_CHECK_ALLOC(reader);
+ GIT_ERROR_CHECK_ALLOC(reader);
reader->reader.read = tree_reader_read;
reader->tree = tree;
@@ -99,7 +99,7 @@ static int workdir_reader_read(
if (error == -1 && errno == ENOENT)
error = GIT_ENOTFOUND;
- giterr_set(GITERR_OS, "could not stat '%s'", path.ptr);
+ git_error_set(GIT_ERROR_OS, "could not stat '%s'", path.ptr);
goto done;
}
@@ -155,7 +155,7 @@ int git_reader_for_workdir(
assert(out && repo);
reader = git__calloc(1, sizeof(workdir_reader));
- GITERR_CHECK_ALLOC(reader);
+ GIT_ERROR_CHECK_ALLOC(reader);
reader->reader.read = workdir_reader_read;
reader->repo = repo;
@@ -220,7 +220,7 @@ int git_reader_for_index(
assert(out && repo);
reader = git__calloc(1, sizeof(index_reader));
- GITERR_CHECK_ALLOC(reader);
+ GIT_ERROR_CHECK_ALLOC(reader);
reader->reader.read = index_reader_read;
reader->repo = repo;
diff --git a/src/rebase.c b/src/rebase.c
index 0846487..4546036 100644
--- a/src/rebase.c
+++ b/src/rebase.c
@@ -153,7 +153,7 @@ GIT_INLINE(int) rebase_readint(
return error;
if (git__strntol32(&num, asc_out->ptr, asc_out->size, &eol, 10) < 0 || num < 0 || *eol) {
- giterr_set(GITERR_REBASE, "the file '%s' contains an invalid numeric value", filename);
+ git_error_set(GIT_ERROR_REBASE, "the file '%s' contains an invalid numeric value", filename);
return -1;
}
@@ -171,7 +171,7 @@ GIT_INLINE(int) rebase_readoid(
return error;
if (str_out->size != GIT_OID_HEXSZ || git_oid_fromstr(out, str_out->ptr) < 0) {
- giterr_set(GITERR_REBASE, "the file '%s' contains an invalid object ID", filename);
+ git_error_set(GIT_ERROR_REBASE, "the file '%s' contains an invalid object ID", filename);
return -1;
}
@@ -231,7 +231,7 @@ static int rebase_open_merge(git_rebase *rebase)
/* Read cmt.* */
git_array_init_to_size(rebase->operations, end);
- GITERR_CHECK_ARRAY(rebase->operations);
+ GIT_ERROR_CHECK_ARRAY(rebase->operations);
for (i = 0; i < end; i++) {
git_buf_clear(&cmt);
@@ -241,7 +241,7 @@ static int rebase_open_merge(git_rebase *rebase)
goto done;
operation = rebase_operation_alloc(rebase, GIT_REBASE_OPERATION_PICK, &id, NULL);
- GITERR_CHECK_ALLOC(operation);
+ GIT_ERROR_CHECK_ALLOC(operation);
}
/* Read 'onto_name' */
@@ -261,7 +261,7 @@ done:
static int rebase_alloc(git_rebase **out, const git_rebase_options *rebase_opts)
{
git_rebase *rebase = git__calloc(1, sizeof(git_rebase));
- GITERR_CHECK_ALLOC(rebase);
+ GIT_ERROR_CHECK_ALLOC(rebase);
*out = NULL;
@@ -272,7 +272,7 @@ static int rebase_alloc(git_rebase **out, const git_rebase_options *rebase_opts)
if (rebase_opts && rebase_opts->rewrite_notes_ref) {
rebase->options.rewrite_notes_ref = git__strdup(rebase_opts->rewrite_notes_ref);
- GITERR_CHECK_ALLOC(rebase->options.rewrite_notes_ref);
+ GIT_ERROR_CHECK_ALLOC(rebase->options.rewrite_notes_ref);
}
*out = rebase;
@@ -282,10 +282,10 @@ static int rebase_alloc(git_rebase **out, const git_rebase_options *rebase_opts)
static int rebase_check_versions(const git_rebase_options *given_opts)
{
- GITERR_CHECK_VERSION(given_opts, GIT_REBASE_OPTIONS_VERSION, "git_rebase_options");
+ GIT_ERROR_CHECK_VERSION(given_opts, GIT_REBASE_OPTIONS_VERSION, "git_rebase_options");
if (given_opts)
- GITERR_CHECK_VERSION(&given_opts->checkout_options, GIT_CHECKOUT_OPTIONS_VERSION, "git_checkout_options");
+ GIT_ERROR_CHECK_VERSION(&given_opts->checkout_options, GIT_CHECKOUT_OPTIONS_VERSION, "git_checkout_options");
return 0;
}
@@ -314,7 +314,7 @@ int git_rebase_open(
goto done;
if (rebase->type == GIT_REBASE_TYPE_NONE) {
- giterr_set(GITERR_REBASE, "there is no rebase in progress");
+ git_error_set(GIT_ERROR_REBASE, "there is no rebase in progress");
error = GIT_ENOTFOUND;
goto done;
}
@@ -370,14 +370,14 @@ int git_rebase_open(
switch (rebase->type) {
case GIT_REBASE_TYPE_INTERACTIVE:
- giterr_set(GITERR_REBASE, "interactive rebase is not supported");
+ git_error_set(GIT_ERROR_REBASE, "interactive rebase is not supported");
error = -1;
break;
case GIT_REBASE_TYPE_MERGE:
error = rebase_open_merge(rebase);
break;
case GIT_REBASE_TYPE_APPLY:
- giterr_set(GITERR_REBASE, "patch application rebase is not supported");
+ git_error_set(GIT_ERROR_REBASE, "patch application rebase is not supported");
error = -1;
break;
default:
@@ -476,7 +476,7 @@ static int rebase_setupfiles(git_rebase *rebase)
git_oid_fmt(orig_head, &rebase->orig_head_id);
if (p_mkdir(rebase->state_path, REBASE_DIR_MODE) < 0) {
- giterr_set(GITERR_OS, "failed to create rebase directory '%s'", rebase->state_path);
+ git_error_set(GIT_ERROR_OS, "failed to create rebase directory '%s'", rebase->state_path);
return -1;
}
@@ -509,7 +509,7 @@ static int rebase_ensure_not_in_progress(git_repository *repo)
return error;
if (type != GIT_REBASE_TYPE_NONE) {
- giterr_set(GITERR_REBASE, "there is an existing rebase in progress");
+ git_error_set(GIT_ERROR_REBASE, "there is an existing rebase in progress");
return -1;
}
@@ -534,7 +534,7 @@ static int rebase_ensure_not_dirty(
goto done;
if (git_diff_num_deltas(diff) > 0) {
- giterr_set(GITERR_REBASE, "uncommitted changes exist in index");
+ git_error_set(GIT_ERROR_REBASE, "uncommitted changes exist in index");
error = fail_with;
goto done;
}
@@ -550,7 +550,7 @@ static int rebase_ensure_not_dirty(
goto done;
if (git_diff_num_deltas(diff) > 0) {
- giterr_set(GITERR_REBASE, "unstaged changes exist in workdir");
+ git_error_set(GIT_ERROR_REBASE, "unstaged changes exist in workdir");
error = fail_with;
goto done;
}
@@ -599,7 +599,7 @@ static int rebase_init_operations(
continue;
operation = rebase_operation_alloc(rebase, GIT_REBASE_OPERATION_PICK, &id, NULL);
- GITERR_CHECK_ALLOC(operation);
+ GIT_ERROR_CHECK_ALLOC(operation);
}
error = 0;
@@ -628,17 +628,17 @@ static int rebase_init_merge(
goto done;
rebase->state_path = git_buf_detach(&state_path);
- GITERR_CHECK_ALLOC(rebase->state_path);
+ GIT_ERROR_CHECK_ALLOC(rebase->state_path);
if (branch->ref_name && strcmp(branch->ref_name, "HEAD")) {
rebase->orig_head_name = git__strdup(branch->ref_name);
- GITERR_CHECK_ALLOC(rebase->orig_head_name);
+ GIT_ERROR_CHECK_ALLOC(rebase->orig_head_name);
} else {
rebase->head_detached = 1;
}
rebase->onto_name = git__strdup(rebase_onto_name(onto));
- GITERR_CHECK_ALLOC(rebase->onto_name);
+ GIT_ERROR_CHECK_ALLOC(rebase->onto_name);
rebase->quiet = rebase->options.quiet;
@@ -807,7 +807,7 @@ static int rebase_next_merge(
goto done;
if ((parent_count = git_commit_parentcount(current_commit)) > 1) {
- giterr_set(GITERR_REBASE, "cannot rebase a merge commit");
+ git_error_set(GIT_ERROR_REBASE, "cannot rebase a merge commit");
error = -1;
goto done;
} else if (parent_count) {
@@ -864,7 +864,7 @@ static int rebase_next_inmemory(
goto done;
if ((parent_count = git_commit_parentcount(current_commit)) > 1) {
- giterr_set(GITERR_REBASE, "cannot rebase a merge commit");
+ git_error_set(GIT_ERROR_REBASE, "cannot rebase a merge commit");
error = -1;
goto done;
} else if (parent_count) {
@@ -950,7 +950,7 @@ static int rebase_commit__create(
operation = git_array_get(rebase->operations, rebase->current);
if (git_index_has_conflicts(index)) {
- giterr_set(GITERR_REBASE, "conflicts have not been resolved");
+ git_error_set(GIT_ERROR_REBASE, "conflicts have not been resolved");
error = GIT_EUNMERGED;
goto done;
}
@@ -962,7 +962,7 @@ static int rebase_commit__create(
goto done;
if (git_oid_equal(&tree_id, git_tree_id(parent_tree))) {
- giterr_set(GITERR_REBASE, "this patch has already been applied");
+ git_error_set(GIT_ERROR_REBASE, "this patch has already been applied");
error = GIT_EAPPLIED;
goto done;
}
@@ -1148,7 +1148,7 @@ static int notes_ref_lookup(git_buf *out, git_rebase *rebase)
if (error != GIT_ENOTFOUND)
goto done;
- giterr_clear();
+ git_error_clear();
do_rewrite = 1;
}
@@ -1175,7 +1175,7 @@ static int rebase_copy_note(
if ((error = git_note_read(¬e, rebase->repo, notes_ref, from)) < 0) {
if (error == GIT_ENOTFOUND) {
- giterr_clear();
+ git_error_clear();
error = 0;
}
@@ -1188,7 +1188,7 @@ static int rebase_copy_note(
(error = git_signature_now(&who, "unknown", "unknown")) < 0)
goto done;
- giterr_clear();
+ git_error_clear();
}
committer = who;
@@ -1216,7 +1216,7 @@ static int rebase_copy_notes(
if ((error = notes_ref_lookup(¬es_ref, rebase)) < 0) {
if (error == GIT_ENOTFOUND) {
- giterr_clear();
+ git_error_clear();
error = 0;
}
@@ -1259,7 +1259,7 @@ static int rebase_copy_notes(
goto done;
on_error:
- giterr_set(GITERR_REBASE, "invalid rewritten file at line %d", linenum);
+ git_error_set(GIT_ERROR_REBASE, "invalid rewritten file at line %d", linenum);
error = -1;
done:
diff --git a/src/refdb.c b/src/refdb.c
index c162a15..b466153 100644
--- a/src/refdb.c
+++ b/src/refdb.c
@@ -24,7 +24,7 @@ int git_refdb_new(git_refdb **out, git_repository *repo)
assert(out && repo);
db = git__calloc(1, sizeof(*db));
- GITERR_CHECK_ALLOC(db);
+ GIT_ERROR_CHECK_ALLOC(db);
db->repo = repo;
@@ -127,7 +127,7 @@ int git_refdb_iterator(git_reference_iterator **out, git_refdb *db, const char *
int error;
if (!db->backend || !db->backend->iterator) {
- giterr_set(GITERR_REFERENCE, "this backend doesn't support iterators");
+ git_error_set(GIT_ERROR_REFERENCE, "this backend doesn't support iterators");
return -1;
}
@@ -245,7 +245,7 @@ int git_refdb_lock(void **payload, git_refdb *db, const char *refname)
assert(payload && db && refname);
if (!db->backend->lock) {
- giterr_set(GITERR_REFERENCE, "backend does not support locking");
+ git_error_set(GIT_ERROR_REFERENCE, "backend does not support locking");
return -1;
}
diff --git a/src/refdb_fs.c b/src/refdb_fs.c
index 361451b..d582cb8 100644
--- a/src/refdb_fs.c
+++ b/src/refdb_fs.c
@@ -94,7 +94,7 @@ static int packed_reload(refdb_fs_backend *backend)
if (error <= 0) {
if (error == GIT_ENOTFOUND) {
git_sortedcache_clear(backend->refcache, true);
- giterr_clear();
+ git_error_clear();
error = 0;
}
return error;
@@ -188,7 +188,7 @@ static int packed_reload(refdb_fs_backend *backend)
return 0;
parse_failed:
- giterr_set(GITERR_REFERENCE, "corrupted packed references file");
+ git_error_set(GIT_ERROR_REFERENCE, "corrupted packed references file");
git_sortedcache_clear(backend->refcache, false);
git_sortedcache_wunlock(backend->refcache);
@@ -215,7 +215,7 @@ static int loose_parse_oid(
return 0;
corrupted:
- giterr_set(GITERR_REFERENCE, "corrupted loose reference file: %s", filename);
+ git_error_set(GIT_ERROR_REFERENCE, "corrupted loose reference file: %s", filename);
return -1;
}
@@ -242,7 +242,7 @@ static int loose_lookup_to_packfile(refdb_fs_backend *backend, const char *name)
* the filesystem under us and skip it...
*/
if (loose_readbuffer(&ref_file, backend->gitpath, name) < 0) {
- giterr_clear();
+ git_error_clear();
goto done;
}
@@ -283,7 +283,7 @@ static int _dirent_loose_load(void *payload, git_buf *full_path)
full_path, backend->direach_flags, _dirent_loose_load, backend);
/* Race with the filesystem, ignore it */
if (error == GIT_ENOTFOUND) {
- giterr_clear();
+ git_error_clear();
return 0;
}
@@ -352,7 +352,7 @@ static const char *loose_parse_symbolic(git_buf *file_content)
refname_start = (const char *)file_content->ptr;
if (git_buf_len(file_content) < header_len + 1) {
- giterr_set(GITERR_REFERENCE, "corrupted loose reference file");
+ git_error_set(GIT_ERROR_REFERENCE, "corrupted loose reference file");
return NULL;
}
@@ -420,7 +420,7 @@ static int loose_lookup(
static int ref_error_notfound(const char *name)
{
- giterr_set(GITERR_REFERENCE, "reference '%s' not found", name);
+ git_error_set(GIT_ERROR_REFERENCE, "reference '%s' not found", name);
return GIT_ENOTFOUND;
}
@@ -468,7 +468,7 @@ static int refdb_fs_backend__lookup(
/* only try to lookup this reference on the packfile if it
* wasn't found on the loose refs; not if there was a critical error */
if (error == GIT_ENOTFOUND) {
- giterr_clear();
+ git_error_clear();
error = packed_lookup(out, backend, ref_name);
}
@@ -596,7 +596,7 @@ static int refdb_fs_backend__iterator_next(
if (loose_lookup(out, backend, path) == 0)
return 0;
- giterr_clear();
+ git_error_clear();
}
if (!iter->cache) {
@@ -639,7 +639,7 @@ static int refdb_fs_backend__iterator_next_name(
return 0;
}
- giterr_clear();
+ git_error_clear();
}
if (!iter->cache) {
@@ -679,7 +679,7 @@ static int refdb_fs_backend__iterator(
return error;
iter = git__calloc(1, sizeof(refdb_fs_iter));
- GITERR_CHECK_ALLOC(iter);
+ GIT_ERROR_CHECK_ALLOC(iter);
git_pool_init(&iter->pool, 1);
@@ -743,7 +743,7 @@ static int reference_path_available(
}
if (exists) {
- giterr_set(GITERR_REFERENCE,
+ git_error_set(GIT_ERROR_REFERENCE,
"failed to write reference '%s': a reference with "
"that name already exists.", new_ref);
return GIT_EEXISTS;
@@ -757,7 +757,7 @@ static int reference_path_available(
if (ref && !ref_is_available(old_ref, new_ref, ref->name)) {
git_sortedcache_runlock(backend->refcache);
- giterr_set(GITERR_REFERENCE,
+ git_error_set(GIT_ERROR_REFERENCE,
"path to reference '%s' collides with existing one", new_ref);
return -1;
}
@@ -776,7 +776,7 @@ static int loose_lock(git_filebuf *file, refdb_fs_backend *backend, const char *
assert(file && backend && name);
if (!git_path_isvalid(backend->repo, name, 0, GIT_PATH_REJECT_FILESYSTEM_DEFAULTS)) {
- giterr_set(GITERR_INVALID, "invalid reference name '%s'", name);
+ git_error_set(GIT_ERROR_INVALID, "invalid reference name '%s'", name);
return GIT_EINVALIDSPEC;
}
@@ -801,7 +801,7 @@ static int loose_lock(git_filebuf *file, refdb_fs_backend *backend, const char *
error = git_filebuf_open(file, ref_path.ptr, filebuf_flags, GIT_REFS_FILE_MODE);
if (error == GIT_EDIRECTORY)
- giterr_set(GITERR_REFERENCE, "cannot lock ref '%s', there are refs beneath that folder", name);
+ git_error_set(GIT_ERROR_REFERENCE, "cannot lock ref '%s', there are refs beneath that folder", name);
git_buf_dispose(&ref_path);
return error;
@@ -832,7 +832,7 @@ static int refdb_fs_backend__lock(void **out, git_refdb_backend *_backend, const
refdb_fs_backend *backend = (refdb_fs_backend *) _backend;
lock = git__calloc(1, sizeof(git_filebuf));
- GITERR_CHECK_ALLOC(lock);
+ GIT_ERROR_CHECK_ALLOC(lock);
if ((error = loose_lock(lock, backend, refname)) < 0) {
git__free(lock);
@@ -991,7 +991,7 @@ static int packed_remove_loose(refdb_fs_backend *backend)
if (error < 0) {
git_buf_dispose(&ref_content);
- giterr_set(GITERR_REFERENCE, "failed to lock loose reference '%s'", ref->name);
+ git_error_set(GIT_ERROR_REFERENCE, "failed to lock loose reference '%s'", ref->name);
return error;
}
@@ -1274,7 +1274,7 @@ static int refdb_fs_backend__write_tail(
goto on_error;
if (cmp) {
- giterr_set(GITERR_REFERENCE, "old reference value does not match");
+ git_error_set(GIT_ERROR_REFERENCE, "old reference value does not match");
error = GIT_EMODIFIED;
goto on_error;
}
@@ -1389,7 +1389,7 @@ static int refdb_fs_backend__delete_tail(
goto cleanup;
if (cmp) {
- giterr_set(GITERR_REFERENCE, "old reference value does not match");
+ git_error_set(GIT_ERROR_REFERENCE, "old reference value does not match");
error = GIT_EMODIFIED;
goto cleanup;
}
@@ -1579,10 +1579,10 @@ static int reflog_alloc(git_reflog **reflog, const char *name)
*reflog = NULL;
log = git__calloc(1, sizeof(git_reflog));
- GITERR_CHECK_ALLOC(log);
+ GIT_ERROR_CHECK_ALLOC(log);
log->ref_name = git__strdup(name);
- GITERR_CHECK_ALLOC(log->ref_name);
+ GIT_ERROR_CHECK_ALLOC(log->ref_name);
if (git_vector_init(&log->entries, 0, NULL) < 0) {
git__free(log->ref_name);
@@ -1602,7 +1602,7 @@ static int reflog_parse(git_reflog *log, const char *buf, size_t buf_size)
#define seek_forward(_increase) do { \
if (_increase >= buf_size) { \
- giterr_set(GITERR_INVALID, "ran out of data while parsing reflog"); \
+ git_error_set(GIT_ERROR_INVALID, "ran out of data while parsing reflog"); \
goto fail; \
} \
buf += _increase; \
@@ -1611,10 +1611,10 @@ static int reflog_parse(git_reflog *log, const char *buf, size_t buf_size)
while (buf_size > GIT_REFLOG_SIZE_MIN) {
entry = git__calloc(1, sizeof(git_reflog_entry));
- GITERR_CHECK_ALLOC(entry);
+ GIT_ERROR_CHECK_ALLOC(entry);
entry->committer = git__calloc(1, sizeof(git_signature));
- GITERR_CHECK_ALLOC(entry->committer);
+ GIT_ERROR_CHECK_ALLOC(entry->committer);
if (git_oid_fromstrn(&entry->oid_old, buf, GIT_OID_HEXSZ) < 0)
goto fail;
@@ -1642,7 +1642,7 @@ static int reflog_parse(git_reflog *log, const char *buf, size_t buf_size)
seek_forward(1);
entry->msg = git__strndup(ptr, buf - ptr);
- GITERR_CHECK_ALLOC(entry->msg);
+ GIT_ERROR_CHECK_ALLOC(entry->msg);
} else
entry->msg = NULL;
@@ -1820,7 +1820,7 @@ static int lock_reflog(git_filebuf *file, refdb_fs_backend *backend, const char
repo = backend->repo;
if (!git_path_isvalid(backend->repo, refname, 0, GIT_PATH_REJECT_FILESYSTEM_DEFAULTS)) {
- giterr_set(GITERR_INVALID, "invalid reference name '%s'", refname);
+ git_error_set(GIT_ERROR_INVALID, "invalid reference name '%s'", refname);
return GIT_EINVALIDSPEC;
}
@@ -1828,7 +1828,7 @@ static int lock_reflog(git_filebuf *file, refdb_fs_backend *backend, const char
return -1;
if (!git_path_isfile(git_buf_cstr(&log_path))) {
- giterr_set(GITERR_INVALID,
+ git_error_set(GIT_ERROR_INVALID,
"log file for reference '%s' doesn't exist", refname);
error = -1;
goto cleanup;
@@ -1917,7 +1917,7 @@ static int reflog_append(refdb_fs_backend *backend, const git_reference *ref, co
if (error == GIT_ENOTFOUND)
return 0;
- giterr_clear();
+ git_error_clear();
}
}
@@ -1940,7 +1940,7 @@ static int reflog_append(refdb_fs_backend *backend, const git_reference *ref, co
if (error == GIT_ENOTFOUND)
error = 0;
} else if (git_path_isdir(git_buf_cstr(&path))) {
- giterr_set(GITERR_REFERENCE, "cannot create reflog at '%s', there are reflogs beneath that folder",
+ git_error_set(GIT_ERROR_REFERENCE, "cannot create reflog at '%s', there are reflogs beneath that folder",
ref->name);
error = GIT_EDIRECTORY;
}
@@ -2014,7 +2014,7 @@ static int refdb_reflog_fs__rename(git_refdb_backend *_backend, const char *old_
p_close(fd);
if (p_rename(git_buf_cstr(&old_path), git_buf_cstr(&temp_path)) < 0) {
- giterr_set(GITERR_OS, "failed to rename reflog for %s", new_name);
+ git_error_set(GIT_ERROR_OS, "failed to rename reflog for %s", new_name);
error = -1;
goto cleanup;
}
@@ -2031,7 +2031,7 @@ static int refdb_reflog_fs__rename(git_refdb_backend *_backend, const char *old_
}
if (p_rename(git_buf_cstr(&temp_path), git_buf_cstr(&new_path)) < 0) {
- giterr_set(GITERR_OS, "failed to rename reflog for %s", new_name);
+ git_error_set(GIT_ERROR_OS, "failed to rename reflog for %s", new_name);
error = -1;
}
@@ -2078,7 +2078,7 @@ int git_refdb_backend_fs(
refdb_fs_backend *backend;
backend = git__calloc(1, sizeof(refdb_fs_backend));
- GITERR_CHECK_ALLOC(backend);
+ GIT_ERROR_CHECK_ALLOC(backend);
backend->repo = repository;
diff --git a/src/reflog.c b/src/reflog.c
index 9389992..1834a27 100644
--- a/src/reflog.c
+++ b/src/reflog.c
@@ -81,7 +81,7 @@ int git_reflog_append(git_reflog *reflog, const git_oid *new_oid, const git_sign
assert(reflog && new_oid && committer);
entry = git__calloc(1, sizeof(git_reflog_entry));
- GITERR_CHECK_ALLOC(entry);
+ GIT_ERROR_CHECK_ALLOC(entry);
if ((git_signature_dup(&entry->committer, committer)) < 0)
goto cleanup;
@@ -94,7 +94,7 @@ int git_reflog_append(git_reflog *reflog, const git_oid *new_oid, const git_sign
if (newline) {
if (newline[1] != '\0') {
- giterr_set(GITERR_INVALID, "reflog message cannot contain newline");
+ git_error_set(GIT_ERROR_INVALID, "reflog message cannot contain newline");
goto cleanup;
}
@@ -194,7 +194,7 @@ int git_reflog_drop(git_reflog *reflog, size_t idx, int rewrite_previous_entry)
entry = (git_reflog_entry *)git_reflog_entry_byindex(reflog, idx);
if (entry == NULL) {
- giterr_set(GITERR_REFERENCE, "no reflog entry at index %"PRIuZ, idx);
+ git_error_set(GIT_ERROR_REFERENCE, "no reflog entry at index %"PRIuZ, idx);
return GIT_ENOTFOUND;
}
diff --git a/src/refs.c b/src/refs.c
index 6e919b2..644bc2e 100644
--- a/src/refs.c
+++ b/src/refs.c
@@ -113,7 +113,7 @@ int git_reference_dup(git_reference **dest, git_reference *source)
else
*dest = git_reference__alloc(source->name, &source->target.oid, &source->peel);
- GITERR_CHECK_ALLOC(*dest);
+ GIT_ERROR_CHECK_ALLOC(*dest);
(*dest)->db = source->db;
GIT_REFCOUNT_INC((*dest)->db);
@@ -243,7 +243,7 @@ int git_reference_lookup_resolved(
}
if (scan_type != GIT_REFERENCE_DIRECT && max_nesting != 0) {
- giterr_set(GITERR_REFERENCE,
+ git_error_set(GIT_ERROR_REFERENCE,
"cannot resolve reference (>%u levels deep)", max_nesting);
git_reference_free(ref);
return -1;
@@ -339,12 +339,12 @@ int git_reference_dwim(git_reference **out, git_repository *repo, const char *re
cleanup:
if (error && !foundvalid) {
/* never found a valid reference name */
- giterr_set(GITERR_REFERENCE,
+ git_error_set(GIT_ERROR_REFERENCE,
"could not use '%s' as valid reference name", git_buf_cstr(&name));
}
if (error == GIT_ENOTFOUND)
- giterr_set(GITERR_REFERENCE, "no reference found for shorthand '%s'", refname);
+ git_error_set(GIT_ERROR_REFERENCE, "no reference found for shorthand '%s'", refname);
git_buf_dispose(&name);
git_buf_dispose(&refnamebuf);
@@ -437,7 +437,7 @@ static int reference__create(
assert(symbolic == NULL);
if (!git_object__is_valid(repo, oid, GIT_OBJECT_ANY)) {
- giterr_set(GITERR_REFERENCE,
+ git_error_set(GIT_ERROR_REFERENCE,
"target OID for the reference doesn't exist on the repository");
return -1;
}
@@ -455,7 +455,7 @@ static int reference__create(
ref = git_reference__alloc_symbolic(normalized, normalized_target);
}
- GITERR_CHECK_ALLOC(ref);
+ GIT_ERROR_CHECK_ALLOC(ref);
if ((error = git_refdb_write(refdb, ref, force, signature, log_message, old_id, old_target)) < 0) {
git_reference_free(ref);
@@ -569,7 +569,7 @@ static int ensure_is_an_updatable_direct_reference(git_reference *ref)
if (ref->type == GIT_REFERENCE_DIRECT)
return 0;
- giterr_set(GITERR_REFERENCE, "cannot set OID on symbolic reference");
+ git_error_set(GIT_ERROR_REFERENCE, "cannot set OID on symbolic reference");
return -1;
}
@@ -597,7 +597,7 @@ static int ensure_is_an_updatable_symbolic_reference(git_reference *ref)
if (ref->type == GIT_REFERENCE_SYMBOLIC)
return 0;
- giterr_set(GITERR_REFERENCE, "cannot set symbolic target on a direct reference");
+ git_error_set(GIT_ERROR_REFERENCE, "cannot set symbolic target on a direct reference");
return -1;
}
@@ -631,7 +631,7 @@ static int update_wt_heads(git_repository *repo, const char *path, void *payload
int error;
if ((error = git_reference__read_head(&head, repo, path)) < 0) {
- giterr_set(GITERR_REFERENCE, "could not read HEAD when renaming references");
+ git_error_set(GIT_ERROR_REFERENCE, "could not read HEAD when renaming references");
goto out;
}
@@ -648,7 +648,7 @@ static int update_wt_heads(git_repository *repo, const char *path, void *payload
/* Update HEAD it was pointing to the reference being renamed */
if ((error = git_repository_create_head(gitdir, data->new_name)) < 0) {
- giterr_set(GITERR_REFERENCE, "failed to update HEAD after renaming reference");
+ git_error_set(GIT_ERROR_REFERENCE, "failed to update HEAD after renaming reference");
goto out;
}
@@ -730,7 +730,7 @@ int git_reference_resolve(git_reference **ref_out, const git_reference *ref)
return git_reference_lookup_resolved(ref_out, ref->db->repo, ref->target.symbolic, -1);
default:
- giterr_set(GITERR_REFERENCE, "invalid reference");
+ git_error_set(GIT_ERROR_REFERENCE, "invalid reference");
return -1;
}
}
@@ -749,7 +749,7 @@ int git_reference_foreach(
while (!(error = git_reference_next(&ref, iter))) {
if ((error = callback(ref, payload)) != 0) {
- giterr_set_after_callback(error);
+ git_error_set_after_callback(error);
break;
}
}
@@ -775,7 +775,7 @@ int git_reference_foreach_name(
while (!(error = git_reference_next_name(&refname, iter))) {
if ((error = callback(refname, payload)) != 0) {
- giterr_set_after_callback(error);
+ git_error_set_after_callback(error);
break;
}
}
@@ -802,7 +802,7 @@ int git_reference_foreach_glob(
while (!(error = git_reference_next_name(&refname, iter))) {
if ((error = callback(refname, payload)) != 0) {
- giterr_set_after_callback(error);
+ git_error_set_after_callback(error);
break;
}
}
@@ -856,7 +856,7 @@ void git_reference_iterator_free(git_reference_iterator *iter)
static int cb__reflist_add(const char *ref, void *data)
{
char *name = git__strdup(ref);
- GITERR_CHECK_ALLOC(name);
+ GIT_ERROR_CHECK_ALLOC(name);
return git_vector_insert((git_vector *)data, name);
}
@@ -1073,8 +1073,8 @@ int git_reference__normalize_name(
cleanup:
if (error == GIT_EINVALIDSPEC)
- giterr_set(
- GITERR_REFERENCE,
+ git_error_set(
+ GIT_ERROR_REFERENCE,
"the given reference name '%s' is not valid", name);
if (error && normalize)
@@ -1100,8 +1100,8 @@ int git_reference_normalize_name(
goto cleanup;
if (git_buf_len(&buf) > buffer_size - 1) {
- giterr_set(
- GITERR_REFERENCE,
+ git_error_set(
+ GIT_ERROR_REFERENCE,
"the provided buffer is too short to hold the normalization of '%s'", name);
error = GIT_EBUFS;
goto cleanup;
@@ -1148,7 +1148,7 @@ static int get_terminal(git_reference **out, git_repository *repo, const char *r
int error = 0;
if (nesting > MAX_NESTING_LEVEL) {
- giterr_set(GITERR_REFERENCE, "reference chain too deep (%d)", nesting);
+ git_error_set(GIT_ERROR_REFERENCE, "reference chain too deep (%d)", nesting);
return GIT_ENOTFOUND;
}
@@ -1198,11 +1198,11 @@ int git_reference__update_terminal(
/* found a dangling symref */
if (error == GIT_ENOTFOUND && ref) {
assert(git_reference_type(ref) == GIT_REFERENCE_SYMBOLIC);
- giterr_clear();
+ git_error_clear();
error = reference__create(&ref2, repo, ref->target.symbolic, oid, NULL, 0, to_use,
log_message, NULL, NULL);
} else if (error == GIT_ENOTFOUND) {
- giterr_clear();
+ git_error_clear();
error = reference__create(&ref2, repo, ref_name, oid, NULL, 0, to_use,
log_message, NULL, NULL);
} else if (error == 0) {
@@ -1341,8 +1341,8 @@ int git_reference_is_note(const git_reference *ref)
static int peel_error(int error, const git_reference *ref, const char* msg)
{
- giterr_set(
- GITERR_INVALID,
+ git_error_set(
+ GIT_ERROR_INVALID,
"the reference '%s' cannot be peeled - %s", git_reference_name(ref), msg);
return error;
}
@@ -1402,7 +1402,7 @@ cleanup:
int git_reference__is_valid_name(const char *refname, unsigned int flags)
{
if (git_reference__normalize_name(NULL, refname, flags) < 0) {
- giterr_clear();
+ git_error_clear();
return false;
}
diff --git a/src/refspec.c b/src/refspec.c
index 7e68071..eaf0c2c 100644
--- a/src/refspec.c
+++ b/src/refspec.c
@@ -43,11 +43,11 @@ int git_refspec__parse(git_refspec *refspec, const char *input, bool is_fetch)
if (!is_fetch && rhs == lhs && rhs[1] == '\0') {
refspec->matching = 1;
refspec->string = git__strdup(input);
- GITERR_CHECK_ALLOC(refspec->string);
+ GIT_ERROR_CHECK_ALLOC(refspec->string);
refspec->src = git__strdup("");
- GITERR_CHECK_ALLOC(refspec->src);
+ GIT_ERROR_CHECK_ALLOC(refspec->src);
refspec->dst = git__strdup("");
- GITERR_CHECK_ALLOC(refspec->dst);
+ GIT_ERROR_CHECK_ALLOC(refspec->dst);
return 0;
}
@@ -132,18 +132,18 @@ int git_refspec__parse(git_refspec *refspec, const char *input, bool is_fetch)
/* if the RHS is empty, then it's a copy of the LHS */
if (!refspec->dst) {
refspec->dst = git__strdup(refspec->src);
- GITERR_CHECK_ALLOC(refspec->dst);
+ GIT_ERROR_CHECK_ALLOC(refspec->dst);
}
}
refspec->string = git__strdup(input);
- GITERR_CHECK_ALLOC(refspec->string);
+ GIT_ERROR_CHECK_ALLOC(refspec->string);
return 0;
invalid:
- giterr_set(
- GITERR_INVALID,
+ git_error_set(
+ GIT_ERROR_INVALID,
"'%s' is not a valid refspec.", input);
git_refspec__dispose(refspec);
return -1;
@@ -169,7 +169,7 @@ int git_refspec_parse(git_refspec **out_refspec, const char *input, int is_fetch
*out_refspec = NULL;
refspec = git__malloc(sizeof(git_refspec));
- GITERR_CHECK_ALLOC(refspec);
+ GIT_ERROR_CHECK_ALLOC(refspec);
if (git_refspec__parse(refspec, input, !!is_fetch) != 0) {
git__free(refspec);
@@ -273,7 +273,7 @@ int git_refspec_transform(git_buf *out, const git_refspec *spec, const char *nam
git_buf_sanitize(out);
if (!git_refspec_src_matches(spec, name)) {
- giterr_set(GITERR_INVALID, "ref '%s' doesn't match the source", name);
+ git_error_set(GIT_ERROR_INVALID, "ref '%s' doesn't match the source", name);
return -1;
}
@@ -289,7 +289,7 @@ int git_refspec_rtransform(git_buf *out, const git_refspec *spec, const char *na
git_buf_sanitize(out);
if (!git_refspec_dst_matches(spec, name)) {
- giterr_set(GITERR_INVALID, "ref '%s' doesn't match the destination", name);
+ git_error_set(GIT_ERROR_INVALID, "ref '%s' doesn't match the destination", name);
return -1;
}
@@ -342,7 +342,7 @@ int git_refspec__dwim_one(git_vector *out, git_refspec *spec, git_vector *refs)
assert(out && spec && refs);
cur = git__calloc(1, sizeof(git_refspec));
- GITERR_CHECK_ALLOC(cur);
+ GIT_ERROR_CHECK_ALLOC(cur);
cur->force = spec->force;
cur->push = spec->push;
@@ -355,7 +355,7 @@ int git_refspec__dwim_one(git_vector *out, git_refspec *spec, git_vector *refs)
for (j = 0; formatters[j]; j++) {
git_buf_clear(&buf);
git_buf_printf(&buf, formatters[j], spec->src);
- GITERR_CHECK_ALLOC_BUF(&buf);
+ GIT_ERROR_CHECK_ALLOC_BUF(&buf);
key.name = (char *) git_buf_cstr(&buf);
if (!git_vector_search(&pos, refs, &key)) {
@@ -368,7 +368,7 @@ int git_refspec__dwim_one(git_vector *out, git_refspec *spec, git_vector *refs)
/* No shorthands found, copy over the name */
if (cur->src == NULL && spec->src != NULL) {
cur->src = git__strdup(spec->src);
- GITERR_CHECK_ALLOC(cur->src);
+ GIT_ERROR_CHECK_ALLOC(cur->src);
}
if (spec->dst && git__prefixcmp(spec->dst, GIT_REFS_DIR)) {
@@ -380,7 +380,7 @@ int git_refspec__dwim_one(git_vector *out, git_refspec *spec, git_vector *refs)
}
git_buf_puts(&buf, spec->dst);
- GITERR_CHECK_ALLOC_BUF(&buf);
+ GIT_ERROR_CHECK_ALLOC_BUF(&buf);
cur->dst = git_buf_detach(&buf);
}
@@ -389,7 +389,7 @@ int git_refspec__dwim_one(git_vector *out, git_refspec *spec, git_vector *refs)
if (cur->dst == NULL && spec->dst != NULL) {
cur->dst = git__strdup(spec->dst);
- GITERR_CHECK_ALLOC(cur->dst);
+ GIT_ERROR_CHECK_ALLOC(cur->dst);
}
return git_vector_insert(out, cur);
diff --git a/src/remote.c b/src/remote.c
index 2cfb921..2f0b8c5 100644
--- a/src/remote.c
+++ b/src/remote.c
@@ -35,7 +35,7 @@ static int add_refspec_to(git_vector *vector, const char *string, bool is_fetch)
git_refspec *spec;
spec = git__calloc(1, sizeof(git_refspec));
- GITERR_CHECK_ALLOC(spec);
+ GIT_ERROR_CHECK_ALLOC(spec);
if (git_refspec__parse(spec, string, is_fetch) < 0) {
git__free(spec);
@@ -85,8 +85,8 @@ static int ensure_remote_name_is_valid(const char *name)
int error = 0;
if (!git_remote_is_valid_name(name)) {
- giterr_set(
- GITERR_CONFIG,
+ git_error_set(
+ GIT_ERROR_CONFIG,
"'%s' is not a valid remote name.", name ? name : "(null)");
error = GIT_EINVALIDSPEC;
}
@@ -111,7 +111,7 @@ static int write_add_refspec(git_repository *repo, const char *name, const char
return error;
if ((error = git_refspec__parse(&spec, refspec, fetch)) < 0) {
- if (giterr_last()->klass != GITERR_NOMEMORY)
+ if (git_error_last()->klass != GIT_ERROR_NOMEMORY)
error = GIT_EINVALIDSPEC;
return error;
@@ -168,7 +168,7 @@ static int get_check_cert(int *out, git_repository *repo)
static int canonicalize_url(git_buf *out, const char *in)
{
if (in == NULL || strlen(in) == 0) {
- giterr_set(GITERR_INVALID, "cannot set empty URL");
+ git_error_set(GIT_ERROR_INVALID, "cannot set empty URL");
return GIT_EINVALIDSPEC;
}
@@ -212,7 +212,7 @@ static int ensure_remote_doesnot_exist(git_repository *repo, const char *name)
git_remote_free(remote);
- giterr_set(GITERR_CONFIG, "remote '%s' already exists", name);
+ git_error_set(GIT_ERROR_CONFIG, "remote '%s' already exists", name);
return GIT_EEXISTS;
}
@@ -240,7 +240,7 @@ int git_remote_create_with_opts(git_remote **out, const char *url, const git_rem
opts = &dummy_opts;
}
- GITERR_CHECK_VERSION(opts, GIT_REMOTE_CREATE_OPTIONS_VERSION, "git_remote_create_options");
+ GIT_ERROR_CHECK_VERSION(opts, GIT_REMOTE_CREATE_OPTIONS_VERSION, "git_remote_create_options");
if (opts->name != NULL) {
if ((error = ensure_remote_name_is_valid(opts->name)) < 0)
@@ -257,7 +257,7 @@ int git_remote_create_with_opts(git_remote **out, const char *url, const git_rem
}
remote = git__calloc(1, sizeof(git_remote));
- GITERR_CHECK_ALLOC(remote);
+ GIT_ERROR_CHECK_ALLOC(remote);
remote->repo = opts->repository;
@@ -270,11 +270,11 @@ int git_remote_create_with_opts(git_remote **out, const char *url, const git_rem
} else {
remote->url = git__strdup(canonical_url.ptr);
}
- GITERR_CHECK_ALLOC(remote->url);
+ GIT_ERROR_CHECK_ALLOC(remote->url);
if (opts->name != NULL) {
remote->name = git__strdup(opts->name);
- GITERR_CHECK_ALLOC(remote->name);
+ GIT_ERROR_CHECK_ALLOC(remote->name);
if (opts->repository &&
((error = git_buf_printf(&var, CONFIG_URL_FMT, opts->name)) < 0 ||
@@ -393,21 +393,21 @@ int git_remote_dup(git_remote **dest, git_remote *source)
int error = 0;
git_refspec *spec;
git_remote *remote = git__calloc(1, sizeof(git_remote));
- GITERR_CHECK_ALLOC(remote);
+ GIT_ERROR_CHECK_ALLOC(remote);
if (source->name != NULL) {
remote->name = git__strdup(source->name);
- GITERR_CHECK_ALLOC(remote->name);
+ GIT_ERROR_CHECK_ALLOC(remote->name);
}
if (source->url != NULL) {
remote->url = git__strdup(source->url);
- GITERR_CHECK_ALLOC(remote->url);
+ GIT_ERROR_CHECK_ALLOC(remote->url);
}
if (source->pushurl != NULL) {
remote->pushurl = git__strdup(source->pushurl);
- GITERR_CHECK_ALLOC(remote->pushurl);
+ GIT_ERROR_CHECK_ALLOC(remote->pushurl);
}
remote->repo = source->repo;
@@ -466,7 +466,7 @@ static int get_optional_config(
*found = !error;
if (error == GIT_ENOTFOUND) {
- giterr_clear();
+ git_error_clear();
error = 0;
}
@@ -492,10 +492,10 @@ int git_remote_lookup(git_remote **out, git_repository *repo, const char *name)
return error;
remote = git__calloc(1, sizeof(git_remote));
- GITERR_CHECK_ALLOC(remote);
+ GIT_ERROR_CHECK_ALLOC(remote);
remote->name = git__strdup(name);
- GITERR_CHECK_ALLOC(remote->name);
+ GIT_ERROR_CHECK_ALLOC(remote->name);
if (git_vector_init(&remote->refs, 32, NULL) < 0 ||
git_vector_init(&remote->refspecs, 2, NULL) < 0 ||
@@ -518,7 +518,7 @@ int git_remote_lookup(git_remote **out, git_repository *repo, const char *name)
if (found && strlen(val) > 0) {
remote->url = apply_insteadof(config, val, GIT_DIRECTION_FETCH);
- GITERR_CHECK_ALLOC(remote->url);
+ GIT_ERROR_CHECK_ALLOC(remote->url);
}
val = NULL;
@@ -532,13 +532,13 @@ int git_remote_lookup(git_remote **out, git_repository *repo, const char *name)
if (!optional_setting_found) {
error = GIT_ENOTFOUND;
- giterr_set(GITERR_CONFIG, "remote '%s' does not exist", name);
+ git_error_set(GIT_ERROR_CONFIG, "remote '%s' does not exist", name);
goto cleanup;
}
if (found && strlen(val) > 0) {
remote->pushurl = apply_insteadof(config, val, GIT_DIRECTION_PUSH);
- GITERR_CHECK_ALLOC(remote->pushurl);
+ GIT_ERROR_CHECK_ALLOC(remote->pushurl);
}
data.remote = remote;
@@ -588,11 +588,11 @@ static int lookup_remote_prune_config(git_remote *remote, git_config *config, co
if ((error = git_config_get_bool(&remote->prune_refs, config, git_buf_cstr(&buf))) < 0) {
if (error == GIT_ENOTFOUND) {
- giterr_clear();
+ git_error_clear();
if ((error = git_config_get_bool(&remote->prune_refs, config, "fetch.prune")) < 0) {
if (error == GIT_ENOTFOUND) {
- giterr_clear();
+ git_error_clear();
error = 0;
}
}
@@ -717,20 +717,20 @@ int git_remote__connect(git_remote *remote, git_direction direction, const git_r
assert(remote);
if (callbacks) {
- GITERR_CHECK_VERSION(callbacks, GIT_REMOTE_CALLBACKS_VERSION, "git_remote_callbacks");
+ GIT_ERROR_CHECK_VERSION(callbacks, GIT_REMOTE_CALLBACKS_VERSION, "git_remote_callbacks");
credentials = callbacks->credentials;
transport = callbacks->transport;
payload = callbacks->payload;
}
if (conn->proxy)
- GITERR_CHECK_VERSION(conn->proxy, GIT_PROXY_OPTIONS_VERSION, "git_proxy_options");
+ GIT_ERROR_CHECK_VERSION(conn->proxy, GIT_PROXY_OPTIONS_VERSION, "git_proxy_options");
t = remote->transport;
url = git_remote__urlfordirection(remote, direction);
if (url == NULL) {
- giterr_set(GITERR_INVALID,
+ git_error_set(GIT_ERROR_INVALID,
"Malformed remote '%s' - missing %s URL",
remote->name ? remote->name : "(anonymous)",
direction == GIT_DIRECTION_FETCH ? "fetch" : "push");
@@ -783,7 +783,7 @@ int git_remote_ls(const git_remote_head ***out, size_t *size, git_remote *remote
assert(remote);
if (!remote->transport) {
- giterr_set(GITERR_NET, "this remote has never connected");
+ git_error_set(GIT_ERROR_NET, "this remote has never connected");
return -1;
}
@@ -847,7 +847,7 @@ int git_remote__get_http_proxy(git_remote *remote, bool use_ssl, char **proxy_ur
if (error < 0) {
if (error == GIT_ENOTFOUND) {
- giterr_clear();
+ git_error_clear();
error = 0;
}
@@ -857,7 +857,7 @@ int git_remote__get_http_proxy(git_remote *remote, bool use_ssl, char **proxy_ur
*proxy_url = git_buf_detach(&val);
found:
- GITERR_CHECK_ALLOC(*proxy_url);
+ GIT_ERROR_CHECK_ALLOC(*proxy_url);
git_config_entry_free(ce);
return 0;
@@ -929,15 +929,15 @@ int git_remote_download(git_remote *remote, const git_strarray *refspecs, const
assert(remote);
if (!remote->repo) {
- giterr_set(GITERR_INVALID, "cannot download detached remote");
+ git_error_set(GIT_ERROR_INVALID, "cannot download detached remote");
return -1;
}
if (opts) {
- GITERR_CHECK_VERSION(&opts->callbacks, GIT_REMOTE_CALLBACKS_VERSION, "git_remote_callbacks");
+ GIT_ERROR_CHECK_VERSION(&opts->callbacks, GIT_REMOTE_CALLBACKS_VERSION, "git_remote_callbacks");
cbs = &opts->callbacks;
custom_headers = &opts->custom_headers;
- GITERR_CHECK_VERSION(&opts->proxy_opts, GIT_PROXY_OPTIONS_VERSION, "git_proxy_options");
+ GIT_ERROR_CHECK_VERSION(&opts->proxy_opts, GIT_PROXY_OPTIONS_VERSION, "git_proxy_options");
proxy = &opts->proxy_opts;
}
@@ -1009,12 +1009,12 @@ int git_remote_fetch(
git_remote_connection_opts conn = GIT_REMOTE_CONNECTION_OPTIONS_INIT;
if (opts) {
- GITERR_CHECK_VERSION(&opts->callbacks, GIT_REMOTE_CALLBACKS_VERSION, "git_remote_callbacks");
+ GIT_ERROR_CHECK_VERSION(&opts->callbacks, GIT_REMOTE_CALLBACKS_VERSION, "git_remote_callbacks");
cbs = &opts->callbacks;
conn.custom_headers = &opts->custom_headers;
update_fetchhead = opts->update_fetchhead;
tagopt = opts->download_tags;
- GITERR_CHECK_VERSION(&opts->proxy_opts, GIT_PROXY_OPTIONS_VERSION, "git_proxy_options");
+ GIT_ERROR_CHECK_VERSION(&opts->proxy_opts, GIT_PROXY_OPTIONS_VERSION, "git_proxy_options");
conn.proxy = &opts->proxy_opts;
}
@@ -1097,7 +1097,7 @@ static int ref_to_update(int *update, git_buf *remote_name, git_remote *remote,
(error = git_refspec_rtransform(remote_name, spec, upstream_name.ptr)) < 0) {
/* Not an error if there is no upstream */
if (error == GIT_ENOTFOUND) {
- giterr_clear();
+ git_error_clear();
error = 0;
}
@@ -1232,7 +1232,7 @@ static int prune_candidates(git_vector *candidates, git_remote *remote)
continue;
refname_dup = git__strdup(refname);
- GITERR_CHECK_ALLOC(refname_dup);
+ GIT_ERROR_CHECK_ALLOC(refname_dup);
if ((error = git_vector_insert(candidates, refname_dup)) < 0)
goto out;
@@ -1262,7 +1262,7 @@ int git_remote_prune(git_remote *remote, const git_remote_callbacks *callbacks)
git_oid zero_id = {{ 0 }};
if (callbacks)
- GITERR_CHECK_VERSION(callbacks, GIT_REMOTE_CALLBACKS_VERSION, "git_remote_callbacks");
+ GIT_ERROR_CHECK_VERSION(callbacks, GIT_REMOTE_CALLBACKS_VERSION, "git_remote_callbacks");
if ((error = ls_to_vector(&remote_refs, remote)) < 0)
goto cleanup;
@@ -1737,7 +1737,7 @@ static int remote_list_cb(const git_config_entry *entry, void *payload)
remote_name = git__strndup(name, namelen - 4); /* strip ".url" */
else
remote_name = git__strndup(name, namelen - 8); /* strip ".pushurl" */
- GITERR_CHECK_ALLOC(remote_name);
+ GIT_ERROR_CHECK_ALLOC(remote_name);
return git_vector_insert(list, remote_name);
}
@@ -1811,7 +1811,7 @@ int git_remote_set_autotag(git_repository *repo, const char *remote, git_remote_
error = 0;
break;
default:
- giterr_set(GITERR_INVALID, "invalid value for the tagopt setting");
+ git_error_set(GIT_ERROR_INVALID, "invalid value for the tagopt setting");
error = -1;
}
@@ -2005,7 +2005,7 @@ static int rename_fetch_refspecs(git_vector *problems, git_remote *remote, const
char *dup;
dup = git__strdup(spec->string);
- GITERR_CHECK_ALLOC(dup);
+ GIT_ERROR_CHECK_ALLOC(dup);
if ((error = git_vector_insert(problems, dup)) < 0)
break;
@@ -2101,7 +2101,7 @@ int git_remote_is_valid_name(
git_buf_dispose(&buf);
git_refspec__dispose(&refspec);
- giterr_clear();
+ git_error_clear();
return error == 0;
}
@@ -2256,7 +2256,7 @@ static int remove_branch_config_related_entries(
if ((error = git_config_delete_entry(config, git_buf_cstr(&buf))) < 0) {
if (error != GIT_ENOTFOUND)
break;
- giterr_clear();
+ git_error_clear();
}
git_buf_clear(&buf);
@@ -2266,7 +2266,7 @@ static int remove_branch_config_related_entries(
if ((error = git_config_delete_entry(config, git_buf_cstr(&buf))) < 0) {
if (error != GIT_ENOTFOUND)
break;
- giterr_clear();
+ git_error_clear();
}
}
@@ -2432,7 +2432,7 @@ int git_remote_upload(git_remote *remote, const git_strarray *refspecs, const gi
assert(remote);
if (!remote->repo) {
- giterr_set(GITERR_INVALID, "cannot download detached remote");
+ git_error_set(GIT_ERROR_INVALID, "cannot download detached remote");
return -1;
}
@@ -2498,15 +2498,15 @@ int git_remote_push(git_remote *remote, const git_strarray *refspecs, const git_
assert(remote);
if (!remote->repo) {
- giterr_set(GITERR_INVALID, "cannot download detached remote");
+ git_error_set(GIT_ERROR_INVALID, "cannot download detached remote");
return -1;
}
if (opts) {
- GITERR_CHECK_VERSION(&opts->callbacks, GIT_REMOTE_CALLBACKS_VERSION, "git_remote_callbacks");
+ GIT_ERROR_CHECK_VERSION(&opts->callbacks, GIT_REMOTE_CALLBACKS_VERSION, "git_remote_callbacks");
cbs = &opts->callbacks;
custom_headers = &opts->custom_headers;
- GITERR_CHECK_VERSION(&opts->proxy_opts, GIT_PROXY_OPTIONS_VERSION, "git_proxy_options");
+ GIT_ERROR_CHECK_VERSION(&opts->proxy_opts, GIT_PROXY_OPTIONS_VERSION, "git_proxy_options");
proxy = &opts->proxy_opts;
}
diff --git a/src/repository.c b/src/repository.c
index 0f38f88..26936a8 100644
--- a/src/repository.c
+++ b/src/repository.c
@@ -256,7 +256,7 @@ int git_repository_new(git_repository **out)
git_repository *repo;
*out = repo = repository_alloc();
- GITERR_CHECK_ALLOC(repo);
+ GIT_ERROR_CHECK_ALLOC(repo);
repo->is_bare = 1;
repo->is_worktree = 0;
@@ -331,7 +331,7 @@ static int load_workdir(git_repository *repo, git_config *config, git_buf *paren
repo->workdir = git_buf_detach(&worktree);
}
- GITERR_CHECK_ALLOC(repo->workdir);
+ GIT_ERROR_CHECK_ALLOC(repo->workdir);
cleanup:
git_buf_dispose(&path);
git_config_entry_free(ce);
@@ -413,7 +413,7 @@ static int read_gitfile(git_buf *path_out, const char *file_path)
if (git_buf_len(&file) <= prefix_len ||
memcmp(git_buf_cstr(&file), GIT_FILE_CONTENT_PREFIX, prefix_len) != 0)
{
- giterr_set(GITERR_REPOSITORY,
+ git_error_set(GIT_ERROR_REPOSITORY,
"the `.git` file at '%s' is malformed", file_path);
error = -1;
}
@@ -551,7 +551,7 @@ static int find_repo(
/* If we didn't find the repository, and we don't have any other error
* to report, report that. */
if (!git_buf_len(gitdir_path) && !error) {
- giterr_set(GITERR_REPOSITORY,
+ git_error_set(GIT_ERROR_REPOSITORY,
"could not find repository from '%s'", start_path);
error = GIT_ENOTFOUND;
}
@@ -576,17 +576,17 @@ int git_repository_open_bare(
if (!valid_repository_path(&path, &common_path)) {
git_buf_dispose(&path);
git_buf_dispose(&common_path);
- giterr_set(GITERR_REPOSITORY, "path is not a repository: %s", bare_path);
+ git_error_set(GIT_ERROR_REPOSITORY, "path is not a repository: %s", bare_path);
return GIT_ENOTFOUND;
}
repo = repository_alloc();
- GITERR_CHECK_ALLOC(repo);
+ GIT_ERROR_CHECK_ALLOC(repo);
repo->gitdir = git_buf_detach(&path);
- GITERR_CHECK_ALLOC(repo->gitdir);
+ GIT_ERROR_CHECK_ALLOC(repo->gitdir);
repo->commondir = git_buf_detach(&common_path);
- GITERR_CHECK_ALLOC(repo->commondir);
+ GIT_ERROR_CHECK_ALLOC(repo->commondir);
/* of course we're bare! */
repo->is_bare = 1;
@@ -620,7 +620,7 @@ static int _git_repository_open_ext_from_env(
if (!start_path) {
error = git__getenv(&dir_buf, "GIT_DIR");
if (error == GIT_ENOTFOUND) {
- giterr_clear();
+ git_error_clear();
start_path = ".";
} else if (error < 0)
goto error;
@@ -633,7 +633,7 @@ static int _git_repository_open_ext_from_env(
error = git__getenv(&ceiling_dirs_buf, "GIT_CEILING_DIRECTORIES");
if (error == GIT_ENOTFOUND)
- giterr_clear();
+ git_error_clear();
else if (error < 0)
goto error;
else
@@ -641,7 +641,7 @@ static int _git_repository_open_ext_from_env(
error = git__getenv(&across_fs_buf, "GIT_DISCOVERY_ACROSS_FILESYSTEM");
if (error == GIT_ENOTFOUND)
- giterr_clear();
+ git_error_clear();
else if (error < 0)
goto error;
else {
@@ -655,7 +655,7 @@ static int _git_repository_open_ext_from_env(
error = git__getenv(&index_file_buf, "GIT_INDEX_FILE");
if (error == GIT_ENOTFOUND)
- giterr_clear();
+ git_error_clear();
else if (error < 0)
goto error;
else {
@@ -666,13 +666,13 @@ static int _git_repository_open_ext_from_env(
error = git__getenv(&namespace_buf, "GIT_NAMESPACE");
if (error == GIT_ENOTFOUND)
- giterr_clear();
+ git_error_clear();
else if (error < 0)
goto error;
error = git__getenv(&object_dir_buf, "GIT_OBJECT_DIRECTORY");
if (error == GIT_ENOTFOUND)
- giterr_clear();
+ git_error_clear();
else if (error < 0)
goto error;
else {
@@ -683,22 +683,22 @@ static int _git_repository_open_ext_from_env(
error = git__getenv(&work_tree_buf, "GIT_WORK_TREE");
if (error == GIT_ENOTFOUND)
- giterr_clear();
+ git_error_clear();
else if (error < 0)
goto error;
else {
- giterr_set(GITERR_INVALID, "GIT_WORK_TREE unimplemented");
+ git_error_set(GIT_ERROR_INVALID, "GIT_WORK_TREE unimplemented");
error = GIT_ERROR;
goto error;
}
error = git__getenv(&work_tree_buf, "GIT_COMMON_DIR");
if (error == GIT_ENOTFOUND)
- giterr_clear();
+ git_error_clear();
else if (error < 0)
goto error;
else {
- giterr_set(GITERR_INVALID, "GIT_COMMON_DIR unimplemented");
+ git_error_set(GIT_ERROR_INVALID, "GIT_COMMON_DIR unimplemented");
error = GIT_ERROR;
goto error;
}
@@ -712,7 +712,7 @@ static int _git_repository_open_ext_from_env(
error = git__getenv(&alts_buf, "GIT_ALTERNATE_OBJECT_DIRECTORIES");
if (error == GIT_ENOTFOUND) {
- giterr_clear();
+ git_error_clear();
error = 0;
} else if (error < 0)
goto error;
@@ -815,18 +815,18 @@ int git_repository_open_ext(
return error;
repo = repository_alloc();
- GITERR_CHECK_ALLOC(repo);
+ GIT_ERROR_CHECK_ALLOC(repo);
repo->gitdir = git_buf_detach(&gitdir);
- GITERR_CHECK_ALLOC(repo->gitdir);
+ GIT_ERROR_CHECK_ALLOC(repo->gitdir);
if (gitlink.size) {
repo->gitlink = git_buf_detach(&gitlink);
- GITERR_CHECK_ALLOC(repo->gitlink);
+ GIT_ERROR_CHECK_ALLOC(repo->gitlink);
}
if (commondir.size) {
repo->commondir = git_buf_detach(&commondir);
- GITERR_CHECK_ALLOC(repo->commondir);
+ GIT_ERROR_CHECK_ALLOC(repo->commondir);
}
if ((error = repo_is_worktree(&is_worktree, repo)) < 0)
@@ -909,7 +909,7 @@ int git_repository_wrap_odb(git_repository **repo_out, git_odb *odb)
git_repository *repo;
repo = repository_alloc();
- GITERR_CHECK_ALLOC(repo);
+ GIT_ERROR_CHECK_ALLOC(repo);
git_repository_set_odb(repo, odb);
*repo_out = repo;
@@ -983,7 +983,7 @@ static int load_config(
error != GIT_ENOTFOUND)
goto on_error;
- giterr_clear(); /* clear any lingering ENOTFOUND errors */
+ git_error_clear(); /* clear any lingering ENOTFOUND errors */
*out = cfg;
return 0;
@@ -1344,7 +1344,7 @@ static int check_repositoryformatversion(git_config *config)
return -1;
if (GIT_REPO_VERSION < version) {
- giterr_set(GITERR_REPOSITORY,
+ git_error_set(GIT_ERROR_REPOSITORY,
"unsupported repository version %d. Only versions up to %d are supported.",
version, GIT_REPO_VERSION);
return -1;
@@ -1474,12 +1474,12 @@ static int create_empty_file(const char *path, mode_t mode)
int fd;
if ((fd = p_creat(path, mode)) < 0) {
- giterr_set(GITERR_OS, "error while creating '%s'", path);
+ git_error_set(GIT_ERROR_OS, "error while creating '%s'", path);
return -1;
}
if (p_close(fd) < 0) {
- giterr_set(GITERR_OS, "error while closing '%s'", path);
+ git_error_set(GIT_ERROR_OS, "error while closing '%s'", path);
return -1;
}
@@ -1514,7 +1514,7 @@ static int repo_local_config(
return error;
if (git_config_open_level(out, parent, GIT_CONFIG_LEVEL_LOCAL) < 0) {
- giterr_clear();
+ git_error_clear();
if (!(error = git_config_add_file_ondisk(
parent, cfg_path, GIT_CONFIG_LEVEL_LOCAL, repo, false)))
@@ -1546,14 +1546,14 @@ static int repo_init_fs_configs(
if ((error = git_config_set_bool(cfg, "core.symlinks", false)) < 0)
return error;
} else if (git_config_delete_entry(cfg, "core.symlinks") < 0)
- giterr_clear();
+ git_error_clear();
if (update_ignorecase) {
if (is_filesystem_case_insensitive(repo_dir)) {
if ((error = git_config_set_bool(cfg, "core.ignorecase", true)) < 0)
return error;
} else if (git_config_delete_entry(cfg, "core.ignorecase") < 0)
- giterr_clear();
+ git_error_clear();
}
#ifdef GIT_USE_ICONV
@@ -1610,7 +1610,7 @@ static int repo_init_config(
SET_REPO_CONFIG(string, "core.worktree", worktree_path.ptr);
} else if (is_reinit) {
if (git_config_delete_entry(config, "core.worktree") < 0)
- giterr_clear();
+ git_error_clear();
}
}
@@ -1638,7 +1638,7 @@ static int repo_reinit_submodule_fs(git_submodule *sm, const char *n, void *p)
if (git_submodule_open(&smrepo, sm) < 0 ||
git_repository_reinit_filesystem(smrepo, true) < 0)
- giterr_clear();
+ git_error_clear();
git_repository_free(smrepo);
return 0;
@@ -1707,7 +1707,7 @@ static int repo_write_template(
git_buf_dispose(&path);
if (error)
- giterr_set(GITERR_OS,
+ git_error_set(GIT_ERROR_OS,
"failed to initialize repository with template '%s'", file);
return error;
@@ -1738,7 +1738,7 @@ static int repo_write_gitlink(
goto cleanup;
if (!p_stat(buf.ptr, &st) && !S_ISREG(st.st_mode)) {
- giterr_set(GITERR_REPOSITORY,
+ git_error_set(GIT_ERROR_REPOSITORY,
"cannot overwrite gitlink file into path '%s'", in_dir);
error = GIT_EEXISTS;
goto cleanup;
@@ -1792,7 +1792,7 @@ static int repo_init_structure(
#ifdef GIT_WIN32
if ((opts->flags & GIT_REPOSITORY_INIT__HAS_DOTGIT) != 0) {
if (git_win32__set_hidden(repo_dir, true) < 0) {
- giterr_set(GITERR_OS,
+ git_error_set(GIT_ERROR_OS,
"failed to mark Git repository folder as hidden");
return -1;
}
@@ -1819,7 +1819,7 @@ static int repo_init_structure(
else if ((error = git_config_open_default(&cfg)) >= 0) {
if (!git_config_get_path(&template_buf, cfg, "init.templatedir"))
tdir = template_buf.ptr;
- giterr_clear();
+ git_error_clear();
}
if (!tdir) {
@@ -1851,7 +1851,7 @@ static int repo_init_structure(
return error;
/* if template was default, ignore error and use internal */
- giterr_clear();
+ git_error_clear();
external_tpl = false;
error = 0;
}
@@ -1953,7 +1953,7 @@ static int repo_init_directories(
if (git_path_dirname_r(wd_path, repo_path->ptr) < 0)
return -1;
} else {
- giterr_set(GITERR_REPOSITORY, "cannot pick working directory"
+ git_error_set(GIT_ERROR_REPOSITORY, "cannot pick working directory"
" for non-bare repository that isn't a '.git' directory");
return -1;
}
@@ -2063,7 +2063,7 @@ int git_repository_init_ext(
assert(out && given_repo && opts);
- GITERR_CHECK_VERSION(opts, GIT_REPOSITORY_INIT_OPTIONS_VERSION, "git_repository_init_options");
+ GIT_ERROR_CHECK_VERSION(opts, GIT_REPOSITORY_INIT_OPTIONS_VERSION, "git_repository_init_options");
error = repo_init_directories(&repo_path, &wd_path, given_repo, opts);
if (error < 0)
@@ -2073,7 +2073,7 @@ int git_repository_init_ext(
if (valid_repository_path(&repo_path, &common_path)) {
if ((opts->flags & GIT_REPOSITORY_INIT_NO_REINIT) != 0) {
- giterr_set(GITERR_REPOSITORY,
+ git_error_set(GIT_ERROR_REPOSITORY,
"attempt to reinitialize '%s'", given_repo);
error = GIT_EEXISTS;
goto cleanup;
@@ -2251,7 +2251,7 @@ int git_repository_head_unborn(git_repository *repo)
git_reference_free(ref);
if (error == GIT_EUNBORNBRANCH) {
- giterr_clear();
+ git_error_clear();
return 1;
}
@@ -2315,12 +2315,12 @@ int git_repository_item_path(git_buf *out, const git_repository *repo, git_repos
parent = git_repository_commondir(repo);
break;
default:
- giterr_set(GITERR_INVALID, "invalid item directory");
+ git_error_set(GIT_ERROR_INVALID, "invalid item directory");
return -1;
}
if (parent == NULL) {
- giterr_set(GITERR_INVALID, "path cannot exist in repository");
+ git_error_set(GIT_ERROR_INVALID, "path cannot exist in repository");
return GIT_ENOTFOUND;
}
@@ -2499,7 +2499,7 @@ int git_repository_message(git_buf *out, git_repository *repo)
if ((error = p_stat(git_buf_cstr(&path), &st)) < 0) {
if (errno == ENOENT)
error = GIT_ENOTFOUND;
- giterr_set(GITERR_OS, "could not access message file");
+ git_error_set(GIT_ERROR_OS, "could not access message file");
} else {
error = git_futils_readbuffer(out, git_buf_cstr(&path));
}
@@ -2577,7 +2577,7 @@ int git_repository_hashfile(
}
if (!git__is_sizet(len)) {
- giterr_set(GITERR_OS, "file size overflow for 32-bit systems");
+ git_error_set(GIT_ERROR_OS, "file size overflow for 32-bit systems");
error = -1;
goto cleanup;
}
@@ -2674,7 +2674,7 @@ int git_repository_set_head(
if (ref && current->type == GIT_REFERENCE_SYMBOLIC && git__strcmp(current->target.symbolic, ref->name) &&
git_reference_is_branch(ref) && git_branch_is_checked_out(ref)) {
- giterr_set(GITERR_REPOSITORY, "cannot set HEAD to reference '%s' as it is the current HEAD "
+ git_error_set(GIT_ERROR_REPOSITORY, "cannot set HEAD to reference '%s' as it is the current HEAD "
"of a linked repository.", git_reference_name(ref));
error = -1;
goto cleanup;
@@ -2854,7 +2854,7 @@ int git_repository_is_shallow(git_repository *repo)
git_buf_dispose(&path);
if (error == GIT_ENOTFOUND) {
- giterr_clear();
+ git_error_clear();
return 0;
}
@@ -2886,12 +2886,12 @@ int git_repository_set_ident(git_repository *repo, const char *name, const char
if (name) {
tmp_name = git__strdup(name);
- GITERR_CHECK_ALLOC(tmp_name);
+ GIT_ERROR_CHECK_ALLOC(tmp_name);
}
if (email) {
tmp_email = git__strdup(email);
- GITERR_CHECK_ALLOC(tmp_email);
+ GIT_ERROR_CHECK_ALLOC(tmp_email);
}
tmp_name = git__swap(repo->ident_name, tmp_name);
diff --git a/src/repository.h b/src/repository.h
index 1a72717..1edcc84 100644
--- a/src/repository.h
+++ b/src/repository.h
@@ -214,8 +214,8 @@ GIT_INLINE(int) git_repository__ensure_not_bare(
if (!git_repository_is_bare(repo))
return 0;
- giterr_set(
- GITERR_REPOSITORY,
+ git_error_set(
+ GIT_ERROR_REPOSITORY,
"cannot %s. This operation is not allowed against bare repositories.",
operation_name);
diff --git a/src/reset.c b/src/reset.c
index b8d69e7..ca6a5bd 100644
--- a/src/reset.c
+++ b/src/reset.c
@@ -42,7 +42,7 @@ int git_reset_default(
if (target) {
if (git_object_owner(target) != repo) {
- giterr_set(GITERR_OBJECT,
+ git_error_set(GIT_ERROR_OBJECT,
"%s_default - The given target does not belong to this repository.", ERROR_MSG);
return -1;
}
@@ -70,7 +70,7 @@ int git_reset_default(
error = git_index_conflict_remove(index, delta->old_file.path);
if (error < 0) {
if (delta->status == GIT_DELTA_ADDED && error == GIT_ENOTFOUND)
- giterr_clear();
+ git_error_clear();
else
goto cleanup;
}
@@ -119,7 +119,7 @@ static int reset(
opts = *checkout_opts;
if (git_object_owner(target) != repo) {
- giterr_set(GITERR_OBJECT,
+ git_error_set(GIT_ERROR_OBJECT,
"%s - The given target does not belong to this repository.", ERROR_MSG);
return -1;
}
@@ -138,7 +138,7 @@ static int reset(
(git_repository_state(repo) == GIT_REPOSITORY_STATE_MERGE ||
git_index_has_conflicts(index)))
{
- giterr_set(GITERR_OBJECT, "%s (soft) in the middle of a merge", ERROR_MSG);
+ git_error_set(GIT_ERROR_OBJECT, "%s (soft) in the middle of a merge", ERROR_MSG);
error = GIT_EUNMERGED;
goto cleanup;
}
@@ -167,7 +167,7 @@ static int reset(
goto cleanup;
if ((error = git_repository_state_cleanup(repo)) < 0) {
- giterr_set(GITERR_INDEX, "%s - failed to clean up merge data", ERROR_MSG);
+ git_error_set(GIT_ERROR_INDEX, "%s - failed to clean up merge data", ERROR_MSG);
goto cleanup;
}
}
diff --git a/src/revert.c b/src/revert.c
index 32c8a39..eb71a68 100644
--- a/src/revert.c
+++ b/src/revert.c
@@ -112,7 +112,7 @@ static int revert_seterr(git_commit *commit, const char *fmt)
git_oid_fmt(commit_oidstr, git_commit_id(commit));
commit_oidstr[GIT_OID_HEXSZ] = '\0';
- giterr_set(GITERR_REVERT, fmt, commit_oidstr);
+ git_error_set(GIT_ERROR_REVERT, fmt, commit_oidstr);
return -1;
}
@@ -182,7 +182,7 @@ int git_revert(
assert(repo && commit);
- GITERR_CHECK_VERSION(given_opts, GIT_REVERT_OPTIONS_VERSION, "git_revert_options");
+ GIT_ERROR_CHECK_VERSION(given_opts, GIT_REVERT_OPTIONS_VERSION, "git_revert_options");
if ((error = git_repository__ensure_not_bare(repo, "revert")) < 0)
return error;
diff --git a/src/revparse.c b/src/revparse.c
index 78d879b..50ee31c 100644
--- a/src/revparse.c
+++ b/src/revparse.c
@@ -47,7 +47,7 @@ static int build_regex(regex_t *regex, const char *pattern)
int error;
if (*pattern == '\0') {
- giterr_set(GITERR_REGEX, "empty pattern");
+ git_error_set(GIT_ERROR_REGEX, "empty pattern");
return GIT_EINVALIDSPEC;
}
@@ -55,7 +55,7 @@ static int build_regex(regex_t *regex, const char *pattern)
if (!error)
return 0;
- error = giterr_set_regex(regex, error);
+ error = git_error_set_regex(regex, error);
regfree(regex);
@@ -119,7 +119,7 @@ static int revparse_lookup_object(
if ((error = maybe_describe(object_out, repo, spec)) != GIT_ENOTFOUND)
return error;
- giterr_set(GITERR_REFERENCE, "revspec '%s' not found", spec);
+ git_error_set(GIT_ERROR_REFERENCE, "revspec '%s' not found", spec);
return GIT_ENOTFOUND;
}
@@ -245,8 +245,8 @@ static int retrieve_oid_from_reflog(git_oid *oid, git_reference *ref, size_t ide
return 0;
notfound:
- giterr_set(
- GITERR_REFERENCE,
+ git_error_set(
+ GIT_ERROR_REFERENCE,
"reflog for '%s' has only %"PRIuZ" entries, asked for %"PRIuZ,
git_reference_name(ref), numentries, identifier);
@@ -759,7 +759,7 @@ int revparse__ext(
* TODO: support merge-stage path lookup (":2:Makefile")
* and plain index blob lookup (:i-am/a/blob)
*/
- giterr_set(GITERR_INVALID, "unimplemented");
+ git_error_set(GIT_ERROR_INVALID, "unimplemented");
error = GIT_ERROR;
goto cleanup;
}
@@ -814,7 +814,7 @@ int revparse__ext(
cleanup:
if (error) {
if (error == GIT_EINVALIDSPEC)
- giterr_set(GITERR_INVALID,
+ git_error_set(GIT_ERROR_INVALID,
"failed to parse revision specifier - Invalid pattern '%s'", spec);
git_object_free(base_rev);
@@ -898,7 +898,7 @@ int git_revparse(
* allowed.
*/
if (!git__strcmp(spec, "..")) {
- giterr_set(GITERR_INVALID, "Invalid pattern '..'");
+ git_error_set(GIT_ERROR_INVALID, "Invalid pattern '..'");
return GIT_EINVALIDSPEC;
}
diff --git a/src/revwalk.c b/src/revwalk.c
index f3442ae..1e3a5f2 100644
--- a/src/revwalk.c
+++ b/src/revwalk.c
@@ -61,7 +61,7 @@ static int push_commit(git_revwalk *walk, const git_oid *oid, int uninteresting,
if (from_glob)
return 0;
- giterr_set(GITERR_INVALID, "object is not a committish");
+ git_error_set(GIT_ERROR_INVALID, "object is not a committish");
return -1;
}
if (error < 0)
@@ -88,7 +88,7 @@ static int push_commit(git_revwalk *walk, const git_oid *oid, int uninteresting,
commit->uninteresting = uninteresting;
list = walk->user_input;
if (git_commit_list_insert(commit, &list) == NULL) {
- giterr_set_oom();
+ git_error_set_oom();
return -1;
}
@@ -135,7 +135,7 @@ static int push_glob(git_revwalk *walk, const char *glob, int hide)
git_buf_joinpath(&buf, GIT_REFS_DIR, glob);
else
git_buf_puts(&buf, glob);
- GITERR_CHECK_ALLOC_BUF(&buf);
+ GIT_ERROR_CHECK_ALLOC_BUF(&buf);
/* If no '?', '*' or '[' exist, we append '/ *' to the glob */
wildcard = strcspn(glob, "?*[");
@@ -200,7 +200,7 @@ int git_revwalk_push_range(git_revwalk *walk, const char *range)
if (revspec.flags & GIT_REVPARSE_MERGE_BASE) {
/* TODO: support "<commit>...<commit>" */
- giterr_set(GITERR_INVALID, "symmetric differences not implemented in revwalk");
+ git_error_set(GIT_ERROR_INVALID, "symmetric differences not implemented in revwalk");
return GIT_EINVALIDSPEC;
}
@@ -243,7 +243,7 @@ static int revwalk_next_timesort(git_commit_list_node **object_out, git_revwalk
}
}
- giterr_clear();
+ git_error_clear();
return GIT_ITEROVER;
}
@@ -451,7 +451,7 @@ static int get_revision(git_commit_list_node **out, git_revwalk *walk, git_commi
commit = git_commit_list_pop(list);
if (!commit) {
- giterr_clear();
+ git_error_clear();
return GIT_ITEROVER;
}
@@ -562,7 +562,7 @@ static int prepare_walk(git_revwalk *walk)
/* If there were no pushes, we know that the walk is already over */
if (!walk->did_push) {
- giterr_clear();
+ git_error_clear();
return GIT_ITEROVER;
}
@@ -624,10 +624,10 @@ static int prepare_walk(git_revwalk *walk)
int git_revwalk_new(git_revwalk **revwalk_out, git_repository *repo)
{
git_revwalk *walk = git__calloc(1, sizeof(git_revwalk));
- GITERR_CHECK_ALLOC(walk);
+ GIT_ERROR_CHECK_ALLOC(walk);
walk->commits = git_oidmap_alloc();
- GITERR_CHECK_ALLOC(walk->commits);
+ GIT_ERROR_CHECK_ALLOC(walk->commits);
if (git_pqueue_init(&walk->iterator_time, 0, 8, git_commit_list_time_cmp) < 0)
return -1;
@@ -709,7 +709,7 @@ int git_revwalk_next(git_oid *oid, git_revwalk *walk)
if (error == GIT_ITEROVER) {
git_revwalk_reset(walk);
- giterr_clear();
+ git_error_clear();
return GIT_ITEROVER;
}
diff --git a/src/settings.c b/src/settings.c
index d71841a..95cbd89 100644
--- a/src/settings.c
+++ b/src/settings.c
@@ -76,8 +76,8 @@ static int config_level_to_sysdir(int config_level)
val = GIT_SYSDIR_PROGRAMDATA;
break;
default:
- giterr_set(
- GITERR_INVALID, "invalid config path selector %d", config_level);
+ git_error_set(
+ GIT_ERROR_INVALID, "invalid config path selector %d", config_level);
}
return val;
@@ -193,7 +193,7 @@ int git_libgit2_opts(int key, ...)
error = git_mbedtls__set_cert_location(path, 1);
}
#else
- giterr_set(GITERR_SSL, "TLS backend doesn't support certificate locations");
+ git_error_set(GIT_ERROR_SSL, "TLS backend doesn't support certificate locations");
error = -1;
#endif
break;
@@ -201,7 +201,7 @@ int git_libgit2_opts(int key, ...)
git__free(git__user_agent);
git__user_agent = git__strdup(va_arg(ap, const char *));
if (!git__user_agent) {
- giterr_set_oom();
+ git_error_set_oom();
error = -1;
}
@@ -221,12 +221,12 @@ int git_libgit2_opts(int key, ...)
git__free(git__ssl_ciphers);
git__ssl_ciphers = git__strdup(va_arg(ap, const char *));
if (!git__ssl_ciphers) {
- giterr_set_oom();
+ git_error_set_oom();
error = -1;
}
}
#else
- giterr_set(GITERR_SSL, "TLS backend doesn't support custom ciphers");
+ git_error_set(GIT_ERROR_SSL, "TLS backend doesn't support custom ciphers");
error = -1;
#endif
break;
@@ -280,7 +280,7 @@ int git_libgit2_opts(int key, ...)
break;
default:
- giterr_set(GITERR_INVALID, "invalid option key");
+ git_error_set(GIT_ERROR_INVALID, "invalid option key");
error = -1;
}
diff --git a/src/signature.c b/src/signature.c
index 11416d7..f4c8a10 100644
--- a/src/signature.c
+++ b/src/signature.c
@@ -25,7 +25,7 @@ void git_signature_free(git_signature *sig)
static int signature_error(const char *msg)
{
- giterr_set(GITERR_INVALID, "failed to parse signature - %s", msg);
+ git_error_set(GIT_ERROR_INVALID, "failed to parse signature - %s", msg);
return -1;
}
@@ -76,12 +76,12 @@ int git_signature_new(git_signature **sig_out, const char *name, const char *ema
}
p = git__calloc(1, sizeof(git_signature));
- GITERR_CHECK_ALLOC(p);
+ GIT_ERROR_CHECK_ALLOC(p);
p->name = extract_trimmed(name, strlen(name));
- GITERR_CHECK_ALLOC(p->name);
+ GIT_ERROR_CHECK_ALLOC(p->name);
p->email = extract_trimmed(email, strlen(email));
- GITERR_CHECK_ALLOC(p->email);
+ GIT_ERROR_CHECK_ALLOC(p->email);
if (p->name[0] == '\0' || p->email[0] == '\0') {
git_signature_free(p);
@@ -104,13 +104,13 @@ int git_signature_dup(git_signature **dest, const git_signature *source)
return 0;
signature = git__calloc(1, sizeof(git_signature));
- GITERR_CHECK_ALLOC(signature);
+ GIT_ERROR_CHECK_ALLOC(signature);
signature->name = git__strdup(source->name);
- GITERR_CHECK_ALLOC(signature->name);
+ GIT_ERROR_CHECK_ALLOC(signature->name);
signature->email = git__strdup(source->email);
- GITERR_CHECK_ALLOC(signature->email);
+ GIT_ERROR_CHECK_ALLOC(signature->email);
signature->when.time = source->when.time;
signature->when.offset = source->when.offset;
@@ -129,13 +129,13 @@ int git_signature__pdup(git_signature **dest, const git_signature *source, git_p
return 0;
signature = git_pool_mallocz(pool, sizeof(git_signature));
- GITERR_CHECK_ALLOC(signature);
+ GIT_ERROR_CHECK_ALLOC(signature);
signature->name = git_pool_strdup(pool, source->name);
- GITERR_CHECK_ALLOC(signature->name);
+ GIT_ERROR_CHECK_ALLOC(signature->name);
signature->email = git_pool_strdup(pool, source->email);
- GITERR_CHECK_ALLOC(signature->email);
+ GIT_ERROR_CHECK_ALLOC(signature->email);
signature->when.time = source->when.time;
signature->when.offset = source->when.offset;
@@ -284,7 +284,7 @@ int git_signature_from_buffer(git_signature **out, const char *buf)
*out = NULL;
sig = git__calloc(1, sizeof(git_signature));
- GITERR_CHECK_ALLOC(sig);
+ GIT_ERROR_CHECK_ALLOC(sig);
buf_end = buf + strlen(buf);
error = git_signature__parse(sig, &buf, buf_end, NULL, '\0');
diff --git a/src/sortedcache.c b/src/sortedcache.c
index bb42c67..02a685e 100644
--- a/src/sortedcache.c
+++ b/src/sortedcache.c
@@ -20,10 +20,10 @@ int git_sortedcache_new(
pathlen = path ? strlen(path) : 0;
- GITERR_CHECK_ALLOC_ADD(&alloclen, sizeof(git_sortedcache), pathlen);
- GITERR_CHECK_ALLOC_ADD(&alloclen, alloclen, 1);
+ GIT_ERROR_CHECK_ALLOC_ADD(&alloclen, sizeof(git_sortedcache), pathlen);
+ GIT_ERROR_CHECK_ALLOC_ADD(&alloclen, alloclen, 1);
sc = git__calloc(1, alloclen);
- GITERR_CHECK_ALLOC(sc);
+ GIT_ERROR_CHECK_ALLOC(sc);
git_pool_init(&sc->pool, 1);
@@ -32,7 +32,7 @@ int git_sortedcache_new(
goto fail;
if (git_rwlock_init(&sc->lock)) {
- giterr_set(GITERR_OS, "failed to initialize lock");
+ git_error_set(GIT_ERROR_OS, "failed to initialize lock");
goto fail;
}
@@ -167,7 +167,7 @@ int git_sortedcache_wlock(git_sortedcache *sc)
GIT_UNUSED(sc); /* prevent warning when compiled w/o threads */
if (git_rwlock_wrlock(&sc->lock) < 0) {
- giterr_set(GITERR_OS, "unable to acquire write lock on cache");
+ git_error_set(GIT_ERROR_OS, "unable to acquire write lock on cache");
return -1;
}
return 0;
@@ -186,7 +186,7 @@ int git_sortedcache_rlock(git_sortedcache *sc)
GIT_UNUSED(sc); /* prevent warning when compiled w/o threads */
if (git_rwlock_rdlock(&sc->lock) < 0) {
- giterr_set(GITERR_OS, "unable to acquire read lock on cache");
+ git_error_set(GIT_ERROR_OS, "unable to acquire read lock on cache");
return -1;
}
return 0;
@@ -219,14 +219,14 @@ int git_sortedcache_lockandload(git_sortedcache *sc, git_buf *buf)
}
if (p_fstat(fd, &st) < 0) {
- giterr_set(GITERR_OS, "failed to stat file");
+ git_error_set(GIT_ERROR_OS, "failed to stat file");
error = -1;
(void)p_close(fd);
goto unlock;
}
if (!git__is_sizet(st.st_size)) {
- giterr_set(GITERR_INVALID, "unable to load file larger than size_t");
+ git_error_set(GIT_ERROR_INVALID, "unable to load file larger than size_t");
error = -1;
(void)p_close(fd);
goto unlock;
@@ -287,7 +287,7 @@ int git_sortedcache_upsert(void **out, git_sortedcache *sc, const char *key)
itemlen = (itemlen + 7) & ~7;
if ((item = git_pool_mallocz(&sc->pool, (uint32_t)itemlen)) == NULL) {
- /* don't use GITERR_CHECK_ALLOC b/c of lock */
+ /* don't use GIT_ERROR_CHECK_ALLOC b/c of lock */
error = -1;
goto done;
}
@@ -378,7 +378,7 @@ int git_sortedcache_remove(git_sortedcache *sc, size_t pos)
*/
if ((item = git_vector_get(&sc->items, pos)) == NULL) {
- giterr_set(GITERR_INVALID, "removing item out of range");
+ git_error_set(GIT_ERROR_INVALID, "removing item out of range");
return GIT_ENOTFOUND;
}
diff --git a/src/stash.c b/src/stash.c
index cb542a3..c332d93 100644
--- a/src/stash.c
+++ b/src/stash.c
@@ -29,7 +29,7 @@
static int create_error(int error, const char *msg)
{
- giterr_set(GITERR_STASH, "cannot stash changes - %s", msg);
+ git_error_set(GIT_ERROR_STASH, "cannot stash changes - %s", msg);
return error;
}
@@ -48,7 +48,7 @@ static int append_abbreviated_oid(git_buf *out, const git_oid *b_commit)
char *formatted_oid;
formatted_oid = git_oid_allocfmt(b_commit);
- GITERR_CHECK_ALLOC(formatted_oid);
+ GIT_ERROR_CHECK_ALLOC(formatted_oid);
git_buf_put(out, formatted_oid, 7);
git__free(formatted_oid);
@@ -59,7 +59,7 @@ static int append_abbreviated_oid(git_buf *out, const git_oid *b_commit)
static int append_commit_description(git_buf *out, git_commit* commit)
{
const char *summary = git_commit_summary(commit);
- GITERR_CHECK_ALLOC(summary);
+ GIT_ERROR_CHECK_ALLOC(summary);
if (append_abbreviated_oid(out, git_commit_id(commit)) < 0)
return -1;
@@ -233,8 +233,8 @@ static int stash_update_index_from_diff(
default:
/* Unimplemented */
- giterr_set(
- GITERR_INVALID,
+ git_error_set(
+ GIT_ERROR_INVALID,
"cannot update index. Unimplemented status (%d)",
delta->status);
return -1;
@@ -641,7 +641,7 @@ static int retrieve_stash_commit(
max = git_reflog_entrycount(reflog);
if (!max || index > max - 1) {
error = GIT_ENOTFOUND;
- giterr_set(GITERR_STASH, "no stashed state at position %" PRIuZ, index);
+ git_error_set(GIT_ERROR_STASH, "no stashed state at position %" PRIuZ, index);
goto cleanup;
}
@@ -822,7 +822,7 @@ static int ensure_clean_index(git_repository *repo, git_index *index)
goto done;
if (git_diff_num_deltas(index_diff) > 0) {
- giterr_set(GITERR_STASH, "%" PRIuZ " uncommitted changes exist in the index",
+ git_error_set(GIT_ERROR_STASH, "%" PRIuZ " uncommitted changes exist in the index",
git_diff_num_deltas(index_diff));
error = GIT_EUNCOMMITTED;
}
@@ -894,7 +894,7 @@ int git_stash_apply(
git_index *untracked_index = NULL;
int error;
- GITERR_CHECK_VERSION(given_opts, GIT_STASH_APPLY_OPTIONS_VERSION, "git_stash_apply_options");
+ GIT_ERROR_CHECK_VERSION(given_opts, GIT_STASH_APPLY_OPTIONS_VERSION, "git_stash_apply_options");
normalize_apply_options(&opts, given_opts);
checkout_strategy = opts.checkout_options.checkout_strategy;
@@ -1027,7 +1027,7 @@ int git_stash_foreach(
error = git_reference_lookup(&stash, repo, GIT_REFS_STASH_FILE);
if (error == GIT_ENOTFOUND) {
- giterr_clear();
+ git_error_clear();
return 0;
}
if (error < 0)
@@ -1046,7 +1046,7 @@ int git_stash_foreach(
payload);
if (error) {
- giterr_set_after_callback(error);
+ git_error_set_after_callback(error);
break;
}
}
@@ -1083,7 +1083,7 @@ int git_stash_drop(
if (!max || index > max - 1) {
error = GIT_ENOTFOUND;
- giterr_set(GITERR_STASH, "no stashed state at position %" PRIuZ, index);
+ git_error_set(GIT_ERROR_STASH, "no stashed state at position %" PRIuZ, index);
goto cleanup;
}
diff --git a/src/status.c b/src/status.c
index a2d3898..ef32a0a 100644
--- a/src/status.c
+++ b/src/status.c
@@ -174,7 +174,7 @@ static int status_collect(
return 0;
status_entry = git__malloc(sizeof(git_status_entry));
- GITERR_CHECK_ALLOC(status_entry);
+ GIT_ERROR_CHECK_ALLOC(status_entry);
status_entry->status = status_compute(status, head2idx, idx2wd);
status_entry->head_to_index = head2idx;
@@ -240,16 +240,16 @@ static int status_validate_options(const git_status_options *opts)
if (!opts)
return 0;
- GITERR_CHECK_VERSION(opts, GIT_STATUS_OPTIONS_VERSION, "git_status_options");
+ GIT_ERROR_CHECK_VERSION(opts, GIT_STATUS_OPTIONS_VERSION, "git_status_options");
if (opts->show > GIT_STATUS_SHOW_WORKDIR_ONLY) {
- giterr_set(GITERR_INVALID, "unknown status 'show' option");
+ git_error_set(GIT_ERROR_INVALID, "unknown status 'show' option");
return -1;
}
if ((opts->flags & GIT_STATUS_OPT_NO_REFRESH) != 0 &&
(opts->flags & GIT_STATUS_OPT_UPDATE_INDEX) != 0) {
- giterr_set(GITERR_INVALID, "updating index from status "
+ git_error_set(GIT_ERROR_INVALID, "updating index from status "
"is not allowed when index refresh is disabled");
return -1;
}
@@ -288,17 +288,17 @@ int git_status_list_new(
if ((error = git_repository_head_tree(&head, repo)) < 0) {
if (error != GIT_ENOTFOUND && error != GIT_EUNBORNBRANCH)
goto done;
- giterr_clear();
+ git_error_clear();
}
}
/* refresh index from disk unless prevented */
if ((flags & GIT_STATUS_OPT_NO_REFRESH) == 0 &&
git_index_read_safely(index) < 0)
- giterr_clear();
+ git_error_clear();
status = git_status_list_alloc(index);
- GITERR_CHECK_ALLOC(status);
+ GIT_ERROR_CHECK_ALLOC(status);
if (opts) {
memcpy(&status->opts, opts, sizeof(git_status_options));
@@ -437,7 +437,7 @@ int git_status_foreach_ext(
status_entry->index_to_workdir->old_file.path;
if ((error = cb(path, status_entry->status, payload)) != 0) {
- giterr_set_after_callback(error);
+ git_error_set_after_callback(error);
break;
}
}
@@ -475,7 +475,7 @@ static int get_one_status(const char *path, unsigned int status, void *data)
p_fnmatch(sfi->expected, path, sfi->fnm_flags) != 0))
{
sfi->ambiguous = true;
- return GIT_EAMBIGUOUS; /* giterr_set will be done by caller */
+ return GIT_EAMBIGUOUS; /* git_error_set will be done by caller */
}
return 0;
@@ -514,13 +514,13 @@ int git_status_file(
error = git_status_foreach_ext(repo, &opts, get_one_status, &sfi);
if (error < 0 && sfi.ambiguous) {
- giterr_set(GITERR_INVALID,
+ git_error_set(GIT_ERROR_INVALID,
"ambiguous path '%s' given to git_status_file", sfi.expected);
error = GIT_EAMBIGUOUS;
}
if (!error && !sfi.count) {
- giterr_set(GITERR_INVALID,
+ git_error_set(GIT_ERROR_INVALID,
"attempt to get status of nonexistent file '%s'", path);
error = GIT_ENOTFOUND;
}
@@ -551,7 +551,7 @@ int git_status_list_get_perfdata(
git_diff_perfdata *out, const git_status_list *status)
{
assert(out);
- GITERR_CHECK_VERSION(out, GIT_DIFF_PERFDATA_VERSION, "git_diff_perfdata");
+ GIT_ERROR_CHECK_VERSION(out, GIT_DIFF_PERFDATA_VERSION, "git_diff_perfdata");
out->stat_calls = 0;
out->oid_calculations = 0;
diff --git a/src/stdalloc.c b/src/stdalloc.c
index 171c9ed..c6d4ec8 100644
--- a/src/stdalloc.c
+++ b/src/stdalloc.c
@@ -14,7 +14,7 @@ static void *stdalloc__malloc(size_t len, const char *file, int line)
GIT_UNUSED(file);
GIT_UNUSED(line);
- if (!ptr) giterr_set_oom();
+ if (!ptr) git_error_set_oom();
return ptr;
}
@@ -25,7 +25,7 @@ static void *stdalloc__calloc(size_t nelem, size_t elsize, const char *file, int
GIT_UNUSED(file);
GIT_UNUSED(line);
- if (!ptr) giterr_set_oom();
+ if (!ptr) git_error_set_oom();
return ptr;
}
@@ -36,7 +36,7 @@ static char *stdalloc__strdup(const char *str, const char *file, int line)
GIT_UNUSED(file);
GIT_UNUSED(line);
- if (!ptr) giterr_set_oom();
+ if (!ptr) git_error_set_oom();
return ptr;
}
@@ -80,7 +80,7 @@ static void *stdalloc__realloc(void *ptr, size_t size, const char *file, int lin
GIT_UNUSED(file);
GIT_UNUSED(line);
- if (!new_ptr) giterr_set_oom();
+ if (!new_ptr) git_error_set_oom();
return new_ptr;
}
diff --git a/src/stream.h b/src/stream.h
index d354775..00220d5 100644
--- a/src/stream.h
+++ b/src/stream.h
@@ -23,7 +23,7 @@ GIT_INLINE(int) git_stream_is_encrypted(git_stream *st)
GIT_INLINE(int) git_stream_certificate(git_cert **out, git_stream *st)
{
if (!st->encrypted) {
- giterr_set(GITERR_INVALID, "an unencrypted stream does not have a certificate");
+ git_error_set(GIT_ERROR_INVALID, "an unencrypted stream does not have a certificate");
return -1;
}
@@ -38,7 +38,7 @@ GIT_INLINE(int) git_stream_supports_proxy(git_stream *st)
GIT_INLINE(int) git_stream_set_proxy(git_stream *st, const git_proxy_options *proxy_opts)
{
if (!st->proxy_support) {
- giterr_set(GITERR_INVALID, "proxy not supported on this stream");
+ git_error_set(GIT_ERROR_INVALID, "proxy not supported on this stream");
return -1;
}
diff --git a/src/streams/mbedtls.c b/src/streams/mbedtls.c
index d22f770..45f5b6e 100644
--- a/src/streams/mbedtls.c
+++ b/src/streams/mbedtls.c
@@ -83,14 +83,14 @@ int git_mbedtls_stream_global_init(void)
char *cipher_string_tmp = NULL;
git__ssl_conf = git__malloc(sizeof(mbedtls_ssl_config));
- GITERR_CHECK_ALLOC(git__ssl_conf);
+ GIT_ERROR_CHECK_ALLOC(git__ssl_conf);
mbedtls_ssl_config_init(git__ssl_conf);
if (mbedtls_ssl_config_defaults(git__ssl_conf,
MBEDTLS_SSL_IS_CLIENT,
MBEDTLS_SSL_TRANSPORT_STREAM,
MBEDTLS_SSL_PRESET_DEFAULT) != 0) {
- giterr_set(GITERR_SSL, "failed to initialize mbedTLS");
+ git_error_set(GIT_ERROR_SSL, "failed to initialize mbedTLS");
goto cleanup;
}
@@ -105,14 +105,14 @@ int git_mbedtls_stream_global_init(void)
/* set the list of allowed ciphersuites */
ciphers_known = 0;
cipher_string = cipher_string_tmp = git__strdup(GIT_SSL_DEFAULT_CIPHERS);
- GITERR_CHECK_ALLOC(cipher_string);
+ GIT_ERROR_CHECK_ALLOC(cipher_string);
while ((cipher_name = git__strtok(&cipher_string_tmp, ":")) != NULL) {
int cipherid = mbedtls_ssl_get_ciphersuite_id(cipher_name);
if (cipherid == 0) continue;
if (ciphers_known >= ARRAY_SIZE(ciphers_list)) {
- giterr_set(GITERR_SSL, "out of cipher list space");
+ git_error_set(GIT_ERROR_SSL, "out of cipher list space");
goto cleanup;
}
@@ -121,26 +121,26 @@ int git_mbedtls_stream_global_init(void)
git__free(cipher_string);
if (!ciphers_known) {
- giterr_set(GITERR_SSL, "no cipher could be enabled");
+ git_error_set(GIT_ERROR_SSL, "no cipher could be enabled");
goto cleanup;
}
mbedtls_ssl_conf_ciphersuites(git__ssl_conf, ciphers_list);
/* Seeding the random number generator */
mbedtls_entropy = git__malloc(sizeof(mbedtls_entropy_context));
- GITERR_CHECK_ALLOC(mbedtls_entropy);
+ GIT_ERROR_CHECK_ALLOC(mbedtls_entropy);
mbedtls_entropy_init(mbedtls_entropy);
ctr_drbg = git__malloc(sizeof(mbedtls_ctr_drbg_context));
- GITERR_CHECK_ALLOC(ctr_drbg);
+ GIT_ERROR_CHECK_ALLOC(ctr_drbg);
mbedtls_ctr_drbg_init(ctr_drbg);
if (mbedtls_ctr_drbg_seed(ctr_drbg,
mbedtls_entropy_func,
mbedtls_entropy, NULL, 0) != 0) {
- giterr_set(GITERR_SSL, "failed to initialize mbedTLS entropy pool");
+ git_error_set(GIT_ERROR_SSL, "failed to initialize mbedTLS entropy pool");
goto cleanup;
}
@@ -193,16 +193,16 @@ static int ssl_set_error(mbedtls_ssl_context *ssl, int error)
switch(error) {
case 0:
- giterr_set(GITERR_SSL, "SSL error: unknown error");
+ git_error_set(GIT_ERROR_SSL, "SSL error: unknown error");
break;
case MBEDTLS_ERR_X509_CERT_VERIFY_FAILED:
- giterr_set(GITERR_SSL, "SSL error: %#04x [%x] - %s", error, ssl->session_negotiate->verify_result, errbuf);
+ git_error_set(GIT_ERROR_SSL, "SSL error: %#04x [%x] - %s", error, ssl->session_negotiate->verify_result, errbuf);
ret = GIT_ECERTIFICATE;
break;
default:
- giterr_set(GITERR_SSL, "SSL error: %#04x - %s", error, errbuf);
+ git_error_set(GIT_ERROR_SSL, "SSL error: %#04x - %s", error, errbuf);
}
return ret;
@@ -228,7 +228,7 @@ static int verify_server_cert(mbedtls_ssl_context *ssl)
char vrfy_buf[512];
int len = mbedtls_x509_crt_verify_info(vrfy_buf, sizeof(vrfy_buf), "", ret);
if (len >= 1) vrfy_buf[len - 1] = '\0'; /* Remove trailing \n */
- giterr_set(GITERR_SSL, "the SSL certificate is invalid: %#04x - %s", ret, vrfy_buf);
+ git_error_set(GIT_ERROR_SSL, "the SSL certificate is invalid: %#04x - %s", ret, vrfy_buf);
return GIT_ECERTIFICATE;
}
@@ -273,18 +273,18 @@ int mbedtls_certificate(git_cert **out, git_stream *stream)
const mbedtls_x509_crt *cert = mbedtls_ssl_get_peer_cert(st->ssl);
if (!cert) {
- giterr_set(GITERR_SSL, "the server did not provide a certificate");
+ git_error_set(GIT_ERROR_SSL, "the server did not provide a certificate");
return -1;
}
/* Retrieve the length of the certificate first */
if (cert->raw.len == 0) {
- giterr_set(GITERR_NET, "failed to retrieve certificate information");
+ git_error_set(GIT_ERROR_NET, "failed to retrieve certificate information");
return -1;
}
encoded_cert = git__malloc(cert->raw.len);
- GITERR_CHECK_ALLOC(encoded_cert);
+ GIT_ERROR_CHECK_ALLOC(encoded_cert);
memcpy(encoded_cert, cert->raw.p, cert->raw.len);
st->cert_info.parent.cert_type = GIT_CERT_X509;
@@ -369,22 +369,22 @@ static int mbedtls_stream_wrap(
int error;
st = git__calloc(1, sizeof(mbedtls_stream));
- GITERR_CHECK_ALLOC(st);
+ GIT_ERROR_CHECK_ALLOC(st);
st->io = in;
st->owned = owned;
st->ssl = git__malloc(sizeof(mbedtls_ssl_context));
- GITERR_CHECK_ALLOC(st->ssl);
+ GIT_ERROR_CHECK_ALLOC(st->ssl);
mbedtls_ssl_init(st->ssl);
if (mbedtls_ssl_setup(st->ssl, git__ssl_conf)) {
- giterr_set(GITERR_SSL, "failed to create ssl object");
+ git_error_set(GIT_ERROR_SSL, "failed to create ssl object");
error = -1;
goto out_err;
}
st->host = git__strdup(host);
- GITERR_CHECK_ALLOC(st->host);
+ GIT_ERROR_CHECK_ALLOC(st->host);
st->parent.version = GIT_STREAM_VERSION;
st->parent.encrypted = 1;
@@ -447,7 +447,7 @@ int git_mbedtls__set_cert_location(const char *path, int is_dir)
assert(path != NULL);
cacert = git__malloc(sizeof(mbedtls_x509_crt));
- GITERR_CHECK_ALLOC(cacert);
+ GIT_ERROR_CHECK_ALLOC(cacert);
mbedtls_x509_crt_init(cacert);
if (is_dir) {
@@ -460,7 +460,7 @@ int git_mbedtls__set_cert_location(const char *path, int is_dir)
mbedtls_x509_crt_free(cacert);
git__free(cacert);
mbedtls_strerror( ret, errbuf, 512 );
- giterr_set(GITERR_SSL, "failed to load CA certificates: %#04x - %s", ret, errbuf);
+ git_error_set(GIT_ERROR_SSL, "failed to load CA certificates: %#04x - %s", ret, errbuf);
return -1;
}
diff --git a/src/streams/openssl.c b/src/streams/openssl.c
index bc12921..6f826ef 100644
--- a/src/streams/openssl.c
+++ b/src/streams/openssl.c
@@ -237,7 +237,7 @@ int git_openssl_stream_global_init(void)
return 0;
error:
- giterr_set(GITERR_NET, "could not initialize openssl: %s",
+ git_error_set(GIT_ERROR_NET, "could not initialize openssl: %s",
ERR_error_string(ERR_get_error(), NULL));
SSL_CTX_free(git__ssl_ctx);
git__ssl_ctx = NULL;
@@ -261,11 +261,11 @@ int git_openssl_set_locking(void)
num_locks = CRYPTO_num_locks();
openssl_locks = git__calloc(num_locks, sizeof(git_mutex));
- GITERR_CHECK_ALLOC(openssl_locks);
+ GIT_ERROR_CHECK_ALLOC(openssl_locks);
for (i = 0; i < num_locks; i++) {
if (git_mutex_init(&openssl_locks[i]) != 0) {
- giterr_set(GITERR_SSL, "failed to initialize openssl locks");
+ git_error_set(GIT_ERROR_SSL, "failed to initialize openssl locks");
return -1;
}
}
@@ -276,7 +276,7 @@ int git_openssl_set_locking(void)
#elif !defined(OPENSSL_LEGACY_API)
return 0;
#else
- giterr_set(GITERR_THREAD, "libgit2 was not built with threads");
+ git_error_set(GIT_ERROR_THREAD, "libgit2 was not built with threads");
return -1;
#endif
}
@@ -343,7 +343,7 @@ static int init_bio_method(void)
{
/* Set up the BIO_METHOD we use for wrapping our own stream implementations */
git_stream_bio_method = BIO_meth_new(BIO_TYPE_SOURCE_SINK | BIO_get_new_index(), "git_stream");
- GITERR_CHECK_ALLOC(git_stream_bio_method);
+ GIT_ERROR_CHECK_ALLOC(git_stream_bio_method);
BIO_meth_set_write(git_stream_bio_method, bio_write);
BIO_meth_set_read(git_stream_bio_method, bio_read);
@@ -369,23 +369,23 @@ static int ssl_set_error(SSL *ssl, int error)
switch (err) {
case SSL_ERROR_WANT_CONNECT:
case SSL_ERROR_WANT_ACCEPT:
- giterr_set(GITERR_SSL, "SSL error: connection failure");
+ git_error_set(GIT_ERROR_SSL, "SSL error: connection failure");
break;
case SSL_ERROR_WANT_X509_LOOKUP:
- giterr_set(GITERR_SSL, "SSL error: x509 error");
+ git_error_set(GIT_ERROR_SSL, "SSL error: x509 error");
break;
case SSL_ERROR_SYSCALL:
e = ERR_get_error();
if (e > 0) {
char errmsg[256];
ERR_error_string_n(e, errmsg, sizeof(errmsg));
- giterr_set(GITERR_NET, "SSL error: %s", errmsg);
+ git_error_set(GIT_ERROR_NET, "SSL error: %s", errmsg);
break;
} else if (error < 0) {
- giterr_set(GITERR_OS, "SSL error: syscall failure");
+ git_error_set(GIT_ERROR_OS, "SSL error: syscall failure");
break;
}
- giterr_set(GITERR_SSL, "SSL error: received early EOF");
+ git_error_set(GIT_ERROR_SSL, "SSL error: received early EOF");
return GIT_EEOF;
break;
case SSL_ERROR_SSL:
@@ -393,13 +393,13 @@ static int ssl_set_error(SSL *ssl, int error)
char errmsg[256];
e = ERR_get_error();
ERR_error_string_n(e, errmsg, sizeof(errmsg));
- giterr_set(GITERR_SSL, "SSL error: %s", errmsg);
+ git_error_set(GIT_ERROR_SSL, "SSL error: %s", errmsg);
break;
}
case SSL_ERROR_NONE:
case SSL_ERROR_ZERO_RETURN:
default:
- giterr_set(GITERR_SSL, "SSL error: unknown error");
+ git_error_set(GIT_ERROR_SSL, "SSL error: unknown error");
break;
}
return -1;
@@ -443,7 +443,7 @@ static int verify_server_cert(SSL *ssl, const char *host)
int i = -1, j, error = 0;
if (SSL_get_verify_result(ssl) != X509_V_OK) {
- giterr_set(GITERR_SSL, "the SSL certificate is invalid");
+ git_error_set(GIT_ERROR_SSL, "the SSL certificate is invalid");
return GIT_ECERTIFICATE;
}
@@ -462,7 +462,7 @@ static int verify_server_cert(SSL *ssl, const char *host)
cert = SSL_get_peer_certificate(ssl);
if (!cert) {
error = -1;
- giterr_set(GITERR_SSL, "the server did not provide a certificate");
+ git_error_set(GIT_ERROR_SSL, "the server did not provide a certificate");
goto cleanup;
}
@@ -529,7 +529,7 @@ static int verify_server_cert(SSL *ssl, const char *host)
if (size > 0) {
peer_cn = OPENSSL_malloc(size + 1);
- GITERR_CHECK_ALLOC(peer_cn);
+ GIT_ERROR_CHECK_ALLOC(peer_cn);
memcpy(peer_cn, ASN1_STRING_get0_data(str), size);
peer_cn[size] = '\0';
} else {
@@ -537,7 +537,7 @@ static int verify_server_cert(SSL *ssl, const char *host)
}
} else {
int size = ASN1_STRING_to_UTF8(&peer_cn, str);
- GITERR_CHECK_ALLOC(peer_cn);
+ GIT_ERROR_CHECK_ALLOC(peer_cn);
if (memchr(peer_cn, '\0', size))
goto cert_fail_name;
}
@@ -549,7 +549,7 @@ static int verify_server_cert(SSL *ssl, const char *host)
cert_fail_name:
error = GIT_ECERTIFICATE;
- giterr_set(GITERR_SSL, "hostname does not match certificate");
+ git_error_set(GIT_ERROR_SSL, "hostname does not match certificate");
goto cleanup;
on_error:
@@ -584,7 +584,7 @@ int openssl_connect(git_stream *stream)
return ret;
bio = BIO_new(git_stream_bio_method);
- GITERR_CHECK_ALLOC(bio);
+ GIT_ERROR_CHECK_ALLOC(bio);
BIO_set_data(bio, st->io);
SSL_set_bio(st->ssl, bio, bio);
@@ -612,19 +612,19 @@ int openssl_certificate(git_cert **out, git_stream *stream)
/* Retrieve the length of the certificate first */
len = i2d_X509(cert, NULL);
if (len < 0) {
- giterr_set(GITERR_NET, "failed to retrieve certificate information");
+ git_error_set(GIT_ERROR_NET, "failed to retrieve certificate information");
return -1;
}
encoded_cert = git__malloc(len);
- GITERR_CHECK_ALLOC(encoded_cert);
+ GIT_ERROR_CHECK_ALLOC(encoded_cert);
/* i2d_X509 makes 'guard' point to just after the data */
guard = encoded_cert;
len = i2d_X509(cert, &guard);
if (len < 0) {
git__free(encoded_cert);
- giterr_set(GITERR_NET, "failed to retrieve certificate information");
+ git_error_set(GIT_ERROR_NET, "failed to retrieve certificate information");
return -1;
}
@@ -706,20 +706,20 @@ static int openssl_stream_wrap(
assert(out && in && host);
st = git__calloc(1, sizeof(openssl_stream));
- GITERR_CHECK_ALLOC(st);
+ GIT_ERROR_CHECK_ALLOC(st);
st->io = in;
st->owned = owned;
st->ssl = SSL_new(git__ssl_ctx);
if (st->ssl == NULL) {
- giterr_set(GITERR_SSL, "failed to create ssl object");
+ git_error_set(GIT_ERROR_SSL, "failed to create ssl object");
git__free(st);
return -1;
}
st->host = git__strdup(host);
- GITERR_CHECK_ALLOC(st->host);
+ GIT_ERROR_CHECK_ALLOC(st->host);
st->parent.version = GIT_STREAM_VERSION;
st->parent.encrypted = 1;
@@ -765,7 +765,7 @@ int git_openssl__set_cert_location(const char *file, const char *path)
char errmsg[256];
ERR_error_string_n(ERR_get_error(), errmsg, sizeof(errmsg));
- giterr_set(GITERR_SSL, "OpenSSL error: failed to load certificates: %s",
+ git_error_set(GIT_ERROR_SSL, "OpenSSL error: failed to load certificates: %s",
errmsg);
return -1;
@@ -785,7 +785,7 @@ int git_openssl_stream_global_init(void)
int git_openssl_set_locking(void)
{
- giterr_set(GITERR_SSL, "libgit2 was not built with OpenSSL support");
+ git_error_set(GIT_ERROR_SSL, "libgit2 was not built with OpenSSL support");
return -1;
}
diff --git a/src/streams/registry.c b/src/streams/registry.c
index 02fd349..b6cf489 100644
--- a/src/streams/registry.c
+++ b/src/streams/registry.c
@@ -66,7 +66,7 @@ int git_stream_registry_lookup(git_stream_registration *out, git_stream_t type)
}
if (git_rwlock_rdlock(&stream_registry.lock) < 0) {
- giterr_set(GITERR_OS, "failed to lock stream registry");
+ git_error_set(GIT_ERROR_OS, "failed to lock stream registry");
return -1;
}
@@ -83,10 +83,10 @@ int git_stream_register(git_stream_t type, git_stream_registration *registration
{
assert(!registration || registration->init);
- GITERR_CHECK_VERSION(registration, GIT_STREAM_VERSION, "stream_registration");
+ GIT_ERROR_CHECK_VERSION(registration, GIT_STREAM_VERSION, "stream_registration");
if (git_rwlock_wrlock(&stream_registry.lock) < 0) {
- giterr_set(GITERR_OS, "failed to lock stream registry");
+ git_error_set(GIT_ERROR_OS, "failed to lock stream registry");
return -1;
}
diff --git a/src/streams/socket.c b/src/streams/socket.c
index 998e2fe..cfd183a 100644
--- a/src/streams/socket.c
+++ b/src/streams/socket.c
@@ -35,16 +35,16 @@ static void net_set_error(const char *str)
char * win32_error = git_win32_get_error_message(error);
if (win32_error) {
- giterr_set(GITERR_NET, "%s: %s", str, win32_error);
+ git_error_set(GIT_ERROR_NET, "%s: %s", str, win32_error);
git__free(win32_error);
} else {
- giterr_set(GITERR_NET, "%s", str);
+ git_error_set(GITERR_NET, "%s", str);
}
}
#else
static void net_set_error(const char *str)
{
- giterr_set(GITERR_NET, "%s: %s", str, strerror(errno));
+ git_error_set(GIT_ERROR_NET, "%s: %s", str, strerror(errno));
}
#endif
@@ -58,7 +58,7 @@ static int close_socket(GIT_SOCKET s)
return -1;
if (0 != WSACleanup()) {
- giterr_set(GITERR_OS, "winsock cleanup failed");
+ git_error_set(GIT_ERROR_OS, "winsock cleanup failed");
return -1;
}
@@ -83,13 +83,13 @@ int socket_connect(git_stream *stream)
WSADATA wsd;
if (WSAStartup(MAKEWORD(2,2), &wsd) != 0) {
- giterr_set(GITERR_OS, "winsock init failed");
+ git_error_set(GIT_ERROR_OS, "winsock init failed");
return -1;
}
if (LOBYTE(wsd.wVersion) != 2 || HIBYTE(wsd.wVersion) != 2) {
WSACleanup();
- giterr_set(GITERR_OS, "winsock init failed");
+ git_error_set(GIT_ERROR_OS, "winsock init failed");
return -1;
}
#endif
@@ -99,7 +99,7 @@ int socket_connect(git_stream *stream)
hints.ai_family = AF_UNSPEC;
if ((ret = p_getaddrinfo(st->host, st->port, &hints, &info)) != 0) {
- giterr_set(GITERR_NET,
+ git_error_set(GIT_ERROR_NET,
"failed to resolve address for %s: %s", st->host, p_gai_strerror(ret));
return -1;
}
@@ -120,7 +120,7 @@ int socket_connect(git_stream *stream)
/* Oops, we couldn't connect to any address */
if (s == INVALID_SOCKET && p == NULL) {
- giterr_set(GITERR_OS, "failed to connect to %s", st->host);
+ git_error_set(GIT_ERROR_OS, "failed to connect to %s", st->host);
p_freeaddrinfo(info);
return -1;
}
@@ -191,14 +191,14 @@ static int default_socket_stream_new(
assert(out && host && port);
st = git__calloc(1, sizeof(git_socket_stream));
- GITERR_CHECK_ALLOC(st);
+ GIT_ERROR_CHECK_ALLOC(st);
st->host = git__strdup(host);
- GITERR_CHECK_ALLOC(st->host);
+ GIT_ERROR_CHECK_ALLOC(st->host);
if (port) {
st->port = git__strdup(port);
- GITERR_CHECK_ALLOC(st->port);
+ GIT_ERROR_CHECK_ALLOC(st->port);
}
st->parent.version = GIT_STREAM_VERSION;
@@ -232,7 +232,7 @@ int git_socket_stream_new(
return error;
if (!init) {
- giterr_set(GITERR_NET, "there is no socket stream available");
+ git_error_set(GIT_ERROR_NET, "there is no socket stream available");
return -1;
}
diff --git a/src/streams/stransport.c b/src/streams/stransport.c
index 6626e0f..da1156c 100644
--- a/src/streams/stransport.c
+++ b/src/streams/stransport.c
@@ -22,18 +22,18 @@ static int stransport_error(OSStatus ret)
CFStringRef message;
if (ret == noErr || ret == errSSLClosedGraceful) {
- giterr_clear();
+ git_error_clear();
return 0;
}
#if !TARGET_OS_IPHONE
message = SecCopyErrorMessageString(ret, NULL);
- GITERR_CHECK_ALLOC(message);
+ GIT_ERROR_CHECK_ALLOC(message);
- giterr_set(GITERR_NET, "SecureTransport error: %s", CFStringGetCStringPtr(message, kCFStringEncodingUTF8));
+ git_error_set(GIT_ERROR_NET, "SecureTransport error: %s", CFStringGetCStringPtr(message, kCFStringEncodingUTF8));
CFRelease(message);
#else
- giterr_set(GITERR_NET, "SecureTransport error: OSStatus %d", (unsigned int)ret);
+ git_error_set(GIT_ERROR_NET, "SecureTransport error: OSStatus %d", (unsigned int)ret);
GIT_UNUSED(message);
#endif
@@ -62,7 +62,7 @@ static int stransport_connect(git_stream *stream)
ret = SSLHandshake(st->ctx);
if (ret != errSSLServerAuthCompleted) {
- giterr_set(GITERR_SSL, "unexpected return value from ssl handshake %d", (int)ret);
+ git_error_set(GIT_ERROR_SSL, "unexpected return value from ssl handshake %d", (int)ret);
return -1;
}
@@ -78,13 +78,13 @@ static int stransport_connect(git_stream *stream)
CFRelease(trust);
if (sec_res == kSecTrustResultInvalid || sec_res == kSecTrustResultOtherError) {
- giterr_set(GITERR_SSL, "internal security trust error");
+ git_error_set(GIT_ERROR_SSL, "internal security trust error");
return -1;
}
if (sec_res == kSecTrustResultDeny || sec_res == kSecTrustResultRecoverableTrustFailure ||
sec_res == kSecTrustResultFatalTrustFailure) {
- giterr_set(GITERR_SSL, "untrusted connection error");
+ git_error_set(GIT_ERROR_SSL, "untrusted connection error");
return GIT_ECERTIFICATE;
}
@@ -112,7 +112,7 @@ static int stransport_certificate(git_cert **out, git_stream *stream)
CFRelease(trust);
if (st->der_data == NULL) {
- giterr_set(GITERR_SSL, "retrieved invalid certificate data");
+ git_error_set(GIT_ERROR_SSL, "retrieved invalid certificate data");
return -1;
}
@@ -254,14 +254,14 @@ static int stransport_wrap(
assert(out && in && host);
st = git__calloc(1, sizeof(stransport_stream));
- GITERR_CHECK_ALLOC(st);
+ GIT_ERROR_CHECK_ALLOC(st);
st->io = in;
st->owned = owned;
st->ctx = SSLCreateContext(NULL, kSSLClientSide, kSSLStreamType);
if (!st->ctx) {
- giterr_set(GITERR_NET, "failed to create SSL context");
+ git_error_set(GIT_ERROR_NET, "failed to create SSL context");
git__free(st);
return -1;
}
diff --git a/src/streams/tls.c b/src/streams/tls.c
index 0ea47fb..6a25171 100644
--- a/src/streams/tls.c
+++ b/src/streams/tls.c
@@ -38,7 +38,7 @@ int git_tls_stream_new(git_stream **out, const char *host, const char *port)
}
if (!init) {
- giterr_set(GITERR_SSL, "there is no TLS stream available");
+ git_error_set(GIT_ERROR_SSL, "there is no TLS stream available");
return -1;
}
@@ -65,7 +65,7 @@ int git_tls_stream_wrap(git_stream **out, git_stream *in, const char *host)
}
if (!wrap) {
- giterr_set(GITERR_SSL, "there is no TLS stream available");
+ git_error_set(GIT_ERROR_SSL, "there is no TLS stream available");
return -1;
}
diff --git a/src/strmap.c b/src/strmap.c
index cee7f69..20b14ac 100644
--- a/src/strmap.c
+++ b/src/strmap.c
@@ -21,7 +21,7 @@ __KHASH_IMPL(str, static kh_inline, const char *, void *, 1, kh_str_hash_func, k
int git_strmap_alloc(git_strmap **map)
{
if ((*map = kh_init(str)) == NULL) {
- giterr_set_oom();
+ git_error_set_oom();
return -1;
}
diff --git a/src/submodule.c b/src/submodule.c
index c468a96..e3ec885 100644
--- a/src/submodule.c
+++ b/src/submodule.c
@@ -95,7 +95,7 @@ static void submodule_set_lookup_error(int error, const char *name)
if (!error)
return;
- giterr_set(GITERR_SUBMODULE, (error == GIT_ENOTFOUND) ?
+ git_error_set(GIT_ERROR_SUBMODULE, (error == GIT_ENOTFOUND) ?
"no submodule named '%s'" :
"submodule '%s' has not been added yet", name);
}
@@ -114,7 +114,7 @@ static int find_by_path(const git_config_entry *entry, void *payload)
fdot = strchr(entry->name, '.');
ldot = strrchr(entry->name, '.');
data->name = git__strndup(fdot + 1, ldot - fdot - 1);
- GITERR_CHECK_ALLOC(data->name);
+ GIT_ERROR_CHECK_ALLOC(data->name);
}
return 0;
@@ -136,7 +136,7 @@ static int is_path_occupied(bool *occupied, git_repository *repo, const char *pa
if ((error = git_index_find(NULL, index, path)) != GIT_ENOTFOUND) {
if (!error) {
- giterr_set(GITERR_SUBMODULE,
+ git_error_set(GIT_ERROR_SUBMODULE,
"File '%s' already exists in the index", path);
*occupied = true;
}
@@ -151,7 +151,7 @@ static int is_path_occupied(bool *occupied, git_repository *repo, const char *pa
if ((error = git_index_find_prefix(NULL, index, dir.ptr)) != GIT_ENOTFOUND) {
if (!error) {
- giterr_set(GITERR_SUBMODULE,
+ git_error_set(GIT_ERROR_SUBMODULE,
"Directory '%s' already exists in the index", path);
*occupied = true;
}
@@ -214,7 +214,7 @@ static int load_submodule_names(git_strmap **out, git_repository *repo, git_conf
ldot = strrchr(entry->name, '.');
if (git_strmap_exists(names, entry->value)) {
- giterr_set(GITERR_SUBMODULE,
+ git_error_set(GIT_ERROR_SUBMODULE,
"duplicated submodule path '%s'", entry->value);
error = -1;
goto out;
@@ -232,7 +232,7 @@ static int load_submodule_names(git_strmap **out, git_repository *repo, git_conf
git_strmap_insert(names, git__strdup(entry->value), git_buf_detach(&buf), &rval);
if (rval < 0) {
- giterr_set(GITERR_NOMEMORY, "error inserting submodule into hash table");
+ git_error_set(GIT_ERROR_NOMEMORY, "error inserting submodule into hash table");
error = -1;
goto out;
}
@@ -262,7 +262,7 @@ int git_submodule_lookup(
assert(repo && name);
if (repo->is_bare) {
- giterr_set(GITERR_SUBMODULE, "cannot get submodules without a working tree");
+ git_error_set(GIT_ERROR_SUBMODULE, "cannot get submodules without a working tree");
return -1;
}
@@ -551,9 +551,9 @@ int git_submodule__map(git_repository *repo, git_strmap *map)
/* get sources that we will need to check */
if (git_repository_index(&idx, repo) < 0)
- giterr_clear();
+ git_error_clear();
if (git_repository_head_tree(&head, repo) < 0)
- giterr_clear();
+ git_error_clear();
wd = git_repository_workdir(repo);
if (wd && (error = git_buf_joinpath(&path, wd, GIT_MODULES_FILE)) < 0)
@@ -614,7 +614,7 @@ int git_submodule_foreach(
size_t i;
if (repo->is_bare) {
- giterr_set(GITERR_SUBMODULE, "cannot get submodules without a working tree");
+ git_error_set(GIT_ERROR_SUBMODULE, "cannot get submodules without a working tree");
return -1;
}
@@ -641,7 +641,7 @@ int git_submodule_foreach(
git_vector_foreach(&snapshot, i, sm) {
if ((error = callback(sm, sm->name, payload)) != 0) {
- giterr_set_after_callback(error);
+ git_error_set_after_callback(error);
break;
}
}
@@ -730,9 +730,9 @@ int git_submodule_add_setup(
/* see if there is already an entry for this submodule */
if (git_submodule_lookup(NULL, repo, path) < 0)
- giterr_clear();
+ git_error_clear();
else {
- giterr_set(GITERR_SUBMODULE,
+ git_error_set(GIT_ERROR_SUBMODULE,
"attempt to add submodule '%s' that already exists", path);
return GIT_EEXISTS;
}
@@ -743,7 +743,7 @@ int git_submodule_add_setup(
path += strlen(git_repository_workdir(repo));
if (git_path_root(path) >= 0) {
- giterr_set(GITERR_SUBMODULE, "submodule path must be a relative path");
+ git_error_set(GIT_ERROR_SUBMODULE, "submodule path must be a relative path");
error = -1;
goto cleanup;
}
@@ -759,7 +759,7 @@ int git_submodule_add_setup(
/* update .gitmodules */
if (!(mods = open_gitmodules(repo, GITMODULES_CREATE))) {
- giterr_set(GITERR_SUBMODULE,
+ git_error_set(GIT_ERROR_SUBMODULE,
"adding submodules to a bare repository is not supported");
return -1;
}
@@ -880,7 +880,7 @@ int git_submodule_add_to_index(git_submodule *sm, int write_index)
/* read stat information for submodule working directory */
if (p_stat(path.ptr, &st) < 0) {
- giterr_set(GITERR_SUBMODULE,
+ git_error_set(GIT_ERROR_SUBMODULE,
"cannot add submodule without working directory");
error = -1;
goto cleanup;
@@ -893,7 +893,7 @@ int git_submodule_add_to_index(git_submodule *sm, int write_index)
/* calling git_submodule_open will have set sm->wd_oid if possible */
if ((sm->flags & GIT_SUBMODULE_STATUS__WD_OID_VALID) == 0) {
- giterr_set(GITERR_SUBMODULE,
+ git_error_set(GIT_ERROR_SUBMODULE,
"cannot add submodule without HEAD to index");
error = -1;
goto cleanup;
@@ -984,7 +984,7 @@ int git_submodule_resolve_url(git_buf *out, git_repository *repo, const char *ur
} else if (strchr(url, ':') != NULL || url[0] == '/') {
error = git_buf_sets(out, url);
} else {
- giterr_set(GITERR_SUBMODULE, "invalid format for submodule URL");
+ git_error_set(GIT_ERROR_SUBMODULE, "invalid format for submodule URL");
error = -1;
}
@@ -1023,7 +1023,7 @@ static int write_mapped_var(git_repository *repo, const char *name, git_cvar_map
const char *val;
if (git_config_lookup_map_enum(&type, &val, maps, nmaps, ival) < 0) {
- giterr_set(GITERR_SUBMODULE, "invalid value for %s", var);
+ git_error_set(GIT_ERROR_SUBMODULE, "invalid value for %s", var);
return -1;
}
@@ -1086,7 +1086,7 @@ const git_oid *git_submodule_wd_id(git_submodule *submodule)
if (!git_submodule_open_bare(&subrepo, submodule))
git_repository_free(subrepo);
else
- giterr_clear();
+ git_error_clear();
}
if (submodule->flags & GIT_SUBMODULE_STATUS__WD_OID_VALID)
@@ -1227,7 +1227,7 @@ int git_submodule_update(git_submodule *sm, int init, git_submodule_update_optio
if (_update_options)
memcpy(&update_options, _update_options, sizeof(git_submodule_update_options));
- GITERR_CHECK_VERSION(&update_options, GIT_SUBMODULE_UPDATE_OPTIONS_VERSION, "git_submodule_update_options");
+ GIT_ERROR_CHECK_VERSION(&update_options, GIT_SUBMODULE_UPDATE_OPTIONS_VERSION, "git_submodule_update_options");
/* Copy over the remote callbacks */
memcpy(&clone_options.fetch_opts, &update_options.fetch_opts, sizeof(git_fetch_options));
@@ -1258,7 +1258,7 @@ int git_submodule_update(git_submodule *sm, int init, git_submodule_update_optio
goto done;
if (!init) {
- giterr_set(GITERR_SUBMODULE, "submodule is not initialized");
+ git_error_set(GIT_ERROR_SUBMODULE, "submodule is not initialized");
error = GIT_ERROR;
goto done;
}
@@ -1302,7 +1302,7 @@ int git_submodule_update(git_submodule *sm, int init, git_submodule_update_optio
goto done;
if ((oid = git_submodule_index_id(sm)) == NULL) {
- giterr_set(GITERR_SUBMODULE, "could not get ID of submodule in index");
+ git_error_set(GIT_ERROR_SUBMODULE, "could not get ID of submodule in index");
error = -1;
goto done;
}
@@ -1346,7 +1346,7 @@ int git_submodule_init(git_submodule *sm, int overwrite)
git_config *cfg = NULL;
if (!sm->url) {
- giterr_set(GITERR_SUBMODULE,
+ git_error_set(GIT_ERROR_SUBMODULE,
"no URL configured for submodule '%s'", sm->name);
return -1;
}
@@ -1390,7 +1390,7 @@ int git_submodule_sync(git_submodule *sm)
git_repository *smrepo = NULL;
if (!sm->url) {
- giterr_set(GITERR_SUBMODULE,
+ git_error_set(GIT_ERROR_SUBMODULE,
"no URL configured for submodule '%s'", sm->name);
return -1;
}
@@ -1412,7 +1412,7 @@ int git_submodule_sync(git_submodule *sm)
if ((error = git_repository_config__weakptr(&cfg, smrepo)) < 0)
/* return error from reading submodule config */;
else if ((error = lookup_head_remote_key(&remote_name, smrepo)) < 0) {
- giterr_clear();
+ git_error_clear();
error = git_buf_sets(&key, "remote.origin.url");
} else {
error = git_buf_join3(
@@ -1469,7 +1469,7 @@ static int git_submodule__open(
if (!git_reference_name_to_id(&sm->wd_oid, *subrepo, GIT_HEAD_FILE))
sm->flags |= GIT_SUBMODULE_STATUS__WD_OID_VALID;
else
- giterr_clear();
+ git_error_clear();
} else if (git_path_exists(path.ptr)) {
sm->flags |= GIT_SUBMODULE_STATUS__WD_SCANNED |
GIT_SUBMODULE_STATUS_IN_WD;
@@ -1559,7 +1559,7 @@ static int submodule_update_head(git_submodule *submodule)
/* if we can't look up file in current head, then done */
if (git_repository_head_tree(&head, submodule->repo) < 0 ||
git_tree_entry_bypath(&te, head, submodule->path) < 0)
- giterr_clear();
+ git_error_clear();
else
submodule_update_from_head_data(submodule, te->attr, git_tree_entry_id(te));
@@ -1662,12 +1662,12 @@ int git_submodule__status(
if (ign == GIT_SUBMODULE_IGNORE_DIRTY) {
/* git_submodule_open_bare will load WD OID data */
if (git_submodule_open_bare(&smrepo, sm) < 0)
- giterr_clear();
+ git_error_clear();
else
git_repository_free(smrepo);
smrepo = NULL;
} else if (git_submodule_open(&smrepo, sm) < 0) {
- giterr_clear();
+ git_error_clear();
smrepo = NULL;
}
@@ -1725,12 +1725,12 @@ static int submodule_alloc(
git_submodule *sm;
if (!name || !(namelen = strlen(name))) {
- giterr_set(GITERR_SUBMODULE, "invalid submodule name");
+ git_error_set(GIT_ERROR_SUBMODULE, "invalid submodule name");
return -1;
}
sm = git__calloc(1, sizeof(git_submodule));
- GITERR_CHECK_ALLOC(sm);
+ GIT_ERROR_CHECK_ALLOC(sm);
sm->name = sm->path = git__strdup(name);
if (!sm->name) {
@@ -1776,7 +1776,7 @@ void git_submodule_free(git_submodule *sm)
static int submodule_config_error(const char *property, const char *value)
{
- giterr_set(GITERR_INVALID,
+ git_error_set(GIT_ERROR_INVALID,
"invalid value for submodule '%s' property: '%s'", property, value);
return -1;
}
@@ -1867,7 +1867,7 @@ static int submodule_read_config(git_submodule *sm, git_config *cfg)
if (sm->path != sm->name)
git__free(sm->path);
sm->path = git__strdup(value);
- GITERR_CHECK_ALLOC(sm->path);
+ GIT_ERROR_CHECK_ALLOC(sm->path);
}
}
@@ -1880,7 +1880,7 @@ static int submodule_read_config(git_submodule *sm, git_config *cfg)
if (!looks_like_command_line_option(value)) {
in_config = 1;
sm->url = git__strdup(value);
- GITERR_CHECK_ALLOC(sm->url);
+ GIT_ERROR_CHECK_ALLOC(sm->url);
}
} else if (error != GIT_ENOTFOUND) {
goto cleanup;
@@ -1889,7 +1889,7 @@ static int submodule_read_config(git_submodule *sm, git_config *cfg)
if ((error = get_value(&value, cfg, &key, sm->name, "branch")) == 0) {
in_config = 1;
sm->branch = git__strdup(value);
- GITERR_CHECK_ALLOC(sm->branch);
+ GIT_ERROR_CHECK_ALLOC(sm->branch);
} else if (error != GIT_ENOTFOUND) {
goto cleanup;
}
@@ -2091,7 +2091,7 @@ static int lookup_head_remote_key(git_buf *remote_name, git_repository *repo)
* a remote key for the local tracking branch HEAD points to.
**/
if (!git_reference_is_branch(head)) {
- giterr_set(GITERR_INVALID,
+ git_error_set(GIT_ERROR_INVALID,
"HEAD does not refer to a branch.");
error = GIT_ENOTFOUND;
goto done;
@@ -2140,8 +2140,8 @@ static int lookup_default_remote(git_remote **remote, git_repository *repo)
error = git_remote_lookup(remote, repo, "origin");
if (error == GIT_ENOTFOUND)
- giterr_set(
- GITERR_SUBMODULE,
+ git_error_set(
+ GIT_ERROR_SUBMODULE,
"cannot get default remote for submodule - no local tracking "
"branch for HEAD and origin does not exist");
@@ -2160,7 +2160,7 @@ static int get_url_base(git_buf *url, git_repository *repo)
} else if (error != GIT_ENOTFOUND)
goto out;
else
- giterr_clear();
+ git_error_clear();
/* if repository does not have a default remote, use workdir instead */
if (git_repository_is_worktree(repo)) {
@@ -2241,11 +2241,11 @@ static void submodule_get_wd_status(
/* if we don't have an unborn head, check diff with index */
if (git_repository_head_tree(&sm_head, sm_repo) < 0)
- giterr_clear();
+ git_error_clear();
else {
/* perform head to index diff on submodule */
if (git_diff_tree_to_index(&diff, sm_repo, sm_head, index, &opt) < 0)
- giterr_clear();
+ git_error_clear();
else {
if (git_diff_num_deltas(diff) > 0)
*status |= GIT_SUBMODULE_STATUS_WD_INDEX_MODIFIED;
@@ -2258,7 +2258,7 @@ static void submodule_get_wd_status(
/* perform index-to-workdir diff on submodule */
if (git_diff_index_to_workdir(&diff, sm_repo, index, &opt) < 0)
- giterr_clear();
+ git_error_clear();
else {
size_t untracked =
git_diff_num_deltas_of_type(diff, GIT_DELTA_UNTRACKED);
diff --git a/src/sysdir.c b/src/sysdir.c
index 5b1549e..e07ba71 100644
--- a/src/sysdir.c
+++ b/src/sysdir.c
@@ -57,12 +57,12 @@ static int get_passwd_home(git_buf *out, uid_t uid)
} while (error == ERANGE && buflen <= 8192);
if (error) {
- giterr_set(GITERR_OS, "failed to get passwd entry");
+ git_error_set(GIT_ERROR_OS, "failed to get passwd entry");
goto out;
}
if (!pwdptr) {
- giterr_set(GITERR_OS, "no passwd entry found for user");
+ git_error_set(GIT_ERROR_OS, "no passwd entry found for user");
goto out;
}
@@ -96,7 +96,7 @@ static int git_sysdir_guess_global_dirs(git_buf *out)
error = get_passwd_home(out, euid);
if (error == GIT_ENOTFOUND) {
- giterr_clear();
+ git_error_clear();
error = 0;
}
@@ -132,7 +132,7 @@ static int git_sysdir_guess_xdg_dirs(git_buf *out)
}
if (error == GIT_ENOTFOUND) {
- giterr_clear();
+ git_error_clear();
error = 0;
}
@@ -189,7 +189,7 @@ static int git_sysdir_check_selector(git_sysdir_t which)
if (which < ARRAY_SIZE(git_sysdir__dirs))
return 0;
- giterr_set(GITERR_INVALID, "config directory selector out of range");
+ git_error_set(GIT_ERROR_INVALID, "config directory selector out of range");
return -1;
}
@@ -200,7 +200,7 @@ int git_sysdir_get(const git_buf **out, git_sysdir_t which)
*out = NULL;
- GITERR_CHECK_ERROR(git_sysdir_check_selector(which));
+ GIT_ERROR_CHECK_ERROR(git_sysdir_check_selector(which));
*out = &git_sysdir__dirs[which].buf;
return 0;
@@ -213,11 +213,11 @@ int git_sysdir_get_str(
{
const git_buf *path = NULL;
- GITERR_CHECK_ERROR(git_sysdir_check_selector(which));
- GITERR_CHECK_ERROR(git_sysdir_get(&path, which));
+ GIT_ERROR_CHECK_ERROR(git_sysdir_check_selector(which));
+ GIT_ERROR_CHECK_ERROR(git_sysdir_get(&path, which));
if (!out || path->size >= outlen) {
- giterr_set(GITERR_NOMEMORY, "buffer is too short for the path");
+ git_error_set(GIT_ERROR_NOMEMORY, "buffer is too short for the path");
return GIT_EBUFS;
}
@@ -232,7 +232,7 @@ int git_sysdir_set(git_sysdir_t which, const char *search_path)
const char *expand_path = NULL;
git_buf merge = GIT_BUF_INIT;
- GITERR_CHECK_ERROR(git_sysdir_check_selector(which));
+ GIT_ERROR_CHECK_ERROR(git_sysdir_check_selector(which));
if (search_path != NULL)
expand_path = strstr(search_path, PATH_MAGIC);
@@ -281,7 +281,7 @@ static int git_sysdir_find_in_dirlist(
const char *scan, *next = NULL;
const git_buf *syspath;
- GITERR_CHECK_ERROR(git_sysdir_get(&syspath, which));
+ GIT_ERROR_CHECK_ERROR(git_sysdir_get(&syspath, which));
if (!syspath || !git_buf_len(syspath))
goto done;
@@ -298,9 +298,9 @@ static int git_sysdir_find_in_dirlist(
if (!len)
continue;
- GITERR_CHECK_ERROR(git_buf_set(path, scan, len));
+ GIT_ERROR_CHECK_ERROR(git_buf_set(path, scan, len));
if (name)
- GITERR_CHECK_ERROR(git_buf_joinpath(path, path->ptr, name));
+ GIT_ERROR_CHECK_ERROR(git_buf_joinpath(path, path->ptr, name));
if (git_path_exists(path->ptr))
return 0;
@@ -308,7 +308,7 @@ static int git_sysdir_find_in_dirlist(
done:
git_buf_dispose(path);
- giterr_set(GITERR_OS, "the %s file '%s' doesn't exist", label, name);
+ git_error_set(GIT_ERROR_OS, "the %s file '%s' doesn't exist", label, name);
return GIT_ENOTFOUND;
}
diff --git a/src/tag.c b/src/tag.c
index 102f1d5..b4a5015 100644
--- a/src/tag.c
+++ b/src/tag.c
@@ -61,7 +61,7 @@ const char *git_tag_message(const git_tag *t)
static int tag_error(const char *str)
{
- giterr_set(GITERR_TAG, "failed to parse tag: %s", str);
+ git_error_set(GIT_ERROR_TAG, "failed to parse tag: %s", str);
return -1;
}
@@ -116,9 +116,9 @@ static int tag_parse(git_tag *tag, const char *buffer, const char *buffer_end)
text_len = search - buffer;
- GITERR_CHECK_ALLOC_ADD(&alloc_len, text_len, 1);
+ GIT_ERROR_CHECK_ALLOC_ADD(&alloc_len, text_len, 1);
tag->tag_name = git__malloc(alloc_len);
- GITERR_CHECK_ALLOC(tag->tag_name);
+ GIT_ERROR_CHECK_ALLOC(tag->tag_name);
memcpy(tag->tag_name, buffer, text_len);
tag->tag_name[text_len] = '\0';
@@ -128,7 +128,7 @@ static int tag_parse(git_tag *tag, const char *buffer, const char *buffer_end)
tag->tagger = NULL;
if (buffer < buffer_end && *buffer != '\n') {
tag->tagger = git__malloc(sizeof(git_signature));
- GITERR_CHECK_ALLOC(tag->tagger);
+ GIT_ERROR_CHECK_ALLOC(tag->tagger);
if (git_signature__parse(tag->tagger, &buffer, buffer_end, "tagger ", '\n') < 0)
return -1;
@@ -148,9 +148,9 @@ static int tag_parse(git_tag *tag, const char *buffer, const char *buffer_end)
text_len = buffer_end - ++buffer;
- GITERR_CHECK_ALLOC_ADD(&alloc_len, text_len, 1);
+ GIT_ERROR_CHECK_ALLOC_ADD(&alloc_len, text_len, 1);
tag->message = git__malloc(alloc_len);
- GITERR_CHECK_ALLOC(tag->message);
+ GIT_ERROR_CHECK_ALLOC(tag->message);
memcpy(tag->message, buffer, text_len);
tag->message[text_len] = '\0';
@@ -239,7 +239,7 @@ static int write_tag_annotation(
on_error:
git_buf_dispose(&tag);
- giterr_set(GITERR_OBJECT, "failed to create tag annotation");
+ git_error_set(GIT_ERROR_OBJECT, "failed to create tag annotation");
return -1;
}
@@ -262,7 +262,7 @@ static int git_tag_create__internal(
assert(!create_tag_annotation || (tagger && message));
if (git_object_owner(target) != repo) {
- giterr_set(GITERR_INVALID, "the given target does not belong to this repository");
+ git_error_set(GIT_ERROR_INVALID, "the given target does not belong to this repository");
return -1;
}
@@ -274,7 +274,7 @@ static int git_tag_create__internal(
* reference unless overwriting has explicitly been requested **/
if (error == 0 && !allow_ref_overwrite) {
git_buf_dispose(&ref_name);
- giterr_set(GITERR_TAG, "tag already exists");
+ git_error_set(GIT_ERROR_TAG, "tag already exists");
return GIT_EEXISTS;
}
@@ -354,7 +354,7 @@ int git_tag_create_frombuffer(git_oid *oid, git_repository *repo, const char *bu
goto on_error;
if (tag.type != target_obj->cached.type) {
- giterr_set(GITERR_TAG, "the type for the given target is invalid");
+ git_error_set(GIT_ERROR_TAG, "the type for the given target is invalid");
goto on_error;
}
@@ -371,7 +371,7 @@ int git_tag_create_frombuffer(git_oid *oid, git_repository *repo, const char *bu
/** Ensure the tag name doesn't conflict with an already existing
* reference unless overwriting has explicitly been requested **/
if (error == 0 && !allow_ref_overwrite) {
- giterr_set(GITERR_TAG, "tag already exists");
+ git_error_set(GIT_ERROR_TAG, "tag already exists");
return GIT_EEXISTS;
}
@@ -443,7 +443,7 @@ static int tags_cb(const char *ref, void *data)
if (!(error = git_reference_name_to_id(&oid, d->repo, ref))) {
if ((error = d->cb(ref, &oid, d->cb_data)) != 0)
- giterr_set_after_callback_function(error, "git_tag_foreach");
+ git_error_set_after_callback_function(error, "git_tag_foreach");
}
return error;
@@ -478,7 +478,7 @@ static int tag_list_cb(const char *tag_name, git_oid *oid, void *data)
p_fnmatch(filter->pattern, tag_name + GIT_REFS_TAGS_DIR_LEN, 0) == 0)
{
char *matched = git__strdup(tag_name + GIT_REFS_TAGS_DIR_LEN);
- GITERR_CHECK_ALLOC(matched);
+ GIT_ERROR_CHECK_ALLOC(matched);
return git_vector_insert(filter->taglist, matched);
}
diff --git a/src/trace.c b/src/trace.c
index 080d1e8..f2f3538 100644
--- a/src/trace.c
+++ b/src/trace.c
@@ -31,7 +31,7 @@ int git_trace_set(git_trace_level_t level, git_trace_callback callback)
GIT_UNUSED(level);
GIT_UNUSED(callback);
- giterr_set(GITERR_INVALID,
+ git_error_set(GIT_ERROR_INVALID,
"this version of libgit2 was not built with tracing.");
return -1;
#endif
diff --git a/src/transaction.c b/src/transaction.c
index cc6d2b7..d8e38d8 100644
--- a/src/transaction.c
+++ b/src/transaction.c
@@ -60,7 +60,7 @@ int git_transaction_config_new(git_transaction **out, git_config *cfg)
assert(out && cfg);
tx = git__calloc(1, sizeof(git_transaction));
- GITERR_CHECK_ALLOC(tx);
+ GIT_ERROR_CHECK_ALLOC(tx);
tx->type = TRANSACTION_CONFIG;
tx->cfg = cfg;
@@ -111,10 +111,10 @@ int git_transaction_lock_ref(git_transaction *tx, const char *refname)
assert(tx && refname);
node = git_pool_mallocz(&tx->pool, sizeof(transaction_node));
- GITERR_CHECK_ALLOC(node);
+ GIT_ERROR_CHECK_ALLOC(node);
node->name = git_pool_strdup(&tx->pool, refname);
- GITERR_CHECK_ALLOC(node->name);
+ GIT_ERROR_CHECK_ALLOC(node->name);
if ((error = git_refdb_lock(&node->payload, tx->db, refname)) < 0)
return error;
@@ -138,7 +138,7 @@ static int find_locked(transaction_node **out, git_transaction *tx, const char *
pos = git_strmap_lookup_index(tx->locks, refname);
if (!git_strmap_valid_index(tx->locks, pos)) {
- giterr_set(GITERR_REFERENCE, "the specified reference is not locked");
+ git_error_set(GIT_ERROR_REFERENCE, "the specified reference is not locked");
return GIT_ENOTFOUND;
}
@@ -169,7 +169,7 @@ static int copy_common(transaction_node *node, git_transaction *tx, const git_si
if (msg) {
node->message = git_pool_strdup(&tx->pool, msg);
- GITERR_CHECK_ALLOC(node->message);
+ GIT_ERROR_CHECK_ALLOC(node->message);
}
return 0;
@@ -208,7 +208,7 @@ int git_transaction_set_symbolic_target(git_transaction *tx, const char *refname
return error;
node->target.symbolic = git_pool_strdup(&tx->pool, target);
- GITERR_CHECK_ALLOC(node->target.symbolic);
+ GIT_ERROR_CHECK_ALLOC(node->target.symbolic);
node->ref_type = GIT_REFERENCE_SYMBOLIC;
return 0;
@@ -235,18 +235,18 @@ static int dup_reflog(git_reflog **out, const git_reflog *in, git_pool *pool)
size_t len, i;
reflog = git_pool_mallocz(pool, sizeof(git_reflog));
- GITERR_CHECK_ALLOC(reflog);
+ GIT_ERROR_CHECK_ALLOC(reflog);
reflog->ref_name = git_pool_strdup(pool, in->ref_name);
- GITERR_CHECK_ALLOC(reflog->ref_name);
+ GIT_ERROR_CHECK_ALLOC(reflog->ref_name);
len = in->entries.length;
reflog->entries.length = len;
reflog->entries.contents = git_pool_mallocz(pool, len * sizeof(void *));
- GITERR_CHECK_ALLOC(reflog->entries.contents);
+ GIT_ERROR_CHECK_ALLOC(reflog->entries.contents);
entries = git_pool_mallocz(pool, len * sizeof(git_reflog_entry));
- GITERR_CHECK_ALLOC(entries);
+ GIT_ERROR_CHECK_ALLOC(entries);
for (i = 0; i < len; i++) {
const git_reflog_entry *src;
@@ -260,7 +260,7 @@ static int dup_reflog(git_reflog **out, const git_reflog *in, git_pool *pool)
git_oid_cpy(&tgt->oid_cur, &src->oid_cur);
tgt->msg = git_pool_strdup(pool, src->msg);
- GITERR_CHECK_ALLOC(tgt->msg);
+ GIT_ERROR_CHECK_ALLOC(tgt->msg);
if (git_signature__pdup(&tgt->committer, src->committer, pool) < 0)
return -1;
@@ -300,7 +300,7 @@ static int update_target(git_refdb *db, transaction_node *node)
abort();
}
- GITERR_CHECK_ALLOC(ref);
+ GIT_ERROR_CHECK_ALLOC(ref);
update_reflog = node->reflog == NULL;
if (node->remove) {
diff --git a/src/transport.c b/src/transport.c
index bf13fe7..227ee7d 100644
--- a/src/transport.c
+++ b/src/transport.c
@@ -123,7 +123,7 @@ int git_transport_new(git_transport **out, git_remote *owner, const char *url)
int error;
if ((error = transport_find_fn(&fn, url, ¶m)) == GIT_ENOTFOUND) {
- giterr_set(GITERR_NET, "unsupported URL protocol");
+ git_error_set(GIT_ERROR_NET, "unsupported URL protocol");
return -1;
} else if (error < 0)
return error;
@@ -131,7 +131,7 @@ int git_transport_new(git_transport **out, git_remote *owner, const char *url)
if ((error = fn(&transport, owner, param)) < 0)
return error;
- GITERR_CHECK_VERSION(transport, GIT_TRANSPORT_VERSION, "git_transport");
+ GIT_ERROR_CHECK_VERSION(transport, GIT_TRANSPORT_VERSION, "git_transport");
*out = transport;
@@ -162,7 +162,7 @@ int git_transport_register(
}
definition = git__calloc(1, sizeof(transport_definition));
- GITERR_CHECK_ALLOC(definition);
+ GIT_ERROR_CHECK_ALLOC(definition);
definition->prefix = git_buf_detach(&prefix);
definition->fn = cb;
diff --git a/src/transports/auth.c b/src/transports/auth.c
index dcc3e09..6c69282 100644
--- a/src/transports/auth.c
+++ b/src/transports/auth.c
@@ -23,7 +23,7 @@ static int basic_next_token(
GIT_UNUSED(ctx);
if (c->credtype != GIT_CREDTYPE_USERPASS_PLAINTEXT) {
- giterr_set(GITERR_INVALID, "invalid credential type for basic auth");
+ git_error_set(GIT_ERROR_INVALID, "invalid credential type for basic auth");
goto on_error;
}
diff --git a/src/transports/auth_negotiate.c b/src/transports/auth_negotiate.c
index 173ae99..25c865c 100644
--- a/src/transports/auth_negotiate.c
+++ b/src/transports/auth_negotiate.c
@@ -44,12 +44,12 @@ static void negotiate_err_set(
if (gss_display_status(&status_display, status_major, GSS_C_GSS_CODE,
GSS_C_NO_OID, &context, &buffer) == GSS_S_COMPLETE) {
- giterr_set(GITERR_NET, "%s: %.*s (%d.%d)",
+ git_error_set(GIT_ERROR_NET, "%s: %.*s (%d.%d)",
message, (int)buffer.length, (const char *)buffer.value,
status_major, status_minor);
gss_release_buffer(&status_minor, &buffer);
} else {
- giterr_set(GITERR_NET, "%s: unknown negotiate error (%d.%d)",
+ git_error_set(GIT_ERROR_NET, "%s: unknown negotiate error (%d.%d)",
message, status_major, status_minor);
}
}
@@ -65,7 +65,7 @@ static int negotiate_set_challenge(
git__free(ctx->challenge);
ctx->challenge = git__strdup(challenge);
- GITERR_CHECK_ALLOC(ctx->challenge);
+ GIT_ERROR_CHECK_ALLOC(ctx->challenge);
return 0;
}
@@ -109,13 +109,13 @@ static int negotiate_next_token(
challenge_len = ctx->challenge ? strlen(ctx->challenge) : 0;
if (challenge_len < 9) {
- giterr_set(GITERR_NET, "no negotiate challenge sent from server");
+ git_error_set(GIT_ERROR_NET, "no negotiate challenge sent from server");
error = -1;
goto done;
} else if (challenge_len > 9) {
if (git_buf_decode_base64(&input_buf,
ctx->challenge + 10, challenge_len - 10) < 0) {
- giterr_set(GITERR_NET, "invalid negotiate challenge from server");
+ git_error_set(GIT_ERROR_NET, "invalid negotiate challenge from server");
error = -1;
goto done;
}
@@ -124,7 +124,7 @@ static int negotiate_next_token(
input_token.length = input_buf.size;
input_token_ptr = &input_token;
} else if (ctx->gss_context != GSS_C_NO_CONTEXT) {
- giterr_set(GITERR_NET, "could not restart authentication");
+ git_error_set(GIT_ERROR_NET, "could not restart authentication");
error = -1;
goto done;
}
@@ -230,7 +230,7 @@ static int negotiate_init_context(
gss_release_oid_set(&status_minor, &mechanism_list);
if (!ctx->oid) {
- giterr_set(GITERR_NET, "negotiate authentication is not supported");
+ git_error_set(GIT_ERROR_NET, "negotiate authentication is not supported");
return -1;
}
@@ -255,7 +255,7 @@ int git_http_auth_negotiate(
*out = NULL;
ctx = git__calloc(1, sizeof(http_auth_negotiate_context));
- GITERR_CHECK_ALLOC(ctx);
+ GIT_ERROR_CHECK_ALLOC(ctx);
if (negotiate_init_context(ctx, connection_data) < 0) {
git__free(ctx);
diff --git a/src/transports/cred.c b/src/transports/cred.c
index 8055e2d..dfacc96 100644
--- a/src/transports/cred.c
+++ b/src/transports/cred.c
@@ -88,7 +88,7 @@ int git_cred_userpass_plaintext_new(
assert(cred && username && password);
c = git__malloc(sizeof(git_cred_userpass_plaintext));
- GITERR_CHECK_ALLOC(c);
+ GIT_ERROR_CHECK_ALLOC(c);
c->parent.credtype = GIT_CREDTYPE_USERPASS_PLAINTEXT;
c->parent.free = plaintext_free;
@@ -217,7 +217,7 @@ int git_cred_ssh_key_memory_new(
GIT_UNUSED(privatekey);
GIT_UNUSED(passphrase);
- giterr_set(GITERR_INVALID,
+ git_error_set(GIT_ERROR_INVALID,
"this version of libgit2 was not built with ssh memory credentials.");
return -1;
#endif
@@ -236,25 +236,25 @@ static int git_cred_ssh_key_type_new(
assert(username && cred && privatekey);
c = git__calloc(1, sizeof(git_cred_ssh_key));
- GITERR_CHECK_ALLOC(c);
+ GIT_ERROR_CHECK_ALLOC(c);
c->parent.credtype = credtype;
c->parent.free = ssh_key_free;
c->username = git__strdup(username);
- GITERR_CHECK_ALLOC(c->username);
+ GIT_ERROR_CHECK_ALLOC(c->username);
c->privatekey = git__strdup(privatekey);
- GITERR_CHECK_ALLOC(c->privatekey);
+ GIT_ERROR_CHECK_ALLOC(c->privatekey);
if (publickey) {
c->publickey = git__strdup(publickey);
- GITERR_CHECK_ALLOC(c->publickey);
+ GIT_ERROR_CHECK_ALLOC(c->publickey);
}
if (passphrase) {
c->passphrase = git__strdup(passphrase);
- GITERR_CHECK_ALLOC(c->passphrase);
+ GIT_ERROR_CHECK_ALLOC(c->passphrase);
}
*cred = &c->parent;
@@ -272,13 +272,13 @@ int git_cred_ssh_interactive_new(
assert(out && username && prompt_callback);
c = git__calloc(1, sizeof(git_cred_ssh_interactive));
- GITERR_CHECK_ALLOC(c);
+ GIT_ERROR_CHECK_ALLOC(c);
c->parent.credtype = GIT_CREDTYPE_SSH_INTERACTIVE;
c->parent.free = ssh_interactive_free;
c->username = git__strdup(username);
- GITERR_CHECK_ALLOC(c->username);
+ GIT_ERROR_CHECK_ALLOC(c->username);
c->prompt_callback = prompt_callback;
c->payload = payload;
@@ -293,13 +293,13 @@ int git_cred_ssh_key_from_agent(git_cred **cred, const char *username) {
assert(username && cred);
c = git__calloc(1, sizeof(git_cred_ssh_key));
- GITERR_CHECK_ALLOC(c);
+ GIT_ERROR_CHECK_ALLOC(c);
c->parent.credtype = GIT_CREDTYPE_SSH_KEY;
c->parent.free = ssh_key_free;
c->username = git__strdup(username);
- GITERR_CHECK_ALLOC(c->username);
+ GIT_ERROR_CHECK_ALLOC(c->username);
c->privatekey = NULL;
@@ -320,17 +320,17 @@ int git_cred_ssh_custom_new(
assert(username && cred);
c = git__calloc(1, sizeof(git_cred_ssh_custom));
- GITERR_CHECK_ALLOC(c);
+ GIT_ERROR_CHECK_ALLOC(c);
c->parent.credtype = GIT_CREDTYPE_SSH_CUSTOM;
c->parent.free = ssh_custom_free;
c->username = git__strdup(username);
- GITERR_CHECK_ALLOC(c->username);
+ GIT_ERROR_CHECK_ALLOC(c->username);
if (publickey_len > 0) {
c->publickey = git__malloc(publickey_len);
- GITERR_CHECK_ALLOC(c->publickey);
+ GIT_ERROR_CHECK_ALLOC(c->publickey);
memcpy(c->publickey, publickey, publickey_len);
}
@@ -350,7 +350,7 @@ int git_cred_default_new(git_cred **cred)
assert(cred);
c = git__calloc(1, sizeof(git_cred_default));
- GITERR_CHECK_ALLOC(c);
+ GIT_ERROR_CHECK_ALLOC(c);
c->credtype = GIT_CREDTYPE_DEFAULT;
c->free = default_free;
@@ -368,10 +368,10 @@ int git_cred_username_new(git_cred **cred, const char *username)
len = strlen(username);
- GITERR_CHECK_ALLOC_ADD(&allocsize, sizeof(git_cred_username), len);
- GITERR_CHECK_ALLOC_ADD(&allocsize, allocsize, 1);
+ GIT_ERROR_CHECK_ALLOC_ADD(&allocsize, sizeof(git_cred_username), len);
+ GIT_ERROR_CHECK_ALLOC_ADD(&allocsize, allocsize, 1);
c = git__malloc(allocsize);
- GITERR_CHECK_ALLOC(c);
+ GIT_ERROR_CHECK_ALLOC(c);
c->parent.credtype = GIT_CREDTYPE_USERNAME;
c->parent.free = username_free;
diff --git a/src/transports/git.c b/src/transports/git.c
index 82a565f..b3f563d 100644
--- a/src/transports/git.c
+++ b/src/transports/git.c
@@ -47,7 +47,7 @@ static int gen_proto(git_buf *request, const char *cmd, const char *url)
delim = strchr(url, '/');
if (delim == NULL) {
- giterr_set(GITERR_NET, "malformed URL");
+ git_error_set(GIT_ERROR_NET, "malformed URL");
return -1;
}
@@ -163,7 +163,7 @@ static int git_proto_stream_alloc(
return -1;
s = git__calloc(1, sizeof(git_proto_stream));
- GITERR_CHECK_ALLOC(s);
+ GIT_ERROR_CHECK_ALLOC(s);
s->parent.subtransport = &t->parent;
s->parent.read = git_proto_stream_read;
@@ -181,7 +181,7 @@ static int git_proto_stream_alloc(
if ((git_socket_stream_new(&s->io, host, port)) < 0)
return -1;
- GITERR_CHECK_VERSION(s->io, GIT_STREAM_VERSION, "git_stream");
+ GIT_ERROR_CHECK_VERSION(s->io, GIT_STREAM_VERSION, "git_stream");
*stream = &s->parent;
return 0;
@@ -242,7 +242,7 @@ static int _git_uploadpack(
return 0;
}
- giterr_set(GITERR_NET, "must call UPLOADPACK_LS before UPLOADPACK");
+ git_error_set(GIT_ERROR_NET, "must call UPLOADPACK_LS before UPLOADPACK");
return -1;
}
@@ -298,7 +298,7 @@ static int _git_receivepack(
return 0;
}
- giterr_set(GITERR_NET, "must call RECEIVEPACK_LS before RECEIVEPACK");
+ git_error_set(GIT_ERROR_NET, "must call RECEIVEPACK_LS before RECEIVEPACK");
return -1;
}
@@ -358,7 +358,7 @@ int git_smart_subtransport_git(git_smart_subtransport **out, git_transport *owne
return -1;
t = git__calloc(1, sizeof(git_subtransport));
- GITERR_CHECK_ALLOC(t);
+ GIT_ERROR_CHECK_ALLOC(t);
t->owner = owner;
t->parent.action = _git_action;
diff --git a/src/transports/http.c b/src/transports/http.c
index 387754e..2168072 100644
--- a/src/transports/http.c
+++ b/src/transports/http.c
@@ -307,44 +307,44 @@ static int on_header_ready(http_subtransport *t)
if (!strcasecmp("Content-Type", git_buf_cstr(name))) {
if (t->content_type) {
- giterr_set(GITERR_NET, "multiple Content-Type headers");
+ git_error_set(GIT_ERROR_NET, "multiple Content-Type headers");
return -1;
}
t->content_type = git__strdup(git_buf_cstr(value));
- GITERR_CHECK_ALLOC(t->content_type);
+ GIT_ERROR_CHECK_ALLOC(t->content_type);
}
else if (!strcasecmp("Content-Length", git_buf_cstr(name))) {
if (t->content_length) {
- giterr_set(GITERR_NET, "multiple Content-Length headers");
+ git_error_set(GIT_ERROR_NET, "multiple Content-Length headers");
return -1;
}
t->content_length = git__strdup(git_buf_cstr(value));
- GITERR_CHECK_ALLOC(t->content_length);
+ GIT_ERROR_CHECK_ALLOC(t->content_length);
}
else if (!strcasecmp("Proxy-Authenticate", git_buf_cstr(name))) {
char *dup = git__strdup(git_buf_cstr(value));
- GITERR_CHECK_ALLOC(dup);
+ GIT_ERROR_CHECK_ALLOC(dup);
if (git_vector_insert(&t->proxy.auth_challenges, dup) < 0)
return -1;
}
else if (!strcasecmp("WWW-Authenticate", git_buf_cstr(name))) {
char *dup = git__strdup(git_buf_cstr(value));
- GITERR_CHECK_ALLOC(dup);
+ GIT_ERROR_CHECK_ALLOC(dup);
if (git_vector_insert(&t->server.auth_challenges, dup) < 0)
return -1;
}
else if (!strcasecmp("Location", git_buf_cstr(name))) {
if (t->location) {
- giterr_set(GITERR_NET, "multiple Location headers");
+ git_error_set(GIT_ERROR_NET, "multiple Location headers");
return -1;
}
t->location = git__strdup(git_buf_cstr(value));
- GITERR_CHECK_ALLOC(t->location);
+ GIT_ERROR_CHECK_ALLOC(t->location);
}
return 0;
@@ -411,7 +411,7 @@ static int on_auth_required(
int ret;
if (!allowed_types) {
- giterr_set(GITERR_NET, "%s requested authentication but did not negotiate mechanisms", type);
+ git_error_set(GIT_ERROR_NET, "%s requested authentication but did not negotiate mechanisms", type);
t->parse_error = PARSE_ERROR_GENERIC;
return t->parse_error;
}
@@ -430,7 +430,7 @@ static int on_auth_required(
assert(*creds);
if (!((*creds)->credtype & allowed_types)) {
- giterr_set(GITERR_NET, "%s credential provider returned an invalid cred type", type);
+ git_error_set(GIT_ERROR_NET, "%s credential provider returned an invalid cred type", type);
t->parse_error = PARSE_ERROR_GENERIC;
return t->parse_error;
}
@@ -441,7 +441,7 @@ static int on_auth_required(
}
}
- giterr_set(GITERR_NET, "%s authentication required but no callback set",
+ git_error_set(GIT_ERROR_NET, "%s authentication required but no callback set",
type);
t->parse_error = PARSE_ERROR_GENERIC;
return t->parse_error;
@@ -457,7 +457,7 @@ static int on_headers_complete(http_parser *parser)
/* Enforce a reasonable cap on the number of replays */
if (t->replay_count++ >= GIT_HTTP_REPLAY_MAX) {
- giterr_set(GITERR_NET, "too many redirects or authentication replays");
+ git_error_set(GIT_ERROR_NET, "too many redirects or authentication replays");
return t->parse_error = PARSE_ERROR_GENERIC;
}
@@ -525,7 +525,7 @@ static int on_headers_complete(http_parser *parser)
/* Check for a 200 HTTP status code. */
if (parser->status_code != 200) {
- giterr_set(GITERR_NET,
+ git_error_set(GIT_ERROR_NET,
"unexpected HTTP status code: %d",
parser->status_code);
return t->parse_error = PARSE_ERROR_GENERIC;
@@ -533,7 +533,7 @@ static int on_headers_complete(http_parser *parser)
/* The response must contain a Content-Type header. */
if (!t->content_type) {
- giterr_set(GITERR_NET, "no Content-Type header in response");
+ git_error_set(GIT_ERROR_NET, "no Content-Type header in response");
return t->parse_error = PARSE_ERROR_GENERIC;
}
@@ -552,7 +552,7 @@ static int on_headers_complete(http_parser *parser)
if (strcmp(t->content_type, git_buf_cstr(&buf))) {
git_buf_dispose(&buf);
- giterr_set(GITERR_NET,
+ git_error_set(GIT_ERROR_NET,
"invalid Content-Type: %s",
t->content_type);
return t->parse_error = PARSE_ERROR_GENERIC;
@@ -588,7 +588,7 @@ static int on_body_fill_buffer(http_parser *parser, const char *str, size_t len)
/* If there's no buffer set, we're explicitly ignoring the body. */
if (ctx->buffer) {
if (ctx->buf_size < len) {
- giterr_set(GITERR_NET, "can't fit data in the buffer");
+ git_error_set(GIT_ERROR_NET, "can't fit data in the buffer");
return t->parse_error = PARSE_ERROR_GENERIC;
}
@@ -702,7 +702,7 @@ static int load_proxy_config(http_subtransport *t)
return error;
if (t->proxy.url.use_ssl) {
- giterr_set(GITERR_NET, "SSL connections to proxy are not supported");
+ git_error_set(GIT_ERROR_NET, "SSL connections to proxy are not supported");
return -1;
}
@@ -723,18 +723,18 @@ static int check_certificate(
if ((error = git_stream_certificate(&cert, stream)) < 0)
return error;
- giterr_state_capture(&last_error, GIT_ECERTIFICATE);
+ git_error_state_capture(&last_error, GIT_ECERTIFICATE);
error = cert_cb(cert, is_valid, url->host, cert_cb_payload);
if (error == GIT_PASSTHROUGH && !is_valid)
- return giterr_state_restore(&last_error);
+ return git_error_state_restore(&last_error);
else if (error == GIT_PASSTHROUGH)
error = 0;
- else if (error && !giterr_last())
- giterr_set(GITERR_NET, "user rejected certificate for %s", url->host);
+ else if (error && !git_error_last())
+ git_error_set(GIT_ERROR_NET, "user rejected certificate for %s", url->host);
- giterr_state_free(&last_error);
+ git_error_state_free(&last_error);
return error;
}
@@ -746,7 +746,7 @@ static int stream_connect(
{
int error;
- GITERR_CHECK_VERSION(stream, GIT_STREAM_VERSION, "git_stream");
+ GIT_ERROR_CHECK_VERSION(stream, GIT_STREAM_VERSION, "git_stream");
error = git_stream_connect(stream);
@@ -786,7 +786,7 @@ static int proxy_headers_complete(http_parser *parser)
/* Enforce a reasonable cap on the number of replays */
if (t->replay_count++ >= GIT_HTTP_REPLAY_MAX) {
- giterr_set(GITERR_NET, "too many redirects or authentication replays");
+ git_error_set(GIT_ERROR_NET, "too many redirects or authentication replays");
return t->parse_error = PARSE_ERROR_GENERIC;
}
@@ -816,7 +816,7 @@ static int proxy_headers_complete(http_parser *parser)
proxy_auth_types);
if (parser->status_code != 200) {
- giterr_set(GITERR_NET, "unexpected status code from proxy: %d",
+ git_error_set(GIT_ERROR_NET, "unexpected status code from proxy: %d",
parser->status_code);
return t->parse_error = PARSE_ERROR_GENERIC;
}
@@ -886,7 +886,7 @@ replay:
/* Ensure that we didn't get a redirect; unsupported. */
if (t->location) {
- giterr_set(GITERR_NET, "proxy server sent unsupported redirect during CONNECT");
+ git_error_set(GIT_ERROR_NET, "proxy server sent unsupported redirect during CONNECT");
error = -1;
goto done;
}
@@ -901,7 +901,7 @@ replay:
}
if (bytes_parsed != t->parse_buffer.offset) {
- giterr_set(GITERR_NET,
+ git_error_set(GIT_ERROR_NET,
"HTTP parser error: %s",
http_errno_description((enum http_errno)t->parser.http_errno));
error = -1;
@@ -1128,7 +1128,7 @@ replay:
return -1;
if (bytes_parsed != t->parse_buffer.offset - data_offset) {
- giterr_set(GITERR_NET,
+ git_error_set(GIT_ERROR_NET,
"HTTP parser error: %s",
http_errno_description((enum http_errno)t->parser.http_errno));
return -1;
@@ -1224,7 +1224,7 @@ static int http_stream_write_single(
assert(t->connected);
if (s->sent_request) {
- giterr_set(GITERR_NET, "subtransport configured for only one write");
+ git_error_set(GIT_ERROR_NET, "subtransport configured for only one write");
return -1;
}
@@ -1272,7 +1272,7 @@ static int http_stream_alloc(http_subtransport *t,
return -1;
s = git__calloc(sizeof(http_stream), 1);
- GITERR_CHECK_ALLOC(s);
+ GIT_ERROR_CHECK_ALLOC(s);
s->parent.subtransport = &t->parent;
s->parent.read = http_stream_read;
@@ -1478,7 +1478,7 @@ int git_smart_subtransport_http(git_smart_subtransport **out, git_transport *own
return -1;
t = git__calloc(sizeof(http_subtransport), 1);
- GITERR_CHECK_ALLOC(t);
+ GIT_ERROR_CHECK_ALLOC(t);
t->owner = (transport_smart *)owner;
t->parent.action = http_action;
diff --git a/src/transports/local.c b/src/transports/local.c
index b8cc950..b544491 100644
--- a/src/transports/local.c
+++ b/src/transports/local.c
@@ -83,7 +83,7 @@ static int add_ref(transport_local *t, const char *name)
if (!strcmp(name, GIT_HEAD_FILE) && error == GIT_ENOTFOUND) {
/* This is actually okay. Empty repos often have a HEAD that
* points to a nonexistent "refs/heads/master". */
- giterr_clear();
+ git_error_clear();
return 0;
}
return error;
@@ -93,16 +93,16 @@ static int add_ref(transport_local *t, const char *name)
git_reference_free(resolved);
head = git__calloc(1, sizeof(git_remote_head));
- GITERR_CHECK_ALLOC(head);
+ GIT_ERROR_CHECK_ALLOC(head);
head->name = git__strdup(name);
- GITERR_CHECK_ALLOC(head->name);
+ GIT_ERROR_CHECK_ALLOC(head->name);
git_oid_cpy(&head->oid, &obj_id);
if (git_reference_type(ref) == GIT_REFERENCE_SYMBOLIC) {
head->symref_target = git__strdup(git_reference_symbolic_target(ref));
- GITERR_CHECK_ALLOC(head->symref_target);
+ GIT_ERROR_CHECK_ALLOC(head->symref_target);
}
git_reference_free(ref);
@@ -130,7 +130,7 @@ static int add_ref(transport_local *t, const char *name)
/* And if it's a tag, peel it, and add it to the list */
head = git__calloc(1, sizeof(git_remote_head));
- GITERR_CHECK_ALLOC(head);
+ GIT_ERROR_CHECK_ALLOC(head);
if (git_buf_join(&buf, 0, name, peeled) < 0) {
free_head(head);
@@ -222,7 +222,7 @@ static int local_connect(
free_heads(&t->refs);
t->url = git__strdup(url);
- GITERR_CHECK_ALLOC(t->url);
+ GIT_ERROR_CHECK_ALLOC(t->url);
t->direction = direction;
t->flags = flags;
@@ -255,7 +255,7 @@ static int local_ls(const git_remote_head ***out, size_t *size, git_transport *t
transport_local *t = (transport_local *)transport;
if (!t->have_refs) {
- giterr_set(GITERR_NET, "the transport has not yet loaded the refs");
+ git_error_set(GIT_ERROR_NET, "the transport has not yet loaded the refs");
return -1;
}
@@ -288,7 +288,7 @@ static int local_negotiate_fetch(
else if (error != GIT_ENOTFOUND)
return error;
else
- giterr_clear();
+ git_error_clear();
git_object_free(obj);
}
@@ -374,7 +374,7 @@ static int local_push(
but we forbid all pushes just in case */
if (!remote_repo->is_bare) {
error = GIT_EBAREREPO;
- giterr_set(GITERR_INVALID, "local push doesn't (yet) support pushing to non-bare repos.");
+ git_error_set(GIT_ERROR_INVALID, "local push doesn't (yet) support pushing to non-bare repos.");
goto on_error;
}
@@ -418,7 +418,7 @@ static int local_push(
status->msg = git__strdup("Remote branch not found to delete");
break;
default:
- last = giterr_last();
+ last = git_error_last();
if (last && last->message)
status->msg = git__strdup(last->message);
@@ -520,8 +520,8 @@ static int foreach_reference_cb(git_reference *reference, void *payload)
error = git_revwalk_hide(walk, git_reference_target(reference));
/* The reference is in the local repository, so the target may not
* exist on the remote. It also may not be a commit. */
- if (error == GIT_ENOTFOUND || error == GITERR_INVALID) {
- giterr_clear();
+ if (error == GIT_ENOTFOUND || error == GIT_ERROR_INVALID) {
+ git_error_clear();
error = 0;
}
@@ -718,7 +718,7 @@ int git_transport_local(git_transport **out, git_remote *owner, void *param)
GIT_UNUSED(param);
t = git__calloc(1, sizeof(transport_local));
- GITERR_CHECK_ALLOC(t);
+ GIT_ERROR_CHECK_ALLOC(t);
t->parent.version = GIT_TRANSPORT_VERSION;
t->parent.set_callbacks = local_set_callbacks;
diff --git a/src/transports/smart.c b/src/transports/smart.c
index 9fcbdcf..fd7113c 100644
--- a/src/transports/smart.c
+++ b/src/transports/smart.c
@@ -139,11 +139,11 @@ static int git_smart__set_custom_headers(
for (i = 0; i < custom_headers->count; i++) {
if (is_malformed_http_header(custom_headers->strings[i])) {
- giterr_set(GITERR_INVALID, "custom HTTP header '%s' is malformed", custom_headers->strings[i]);
+ git_error_set(GIT_ERROR_INVALID, "custom HTTP header '%s' is malformed", custom_headers->strings[i]);
return -1;
}
if (is_forbidden_custom_header(custom_headers->strings[i])) {
- giterr_set(GITERR_INVALID, "custom HTTP header '%s' is already set by libgit2", custom_headers->strings[i]);
+ git_error_set(GIT_ERROR_INVALID, "custom HTTP header '%s' is already set by libgit2", custom_headers->strings[i]);
return -1;
}
}
@@ -224,7 +224,7 @@ static int git_smart__connect(
return -1;
t->url = git__strdup(url);
- GITERR_CHECK_ALLOC(t->url);
+ GIT_ERROR_CHECK_ALLOC(t->url);
if (git_proxy_options_dup(&t->proxy, proxy) < 0)
return -1;
@@ -239,7 +239,7 @@ static int git_smart__connect(
else if (GIT_DIRECTION_PUSH == t->direction)
service = GIT_SERVICE_RECEIVEPACK_LS;
else {
- giterr_set(GITERR_NET, "invalid direction");
+ git_error_set(GIT_ERROR_NET, "invalid direction");
return -1;
}
@@ -260,7 +260,7 @@ static int git_smart__connect(
pkt = (git_pkt *)git_vector_get(&t->refs, 0);
if (!pkt || GIT_PKT_COMMENT != pkt->type) {
- giterr_set(GITERR_NET, "invalid response");
+ git_error_set(GIT_ERROR_NET, "invalid response");
return -1;
} else {
/* Remove the comment pkt from the list */
@@ -274,7 +274,7 @@ static int git_smart__connect(
pkt = (git_pkt *)git_vector_get(&t->refs, 0);
if (pkt && GIT_PKT_REF != pkt->type) {
- giterr_set(GITERR_NET, "invalid response");
+ git_error_set(GIT_ERROR_NET, "invalid response");
return -1;
}
first = (git_pkt_ref *)pkt;
@@ -297,7 +297,7 @@ static int git_smart__connect(
/* There was no ref packet received, or the cap list was empty */
error = 0;
} else {
- giterr_set(GITERR_NET, "invalid response");
+ git_error_set(GIT_ERROR_NET, "invalid response");
goto cleanup;
}
@@ -318,7 +318,7 @@ static int git_smart__ls(const git_remote_head ***out, size_t *size, git_transpo
transport_smart *t = (transport_smart *)transport;
if (!t->have_refs) {
- giterr_set(GITERR_NET, "the transport has not yet loaded the refs");
+ git_error_set(GIT_ERROR_NET, "the transport has not yet loaded the refs");
return -1;
}
@@ -338,7 +338,7 @@ int git_smart__negotiation_step(git_transport *transport, void *data, size_t len
return -1;
if (GIT_DIRECTION_FETCH != t->direction) {
- giterr_set(GITERR_NET, "this operation is only valid for fetch");
+ git_error_set(GIT_ERROR_NET, "this operation is only valid for fetch");
return -1;
}
@@ -367,7 +367,7 @@ int git_smart__get_push_stream(transport_smart *t, git_smart_subtransport_stream
return -1;
if (GIT_DIRECTION_PUSH != t->direction) {
- giterr_set(GITERR_NET, "this operation is only valid for push");
+ git_error_set(GIT_ERROR_NET, "this operation is only valid for push");
return -1;
}
@@ -516,7 +516,7 @@ int git_transport_smart(git_transport **out, git_remote *owner, void *param)
return -1;
t = git__calloc(1, sizeof(transport_smart));
- GITERR_CHECK_ALLOC(t);
+ GIT_ERROR_CHECK_ALLOC(t);
t->parent.version = GIT_TRANSPORT_VERSION;
t->parent.set_callbacks = git_smart__set_callbacks;
diff --git a/src/transports/smart_pkt.c b/src/transports/smart_pkt.c
index fb59c70..9bc273e 100644
--- a/src/transports/smart_pkt.c
+++ b/src/transports/smart_pkt.c
@@ -31,7 +31,7 @@ static int flush_pkt(git_pkt **out)
git_pkt *pkt;
pkt = git__malloc(sizeof(git_pkt));
- GITERR_CHECK_ALLOC(pkt);
+ GIT_ERROR_CHECK_ALLOC(pkt);
pkt->type = GIT_PKT_FLUSH;
*out = pkt;
@@ -45,7 +45,7 @@ static int ack_pkt(git_pkt **out, const char *line, size_t len)
git_pkt_ack *pkt;
pkt = git__calloc(1, sizeof(git_pkt_ack));
- GITERR_CHECK_ALLOC(pkt);
+ GIT_ERROR_CHECK_ALLOC(pkt);
pkt->type = GIT_PKT_ACK;
if (git__prefixncmp(line, len, "ACK "))
@@ -77,7 +77,7 @@ static int ack_pkt(git_pkt **out, const char *line, size_t len)
return 0;
out_err:
- giterr_set(GITERR_NET, "error parsing ACK pkt-line");
+ git_error_set(GIT_ERROR_NET, "error parsing ACK pkt-line");
git__free(pkt);
return -1;
}
@@ -87,7 +87,7 @@ static int nak_pkt(git_pkt **out)
git_pkt *pkt;
pkt = git__malloc(sizeof(git_pkt));
- GITERR_CHECK_ALLOC(pkt);
+ GIT_ERROR_CHECK_ALLOC(pkt);
pkt->type = GIT_PKT_NAK;
*out = pkt;
@@ -100,10 +100,10 @@ static int comment_pkt(git_pkt **out, const char *line, size_t len)
git_pkt_comment *pkt;
size_t alloclen;
- GITERR_CHECK_ALLOC_ADD(&alloclen, sizeof(git_pkt_comment), len);
- GITERR_CHECK_ALLOC_ADD(&alloclen, alloclen, 1);
+ GIT_ERROR_CHECK_ALLOC_ADD(&alloclen, sizeof(git_pkt_comment), len);
+ GIT_ERROR_CHECK_ALLOC_ADD(&alloclen, alloclen, 1);
pkt = git__malloc(alloclen);
- GITERR_CHECK_ALLOC(pkt);
+ GIT_ERROR_CHECK_ALLOC(pkt);
pkt->type = GIT_PKT_COMMENT;
memcpy(pkt->comment, line, len);
@@ -125,10 +125,10 @@ static int err_pkt(git_pkt **out, const char *line, size_t len)
line += 4;
len -= 4;
- GITERR_CHECK_ALLOC_ADD(&alloclen, sizeof(git_pkt_progress), len);
- GITERR_CHECK_ALLOC_ADD(&alloclen, alloclen, 1);
+ GIT_ERROR_CHECK_ALLOC_ADD(&alloclen, sizeof(git_pkt_progress), len);
+ GIT_ERROR_CHECK_ALLOC_ADD(&alloclen, alloclen, 1);
pkt = git__malloc(alloclen);
- GITERR_CHECK_ALLOC(pkt);
+ GIT_ERROR_CHECK_ALLOC(pkt);
pkt->type = GIT_PKT_ERR;
pkt->len = len;
@@ -140,7 +140,7 @@ static int err_pkt(git_pkt **out, const char *line, size_t len)
return 0;
out_err:
- giterr_set(GITERR_NET, "error parsing ERR pkt-line");
+ git_error_set(GIT_ERROR_NET, "error parsing ERR pkt-line");
git__free(pkt);
return -1;
}
@@ -153,9 +153,9 @@ static int data_pkt(git_pkt **out, const char *line, size_t len)
line++;
len--;
- GITERR_CHECK_ALLOC_ADD(&alloclen, sizeof(git_pkt_progress), len);
+ GIT_ERROR_CHECK_ALLOC_ADD(&alloclen, sizeof(git_pkt_progress), len);
pkt = git__malloc(alloclen);
- GITERR_CHECK_ALLOC(pkt);
+ GIT_ERROR_CHECK_ALLOC(pkt);
pkt->type = GIT_PKT_DATA;
pkt->len = len;
@@ -174,9 +174,9 @@ static int sideband_progress_pkt(git_pkt **out, const char *line, size_t len)
line++;
len--;
- GITERR_CHECK_ALLOC_ADD(&alloclen, sizeof(git_pkt_progress), len);
+ GIT_ERROR_CHECK_ALLOC_ADD(&alloclen, sizeof(git_pkt_progress), len);
pkt = git__malloc(alloclen);
- GITERR_CHECK_ALLOC(pkt);
+ GIT_ERROR_CHECK_ALLOC(pkt);
pkt->type = GIT_PKT_PROGRESS;
pkt->len = len;
@@ -195,10 +195,10 @@ static int sideband_error_pkt(git_pkt **out, const char *line, size_t len)
line++;
len--;
- GITERR_CHECK_ALLOC_ADD(&alloc_len, sizeof(git_pkt_err), len);
- GITERR_CHECK_ALLOC_ADD(&alloc_len, alloc_len, 1);
+ GIT_ERROR_CHECK_ALLOC_ADD(&alloc_len, sizeof(git_pkt_err), len);
+ GIT_ERROR_CHECK_ALLOC_ADD(&alloc_len, alloc_len, 1);
pkt = git__malloc(alloc_len);
- GITERR_CHECK_ALLOC(pkt);
+ GIT_ERROR_CHECK_ALLOC(pkt);
pkt->type = GIT_PKT_ERR;
pkt->len = (int)len;
@@ -219,7 +219,7 @@ static int ref_pkt(git_pkt **out, const char *line, size_t len)
size_t alloclen;
pkt = git__calloc(1, sizeof(git_pkt_ref));
- GITERR_CHECK_ALLOC(pkt);
+ GIT_ERROR_CHECK_ALLOC(pkt);
pkt->type = GIT_PKT_REF;
if (len < GIT_OID_HEXSZ || git_oid_fromstr(&pkt->head.oid, line) < 0)
@@ -238,9 +238,9 @@ static int ref_pkt(git_pkt **out, const char *line, size_t len)
if (line[len - 1] == '\n')
--len;
- GITERR_CHECK_ALLOC_ADD(&alloclen, len, 1);
+ GIT_ERROR_CHECK_ALLOC_ADD(&alloclen, len, 1);
pkt->head.name = git__malloc(alloclen);
- GITERR_CHECK_ALLOC(pkt->head.name);
+ GIT_ERROR_CHECK_ALLOC(pkt->head.name);
memcpy(pkt->head.name, line, len);
pkt->head.name[len] = '\0';
@@ -252,7 +252,7 @@ static int ref_pkt(git_pkt **out, const char *line, size_t len)
return 0;
out_err:
- giterr_set(GITERR_NET, "error parsing REF pkt-line");
+ git_error_set(GIT_ERROR_NET, "error parsing REF pkt-line");
if (pkt)
git__free(pkt->head.name);
git__free(pkt);
@@ -265,7 +265,7 @@ static int ok_pkt(git_pkt **out, const char *line, size_t len)
size_t alloc_len;
pkt = git__malloc(sizeof(*pkt));
- GITERR_CHECK_ALLOC(pkt);
+ GIT_ERROR_CHECK_ALLOC(pkt);
pkt->type = GIT_PKT_OK;
if (git__prefixncmp(line, len, "ok "))
@@ -276,9 +276,9 @@ static int ok_pkt(git_pkt **out, const char *line, size_t len)
if (line[len - 1] == '\n')
--len;
- GITERR_CHECK_ALLOC_ADD(&alloc_len, len, 1);
+ GIT_ERROR_CHECK_ALLOC_ADD(&alloc_len, len, 1);
pkt->ref = git__malloc(alloc_len);
- GITERR_CHECK_ALLOC(pkt->ref);
+ GIT_ERROR_CHECK_ALLOC(pkt->ref);
memcpy(pkt->ref, line, len);
pkt->ref[len] = '\0';
@@ -287,7 +287,7 @@ static int ok_pkt(git_pkt **out, const char *line, size_t len)
return 0;
out_err:
- giterr_set(GITERR_NET, "error parsing OK pkt-line");
+ git_error_set(GIT_ERROR_NET, "error parsing OK pkt-line");
git__free(pkt);
return -1;
}
@@ -299,7 +299,7 @@ static int ng_pkt(git_pkt **out, const char *line, size_t len)
size_t alloclen;
pkt = git__malloc(sizeof(*pkt));
- GITERR_CHECK_ALLOC(pkt);
+ GIT_ERROR_CHECK_ALLOC(pkt);
pkt->ref = NULL;
pkt->type = GIT_PKT_NG;
@@ -314,9 +314,9 @@ static int ng_pkt(git_pkt **out, const char *line, size_t len)
goto out_err;
len = ptr - line;
- GITERR_CHECK_ALLOC_ADD(&alloclen, len, 1);
+ GIT_ERROR_CHECK_ALLOC_ADD(&alloclen, len, 1);
pkt->ref = git__malloc(alloclen);
- GITERR_CHECK_ALLOC(pkt->ref);
+ GIT_ERROR_CHECK_ALLOC(pkt->ref);
memcpy(pkt->ref, line, len);
pkt->ref[len] = '\0';
@@ -329,9 +329,9 @@ static int ng_pkt(git_pkt **out, const char *line, size_t len)
goto out_err;
len = ptr - line;
- GITERR_CHECK_ALLOC_ADD(&alloclen, len, 1);
+ GIT_ERROR_CHECK_ALLOC_ADD(&alloclen, len, 1);
pkt->msg = git__malloc(alloclen);
- GITERR_CHECK_ALLOC(pkt->msg);
+ GIT_ERROR_CHECK_ALLOC(pkt->msg);
memcpy(pkt->msg, line, len);
pkt->msg[len] = '\0';
@@ -340,7 +340,7 @@ static int ng_pkt(git_pkt **out, const char *line, size_t len)
return 0;
out_err:
- giterr_set(GITERR_NET, "invalid packet line");
+ git_error_set(GIT_ERROR_NET, "invalid packet line");
git__free(pkt->ref);
git__free(pkt);
return -1;
@@ -351,7 +351,7 @@ static int unpack_pkt(git_pkt **out, const char *line, size_t len)
git_pkt_unpack *pkt;
pkt = git__malloc(sizeof(*pkt));
- GITERR_CHECK_ALLOC(pkt);
+ GIT_ERROR_CHECK_ALLOC(pkt);
pkt->type = GIT_PKT_UNPACK;
if (!git__prefixncmp(line, len, "unpack ok"))
@@ -386,7 +386,7 @@ static int parse_len(size_t *out, const char *line, size_t linelen)
}
}
- giterr_set(GITERR_NET, "invalid hex digit in length: '%s'", num);
+ git_error_set(GIT_ERROR_NET, "invalid hex digit in length: '%s'", num);
return -1;
}
}
@@ -430,9 +430,9 @@ int git_pkt_parse_line(
if (error == GIT_EBUFS)
;
else if (!git__prefixncmp(line, linelen, "PACK"))
- giterr_set(GITERR_NET, "unexpected pack file");
+ git_error_set(GIT_ERROR_NET, "unexpected pack file");
else
- giterr_set(GITERR_NET, "bad packet length");
+ git_error_set(GIT_ERROR_NET, "bad packet length");
return error;
}
@@ -458,7 +458,7 @@ int git_pkt_parse_line(
* line, we should return an error upon hitting one.
*/
if (len == PKT_LEN_SIZE) {
- giterr_set_str(GITERR_NET, "Invalid empty packet");
+ git_error_set_str(GIT_ERROR_NET, "Invalid empty packet");
return GIT_ERROR;
}
@@ -561,7 +561,7 @@ static int buffer_want_with_caps(const git_remote_head *head, transport_smart_ca
git_buf_len(&str) + 1 /* LF */;
if (len > 0xffff) {
- giterr_set(GITERR_NET,
+ git_error_set(GIT_ERROR_NET,
"tried to produce packet with invalid length %" PRIuZ, len);
return -1;
}
@@ -572,7 +572,7 @@ static int buffer_want_with_caps(const git_remote_head *head, transport_smart_ca
"%04xwant %s %s\n", (unsigned int)len, oid, git_buf_cstr(&str));
git_buf_dispose(&str);
- GITERR_CHECK_ALLOC_BUF(buf);
+ GIT_ERROR_CHECK_ALLOC_BUF(buf);
return 0;
}
diff --git a/src/transports/smart_protocol.c b/src/transports/smart_protocol.c
index 031f851..2d8a1d8 100644
--- a/src/transports/smart_protocol.c
+++ b/src/transports/smart_protocol.c
@@ -56,7 +56,7 @@ int git_smart__store_refs(transport_smart *t, int flushes)
return recvd;
if (recvd == 0) {
- giterr_set(GITERR_NET, "early EOF");
+ git_error_set(GIT_ERROR_NET, "early EOF");
return GIT_EEOF;
}
@@ -65,7 +65,7 @@ int git_smart__store_refs(transport_smart *t, int flushes)
gitno_consume(buf, line_end);
if (pkt->type == GIT_PKT_ERR) {
- giterr_set(GITERR_NET, "remote error: %s", ((git_pkt_err *)pkt)->error);
+ git_error_set(GIT_ERROR_NET, "remote error: %s", ((git_pkt_err *)pkt)->error);
git__free(pkt);
return -1;
}
@@ -103,14 +103,14 @@ static int append_symref(const char **out, git_vector *symrefs, const char *ptr)
/* symref mapping has refspec format */
mapping = git__calloc(1, sizeof(git_refspec));
- GITERR_CHECK_ALLOC(mapping);
+ GIT_ERROR_CHECK_ALLOC(mapping);
error = git_refspec__parse(mapping, git_buf_cstr(&buf), true);
git_buf_dispose(&buf);
/* if the error isn't OOM, then it's a parse error; let's use a nicer message */
if (error < 0) {
- if (giterr_last()->klass != GITERR_NOMEMORY)
+ if (git_error_last()->klass != GIT_ERROR_NOMEMORY)
goto on_invalid;
git__free(mapping);
@@ -124,7 +124,7 @@ static int append_symref(const char **out, git_vector *symrefs, const char *ptr)
return 0;
on_invalid:
- giterr_set(GITERR_NET, "remote sent invalid symref");
+ git_error_set(GIT_ERROR_NET, "remote sent invalid symref");
git_refspec__dispose(mapping);
git__free(mapping);
return -1;
@@ -230,7 +230,7 @@ static int recv_pkt(git_pkt **out_pkt, git_pkt_type *out_type, gitno_buffer *buf
if ((ret = gitno_recv(buf)) < 0) {
return ret;
} else if (ret == 0) {
- giterr_set(GITERR_NET, "early EOF");
+ git_error_set(GIT_ERROR_NET, "early EOF");
return GIT_EEOF;
}
} while (error);
@@ -382,7 +382,7 @@ int git_smart__negotiate_fetch(git_transport *transport, git_repository *repo, c
i++;
if (i % 20 == 0) {
if (t->cancelled.val) {
- giterr_set(GITERR_NET, "The fetch was cancelled by the user");
+ git_error_set(GIT_ERROR_NET, "The fetch was cancelled by the user");
error = GIT_EUSER;
goto on_error;
}
@@ -409,7 +409,7 @@ int git_smart__negotiate_fetch(git_transport *transport, git_repository *repo, c
} else if (pkt_type == GIT_PKT_NAK) {
continue;
} else {
- giterr_set(GITERR_NET, "Unexpected pkt type");
+ git_error_set(GIT_ERROR_NET, "Unexpected pkt type");
error = -1;
goto on_error;
}
@@ -461,7 +461,7 @@ int git_smart__negotiate_fetch(git_transport *transport, git_repository *repo, c
goto on_error;
if (t->cancelled.val) {
- giterr_set(GITERR_NET, "The fetch was cancelled by the user");
+ git_error_set(GIT_ERROR_NET, "The fetch was cancelled by the user");
error = GIT_EUSER;
goto on_error;
}
@@ -477,7 +477,7 @@ int git_smart__negotiate_fetch(git_transport *transport, git_repository *repo, c
return error;
if (pkt_type != GIT_PKT_ACK && pkt_type != GIT_PKT_NAK) {
- giterr_set(GITERR_NET, "Unexpected pkt type");
+ git_error_set(GIT_ERROR_NET, "Unexpected pkt type");
return -1;
}
} else {
@@ -498,7 +498,7 @@ static int no_sideband(transport_smart *t, struct git_odb_writepack *writepack,
do {
if (t->cancelled.val) {
- giterr_set(GITERR_NET, "The fetch was cancelled by the user");
+ git_error_set(GIT_ERROR_NET, "The fetch was cancelled by the user");
return GIT_EUSER;
}
@@ -591,7 +591,7 @@ int git_smart__download_pack(
/* Check cancellation before network call */
if (t->cancelled.val) {
- giterr_clear();
+ git_error_clear();
error = GIT_EUSER;
goto done;
}
@@ -599,7 +599,7 @@ int git_smart__download_pack(
if ((error = recv_pkt(&pkt, NULL, buf)) >= 0) {
/* Check cancellation after network call */
if (t->cancelled.val) {
- giterr_clear();
+ git_error_clear();
error = GIT_EUSER;
} else if (pkt->type == GIT_PKT_PROGRESS) {
if (t->progress_cb) {
@@ -701,7 +701,7 @@ static int add_push_report_pkt(git_push *push, git_pkt *pkt)
switch (pkt->type) {
case GIT_PKT_OK:
status = git__calloc(1, sizeof(push_status));
- GITERR_CHECK_ALLOC(status);
+ GIT_ERROR_CHECK_ALLOC(status);
status->msg = NULL;
status->ref = git__strdup(((git_pkt_ok *)pkt)->ref);
if (!status->ref ||
@@ -712,7 +712,7 @@ static int add_push_report_pkt(git_push *push, git_pkt *pkt)
break;
case GIT_PKT_NG:
status = git__calloc(1, sizeof(push_status));
- GITERR_CHECK_ALLOC(status);
+ GIT_ERROR_CHECK_ALLOC(status);
status->ref = git__strdup(((git_pkt_ng *)pkt)->ref);
status->msg = git__strdup(((git_pkt_ng *)pkt)->msg);
if (!status->ref || !status->msg ||
@@ -727,7 +727,7 @@ static int add_push_report_pkt(git_push *push, git_pkt *pkt)
case GIT_PKT_FLUSH:
return GIT_ITEROVER;
default:
- giterr_set(GITERR_NET, "report-status: protocol error");
+ git_error_set(GIT_ERROR_NET, "report-status: protocol error");
return -1;
}
@@ -815,7 +815,7 @@ static int parse_report(transport_smart *transport, git_push *push)
}
if (recvd == 0) {
- giterr_set(GITERR_NET, "early EOF");
+ git_error_set(GIT_ERROR_NET, "early EOF");
error = GIT_EEOF;
goto done;
}
@@ -832,7 +832,7 @@ static int parse_report(transport_smart *transport, git_push *push)
error = add_push_report_sideband_pkt(push, (git_pkt_data *)pkt, &data_pkt_buf);
break;
case GIT_PKT_ERR:
- giterr_set(GITERR_NET, "report-status: Error reported: %s",
+ git_error_set(GIT_ERROR_NET, "report-status: Error reported: %s",
((git_pkt_err *)pkt)->error);
error = -1;
break;
@@ -855,7 +855,7 @@ static int parse_report(transport_smart *transport, git_push *push)
if (data_pkt_buf.size > 0) {
/* If there was data remaining in the pack data buffer,
* then the server sent a partial pkt-line */
- giterr_set(GITERR_NET, "Incomplete pack data pkt-line");
+ git_error_set(GIT_ERROR_NET, "Incomplete pack data pkt-line");
error = GIT_ERROR;
}
goto done;
@@ -873,7 +873,7 @@ done:
static int add_ref_from_push_spec(git_vector *refs, push_spec *push_spec)
{
git_pkt_ref *added = git__calloc(1, sizeof(git_pkt_ref));
- GITERR_CHECK_ALLOC(added);
+ GIT_ERROR_CHECK_ALLOC(added);
added->type = GIT_PKT_REF;
git_oid_cpy(&added->head.oid, &push_spec->loid);
@@ -902,7 +902,7 @@ static int update_refs_from_report(
/* For each push spec we sent to the server, we should have
* gotten back a status packet in the push report */
if (push_specs->length != push_report->length) {
- giterr_set(GITERR_NET, "report-status: protocol error");
+ git_error_set(GIT_ERROR_NET, "report-status: protocol error");
return -1;
}
@@ -917,7 +917,7 @@ static int update_refs_from_report(
/* For each push spec we sent to the server, we should have
* gotten back a status packet in the push report which matches */
if (strcmp(push_spec->refspec.dst, push_status->ref)) {
- giterr_set(GITERR_NET, "report-status: protocol error");
+ git_error_set(GIT_ERROR_NET, "report-status: protocol error");
return -1;
}
}
diff --git a/src/transports/ssh.c b/src/transports/ssh.c
index 9e01a4a..5a6058f 100644
--- a/src/transports/ssh.c
+++ b/src/transports/ssh.c
@@ -54,7 +54,7 @@ static void ssh_error(LIBSSH2_SESSION *session, const char *errmsg)
char *ssherr;
libssh2_session_last_error(session, &ssherr, NULL, 0);
- giterr_set(GITERR_SSH, "%s: %s", errmsg, ssherr);
+ git_error_set(GIT_ERROR_SSH, "%s: %s", errmsg, ssherr);
}
/*
@@ -85,7 +85,7 @@ static int gen_proto(git_buf *request, const char *cmd, const char *url)
done:
if (!repo) {
- giterr_set(GITERR_NET, "malformed git protocol URL");
+ git_error_set(GIT_ERROR_NET, "malformed git protocol URL");
return -1;
}
@@ -151,7 +151,7 @@ static int ssh_stream_read(
*/
if (rc == 0) {
if ((rc = libssh2_channel_read_stderr(s->channel, buffer, buf_size)) > 0) {
- giterr_set(GITERR_SSH, "%*s", rc, buffer);
+ git_error_set(GIT_ERROR_SSH, "%*s", rc, buffer);
return GIT_EEOF;
} else if (rc < LIBSSH2_ERROR_NONE) {
ssh_error(s->session, "SSH could not read stderr");
@@ -238,7 +238,7 @@ static int ssh_stream_alloc(
assert(stream);
s = git__calloc(sizeof(ssh_stream), 1);
- GITERR_CHECK_ALLOC(s);
+ GIT_ERROR_CHECK_ALLOC(s);
s->parent.subtransport = &t->parent;
s->parent.read = ssh_stream_read;
@@ -272,19 +272,19 @@ static int git_ssh_extract_url_parts(
if (at) {
start = at + 1;
*username = git__substrdup(url, at - url);
- GITERR_CHECK_ALLOC(*username);
+ GIT_ERROR_CHECK_ALLOC(*username);
} else {
start = url;
*username = NULL;
}
if (colon == NULL || (colon < start)) {
- giterr_set(GITERR_NET, "malformed URL");
+ git_error_set(GIT_ERROR_NET, "malformed URL");
return -1;
}
*host = git__substrdup(start, colon - start);
- GITERR_CHECK_ALLOC(*host);
+ GIT_ERROR_CHECK_ALLOC(*host);
return 0;
}
@@ -350,7 +350,7 @@ static int _git_ssh_authenticate_session(
int rc;
do {
- giterr_clear();
+ git_error_clear();
switch (cred->credtype) {
case GIT_CREDTYPE_USERPASS_PLAINTEXT: {
git_cred_userpass_plaintext *c = (git_cred_userpass_plaintext *)cred;
@@ -428,7 +428,7 @@ static int _git_ssh_authenticate_session(
return GIT_EAUTH;
if (rc != LIBSSH2_ERROR_NONE) {
- if (!giterr_last())
+ if (!git_error_last())
ssh_error(session, "Failed to authenticate SSH session");
return -1;
}
@@ -452,19 +452,19 @@ static int request_creds(git_cred **out, ssh_subtransport *t, const char *user,
} else if (error < 0) {
return error;
} else if (!cred) {
- giterr_set(GITERR_SSH, "callback failed to initialize SSH credentials");
+ git_error_set(GIT_ERROR_SSH, "callback failed to initialize SSH credentials");
return -1;
}
}
if (no_callback) {
- giterr_set(GITERR_SSH, "authentication required but no callback set");
+ git_error_set(GIT_ERROR_SSH, "authentication required but no callback set");
return -1;
}
if (!(cred->credtype & auth_methods)) {
cred->free(cred);
- giterr_set(GITERR_SSH, "callback returned unsupported credentials type");
+ git_error_set(GIT_ERROR_SSH, "callback returned unsupported credentials type");
return -1;
}
@@ -485,7 +485,7 @@ static int _git_ssh_session_create(
s = libssh2_session_init();
if (!s) {
- giterr_set(GITERR_NET, "failed to initialize SSH session");
+ git_error_set(GIT_ERROR_NET, "failed to initialize SSH session");
return -1;
}
@@ -544,7 +544,7 @@ static int _git_ssh_setup_conn(
if ((error = git_ssh_extract_url_parts(&host, &user, url)) < 0)
goto done;
port = git__strdup(default_port);
- GITERR_CHECK_ALLOC(port);
+ GIT_ERROR_CHECK_ALLOC(port);
post_extract:
if ((error = git_socket_stream_new(&s->io, host, port)) < 0 ||
@@ -573,21 +573,21 @@ post_extract:
}
if (cert.type == 0) {
- giterr_set(GITERR_SSH, "unable to get the host key");
+ git_error_set(GIT_ERROR_SSH, "unable to get the host key");
error = -1;
goto done;
}
/* We don't currently trust any hostkeys */
- giterr_clear();
+ git_error_clear();
cert_ptr = &cert;
error = t->owner->certificate_check_cb((git_cert *) cert_ptr, 0, host, t->owner->message_cb_payload);
if (error < 0 && error != GIT_PASSTHROUGH) {
- if (!giterr_last())
- giterr_set(GITERR_NET, "user cancelled hostkey check");
+ if (!git_error_last())
+ git_error_set(GIT_ERROR_NET, "user cancelled hostkey check");
goto done;
}
@@ -626,7 +626,7 @@ post_extract:
goto done;
if (strcmp(user, git_cred__username(cred))) {
- giterr_set(GITERR_SSH, "username does not match previous request");
+ git_error_set(GIT_ERROR_SSH, "username does not match previous request");
error = -1;
goto done;
}
@@ -693,7 +693,7 @@ static int ssh_uploadpack(
return 0;
}
- giterr_set(GITERR_NET, "must call UPLOADPACK_LS before UPLOADPACK");
+ git_error_set(GIT_ERROR_NET, "must call UPLOADPACK_LS before UPLOADPACK");
return -1;
}
@@ -720,7 +720,7 @@ static int ssh_receivepack(
return 0;
}
- giterr_set(GITERR_NET, "must call RECEIVEPACK_LS before RECEIVEPACK");
+ git_error_set(GIT_ERROR_NET, "must call RECEIVEPACK_LS before RECEIVEPACK");
return -1;
}
@@ -836,7 +836,7 @@ int git_smart_subtransport_ssh(
GIT_UNUSED(param);
t = git__calloc(sizeof(ssh_subtransport), 1);
- GITERR_CHECK_ALLOC(t);
+ GIT_ERROR_CHECK_ALLOC(t);
t->owner = (transport_smart *)owner;
t->parent.action = _ssh_action;
@@ -852,7 +852,7 @@ int git_smart_subtransport_ssh(
assert(out);
*out = NULL;
- giterr_set(GITERR_INVALID, "cannot create SSH transport. Library was built without SSH support");
+ git_error_set(GIT_ERROR_INVALID, "cannot create SSH transport. Library was built without SSH support");
return -1;
#endif
}
@@ -872,7 +872,7 @@ int git_transport_ssh_with_paths(git_transport **out, git_remote *owner, void *p
};
if (paths->count != 2) {
- giterr_set(GITERR_SSH, "invalid ssh paths, must be two strings");
+ git_error_set(GIT_ERROR_SSH, "invalid ssh paths, must be two strings");
return GIT_EINVALIDSPEC;
}
@@ -883,9 +883,9 @@ int git_transport_ssh_with_paths(git_transport **out, git_remote *owner, void *p
t = (ssh_subtransport *) smart->wrapped;
t->cmd_uploadpack = git__strdup(paths->strings[0]);
- GITERR_CHECK_ALLOC(t->cmd_uploadpack);
+ GIT_ERROR_CHECK_ALLOC(t->cmd_uploadpack);
t->cmd_receivepack = git__strdup(paths->strings[1]);
- GITERR_CHECK_ALLOC(t->cmd_receivepack);
+ GIT_ERROR_CHECK_ALLOC(t->cmd_receivepack);
*out = transport;
return 0;
@@ -896,7 +896,7 @@ int git_transport_ssh_with_paths(git_transport **out, git_remote *owner, void *p
assert(out);
*out = NULL;
- giterr_set(GITERR_INVALID, "cannot create SSH transport. Library was built without SSH support");
+ git_error_set(GIT_ERROR_INVALID, "cannot create SSH transport. Library was built without SSH support");
return -1;
#endif
}
@@ -912,7 +912,7 @@ int git_transport_ssh_global_init(void)
{
#ifdef GIT_SSH
if (libssh2_init(0) < 0) {
- giterr_set(GITERR_SSH, "unable to initialize libssh2");
+ git_error_set(GIT_ERROR_SSH, "unable to initialize libssh2");
return -1;
}
diff --git a/src/transports/winhttp.c b/src/transports/winhttp.c
index 11b4298..d878232 100644
--- a/src/transports/winhttp.c
+++ b/src/transports/winhttp.c
@@ -126,7 +126,7 @@ static int _apply_userpass_credential(HINTERNET request, DWORD target, DWORD sch
goto done;
if (!WinHttpSetCredentials(request, target, scheme, user, pass, NULL)) {
- giterr_set(GITERR_OS, "failed to set credentials");
+ git_error_set(GIT_ERROR_OS, "failed to set credentials");
error = -1;
}
@@ -164,7 +164,7 @@ static int apply_userpass_credential(HINTERNET request, int mechanisms, git_cred
} else if (mechanisms & GIT_WINHTTP_AUTH_BASIC) {
native_scheme = WINHTTP_AUTH_SCHEME_BASIC;
} else {
- giterr_set(GITERR_NET, "invalid authentication scheme");
+ git_error_set(GIT_ERROR_NET, "invalid authentication scheme");
return -1;
}
@@ -190,7 +190,7 @@ static int apply_default_credentials(HINTERNET request, int mechanisms)
native_scheme = WINHTTP_AUTH_SCHEME_NEGOTIATE;
if (!native_scheme) {
- giterr_set(GITERR_NET, "invalid authentication scheme");
+ git_error_set(GIT_ERROR_NET, "invalid authentication scheme");
return -1;
}
@@ -223,7 +223,7 @@ static int fallback_cred_acquire_cb(
/* Convert URL to wide characters */
if (git__utf8_to_16_alloc(&wide_url, url) < 0) {
- giterr_set(GITERR_OS, "failed to convert string to wide form");
+ git_error_set(GIT_ERROR_OS, "failed to convert string to wide form");
return -1;
}
@@ -274,8 +274,8 @@ static int certificate_check(winhttp_stream *s, int valid)
/* If there is no override, we should fail if WinHTTP doesn't think it's fine */
if (t->owner->certificate_check_cb == NULL && !valid) {
- if (!giterr_last())
- giterr_set(GITERR_NET, "unknown certificate check failure");
+ if (!git_error_last())
+ git_error_set(GIT_ERROR_NET, "unknown certificate check failure");
return GIT_ECERTIFICATE;
}
@@ -284,11 +284,11 @@ static int certificate_check(winhttp_stream *s, int valid)
return 0;
if (!WinHttpQueryOption(s->request, WINHTTP_OPTION_SERVER_CERT_CONTEXT, &cert_ctx, &cert_ctx_size)) {
- giterr_set(GITERR_OS, "failed to get server certificate");
+ git_error_set(GIT_ERROR_OS, "failed to get server certificate");
return -1;
}
- giterr_clear();
+ git_error_clear();
cert.parent.cert_type = GIT_CERT_X509;
cert.data = cert_ctx->pbCertEncoded;
cert.len = cert_ctx->cbCertEncoded;
@@ -298,8 +298,8 @@ static int certificate_check(winhttp_stream *s, int valid)
if (error == GIT_PASSTHROUGH)
error = valid ? 0 : GIT_ECERTIFICATE;
- if (error < 0 && !giterr_last())
- giterr_set(GITERR_NET, "user cancelled certificate check");
+ if (error < 0 && !git_error_last())
+ git_error_set(GIT_ERROR_NET, "user cancelled certificate check");
return error;
}
@@ -355,7 +355,7 @@ static int winhttp_stream_connect(winhttp_stream *s)
/* Convert URL to wide characters */
if (git__utf8_to_16_alloc(&s->request_uri, git_buf_cstr(&buf)) < 0) {
- giterr_set(GITERR_OS, "failed to convert string to wide form");
+ git_error_set(GIT_ERROR_OS, "failed to convert string to wide form");
goto on_error;
}
@@ -370,12 +370,12 @@ static int winhttp_stream_connect(winhttp_stream *s)
t->connection_data.use_ssl ? WINHTTP_FLAG_SECURE : 0);
if (!s->request) {
- giterr_set(GITERR_OS, "failed to open request");
+ git_error_set(GIT_ERROR_OS, "failed to open request");
goto on_error;
}
if (!WinHttpSetTimeouts(s->request, default_timeout, default_connect_timeout, default_timeout, default_timeout)) {
- giterr_set(GITERR_OS, "failed to set timeouts for WinHTTP");
+ git_error_set(GIT_ERROR_OS, "failed to set timeouts for WinHTTP");
goto on_error;
}
@@ -387,7 +387,7 @@ static int winhttp_stream_connect(winhttp_stream *s)
}
else if (proxy_opts->type == GIT_PROXY_SPECIFIED) {
proxy_url = git__strdup(proxy_opts->url);
- GITERR_CHECK_ALLOC(proxy_url);
+ GIT_ERROR_CHECK_ALLOC(proxy_url);
}
if (proxy_url) {
@@ -400,7 +400,7 @@ static int winhttp_stream_connect(winhttp_stream *s)
} else if (!git__prefixcmp(proxy_url, SCHEME_HTTPS)) {
t->proxy_connection_data.use_ssl = true;
} else {
- giterr_set(GITERR_NET, "invalid URL: '%s'", proxy_url);
+ git_error_set(GIT_ERROR_NET, "invalid URL: '%s'", proxy_url);
return -1;
}
@@ -447,7 +447,7 @@ static int winhttp_stream_connect(winhttp_stream *s)
WINHTTP_OPTION_PROXY,
&proxy_info,
sizeof(WINHTTP_PROXY_INFO))) {
- giterr_set(GITERR_OS, "failed to set proxy");
+ git_error_set(GIT_ERROR_OS, "failed to set proxy");
git__free(proxy_wide);
goto on_error;
}
@@ -470,7 +470,7 @@ static int winhttp_stream_connect(winhttp_stream *s)
WINHTTP_OPTION_DISABLE_FEATURE,
&disable_redirects,
sizeof(disable_redirects))) {
- giterr_set(GITERR_OS, "failed to disable redirects");
+ git_error_set(GIT_ERROR_OS, "failed to disable redirects");
goto on_error;
}
@@ -484,7 +484,7 @@ static int winhttp_stream_connect(winhttp_stream *s)
/* Send Pragma: no-cache header */
if (!WinHttpAddRequestHeaders(s->request, pragma_nocache, (ULONG) -1L, WINHTTP_ADDREQ_FLAG_ADD)) {
- giterr_set(GITERR_OS, "failed to add a header to the request");
+ git_error_set(GIT_ERROR_OS, "failed to add a header to the request");
goto on_error;
}
@@ -497,13 +497,13 @@ static int winhttp_stream_connect(winhttp_stream *s)
goto on_error;
if (git__utf8_to_16(ct, MAX_CONTENT_TYPE_LEN, git_buf_cstr(&buf)) < 0) {
- giterr_set(GITERR_OS, "failed to convert content-type to wide characters");
+ git_error_set(GIT_ERROR_OS, "failed to convert content-type to wide characters");
goto on_error;
}
if (!WinHttpAddRequestHeaders(s->request, ct, (ULONG)-1L,
WINHTTP_ADDREQ_FLAG_ADD | WINHTTP_ADDREQ_FLAG_REPLACE)) {
- giterr_set(GITERR_OS, "failed to add a header to the request");
+ git_error_set(GIT_ERROR_OS, "failed to add a header to the request");
goto on_error;
}
@@ -514,13 +514,13 @@ static int winhttp_stream_connect(winhttp_stream *s)
goto on_error;
if (git__utf8_to_16(ct, MAX_CONTENT_TYPE_LEN, git_buf_cstr(&buf)) < 0) {
- giterr_set(GITERR_OS, "failed to convert accept header to wide characters");
+ git_error_set(GIT_ERROR_OS, "failed to convert accept header to wide characters");
goto on_error;
}
if (!WinHttpAddRequestHeaders(s->request, ct, (ULONG)-1L,
WINHTTP_ADDREQ_FLAG_ADD | WINHTTP_ADDREQ_FLAG_REPLACE)) {
- giterr_set(GITERR_OS, "failed to add a header to the request");
+ git_error_set(GIT_ERROR_OS, "failed to add a header to the request");
goto on_error;
}
}
@@ -530,13 +530,13 @@ static int winhttp_stream_connect(winhttp_stream *s)
git_buf_clear(&buf);
git_buf_puts(&buf, t->owner->custom_headers.strings[i]);
if (git__utf8_to_16(ct, MAX_CONTENT_TYPE_LEN, git_buf_cstr(&buf)) < 0) {
- giterr_set(GITERR_OS, "failed to convert custom header to wide characters");
+ git_error_set(GIT_ERROR_OS, "failed to convert custom header to wide characters");
goto on_error;
}
if (!WinHttpAddRequestHeaders(s->request, ct, (ULONG)-1L,
WINHTTP_ADDREQ_FLAG_ADD | WINHTTP_ADDREQ_FLAG_REPLACE)) {
- giterr_set(GITERR_OS, "failed to add a header to the request");
+ git_error_set(GIT_ERROR_OS, "failed to add a header to the request");
goto on_error;
}
}
@@ -597,7 +597,7 @@ static int parse_unauthorized_response(
* We can assume this was already done, since we know we are unauthorized.
*/
if (!WinHttpQueryAuthSchemes(request, &supported, &first, &target)) {
- giterr_set(GITERR_OS, "failed to parse supported auth schemes");
+ git_error_set(GIT_ERROR_OS, "failed to parse supported auth schemes");
return -1;
}
@@ -640,7 +640,7 @@ static int write_chunk(HINTERNET request, const char *buffer, size_t len)
git_buf_cstr(&buf), (DWORD)git_buf_len(&buf),
&bytes_written)) {
git_buf_dispose(&buf);
- giterr_set(GITERR_OS, "failed to write chunk header");
+ git_error_set(GIT_ERROR_OS, "failed to write chunk header");
return -1;
}
@@ -650,7 +650,7 @@ static int write_chunk(HINTERNET request, const char *buffer, size_t len)
if (!WinHttpWriteData(request,
buffer, (DWORD)len,
&bytes_written)) {
- giterr_set(GITERR_OS, "failed to write chunk");
+ git_error_set(GIT_ERROR_OS, "failed to write chunk");
return -1;
}
@@ -658,7 +658,7 @@ static int write_chunk(HINTERNET request, const char *buffer, size_t len)
if (!WinHttpWriteData(request,
"\r\n", 2,
&bytes_written)) {
- giterr_set(GITERR_OS, "failed to write chunk footer");
+ git_error_set(GIT_ERROR_OS, "failed to write chunk footer");
return -1;
}
@@ -671,7 +671,7 @@ static int winhttp_close_connection(winhttp_subtransport *t)
if (t->connection) {
if (!WinHttpCloseHandle(t->connection)) {
- giterr_set(GITERR_OS, "unable to close connection");
+ git_error_set(GIT_ERROR_OS, "unable to close connection");
ret = -1;
}
@@ -680,7 +680,7 @@ static int winhttp_close_connection(winhttp_subtransport *t)
if (t->session) {
if (!WinHttpCloseHandle(t->session)) {
- giterr_set(GITERR_OS, "unable to close session");
+ git_error_set(GIT_ERROR_OS, "unable to close session");
ret = -1;
}
@@ -705,21 +705,21 @@ static void CALLBACK winhttp_status(
status = *((DWORD *)info);
if ((status & WINHTTP_CALLBACK_STATUS_FLAG_CERT_CN_INVALID))
- giterr_set(GITERR_NET, "SSL certificate issued for different common name");
+ git_error_set(GIT_ERROR_NET, "SSL certificate issued for different common name");
else if ((status & WINHTTP_CALLBACK_STATUS_FLAG_CERT_DATE_INVALID))
- giterr_set(GITERR_NET, "SSL certificate has expired");
+ git_error_set(GIT_ERROR_NET, "SSL certificate has expired");
else if ((status & WINHTTP_CALLBACK_STATUS_FLAG_INVALID_CA))
- giterr_set(GITERR_NET, "SSL certificate signed by unknown CA");
+ git_error_set(GIT_ERROR_NET, "SSL certificate signed by unknown CA");
else if ((status & WINHTTP_CALLBACK_STATUS_FLAG_INVALID_CERT))
- giterr_set(GITERR_NET, "SSL certificate is invalid");
+ git_error_set(GIT_ERROR_NET, "SSL certificate is invalid");
else if ((status & WINHTTP_CALLBACK_STATUS_FLAG_CERT_REV_FAILED))
- giterr_set(GITERR_NET, "certificate revocation check failed");
+ git_error_set(GIT_ERROR_NET, "certificate revocation check failed");
else if ((status & WINHTTP_CALLBACK_STATUS_FLAG_CERT_REVOKED))
- giterr_set(GITERR_NET, "SSL certificate was revoked");
+ git_error_set(GIT_ERROR_NET, "SSL certificate was revoked");
else if ((status & WINHTTP_CALLBACK_STATUS_FLAG_SECURITY_CHANNEL_ERROR))
- giterr_set(GITERR_NET, "security libraries could not be loaded");
+ git_error_set(GIT_ERROR_NET, "security libraries could not be loaded");
else
- giterr_set(GITERR_NET, "unknown security error %lu", status);
+ git_error_set(GITERR_NET, "unknown security error %lu", status);
}
static int winhttp_connect(
@@ -747,7 +747,7 @@ static int winhttp_connect(
/* Prepare host */
if (git__utf8_to_16_alloc(&wide_host, t->connection_data.host) < 0) {
- giterr_set(GITERR_OS, "unable to convert host to wide characters");
+ git_error_set(GIT_ERROR_OS, "unable to convert host to wide characters");
return -1;
}
@@ -758,7 +758,7 @@ static int winhttp_connect(
}
if (git__utf8_to_16_alloc(&wide_ua, git_buf_cstr(&ua)) < 0) {
- giterr_set(GITERR_OS, "unable to convert host to wide characters");
+ git_error_set(GIT_ERROR_OS, "unable to convert host to wide characters");
git__free(wide_host);
git_buf_dispose(&ua);
return -1;
@@ -775,7 +775,7 @@ static int winhttp_connect(
0);
if (!t->session) {
- giterr_set(GITERR_OS, "failed to init WinHTTP");
+ git_error_set(GIT_ERROR_OS, "failed to init WinHTTP");
goto on_error;
}
@@ -790,7 +790,7 @@ static int winhttp_connect(
sizeof(protocols));
if (!WinHttpSetTimeouts(t->session, default_timeout, default_connect_timeout, default_timeout, default_timeout)) {
- giterr_set(GITERR_OS, "failed to set timeouts for WinHTTP");
+ git_error_set(GIT_ERROR_OS, "failed to set timeouts for WinHTTP");
goto on_error;
}
@@ -803,12 +803,12 @@ static int winhttp_connect(
0);
if (!t->connection) {
- giterr_set(GITERR_OS, "failed to connect to host");
+ git_error_set(GIT_ERROR_OS, "failed to connect to host");
goto on_error;
}
if (WinHttpSetStatusCallback(t->connection, winhttp_status, WINHTTP_CALLBACK_FLAG_SECURE_FAILURE, 0) == WINHTTP_INVALID_STATUS_CALLBACK) {
- giterr_set(GITERR_OS, "failed to set status callback");
+ git_error_set(GIT_ERROR_OS, "failed to set status callback");
goto on_error;
}
@@ -854,10 +854,10 @@ static int send_request(winhttp_stream *s, size_t len, int ignore_length)
int request_failed = 0, cert_valid = 1, error = 0;
DWORD ignore_flags;
- giterr_clear();
+ git_error_clear();
if ((error = do_send_request(s, len, ignore_length)) < 0) {
if (GetLastError() != ERROR_WINHTTP_SECURE_FAILURE) {
- giterr_set(GITERR_OS, "failed to send request");
+ git_error_set(GIT_ERROR_OS, "failed to send request");
return -1;
}
@@ -865,10 +865,10 @@ static int send_request(winhttp_stream *s, size_t len, int ignore_length)
cert_valid = 0;
}
- giterr_clear();
+ git_error_clear();
if ((error = certificate_check(s, cert_valid)) < 0) {
- if (!giterr_last())
- giterr_set(GITERR_OS, "user cancelled certificate check");
+ if (!git_error_last())
+ git_error_set(GIT_ERROR_OS, "user cancelled certificate check");
return error;
}
@@ -880,12 +880,12 @@ static int send_request(winhttp_stream *s, size_t len, int ignore_length)
ignore_flags = no_check_cert_flags;
if (!WinHttpSetOption(s->request, WINHTTP_OPTION_SECURITY_FLAGS, &ignore_flags, sizeof(ignore_flags))) {
- giterr_set(GITERR_OS, "failed to set security options");
+ git_error_set(GIT_ERROR_OS, "failed to set security options");
return -1;
}
if ((error = do_send_request(s, len, ignore_length)) < 0)
- giterr_set(GITERR_OS, "failed to send request with unchecked certificate");
+ git_error_set(GIT_ERROR_OS, "failed to send request with unchecked certificate");
return error;
}
@@ -905,7 +905,7 @@ static int winhttp_stream_read(
replay:
/* Enforce a reasonable cap on the number of replays */
if (replay_count++ >= GIT_HTTP_REPLAY_MAX) {
- giterr_set(GITERR_NET, "too many redirects or authentication replays");
+ git_error_set(GIT_ERROR_NET, "too many redirects or authentication replays");
return -1;
}
@@ -940,7 +940,7 @@ replay:
if (!WinHttpWriteData(s->request,
"0\r\n\r\n", 5,
&bytes_written)) {
- giterr_set(GITERR_OS, "failed to write final chunk");
+ git_error_set(GIT_ERROR_OS, "failed to write final chunk");
return -1;
}
}
@@ -951,7 +951,7 @@ replay:
if (INVALID_SET_FILE_POINTER == SetFilePointer(s->post_body,
0, 0, FILE_BEGIN) &&
NO_ERROR != GetLastError()) {
- giterr_set(GITERR_OS, "failed to reset file pointer");
+ git_error_set(GIT_ERROR_OS, "failed to reset file pointer");
return -1;
}
@@ -965,14 +965,14 @@ replay:
&bytes_read, NULL) ||
!bytes_read) {
git__free(buffer);
- giterr_set(GITERR_OS, "failed to read from temp file");
+ git_error_set(GIT_ERROR_OS, "failed to read from temp file");
return -1;
}
if (!WinHttpWriteData(s->request, buffer,
bytes_read, &bytes_written)) {
git__free(buffer);
- giterr_set(GITERR_OS, "failed to write data");
+ git_error_set(GIT_ERROR_OS, "failed to write data");
return -1;
}
@@ -988,7 +988,7 @@ replay:
}
if (!WinHttpReceiveResponse(s->request, 0)) {
- giterr_set(GITERR_OS, "failed to receive response");
+ git_error_set(GIT_ERROR_OS, "failed to receive response");
return -1;
}
@@ -1000,7 +1000,7 @@ replay:
WINHTTP_HEADER_NAME_BY_INDEX,
&status_code, &status_code_length,
WINHTTP_NO_HEADER_INDEX)) {
- giterr_set(GITERR_OS, "failed to retrieve status code");
+ git_error_set(GIT_ERROR_OS, "failed to retrieve status code");
return -1;
}
@@ -1030,12 +1030,12 @@ replay:
&location_length,
WINHTTP_NO_HEADER_INDEX) ||
GetLastError() != ERROR_INSUFFICIENT_BUFFER) {
- giterr_set(GITERR_OS, "failed to read Location header");
+ git_error_set(GIT_ERROR_OS, "failed to read Location header");
return -1;
}
location = git__malloc(location_length);
- GITERR_CHECK_ALLOC(location);
+ GIT_ERROR_CHECK_ALLOC(location);
if (!WinHttpQueryHeaders(s->request,
WINHTTP_QUERY_LOCATION,
@@ -1043,14 +1043,14 @@ replay:
location,
&location_length,
WINHTTP_NO_HEADER_INDEX)) {
- giterr_set(GITERR_OS, "failed to read Location header");
+ git_error_set(GIT_ERROR_OS, "failed to read Location header");
git__free(location);
return -1;
}
/* Convert the Location header to UTF-8 */
if (git__utf16_to_8_alloc(&location8, location) < 0) {
- giterr_set(GITERR_OS, "failed to convert Location header to UTF-8");
+ git_error_set(GIT_ERROR_OS, "failed to convert Location header to UTF-8");
git__free(location);
return -1;
}
@@ -1142,7 +1142,7 @@ replay:
}
if (HTTP_STATUS_OK != status_code) {
- giterr_set(GITERR_NET, "request failed with status code: %lu", status_code);
+ git_error_set(GITERR_NET, "request failed with status code: %lu", status_code);
return -1;
}
@@ -1153,7 +1153,7 @@ replay:
p_snprintf(expected_content_type_8, MAX_CONTENT_TYPE_LEN, "application/x-git-%s-advertisement", s->service);
if (git__utf8_to_16(expected_content_type, MAX_CONTENT_TYPE_LEN, expected_content_type_8) < 0) {
- giterr_set(GITERR_OS, "failed to convert expected content-type to wide characters");
+ git_error_set(GIT_ERROR_OS, "failed to convert expected content-type to wide characters");
return -1;
}
@@ -1164,12 +1164,12 @@ replay:
WINHTTP_HEADER_NAME_BY_INDEX,
&content_type, &content_type_length,
WINHTTP_NO_HEADER_INDEX)) {
- giterr_set(GITERR_OS, "failed to retrieve response content-type");
+ git_error_set(GIT_ERROR_OS, "failed to retrieve response content-type");
return -1;
}
if (wcscmp(expected_content_type, content_type)) {
- giterr_set(GITERR_NET, "received unexpected content-type");
+ git_error_set(GIT_ERROR_NET, "received unexpected content-type");
return -1;
}
@@ -1181,7 +1181,7 @@ replay:
(DWORD)buf_size,
&dw_bytes_read))
{
- giterr_set(GITERR_OS, "failed to read data");
+ git_error_set(GIT_ERROR_OS, "failed to read data");
return -1;
}
@@ -1204,7 +1204,7 @@ static int winhttp_stream_write_single(
/* This implementation of write permits only a single call. */
if (s->sent_request) {
- giterr_set(GITERR_NET, "subtransport configured for only one write");
+ git_error_set(GIT_ERROR_NET, "subtransport configured for only one write");
return -1;
}
@@ -1217,7 +1217,7 @@ static int winhttp_stream_write_single(
(LPCVOID)buffer,
(DWORD)len,
&bytes_written)) {
- giterr_set(GITERR_OS, "failed to write data");
+ git_error_set(GIT_ERROR_OS, "failed to write data");
return -1;
}
@@ -1235,12 +1235,12 @@ static int put_uuid_string(LPWSTR buffer, size_t buffer_len_cch)
if (RPC_S_OK != status &&
RPC_S_UUID_LOCAL_ONLY != status &&
RPC_S_UUID_NO_ADDRESS != status) {
- giterr_set(GITERR_NET, "unable to generate name for temp file");
+ git_error_set(GIT_ERROR_NET, "unable to generate name for temp file");
return -1;
}
if (buffer_len_cch < UUID_LENGTH_CCH + 1) {
- giterr_set(GITERR_NET, "buffer too small for name of temp file");
+ git_error_set(GIT_ERROR_NET, "buffer too small for name of temp file");
return -1;
}
@@ -1255,7 +1255,7 @@ static int put_uuid_string(LPWSTR buffer, size_t buffer_len_cch)
uuid.Data4[4], uuid.Data4[5], uuid.Data4[6], uuid.Data4[7]);
if (result < UUID_LENGTH_CCH) {
- giterr_set(GITERR_OS, "unable to generate name for temp file");
+ git_error_set(GIT_ERROR_OS, "unable to generate name for temp file");
return -1;
}
@@ -1267,7 +1267,7 @@ static int get_temp_file(LPWSTR buffer, DWORD buffer_len_cch)
size_t len;
if (!GetTempPathW(buffer_len_cch, buffer)) {
- giterr_set(GITERR_OS, "failed to get temp path");
+ git_error_set(GIT_ERROR_OS, "failed to get temp path");
return -1;
}
@@ -1310,13 +1310,13 @@ static int winhttp_stream_write_buffered(
if (INVALID_HANDLE_VALUE == s->post_body) {
s->post_body = NULL;
- giterr_set(GITERR_OS, "failed to create temporary file");
+ git_error_set(GIT_ERROR_OS, "failed to create temporary file");
return -1;
}
}
if (!WriteFile(s->post_body, buffer, (DWORD)len, &bytes_written, NULL)) {
- giterr_set(GITERR_OS, "failed to write to temporary file");
+ git_error_set(GIT_ERROR_OS, "failed to write to temporary file");
return -1;
}
@@ -1343,7 +1343,7 @@ static int winhttp_stream_write_chunked(
if (!WinHttpAddRequestHeaders(s->request,
transfer_encoding, (ULONG) -1L,
WINHTTP_ADDREQ_FLAG_ADD)) {
- giterr_set(GITERR_OS, "failed to add a header to the request");
+ git_error_set(GIT_ERROR_OS, "failed to add a header to the request");
return -1;
}
@@ -1412,7 +1412,7 @@ static int winhttp_stream_alloc(winhttp_subtransport *t, winhttp_stream **stream
return -1;
s = git__calloc(1, sizeof(winhttp_stream));
- GITERR_CHECK_ALLOC(s);
+ GIT_ERROR_CHECK_ALLOC(s);
s->parent.subtransport = &t->parent;
s->parent.read = winhttp_stream_read;
@@ -1580,7 +1580,7 @@ int git_smart_subtransport_http(git_smart_subtransport **out, git_transport *own
return -1;
t = git__calloc(1, sizeof(winhttp_subtransport));
- GITERR_CHECK_ALLOC(t);
+ GIT_ERROR_CHECK_ALLOC(t);
t->owner = (transport_smart *)owner;
t->parent.action = winhttp_action;
diff --git a/src/tree-cache.c b/src/tree-cache.c
index c33e6af..d3ba864 100644
--- a/src/tree-cache.c
+++ b/src/tree-cache.c
@@ -123,7 +123,7 @@ static int read_tree_internal(git_tree_cache **out,
unsigned int i;
tree->children = git_pool_malloc(pool, tree->children_count * sizeof(git_tree_cache *));
- GITERR_CHECK_ALLOC(tree->children);
+ GIT_ERROR_CHECK_ALLOC(tree->children);
memset(tree->children, 0x0, tree->children_count * sizeof(git_tree_cache *));
@@ -138,7 +138,7 @@ static int read_tree_internal(git_tree_cache **out,
return 0;
corrupted:
- giterr_set(GITERR_INDEX, "corrupted TREE extension in index");
+ git_error_set(GIT_ERROR_INDEX, "corrupted TREE extension in index");
return -1;
}
@@ -150,7 +150,7 @@ int git_tree_cache_read(git_tree_cache **tree, const char *buffer, size_t buffer
return -1;
if (buffer < buffer_end) {
- giterr_set(GITERR_INDEX, "corrupted TREE extension in index (unexpected trailing data)");
+ git_error_set(GIT_ERROR_INDEX, "corrupted TREE extension in index (unexpected trailing data)");
return -1;
}
@@ -184,7 +184,7 @@ static int read_tree_recursive(git_tree_cache *cache, const git_tree *tree, git_
cache->children_count = ntrees;
cache->children = git_pool_mallocz(pool, ntrees * sizeof(git_tree_cache *));
- GITERR_CHECK_ALLOC(cache->children);
+ GIT_ERROR_CHECK_ALLOC(cache->children);
j = 0;
for (i = 0; i < nentries; i++) {
@@ -237,7 +237,7 @@ int git_tree_cache_new(git_tree_cache **out, const char *name, git_pool *pool)
name_len = strlen(name);
tree = git_pool_malloc(pool, sizeof(git_tree_cache) + name_len + 1);
- GITERR_CHECK_ALLOC(tree);
+ GIT_ERROR_CHECK_ALLOC(tree);
memset(tree, 0x0, sizeof(git_tree_cache));
/* NUL-terminated tree name */
diff --git a/src/tree.c b/src/tree.c
index 5a3045d..d3b11f8 100644
--- a/src/tree.c
+++ b/src/tree.c
@@ -18,7 +18,7 @@
#define MAX_FILEMODE_BYTES 6
#define TREE_ENTRY_CHECK_NAMELEN(n) \
- if (n > UINT16_MAX) { giterr_set(GITERR_INVALID, "tree entry path too long"); }
+ if (n > UINT16_MAX) { git_error_set(GIT_ERROR_INVALID, "tree entry path too long"); }
static bool valid_filemode(const int filemode)
{
@@ -350,9 +350,9 @@ unsigned int git_treebuilder_entrycount(git_treebuilder *bld)
static int tree_error(const char *str, const char *path)
{
if (path)
- giterr_set(GITERR_TREE, "%s - %s", str, path);
+ git_error_set(GIT_ERROR_TREE, "%s - %s", str, path);
else
- giterr_set(GITERR_TREE, "%s", str);
+ git_error_set(GIT_ERROR_TREE, "%s", str);
return -1;
}
@@ -386,7 +386,7 @@ int git_tree__parse_raw(void *_tree, const char *data, size_t size)
tree->odb_obj = NULL;
git_array_init_to_size(tree->entries, DEFAULT_TREE_SIZE);
- GITERR_CHECK_ARRAY(tree->entries);
+ GIT_ERROR_CHECK_ARRAY(tree->entries);
while (buffer < buffer_end) {
git_tree_entry *entry;
@@ -412,7 +412,7 @@ int git_tree__parse_raw(void *_tree, const char *data, size_t size)
/* Allocate the entry */
{
entry = git_array_alloc(tree->entries);
- GITERR_CHECK_ALLOC(entry);
+ GIT_ERROR_CHECK_ALLOC(entry);
entry->attr = attr;
entry->filename_len = filename_len;
@@ -503,14 +503,14 @@ static int append_entry(
return error;
entry = alloc_entry(filename, strlen(filename), id);
- GITERR_CHECK_ALLOC(entry);
+ GIT_ERROR_CHECK_ALLOC(entry);
entry->attr = (uint16_t)filemode;
git_strmap_insert(bld->map, entry->filename, entry, &error);
if (error < 0) {
git_tree_entry_free(entry);
- giterr_set(GITERR_TREE, "failed to append entry %s to the tree builder", filename);
+ git_error_set(GIT_ERROR_TREE, "failed to append entry %s to the tree builder", filename);
return -1;
}
@@ -573,7 +573,7 @@ static int write_tree(
char *subdir, *last_comp;
subdir = git__strndup(entry->path, next_slash - entry->path);
- GITERR_CHECK_ALLOC(subdir);
+ GIT_ERROR_CHECK_ALLOC(subdir);
/* Write out the subtree */
written = write_tree(&sub_oid, repo, index, subdir, i, shared_buf);
@@ -630,7 +630,7 @@ int git_tree__write_index(
assert(oid && index && repo);
if (git_index_has_conflicts(index)) {
- giterr_set(GITERR_INDEX,
+ git_error_set(GIT_ERROR_INDEX,
"cannot create a tree from a not fully merged index.");
return GIT_EUNMERGED;
}
@@ -684,7 +684,7 @@ int git_treebuilder_new(
assert(builder_p && repo);
bld = git__calloc(1, sizeof(git_treebuilder));
- GITERR_CHECK_ALLOC(bld);
+ GIT_ERROR_CHECK_ALLOC(bld);
bld->repo = repo;
@@ -736,13 +736,13 @@ int git_treebuilder_insert(
git_oid_cpy((git_oid *) entry->oid, id);
} else {
entry = alloc_entry(filename, strlen(filename), id);
- GITERR_CHECK_ALLOC(entry);
+ GIT_ERROR_CHECK_ALLOC(entry);
git_strmap_insert(bld->map, entry->filename, entry, &error);
if (error < 0) {
git_tree_entry_free(entry);
- giterr_set(GITERR_TREE, "failed to insert %s", filename);
+ git_error_set(GIT_ERROR_TREE, "failed to insert %s", filename);
return -1;
}
}
@@ -910,14 +910,14 @@ int git_tree_entry_bypath(
filename_len = subpath_len(path);
if (filename_len == 0) {
- giterr_set(GITERR_TREE, "invalid tree path given");
+ git_error_set(GIT_ERROR_TREE, "invalid tree path given");
return GIT_ENOTFOUND;
}
entry = entry_fromname(root, path, filename_len);
if (entry == NULL) {
- giterr_set(GITERR_TREE,
+ git_error_set(GIT_ERROR_TREE,
"the path '%.*s' does not exist in the given tree", (int) filename_len, path);
return GIT_ENOTFOUND;
}
@@ -927,7 +927,7 @@ int git_tree_entry_bypath(
/* If there are more components in the path...
* then this entry *must* be a tree */
if (!git_tree_entry__is_tree(entry)) {
- giterr_set(GITERR_TREE,
+ git_error_set(GIT_ERROR_TREE,
"the path '%.*s' exists but is not a tree", (int) filename_len, path);
return GIT_ENOTFOUND;
}
@@ -972,7 +972,7 @@ static int tree_walk(
if (preorder) {
error = callback(path->ptr, entry, payload);
if (error < 0) { /* negative value stops iteration */
- giterr_set_after_callback_function(error, "git_tree_walk");
+ git_error_set_after_callback_function(error, "git_tree_walk");
break;
}
if (error > 0) { /* positive value skips this entry */
@@ -1008,7 +1008,7 @@ static int tree_walk(
if (!preorder) {
error = callback(path->ptr, entry, payload);
if (error < 0) { /* negative value stops iteration */
- giterr_set_after_callback_function(error, "git_tree_walk");
+ git_error_set_after_callback_function(error, "git_tree_walk");
break;
}
error = 0;
@@ -1028,7 +1028,7 @@ int git_tree_walk(
git_buf root_path = GIT_BUF_INIT;
if (mode != GIT_TREEWALK_POST && mode != GIT_TREEWALK_PRE) {
- giterr_set(GITERR_INVALID, "invalid walking mode for tree walk");
+ git_error_set(GIT_ERROR_INVALID, "invalid walking mode for tree walk");
return -1;
}
@@ -1052,7 +1052,7 @@ static int on_dup_entry(void **old, void *new)
{
GIT_UNUSED(old); GIT_UNUSED(new);
- giterr_set(GITERR_TREE, "duplicate entries given for update");
+ git_error_set(GIT_ERROR_TREE, "duplicate entries given for update");
return -1;
}
@@ -1121,14 +1121,14 @@ static int create_popped_tree(tree_stack_entry *current, tree_stack_entry *poppe
git_buf_puts(component, popped->name);
git__free(popped->name);
- GITERR_CHECK_ALLOC(component->ptr);
+ GIT_ERROR_CHECK_ALLOC(component->ptr);
/* Error out if this would create a D/F conflict in this update */
if (current->tree) {
const git_tree_entry *to_replace;
to_replace = git_tree_entry_byname(current->tree, component->ptr);
if (to_replace && git_tree_entry_type(to_replace) != GIT_OBJECT_TREE) {
- giterr_set(GITERR_TREE, "D/F conflict when updating tree");
+ git_error_set(GIT_ERROR_TREE, "D/F conflict when updating tree");
return -1;
}
}
@@ -1155,7 +1155,7 @@ int git_tree_create_updated(git_oid *out, git_repository *repo, git_tree *baseli
}
root_elem = git_array_alloc(stack);
- GITERR_CHECK_ALLOC(root_elem);
+ GIT_ERROR_CHECK_ALLOC(root_elem);
memset(root_elem, 0, sizeof(*root_elem));
if (baseline && (error = git_tree_dup(&root_elem->tree, baseline)) < 0)
@@ -1205,13 +1205,13 @@ int git_tree_create_updated(git_oid *out, git_repository *repo, git_tree *baseli
entry = treebuilder_get(last->bld, component.ptr);
if (entry && git_tree_entry_type(entry) != GIT_OBJECT_TREE) {
- giterr_set(GITERR_TREE, "D/F conflict when updating tree");
+ git_error_set(GIT_ERROR_TREE, "D/F conflict when updating tree");
error = -1;
goto cleanup;
}
new_entry = git_array_alloc(stack);
- GITERR_CHECK_ALLOC(new_entry);
+ GIT_ERROR_CHECK_ALLOC(new_entry);
memset(new_entry, 0, sizeof(*new_entry));
new_entry->tree = NULL;
@@ -1222,7 +1222,7 @@ int git_tree_create_updated(git_oid *out, git_repository *repo, git_tree *baseli
goto cleanup;
new_entry->name = git__strdup(component.ptr);
- GITERR_CHECK_ALLOC(new_entry->name);
+ GIT_ERROR_CHECK_ALLOC(new_entry->name);
/* Get to the start of the next component */
path += component.size + 1;
@@ -1238,7 +1238,7 @@ int git_tree_create_updated(git_oid *out, git_repository *repo, git_tree *baseli
const git_tree_entry *e = git_treebuilder_get(last->bld, basename);
if (e && git_tree_entry_type(e) != git_object__type_from_filemode(update->filemode)) {
git__free(basename);
- giterr_set(GITERR_TREE, "cannot replace '%s' with '%s' at '%s'",
+ git_error_set(GIT_ERROR_TREE, "cannot replace '%s' with '%s' at '%s'",
git_object_type2string(git_tree_entry_type(e)),
git_object_type2string(git_object__type_from_filemode(update->filemode)),
update->path);
@@ -1258,7 +1258,7 @@ int git_tree_create_updated(git_oid *out, git_repository *repo, git_tree *baseli
break;
}
default:
- giterr_set(GITERR_TREE, "unknown action for update");
+ git_error_set(GIT_ERROR_TREE, "unknown action for update");
error = -1;
goto cleanup;
}
diff --git a/src/unix/map.c b/src/unix/map.c
index 8a07fcf..1ebbced 100644
--- a/src/unix/map.c
+++ b/src/unix/map.c
@@ -20,7 +20,7 @@ int git__page_size(size_t *page_size)
{
long sc_page_size = sysconf(_SC_PAGE_SIZE);
if (sc_page_size < 0) {
- giterr_set(GITERR_OS, "can't determine system page size");
+ git_error_set(GIT_ERROR_OS, "can't determine system page size");
return -1;
}
*page_size = (size_t) sc_page_size;
@@ -55,7 +55,7 @@ int p_mmap(git_map *out, size_t len, int prot, int flags, int fd, git_off_t offs
out->data = mmap(NULL, len, mprot, mflag, fd, offset);
if (!out->data || out->data == MAP_FAILED) {
- giterr_set(GITERR_OS, "failed to mmap. Could not write data");
+ git_error_set(GIT_ERROR_OS, "failed to mmap. Could not write data");
return -1;
}
diff --git a/src/util.c b/src/util.c
index 9952a60..984a3d7 100644
--- a/src/util.c
+++ b/src/util.c
@@ -49,7 +49,7 @@ int git_strarray_copy(git_strarray *tgt, const git_strarray *src)
return 0;
tgt->strings = git__calloc(src->count, sizeof(char *));
- GITERR_CHECK_ALLOC(tgt->strings);
+ GIT_ERROR_CHECK_ALLOC(tgt->strings);
for (i = 0; i < src->count; ++i) {
if (!src->strings[i])
@@ -164,7 +164,7 @@ int git__strntol64(int64_t *result, const char *nptr, size_t nptr_len, const cha
Return:
if (ndig == 0) {
- giterr_set(GITERR_INVALID, "failed to convert string to long: not a number");
+ git_error_set(GIT_ERROR_INVALID, "failed to convert string to long: not a number");
return -1;
}
@@ -172,7 +172,7 @@ Return:
*endptr = p;
if (ovfl) {
- giterr_set(GITERR_INVALID, "failed to convert string to long: overflow error");
+ git_error_set(GIT_ERROR_INVALID, "failed to convert string to long: overflow error");
return -1;
}
@@ -193,7 +193,7 @@ int git__strntol32(int32_t *result, const char *nptr, size_t nptr_len, const cha
tmp_int = tmp_long & 0xFFFFFFFF;
if (tmp_int != tmp_long) {
int len = tmp_endptr - nptr;
- giterr_set(GITERR_INVALID, "failed to convert: '%.*s' is too large", len, nptr);
+ git_error_set(GIT_ERROR_INVALID, "failed to convert: '%.*s' is too large", len, nptr);
return -1;
}
@@ -899,7 +899,7 @@ int git__getenv(git_buf *out, const char *name)
if ((value_len = GetEnvironmentVariableW(wide_name, NULL, 0)) > 0) {
wide_value = git__malloc(value_len * sizeof(wchar_t));
- GITERR_CHECK_ALLOC(wide_value);
+ GIT_ERROR_CHECK_ALLOC(wide_value);
value_len = GetEnvironmentVariableW(wide_name, wide_value, value_len);
}
@@ -909,7 +909,7 @@ int git__getenv(git_buf *out, const char *name)
else if (GetLastError() == ERROR_ENVVAR_NOT_FOUND)
error = GIT_ENOTFOUND;
else
- giterr_set(GITERR_OS, "could not read environment variable '%s'", name);
+ git_error_set(GIT_ERROR_OS, "could not read environment variable '%s'", name);
git__free(wide_name);
git__free(wide_value);
diff --git a/src/vector.c b/src/vector.c
index 98aa7bb..b51e764 100644
--- a/src/vector.c
+++ b/src/vector.c
@@ -36,7 +36,7 @@ GIT_INLINE(int) resize_vector(git_vector *v, size_t new_size)
return 0;
new_contents = git__reallocarray(v->contents, new_size, sizeof(void *));
- GITERR_CHECK_ALLOC(new_contents);
+ GIT_ERROR_CHECK_ALLOC(new_contents);
v->_alloc_size = new_size;
v->contents = new_contents;
@@ -65,9 +65,9 @@ int git_vector_dup(git_vector *v, const git_vector *src, git_vector_cmp cmp)
if (src->length) {
size_t bytes;
- GITERR_CHECK_ALLOC_MULTIPLY(&bytes, src->length, sizeof(void *));
+ GIT_ERROR_CHECK_ALLOC_MULTIPLY(&bytes, src->length, sizeof(void *));
v->contents = git__malloc(bytes);
- GITERR_CHECK_ALLOC(v->contents);
+ GIT_ERROR_CHECK_ALLOC(v->contents);
v->_alloc_size = src->length;
memcpy(v->contents, src->contents, bytes);
}
@@ -342,7 +342,7 @@ int git_vector_insert_null(git_vector *v, size_t idx, size_t insert_len)
assert(insert_len > 0 && idx <= v->length);
- GITERR_CHECK_ALLOC_ADD(&new_length, v->length, insert_len);
+ GIT_ERROR_CHECK_ALLOC_ADD(&new_length, v->length, insert_len);
if (new_length > v->_alloc_size && resize_vector(v, new_length) < 0)
return -1;
diff --git a/src/win32/dir.c b/src/win32/dir.c
index 1d37874..44052ca 100644
--- a/src/win32/dir.c
+++ b/src/win32/dir.c
@@ -31,7 +31,7 @@ git__DIR *git__opendir(const char *dir)
new->h = FindFirstFileW(filter_w, &new->f);
if (new->h == INVALID_HANDLE_VALUE) {
- giterr_set(GITERR_OS, "could not open directory '%s'", dir);
+ git_error_set(GIT_ERROR_OS, "could not open directory '%s'", dir);
git__free(new);
return NULL;
}
@@ -56,7 +56,7 @@ int git__readdir_ext(
else if (!FindNextFileW(d->h, &d->f)) {
if (GetLastError() == ERROR_NO_MORE_FILES)
return 0;
- giterr_set(GITERR_OS, "could not read from directory '%s'", d->dir);
+ git_error_set(GIT_ERROR_OS, "could not read from directory '%s'", d->dir);
return -1;
}
@@ -101,7 +101,7 @@ void git__rewinddir(git__DIR *d)
d->h = FindFirstFileW(filter_w, &d->f);
if (d->h == INVALID_HANDLE_VALUE)
- giterr_set(GITERR_OS, "could not open directory '%s'", d->dir);
+ git_error_set(GIT_ERROR_OS, "could not open directory '%s'", d->dir);
else
d->first = 1;
}
diff --git a/src/win32/findfile.c b/src/win32/findfile.c
index b5419be..7f077e1 100644
--- a/src/win32/findfile.c
+++ b/src/win32/findfile.c
@@ -39,7 +39,7 @@ static int win32_path_to_8(git_buf *dest, const wchar_t *src)
git_win32_utf8_path utf8_path;
if (git_win32_path_to_utf8(utf8_path, src) < 0) {
- giterr_set(GITERR_OS, "unable to convert path to UTF-8");
+ git_error_set(GIT_ERROR_OS, "unable to convert path to UTF-8");
return -1;
}
diff --git a/src/win32/map.c b/src/win32/map.c
index 6a17aeb..5769cb8 100644
--- a/src/win32/map.c
+++ b/src/win32/map.c
@@ -69,7 +69,7 @@ int p_mmap(git_map *out, size_t len, int prot, int flags, int fd, git_off_t offs
if (fh == INVALID_HANDLE_VALUE) {
errno = EBADF;
- giterr_set(GITERR_OS, "failed to mmap. Invalid handle value");
+ git_error_set(GIT_ERROR_OS, "failed to mmap. Invalid handle value");
return -1;
}
@@ -88,13 +88,13 @@ int p_mmap(git_map *out, size_t len, int prot, int flags, int fd, git_off_t offs
if (page_offset != 0) { /* offset must be multiple of the allocation granularity */
errno = EINVAL;
- giterr_set(GITERR_OS, "failed to mmap. Offset must be multiple of allocation granularity");
+ git_error_set(GIT_ERROR_OS, "failed to mmap. Offset must be multiple of allocation granularity");
return -1;
}
out->fmh = CreateFileMapping(fh, NULL, fmap_prot, 0, 0, NULL);
if (!out->fmh || out->fmh == INVALID_HANDLE_VALUE) {
- giterr_set(GITERR_OS, "failed to mmap. Invalid handle value");
+ git_error_set(GIT_ERROR_OS, "failed to mmap. Invalid handle value");
out->fmh = NULL;
return -1;
}
@@ -105,7 +105,7 @@ int p_mmap(git_map *out, size_t len, int prot, int flags, int fd, git_off_t offs
off_hi = (DWORD)(page_start >> 32);
out->data = MapViewOfFile(out->fmh, view_prot, off_hi, off_low, len);
if (!out->data) {
- giterr_set(GITERR_OS, "failed to mmap. No data written");
+ git_error_set(GIT_ERROR_OS, "failed to mmap. No data written");
CloseHandle(out->fmh);
out->fmh = NULL;
return -1;
@@ -123,7 +123,7 @@ int p_munmap(git_map *map)
if (map->data) {
if (!UnmapViewOfFile(map->data)) {
- giterr_set(GITERR_OS, "failed to munmap. Could not unmap view of file");
+ git_error_set(GIT_ERROR_OS, "failed to munmap. Could not unmap view of file");
error = -1;
}
map->data = NULL;
@@ -131,7 +131,7 @@ int p_munmap(git_map *map)
if (map->fmh) {
if (!CloseHandle(map->fmh)) {
- giterr_set(GITERR_OS, "failed to munmap. Could not close handle");
+ git_error_set(GIT_ERROR_OS, "failed to munmap. Could not close handle");
error = -1;
}
map->fmh = NULL;
diff --git a/src/win32/posix_w32.c b/src/win32/posix_w32.c
index aa9e618..d8bbebb 100644
--- a/src/win32/posix_w32.c
+++ b/src/win32/posix_w32.c
@@ -532,7 +532,7 @@ int p_utimes(const char *path, const struct p_timeval times[2])
attrs_new = attrs_orig & ~FILE_ATTRIBUTE_READONLY;
if (!SetFileAttributesW(wpath, attrs_new)) {
- giterr_set(GITERR_OS, "failed to set attributes");
+ git_error_set(GIT_ERROR_OS, "failed to set attributes");
return -1;
}
}
@@ -852,7 +852,7 @@ int p_rename(const char *from, const char *to)
int p_recv(GIT_SOCKET socket, void *buffer, size_t length, int flags)
{
if ((size_t)((int)length) != length)
- return -1; /* giterr_set will be done by caller */
+ return -1; /* git_error_set will be done by caller */
return recv(socket, buffer, (int)length, flags);
}
@@ -860,7 +860,7 @@ int p_recv(GIT_SOCKET socket, void *buffer, size_t length, int flags)
int p_send(GIT_SOCKET socket, const void *buffer, size_t length, int flags)
{
if ((size_t)((int)length) != length)
- return -1; /* giterr_set will be done by caller */
+ return -1; /* git_error_set will be done by caller */
return send(socket, buffer, (int)length, flags);
}
diff --git a/src/win32/w32_buffer.c b/src/win32/w32_buffer.c
index 45c024d..22ea9a1 100644
--- a/src/win32/w32_buffer.c
+++ b/src/win32/w32_buffer.c
@@ -36,8 +36,8 @@ int git_buf_put_w(git_buf *buf, const wchar_t *string_w, size_t len_w)
assert(utf8_len > 0);
- GITERR_CHECK_ALLOC_ADD(&new_size, buf->size, (size_t)utf8_len);
- GITERR_CHECK_ALLOC_ADD(&new_size, new_size, 1);
+ GIT_ERROR_CHECK_ALLOC_ADD(&new_size, buf->size, (size_t)utf8_len);
+ GIT_ERROR_CHECK_ALLOC_ADD(&new_size, new_size, 1);
if (git_buf_grow(buf, new_size) < 0)
return -1;
diff --git a/src/win32/w32_crtdbg_stacktrace.c b/src/win32/w32_crtdbg_stacktrace.c
index 3fcadd2..49b54f1 100644
--- a/src/win32/w32_crtdbg_stacktrace.c
+++ b/src/win32/w32_crtdbg_stacktrace.c
@@ -74,21 +74,21 @@ static bool g_transient_leaks_since_mark = false; /* payload for hook */
static void *crtdbg__malloc(size_t len, const char *file, int line)
{
void *ptr = _malloc_dbg(len, _NORMAL_BLOCK, git_win32__crtdbg_stacktrace(1,file), line);
- if (!ptr) giterr_set_oom();
+ if (!ptr) git_error_set_oom();
return ptr;
}
static void *crtdbg__calloc(size_t nelem, size_t elsize, const char *file, int line)
{
void *ptr = _calloc_dbg(nelem, elsize, _NORMAL_BLOCK, git_win32__crtdbg_stacktrace(1,file), line);
- if (!ptr) giterr_set_oom();
+ if (!ptr) git_error_set_oom();
return ptr;
}
static char *crtdbg__strdup(const char *str, const char *file, int line)
{
char *ptr = _strdup_dbg(str, _NORMAL_BLOCK, git_win32__crtdbg_stacktrace(1,file), line);
- if (!ptr) giterr_set_oom();
+ if (!ptr) git_error_set_oom();
return ptr;
}
@@ -128,7 +128,7 @@ static char *crtdbg__substrdup(const char *start, size_t n, const char *file, in
static void *crtdbg__realloc(void *ptr, size_t size, const char *file, int line)
{
void *new_ptr = _realloc_dbg(ptr, size, _NORMAL_BLOCK, git_win32__crtdbg_stacktrace(1,file), line);
- if (!new_ptr) giterr_set_oom();
+ if (!new_ptr) git_error_set_oom();
return new_ptr;
}
@@ -347,11 +347,11 @@ int git_win32__crtdbg_stacktrace__dump(
bool b_quiet = IS_BIT_SET(opt, GIT_WIN32__CRTDBG_STACKTRACE__QUIET);
if (b_leaks_since_mark && b_leaks_total) {
- giterr_set(GITERR_INVALID, "cannot combine LEAKS_SINCE_MARK and LEAKS_TOTAL.");
+ git_error_set(GIT_ERROR_INVALID, "cannot combine LEAKS_SINCE_MARK and LEAKS_TOTAL.");
return GIT_ERROR;
}
if (!b_set_mark && !b_leaks_since_mark && !b_leaks_total) {
- giterr_set(GITERR_INVALID, "nothing to do.");
+ git_error_set(GIT_ERROR_INVALID, "nothing to do.");
return GIT_ERROR;
}
diff --git a/src/win32/w32_stack.c b/src/win32/w32_stack.c
index b40f9d2..c9d6b1a 100644
--- a/src/win32/w32_stack.c
+++ b/src/win32/w32_stack.c
@@ -55,7 +55,7 @@ void git_win32__stack_cleanup(void)
int git_win32__stack_capture(git_win32__stack__raw_data *pdata, int skip)
{
if (!g_win32_stack_initialized) {
- giterr_set(GITERR_INVALID, "git_win32_stack not initialized.");
+ git_error_set(GIT_ERROR_INVALID, "git_win32_stack not initialized.");
return GIT_ERROR;
}
@@ -102,7 +102,7 @@ int git_win32__stack_format(
int detail_len;
if (!g_win32_stack_initialized) {
- giterr_set(GITERR_INVALID, "git_win32_stack not initialized.");
+ git_error_set(GIT_ERROR_INVALID, "git_win32_stack not initialized.");
return GIT_ERROR;
}
diff --git a/src/win32/w32_util.c b/src/win32/w32_util.c
index 5996c9f..10e17fc 100644
--- a/src/win32/w32_util.c
+++ b/src/win32/w32_util.c
@@ -68,7 +68,7 @@ int git_win32__set_hidden(const char *path, bool hidden)
newattrs = attrs & ~FILE_ATTRIBUTE_HIDDEN;
if (attrs != newattrs && !SetFileAttributesW(buf, newattrs)) {
- giterr_set(GITERR_OS, "failed to %s hidden bit for '%s'",
+ git_error_set(GIT_ERROR_OS, "failed to %s hidden bit for '%s'",
hidden ? "set" : "unset", path);
return -1;
}
diff --git a/src/win32/w32_util.h b/src/win32/w32_util.h
index 5216a13..3a79425 100644
--- a/src/win32/w32_util.h
+++ b/src/win32/w32_util.h
@@ -158,7 +158,7 @@ GIT_INLINE(int) git_win32__file_attribute_to_stat(
/* st_size gets the UTF-8 length of the target name, in bytes,
* not counting the NULL terminator */
if ((st->st_size = git__utf16_to_8(NULL, 0, target)) < 0) {
- giterr_set(GITERR_OS, "could not convert reparse point name for '%ls'", path);
+ git_error_set(GIT_ERROR_OS, "could not convert reparse point name for '%ls'", path);
return -1;
}
}
diff --git a/src/worktree.c b/src/worktree.c
index e06cdfb..174a107 100644
--- a/src/worktree.c
+++ b/src/worktree.c
@@ -194,7 +194,7 @@ int git_worktree_open_from_repository(git_worktree **out, git_repository *repo)
int error = 0;
if (!git_repository_is_worktree(repo)) {
- giterr_set(GITERR_WORKTREE, "cannot open worktree of a non-worktree repo");
+ git_error_set(GIT_ERROR_WORKTREE, "cannot open worktree of a non-worktree repo");
error = -1;
goto out;
}
@@ -237,21 +237,21 @@ int git_worktree_validate(const git_worktree *wt)
assert(wt);
if (!is_worktree_dir(wt->gitdir_path)) {
- giterr_set(GITERR_WORKTREE,
+ git_error_set(GIT_ERROR_WORKTREE,
"Worktree gitdir ('%s') is not valid",
wt->gitlink_path);
return GIT_ERROR;
}
if (wt->parent_path && !git_path_exists(wt->parent_path)) {
- giterr_set(GITERR_WORKTREE,
+ git_error_set(GIT_ERROR_WORKTREE,
"Worktree parent directory ('%s') does not exist ",
wt->parent_path);
return GIT_ERROR;
}
if (!git_path_exists(wt->commondir_path)) {
- giterr_set(GITERR_WORKTREE,
+ git_error_set(GIT_ERROR_WORKTREE,
"Worktree common directory ('%s') does not exist ",
wt->commondir_path);
return GIT_ERROR;
@@ -280,7 +280,7 @@ int git_worktree_add(git_worktree **out, git_repository *repo,
git_worktree_add_options wtopts = GIT_WORKTREE_ADD_OPTIONS_INIT;
int err;
- GITERR_CHECK_VERSION(
+ GIT_ERROR_CHECK_VERSION(
opts, GIT_WORKTREE_ADD_OPTIONS_VERSION, "git_worktree_add_options");
if (opts)
@@ -343,13 +343,13 @@ int git_worktree_add(git_worktree **out, git_repository *repo,
/* Set up worktree reference */
if (wtopts.ref) {
if (!git_reference_is_branch(wtopts.ref)) {
- giterr_set(GITERR_WORKTREE, "reference is not a branch");
+ git_error_set(GIT_ERROR_WORKTREE, "reference is not a branch");
err = -1;
goto out;
}
if (git_branch_is_checked_out(wtopts.ref)) {
- giterr_set(GITERR_WORKTREE, "reference is already checked out");
+ git_error_set(GIT_ERROR_WORKTREE, "reference is already checked out");
err = -1;
goto out;
}
@@ -491,7 +491,7 @@ int git_worktree_is_prunable(git_worktree *wt,
git_buf reason = GIT_BUF_INIT;
git_worktree_prune_options popts = GIT_WORKTREE_PRUNE_OPTIONS_INIT;
- GITERR_CHECK_VERSION(
+ GIT_ERROR_CHECK_VERSION(
opts, GIT_WORKTREE_PRUNE_OPTIONS_VERSION,
"git_worktree_prune_options");
@@ -503,7 +503,7 @@ int git_worktree_is_prunable(git_worktree *wt,
{
if (!reason.size)
git_buf_attach_notowned(&reason, "no reason given", 15);
- giterr_set(GITERR_WORKTREE, "Not pruning locked working tree: '%s'", reason.ptr);
+ git_error_set(GIT_ERROR_WORKTREE, "Not pruning locked working tree: '%s'", reason.ptr);
git_buf_dispose(&reason);
return 0;
@@ -512,7 +512,7 @@ int git_worktree_is_prunable(git_worktree *wt,
if ((popts.flags & GIT_WORKTREE_PRUNE_VALID) == 0 &&
git_worktree_validate(wt) == 0)
{
- giterr_set(GITERR_WORKTREE, "Not pruning valid working tree");
+ git_error_set(GIT_ERROR_WORKTREE, "Not pruning valid working tree");
return 0;
}
@@ -527,7 +527,7 @@ int git_worktree_prune(git_worktree *wt,
char *wtpath;
int err;
- GITERR_CHECK_VERSION(
+ GIT_ERROR_CHECK_VERSION(
opts, GIT_WORKTREE_PRUNE_OPTIONS_VERSION,
"git_worktree_prune_options");
@@ -544,7 +544,7 @@ int git_worktree_prune(git_worktree *wt,
goto out;
if (!git_path_exists(path.ptr))
{
- giterr_set(GITERR_WORKTREE, "Worktree gitdir '%s' does not exist", path.ptr);
+ git_error_set(GIT_ERROR_WORKTREE, "Worktree gitdir '%s' does not exist", path.ptr);
err = -1;
goto out;
}
@@ -564,7 +564,7 @@ int git_worktree_prune(git_worktree *wt,
git_buf_attach(&path, wtpath, 0);
if (!git_path_exists(path.ptr))
{
- giterr_set(GITERR_WORKTREE, "Working tree '%s' does not exist", path.ptr);
+ git_error_set(GIT_ERROR_WORKTREE, "Working tree '%s' does not exist", path.ptr);
err = -1;
goto out;
}
diff --git a/src/xdiff/xdiffi.c b/src/xdiff/xdiffi.c
index 97db054..9a7f538 100644
--- a/src/xdiff/xdiffi.c
+++ b/src/xdiff/xdiffi.c
@@ -350,10 +350,10 @@ int xdl_do_diff(mmfile_t *mf1, mmfile_t *mf2, xpparam_t const *xpp,
* Allocate and setup K vectors to be used by the differential algorithm.
* One is to store the forward path and one to store the backward path.
*/
- GITERR_CHECK_ALLOC_ADD3(&ndiags, xe->xdf1.nreff, xe->xdf2.nreff, 3);
- GITERR_CHECK_ALLOC_MULTIPLY(&allocsize, ndiags, 2);
- GITERR_CHECK_ALLOC_ADD(&allocsize, allocsize, 2);
- GITERR_CHECK_ALLOC_MULTIPLY(&allocsize, allocsize, sizeof(long));
+ GIT_ERROR_CHECK_ALLOC_ADD3(&ndiags, xe->xdf1.nreff, xe->xdf2.nreff, 3);
+ GIT_ERROR_CHECK_ALLOC_MULTIPLY(&allocsize, ndiags, 2);
+ GIT_ERROR_CHECK_ALLOC_ADD(&allocsize, allocsize, 2);
+ GIT_ERROR_CHECK_ALLOC_MULTIPLY(&allocsize, allocsize, sizeof(long));
if (!(kvd = (long *) xdl_malloc(allocsize))) {
xdl_free_env(xe);
diff --git a/src/xdiff/xhistogram.c b/src/xdiff/xhistogram.c
index ca8605e..00bbfce 100644
--- a/src/xdiff/xhistogram.c
+++ b/src/xdiff/xhistogram.c
@@ -302,7 +302,7 @@ static int histogram_diff(
index.table_bits = xdl_hashbits(count1);
sz = index.records_size = 1 << index.table_bits;
- GITERR_CHECK_ALLOC_MULTIPLY(&sz, sz, sizeof(struct record *));
+ GIT_ERROR_CHECK_ALLOC_MULTIPLY(&sz, sz, sizeof(struct record *));
if (!(index.records = (struct record **) xdl_malloc(sz)))
goto cleanup;
diff --git a/src/xdiff/xmerge.c b/src/xdiff/xmerge.c
index 6fec95a..e6eaf24 100644
--- a/src/xdiff/xmerge.c
+++ b/src/xdiff/xmerge.c
@@ -125,7 +125,7 @@ static int xdl_recs_copy_0(size_t *out, int use_orig, xdfenv_t *xe, int i, int c
if (dest)
memcpy(dest + size, recs[i]->ptr, recs[i]->size);
- GITERR_CHECK_ALLOC_ADD(&size, size, recs[i++]->size);
+ GIT_ERROR_CHECK_ALLOC_ADD(&size, size, recs[i++]->size);
}
if (add_nl) {
@@ -134,13 +134,13 @@ static int xdl_recs_copy_0(size_t *out, int use_orig, xdfenv_t *xe, int i, int c
if (needs_cr) {
if (dest)
dest[size] = '\r';
- GITERR_CHECK_ALLOC_ADD(&size, size, 1);
+ GIT_ERROR_CHECK_ALLOC_ADD(&size, size, 1);
}
if (dest)
dest[size] = '\n';
- GITERR_CHECK_ALLOC_ADD(&size, size, 1);
+ GIT_ERROR_CHECK_ALLOC_ADD(&size, size, 1);
}
}
@@ -224,10 +224,10 @@ static int fill_conflict_hunk(size_t *out, xdfenv_t *xe1, const char *name1,
dest ? dest + size : NULL) < 0)
return -1;
- GITERR_CHECK_ALLOC_ADD(&size, size, copied);
+ GIT_ERROR_CHECK_ALLOC_ADD(&size, size, copied);
if (!dest) {
- GITERR_CHECK_ALLOC_ADD5(&size, size, marker_size, 1, needs_cr, marker1_size);
+ GIT_ERROR_CHECK_ALLOC_ADD5(&size, size, marker_size, 1, needs_cr, marker1_size);
} else {
memset(dest + size, '<', marker_size);
size += marker_size;
@@ -246,12 +246,12 @@ static int fill_conflict_hunk(size_t *out, xdfenv_t *xe1, const char *name1,
dest ? dest + size : NULL) < 0)
return -1;
- GITERR_CHECK_ALLOC_ADD(&size, size, copied);
+ GIT_ERROR_CHECK_ALLOC_ADD(&size, size, copied);
if (style == XDL_MERGE_DIFF3) {
/* Shared preimage */
if (!dest) {
- GITERR_CHECK_ALLOC_ADD5(&size, size, marker_size, 1, needs_cr, marker3_size);
+ GIT_ERROR_CHECK_ALLOC_ADD5(&size, size, marker_size, 1, needs_cr, marker3_size);
} else {
memset(dest + size, '|', marker_size);
size += marker_size;
@@ -268,11 +268,11 @@ static int fill_conflict_hunk(size_t *out, xdfenv_t *xe1, const char *name1,
if (xdl_orig_copy(&copied, xe1, m->i0, m->chg0, needs_cr, 1,
dest ? dest + size : NULL) < 0)
return -1;
- GITERR_CHECK_ALLOC_ADD(&size, size, copied);
+ GIT_ERROR_CHECK_ALLOC_ADD(&size, size, copied);
}
if (!dest) {
- GITERR_CHECK_ALLOC_ADD4(&size, size, marker_size, 1, needs_cr);
+ GIT_ERROR_CHECK_ALLOC_ADD4(&size, size, marker_size, 1, needs_cr);
} else {
memset(dest + size, '=', marker_size);
size += marker_size;
@@ -286,10 +286,10 @@ static int fill_conflict_hunk(size_t *out, xdfenv_t *xe1, const char *name1,
if (xdl_recs_copy(&copied, xe2, m->i2, m->chg2, needs_cr, 1,
dest ? dest + size : NULL) < 0)
return -1;
- GITERR_CHECK_ALLOC_ADD(&size, size, copied);
+ GIT_ERROR_CHECK_ALLOC_ADD(&size, size, copied);
if (!dest) {
- GITERR_CHECK_ALLOC_ADD5(&size, size, marker_size, 1, needs_cr, marker2_size);
+ GIT_ERROR_CHECK_ALLOC_ADD5(&size, size, marker_size, 1, needs_cr, marker2_size);
} else {
memset(dest + size, '>', marker_size);
size += marker_size;
@@ -336,7 +336,7 @@ static int xdl_fill_merge_buffer(size_t *out,
if (xdl_recs_copy(&copied, xe1, i, m->i1 - i, 0, 0,
dest ? dest + size : NULL) < 0)
return -1;
- GITERR_CHECK_ALLOC_ADD(&size, size, copied);
+ GIT_ERROR_CHECK_ALLOC_ADD(&size, size, copied);
/* Postimage from side #1 */
if (m->mode & 1) {
@@ -345,7 +345,7 @@ static int xdl_fill_merge_buffer(size_t *out,
if (xdl_recs_copy(&copied, xe1, m->i1, m->chg1, needs_cr, (m->mode & 2),
dest ? dest + size : NULL) < 0)
return -1;
- GITERR_CHECK_ALLOC_ADD(&size, size, copied);
+ GIT_ERROR_CHECK_ALLOC_ADD(&size, size, copied);
}
/* Postimage from side #2 */
@@ -353,7 +353,7 @@ static int xdl_fill_merge_buffer(size_t *out,
if (xdl_recs_copy(&copied, xe2, m->i2, m->chg2, 0, 0,
dest ? dest + size : NULL) < 0)
return -1;
- GITERR_CHECK_ALLOC_ADD(&size, size, copied);
+ GIT_ERROR_CHECK_ALLOC_ADD(&size, size, copied);
}
} else
continue;
@@ -363,7 +363,7 @@ static int xdl_fill_merge_buffer(size_t *out,
if (xdl_recs_copy(&copied, xe1, i, xe1->xdf2.nrec - i, 0, 0,
dest ? dest + size : NULL) < 0)
return -1;
- GITERR_CHECK_ALLOC_ADD(&size, size, copied);
+ GIT_ERROR_CHECK_ALLOC_ADD(&size, size, copied);
*out = size;
return 0;
diff --git a/src/zstream.c b/src/zstream.c
index affa556..fc8bfb8 100644
--- a/src/zstream.c
+++ b/src/zstream.c
@@ -22,13 +22,13 @@ GIT_INLINE(int) zstream_seterr(git_zstream *zs)
case Z_BUF_ERROR: /* not fatal; we retry with a larger buffer */
return 0;
case Z_MEM_ERROR:
- giterr_set_oom();
+ git_error_set_oom();
break;
default:
if (zs->z.msg)
- giterr_set_str(GITERR_ZLIB, zs->z.msg);
+ git_error_set_str(GIT_ERROR_ZLIB, zs->z.msg);
else
- giterr_set(GITERR_ZLIB, "unknown compression error");
+ git_error_set(GIT_ERROR_ZLIB, "unknown compression error");
}
return -1;
@@ -136,7 +136,7 @@ int git_zstream_get_output(void *out, size_t *out_len, git_zstream *zstream)
size_t out_remain = *out_len;
if (zstream->in_len && zstream->zerr == Z_STREAM_END) {
- giterr_set(GITERR_ZLIB, "zlib input had trailing garbage");
+ git_error_set(GIT_ERROR_ZLIB, "zlib input had trailing garbage");
return -1;
}
diff --git a/tests/checkout/index.c b/tests/checkout/index.c
index a4c811b..8272c68 100644
--- a/tests/checkout/index.c
+++ b/tests/checkout/index.c
@@ -548,15 +548,15 @@ void test_checkout_index__validates_struct_version(void)
opts.version = 1024;
cl_git_fail(git_checkout_index(g_repo, NULL, &opts));
- err = giterr_last();
- cl_assert_equal_i(err->klass, GITERR_INVALID);
+ err = git_error_last();
+ cl_assert_equal_i(err->klass, GIT_ERROR_INVALID);
opts.version = 0;
- giterr_clear();
+ git_error_clear();
cl_git_fail(git_checkout_index(g_repo, NULL, &opts));
- err = giterr_last();
- cl_assert_equal_i(err->klass, GITERR_INVALID);
+ err = git_error_last();
+ cl_assert_equal_i(err->klass, GIT_ERROR_INVALID);
}
void test_checkout_index__can_update_prefixed_files(void)
diff --git a/tests/clar_libgit2.c b/tests/clar_libgit2.c
index 740264c..4723a06 100644
--- a/tests/clar_libgit2.c
+++ b/tests/clar_libgit2.c
@@ -7,7 +7,7 @@ void cl_git_report_failure(
int error, int expected, const char *file, int line, const char *fncall)
{
char msg[4096];
- const git_error *last = giterr_last();
+ const git_error *last = git_error_last();
if (expected)
p_snprintf(msg, 4096, "error %d (expected %d) - %s",
@@ -470,7 +470,7 @@ int cl_repo_get_bool(git_repository *repo, const char *cfg)
git_config *config;
cl_git_pass(git_repository_config(&config, repo));
if (git_config_get_bool(&val, config, cfg) < 0)
- giterr_clear();
+ git_error_clear();
git_config_free(config);
return val;
}
diff --git a/tests/clar_libgit2.h b/tests/clar_libgit2.h
index 8a0ff4f..da6ff29 100644
--- a/tests/clar_libgit2.h
+++ b/tests/clar_libgit2.h
@@ -18,7 +18,7 @@
#define cl_git_expect(expr, expected, file, line) do { \
int _lg2_error; \
- giterr_clear(); \
+ git_error_clear(); \
if ((_lg2_error = (expr)) != expected) \
cl_git_report_failure(_lg2_error, expected, file, line, "Function call failed: " #expr); \
} while (0)
@@ -29,7 +29,7 @@
* calls that are supposed to fail!
*/
#define cl_git_fail(expr) do { \
- giterr_clear(); \
+ git_error_clear(); \
if ((expr) == 0) \
cl_git_report_failure(0, 0, __FILE__, __LINE__, "Function call succeeded: " #expr); \
} while (0)
@@ -40,7 +40,7 @@
#define cl_win32_pass(expr) do { \
int _win32_res; \
if ((_win32_res = (expr)) == 0) { \
- giterr_set(GITERR_OS, "Returned: %d, system error code: %lu", _win32_res, GetLastError()); \
+ git_error_set(GIT_ERROR_OS, "Returned: %d, system error code: %lu", _win32_res, GetLastError()); \
cl_git_report_failure(_win32_res, 0, __FILE__, __LINE__, "System call failed: " #expr); \
} \
} while(0)
@@ -70,9 +70,9 @@ typedef struct {
#endif
#define cl_git_thread_pass_(__threaderr, __expr, __file, __line) do { \
- giterr_clear(); \
+ git_error_clear(); \
if ((((cl_git_thread_err *)__threaderr)->error = (__expr)) != 0) { \
- const git_error *_last = giterr_last(); \
+ const git_error *_last = git_error_last(); \
((cl_git_thread_err *)__threaderr)->file = __file; \
((cl_git_thread_err *)__threaderr)->line = __line; \
((cl_git_thread_err *)__threaderr)->expr = "Function call failed: " #__expr; \
diff --git a/tests/commit/parse.c b/tests/commit/parse.c
index a5dcf87..f0a31de 100644
--- a/tests/commit/parse.c
+++ b/tests/commit/parse.c
@@ -531,12 +531,12 @@ corrupt signature\n";
/* Try to parse a tree */
cl_git_pass(git_oid_fromstr(&commit_id, "45dd856fdd4d89b884c340ba0e047752d9b085d6"));
cl_git_fail_with(GIT_ENOTFOUND, git_commit_extract_signature(&signature, &signed_data, g_repo, &commit_id, NULL));
- cl_assert_equal_i(GITERR_INVALID, giterr_last()->klass);
+ cl_assert_equal_i(GIT_ERROR_INVALID, git_error_last()->klass);
/* Try to parse an unsigned commit */
cl_git_pass(git_odb_write(&commit_id, odb, passing_commit_cases[1], strlen(passing_commit_cases[1]), GIT_OBJECT_COMMIT));
cl_git_fail_with(GIT_ENOTFOUND, git_commit_extract_signature(&signature, &signed_data, g_repo, &commit_id, NULL));
- cl_assert_equal_i(GITERR_OBJECT, giterr_last()->klass);
+ cl_assert_equal_i(GIT_ERROR_OBJECT, git_error_last()->klass);
/* Parse the commit with a single-line signature */
git_buf_clear(&signature);
diff --git a/tests/config/backend.c b/tests/config/backend.c
index 18c4ca5..96feecc 100644
--- a/tests/config/backend.c
+++ b/tests/config/backend.c
@@ -11,14 +11,14 @@ void test_config_backend__checks_version(void)
cl_git_pass(git_config_new(&cfg));
cl_git_fail(git_config_add_backend(cfg, &backend, 0, NULL, false));
- err = giterr_last();
- cl_assert_equal_i(GITERR_INVALID, err->klass);
+ err = git_error_last();
+ cl_assert_equal_i(GIT_ERROR_INVALID, err->klass);
- giterr_clear();
+ git_error_clear();
backend.version = 1024;
cl_git_fail(git_config_add_backend(cfg, &backend, 0, NULL, false));
- err = giterr_last();
- cl_assert_equal_i(GITERR_INVALID, err->klass);
+ err = git_error_last();
+ cl_assert_equal_i(GIT_ERROR_INVALID, err->klass);
git_config_free(cfg);
}
diff --git a/tests/config/include.c b/tests/config/include.c
index bab59bc..4454693 100644
--- a/tests/config/include.c
+++ b/tests/config/include.c
@@ -101,9 +101,9 @@ void test_config_include__missing(void)
{
cl_git_mkfile("including", "[include]\npath = nonexistentfile\n[foo]\nbar = baz");
- giterr_clear();
+ git_error_clear();
cl_git_pass(git_config_open_ondisk(&cfg, "including"));
- cl_assert(giterr_last() == NULL);
+ cl_assert(git_error_last() == NULL);
cl_git_pass(git_config_get_string_buf(&buf, cfg, "foo.bar"));
cl_assert_equal_s("baz", git_buf_cstr(&buf));
@@ -115,9 +115,9 @@ void test_config_include__missing_homedir(void)
cl_git_pass(git_libgit2_opts(GIT_OPT_SET_SEARCH_PATH, GIT_CONFIG_LEVEL_GLOBAL, cl_fixture("config")));
cl_git_mkfile("including", "[include]\npath = ~/.nonexistentfile\n[foo]\nbar = baz");
- giterr_clear();
+ git_error_clear();
cl_git_pass(git_config_open_ondisk(&cfg, "including"));
- cl_assert(giterr_last() == NULL);
+ cl_assert(git_error_last() == NULL);
cl_git_pass(git_config_get_string_buf(&buf, cfg, "foo.bar"));
cl_assert_equal_s("baz", git_buf_cstr(&buf));
diff --git a/tests/config/rename.c b/tests/config/rename.c
index a461415..be620c3 100644
--- a/tests/config/rename.c
+++ b/tests/config/rename.c
@@ -66,7 +66,7 @@ void test_config_rename__prevent_overwrite(void)
/* so, we don't currently prevent overwrite... */
/* {
const git_error *err;
- cl_assert((err = giterr_last()) != NULL);
+ cl_assert((err = git_error_last()) != NULL);
cl_assert(err->message != NULL);
} */
}
diff --git a/tests/core/errors.c b/tests/core/errors.c
index ab18951..386ecdc 100644
--- a/tests/core/errors.c
+++ b/tests/core/errors.c
@@ -4,26 +4,26 @@ void test_core_errors__public_api(void)
{
char *str_in_error;
- giterr_clear();
- cl_assert(giterr_last() == NULL);
+ git_error_clear();
+ cl_assert(git_error_last() == NULL);
- giterr_set_oom();
+ git_error_set_oom();
- cl_assert(giterr_last() != NULL);
- cl_assert(giterr_last()->klass == GITERR_NOMEMORY);
- str_in_error = strstr(giterr_last()->message, "memory");
+ cl_assert(git_error_last() != NULL);
+ cl_assert(git_error_last()->klass == GIT_ERROR_NOMEMORY);
+ str_in_error = strstr(git_error_last()->message, "memory");
cl_assert(str_in_error != NULL);
- giterr_clear();
+ git_error_clear();
- giterr_set_str(GITERR_REPOSITORY, "This is a test");
+ git_error_set_str(GIT_ERROR_REPOSITORY, "This is a test");
- cl_assert(giterr_last() != NULL);
- str_in_error = strstr(giterr_last()->message, "This is a test");
+ cl_assert(git_error_last() != NULL);
+ str_in_error = strstr(git_error_last()->message, "This is a test");
cl_assert(str_in_error != NULL);
- giterr_clear();
- cl_assert(giterr_last() == NULL);
+ git_error_clear();
+ cl_assert(git_error_last() == NULL);
}
#include "common.h"
@@ -34,26 +34,26 @@ void test_core_errors__new_school(void)
{
char *str_in_error;
- giterr_clear();
- cl_assert(giterr_last() == NULL);
+ git_error_clear();
+ cl_assert(git_error_last() == NULL);
- giterr_set_oom(); /* internal fn */
+ git_error_set_oom(); /* internal fn */
- cl_assert(giterr_last() != NULL);
- cl_assert(giterr_last()->klass == GITERR_NOMEMORY);
- str_in_error = strstr(giterr_last()->message, "memory");
+ cl_assert(git_error_last() != NULL);
+ cl_assert(git_error_last()->klass == GIT_ERROR_NOMEMORY);
+ str_in_error = strstr(git_error_last()->message, "memory");
cl_assert(str_in_error != NULL);
- giterr_clear();
+ git_error_clear();
- giterr_set(GITERR_REPOSITORY, "This is a test"); /* internal fn */
+ git_error_set(GIT_ERROR_REPOSITORY, "This is a test"); /* internal fn */
- cl_assert(giterr_last() != NULL);
- str_in_error = strstr(giterr_last()->message, "This is a test");
+ cl_assert(git_error_last() != NULL);
+ str_in_error = strstr(git_error_last()->message, "This is a test");
cl_assert(str_in_error != NULL);
- giterr_clear();
- cl_assert(giterr_last() == NULL);
+ git_error_clear();
+ cl_assert(git_error_last() == NULL);
do {
struct stat st;
@@ -61,74 +61,74 @@ void test_core_errors__new_school(void)
cl_assert(p_lstat("this_file_does_not_exist", &st) < 0);
GIT_UNUSED(st);
} while (false);
- giterr_set(GITERR_OS, "stat failed"); /* internal fn */
+ git_error_set(GIT_ERROR_OS, "stat failed"); /* internal fn */
- cl_assert(giterr_last() != NULL);
- str_in_error = strstr(giterr_last()->message, "stat failed");
+ cl_assert(git_error_last() != NULL);
+ str_in_error = strstr(git_error_last()->message, "stat failed");
cl_assert(str_in_error != NULL);
cl_assert(git__prefixcmp(str_in_error, "stat failed: ") == 0);
cl_assert(strlen(str_in_error) > strlen("stat failed: "));
#ifdef GIT_WIN32
- giterr_clear();
+ git_error_clear();
/* The MSDN docs use this to generate a sample error */
cl_assert(GetProcessId(NULL) == 0);
- giterr_set(GITERR_OS, "GetProcessId failed"); /* internal fn */
+ git_error_set(GIT_ERROR_OS, "GetProcessId failed"); /* internal fn */
- cl_assert(giterr_last() != NULL);
- str_in_error = strstr(giterr_last()->message, "GetProcessId failed");
+ cl_assert(git_error_last() != NULL);
+ str_in_error = strstr(git_error_last()->message, "GetProcessId failed");
cl_assert(str_in_error != NULL);
cl_assert(git__prefixcmp(str_in_error, "GetProcessId failed: ") == 0);
cl_assert(strlen(str_in_error) > strlen("GetProcessId failed: "));
#endif
- giterr_clear();
+ git_error_clear();
}
void test_core_errors__restore(void)
{
git_error_state err_state = {0};
- giterr_clear();
- cl_assert(giterr_last() == NULL);
+ git_error_clear();
+ cl_assert(git_error_last() == NULL);
- cl_assert_equal_i(0, giterr_state_capture(&err_state, 0));
+ cl_assert_equal_i(0, git_error_state_capture(&err_state, 0));
memset(&err_state, 0x0, sizeof(git_error_state));
- giterr_set(42, "Foo: %s", "bar");
- cl_assert_equal_i(-1, giterr_state_capture(&err_state, -1));
+ git_error_set(42, "Foo: %s", "bar");
+ cl_assert_equal_i(-1, git_error_state_capture(&err_state, -1));
- cl_assert(giterr_last() == NULL);
+ cl_assert(git_error_last() == NULL);
- giterr_set(99, "Bar: %s", "foo");
+ git_error_set(99, "Bar: %s", "foo");
- giterr_state_restore(&err_state);
+ git_error_state_restore(&err_state);
- cl_assert_equal_i(42, giterr_last()->klass);
- cl_assert_equal_s("Foo: bar", giterr_last()->message);
+ cl_assert_equal_i(42, git_error_last()->klass);
+ cl_assert_equal_s("Foo: bar", git_error_last()->message);
}
void test_core_errors__free_state(void)
{
git_error_state err_state = {0};
- giterr_clear();
+ git_error_clear();
- giterr_set(42, "Foo: %s", "bar");
- cl_assert_equal_i(-1, giterr_state_capture(&err_state, -1));
+ git_error_set(42, "Foo: %s", "bar");
+ cl_assert_equal_i(-1, git_error_state_capture(&err_state, -1));
- giterr_set(99, "Bar: %s", "foo");
+ git_error_set(99, "Bar: %s", "foo");
- giterr_state_free(&err_state);
+ git_error_state_free(&err_state);
- cl_assert_equal_i(99, giterr_last()->klass);
- cl_assert_equal_s("Bar: foo", giterr_last()->message);
+ cl_assert_equal_i(99, git_error_last()->klass);
+ cl_assert_equal_s("Bar: foo", git_error_last()->message);
- giterr_state_restore(&err_state);
+ git_error_state_restore(&err_state);
- cl_assert(giterr_last() == NULL);
+ cl_assert(git_error_last() == NULL);
}
void test_core_errors__restore_oom(void)
@@ -136,30 +136,30 @@ void test_core_errors__restore_oom(void)
git_error_state err_state = {0};
const git_error *oom_error = NULL;
- giterr_clear();
+ git_error_clear();
- giterr_set_oom(); /* internal fn */
- oom_error = giterr_last();
+ git_error_set_oom(); /* internal fn */
+ oom_error = git_error_last();
cl_assert(oom_error);
- cl_assert_equal_i(-1, giterr_state_capture(&err_state, -1));
+ cl_assert_equal_i(-1, git_error_state_capture(&err_state, -1));
- cl_assert(giterr_last() == NULL);
- cl_assert_equal_i(GITERR_NOMEMORY, err_state.error_msg.klass);
+ cl_assert(git_error_last() == NULL);
+ cl_assert_equal_i(GIT_ERROR_NOMEMORY, err_state.error_msg.klass);
cl_assert_equal_s("Out of memory", err_state.error_msg.message);
- giterr_state_restore(&err_state);
+ git_error_state_restore(&err_state);
- cl_assert(giterr_last()->klass == GITERR_NOMEMORY);
- cl_assert_(giterr_last() == oom_error, "static oom error not restored");
+ cl_assert(git_error_last()->klass == GIT_ERROR_NOMEMORY);
+ cl_assert_(git_error_last() == oom_error, "static oom error not restored");
- giterr_clear();
+ git_error_clear();
}
static int test_arraysize_multiply(size_t nelem, size_t size)
{
size_t out;
- GITERR_CHECK_ALLOC_MULTIPLY(&out, nelem, size);
+ GIT_ERROR_CHECK_ALLOC_MULTIPLY(&out, nelem, size);
return 0;
}
@@ -174,14 +174,14 @@ void test_core_errors__integer_overflow_alloc_multiply(void)
cl_git_fail(test_arraysize_multiply(SIZE_MAX-1, sizeof(void *)));
cl_git_fail(test_arraysize_multiply((SIZE_MAX/sizeof(void *))+1, sizeof(void *)));
- cl_assert_equal_i(GITERR_NOMEMORY, giterr_last()->klass);
- cl_assert_equal_s("Out of memory", giterr_last()->message);
+ cl_assert_equal_i(GIT_ERROR_NOMEMORY, git_error_last()->klass);
+ cl_assert_equal_s("Out of memory", git_error_last()->message);
}
static int test_arraysize_add(size_t one, size_t two)
{
size_t out;
- GITERR_CHECK_ALLOC_ADD(&out, one, two);
+ GIT_ERROR_CHECK_ALLOC_ADD(&out, one, two);
return 0;
}
@@ -194,29 +194,29 @@ void test_core_errors__integer_overflow_alloc_add(void)
cl_git_fail(test_arraysize_multiply(SIZE_MAX-1, 2));
cl_git_fail(test_arraysize_multiply(SIZE_MAX, SIZE_MAX));
- cl_assert_equal_i(GITERR_NOMEMORY, giterr_last()->klass);
- cl_assert_equal_s("Out of memory", giterr_last()->message);
+ cl_assert_equal_i(GIT_ERROR_NOMEMORY, git_error_last()->klass);
+ cl_assert_equal_s("Out of memory", git_error_last()->message);
}
void test_core_errors__integer_overflow_sets_oom(void)
{
size_t out;
- giterr_clear();
+ git_error_clear();
cl_assert(!GIT_ADD_SIZET_OVERFLOW(&out, SIZE_MAX-1, 1));
- cl_assert_equal_p(NULL, giterr_last());
+ cl_assert_equal_p(NULL, git_error_last());
- giterr_clear();
+ git_error_clear();
cl_assert(!GIT_ADD_SIZET_OVERFLOW(&out, 42, 69));
- cl_assert_equal_p(NULL, giterr_last());
+ cl_assert_equal_p(NULL, git_error_last());
- giterr_clear();
+ git_error_clear();
cl_assert(GIT_ADD_SIZET_OVERFLOW(&out, SIZE_MAX, SIZE_MAX));
- cl_assert_equal_i(GITERR_NOMEMORY, giterr_last()->klass);
- cl_assert_equal_s("Out of memory", giterr_last()->message);
+ cl_assert_equal_i(GIT_ERROR_NOMEMORY, git_error_last()->klass);
+ cl_assert_equal_s("Out of memory", git_error_last()->message);
- giterr_clear();
+ git_error_clear();
cl_assert(GIT_ADD_SIZET_OVERFLOW(&out, SIZE_MAX, SIZE_MAX));
- cl_assert_equal_i(GITERR_NOMEMORY, giterr_last()->klass);
- cl_assert_equal_s("Out of memory", giterr_last()->message);
+ cl_assert_equal_i(GIT_ERROR_NOMEMORY, git_error_last()->klass);
+ cl_assert_equal_s("Out of memory", git_error_last()->message);
}
diff --git a/tests/core/sha1.c b/tests/core/sha1.c
index c5b20f6..f81d408 100644
--- a/tests/core/sha1.c
+++ b/tests/core/sha1.c
@@ -54,7 +54,7 @@ void test_core_sha1__detect_collision_attack(void)
#ifdef GIT_SHA1_COLLISIONDETECT
GIT_UNUSED(expected);
cl_git_fail(sha1_file(&oid, FIXTURE_DIR "/shattered-1.pdf"));
- cl_assert_equal_s("SHA1 collision attack detected", giterr_last()->message);
+ cl_assert_equal_s("SHA1 collision attack detected", git_error_last()->message);
#else
cl_git_pass(sha1_file(&oid, FIXTURE_DIR "/shattered-1.pdf"));
git_oid_fromstr(&expected, "38762cf7f55934b34d179ae6a4c80cadccbb7f0a");
diff --git a/tests/core/strtol.c b/tests/core/strtol.c
index 6f4e63a..25dbe46 100644
--- a/tests/core/strtol.c
+++ b/tests/core/strtol.c
@@ -121,6 +121,6 @@ void test_core_strtol__buffer_length_with_leading_sign_truncates(void)
void test_core_strtol__error_message_cuts_off(void)
{
assert_l32_fails("2147483657foobar", 10);
- cl_assert(strstr(giterr_last()->message, "2147483657") != NULL);
- cl_assert(strstr(giterr_last()->message, "foobar") == NULL);
+ cl_assert(strstr(git_error_last()->message, "2147483657") != NULL);
+ cl_assert(strstr(git_error_last()->message, "foobar") == NULL);
}
diff --git a/tests/diff/blob.c b/tests/diff/blob.c
index a876a97..37898ad 100644
--- a/tests/diff/blob.c
+++ b/tests/diff/blob.c
@@ -582,8 +582,8 @@ void test_diff_blob__checks_options_version_too_low(void)
cl_git_fail(git_diff_blobs(
d, NULL, alien, NULL, &opts,
diff_file_cb, diff_binary_cb, diff_hunk_cb, diff_line_cb, &expected));
- err = giterr_last();
- cl_assert_equal_i(GITERR_INVALID, err->klass);
+ err = git_error_last();
+ cl_assert_equal_i(GIT_ERROR_INVALID, err->klass);
}
void test_diff_blob__checks_options_version_too_high(void)
@@ -594,8 +594,8 @@ void test_diff_blob__checks_options_version_too_high(void)
cl_git_fail(git_diff_blobs(
d, NULL, alien, NULL, &opts,
diff_file_cb, diff_binary_cb, diff_hunk_cb, diff_line_cb, &expected));
- err = giterr_last();
- cl_assert_equal_i(GITERR_INVALID, err->klass);
+ err = git_error_last();
+ cl_assert_equal_i(GIT_ERROR_INVALID, err->klass);
}
void test_diff_blob__can_correctly_detect_a_binary_blob_as_binary(void)
diff --git a/tests/diff/diff_helpers.c b/tests/diff/diff_helpers.c
index fdedd89..e990033 100644
--- a/tests/diff/diff_helpers.c
+++ b/tests/diff/diff_helpers.c
@@ -224,7 +224,7 @@ int diff_foreach_via_iterator(
return 0;
abort:
- giterr_clear();
+ git_error_clear();
return GIT_EUSER;
}
diff --git a/tests/diff/diffiter.c b/tests/diff/diffiter.c
index 432201b..991c73b 100644
--- a/tests/diff/diffiter.c
+++ b/tests/diff/diffiter.c
@@ -441,13 +441,13 @@ void test_diff_diffiter__checks_options_version(void)
opts.flags |= GIT_DIFF_INCLUDE_IGNORED | GIT_DIFF_INCLUDE_UNTRACKED;
cl_git_fail(git_diff_index_to_workdir(&diff, repo, NULL, &opts));
- err = giterr_last();
- cl_assert_equal_i(GITERR_INVALID, err->klass);
+ err = git_error_last();
+ cl_assert_equal_i(GIT_ERROR_INVALID, err->klass);
- giterr_clear();
+ git_error_clear();
opts.version = 1024;
cl_git_fail(git_diff_index_to_workdir(&diff, repo, NULL, &opts));
- err = giterr_last();
- cl_assert_equal_i(GITERR_INVALID, err->klass);
+ err = git_error_last();
+ cl_assert_equal_i(GIT_ERROR_INVALID, err->klass);
}
diff --git a/tests/diff/index.c b/tests/diff/index.c
index 0293b78..b616a37 100644
--- a/tests/diff/index.c
+++ b/tests/diff/index.c
@@ -149,15 +149,15 @@ void test_diff_index__checks_options_version(void)
opts.version = 0;
cl_git_fail(git_diff_tree_to_index(&diff, g_repo, a, NULL, &opts));
- err = giterr_last();
- cl_assert_equal_i(GITERR_INVALID, err->klass);
+ err = git_error_last();
+ cl_assert_equal_i(GIT_ERROR_INVALID, err->klass);
cl_assert_equal_p(diff, NULL);
- giterr_clear();
+ git_error_clear();
opts.version = 1024;
cl_git_fail(git_diff_tree_to_index(&diff, g_repo, a, NULL, &opts));
- err = giterr_last();
- cl_assert_equal_i(GITERR_INVALID, err->klass);
+ err = git_error_last();
+ cl_assert_equal_i(GIT_ERROR_INVALID, err->klass);
cl_assert_equal_p(diff, NULL);
git_tree_free(a);
diff --git a/tests/diff/rename.c b/tests/diff/rename.c
index 2166ea5..df32eeb 100644
--- a/tests/diff/rename.c
+++ b/tests/diff/rename.c
@@ -172,14 +172,14 @@ void test_diff_rename__checks_options_version(void)
opts.version = 0;
cl_git_fail(git_diff_find_similar(diff, &opts));
- err = giterr_last();
- cl_assert_equal_i(GITERR_INVALID, err->klass);
+ err = git_error_last();
+ cl_assert_equal_i(GIT_ERROR_INVALID, err->klass);
- giterr_clear();
+ git_error_clear();
opts.version = 1024;
cl_git_fail(git_diff_find_similar(diff, &opts));
- err = giterr_last();
- cl_assert_equal_i(GITERR_INVALID, err->klass);
+ err = git_error_last();
+ cl_assert_equal_i(GIT_ERROR_INVALID, err->klass);
git_diff_free(diff);
git_tree_free(old_tree);
diff --git a/tests/diff/tree.c b/tests/diff/tree.c
index e4b2a8b..a3b00ec 100644
--- a/tests/diff/tree.c
+++ b/tests/diff/tree.c
@@ -311,13 +311,13 @@ void test_diff_tree__checks_options_version(void)
opts.version = 0;
cl_git_fail(git_diff_tree_to_tree(&diff, g_repo, a, b, &opts));
- err = giterr_last();
- cl_assert_equal_i(GITERR_INVALID, err->klass);
+ err = git_error_last();
+ cl_assert_equal_i(GIT_ERROR_INVALID, err->klass);
- giterr_clear();
+ git_error_clear();
opts.version = 1024;
cl_git_fail(git_diff_tree_to_tree(&diff, g_repo, a, b, &opts));
- err = giterr_last();
+ err = git_error_last();
}
void process_tree_to_tree_diffing(
diff --git a/tests/diff/workdir.c b/tests/diff/workdir.c
index f42121f..7a045b4 100644
--- a/tests/diff/workdir.c
+++ b/tests/diff/workdir.c
@@ -1221,14 +1221,14 @@ void test_diff_workdir__checks_options_version(void)
opts.version = 0;
cl_git_fail(git_diff_tree_to_workdir(&diff, g_repo, NULL, &opts));
- err = giterr_last();
- cl_assert_equal_i(GITERR_INVALID, err->klass);
+ err = git_error_last();
+ cl_assert_equal_i(GIT_ERROR_INVALID, err->klass);
- giterr_clear();
+ git_error_clear();
opts.version = 1024;
cl_git_fail(git_diff_tree_to_workdir(&diff, g_repo, NULL, &opts));
- err = giterr_last();
- cl_assert_equal_i(GITERR_INVALID, err->klass);
+ err = git_error_last();
+ cl_assert_equal_i(GIT_ERROR_INVALID, err->klass);
}
void test_diff_workdir__can_diff_empty_file(void)
diff --git a/tests/fetchhead/nonetwork.c b/tests/fetchhead/nonetwork.c
index 6ea48a5..6589432 100644
--- a/tests/fetchhead/nonetwork.c
+++ b/tests/fetchhead/nonetwork.c
@@ -293,7 +293,7 @@ void test_fetchhead_nonetwork__invalid_for_merge(void)
cl_git_rewritefile("./test1/.git/FETCH_HEAD", "49322bb17d3acc9146f98c97d078513228bbf3c0\tinvalid-merge\t\n");
cl_git_fail(git_repository_fetchhead_foreach(g_repo, read_noop, NULL));
- cl_assert(git__prefixcmp(giterr_last()->message, "invalid for-merge") == 0);
+ cl_assert(git__prefixcmp(git_error_last()->message, "invalid for-merge") == 0);
}
void test_fetchhead_nonetwork__invalid_description(void)
@@ -304,7 +304,7 @@ void test_fetchhead_nonetwork__invalid_description(void)
cl_git_rewritefile("./test1/.git/FETCH_HEAD", "49322bb17d3acc9146f98c97d078513228bbf3c0\tnot-for-merge\n");
cl_git_fail(git_repository_fetchhead_foreach(g_repo, read_noop, NULL));
- cl_assert(git__prefixcmp(giterr_last()->message, "invalid description") == 0);
+ cl_assert(git__prefixcmp(git_error_last()->message, "invalid description") == 0);
}
static int assert_master_for_merge(const char *ref, const char *url, const git_oid *id, unsigned int is_merge, void *data)
diff --git a/tests/filter/crlf.c b/tests/filter/crlf.c
index a986462..a266005 100644
--- a/tests/filter/crlf.c
+++ b/tests/filter/crlf.c
@@ -97,14 +97,14 @@ void test_filter_crlf__with_safecrlf(void)
in.size = strlen(in.ptr);
cl_git_fail(git_filter_list_apply_to_data(&out, fl, &in));
- cl_assert_equal_i(giterr_last()->klass, GITERR_FILTER);
+ cl_assert_equal_i(git_error_last()->klass, GIT_ERROR_FILTER);
/* Normalized \n fails for autocrlf=true when safecrlf=true */
in.ptr = "Normal\nLF\nonly\nline-endings.\n";
in.size = strlen(in.ptr);
cl_git_fail(git_filter_list_apply_to_data(&out, fl, &in));
- cl_assert_equal_i(giterr_last()->klass, GITERR_FILTER);
+ cl_assert_equal_i(git_error_last()->klass, GIT_ERROR_FILTER);
/* String with \r but without \r\n does not fail with safecrlf */
in.ptr = "Normal\nCR only\rand some more\nline-endings.\n";
diff --git a/tests/filter/wildcard.c b/tests/filter/wildcard.c
index ffa9531..3c25ea2 100644
--- a/tests/filter/wildcard.c
+++ b/tests/filter/wildcard.c
@@ -69,7 +69,7 @@ static int wildcard_filter_check(
if (strcmp(attr_values[0], "wcflip") == 0 ||
strcmp(attr_values[0], "wcreverse") == 0) {
*payload = git__strdup(attr_values[0]);
- GITERR_CHECK_ALLOC(*payload);
+ GIT_ERROR_CHECK_ALLOC(*payload);
return 0;
}
diff --git a/tests/index/crlf.c b/tests/index/crlf.c
index d90ea58..7aa6be4 100644
--- a/tests/index/crlf.c
+++ b/tests/index/crlf.c
@@ -82,8 +82,8 @@ static int add_and_check_file(void *payload, git_buf *actual_path)
git_buf_rtrim(&expected_contents);
if (git_index_add_bypath(g_index, basename) == 0 ||
- giterr_last()->klass != GITERR_FILTER ||
- strcmp(expected_contents.ptr, giterr_last()->message) != 0)
+ git_error_last()->klass != GIT_ERROR_FILTER ||
+ strcmp(expected_contents.ptr, git_error_last()->message) != 0)
goto done;
} else {
cl_fail("unexpected index failure");
diff --git a/tests/index/tests.c b/tests/index/tests.c
index 49ef8b2..7c29ef3 100644
--- a/tests/index/tests.c
+++ b/tests/index/tests.c
@@ -849,8 +849,8 @@ void test_index_tests__elocked(void)
error = git_index_write(index);
cl_assert_equal_i(GIT_ELOCKED, error);
- err = giterr_last();
- cl_assert_equal_i(err->klass, GITERR_INDEX);
+ err = git_error_last();
+ cl_assert_equal_i(err->klass, GIT_ERROR_INDEX);
git_filebuf_cleanup(&file);
git_index_free(index);
diff --git a/tests/network/remote/remotes.c b/tests/network/remote/remotes.c
index ff11a3e..1051795 100644
--- a/tests/network/remote/remotes.c
+++ b/tests/network/remote/remotes.c
@@ -73,8 +73,8 @@ void test_network_remote_remotes__error_when_not_found(void)
git_remote *r;
cl_git_fail_with(git_remote_lookup(&r, _repo, "does-not-exist"), GIT_ENOTFOUND);
- cl_assert(giterr_last() != NULL);
- cl_assert(giterr_last()->klass == GITERR_CONFIG);
+ cl_assert(git_error_last() != NULL);
+ cl_assert(git_error_last()->klass == GIT_ERROR_CONFIG);
}
void test_network_remote_remotes__error_when_no_push_available(void)
@@ -337,8 +337,8 @@ void test_network_remote_remotes__can_load_with_an_empty_url(void)
cl_git_fail(git_remote_connect(remote, GIT_DIRECTION_FETCH, NULL, NULL, NULL));
- cl_assert(giterr_last() != NULL);
- cl_assert(giterr_last()->klass == GITERR_INVALID);
+ cl_assert(git_error_last() != NULL);
+ cl_assert(git_error_last()->klass == GIT_ERROR_INVALID);
git_remote_free(remote);
}
diff --git a/tests/object/tag/parse.c b/tests/object/tag/parse.c
index 22535a0..2c0635a 100644
--- a/tests/object/tag/parse.c
+++ b/tests/object/tag/parse.c
@@ -214,5 +214,5 @@ void test_object_tag_parse__no_oob_read_when_searching_message(void)
* expected one.
*/
assert_tag_fails(tag, strlen(tag) - strlen("\n\nMessage"));
- cl_assert(strstr(giterr_last()->message, "tag contains no message"));
+ cl_assert(strstr(git_error_last()->message, "tag contains no message"));
}
diff --git a/tests/object/tree/parse.c b/tests/object/tree/parse.c
index 1ab01c8..9d76a74 100644
--- a/tests/object/tree/parse.c
+++ b/tests/object/tree/parse.c
@@ -118,7 +118,7 @@ void test_object_tree_parse__mode_doesnt_cause_oob_read(void)
* later fail to parse the OID with a different error
* message
*/
- cl_assert_equal_s(giterr_last()->message, "failed to parse tree: missing space after filemode");
+ cl_assert_equal_s(git_error_last()->message, "failed to parse tree: missing space after filemode");
}
void test_object_tree_parse__unreasonably_large_mode_fails(void)
diff --git a/tests/object/tree/write.c b/tests/object/tree/write.c
index 8df6938..9efeeb9 100644
--- a/tests/object/tree/write.c
+++ b/tests/object/tree/write.c
@@ -520,7 +520,7 @@ void test_object_tree_write__invalid_null_oid(void)
cl_git_pass(git_treebuilder_new(&bld, g_repo, NULL));
cl_git_fail(git_treebuilder_insert(NULL, bld, "null_oid_file", &null_oid, GIT_FILEMODE_BLOB));
- cl_assert(giterr_last() && strstr(giterr_last()->message, "null OID") != NULL);
+ cl_assert(git_error_last() && strstr(git_error_last()->message, "null OID") != NULL);
git_treebuilder_free(bld);
}
diff --git a/tests/odb/backend/backend_helpers.c b/tests/odb/backend/backend_helpers.c
index c0f4103..139d2fc 100644
--- a/tests/odb/backend/backend_helpers.c
+++ b/tests/odb/backend/backend_helpers.c
@@ -139,7 +139,7 @@ int build_fake_backend(
fake_backend *backend;
backend = git__calloc(1, sizeof(fake_backend));
- GITERR_CHECK_ALLOC(backend);
+ GIT_ERROR_CHECK_ALLOC(backend);
backend->parent.version = GIT_ODB_BACKEND_VERSION;
diff --git a/tests/odb/backend/nobackend.c b/tests/odb/backend/nobackend.c
index cd727b7..7484d42 100644
--- a/tests/odb/backend/nobackend.c
+++ b/tests/odb/backend/nobackend.c
@@ -39,7 +39,7 @@ void test_odb_backend_nobackend__write_fails_gracefully(void)
git_repository_odb(&odb, _repo);
cl_git_fail(git_odb_write(&id, odb, "Hello world!\n", 13, GIT_OBJECT_BLOB));
- err = giterr_last();
+ err = git_error_last();
cl_assert_equal_s(err->message, "cannot write object - unsupported in the loaded odb backends");
git_odb_free(odb);
diff --git a/tests/odb/backend/simple.c b/tests/odb/backend/simple.c
index f4d29cc..484dcba 100644
--- a/tests/odb/backend/simple.c
+++ b/tests/odb/backend/simple.c
@@ -246,5 +246,5 @@ void test_odb_backend_simple__null_oid_is_ignored(void)
cl_assert(!git_odb_exists(_odb, &null_oid));
cl_git_fail_with(GIT_ENOTFOUND, git_odb_read(&obj, _odb, &null_oid));
- cl_assert(giterr_last() && strstr(giterr_last()->message, "null OID"));
+ cl_assert(git_error_last() && strstr(git_error_last()->message, "null OID"));
}
diff --git a/tests/online/clone.c b/tests/online/clone.c
index 3f12a02..6fdbbbd 100644
--- a/tests/online/clone.c
+++ b/tests/online/clone.c
@@ -472,7 +472,7 @@ static int cred_cb(git_cred **cred, const char *url, const char *user_from_url,
_remote_user, _remote_ssh_pubkey,
_remote_ssh_privkey, _remote_ssh_passphrase);
- giterr_set(GITERR_NET, "unexpected cred type");
+ git_error_set(GIT_ERROR_NET, "unexpected cred type");
return -1;
}
@@ -665,7 +665,7 @@ static int ssh_memory_cred_cb(git_cred **cred, const char *url, const char *user
return ret;
}
- giterr_set(GITERR_NET, "unexpected cred type");
+ git_error_set(GIT_ERROR_NET, "unexpected cred type");
return -1;
}
diff --git a/tests/pack/indexer.c b/tests/pack/indexer.c
index 7b1daa9..3c4e1c1 100644
--- a/tests/pack/indexer.c
+++ b/tests/pack/indexer.c
@@ -122,8 +122,8 @@ void test_pack_indexer__missing_trailer(void)
idx, missing_trailer_pack, missing_trailer_pack_len, &stats));
cl_git_fail(git_indexer_commit(idx, &stats));
- cl_assert(giterr_last() != NULL);
- cl_assert_equal_i(giterr_last()->klass, GITERR_INDEXER);
+ cl_assert(git_error_last() != NULL);
+ cl_assert_equal_i(git_error_last()->klass, GIT_ERROR_INDEXER);
git_indexer_free(idx);
}
@@ -138,8 +138,8 @@ void test_pack_indexer__leaky(void)
idx, leaky_pack, leaky_pack_len, &stats));
cl_git_fail(git_indexer_commit(idx, &stats));
- cl_assert(giterr_last() != NULL);
- cl_assert_equal_i(giterr_last()->klass, GITERR_INDEXER);
+ cl_assert(git_error_last() != NULL);
+ cl_assert_equal_i(git_error_last()->klass, GIT_ERROR_INDEXER);
git_indexer_free(idx);
}
@@ -231,8 +231,8 @@ void test_pack_indexer__corrupt_length(void)
idx, corrupt_thin_pack, corrupt_thin_pack_len, &stats));
cl_git_fail(git_indexer_commit(idx, &stats));
- cl_assert(giterr_last() != NULL);
- cl_assert_equal_i(giterr_last()->klass, GITERR_ZLIB);
+ cl_assert(git_error_last() != NULL);
+ cl_assert_equal_i(git_error_last()->klass, GIT_ERROR_ZLIB);
git_indexer_free(idx);
git_odb_free(odb);
diff --git a/tests/refs/branches/move.c b/tests/refs/branches/move.c
index acd8661..2cba9df 100644
--- a/tests/refs/branches/move.c
+++ b/tests/refs/branches/move.c
@@ -84,7 +84,7 @@ void test_refs_branches_move__can_not_move_a_branch_if_its_destination_name_coll
cl_assert_equal_i(GIT_EEXISTS,
git_branch_move(&new_ref, original_ref, "master", 0));
- cl_assert(giterr_last()->message != NULL);
+ cl_assert(git_error_last()->message != NULL);
cl_git_pass(git_repository_config_snapshot(&config, repo));
cl_git_pass(git_config_get_string(&str, config, "branch.master.remote"));
@@ -96,7 +96,7 @@ void test_refs_branches_move__can_not_move_a_branch_if_its_destination_name_coll
cl_assert_equal_i(GIT_EEXISTS,
git_branch_move(&new_ref, original_ref, "cannot-fetch", 0));
- cl_assert(giterr_last()->message != NULL);
+ cl_assert(git_error_last()->message != NULL);
cl_git_pass(git_repository_config_snapshot(&config, repo));
cl_git_pass(git_config_get_string(&str, config, "branch.master.remote"));
@@ -111,7 +111,7 @@ void test_refs_branches_move__can_not_move_a_branch_if_its_destination_name_coll
cl_assert_equal_i(GIT_EEXISTS,
git_branch_move(&new_ref, original_ref, "master", 0));
- cl_assert(giterr_last()->message != NULL);
+ cl_assert(git_error_last()->message != NULL);
cl_git_pass(git_repository_config_snapshot(&config, repo));
cl_git_pass(git_config_get_string(&str, config, "branch.master.remote"));
diff --git a/tests/refs/branches/remote.c b/tests/refs/branches/remote.c
index ac428ab..27a3b0c 100644
--- a/tests/refs/branches/remote.c
+++ b/tests/refs/branches/remote.c
@@ -34,10 +34,10 @@ void test_refs_branches_remote__no_matching_remote_returns_error(void)
const char *unknown = "refs/remotes/nonexistent/master";
git_buf buf;
- giterr_clear();
+ git_error_clear();
memset(&buf, 0, sizeof(git_buf));
cl_git_fail_with(git_branch_remote_name(&buf, g_repo, unknown), GIT_ENOTFOUND);
- cl_assert(giterr_last() != NULL);
+ cl_assert(git_error_last() != NULL);
}
void test_refs_branches_remote__local_remote_returns_error(void)
@@ -45,10 +45,10 @@ void test_refs_branches_remote__local_remote_returns_error(void)
const char *local = "refs/heads/master";
git_buf buf;
- giterr_clear();
+ git_error_clear();
memset(&buf, 0, sizeof(git_buf));
cl_git_fail_with(git_branch_remote_name(&buf, g_repo, local), GIT_ERROR);
- cl_assert(giterr_last() != NULL);
+ cl_assert(git_error_last() != NULL);
}
void test_refs_branches_remote__ambiguous_remote_returns_error(void)
@@ -61,8 +61,8 @@ void test_refs_branches_remote__ambiguous_remote_returns_error(void)
git_remote_free(remote);
- giterr_clear();
+ git_error_clear();
memset(&buf, 0, sizeof(git_buf));
cl_git_fail_with(git_branch_remote_name(&buf, g_repo, remote_tracking_branch_name), GIT_EAMBIGUOUS);
- cl_assert(giterr_last() != NULL);
+ cl_assert(git_error_last() != NULL);
}
diff --git a/tests/refs/branches/upstream.c b/tests/refs/branches/upstream.c
index 176f2a5..928a9ff 100644
--- a/tests/refs/branches/upstream.c
+++ b/tests/refs/branches/upstream.c
@@ -176,7 +176,7 @@ void test_refs_branches_upstream__no_fetch_refspec(void)
cl_git_pass(git_reference_create(&ref, repo, "refs/remotes/matching/master", git_reference_target(branch), 1, "fetch"));
cl_git_fail(git_branch_set_upstream(branch, "matching/master"));
cl_assert_equal_s("could not determine remote for 'refs/remotes/matching/master'",
- giterr_last()->message);
+ git_error_last()->message);
/* we can't set it automatically, so let's test the user setting it by hand */
cl_git_pass(git_repository_config(&cfg, repo));
diff --git a/tests/refs/lookup.c b/tests/refs/lookup.c
index 456d0d2..01e956d 100644
--- a/tests/refs/lookup.c
+++ b/tests/refs/lookup.c
@@ -64,5 +64,5 @@ void test_refs_lookup__dwim_notfound(void)
git_reference *ref;
cl_git_fail_with(GIT_ENOTFOUND, git_reference_dwim(&ref, g_repo, "idontexist"));
- cl_assert_equal_s("no reference found for shorthand 'idontexist'", giterr_last()->message);
+ cl_assert_equal_s("no reference found for shorthand 'idontexist'", git_error_last()->message);
}
diff --git a/tests/refs/reflog/reflog.c b/tests/refs/reflog/reflog.c
index 3a6c97c..cf8c5c2 100644
--- a/tests/refs/reflog/reflog.c
+++ b/tests/refs/reflog/reflog.c
@@ -253,11 +253,11 @@ void test_refs_reflog_reflog__reading_a_reflog_with_invalid_format_returns_error
cl_assert(strstr(git_buf_cstr(&logcontents), "Reflog\nmessage") != NULL);
/* clear the error state so we can capture the error generated by git_reflog_read */
- giterr_clear();
+ git_error_clear();
cl_git_fail(git_reflog_read(&reflog, g_repo, refname));
- error = giterr_last();
+ error = git_error_last();
cl_assert(error != NULL);
cl_assert_equal_s("unable to parse OID - contains invalid characters", error->message);
diff --git a/tests/repo/shallow.c b/tests/repo/shallow.c
index 5aeaf2d..b9a7b81 100644
--- a/tests/repo/shallow.c
+++ b/tests/repo/shallow.c
@@ -35,5 +35,5 @@ void test_repo_shallow__clears_errors(void)
{
g_repo = cl_git_sandbox_init("testrepo.git");
cl_assert_equal_i(0, git_repository_is_shallow(g_repo));
- cl_assert_equal_p(NULL, giterr_last());
+ cl_assert_equal_p(NULL, git_error_last());
}
diff --git a/tests/threads/basic.c b/tests/threads/basic.c
index 9ce740c..ed4fd2f 100644
--- a/tests/threads/basic.c
+++ b/tests/threads/basic.c
@@ -38,7 +38,7 @@ void test_threads_basic__multiple_init(void)
static void *set_error(void *dummy)
{
- giterr_set(GITERR_INVALID, "oh no, something happened!\n");
+ git_error_set(GIT_ERROR_INVALID, "oh no, something happened!\n");
return dummy;
}
diff --git a/tests/threads/diff.c b/tests/threads/diff.c
index ab34b32..6996427 100644
--- a/tests/threads/diff.c
+++ b/tests/threads/diff.c
@@ -136,7 +136,7 @@ static void *run_index_diffs(void *arg)
git_diff_free(diff);
git_repository_free(repo);
- giterr_clear();
+ git_error_clear();
return arg;
}
@@ -203,7 +203,7 @@ static void *run_index_diffs_with_modifier(void *arg)
done:
git_index_free(idx);
git_repository_free(repo);
- giterr_clear();
+ git_error_clear();
return arg;
}
diff --git a/tests/threads/iterator.c b/tests/threads/iterator.c
index d93c891..33d1bda 100644
--- a/tests/threads/iterator.c
+++ b/tests/threads/iterator.c
@@ -41,7 +41,7 @@ static void *run_workdir_iterator(void *arg)
git_iterator_free(iter);
git_repository_free(repo);
- giterr_clear();
+ git_error_clear();
return arg;
}
diff --git a/tests/threads/refdb.c b/tests/threads/refdb.c
index 94c5f50..a4630df 100644
--- a/tests/threads/refdb.c
+++ b/tests/threads/refdb.c
@@ -58,7 +58,7 @@ static void *iterate_refs(void *arg)
git_reference_iterator_free(i);
git_repository_free(repo);
- giterr_clear();
+ git_error_clear();
return arg;
}
@@ -101,7 +101,7 @@ static void *create_refs(void *arg)
git_repository_free(repo);
- giterr_clear();
+ git_error_clear();
return arg;
}
@@ -143,7 +143,7 @@ static void *delete_refs(void *arg)
}
git_repository_free(repo);
- giterr_clear();
+ git_error_clear();
return arg;
}
diff --git a/tests/valgrind-supp-mac.txt b/tests/valgrind-supp-mac.txt
index 0cdc975..a104199 100644
--- a/tests/valgrind-supp-mac.txt
+++ b/tests/valgrind-supp-mac.txt
@@ -1,12 +1,12 @@
{
- libgit2-giterr-set-buffer
+ libgit2-git-error-set-buffer
Memcheck:Leak
...
fun:git__realloc
fun:git_buf_try_grow
fun:git_buf_grow
fun:git_buf_vprintf
- fun:giterr_set
+ fun:git_error_set
}
{
mac-setenv-leak-1
diff --git a/tests/win32/longpath.c b/tests/win32/longpath.c
index f5a9534..bf5aac7 100644
--- a/tests/win32/longpath.c
+++ b/tests/win32/longpath.c
@@ -38,7 +38,7 @@ void assert_name_too_long(void)
size_t expected_len, actual_len;
char *expected_msg;
- err = giterr_last();
+ err = git_error_last();
actual_len = strlen(err->message);
expected_msg = git_win32_get_error_message(ERROR_FILENAME_EXCED_RANGE);