Rename ref and reflog apis for consistency
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
diff --git a/include/git2/pack.h b/include/git2/pack.h
index 94d5fc6..585cffe 100644
--- a/include/git2/pack.h
+++ b/include/git2/pack.h
@@ -38,8 +38,9 @@ GIT_EXTERN(int) git_packbuilder_new(git_packbuilder **out, git_repository *repo)
*
* @param pb The packbuilder
* @param n Number of threads to spawn
+ * @return number of actual threads to be used
*/
-GIT_EXTERN(void) git_packbuilder_set_threads(git_packbuilder *pb, unsigned int n);
+GIT_EXTERN(unsigned int) git_packbuilder_set_threads(git_packbuilder *pb, unsigned int n);
/**
* Insert a single object
@@ -48,12 +49,12 @@ GIT_EXTERN(void) git_packbuilder_set_threads(git_packbuilder *pb, unsigned int n
* commits followed by trees and blobs.
*
* @param pb The packbuilder
- * @param oid The oid of the commit
- * @param oid The name; might be NULL
+ * @param id The oid of the commit
+ * @param name The name; might be NULL
*
* @return 0 or an error code
*/
-GIT_EXTERN(int) git_packbuilder_insert(git_packbuilder *pb, const git_oid *oid, const char *name);
+GIT_EXTERN(int) git_packbuilder_insert(git_packbuilder *pb, const git_oid *id, const char *name);
/**
* Insert a root tree object
@@ -61,11 +62,11 @@ GIT_EXTERN(int) git_packbuilder_insert(git_packbuilder *pb, const git_oid *oid,
* This will add the tree as well as all referenced trees and blobs.
*
* @param pb The packbuilder
- * @param oid The oid of the root tree
+ * @param id The oid of the root tree
*
* @return 0 or an error code
*/
-GIT_EXTERN(int) git_packbuilder_insert_tree(git_packbuilder *pb, const git_oid *oid);
+GIT_EXTERN(int) git_packbuilder_insert_tree(git_packbuilder *pb, const git_oid *id);
/**
* Write the new pack and the corresponding index to path
@@ -82,15 +83,17 @@ GIT_EXTERN(int) git_packbuilder_write(git_packbuilder *pb, const char *file);
*
* @param pb the packbuilder
* @param cb the callback to call with each packed object's buffer
- * @param data the callback's data
+ * @param payload the callback's data
* @return 0 or an error code
*/
-GIT_EXTERN(int) git_packbuilder_foreach(git_packbuilder *pb, int (*cb)(void *buf, size_t size, void *data), void *data);
+typedef int (*git_packbuilder_foreach_cb)(void *buf, size_t size, void *payload);
+GIT_EXTERN(int) git_packbuilder_foreach(git_packbuilder *pb, git_packbuilder_foreach_cb cb, void *payload);
/**
* Get the total number of objects the packbuilder will write out
*
* @param pb the packbuilder
+ * @return
*/
GIT_EXTERN(uint32_t) git_packbuilder_object_count(git_packbuilder *pb);
@@ -98,6 +101,7 @@ GIT_EXTERN(uint32_t) git_packbuilder_object_count(git_packbuilder *pb);
* Get the number of objects the packbuilder has already written out
*
* @param pb the packbuilder
+ * @return
*/
GIT_EXTERN(uint32_t) git_packbuilder_written(git_packbuilder *pb);
diff --git a/include/git2/reflog.h b/include/git2/reflog.h
index 72e1f17..45dff21 100644
--- a/include/git2/reflog.h
+++ b/include/git2/reflog.h
@@ -30,11 +30,11 @@ GIT_BEGIN_DECL
* The reflog must be freed manually by using
* git_reflog_free().
*
- * @param reflog pointer to reflog
+ * @param out pointer to reflog
* @param ref reference to read the reflog for
* @return 0 or an error code
*/
-GIT_EXTERN(int) git_reflog_read(git_reflog **reflog, git_reference *ref);
+GIT_EXTERN(int) git_reflog_read(git_reflog **out, const git_reference *ref);
/**
* Write an existing in-memory reflog object back to disk
@@ -51,12 +51,12 @@ GIT_EXTERN(int) git_reflog_write(git_reflog *reflog);
* `msg` is optional and can be NULL.
*
* @param reflog an existing reflog object
- * @param new_oid the OID the reference is now pointing to
+ * @param id the OID the reference is now pointing to
* @param committer the signature of the committer
* @param msg the reflog message
* @return 0 or an error code
*/
-GIT_EXTERN(int) git_reflog_append(git_reflog *reflog, const git_oid *new_oid, const git_signature *committer, const char *msg);
+GIT_EXTERN(int) git_reflog_append(git_reflog *reflog, const git_oid *id, const git_signature *committer, const char *msg);
/**
* Rename the reflog for the given reference
@@ -64,10 +64,10 @@ GIT_EXTERN(int) git_reflog_append(git_reflog *reflog, const git_oid *new_oid, co
* The reflog to be renamed is expected to already exist
*
* @param ref the reference
- * @param new_name the new name of the reference
+ * @param name the new name of the reference
* @return 0 or an error code
*/
-GIT_EXTERN(int) git_reflog_rename(git_reference *ref, const char *new_name);
+GIT_EXTERN(int) git_reflog_rename(git_reference *ref, const char *name);
/**
* Delete the reflog for the given reference
@@ -83,7 +83,7 @@ GIT_EXTERN(int) git_reflog_delete(git_reference *ref);
* @param reflog the previously loaded reflog
* @return the number of log entries
*/
-GIT_EXTERN(unsigned int) git_reflog_entrycount(git_reflog *reflog);
+GIT_EXTERN(size_t) git_reflog_entrycount(git_reflog *reflog);
/**
* Lookup an entry by its index
@@ -126,7 +126,7 @@ GIT_EXTERN(int) git_reflog_drop(
* @param entry a reflog entry
* @return the old oid
*/
-GIT_EXTERN(const git_oid *) git_reflog_entry_oidold(const git_reflog_entry *entry);
+GIT_EXTERN(const git_oid *) git_reflog_entry_id_old(const git_reflog_entry *entry);
/**
* Get the new oid
@@ -134,7 +134,7 @@ GIT_EXTERN(const git_oid *) git_reflog_entry_oidold(const git_reflog_entry *entr
* @param entry a reflog entry
* @return the new oid at this time
*/
-GIT_EXTERN(const git_oid *) git_reflog_entry_oidnew(const git_reflog_entry *entry);
+GIT_EXTERN(const git_oid *) git_reflog_entry_id_new(const git_reflog_entry *entry);
/**
* Get the committer of this entry
@@ -142,15 +142,15 @@ GIT_EXTERN(const git_oid *) git_reflog_entry_oidnew(const git_reflog_entry *entr
* @param entry a reflog entry
* @return the committer
*/
-GIT_EXTERN(git_signature *) git_reflog_entry_committer(const git_reflog_entry *entry);
+GIT_EXTERN(const git_signature *) git_reflog_entry_committer(const git_reflog_entry *entry);
/**
- * Get the log msg
+ * Get the log message
*
* @param entry a reflog entry
* @return the log msg
*/
-GIT_EXTERN(char *) git_reflog_entry_msg(const git_reflog_entry *entry);
+GIT_EXTERN(const char *) git_reflog_entry_message(const git_reflog_entry *entry);
/**
* Free the reflog
diff --git a/include/git2/refs.h b/include/git2/refs.h
index bc3f444..4e5a691 100644
--- a/include/git2/refs.h
+++ b/include/git2/refs.h
@@ -29,12 +29,12 @@ GIT_BEGIN_DECL
* See `git_reference_create_symbolic()` for documentation about valid
* reference names.
*
- * @param reference_out pointer to the looked-up reference
+ * @param out pointer to the looked-up reference
* @param repo the repository to look up the reference
* @param name the long name for the reference (e.g. HEAD, refs/heads/master, refs/tags/v0.1.0, ...)
- * @return 0 or an error code
+ * @return 0 or an error code (ENOTFOUND, EINVALIDSPEC)
*/
-GIT_EXTERN(int) git_reference_lookup(git_reference **reference_out, git_repository *repo, const char *name);
+GIT_EXTERN(int) git_reference_lookup(git_reference **out, git_repository *repo, const char *name);
/**
* Lookup a reference by name and resolve immediately to OID.
@@ -43,12 +43,13 @@ GIT_EXTERN(int) git_reference_lookup(git_reference **reference_out, git_reposito
* through to the object id that it refers to. This avoids having to
* allocate or free any `git_reference` objects for simple situations.
*
- * @param oid Pointer to oid to be filled in
+ * @param out Pointer to oid to be filled in
* @param repo The repository in which to look up the reference
* @param name The long name for the reference
- * @return 0 on success, -1 if name could not be resolved
+ * @return 0 on success, -1 if name could not be resolved (EINVALIDSPEC,
+ * ENOTFOUND, etc)
*/
-GIT_EXTERN(int) git_reference_name_to_oid(
+GIT_EXTERN(int) git_reference_name_to_id(
git_oid *out, git_repository *repo, const char *name);
/**
@@ -73,14 +74,14 @@ GIT_EXTERN(int) git_reference_name_to_oid(
* This function will return an error if a reference already exists with the
* given name unless `force` is true, in which case it will be overwritten.
*
- * @param ref_out Pointer to the newly created reference
+ * @param out Pointer to the newly created reference
* @param repo Repository where that reference will live
* @param name The name of the reference
* @param target The target of the reference
* @param force Overwrite existing references
- * @return 0 or an error code
+ * @return 0 or an error code (EEXISTS, EINVALIDSPEC)
*/
-GIT_EXTERN(int) git_reference_create_symbolic(git_reference **ref_out, git_repository *repo, const char *name, const char *target, int force);
+GIT_EXTERN(int) git_reference_symbolic_create(git_reference **out, git_repository *repo, const char *name, const char *target, int force);
/**
* Create a new direct reference.
@@ -105,14 +106,14 @@ GIT_EXTERN(int) git_reference_create_symbolic(git_reference **ref_out, git_repos
* This function will return an error if a reference already exists with the
* given name unless `force` is true, in which case it will be overwritten.
*
- * @param ref_out Pointer to the newly created reference
+ * @param out Pointer to the newly created reference
* @param repo Repository where that reference will live
* @param name The name of the reference
* @param id The object id pointed to by the reference.
* @param force Overwrite existing references
- * @return 0 or an error code
+ * @return 0 or an error code (EINVALIDSPEC, EEXISTS)
*/
-GIT_EXTERN(int) git_reference_create_oid(git_reference **ref_out, git_repository *repo, const char *name, const git_oid *id, int force);
+GIT_EXTERN(int) git_reference_create(git_reference **out, git_repository *repo, const char *name, const git_oid *id, int force);
/**
* Get the OID pointed to by a direct reference.
@@ -127,7 +128,7 @@ GIT_EXTERN(int) git_reference_create_oid(git_reference **ref_out, git_repository
* @param ref The reference
* @return a pointer to the oid if available, NULL otherwise
*/
-GIT_EXTERN(const git_oid *) git_reference_oid(git_reference *ref);
+GIT_EXTERN(const git_oid *) git_reference_target(const git_reference *ref);
/**
* Get full name to the reference pointed to by a symbolic reference.
@@ -137,7 +138,7 @@ GIT_EXTERN(const git_oid *) git_reference_oid(git_reference *ref);
* @param ref The reference
* @return a pointer to the name if available, NULL otherwise
*/
-GIT_EXTERN(const char *) git_reference_target(git_reference *ref);
+GIT_EXTERN(const char *) git_reference_symbolic_target(const git_reference *ref);
/**
* Get the type of a reference.
@@ -147,7 +148,7 @@ GIT_EXTERN(const char *) git_reference_target(git_reference *ref);
* @param ref The reference
* @return the type
*/
-GIT_EXTERN(git_ref_t) git_reference_type(git_reference *ref);
+GIT_EXTERN(git_ref_t) git_reference_type(const git_reference *ref);
/**
* Get the full name of a reference.
@@ -157,7 +158,7 @@ GIT_EXTERN(git_ref_t) git_reference_type(git_reference *ref);
* @param ref The reference
* @return the full name for the ref
*/
-GIT_EXTERN(const char *) git_reference_name(git_reference *ref);
+GIT_EXTERN(const char *) git_reference_name(const git_reference *ref);
/**
* Resolve a symbolic reference to a direct reference.
@@ -175,7 +176,7 @@ GIT_EXTERN(const char *) git_reference_name(git_reference *ref);
* @param ref The reference
* @return 0 or an error code
*/
-GIT_EXTERN(int) git_reference_resolve(git_reference **resolved_ref, git_reference *ref);
+GIT_EXTERN(int) git_reference_resolve(git_reference **out, const git_reference *ref);
/**
* Get the repository where a reference resides.
@@ -183,7 +184,7 @@ GIT_EXTERN(int) git_reference_resolve(git_reference **resolved_ref, git_referenc
* @param ref The reference
* @return a pointer to the repo
*/
-GIT_EXTERN(git_repository *) git_reference_owner(git_reference *ref);
+GIT_EXTERN(git_repository *) git_reference_owner(const git_reference *ref);
/**
* Set the symbolic target of a reference.
@@ -194,9 +195,9 @@ GIT_EXTERN(git_repository *) git_reference_owner(git_reference *ref);
*
* @param ref The reference
* @param target The new target for the reference
- * @return 0 or an error code
+ * @return 0 or an error code (EINVALIDSPEC)
*/
-GIT_EXTERN(int) git_reference_set_target(git_reference *ref, const char *target);
+GIT_EXTERN(int) git_reference_symbolic_set_target(git_reference *ref, const char *target);
/**
* Set the OID target of a reference.
@@ -209,7 +210,7 @@ GIT_EXTERN(int) git_reference_set_target(git_reference *ref, const char *target)
* @param id The new target OID for the reference
* @return 0 or an error code
*/
-GIT_EXTERN(int) git_reference_set_oid(git_reference *ref, const git_oid *id);
+GIT_EXTERN(int) git_reference_set_target(git_reference *ref, const git_oid *id);
/**
* Rename an existing reference.
@@ -231,12 +232,12 @@ GIT_EXTERN(int) git_reference_set_oid(git_reference *ref, const git_oid *id);
* the reflog if it exists.
*
* @param ref The reference to rename
- * @param new_name The new name for the reference
+ * @param name The new name for the reference
* @param force Overwrite an existing reference
- * @return 0 or an error code
+ * @return 0 or an error code (EINVALIDSPEC, EEXISTS)
*
*/
-GIT_EXTERN(int) git_reference_rename(git_reference *ref, const char *new_name, int force);
+GIT_EXTERN(int) git_reference_rename(git_reference *ref, const char *name, int force);
/**
* Delete an existing reference.
diff --git a/src/branch.c b/src/branch.c
index c6173ca..87ee708 100644
--- a/src/branch.c
+++ b/src/branch.c
@@ -77,7 +77,7 @@ int git_branch_create(
if (git_buf_joinpath(&canonical_branch_name, GIT_REFS_HEADS_DIR, branch_name) < 0)
goto cleanup;
- error = git_reference_create_oid(&branch, repository,
+ error = git_reference_create(&branch, repository,
git_buf_cstr(&canonical_branch_name), git_object_id(commit), force);
if (!error)
diff --git a/src/clone.c b/src/clone.c
index 9ef6f81..ea644dd 100644
--- a/src/clone.c
+++ b/src/clone.c
@@ -122,7 +122,7 @@ static int reference_matches_remote_head(
if (git_buf_len(&head_info->branchname) > 0)
return 0;
- if (git_reference_name_to_oid(
+ if (git_reference_name_to_id(
&oid,
head_info->repo,
reference_name) < 0) {
diff --git a/src/notes.c b/src/notes.c
index 81e4e50..7584846 100644
--- a/src/notes.c
+++ b/src/notes.c
@@ -406,7 +406,7 @@ static int retrieve_note_tree_and_commit(
if ((error = normalize_namespace(notes_ref, repo)) < 0)
return error;
- if ((error = git_reference_name_to_oid(&oid, repo, *notes_ref)) < 0)
+ if ((error = git_reference_name_to_id(&oid, repo, *notes_ref)) < 0)
return error;
if (git_commit_lookup(commit_out, repo, &oid) < 0)
diff --git a/src/pack-objects.c b/src/pack-objects.c
index a146dc0..5db4bc9 100644
--- a/src/pack-objects.c
+++ b/src/pack-objects.c
@@ -136,10 +136,11 @@ on_error:
return -1;
}
-void git_packbuilder_set_threads(git_packbuilder *pb, unsigned int n)
+unsigned int git_packbuilder_set_threads(git_packbuilder *pb, unsigned int n)
{
assert(pb);
pb->nr_threads = n;
+ return pb->nr_threads;
}
static void rehash(git_packbuilder *pb)
diff --git a/src/reflog.c b/src/reflog.c
index 7b07c6a..72a34f6 100644
--- a/src/reflog.c
+++ b/src/reflog.c
@@ -10,7 +10,7 @@
#include "filebuf.h"
#include "signature.h"
-static int reflog_init(git_reflog **reflog, git_reference *ref)
+static int reflog_init(git_reflog **reflog, const git_reference *ref)
{
git_reflog *log;
@@ -180,7 +180,7 @@ void git_reflog_free(git_reflog *reflog)
git__free(reflog);
}
-static int retrieve_reflog_path(git_buf *path, git_reference *ref)
+static int retrieve_reflog_path(git_buf *path, const git_reference *ref)
{
return git_buf_join_n(path, '/', 3,
git_reference_owner(ref)->path_repository, GIT_REFLOG_DIR, ref->name);
@@ -201,7 +201,7 @@ static int create_new_reflog_file(const char *filepath)
return p_close(fd);
}
-int git_reflog_read(git_reflog **reflog, git_reference *ref)
+int git_reflog_read(git_reflog **reflog, const git_reference *ref)
{
int error = -1;
git_buf log_path = GIT_BUF_INIT;
@@ -405,10 +405,10 @@ int git_reflog_delete(git_reference *ref)
return error;
}
-unsigned int git_reflog_entrycount(git_reflog *reflog)
+size_t git_reflog_entrycount(git_reflog *reflog)
{
assert(reflog);
- return (unsigned int)reflog->entries.length;
+ return reflog->entries.length;
}
const git_reflog_entry * git_reflog_entry_byindex(git_reflog *reflog, size_t idx)
@@ -425,25 +425,25 @@ const git_reflog_entry * git_reflog_entry_byindex(git_reflog *reflog, size_t idx
return git_vector_get(&reflog->entries, pos);
}
-const git_oid * git_reflog_entry_oidold(const git_reflog_entry *entry)
+const git_oid * git_reflog_entry_id_old(const git_reflog_entry *entry)
{
assert(entry);
return &entry->oid_old;
}
-const git_oid * git_reflog_entry_oidnew(const git_reflog_entry *entry)
+const git_oid * git_reflog_entry_id_new(const git_reflog_entry *entry)
{
assert(entry);
return &entry->oid_cur;
}
-git_signature * git_reflog_entry_committer(const git_reflog_entry *entry)
+const git_signature * git_reflog_entry_committer(const git_reflog_entry *entry)
{
assert(entry);
return entry->committer;
}
-char * git_reflog_entry_msg(const git_reflog_entry *entry)
+const char * git_reflog_entry_message(const git_reflog_entry *entry)
{
assert(entry);
return entry->msg;
diff --git a/src/refs.c b/src/refs.c
index 97c9756..1aaf4f6 100644
--- a/src/refs.c
+++ b/src/refs.c
@@ -1074,7 +1074,7 @@ int git_reference_lookup(git_reference **ref_out,
return git_reference_lookup_resolved(ref_out, repo, name, 0);
}
-int git_reference_name_to_oid(
+int git_reference_name_to_id(
git_oid *out, git_repository *repo, const char *name)
{
int error;
@@ -1083,7 +1083,7 @@ int git_reference_name_to_oid(
if ((error = git_reference_lookup_resolved(&ref, repo, name, -1)) < 0)
return error;
- git_oid_cpy(out, git_reference_oid(ref));
+ git_oid_cpy(out, git_reference_target(ref));
git_reference_free(ref);
return 0;
}
@@ -1153,7 +1153,7 @@ int git_reference_lookup_resolved(
/**
* Getters
*/
-git_ref_t git_reference_type(git_reference *ref)
+git_ref_t git_reference_type(const git_reference *ref)
{
assert(ref);
@@ -1172,19 +1172,19 @@ int git_reference_is_packed(git_reference *ref)
return !!(ref->flags & GIT_REF_PACKED);
}
-const char *git_reference_name(git_reference *ref)
+const char *git_reference_name(const git_reference *ref)
{
assert(ref);
return ref->name;
}
-git_repository *git_reference_owner(git_reference *ref)
+git_repository *git_reference_owner(const git_reference *ref)
{
assert(ref);
return ref->owner;
}
-const git_oid *git_reference_oid(git_reference *ref)
+const git_oid *git_reference_target(const git_reference *ref)
{
assert(ref);
@@ -1194,7 +1194,7 @@ const git_oid *git_reference_oid(git_reference *ref)
return &ref->target.oid;
}
-const char *git_reference_target(git_reference *ref)
+const char *git_reference_symbolic_target(const git_reference *ref)
{
assert(ref);
@@ -1204,7 +1204,7 @@ const char *git_reference_target(git_reference *ref)
return ref->target.symbolic;
}
-int git_reference_create_symbolic(
+int git_reference_symbolic_create(
git_reference **ref_out,
git_repository *repo,
const char *name,
@@ -1231,7 +1231,7 @@ int git_reference_create_symbolic(
/* set the target; this will normalize the name automatically
* and write the reference on disk */
- if (git_reference_set_target(ref, target) < 0) {
+ if (git_reference_symbolic_set_target(ref, target) < 0) {
git_reference_free(ref);
return -1;
}
@@ -1244,7 +1244,7 @@ int git_reference_create_symbolic(
return 0;
}
-int git_reference_create_oid(
+int git_reference_create(
git_reference **ref_out,
git_repository *repo,
const char *name,
@@ -1270,7 +1270,7 @@ int git_reference_create_oid(
ref->flags |= GIT_REF_OID;
/* set the oid; this will write the reference on disk */
- if (git_reference_set_oid(ref, id) < 0) {
+ if (git_reference_set_target(ref, id) < 0) {
git_reference_free(ref);
return -1;
}
@@ -1292,7 +1292,7 @@ int git_reference_create_oid(
* We do not repack packed references because of performance
* reasons.
*/
-int git_reference_set_oid(git_reference *ref, const git_oid *id)
+int git_reference_set_target(git_reference *ref, const git_oid *id)
{
git_odb *odb = NULL;
@@ -1328,7 +1328,7 @@ int git_reference_set_oid(git_reference *ref, const git_oid *id)
* a pack. We just change the target in memory
* and overwrite the file on disk.
*/
-int git_reference_set_target(git_reference *ref, const char *target)
+int git_reference_symbolic_set_target(git_reference *ref, const char *target)
{
char normalized[GIT_REFNAME_MAX];
@@ -1397,10 +1397,10 @@ int git_reference_rename(git_reference *ref, const char *new_name, int force)
* Finally we can create the new reference.
*/
if (ref->flags & GIT_REF_SYMBOLIC) {
- result = git_reference_create_symbolic(
+ result = git_reference_symbolic_create(
NULL, ref->owner, new_name, ref->target.symbolic, force);
} else {
- result = git_reference_create_oid(
+ result = git_reference_create(
NULL, ref->owner, new_name, &ref->target.oid, force);
}
@@ -1444,10 +1444,10 @@ rollback:
* Try to create the old reference again, ignore failures
*/
if (ref->flags & GIT_REF_SYMBOLIC)
- git_reference_create_symbolic(
+ git_reference_symbolic_create(
NULL, ref->owner, ref->name, ref->target.symbolic, 0);
else
- git_reference_create_oid(
+ git_reference_create(
NULL, ref->owner, ref->name, &ref->target.oid, 0);
/* The reference is no longer packed */
@@ -1457,7 +1457,7 @@ rollback:
return -1;
}
-int git_reference_resolve(git_reference **ref_out, git_reference *ref)
+int git_reference_resolve(git_reference **ref_out, const git_reference *ref)
{
if (ref->flags & GIT_REF_OID)
return git_reference_lookup(ref_out, ref->owner, ref->name);
@@ -1797,7 +1797,7 @@ int git_reference__update(git_repository *repo, const git_oid *oid, const char *
* a new reference and that's it */
if (res == GIT_ENOTFOUND) {
giterr_clear();
- return git_reference_create_oid(NULL, repo, ref_name, oid, 1);
+ return git_reference_create(NULL, repo, ref_name, oid, 1);
}
if (res < 0)
@@ -1810,7 +1810,7 @@ int git_reference__update(git_repository *repo, const git_oid *oid, const char *
const char *sym_target;
/* The target pointed at by this reference */
- sym_target = git_reference_target(ref);
+ sym_target = git_reference_symbolic_target(ref);
/* resolve the reference to the target it points to */
res = git_reference_resolve(&aux, ref);
@@ -1822,7 +1822,7 @@ int git_reference__update(git_repository *repo, const git_oid *oid, const char *
*/
if (res == GIT_ENOTFOUND) {
giterr_clear();
- res = git_reference_create_oid(NULL, repo, sym_target, oid, 1);
+ res = git_reference_create(NULL, repo, sym_target, oid, 1);
git_reference_free(ref);
return res;
}
@@ -1840,7 +1840,7 @@ int git_reference__update(git_repository *repo, const git_oid *oid, const char *
/* ref is made to point to `oid`: ref is either the original reference,
* or the target of the symbolic reference we've looked up */
- res = git_reference_set_oid(ref, oid);
+ res = git_reference_set_target(ref, oid);
git_reference_free(ref);
return res;
}
@@ -1923,7 +1923,7 @@ static int reference_target(git_object **object, git_reference *ref)
{
const git_oid *oid;
- oid = git_reference_oid(ref);
+ oid = git_reference_target(ref);
return git_object_lookup(object, git_reference_owner(ref), oid, GIT_OBJ_ANY);
}
diff --git a/src/remote.c b/src/remote.c
index 4a4d160..063e518 100644
--- a/src/remote.c
+++ b/src/remote.c
@@ -695,7 +695,7 @@ int git_remote_update_tips(git_remote *remote)
head = (git_remote_head *)refs.contents[0];
if (!strcmp(head->name, GIT_HEAD_FILE)) {
- if (git_reference_create_oid(&ref, remote->repo, GIT_FETCH_HEAD_FILE, &head->oid, 1) < 0)
+ if (git_reference_create(&ref, remote->repo, GIT_FETCH_HEAD_FILE, &head->oid, 1) < 0)
goto on_error;
i = 1;
@@ -735,7 +735,7 @@ int git_remote_update_tips(git_remote *remote)
if (git_vector_insert(&update_heads, head) < 0)
goto on_error;
- error = git_reference_name_to_oid(&old, remote->repo, refname.ptr);
+ error = git_reference_name_to_id(&old, remote->repo, refname.ptr);
if (error < 0 && error != GIT_ENOTFOUND)
goto on_error;
@@ -746,7 +746,7 @@ int git_remote_update_tips(git_remote *remote)
continue;
/* In autotag mode, don't overwrite any locally-existing tags */
- error = git_reference_create_oid(&ref, remote->repo, refname.ptr, &head->oid, !autotag);
+ error = git_reference_create(&ref, remote->repo, refname.ptr, &head->oid, !autotag);
if (error < 0 && error != GIT_EEXISTS)
goto on_error;
diff --git a/src/repository.c b/src/repository.c
index deab771..1642f45 100644
--- a/src/repository.c
+++ b/src/repository.c
@@ -1231,7 +1231,7 @@ int git_repository_head_detached(git_repository *repo)
return 0;
}
- exists = git_odb_exists(odb, git_reference_oid(ref));
+ exists = git_odb_exists(odb, git_reference_target(ref));
git_reference_free(ref);
return exists;
@@ -1250,7 +1250,7 @@ int git_repository_head(git_reference **head_out, git_repository *repo)
return 0;
}
- error = git_reference_lookup_resolved(head_out, repo, git_reference_target(head), -1);
+ error = git_reference_lookup_resolved(head_out, repo, git_reference_symbolic_target(head), -1);
git_reference_free(head);
return error == GIT_ENOTFOUND ? GIT_EORPHANEDHEAD : error;
@@ -1305,7 +1305,7 @@ int git_repository_is_empty(git_repository *repo)
goto cleanup;
if (!(error = strcmp(
- git_reference_target(head),
+ git_reference_symbolic_target(head),
GIT_REFS_HEADS_DIR "master") == 0))
goto cleanup;
@@ -1531,11 +1531,11 @@ int git_repository_set_head(
if (!error) {
if (git_reference_is_branch(ref))
- error = git_reference_create_symbolic(&new_head, repo, GIT_HEAD_FILE, git_reference_name(ref), 1);
+ error = git_reference_symbolic_create(&new_head, repo, GIT_HEAD_FILE, git_reference_name(ref), 1);
else
- error = git_repository_set_head_detached(repo, git_reference_oid(ref));
+ error = git_repository_set_head_detached(repo, git_reference_target(ref));
} else if (looks_like_a_branch(refname))
- error = git_reference_create_symbolic(&new_head, repo, GIT_HEAD_FILE, refname, 1);
+ error = git_reference_symbolic_create(&new_head, repo, GIT_HEAD_FILE, refname, 1);
git_reference_free(ref);
git_reference_free(new_head);
@@ -1559,7 +1559,7 @@ int git_repository_set_head_detached(
if ((error = git_object_peel(&peeled, object, GIT_OBJ_COMMIT)) < 0)
goto cleanup;
- error = git_reference_create_oid(&new_head, repo, GIT_HEAD_FILE, git_object_id(peeled), 1);
+ error = git_reference_create(&new_head, repo, GIT_HEAD_FILE, git_object_id(peeled), 1);
cleanup:
git_object_free(object);
@@ -1581,10 +1581,10 @@ int git_repository_detach_head(
if ((error = git_repository_head(&old_head, repo)) < 0)
return error;
- if ((error = git_object_lookup(&object, repo, git_reference_oid(old_head), GIT_OBJ_COMMIT)) < 0)
+ if ((error = git_object_lookup(&object, repo, git_reference_target(old_head), GIT_OBJ_COMMIT)) < 0)
goto cleanup;
- error = git_reference_create_oid(&new_head, repo, GIT_HEAD_FILE, git_reference_oid(old_head), 1);
+ error = git_reference_create(&new_head, repo, GIT_HEAD_FILE, git_reference_target(old_head), 1);
cleanup:
git_object_free(object);
diff --git a/src/reset.c b/src/reset.c
index 8f470b2..928a2bc 100644
--- a/src/reset.c
+++ b/src/reset.c
@@ -41,14 +41,14 @@ static int update_head(git_repository *repo, git_object *commit)
if ((error = git_reference_lookup(&head, repo, GIT_HEAD_FILE)) < 0)
goto cleanup;
- if ((error = git_reference_create_oid(
+ if ((error = git_reference_create(
&target,
repo,
- git_reference_target(head),
+ git_reference_symbolic_target(head),
git_object_id(commit), 0)) < 0)
goto cleanup;
} else {
- if ((error = git_reference_set_oid(head, git_object_id(commit))) < 0)
+ if ((error = git_reference_set_target(head, git_object_id(commit))) < 0)
goto cleanup;
}
diff --git a/src/revparse.c b/src/revparse.c
index 6b49402..79900c4 100644
--- a/src/revparse.c
+++ b/src/revparse.c
@@ -140,7 +140,7 @@ static int revparse_lookup_object(git_object **out, git_repository *repo, const
error = disambiguate_refname(&ref, repo, spec);
if (!error) {
- error = git_object_lookup(out, repo, git_reference_oid(ref), GIT_OBJ_ANY);
+ error = git_object_lookup(out, repo, git_reference_target(ref), GIT_OBJ_ANY);
git_reference_free(ref);
return error;
}
@@ -203,7 +203,7 @@ static int retrieve_previously_checked_out_branch_or_revision(git_object **out,
for (i = 0; i < numentries; i++) {
entry = git_reflog_entry_byindex(reflog, i);
- msg = git_reflog_entry_msg(entry);
+ msg = git_reflog_entry_message(entry);
if (regexec(&preg, msg, 2, regexmatches, 0))
continue;
@@ -263,7 +263,7 @@ static int retrieve_oid_from_reflog(git_oid *oid, git_reference *ref, unsigned i
}
entry = git_reflog_entry_byindex(reflog, identifier);
- git_oid_cpy(oid, git_reflog_entry_oidnew(entry));
+ git_oid_cpy(oid, git_reflog_entry_id_new(entry));
error = 0;
goto cleanup;
@@ -278,7 +278,7 @@ static int retrieve_oid_from_reflog(git_oid *oid, git_reference *ref, unsigned i
if (commit_time.time - identifier > 0)
continue;
- git_oid_cpy(oid, git_reflog_entry_oidnew(entry));
+ git_oid_cpy(oid, git_reflog_entry_id_new(entry));
error = 0;
goto cleanup;
}
@@ -306,7 +306,7 @@ static int retrieve_revobject_from_reflog(git_object **out, git_reference **base
}
if (position == 0) {
- error = git_object_lookup(out, repo, git_reference_oid(ref), GIT_OBJ_ANY);
+ error = git_object_lookup(out, repo, git_reference_target(ref), GIT_OBJ_ANY);
goto cleanup;
}
@@ -632,7 +632,7 @@ static int object_from_reference(git_object **object, git_reference *reference)
if (git_reference_resolve(&resolved, reference) < 0)
return -1;
- error = git_object_lookup(object, reference->owner, git_reference_oid(resolved), GIT_OBJ_ANY);
+ error = git_object_lookup(object, reference->owner, git_reference_target(resolved), GIT_OBJ_ANY);
git_reference_free(resolved);
return error;
diff --git a/src/revwalk.c b/src/revwalk.c
index 4fff238..236c945 100644
--- a/src/revwalk.c
+++ b/src/revwalk.c
@@ -559,7 +559,7 @@ static int push_ref(git_revwalk *walk, const char *refname, int hide)
{
git_oid oid;
- if (git_reference_name_to_oid(&oid, walk->repo, refname) < 0)
+ if (git_reference_name_to_id(&oid, walk->repo, refname) < 0)
return -1;
return push_commit(walk, &oid, hide);
diff --git a/src/stash.c b/src/stash.c
index b74429a..89e5ff3 100644
--- a/src/stash.c
+++ b/src/stash.c
@@ -98,7 +98,7 @@ static int retrieve_base_commit_and_message(
"%s: ",
git_reference_name(head) + strlen(GIT_REFS_HEADS_DIR));
- if (git_commit_lookup(b_commit, repo, git_reference_oid(head)) < 0)
+ if (git_commit_lookup(b_commit, repo, git_reference_target(head)) < 0)
goto cleanup;
if (append_commit_description(stash_message, *b_commit) < 0)
@@ -436,7 +436,7 @@ static int update_reflog(
git_reflog *reflog = NULL;
int error;
- if ((error = git_reference_create_oid(&stash, repo, GIT_REFS_STASH_FILE, w_commit_oid, 1)) < 0)
+ if ((error = git_reference_create(&stash, repo, GIT_REFS_STASH_FILE, w_commit_oid, 1)) < 0)
goto cleanup;
if ((error = git_reflog_read(&reflog, stash)) < 0)
@@ -603,8 +603,8 @@ int git_stash_foreach(
entry = git_reflog_entry_byindex(reflog, i);
if (callback(i,
- git_reflog_entry_msg(entry),
- git_reflog_entry_oidnew(entry),
+ git_reflog_entry_message(entry),
+ git_reflog_entry_id_new(entry),
payload)) {
error = GIT_EUSER;
goto cleanup;
diff --git a/src/submodule.c b/src/submodule.c
index 6eb1c52..6093ff9 100644
--- a/src/submodule.c
+++ b/src/submodule.c
@@ -695,7 +695,7 @@ int git_submodule_open(
/* if we have opened the submodule successfully, let's grab the HEAD OID */
if (!error && !(submodule->flags & GIT_SUBMODULE_STATUS__WD_OID_VALID)) {
- if (!git_reference_name_to_oid(
+ if (!git_reference_name_to_id(
&submodule->wd_oid, *subrepo, GIT_HEAD_FILE))
submodule->flags |= GIT_SUBMODULE_STATUS__WD_OID_VALID;
else
@@ -1316,7 +1316,7 @@ static int lookup_head_remote(git_buf *url, git_repository *repo)
/* remote should refer to something like refs/remotes/ORIGIN/BRANCH */
if (git_reference_type(remote) != GIT_REF_SYMBOLIC ||
- git__prefixcmp(git_reference_target(remote), GIT_REFS_REMOTES_DIR) != 0)
+ git__prefixcmp(git_reference_symbolic_target(remote), GIT_REFS_REMOTES_DIR) != 0)
{
giterr_set(GITERR_SUBMODULE,
"Cannot resolve relative URL when HEAD is not symbolic");
@@ -1324,7 +1324,7 @@ static int lookup_head_remote(git_buf *url, git_repository *repo)
goto cleanup;
}
- scan = tgt = git_reference_target(remote) + strlen(GIT_REFS_REMOTES_DIR);
+ scan = tgt = git_reference_symbolic_target(remote) + strlen(GIT_REFS_REMOTES_DIR);
while (*scan && (*scan != '/' || (scan > tgt && scan[-1] != '\\')))
scan++; /* find non-escaped slash to end ORIGIN name */
diff --git a/src/tag.c b/src/tag.c
index 13369d9..c39119c 100644
--- a/src/tag.c
+++ b/src/tag.c
@@ -188,7 +188,7 @@ static int retrieve_tag_reference_oid(
if (git_buf_joinpath(ref_name_out, GIT_REFS_TAGS_DIR, tag_name) < 0)
return -1;
- return git_reference_name_to_oid(oid, repo, ref_name_out->ptr);
+ return git_reference_name_to_id(oid, repo, ref_name_out->ptr);
}
static int write_tag_annotation(
@@ -267,7 +267,7 @@ static int git_tag_create__internal(
} else
git_oid_cpy(oid, git_object_id(target));
- error = git_reference_create_oid(&new_ref, repo, ref_name.ptr, oid, allow_ref_overwrite);
+ error = git_reference_create(&new_ref, repo, ref_name.ptr, oid, allow_ref_overwrite);
git_reference_free(new_ref);
git_buf_free(&ref_name);
@@ -358,7 +358,7 @@ int git_tag_create_frombuffer(git_oid *oid, git_repository *repo, const char *bu
return -1;
}
- error = git_reference_create_oid(&new_ref, repo, ref_name.ptr, oid, allow_ref_overwrite);
+ error = git_reference_create(&new_ref, repo, ref_name.ptr, oid, allow_ref_overwrite);
git_reference_free(new_ref);
git_buf_free(&ref_name);
@@ -409,7 +409,7 @@ static int tags_cb(const char *ref, void *data)
if (git__prefixcmp(ref, GIT_REFS_TAGS_DIR) != 0)
return 0; /* no tag */
- if (git_reference_name_to_oid(&oid, d->repo, ref) < 0)
+ if (git_reference_name_to_id(&oid, d->repo, ref) < 0)
return -1;
return d->cb(ref, &oid, d->cb_data);
diff --git a/src/transports/local.c b/src/transports/local.c
index 46c9218..caac46e 100644
--- a/src/transports/local.c
+++ b/src/transports/local.c
@@ -48,7 +48,7 @@ static int add_ref(transport_local *t, const char *name)
head->name = git__strdup(name);
GITERR_CHECK_ALLOC(head->name);
- if (git_reference_name_to_oid(&head->oid, t->repo, name) < 0) {
+ if (git_reference_name_to_id(&head->oid, t->repo, name) < 0) {
git__free(head->name);
git__free(head);
return -1;
diff --git a/src/transports/smart_protocol.c b/src/transports/smart_protocol.c
index e24eb27..06424cb 100644
--- a/src/transports/smart_protocol.c
+++ b/src/transports/smart_protocol.c
@@ -188,7 +188,7 @@ static int fetch_setup_walk(git_revwalk **out, git_repository *repo)
if (git_reference_type(ref) == GIT_REF_SYMBOLIC)
continue;
- if (git_revwalk_push(walk, git_reference_oid(ref)) < 0)
+ if (git_revwalk_push(walk, git_reference_target(ref)) < 0)
goto on_error;
git_reference_free(ref);
diff --git a/tests-clar/checkout/index.c b/tests-clar/checkout/index.c
index c7b19db..b6d6372 100644
--- a/tests-clar/checkout/index.c
+++ b/tests-clar/checkout/index.c
@@ -247,7 +247,7 @@ void test_checkout_index__options_dir_modes(void)
git_oid oid;
git_commit *commit;
- cl_git_pass(git_reference_name_to_oid(&oid, g_repo, "refs/heads/dir"));
+ cl_git_pass(git_reference_name_to_id(&oid, g_repo, "refs/heads/dir"));
cl_git_pass(git_commit_lookup(&commit, g_repo, &oid));
reset_index_to_treeish((git_object *)commit);
diff --git a/tests-clar/clone/network.c b/tests-clar/clone/network.c
index def5214..4759b60 100644
--- a/tests-clar/clone/network.c
+++ b/tests-clar/clone/network.c
@@ -74,7 +74,7 @@ void test_clone_network__empty_repository(void)
cl_git_pass(git_reference_lookup(&head, g_repo, GIT_HEAD_FILE));
cl_assert_equal_i(GIT_REF_SYMBOLIC, git_reference_type(head));
- cl_assert_equal_s("refs/heads/master", git_reference_target(head));
+ cl_assert_equal_s("refs/heads/master", git_reference_symbolic_target(head));
git_reference_free(head);
}
@@ -129,7 +129,7 @@ void test_clone_network__can_checkout_a_cloned_repo(void)
cl_git_pass(git_reference_lookup(&head, g_repo, "HEAD"));
cl_assert_equal_i(GIT_REF_SYMBOLIC, git_reference_type(head));
- cl_assert_equal_s("refs/heads/master", git_reference_target(head));
+ cl_assert_equal_s("refs/heads/master", git_reference_symbolic_target(head));
cl_assert_equal_i(true, checkout_progress_cb_was_called);
cl_assert_equal_i(true, fetch_progress_cb_was_called);
diff --git a/tests-clar/commit/commit.c b/tests-clar/commit/commit.c
index 4cedcea..8f071ff 100644
--- a/tests-clar/commit/commit.c
+++ b/tests-clar/commit/commit.c
@@ -37,7 +37,7 @@ void test_commit_commit__create_unexisting_update_ref(void)
NULL, "some msg", tree, 1, (const git_commit **) &commit));
cl_git_pass(git_reference_lookup(&ref, _repo, "refs/heads/foo/bar"));
- cl_assert(!git_oid_cmp(&oid, git_reference_oid(ref)));
+ cl_assert(!git_oid_cmp(&oid, git_reference_target(ref)));
git_tree_free(tree);
git_commit_free(commit);
diff --git a/tests-clar/commit/write.c b/tests-clar/commit/write.c
index 6d62809..7b9868b 100644
--- a/tests-clar/commit/write.c
+++ b/tests-clar/commit/write.c
@@ -112,10 +112,10 @@ void test_commit_write__root(void)
/* First we need to update HEAD so it points to our non-existant branch */
cl_git_pass(git_reference_lookup(&head, g_repo, "HEAD"));
cl_assert(git_reference_type(head) == GIT_REF_SYMBOLIC);
- head_old = git__strdup(git_reference_target(head));
+ head_old = git__strdup(git_reference_symbolic_target(head));
cl_assert(head_old != NULL);
- cl_git_pass(git_reference_set_target(head, branch_name));
+ cl_git_pass(git_reference_symbolic_set_target(head, branch_name));
cl_git_pass(git_commit_create_v(
&commit_id, /* out id */
@@ -140,7 +140,7 @@ void test_commit_write__root(void)
cl_git_pass(git_commit_lookup(&commit, g_repo, &commit_id));
cl_assert(git_commit_parentcount(commit) == 0);
cl_git_pass(git_reference_lookup(&branch, g_repo, branch_name));
- branch_oid = git_reference_oid(branch);
+ branch_oid = git_reference_target(branch);
cl_git_pass(git_oid_cmp(branch_oid, &commit_id));
cl_assert(!strcmp(git_commit_message(commit), root_commit_message));
}
diff --git a/tests-clar/object/tag/write.c b/tests-clar/object/tag/write.c
index 10d0479..3e11003 100644
--- a/tests-clar/object/tag/write.c
+++ b/tests-clar/object/tag/write.c
@@ -58,7 +58,7 @@ void test_object_tag_write__basic(void)
cl_assert_equal_s(git_tag_message(tag), tagger_message);
cl_git_pass(git_reference_lookup(&ref_tag, g_repo, "refs/tags/the-tag"));
- cl_assert(git_oid_cmp(git_reference_oid(ref_tag), &tag_id) == 0);
+ cl_assert(git_oid_cmp(git_reference_target(ref_tag), &tag_id) == 0);
cl_git_pass(git_reference_delete(ref_tag));
git_tag_free(tag);
@@ -103,7 +103,7 @@ void test_object_tag_write__replace(void)
cl_git_pass(git_object_lookup(&target, g_repo, &target_id, GIT_OBJ_COMMIT));
cl_git_pass(git_reference_lookup(&ref_tag, g_repo, "refs/tags/e90810b"));
- git_oid_cpy(&old_tag_id, git_reference_oid(ref_tag));
+ git_oid_cpy(&old_tag_id, git_reference_target(ref_tag));
git_reference_free(ref_tag);
/* create signature */
@@ -122,8 +122,8 @@ void test_object_tag_write__replace(void)
git_signature_free(tagger);
cl_git_pass(git_reference_lookup(&ref_tag, g_repo, "refs/tags/e90810b"));
- cl_assert(git_oid_cmp(git_reference_oid(ref_tag), &tag_id) == 0);
- cl_assert(git_oid_cmp(git_reference_oid(ref_tag), &old_tag_id) != 0);
+ cl_assert(git_oid_cmp(git_reference_target(ref_tag), &tag_id) == 0);
+ cl_assert(git_oid_cmp(git_reference_target(ref_tag), &old_tag_id) != 0);
git_reference_free(ref_tag);
}
@@ -150,7 +150,7 @@ void test_object_tag_write__lightweight(void)
cl_assert(git_oid_cmp(&object_id, &target_id) == 0);
cl_git_pass(git_reference_lookup(&ref_tag, g_repo, "refs/tags/light-tag"));
- cl_assert(git_oid_cmp(git_reference_oid(ref_tag), &target_id) == 0);
+ cl_assert(git_oid_cmp(git_reference_target(ref_tag), &target_id) == 0);
cl_git_pass(git_tag_delete(g_repo, "light-tag"));
diff --git a/tests-clar/refs/branches/create.c b/tests-clar/refs/branches/create.c
index 5ecb428..51db04b 100644
--- a/tests-clar/refs/branches/create.c
+++ b/tests-clar/refs/branches/create.c
@@ -47,7 +47,7 @@ void test_refs_branches_create__can_create_a_local_branch(void)
retrieve_known_commit(&target, repo);
cl_git_pass(git_branch_create(&branch, repo, NEW_BRANCH_NAME, target, 0));
- cl_git_pass(git_oid_cmp(git_reference_oid(branch), git_object_id(target)));
+ cl_git_pass(git_oid_cmp(git_reference_target(branch), git_object_id(target)));
}
void test_refs_branches_create__can_not_create_a_branch_if_its_name_collide_with_an_existing_one(void)
@@ -62,7 +62,7 @@ void test_refs_branches_create__can_force_create_over_an_existing_branch(void)
retrieve_known_commit(&target, repo);
cl_git_pass(git_branch_create(&branch, repo, "br2", target, 1));
- cl_git_pass(git_oid_cmp(git_reference_oid(branch), git_object_id(target)));
+ cl_git_pass(git_oid_cmp(git_reference_target(branch), git_object_id(target)));
cl_assert_equal_s("refs/heads/br2", git_reference_name(branch));
}
@@ -72,7 +72,7 @@ void test_refs_branches_create__creating_a_branch_targeting_a_tag_dereferences_i
retrieve_target_from_oid(&target, repo, "b25fa35b38051e4ae45d4222e795f9df2e43f1d1");
cl_git_pass(git_branch_create(&branch, repo, NEW_BRANCH_NAME, target, 0));
- cl_git_pass(git_oid_streq(git_reference_oid(branch), "e90810b8df3e80c413d903f631643c716887138d"));
+ cl_git_pass(git_oid_streq(git_reference_target(branch), "e90810b8df3e80c413d903f631643c716887138d"));
}
void test_refs_branches_create__can_not_create_a_branch_pointing_to_a_non_commit_object(void)
diff --git a/tests-clar/refs/branches/delete.c b/tests-clar/refs/branches/delete.c
index 75271a2..1843036 100644
--- a/tests-clar/refs/branches/delete.c
+++ b/tests-clar/refs/branches/delete.c
@@ -14,7 +14,7 @@ void test_refs_branches_delete__initialize(void)
cl_git_pass(git_repository_open(&repo, "testrepo.git"));
cl_git_pass(git_oid_fromstr(&id, "be3563ae3f795b2b4353bcce3a527ad0a4f7f644"));
- cl_git_pass(git_reference_create_oid(&fake_remote, repo, "refs/remotes/nulltoken/master", &id, 0));
+ cl_git_pass(git_reference_create(&fake_remote, repo, "refs/remotes/nulltoken/master", &id, 0));
}
void test_refs_branches_delete__cleanup(void)
@@ -35,7 +35,7 @@ void test_refs_branches_delete__can_not_delete_a_branch_pointed_at_by_HEAD(void)
/* Ensure HEAD targets the local master branch */
cl_git_pass(git_reference_lookup(&head, repo, GIT_HEAD_FILE));
- cl_assert(strcmp("refs/heads/master", git_reference_target(head)) == 0);
+ cl_assert(strcmp("refs/heads/master", git_reference_symbolic_target(head)) == 0);
git_reference_free(head);
cl_git_pass(git_branch_lookup(&branch, repo, "master", GIT_BRANCH_LOCAL));
@@ -71,7 +71,7 @@ void test_refs_branches_delete__can_delete_a_branch_pointed_at_by_detached_HEAD(
cl_git_pass(git_reference_lookup(&head, repo, GIT_HEAD_FILE));
cl_assert_equal_i(GIT_REF_SYMBOLIC, git_reference_type(head));
- cl_assert_equal_s("refs/heads/master", git_reference_target(head));
+ cl_assert_equal_s("refs/heads/master", git_reference_symbolic_target(head));
git_reference_free(head);
/* Detach HEAD and make it target the commit that "master" points to */
@@ -107,4 +107,4 @@ void test_refs_branches_delete__deleting_a_branch_removes_related_configuration_
assert_config_entry_existence(repo, "branch.track-local.remote", false);
assert_config_entry_existence(repo, "branch.track-local.merge", false);
-}
\ No newline at end of file
+}
diff --git a/tests-clar/refs/branches/foreach.c b/tests-clar/refs/branches/foreach.c
index dfa0439..96a5bc2 100644
--- a/tests-clar/refs/branches/foreach.c
+++ b/tests-clar/refs/branches/foreach.c
@@ -12,7 +12,7 @@ void test_refs_branches_foreach__initialize(void)
cl_git_pass(git_repository_open(&repo, "testrepo.git"));
cl_git_pass(git_oid_fromstr(&id, "be3563ae3f795b2b4353bcce3a527ad0a4f7f644"));
- cl_git_pass(git_reference_create_oid(&fake_remote, repo, "refs/remotes/nulltoken/master", &id, 0));
+ cl_git_pass(git_reference_create(&fake_remote, repo, "refs/remotes/nulltoken/master", &id, 0));
}
void test_refs_branches_foreach__cleanup(void)
@@ -119,7 +119,7 @@ void test_refs_branches_foreach__retrieve_remote_symbolic_HEAD_when_present(void
};
git_reference_free(fake_remote);
- cl_git_pass(git_reference_create_symbolic(&fake_remote, repo, "refs/remotes/nulltoken/HEAD", "refs/remotes/nulltoken/master", 0));
+ cl_git_pass(git_reference_symbolic_create(&fake_remote, repo, "refs/remotes/nulltoken/HEAD", "refs/remotes/nulltoken/master", 0));
assert_retrieval(GIT_BRANCH_REMOTE, 3);
diff --git a/tests-clar/refs/branches/ishead.c b/tests-clar/refs/branches/ishead.c
index 2ab488f..dfcf1b5 100644
--- a/tests-clar/refs/branches/ishead.c
+++ b/tests-clar/refs/branches/ishead.c
@@ -98,9 +98,9 @@ void test_refs_branches_ishead__only_direct_references_are_considered(void)
git_repository_free(repo);
repo = cl_git_sandbox_init("testrepo.git");
- cl_git_pass(git_reference_create_symbolic(&linked, repo, "refs/heads/linked", "refs/heads/master", 0));
- cl_git_pass(git_reference_create_symbolic(&super, repo, "refs/heads/super", "refs/heads/linked", 0));
- cl_git_pass(git_reference_create_symbolic(&head, repo, GIT_HEAD_FILE, "refs/heads/super", 1));
+ cl_git_pass(git_reference_symbolic_create(&linked, repo, "refs/heads/linked", "refs/heads/master", 0));
+ cl_git_pass(git_reference_symbolic_create(&super, repo, "refs/heads/super", "refs/heads/linked", 0));
+ cl_git_pass(git_reference_symbolic_create(&head, repo, GIT_HEAD_FILE, "refs/heads/super", 1));
cl_assert_equal_i(false, git_branch_is_head(linked));
cl_assert_equal_i(false, git_branch_is_head(super));
diff --git a/tests-clar/refs/crashes.c b/tests-clar/refs/crashes.c
index e1b289a..9fb5ff6 100644
--- a/tests-clar/refs/crashes.c
+++ b/tests-clar/refs/crashes.c
@@ -7,7 +7,7 @@ void test_refs_crashes__double_free(void)
const char *REFNAME = "refs/heads/xxx";
cl_git_pass(git_repository_open(&repo, cl_fixture("testrepo.git")));
- cl_git_pass(git_reference_create_symbolic(&ref, repo, REFNAME, "refs/heads/master", 0));
+ cl_git_pass(git_reference_symbolic_create(&ref, repo, REFNAME, "refs/heads/master", 0));
cl_git_pass(git_reference_lookup(&ref2, repo, REFNAME));
cl_git_pass(git_reference_delete(ref));
/* reference is gone from disk, so reloading it will fail */
diff --git a/tests-clar/refs/create.c b/tests-clar/refs/create.c
index bf234bc..bef9bfd 100644
--- a/tests-clar/refs/create.c
+++ b/tests-clar/refs/create.c
@@ -36,7 +36,7 @@ void test_refs_create__symbolic(void)
git_buf_free(&ref_path);
/* Create and write the new symbolic reference */
- cl_git_pass(git_reference_create_symbolic(&new_reference, g_repo, new_head_tracker, current_head_target, 0));
+ cl_git_pass(git_reference_symbolic_create(&new_reference, g_repo, new_head_tracker, current_head_target, 0));
/* Ensure the reference can be looked-up... */
cl_git_pass(git_reference_lookup(&looked_up_ref, g_repo, new_head_tracker));
@@ -49,7 +49,7 @@ void test_refs_create__symbolic(void)
cl_assert(git_reference_type(resolved_ref) == GIT_REF_OID);
/* ...and that it points to the current master tip */
- cl_assert(git_oid_cmp(&id, git_reference_oid(resolved_ref)) == 0);
+ cl_assert(git_oid_cmp(&id, git_reference_target(resolved_ref)) == 0);
git_reference_free(looked_up_ref);
git_reference_free(resolved_ref);
@@ -58,7 +58,7 @@ void test_refs_create__symbolic(void)
cl_git_pass(git_reference_lookup(&looked_up_ref, repo2, new_head_tracker));
cl_git_pass(git_reference_resolve(&resolved_ref, looked_up_ref));
- cl_assert(git_oid_cmp(&id, git_reference_oid(resolved_ref)) == 0);
+ cl_assert(git_oid_cmp(&id, git_reference_target(resolved_ref)) == 0);
git_repository_free(repo2);
@@ -79,10 +79,10 @@ void test_refs_create__deep_symbolic(void)
git_oid_fromstr(&id, current_master_tip);
cl_git_pass(git_buf_joinpath(&ref_path, g_repo->path_repository, new_head_tracker));
- cl_git_pass(git_reference_create_symbolic(&new_reference, g_repo, new_head_tracker, current_head_target, 0));
+ cl_git_pass(git_reference_symbolic_create(&new_reference, g_repo, new_head_tracker, current_head_target, 0));
cl_git_pass(git_reference_lookup(&looked_up_ref, g_repo, new_head_tracker));
cl_git_pass(git_reference_resolve(&resolved_ref, looked_up_ref));
- cl_assert(git_oid_cmp(&id, git_reference_oid(resolved_ref)) == 0);
+ cl_assert(git_oid_cmp(&id, git_reference_target(resolved_ref)) == 0);
git_reference_free(new_reference);
git_reference_free(looked_up_ref);
@@ -106,7 +106,7 @@ void test_refs_create__oid(void)
cl_git_pass(git_buf_joinpath(&ref_path, g_repo->path_repository, new_head));
/* Create and write the new object id reference */
- cl_git_pass(git_reference_create_oid(&new_reference, g_repo, new_head, &id, 0));
+ cl_git_pass(git_reference_create(&new_reference, g_repo, new_head, &id, 0));
/* Ensure the reference can be looked-up... */
cl_git_pass(git_reference_lookup(&looked_up_ref, g_repo, new_head));
@@ -115,14 +115,14 @@ void test_refs_create__oid(void)
cl_assert_equal_s(looked_up_ref->name, new_head);
/* ...and that it points to the current master tip */
- cl_assert(git_oid_cmp(&id, git_reference_oid(looked_up_ref)) == 0);
+ cl_assert(git_oid_cmp(&id, git_reference_target(looked_up_ref)) == 0);
git_reference_free(looked_up_ref);
/* Similar test with a fresh new repository */
cl_git_pass(git_repository_open(&repo2, "testrepo"));
cl_git_pass(git_reference_lookup(&looked_up_ref, repo2, new_head));
- cl_assert(git_oid_cmp(&id, git_reference_oid(looked_up_ref)) == 0);
+ cl_assert(git_oid_cmp(&id, git_reference_target(looked_up_ref)) == 0);
git_repository_free(repo2);
@@ -142,7 +142,7 @@ void test_refs_create__oid_unknown(void)
git_oid_fromstr(&id, "deadbeef3f795b2b4353bcce3a527ad0a4f7f644");
/* Create and write the new object id reference */
- cl_git_fail(git_reference_create_oid(&new_reference, g_repo, new_head, &id, 0));
+ cl_git_fail(git_reference_create(&new_reference, g_repo, new_head, &id, 0));
/* Ensure the reference can't be looked-up... */
cl_git_fail(git_reference_lookup(&looked_up_ref, g_repo, new_head));
@@ -156,9 +156,9 @@ void test_refs_create__propagate_eexists(void)
/* Make sure it works for oid and for symbolic both */
git_oid_fromstr(&oid, current_master_tip);
- error = git_reference_create_oid(&ref, g_repo, current_head_target, &oid, false);
+ error = git_reference_create(&ref, g_repo, current_head_target, &oid, false);
cl_assert(error == GIT_EEXISTS);
- error = git_reference_create_symbolic(&ref, g_repo, "HEAD", current_head_target, false);
+ error = git_reference_symbolic_create(&ref, g_repo, "HEAD", current_head_target, false);
cl_assert(error == GIT_EEXISTS);
}
diff --git a/tests-clar/refs/delete.c b/tests-clar/refs/delete.c
index 912f414..cc5ab39 100644
--- a/tests-clar/refs/delete.c
+++ b/tests-clar/refs/delete.c
@@ -62,7 +62,7 @@ void test_refs_delete__packed_only(void)
git_oid_fromstr(&id, current_master_tip);
/* Create and write the new object id reference */
- cl_git_pass(git_reference_create_oid(&ref, g_repo, new_ref, &id, 0));
+ cl_git_pass(git_reference_create(&ref, g_repo, new_ref, &id, 0));
git_reference_free(ref);
/* Lookup the reference */
diff --git a/tests-clar/refs/foreachglob.c b/tests-clar/refs/foreachglob.c
index 8ecce9c..88516dd 100644
--- a/tests-clar/refs/foreachglob.c
+++ b/tests-clar/refs/foreachglob.c
@@ -12,7 +12,7 @@ void test_refs_foreachglob__initialize(void)
cl_git_pass(git_repository_open(&repo, "testrepo.git"));
cl_git_pass(git_oid_fromstr(&id, "be3563ae3f795b2b4353bcce3a527ad0a4f7f644"));
- cl_git_pass(git_reference_create_oid(&fake_remote, repo, "refs/remotes/nulltoken/master", &id, 0));
+ cl_git_pass(git_reference_create(&fake_remote, repo, "refs/remotes/nulltoken/master", &id, 0));
}
void test_refs_foreachglob__cleanup(void)
diff --git a/tests-clar/refs/lookup.c b/tests-clar/refs/lookup.c
index 71ab1b7..11fd68f 100644
--- a/tests-clar/refs/lookup.c
+++ b/tests-clar/refs/lookup.c
@@ -36,7 +36,7 @@ void test_refs_lookup__oid(void)
{
git_oid tag, expected;
- cl_git_pass(git_reference_name_to_oid(&tag, g_repo, "refs/tags/point_to_blob"));
+ cl_git_pass(git_reference_name_to_id(&tag, g_repo, "refs/tags/point_to_blob"));
cl_git_pass(git_oid_fromstr(&expected, "1385f264afb75a56a5bec74243be9b367ba4ca08"));
cl_assert(git_oid_cmp(&tag, &expected) == 0);
}
diff --git a/tests-clar/refs/overwrite.c b/tests-clar/refs/overwrite.c
index 410e39a..ebe7206 100644
--- a/tests-clar/refs/overwrite.c
+++ b/tests-clar/refs/overwrite.c
@@ -27,25 +27,25 @@ void test_refs_overwrite__symbolic(void)
git_reference *ref, *branch_ref;
/* The target needds to exist and we need to check the name has changed */
- cl_git_pass(git_reference_create_symbolic(&branch_ref, g_repo, ref_branch_name, ref_master_name, 0));
- cl_git_pass(git_reference_create_symbolic(&ref, g_repo, ref_name, ref_branch_name, 0));
+ cl_git_pass(git_reference_symbolic_create(&branch_ref, g_repo, ref_branch_name, ref_master_name, 0));
+ cl_git_pass(git_reference_symbolic_create(&ref, g_repo, ref_name, ref_branch_name, 0));
git_reference_free(ref);
/* Ensure it points to the right place*/
cl_git_pass(git_reference_lookup(&ref, g_repo, ref_name));
cl_assert(git_reference_type(ref) & GIT_REF_SYMBOLIC);
- cl_assert_equal_s(git_reference_target(ref), ref_branch_name);
+ cl_assert_equal_s(git_reference_symbolic_target(ref), ref_branch_name);
git_reference_free(ref);
/* Ensure we can't create it unless we force it to */
- cl_git_fail(git_reference_create_symbolic(&ref, g_repo, ref_name, ref_master_name, 0));
- cl_git_pass(git_reference_create_symbolic(&ref, g_repo, ref_name, ref_master_name, 1));
+ cl_git_fail(git_reference_symbolic_create(&ref, g_repo, ref_name, ref_master_name, 0));
+ cl_git_pass(git_reference_symbolic_create(&ref, g_repo, ref_name, ref_master_name, 1));
git_reference_free(ref);
/* Ensure it points to the right place */
cl_git_pass(git_reference_lookup(&ref, g_repo, ref_name));
cl_assert(git_reference_type(ref) & GIT_REF_SYMBOLIC);
- cl_assert_equal_s(git_reference_target(ref), ref_master_name);
+ cl_assert_equal_s(git_reference_symbolic_target(ref), ref_master_name);
git_reference_free(ref);
git_reference_free(branch_ref);
@@ -59,26 +59,26 @@ void test_refs_overwrite__object_id(void)
cl_git_pass(git_reference_lookup(&ref, g_repo, ref_master_name));
cl_assert(git_reference_type(ref) & GIT_REF_OID);
- git_oid_cpy(&id, git_reference_oid(ref));
+ git_oid_cpy(&id, git_reference_target(ref));
git_reference_free(ref);
/* Create it */
- cl_git_pass(git_reference_create_oid(&ref, g_repo, ref_name, &id, 0));
+ cl_git_pass(git_reference_create(&ref, g_repo, ref_name, &id, 0));
git_reference_free(ref);
cl_git_pass(git_reference_lookup(&ref, g_repo, ref_test_name));
cl_assert(git_reference_type(ref) & GIT_REF_OID);
- git_oid_cpy(&id, git_reference_oid(ref));
+ git_oid_cpy(&id, git_reference_target(ref));
git_reference_free(ref);
/* Ensure we can't overwrite unless we force it */
- cl_git_fail(git_reference_create_oid(&ref, g_repo, ref_name, &id, 0));
- cl_git_pass(git_reference_create_oid(&ref, g_repo, ref_name, &id, 1));
+ cl_git_fail(git_reference_create(&ref, g_repo, ref_name, &id, 0));
+ cl_git_pass(git_reference_create(&ref, g_repo, ref_name, &id, 1));
git_reference_free(ref);
/* Ensure it has been overwritten */
cl_git_pass(git_reference_lookup(&ref, g_repo, ref_name));
- cl_assert(!git_oid_cmp(&id, git_reference_oid(ref)));
+ cl_assert(!git_oid_cmp(&id, git_reference_target(ref)));
git_reference_free(ref);
}
@@ -91,19 +91,19 @@ void test_refs_overwrite__object_id_with_symbolic(void)
cl_git_pass(git_reference_lookup(&ref, g_repo, ref_master_name));
cl_assert(git_reference_type(ref) & GIT_REF_OID);
- git_oid_cpy(&id, git_reference_oid(ref));
+ git_oid_cpy(&id, git_reference_target(ref));
git_reference_free(ref);
- cl_git_pass(git_reference_create_oid(&ref, g_repo, ref_name, &id, 0));
+ cl_git_pass(git_reference_create(&ref, g_repo, ref_name, &id, 0));
git_reference_free(ref);
- cl_git_fail(git_reference_create_symbolic(&ref, g_repo, ref_name, ref_master_name, 0));
- cl_git_pass(git_reference_create_symbolic(&ref, g_repo, ref_name, ref_master_name, 1));
+ cl_git_fail(git_reference_symbolic_create(&ref, g_repo, ref_name, ref_master_name, 0));
+ cl_git_pass(git_reference_symbolic_create(&ref, g_repo, ref_name, ref_master_name, 1));
git_reference_free(ref);
/* Ensure it points to the right place */
cl_git_pass(git_reference_lookup(&ref, g_repo, ref_name));
cl_assert(git_reference_type(ref) & GIT_REF_SYMBOLIC);
- cl_assert_equal_s(git_reference_target(ref), ref_master_name);
+ cl_assert_equal_s(git_reference_symbolic_target(ref), ref_master_name);
git_reference_free(ref);
}
@@ -116,21 +116,21 @@ void test_refs_overwrite__symbolic_with_object_id(void)
cl_git_pass(git_reference_lookup(&ref, g_repo, ref_master_name));
cl_assert(git_reference_type(ref) & GIT_REF_OID);
- git_oid_cpy(&id, git_reference_oid(ref));
+ git_oid_cpy(&id, git_reference_target(ref));
git_reference_free(ref);
/* Create the symbolic ref */
- cl_git_pass(git_reference_create_symbolic(&ref, g_repo, ref_name, ref_master_name, 0));
+ cl_git_pass(git_reference_symbolic_create(&ref, g_repo, ref_name, ref_master_name, 0));
git_reference_free(ref);
/* It shouldn't overwrite unless we tell it to */
- cl_git_fail(git_reference_create_oid(&ref, g_repo, ref_name, &id, 0));
- cl_git_pass(git_reference_create_oid(&ref, g_repo, ref_name, &id, 1));
+ cl_git_fail(git_reference_create(&ref, g_repo, ref_name, &id, 0));
+ cl_git_pass(git_reference_create(&ref, g_repo, ref_name, &id, 1));
git_reference_free(ref);
/* Ensure it points to the right place */
cl_git_pass(git_reference_lookup(&ref, g_repo, ref_name));
cl_assert(git_reference_type(ref) & GIT_REF_OID);
- cl_assert(!git_oid_cmp(git_reference_oid(ref), &id));
+ cl_assert(!git_oid_cmp(git_reference_target(ref), &id));
git_reference_free(ref);
}
diff --git a/tests-clar/refs/read.c b/tests-clar/refs/read.c
index b867c97..c10a540 100644
--- a/tests-clar/refs/read.c
+++ b/tests-clar/refs/read.c
@@ -37,7 +37,7 @@ void test_refs_read__loose_tag(void)
cl_assert(git_reference_is_packed(reference) == 0);
cl_assert_equal_s(reference->name, loose_tag_ref_name);
- cl_git_pass(git_object_lookup(&object, g_repo, git_reference_oid(reference), GIT_OBJ_ANY));
+ cl_git_pass(git_object_lookup(&object, g_repo, git_reference_target(reference), GIT_OBJ_ANY));
cl_assert(object != NULL);
cl_assert(git_object_type(object) == GIT_OBJ_TAG);
@@ -77,7 +77,7 @@ void test_refs_read__symbolic(void)
cl_git_pass(git_reference_resolve(&resolved_ref, reference));
cl_assert(git_reference_type(resolved_ref) == GIT_REF_OID);
- cl_git_pass(git_object_lookup(&object, g_repo, git_reference_oid(resolved_ref), GIT_OBJ_ANY));
+ cl_git_pass(git_object_lookup(&object, g_repo, git_reference_target(resolved_ref), GIT_OBJ_ANY));
cl_assert(object != NULL);
cl_assert(git_object_type(object) == GIT_OBJ_COMMIT);
@@ -105,7 +105,7 @@ void test_refs_read__nested_symbolic(void)
cl_git_pass(git_reference_resolve(&resolved_ref, reference));
cl_assert(git_reference_type(resolved_ref) == GIT_REF_OID);
- cl_git_pass(git_object_lookup(&object, g_repo, git_reference_oid(resolved_ref), GIT_OBJ_ANY));
+ cl_git_pass(git_object_lookup(&object, g_repo, git_reference_target(resolved_ref), GIT_OBJ_ANY));
cl_assert(object != NULL);
cl_assert(git_object_type(object) == GIT_OBJ_COMMIT);
@@ -129,13 +129,13 @@ void test_refs_read__head_then_master(void)
cl_git_pass(git_reference_lookup(&reference, g_repo, GIT_HEAD_FILE));
cl_git_pass(git_reference_resolve(&resolved_ref, reference));
- cl_git_pass(git_oid_cmp(git_reference_oid(comp_base_ref), git_reference_oid(resolved_ref)));
+ cl_git_pass(git_oid_cmp(git_reference_target(comp_base_ref), git_reference_target(resolved_ref)));
git_reference_free(reference);
git_reference_free(resolved_ref);
cl_git_pass(git_reference_lookup(&reference, g_repo, current_head_target));
cl_git_pass(git_reference_resolve(&resolved_ref, reference));
- cl_git_pass(git_oid_cmp(git_reference_oid(comp_base_ref), git_reference_oid(resolved_ref)));
+ cl_git_pass(git_oid_cmp(git_reference_target(comp_base_ref), git_reference_target(resolved_ref)));
git_reference_free(reference);
git_reference_free(resolved_ref);
@@ -151,7 +151,7 @@ void test_refs_read__master_then_head(void)
cl_git_pass(git_reference_lookup(&reference, g_repo, GIT_HEAD_FILE));
cl_git_pass(git_reference_resolve(&resolved_ref, reference));
- cl_git_pass(git_oid_cmp(git_reference_oid(master_ref), git_reference_oid(resolved_ref)));
+ cl_git_pass(git_oid_cmp(git_reference_target(master_ref), git_reference_target(resolved_ref)));
git_reference_free(reference);
git_reference_free(resolved_ref);
@@ -170,7 +170,7 @@ void test_refs_read__packed(void)
cl_assert(git_reference_is_packed(reference));
cl_assert_equal_s(reference->name, packed_head_name);
- cl_git_pass(git_object_lookup(&object, g_repo, git_reference_oid(reference), GIT_OBJ_ANY));
+ cl_git_pass(git_object_lookup(&object, g_repo, git_reference_target(reference), GIT_OBJ_ANY));
cl_assert(object != NULL);
cl_assert(git_object_type(object) == GIT_OBJ_COMMIT);
@@ -200,7 +200,7 @@ void test_refs_read__chomped(void)
cl_git_pass(git_reference_lookup(&test, g_repo, "refs/heads/test"));
cl_git_pass(git_reference_lookup(&chomped, g_repo, "refs/heads/chomped"));
- cl_git_pass(git_oid_cmp(git_reference_oid(test), git_reference_oid(chomped)));
+ cl_git_pass(git_oid_cmp(git_reference_target(test), git_reference_target(chomped)));
git_reference_free(test);
git_reference_free(chomped);
@@ -212,7 +212,7 @@ void test_refs_read__trailing(void)
cl_git_pass(git_reference_lookup(&test, g_repo, "refs/heads/test"));
cl_git_pass(git_reference_lookup(&trailing, g_repo, "refs/heads/trailing"));
- cl_git_pass(git_oid_cmp(git_reference_oid(test), git_reference_oid(trailing)));
+ cl_git_pass(git_oid_cmp(git_reference_target(test), git_reference_target(trailing)));
git_reference_free(trailing);
cl_git_pass(git_reference_lookup(&trailing, g_repo, "FETCH_HEAD"));
diff --git a/tests-clar/refs/reflog/reflog.c b/tests-clar/refs/reflog/reflog.c
index 09b9356..4c3d0da 100644
--- a/tests-clar/refs/reflog/reflog.c
+++ b/tests-clar/refs/reflog/reflog.c
@@ -46,7 +46,7 @@ void test_refs_reflog_reflog__append_then_read(void)
/* Create a new branch pointing at the HEAD */
git_oid_fromstr(&oid, current_master_tip);
- cl_git_pass(git_reference_create_oid(&ref, g_repo, new_ref, &oid, 0));
+ cl_git_pass(git_reference_create(&ref, g_repo, new_ref, &oid, 0));
cl_git_pass(git_signature_now(&committer, "foo", "foo@bar"));
diff --git a/tests-clar/refs/rename.c b/tests-clar/refs/rename.c
index 19bf875..ec5c125 100644
--- a/tests-clar/refs/rename.c
+++ b/tests-clar/refs/rename.c
@@ -201,7 +201,7 @@ void test_refs_rename__force_loose_packed(void)
/* An existing reference... */
cl_git_pass(git_reference_lookup(&looked_up_ref, g_repo, packed_head_name));
- git_oid_cpy(&oid, git_reference_oid(looked_up_ref));
+ git_oid_cpy(&oid, git_reference_target(looked_up_ref));
/* Can be force-renamed to the name of another existing reference. */
cl_git_pass(git_reference_rename(looked_up_ref, packed_test_head_name, 1));
@@ -210,7 +210,7 @@ void test_refs_rename__force_loose_packed(void)
/* Check we actually renamed it */
cl_git_pass(git_reference_lookup(&looked_up_ref, g_repo, packed_test_head_name));
cl_assert_equal_s(looked_up_ref->name, packed_test_head_name);
- cl_assert(!git_oid_cmp(&oid, git_reference_oid(looked_up_ref)));
+ cl_assert(!git_oid_cmp(&oid, git_reference_target(looked_up_ref)));
git_reference_free(looked_up_ref);
/* And that the previous one doesn't exist any longer */
@@ -225,7 +225,7 @@ void test_refs_rename__force_loose(void)
/* An existing reference... */
cl_git_pass(git_reference_lookup(&looked_up_ref, g_repo, "refs/heads/br2"));
- git_oid_cpy(&oid, git_reference_oid(looked_up_ref));
+ git_oid_cpy(&oid, git_reference_target(looked_up_ref));
/* Can be force-renamed to the name of another existing reference. */
cl_git_pass(git_reference_rename(looked_up_ref, "refs/heads/test", 1));
@@ -234,7 +234,7 @@ void test_refs_rename__force_loose(void)
/* Check we actually renamed it */
cl_git_pass(git_reference_lookup(&looked_up_ref, g_repo, "refs/heads/test"));
cl_assert_equal_s(looked_up_ref->name, "refs/heads/test");
- cl_assert(!git_oid_cmp(&oid, git_reference_oid(looked_up_ref)));
+ cl_assert(!git_oid_cmp(&oid, git_reference_target(looked_up_ref)));
git_reference_free(looked_up_ref);
/* And that the previous one doesn't exist any longer */
@@ -253,17 +253,17 @@ void test_refs_rename__overwrite(void)
cl_git_pass(git_reference_lookup(&ref, g_repo, ref_master_name));
cl_assert(git_reference_type(ref) & GIT_REF_OID);
- git_oid_cpy(&id, git_reference_oid(ref));
+ git_oid_cpy(&id, git_reference_target(ref));
/* Create loose references */
- cl_git_pass(git_reference_create_oid(&ref_one, g_repo, ref_one_name, &id, 0));
- cl_git_pass(git_reference_create_oid(&ref_two, g_repo, ref_two_name, &id, 0));
+ cl_git_pass(git_reference_create(&ref_one, g_repo, ref_one_name, &id, 0));
+ cl_git_pass(git_reference_create(&ref_two, g_repo, ref_two_name, &id, 0));
/* Pack everything */
cl_git_pass(git_reference_packall(g_repo));
/* Attempt to create illegal reference */
- cl_git_fail(git_reference_create_oid(&ref_one_new, g_repo, ref_one_name_new, &id, 0));
+ cl_git_fail(git_reference_create(&ref_one_new, g_repo, ref_one_name_new, &id, 0));
/* Illegal reference couldn't be created so this is supposed to fail */
cl_git_fail(git_reference_lookup(&ref_one_new, g_repo, ref_one_name_new));
@@ -284,10 +284,10 @@ void test_refs_rename__prefix(void)
cl_git_pass(git_reference_lookup(&ref, g_repo, ref_master_name));
cl_assert(git_reference_type(ref) & GIT_REF_OID);
- git_oid_cpy(&id, git_reference_oid(ref));
+ git_oid_cpy(&id, git_reference_target(ref));
/* Create loose references */
- cl_git_pass(git_reference_create_oid(&ref_two, g_repo, ref_two_name, &id, 0));
+ cl_git_pass(git_reference_create(&ref_two, g_repo, ref_two_name, &id, 0));
/* An existing reference... */
cl_git_pass(git_reference_lookup(&looked_up_ref, g_repo, ref_two_name));
@@ -316,10 +316,10 @@ void test_refs_rename__move_up(void)
cl_git_pass(git_reference_lookup(&ref, g_repo, ref_master_name));
cl_assert(git_reference_type(ref) & GIT_REF_OID);
- git_oid_cpy(&id, git_reference_oid(ref));
+ git_oid_cpy(&id, git_reference_target(ref));
/* Create loose references */
- cl_git_pass(git_reference_create_oid(&ref_two, g_repo, ref_two_name_new, &id, 0));
+ cl_git_pass(git_reference_create(&ref_two, g_repo, ref_two_name_new, &id, 0));
git_reference_free(ref_two);
/* An existing reference... */
diff --git a/tests-clar/refs/revparse.c b/tests-clar/refs/revparse.c
index a1f0dbf..3698b51 100644
--- a/tests-clar/refs/revparse.c
+++ b/tests-clar/refs/revparse.c
@@ -468,11 +468,11 @@ void test_refs_revparse__issue_994(void)
cl_git_pass(git_repository_head(&head, repo));
- cl_git_pass(git_reference_create_oid(
+ cl_git_pass(git_reference_create(
&with_at,
repo,
"refs/remotes/origin/bim_with_3d@11296",
- git_reference_oid(head),
+ git_reference_target(head),
0));
cl_git_pass(git_revparse_single(&target, repo, "origin/bim_with_3d@11296"));
diff --git a/tests-clar/refs/unicode.c b/tests-clar/refs/unicode.c
index fbe95b1..424ee64 100644
--- a/tests-clar/refs/unicode.c
+++ b/tests-clar/refs/unicode.c
@@ -27,14 +27,14 @@ void test_refs_unicode__create_and_lookup(void)
/* Create the reference */
cl_git_pass(git_reference_lookup(&ref0, repo, master));
- cl_git_pass(git_reference_create_oid(&ref1, repo, REFNAME, git_reference_oid(ref0), 0));
+ cl_git_pass(git_reference_create(&ref1, repo, REFNAME, git_reference_target(ref0), 0));
cl_assert(strcmp(REFNAME, git_reference_name(ref1)) == 0);
/* Lookup the reference in a different instance of the repository */
cl_git_pass(git_repository_open(&repo2, "testrepo.git"));
cl_git_pass(git_reference_lookup(&ref2, repo2, REFNAME));
- cl_assert(git_oid_cmp(git_reference_oid(ref1), git_reference_oid(ref2)) == 0);
+ cl_assert(git_oid_cmp(git_reference_target(ref1), git_reference_target(ref2)) == 0);
cl_assert(strcmp(REFNAME, git_reference_name(ref2)) == 0);
git_reference_free(ref0);
diff --git a/tests-clar/repo/head.c b/tests-clar/repo/head.c
index 1c1e905..a9f5cfc 100644
--- a/tests-clar/repo/head.c
+++ b/tests-clar/repo/head.c
@@ -26,7 +26,7 @@ void test_repo_head__head_detached(void)
cl_assert_equal_i(true, git_repository_head_detached(repo));
/* take the reop back to it's original state */
- cl_git_pass(git_reference_create_symbolic(&ref, repo, "HEAD", "refs/heads/master", 1));
+ cl_git_pass(git_reference_symbolic_create(&ref, repo, "HEAD", "refs/heads/master", 1));
git_reference_free(ref);
cl_assert_equal_i(false, git_repository_head_detached(repo));
@@ -44,7 +44,7 @@ void test_repo_head__head_orphan(void)
/* take the repo back to it's original state */
- cl_git_pass(git_reference_create_symbolic(&ref, repo, "HEAD", "refs/heads/master", 1));
+ cl_git_pass(git_reference_symbolic_create(&ref, repo, "HEAD", "refs/heads/master", 1));
cl_assert(git_repository_head_orphan(repo) == 0);
git_reference_free(ref);
@@ -94,7 +94,7 @@ static void assert_head_is_correctly_detached(void)
cl_git_pass(git_repository_head(&head, repo));
- cl_git_pass(git_object_lookup(&commit, repo, git_reference_oid(head), GIT_OBJ_COMMIT));
+ cl_git_pass(git_object_lookup(&commit, repo, git_reference_target(head), GIT_OBJ_COMMIT));
git_object_free(commit);
git_reference_free(head);
@@ -156,7 +156,7 @@ void test_repo_head__detach_head_Fails_if_HEAD_and_point_to_a_non_commitish(void
{
git_reference *head;
- cl_git_pass(git_reference_create_symbolic(&head, repo, GIT_HEAD_FILE, "refs/tags/point_to_blob", 1));
+ cl_git_pass(git_reference_symbolic_create(&head, repo, GIT_HEAD_FILE, "refs/tags/point_to_blob", 1));
cl_git_fail(git_repository_detach_head(repo));
diff --git a/tests-clar/repo/init.c b/tests-clar/repo/init.c
index f29f540..3b14c97 100644
--- a/tests-clar/repo/init.c
+++ b/tests-clar/repo/init.c
@@ -353,7 +353,7 @@ void test_repo_init__extended_1(void)
cl_git_pass(git_reference_lookup(&ref, _repo, "HEAD"));
cl_assert(git_reference_type(ref) == GIT_REF_SYMBOLIC);
- cl_assert_equal_s("refs/heads/development", git_reference_target(ref));
+ cl_assert_equal_s("refs/heads/development", git_reference_symbolic_target(ref));
git_reference_free(ref);
cl_git_pass(git_remote_load(&remote, _repo, "origin"));
diff --git a/tests-clar/repo/repo_helpers.c b/tests-clar/repo/repo_helpers.c
index 19ab38e..74902e4 100644
--- a/tests-clar/repo/repo_helpers.c
+++ b/tests-clar/repo/repo_helpers.c
@@ -7,7 +7,7 @@ void make_head_orphaned(git_repository* repo, const char *target)
{
git_reference *head;
- cl_git_pass(git_reference_create_symbolic(&head, repo, GIT_HEAD_FILE, target, 1));
+ cl_git_pass(git_reference_symbolic_create(&head, repo, GIT_HEAD_FILE, target, 1));
git_reference_free(head);
}
diff --git a/tests-clar/reset/soft.c b/tests-clar/reset/soft.c
index 7914d46..9ebd637 100644
--- a/tests-clar/reset/soft.c
+++ b/tests-clar/reset/soft.c
@@ -24,7 +24,7 @@ static void assert_reset_soft(bool should_be_detached)
{
git_oid oid;
- cl_git_pass(git_reference_name_to_oid(&oid, repo, "HEAD"));
+ cl_git_pass(git_reference_name_to_id(&oid, repo, "HEAD"));
cl_git_fail(git_oid_streq(&oid, KNOWN_COMMIT_IN_BARE_REPO));
retrieve_target_from_oid(&target, repo, KNOWN_COMMIT_IN_BARE_REPO);
@@ -35,7 +35,7 @@ static void assert_reset_soft(bool should_be_detached)
cl_assert(git_repository_head_detached(repo) == should_be_detached);
- cl_git_pass(git_reference_name_to_oid(&oid, repo, "HEAD"));
+ cl_git_pass(git_reference_name_to_id(&oid, repo, "HEAD"));
cl_git_pass(git_oid_streq(&oid, KNOWN_COMMIT_IN_BARE_REPO));
}
@@ -56,7 +56,7 @@ void test_reset_soft__resetting_to_the_commit_pointed_at_by_the_Head_does_not_ch
git_oid oid;
char raw_head_oid[GIT_OID_HEXSZ + 1];
- cl_git_pass(git_reference_name_to_oid(&oid, repo, "HEAD"));
+ cl_git_pass(git_reference_name_to_id(&oid, repo, "HEAD"));
git_oid_fmt(raw_head_oid, &oid);
raw_head_oid[GIT_OID_HEXSZ] = '\0';
@@ -64,7 +64,7 @@ void test_reset_soft__resetting_to_the_commit_pointed_at_by_the_Head_does_not_ch
cl_git_pass(git_reset(repo, target, GIT_RESET_SOFT));
- cl_git_pass(git_reference_name_to_oid(&oid, repo, "HEAD"));
+ cl_git_pass(git_reference_name_to_id(&oid, repo, "HEAD"));
cl_git_pass(git_oid_streq(&oid, raw_head_oid));
}
@@ -78,7 +78,7 @@ void test_reset_soft__resetting_to_a_tag_sets_the_Head_to_the_peeled_commit(void
cl_git_pass(git_reset(repo, target, GIT_RESET_SOFT));
cl_assert(git_repository_head_detached(repo) == false);
- cl_git_pass(git_reference_name_to_oid(&oid, repo, "HEAD"));
+ cl_git_pass(git_reference_name_to_id(&oid, repo, "HEAD"));
cl_git_pass(git_oid_streq(&oid, KNOWN_COMMIT_IN_BARE_REPO));
}
@@ -110,7 +110,7 @@ void test_reset_soft__resetting_against_an_orphaned_head_repo_makes_the_head_no_
cl_assert_equal_i(false, git_repository_head_orphan(repo));
cl_git_pass(git_reference_lookup(&head, repo, NON_EXISTING_HEAD));
- cl_assert_equal_i(0, git_oid_streq(git_reference_oid(head), KNOWN_COMMIT_IN_BARE_REPO));
+ cl_assert_equal_i(0, git_oid_streq(git_reference_target(head), KNOWN_COMMIT_IN_BARE_REPO));
git_reference_free(head);
}
diff --git a/tests-clar/revwalk/signatureparsing.c b/tests-clar/revwalk/signatureparsing.c
index cf1d31e..4f29dd1 100644
--- a/tests-clar/revwalk/signatureparsing.c
+++ b/tests-clar/revwalk/signatureparsing.c
@@ -31,10 +31,10 @@ void test_revwalk_signatureparsing__do_not_choke_when_name_contains_angle_bracke
*/
cl_git_pass(git_reference_lookup(&ref, _repo, "refs/heads/haacked"));
- git_revwalk_push(_walk, git_reference_oid(ref));
+ git_revwalk_push(_walk, git_reference_target(ref));
cl_git_pass(git_revwalk_next(&commit_oid, _walk));
- cl_git_pass(git_commit_lookup(&commit, _repo, git_reference_oid(ref)));
+ cl_git_pass(git_commit_lookup(&commit, _repo, git_reference_target(ref)));
signature = git_commit_committer(commit);
cl_assert_equal_s("Yu V. Bin Haacked", signature->email);
diff --git a/tests-clar/stash/drop.c b/tests-clar/stash/drop.c
index 9d1aeda..26b5717 100644
--- a/tests-clar/stash/drop.c
+++ b/tests-clar/stash/drop.c
@@ -95,7 +95,7 @@ void test_stash_drop__dropping_an_entry_rewrites_reflog_history(void)
cl_git_pass(git_reflog_read(&reflog, stash));
entry = git_reflog_entry_byindex(reflog, 1);
- git_oid_cpy(&oid, git_reflog_entry_oidold(entry));
+ git_oid_cpy(&oid, git_reflog_entry_id_old(entry));
count = git_reflog_entrycount(reflog);
git_reflog_free(reflog);
@@ -105,7 +105,7 @@ void test_stash_drop__dropping_an_entry_rewrites_reflog_history(void)
cl_git_pass(git_reflog_read(&reflog, stash));
entry = git_reflog_entry_byindex(reflog, 0);
- cl_assert_equal_i(0, git_oid_cmp(&oid, git_reflog_entry_oidold(entry)));
+ cl_assert_equal_i(0, git_oid_cmp(&oid, git_reflog_entry_id_old(entry)));
cl_assert_equal_i(count - 1, git_reflog_entrycount(reflog));
git_reflog_free(reflog);
diff --git a/tests-clar/stash/save.c b/tests-clar/stash/save.c
index 4eaf2a3..f8b4278 100644
--- a/tests-clar/stash/save.c
+++ b/tests-clar/stash/save.c
@@ -193,7 +193,7 @@ void test_stash_save__cannot_stash_against_an_unborn_branch(void)
git_reference *head;
cl_git_pass(git_reference_lookup(&head, repo, "HEAD"));
- cl_git_pass(git_reference_set_target(head, "refs/heads/unborn"));
+ cl_git_pass(git_reference_symbolic_set_target(head, "refs/heads/unborn"));
cl_assert_equal_i(GIT_EORPHANEDHEAD,
git_stash_save(&stash_tip_oid, repo, signature, NULL, GIT_STASH_DEFAULT));
diff --git a/tests-clar/status/worktree.c b/tests-clar/status/worktree.c
index c154179..04e3ef1 100644
--- a/tests-clar/status/worktree.c
+++ b/tests-clar/status/worktree.c
@@ -482,7 +482,7 @@ static void fill_index_wth_head_entries(git_repository *repo, git_index *index)
git_commit *commit;
git_tree *tree;
- cl_git_pass(git_reference_name_to_oid(&oid, repo, "HEAD"));
+ cl_git_pass(git_reference_name_to_id(&oid, repo, "HEAD"));
cl_git_pass(git_commit_lookup(&commit, repo, &oid));
cl_git_pass(git_commit_tree(&tree, commit));