oid: Rename methods Yeah. Finally. Fuck the old names, this ain't POSIX and they don't make any sense at all.
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
diff --git a/examples/general.c b/examples/general.c
index 6362e96..1900f48 100644
--- a/examples/general.c
+++ b/examples/general.c
@@ -49,7 +49,7 @@ int main (int argc, char** argv)
// The `git_oid` is the structure that keeps the SHA value. We will use this throughout the example
// for storing the value of the current SHA key we're working with.
git_oid oid;
- git_oid_mkstr(&oid, hex);
+ git_oid_fromstr(&oid, hex);
// Once we've converted the string into the oid value, we can get the raw value of the SHA.
printf("Raw 20 bytes: [%s]\n", (&oid)->id);
@@ -133,7 +133,7 @@ int main (int argc, char** argv)
printf("\n*Commit Parsing*\n");
git_commit *commit;
- git_oid_mkstr(&oid, "f0877d0b841d75172ec404fc9370173dfffc20d1");
+ git_oid_fromstr(&oid, "f0877d0b841d75172ec404fc9370173dfffc20d1");
error = git_commit_lookup(&commit, repo, &oid);
@@ -192,8 +192,8 @@ int main (int argc, char** argv)
// Commit objects need a tree to point to and optionally one or more parents. Here we're creating oid
// objects to create the commit with, but you can also use
- git_oid_mkstr(&tree_id, "28873d96b4e8f4e33ea30f4c682fd325f7ba56ac");
- git_oid_mkstr(&parent_id, "f0877d0b841d75172ec404fc9370173dfffc20d1");
+ git_oid_fromstr(&tree_id, "28873d96b4e8f4e33ea30f4c682fd325f7ba56ac");
+ git_oid_fromstr(&parent_id, "f0877d0b841d75172ec404fc9370173dfffc20d1");
// Here we actually create the commit object with a single call with all the values we need to create
// the commit. The SHA key is written to the `commit_id` variable here.
@@ -222,7 +222,7 @@ int main (int argc, char** argv)
// We create an oid for the tag object if we know the SHA and look it up in the repository the same
// way that we would a commit (or any other) object.
- git_oid_mkstr(&oid, "bc422d45275aca289c51d79830b45cecebff7c3a");
+ git_oid_fromstr(&oid, "bc422d45275aca289c51d79830b45cecebff7c3a");
error = git_tag_lookup(&tag, repo, &oid);
@@ -250,7 +250,7 @@ int main (int argc, char** argv)
git_object *objt;
// Create the oid and lookup the tree object just like the other objects.
- git_oid_mkstr(&oid, "2a741c18ac5ff082a7caaec6e74db3075a1906b5");
+ git_oid_fromstr(&oid, "2a741c18ac5ff082a7caaec6e74db3075a1906b5");
git_tree_lookup(&tree, repo, &oid);
// Getting the count of entries in the tree so you can iterate over them if you want to.
@@ -284,7 +284,7 @@ int main (int argc, char** argv)
printf("\n*Blob Parsing*\n");
git_blob *blob;
- git_oid_mkstr(&oid, "af7574ea73f7b166f869ef1a39be126d9a186ae0");
+ git_oid_fromstr(&oid, "af7574ea73f7b166f869ef1a39be126d9a186ae0");
git_blob_lookup(&blob, repo, &oid);
// You can access a buffer with the raw contents of the blob directly.
@@ -308,7 +308,7 @@ int main (int argc, char** argv)
git_revwalk *walk;
git_commit *wcommit;
- git_oid_mkstr(&oid, "f0877d0b841d75172ec404fc9370173dfffc20d1");
+ git_oid_fromstr(&oid, "f0877d0b841d75172ec404fc9370173dfffc20d1");
// To use the revwalker, create a new walker, tell it how you want to sort the output and then push
// one or more starting points onto the walker. If you want to emulate the output of `git log` you
diff --git a/include/git2/oid.h b/include/git2/oid.h
index 3097a2d..74d5bd3 100644
--- a/include/git2/oid.h
+++ b/include/git2/oid.h
@@ -61,14 +61,14 @@ typedef struct {
* needed for an oid encoded in hex (40 bytes).
* @return GIT_SUCCESS if valid; GIT_ENOTOID on failure.
*/
-GIT_EXTERN(int) git_oid_mkstr(git_oid *out, const char *str);
+GIT_EXTERN(int) git_oid_fromstr(git_oid *out, const char *str);
/**
* Copy an already raw oid into a git_oid structure.
* @param out oid structure the result is written into.
* @param raw the raw input bytes to be copied.
*/
-GIT_EXTERN(void) git_oid_mkraw(git_oid *out, const unsigned char *raw);
+GIT_EXTERN(void) git_oid_fromraw(git_oid *out, const unsigned char *raw);
/**
* Format a git_oid into a hex string.
diff --git a/src/index.c b/src/index.c
index 08e2490..23fd52e 100644
--- a/src/index.c
+++ b/src/index.c
@@ -582,7 +582,7 @@ static int read_tree_internal(git_index_tree **out,
goto cleanup;
}
- git_oid_mkraw(&tree->oid, (const unsigned char *)buffer);
+ git_oid_fromraw(&tree->oid, (const unsigned char *)buffer);
buffer += GIT_OID_RAWSZ;
/* Parse children: */
@@ -670,7 +670,7 @@ static int read_unmerged(git_index *index, const char *buffer, size_t size)
continue;
if (size < 20)
return git__throw(GIT_ERROR, "Failed to read unmerged entries");
- git_oid_mkraw(&lost->oid[i], (unsigned char *) buffer);
+ git_oid_fromraw(&lost->oid[i], (unsigned char *) buffer);
size -= 20;
buffer += 20;
}
@@ -867,7 +867,7 @@ static int parse_index(git_index *index, const char *buffer, size_t buffer_size)
return git__throw(GIT_EOBJCORRUPTED, "Failed to parse index. Buffer size does not match index footer size");
/* 160-bit SHA-1 over the content of the index file before this checksum. */
- git_oid_mkraw(&checksum_expected, (const unsigned char *)buffer);
+ git_oid_fromraw(&checksum_expected, (const unsigned char *)buffer);
if (git_oid_cmp(&checksum_calculated, &checksum_expected) != 0)
return git__throw(GIT_EOBJCORRUPTED, "Failed to parse index. Calculated checksum does not match expected checksum");
diff --git a/src/odb_loose.c b/src/odb_loose.c
index 9564ef0..006ba9c 100644
--- a/src/odb_loose.c
+++ b/src/odb_loose.c
@@ -546,7 +546,7 @@ static int locate_object_short_oid(char *object_location, git_oid *res_oid, loos
}
/* Convert obtained hex formatted oid to raw */
- error = git_oid_mkstr(res_oid, (char *)state.res_oid);
+ error = git_oid_fromstr(res_oid, (char *)state.res_oid);
if (error) {
return git__rethrow(error, "Failed to locate object from short oid");
}
diff --git a/src/odb_pack.c b/src/odb_pack.c
index 29ceb02..d02338d 100644
--- a/src/odb_pack.c
+++ b/src/odb_pack.c
@@ -856,7 +856,7 @@ static int packfile_check(struct pack_file **pack_out, const char *path)
/* see if we can parse the sha1 oid in the packfile name */
if (path_len < 40 ||
- git_oid_mkstr(&p->sha1, path + path_len - GIT_OID_HEXSZ) < GIT_SUCCESS)
+ git_oid_fromstr(&p->sha1, path + path_len - GIT_OID_HEXSZ) < GIT_SUCCESS)
memset(&p->sha1, 0x0, GIT_OID_RAWSZ);
*pack_out = p;
@@ -1032,7 +1032,7 @@ static int pack_entry_find_offset(
return git__throw(GIT_EAMBIGUOUSOIDPREFIX, "Failed to find offset for pack entry. Ambiguous sha1 prefix within pack");
} else {
*offset_out = nth_packed_object_offset(p, pos);
- git_oid_mkraw(found_oid, current);
+ git_oid_fromraw(found_oid, current);
#ifdef INDEX_DEBUG_LOOKUP
unsigned char hex_sha1[GIT_OID_HEXSZ + 1];
diff --git a/src/oid.c b/src/oid.c
index 6bf4211..031be06 100644
--- a/src/oid.c
+++ b/src/oid.c
@@ -49,7 +49,7 @@ static signed char from_hex[] = {
};
static char to_hex[] = "0123456789abcdef";
-int git_oid_mkstr(git_oid *out, const char *str)
+int git_oid_fromstr(git_oid *out, const char *str)
{
size_t p;
for (p = 0; p < sizeof(out->id); p++, str += 2) {
@@ -135,7 +135,7 @@ int git__parse_oid(git_oid *oid, const char **buffer_out,
if (buffer[header_len + sha_len] != '\n')
return git__throw(GIT_EOBJCORRUPTED, "Failed to parse OID. Buffer not terminated correctly");
- if (git_oid_mkstr(oid, buffer + header_len) < GIT_SUCCESS)
+ if (git_oid_fromstr(oid, buffer + header_len) < GIT_SUCCESS)
return git__throw(GIT_EOBJCORRUPTED, "Failed to parse OID. Failed to generate sha1");
*buffer_out = buffer + (header_len + sha_len + 1);
@@ -157,7 +157,7 @@ int git__write_oid(git_odb_stream *stream, const char *header, const git_oid *oi
return GIT_SUCCESS;
}
-void git_oid_mkraw(git_oid *out, const unsigned char *raw)
+void git_oid_fromraw(git_oid *out, const unsigned char *raw)
{
memcpy(out->id, raw, sizeof(out->id));
}
diff --git a/src/refs.c b/src/refs.c
index 2aedb85..e74eca2 100644
--- a/src/refs.c
+++ b/src/refs.c
@@ -272,7 +272,7 @@ static int loose_parse_oid(git_reference *ref, gitfo_buf *file_content)
return git__throw(GIT_EOBJCORRUPTED,
"Failed to parse loose reference. Reference too short");
- if ((error = git_oid_mkstr(&ref_oid->oid, buffer)) < GIT_SUCCESS)
+ if ((error = git_oid_fromstr(&ref_oid->oid, buffer)) < GIT_SUCCESS)
return git__rethrow(GIT_EOBJCORRUPTED, "Failed to parse loose reference.");
buffer = buffer + GIT_OID_HEXSZ;
@@ -447,7 +447,7 @@ static int packed_parse_peel(
return git__throw(GIT_EPACKEDREFSCORRUPTED, "Failed to parse packed reference. Buffer too small");
/* Is this a valid object id? */
- if (git_oid_mkstr(&tag_ref->peel_target, buffer) < GIT_SUCCESS)
+ if (git_oid_fromstr(&tag_ref->peel_target, buffer) < GIT_SUCCESS)
return git__throw(GIT_EPACKEDREFSCORRUPTED, "Failed to parse packed reference. Not a valid object ID");
buffer = buffer + GIT_OID_HEXSZ;
@@ -487,7 +487,7 @@ static int packed_parse_oid(
}
/* Is this a valid object id? */
- if ((error = git_oid_mkstr(&id, buffer)) < GIT_SUCCESS)
+ if ((error = git_oid_fromstr(&id, buffer)) < GIT_SUCCESS)
goto cleanup;
refname_end = memchr(refname_begin, '\n', buffer_end - refname_begin);
diff --git a/src/revwalk.c b/src/revwalk.c
index b64b0e2..5152796 100644
--- a/src/revwalk.c
+++ b/src/revwalk.c
@@ -209,7 +209,7 @@ static int commit_quick_parse(git_revwalk *walk, commit_object *commit, git_rawo
for (i = 0; i < parents; ++i) {
git_oid oid;
- if (git_oid_mkstr(&oid, (char *)buffer + STRLEN("parent ")) < GIT_SUCCESS)
+ if (git_oid_fromstr(&oid, (char *)buffer + STRLEN("parent ")) < GIT_SUCCESS)
return git__throw(GIT_EOBJCORRUPTED, "Failed to parse commit. Parent object is corrupted");
commit->parents[i] = commit_lookup(walk, &oid);
diff --git a/src/tree.c b/src/tree.c
index fabcfd8..2c10ab8 100644
--- a/src/tree.c
+++ b/src/tree.c
@@ -183,7 +183,7 @@ static int tree_parse_buffer(git_tree *tree, const char *buffer, const char *buf
buffer++;
- git_oid_mkraw(&entry->oid, (const unsigned char *)buffer);
+ git_oid_fromraw(&entry->oid, (const unsigned char *)buffer);
buffer += GIT_OID_RAWSZ;
}
diff --git a/tests/t01-rawobj.c b/tests/t01-rawobj.c
index 5db9a79..d8cc63b 100644
--- a/tests/t01-rawobj.c
+++ b/tests/t01-rawobj.c
@@ -44,12 +44,12 @@ END_TEST
BEGIN_TEST(oid1, "fail when parsing an empty string as oid")
git_oid out;
- must_fail(git_oid_mkstr(&out, ""));
+ must_fail(git_oid_fromstr(&out, ""));
END_TEST
BEGIN_TEST(oid2, "fail when parsing an invalid string as oid")
git_oid out;
- must_fail(git_oid_mkstr(&out, "moo"));
+ must_fail(git_oid_fromstr(&out, "moo"));
END_TEST
static int from_hex(unsigned int i)
@@ -79,17 +79,17 @@ BEGIN_TEST(oid3, "find all invalid characters when parsing an oid")
if (from_hex(i) >= 0) {
exp[19] = (unsigned char)(from_hex(i) << 4);
- must_pass(git_oid_mkstr(&out, in));
+ must_pass(git_oid_fromstr(&out, in));
must_be_true(memcmp(out.id, exp, sizeof(out.id)) == 0);
} else {
- must_fail(git_oid_mkstr(&out, in));
+ must_fail(git_oid_fromstr(&out, in));
}
}
END_TEST
BEGIN_TEST(oid4, "fail when parsing an invalid oid string")
git_oid out;
- must_fail(git_oid_mkstr(&out, "16a67770b7d8d72317c4b775213c23a8bd74f5ez"));
+ must_fail(git_oid_fromstr(&out, "16a67770b7d8d72317c4b775213c23a8bd74f5ez"));
END_TEST
BEGIN_TEST(oid5, "succeed when parsing a valid oid string")
@@ -101,10 +101,10 @@ BEGIN_TEST(oid5, "succeed when parsing a valid oid string")
0xa8, 0xbd, 0x74, 0xf5, 0xe0,
};
- must_pass(git_oid_mkstr(&out, "16a67770b7d8d72317c4b775213c23a8bd74f5e0"));
+ must_pass(git_oid_fromstr(&out, "16a67770b7d8d72317c4b775213c23a8bd74f5e0"));
must_pass(memcmp(out.id, exp, sizeof(out.id)));
- must_pass(git_oid_mkstr(&out, "16A67770B7D8D72317C4b775213C23A8BD74F5E0"));
+ must_pass(git_oid_fromstr(&out, "16A67770B7D8D72317C4b775213C23A8BD74F5E0"));
must_pass(memcmp(out.id, exp, sizeof(out.id)));
END_TEST
@@ -117,7 +117,7 @@ BEGIN_TEST(oid6, "build a valid oid from raw bytes")
0xa8, 0xbd, 0x74, 0xf5, 0xe0,
};
- git_oid_mkraw(&out, exp);
+ git_oid_fromraw(&out, exp);
must_pass(memcmp(out.id, exp, sizeof(out.id)));
END_TEST
@@ -131,7 +131,7 @@ BEGIN_TEST(oid7, "properly copy an oid to another")
};
memset(&b, 0, sizeof(b));
- git_oid_mkraw(&a, exp);
+ git_oid_fromraw(&a, exp);
git_oid_cpy(&b, &a);
must_pass(memcmp(a.id, exp, sizeof(a.id)));
END_TEST
@@ -151,8 +151,8 @@ BEGIN_TEST(oid8, "compare two oids (lesser than)")
0xa8, 0xbd, 0x74, 0xf5, 0xf0,
};
- git_oid_mkraw(&a, a_in);
- git_oid_mkraw(&b, b_in);
+ git_oid_fromraw(&a, a_in);
+ git_oid_fromraw(&b, b_in);
must_be_true(git_oid_cmp(&a, &b) < 0);
END_TEST
@@ -165,8 +165,8 @@ BEGIN_TEST(oid9, "compare two oids (equal)")
0xa8, 0xbd, 0x74, 0xf5, 0xe0,
};
- git_oid_mkraw(&a, a_in);
- git_oid_mkraw(&b, a_in);
+ git_oid_fromraw(&a, a_in);
+ git_oid_fromraw(&b, a_in);
must_be_true(git_oid_cmp(&a, &b) == 0);
END_TEST
@@ -185,8 +185,8 @@ BEGIN_TEST(oid10, "compare two oids (greater than)")
0xa8, 0xbd, 0x74, 0xf5, 0xd0,
};
- git_oid_mkraw(&a, a_in);
- git_oid_mkraw(&b, b_in);
+ git_oid_fromraw(&a, a_in);
+ git_oid_fromraw(&b, b_in);
must_be_true(git_oid_cmp(&a, &b) > 0);
END_TEST
@@ -195,7 +195,7 @@ BEGIN_TEST(oid11, "compare formated oids")
git_oid in;
char out[GIT_OID_HEXSZ + 1];
- must_pass(git_oid_mkstr(&in, exp));
+ must_pass(git_oid_fromstr(&in, exp));
/* Format doesn't touch the last byte */
out[GIT_OID_HEXSZ] = 'Z';
@@ -212,7 +212,7 @@ BEGIN_TEST(oid12, "compare oids (allocate + format)")
git_oid in;
char *out;
- must_pass(git_oid_mkstr(&in, exp));
+ must_pass(git_oid_fromstr(&in, exp));
out = git_oid_allocfmt(&in);
must_be_true(out);
@@ -226,7 +226,7 @@ BEGIN_TEST(oid13, "compare oids (path format)")
git_oid in;
char out[GIT_OID_HEXSZ + 2];
- must_pass(git_oid_mkstr(&in, exp1));
+ must_pass(git_oid_fromstr(&in, exp1));
/* Format doesn't touch the last byte */
out[GIT_OID_HEXSZ + 1] = 'Z';
@@ -245,7 +245,7 @@ BEGIN_TEST(oid14, "convert raw oid to string")
char *str;
int i;
- must_pass(git_oid_mkstr(&in, exp));
+ must_pass(git_oid_fromstr(&in, exp));
/* NULL buffer pointer, returns static empty string */
str = git_oid_to_string(NULL, sizeof(out), &in);
@@ -288,7 +288,7 @@ BEGIN_TEST(oid15, "convert raw oid to string (big)")
char big[GIT_OID_HEXSZ + 1 + 3]; /* note + 4 => big buffer */
char *str;
- must_pass(git_oid_mkstr(&in, exp));
+ must_pass(git_oid_fromstr(&in, exp));
/* place some tail material */
big[GIT_OID_HEXSZ+0] = 'W'; /* should be '\0' afterwards */
@@ -412,14 +412,14 @@ BEGIN_TEST(hash0, "normal hash by blocks")
/* should already be init'd */
git_hash_update(ctx, hello_text, strlen(hello_text));
git_hash_final(&id2, ctx);
- must_pass(git_oid_mkstr(&id1, hello_id));
+ must_pass(git_oid_fromstr(&id1, hello_id));
must_be_true(git_oid_cmp(&id1, &id2) == 0);
/* reinit should permit reuse */
git_hash_init(ctx);
git_hash_update(ctx, bye_text, strlen(bye_text));
git_hash_final(&id2, ctx);
- must_pass(git_oid_mkstr(&id1, bye_id));
+ must_pass(git_oid_fromstr(&id1, bye_id));
must_be_true(git_oid_cmp(&id1, &id2) == 0);
git_hash_free_ctx(ctx);
@@ -428,7 +428,7 @@ END_TEST
BEGIN_TEST(hash1, "hash whole buffer in a single call")
git_oid id1, id2;
- must_pass(git_oid_mkstr(&id1, hello_id));
+ must_pass(git_oid_fromstr(&id1, hello_id));
git_hash_buf(&id2, hello_text, strlen(hello_text));
@@ -439,7 +439,7 @@ BEGIN_TEST(hash2, "hash a vector")
git_oid id1, id2;
git_buf_vec vec[2];
- must_pass(git_oid_mkstr(&id1, hello_id));
+ must_pass(git_oid_fromstr(&id1, hello_id));
vec[0].data = hello_text;
vec[0].len = 4;
@@ -500,7 +500,7 @@ END_TEST
BEGIN_TEST(objhash0, "hash junk data")
git_oid id, id_zero;
- must_pass(git_oid_mkstr(&id_zero, zero_id));
+ must_pass(git_oid_fromstr(&id_zero, zero_id));
/* invalid types: */
junk_obj.data = some_data;
@@ -531,7 +531,7 @@ END_TEST
BEGIN_TEST(objhash1, "hash a commit object")
git_oid id1, id2;
- must_pass(git_oid_mkstr(&id1, commit_id));
+ must_pass(git_oid_fromstr(&id1, commit_id));
must_pass(hash_object(&id2, &commit_obj));
@@ -541,7 +541,7 @@ END_TEST
BEGIN_TEST(objhash2, "hash a tree object")
git_oid id1, id2;
- must_pass(git_oid_mkstr(&id1, tree_id));
+ must_pass(git_oid_fromstr(&id1, tree_id));
must_pass(hash_object(&id2, &tree_obj));
@@ -551,7 +551,7 @@ END_TEST
BEGIN_TEST(objhash3, "hash a tag object")
git_oid id1, id2;
- must_pass(git_oid_mkstr(&id1, tag_id));
+ must_pass(git_oid_fromstr(&id1, tag_id));
must_pass(hash_object(&id2, &tag_obj));
@@ -561,7 +561,7 @@ END_TEST
BEGIN_TEST(objhash4, "hash a zero-length object")
git_oid id1, id2;
- must_pass(git_oid_mkstr(&id1, zero_id));
+ must_pass(git_oid_fromstr(&id1, zero_id));
must_pass(hash_object(&id2, &zero_obj));
@@ -571,7 +571,7 @@ END_TEST
BEGIN_TEST(objhash5, "hash an one-byte long object")
git_oid id1, id2;
- must_pass(git_oid_mkstr(&id1, one_id));
+ must_pass(git_oid_fromstr(&id1, one_id));
must_pass(hash_object(&id2, &one_obj));
@@ -581,7 +581,7 @@ END_TEST
BEGIN_TEST(objhash6, "hash a two-byte long object")
git_oid id1, id2;
- must_pass(git_oid_mkstr(&id1, two_id));
+ must_pass(git_oid_fromstr(&id1, two_id));
must_pass(hash_object(&id2, &two_obj));
@@ -591,7 +591,7 @@ END_TEST
BEGIN_TEST(objhash7, "hash an object several bytes long")
git_oid id1, id2;
- must_pass(git_oid_mkstr(&id1, some_id));
+ must_pass(git_oid_fromstr(&id1, some_id));
must_pass(hash_object(&id2, &some_obj));
diff --git a/tests/t02-objread.c b/tests/t02-objread.c
index 85b03b0..8f11e9e 100644
--- a/tests/t02-objread.c
+++ b/tests/t02-objread.c
@@ -36,12 +36,12 @@ BEGIN_TEST(existsloose0, "check if a loose object exists on the odb")
must_pass(write_object_files(odb_dir, &one));
must_pass(git_odb_open(&db, odb_dir));
- must_pass(git_oid_mkstr(&id, one.id));
+ must_pass(git_oid_fromstr(&id, one.id));
must_be_true(git_odb_exists(db, &id));
/* Test for a non-existant object */
- must_pass(git_oid_mkstr(&id2, "8b137891791fe96927ad78e64b0aad7bded08baa"));
+ must_pass(git_oid_fromstr(&id2, "8b137891791fe96927ad78e64b0aad7bded08baa"));
must_be_true(0 == git_odb_exists(db, &id2));
git_odb_close(db);
@@ -55,7 +55,7 @@ BEGIN_TEST(readloose0, "read a loose commit")
must_pass(write_object_files(odb_dir, &commit));
must_pass(git_odb_open(&db, odb_dir));
- must_pass(git_oid_mkstr(&id, commit.id));
+ must_pass(git_oid_fromstr(&id, commit.id));
must_pass(git_odb_read(&obj, db, &id));
must_pass(cmp_objects((git_rawobj *)&obj->raw, &commit));
@@ -72,7 +72,7 @@ BEGIN_TEST(readloose1, "read a loose tree")
must_pass(write_object_files(odb_dir, &tree));
must_pass(git_odb_open(&db, odb_dir));
- must_pass(git_oid_mkstr(&id, tree.id));
+ must_pass(git_oid_fromstr(&id, tree.id));
must_pass(git_odb_read(&obj, db, &id));
must_pass(cmp_objects((git_rawobj *)&obj->raw, &tree));
@@ -89,7 +89,7 @@ BEGIN_TEST(readloose2, "read a loose tag")
must_pass(write_object_files(odb_dir, &tag));
must_pass(git_odb_open(&db, odb_dir));
- must_pass(git_oid_mkstr(&id, tag.id));
+ must_pass(git_oid_fromstr(&id, tag.id));
must_pass(git_odb_read(&obj, db, &id));
must_pass(cmp_objects((git_rawobj *)&obj->raw, &tag));
@@ -106,7 +106,7 @@ BEGIN_TEST(readloose3, "read a loose zero-bytes object")
must_pass(write_object_files(odb_dir, &zero));
must_pass(git_odb_open(&db, odb_dir));
- must_pass(git_oid_mkstr(&id, zero.id));
+ must_pass(git_oid_fromstr(&id, zero.id));
must_pass(git_odb_read(&obj, db, &id));
must_pass(cmp_objects((git_rawobj *)&obj->raw, &zero));
@@ -123,7 +123,7 @@ BEGIN_TEST(readloose4, "read a one-byte long loose object")
must_pass(write_object_files(odb_dir, &one));
must_pass(git_odb_open(&db, odb_dir));
- must_pass(git_oid_mkstr(&id, one.id));
+ must_pass(git_oid_fromstr(&id, one.id));
must_pass(git_odb_read(&obj, db, &id));
must_pass(cmp_objects(&obj->raw, &one));
@@ -140,7 +140,7 @@ BEGIN_TEST(readloose5, "read a two-bytes long loose object")
must_pass(write_object_files(odb_dir, &two));
must_pass(git_odb_open(&db, odb_dir));
- must_pass(git_oid_mkstr(&id, two.id));
+ must_pass(git_oid_fromstr(&id, two.id));
must_pass(git_odb_read(&obj, db, &id));
must_pass(cmp_objects(&obj->raw, &two));
@@ -157,7 +157,7 @@ BEGIN_TEST(readloose6, "read a loose object which is several bytes long")
must_pass(write_object_files(odb_dir, &some));
must_pass(git_odb_open(&db, odb_dir));
- must_pass(git_oid_mkstr(&id, some.id));
+ must_pass(git_oid_fromstr(&id, some.id));
must_pass(git_odb_read(&obj, db, &id));
must_pass(cmp_objects(&obj->raw, &some));
@@ -177,7 +177,7 @@ BEGIN_TEST(readpack0, "read several packed objects")
git_oid id;
git_odb_object *obj;
- must_pass(git_oid_mkstr(&id, packed_objects[i]));
+ must_pass(git_oid_fromstr(&id, packed_objects[i]));
must_be_true(git_odb_exists(db, &id) == 1);
must_pass(git_odb_read(&obj, db, &id));
@@ -199,7 +199,7 @@ BEGIN_TEST(readheader0, "read only the header of several packed objects")
size_t len;
git_otype type;
- must_pass(git_oid_mkstr(&id, packed_objects[i]));
+ must_pass(git_oid_fromstr(&id, packed_objects[i]));
must_pass(git_odb_read(&obj, db, &id));
must_pass(git_odb_read_header(&len, &type, db, &id));
@@ -225,7 +225,7 @@ BEGIN_TEST(readheader1, "read only the header of several loose objects")
size_t len;
git_otype type;
- must_pass(git_oid_mkstr(&id, loose_objects[i]));
+ must_pass(git_oid_fromstr(&id, loose_objects[i]));
must_be_true(git_odb_exists(db, &id) == 1);
diff --git a/tests/t03-objwrite.c b/tests/t03-objwrite.c
index 7738873..08ddc0f 100644
--- a/tests/t03-objwrite.c
+++ b/tests/t03-objwrite.c
@@ -104,7 +104,7 @@ BEGIN_TEST(write0, "write loose commit object")
must_pass(make_odb_dir());
must_pass(git_odb_open(&db, odb_dir));
- must_pass(git_oid_mkstr(&id1, commit.id));
+ must_pass(git_oid_fromstr(&id1, commit.id));
must_pass(streaming_write(&id2, db, &commit_obj));
must_be_true(git_oid_cmp(&id1, &id2) == 0);
@@ -125,7 +125,7 @@ BEGIN_TEST(write1, "write loose tree object")
must_pass(make_odb_dir());
must_pass(git_odb_open(&db, odb_dir));
- must_pass(git_oid_mkstr(&id1, tree.id));
+ must_pass(git_oid_fromstr(&id1, tree.id));
must_pass(streaming_write(&id2, db, &tree_obj));
must_be_true(git_oid_cmp(&id1, &id2) == 0);
@@ -146,7 +146,7 @@ BEGIN_TEST(write2, "write loose tag object")
must_pass(make_odb_dir());
must_pass(git_odb_open(&db, odb_dir));
- must_pass(git_oid_mkstr(&id1, tag.id));
+ must_pass(git_oid_fromstr(&id1, tag.id));
must_pass(streaming_write(&id2, db, &tag_obj));
must_be_true(git_oid_cmp(&id1, &id2) == 0);
@@ -167,7 +167,7 @@ BEGIN_TEST(write3, "write zero-length object")
must_pass(make_odb_dir());
must_pass(git_odb_open(&db, odb_dir));
- must_pass(git_oid_mkstr(&id1, zero.id));
+ must_pass(git_oid_fromstr(&id1, zero.id));
must_pass(streaming_write(&id2, db, &zero_obj));
must_be_true(git_oid_cmp(&id1, &id2) == 0);
@@ -188,7 +188,7 @@ BEGIN_TEST(write4, "write one-byte long object")
must_pass(make_odb_dir());
must_pass(git_odb_open(&db, odb_dir));
- must_pass(git_oid_mkstr(&id1, one.id));
+ must_pass(git_oid_fromstr(&id1, one.id));
must_pass(streaming_write(&id2, db, &one_obj));
must_be_true(git_oid_cmp(&id1, &id2) == 0);
@@ -209,7 +209,7 @@ BEGIN_TEST(write5, "write two-byte long object")
must_pass(make_odb_dir());
must_pass(git_odb_open(&db, odb_dir));
- must_pass(git_oid_mkstr(&id1, two.id));
+ must_pass(git_oid_fromstr(&id1, two.id));
must_pass(streaming_write(&id2, db, &two_obj));
must_be_true(git_oid_cmp(&id1, &id2) == 0);
@@ -230,7 +230,7 @@ BEGIN_TEST(write6, "write an object which is several bytes long")
must_pass(make_odb_dir());
must_pass(git_odb_open(&db, odb_dir));
- must_pass(git_oid_mkstr(&id1, some.id));
+ must_pass(git_oid_fromstr(&id1, some.id));
must_pass(streaming_write(&id2, db, &some_obj));
must_be_true(git_oid_cmp(&id1, &id2) == 0);
diff --git a/tests/t04-commit.c b/tests/t04-commit.c
index 36f3e66..0ae0cdf 100644
--- a/tests/t04-commit.c
+++ b/tests/t04-commit.c
@@ -370,7 +370,7 @@ BEGIN_TEST(details0, "query the details on a parsed commit")
unsigned int parents, p;
git_commit *parent = NULL, *old_parent = NULL;
- git_oid_mkstr(&id, commit_ids[i]);
+ git_oid_fromstr(&id, commit_ids[i]);
must_pass(git_commit_lookup(&commit, repo, &id));
@@ -426,8 +426,8 @@ BEGIN_TEST(write0, "write a new commit object from memory to disk")
must_pass(git_repository_open(&repo, REPOSITORY_FOLDER));
- git_oid_mkstr(&tree_id, tree_oid);
- git_oid_mkstr(&parent_id, commit_ids[4]);
+ git_oid_fromstr(&tree_id, tree_oid);
+ git_oid_fromstr(&parent_id, commit_ids[4]);
/* create signatures */
committer = git_signature_new(COMMITTER_NAME, COMMITTER_EMAIL, 123456789, 60);
@@ -489,7 +489,7 @@ BEGIN_TEST(root0, "create a root commit")
must_pass(git_repository_open(&repo, REPOSITORY_FOLDER));
- git_oid_mkstr(&tree_id, tree_oid);
+ git_oid_fromstr(&tree_id, tree_oid);
/* create signatures */
committer = git_signature_new(COMMITTER_NAME, COMMITTER_EMAIL, 123456789, 60);
diff --git a/tests/t05-revwalk.c b/tests/t05-revwalk.c
index cfcf010..ac5de21 100644
--- a/tests/t05-revwalk.c
+++ b/tests/t05-revwalk.c
@@ -124,7 +124,7 @@ BEGIN_TEST(walk0, "do a simple walk on a repo with different sorting modes")
must_pass(git_repository_open(&repo, REPOSITORY_FOLDER));
must_pass(git_revwalk_new(&walk, repo));
- git_oid_mkstr(&id, commit_head);
+ git_oid_fromstr(&id, commit_head);
must_pass(test_walk(walk, &id, GIT_SORT_TIME, commit_sorting_time, 1));
must_pass(test_walk(walk, &id, GIT_SORT_TOPOLOGICAL, commit_sorting_topo, 2));
diff --git a/tests/t06-index.c b/tests/t06-index.c
index 621deab..51f8936 100644
--- a/tests/t06-index.c
+++ b/tests/t06-index.c
@@ -196,7 +196,7 @@ BEGIN_TEST(add0, "add a new file to the index")
* This has been generated by executing the following
* $ echo "hey there" | git hash-object --stdin
*/
- must_pass(git_oid_mkstr(&id1, "a8233120f6ad708f843d861ce2b7228ec4e3dec6"));
+ must_pass(git_oid_fromstr(&id1, "a8233120f6ad708f843d861ce2b7228ec4e3dec6"));
/* Add the new file to the index */
must_pass(git_index_add(index, "test.txt", 0));
diff --git a/tests/t08-tag.c b/tests/t08-tag.c
index fae2e99..48d48fe 100644
--- a/tests/t08-tag.c
+++ b/tests/t08-tag.c
@@ -39,9 +39,9 @@ BEGIN_TEST(read0, "read and parse a tag from the repository")
must_pass(git_repository_open(&repo, REPOSITORY_FOLDER));
- git_oid_mkstr(&id1, tag1_id);
- git_oid_mkstr(&id2, tag2_id);
- git_oid_mkstr(&id_commit, tagged_commit);
+ git_oid_fromstr(&id1, tag1_id);
+ git_oid_fromstr(&id2, tag2_id);
+ git_oid_fromstr(&id_commit, tagged_commit);
must_pass(git_tag_lookup(&tag1, repo, &id1));
@@ -91,7 +91,7 @@ BEGIN_TEST(write0, "write a tag to the repository and read it again")
must_pass(git_repository_open(&repo, REPOSITORY_FOLDER));
- git_oid_mkstr(&target_id, tagged_commit);
+ git_oid_fromstr(&target_id, tagged_commit);
/* create signature */
tagger = git_signature_new(TAGGER_NAME, TAGGER_EMAIL, 123456789, 60);
@@ -139,7 +139,7 @@ BEGIN_TEST(write1, "write a tag to the repository which points to an unknown oid
must_pass(git_repository_open(&repo, REPOSITORY_FOLDER));
- git_oid_mkstr(&target_id, "deadbeef1b46c854b31185ea97743be6a8774479");
+ git_oid_fromstr(&target_id, "deadbeef1b46c854b31185ea97743be6a8774479");
/* create signature */
tagger = git_signature_new(TAGGER_NAME, TAGGER_EMAIL, 123456789, 60);
@@ -167,7 +167,7 @@ BEGIN_TEST(write2, "Attempt to write a tag bearing the same name than an already
must_pass(git_repository_open(&repo, REPOSITORY_FOLDER));
- git_oid_mkstr(&target_id, tagged_commit);
+ git_oid_fromstr(&target_id, tagged_commit);
/* create signature */
tagger = git_signature_new(TAGGER_NAME, TAGGER_EMAIL, 123456789, 60);
@@ -196,7 +196,7 @@ BEGIN_TEST(write3, "Replace an already existing tag")
must_pass(open_temp_repo(&repo, REPOSITORY_FOLDER));
- git_oid_mkstr(&target_id, tagged_commit);
+ git_oid_fromstr(&target_id, tagged_commit);
must_pass(git_reference_lookup(&ref_tag, repo, "refs/tags/e90810b"));
git_oid_cpy(&old_tag_id, git_reference_oid(ref_tag));
diff --git a/tests/t09-tree.c b/tests/t09-tree.c
index 8062d53..640deab 100644
--- a/tests/t09-tree.c
+++ b/tests/t09-tree.c
@@ -71,7 +71,7 @@ BEGIN_TEST(read0, "acces randomly the entries on a loaded tree")
must_pass(git_repository_open(&repo, REPOSITORY_FOLDER));
- git_oid_mkstr(&id, tree_oid);
+ git_oid_fromstr(&id, tree_oid);
must_pass(git_tree_lookup(&tree, repo, &id));
@@ -96,7 +96,7 @@ BEGIN_TEST(read1, "read a tree from the repository")
must_pass(git_repository_open(&repo, REPOSITORY_FOLDER));
- git_oid_mkstr(&id, tree_oid);
+ git_oid_fromstr(&id, tree_oid);
must_pass(git_tree_lookup(&tree, repo, &id));
@@ -143,9 +143,9 @@ BEGIN_TEST(write2, "write a tree from a memory")
git_oid id, bid, rid, id2;
must_pass(open_temp_repo(&repo, REPOSITORY_FOLDER));
- git_oid_mkstr(&id, first_tree);
- git_oid_mkstr(&id2, second_tree);
- git_oid_mkstr(&bid, blob_oid);
+ git_oid_fromstr(&id, first_tree);
+ git_oid_fromstr(&id2, second_tree);
+ git_oid_fromstr(&bid, blob_oid);
//create a second tree from first tree using `git_treebuilder_insert` on REPOSITORY_FOLDER.
must_pass(git_tree_lookup(&tree, repo, &id));
@@ -168,10 +168,10 @@ BEGIN_TEST(write3, "write a hierarchical tree from a memory")
git_oid id_hiearar;
must_pass(open_temp_repo(&repo, REPOSITORY_FOLDER));
- git_oid_mkstr(&id, first_tree);
- git_oid_mkstr(&id2, second_tree);
- git_oid_mkstr(&id3, third_tree);
- git_oid_mkstr(&bid, blob_oid);
+ git_oid_fromstr(&id, first_tree);
+ git_oid_fromstr(&id2, second_tree);
+ git_oid_fromstr(&id3, third_tree);
+ git_oid_fromstr(&bid, blob_oid);
//create subtree
must_pass(git_treebuilder_create(&builder, NULL));
diff --git a/tests/t10-refs.c b/tests/t10-refs.c
index 3c9df43..054991c 100644
--- a/tests/t10-refs.c
+++ b/tests/t10-refs.c
@@ -89,7 +89,7 @@ BEGIN_TEST(readsym0, "lookup a symbolic reference")
must_be_true(object != NULL);
must_be_true(git_object_type(object) == GIT_OBJ_COMMIT);
- git_oid_mkstr(&id, current_master_tip);
+ git_oid_fromstr(&id, current_master_tip);
must_be_true(git_oid_cmp(&id, git_object_id(object)) == 0);
git_object_close(object);
@@ -116,7 +116,7 @@ BEGIN_TEST(readsym1, "lookup a nested symbolic reference")
must_be_true(object != NULL);
must_be_true(git_object_type(object) == GIT_OBJ_COMMIT);
- git_oid_mkstr(&id, current_master_tip);
+ git_oid_fromstr(&id, current_master_tip);
must_be_true(git_oid_cmp(&id, git_object_id(object)) == 0);
git_object_close(object);
@@ -204,7 +204,7 @@ BEGIN_TEST(create0, "create a new symbolic reference")
const char *new_head_tracker = "another-head-tracker";
- git_oid_mkstr(&id, current_master_tip);
+ git_oid_fromstr(&id, current_master_tip);
must_pass(open_temp_repo(&repo, REPOSITORY_FOLDER));
@@ -247,7 +247,7 @@ BEGIN_TEST(create1, "create a deep symbolic reference")
const char *new_head_tracker = "deep/rooted/tracker";
- git_oid_mkstr(&id, current_master_tip);
+ git_oid_fromstr(&id, current_master_tip);
must_pass(open_temp_repo(&repo, REPOSITORY_FOLDER));
@@ -268,7 +268,7 @@ BEGIN_TEST(create2, "create a new OID reference")
const char *new_head = "refs/heads/new-head";
- git_oid_mkstr(&id, current_master_tip);
+ git_oid_fromstr(&id, current_master_tip);
must_pass(open_temp_repo(&repo, REPOSITORY_FOLDER));
@@ -305,7 +305,7 @@ BEGIN_TEST(create3, "Can not create a new OID reference which targets at an unkn
const char *new_head = "refs/heads/new-head";
- git_oid_mkstr(&id, "deadbeef3f795b2b4353bcce3a527ad0a4f7f644");
+ git_oid_fromstr(&id, "deadbeef3f795b2b4353bcce3a527ad0a4f7f644");
must_pass(git_repository_open(&repo, REPOSITORY_FOLDER));