summaryrefslogtreecommitdiff
path: root/tests/libgit2/object/tree
diff options
context:
space:
mode:
Diffstat (limited to 'tests/libgit2/object/tree')
-rw-r--r--tests/libgit2/object/tree/attributes.c10
-rw-r--r--tests/libgit2/object/tree/duplicateentries.c28
-rw-r--r--tests/libgit2/object/tree/frompath.c2
-rw-r--r--tests/libgit2/object/tree/parse.c2
-rw-r--r--tests/libgit2/object/tree/read.c4
-rw-r--r--tests/libgit2/object/tree/update.c62
-rw-r--r--tests/libgit2/object/tree/walk.c6
-rw-r--r--tests/libgit2/object/tree/write.c44
8 files changed, 82 insertions, 76 deletions
diff --git a/tests/libgit2/object/tree/attributes.c b/tests/libgit2/object/tree/attributes.c
index 8654dfa31..285d19804 100644
--- a/tests/libgit2/object/tree/attributes.c
+++ b/tests/libgit2/object/tree/attributes.c
@@ -21,7 +21,7 @@ void test_object_tree_attributes__ensure_correctness_of_attributes_on_insertion(
git_treebuilder *builder;
git_oid oid;
- cl_git_pass(git_oid_fromstr(&oid, blob_oid));
+ cl_git_pass(git_oid__fromstr(&oid, blob_oid, GIT_OID_SHA1));
cl_git_pass(git_treebuilder_new(&builder, repo, NULL));
@@ -39,7 +39,7 @@ void test_object_tree_attributes__group_writable_tree_entries_created_with_an_an
const git_tree_entry *entry;
- cl_git_pass(git_oid_fromstr(&tid, tree_oid));
+ cl_git_pass(git_oid__fromstr(&tid, tree_oid, GIT_OID_SHA1));
cl_git_pass(git_tree_lookup(&tree, repo, &tid));
entry = git_tree_entry_byname(tree, "old_mode.txt");
@@ -56,7 +56,7 @@ void test_object_tree_attributes__treebuilder_reject_invalid_filemode(void)
git_oid bid;
const git_tree_entry *entry;
- cl_git_pass(git_oid_fromstr(&bid, blob_oid));
+ cl_git_pass(git_oid__fromstr(&bid, blob_oid, GIT_OID_SHA1));
cl_git_pass(git_treebuilder_new(&builder, repo, NULL));
cl_git_fail(git_treebuilder_insert(
@@ -76,7 +76,7 @@ void test_object_tree_attributes__normalize_attributes_when_creating_a_tree_from
git_tree *tree;
const git_tree_entry *entry;
- cl_git_pass(git_oid_fromstr(&tid, tree_oid));
+ cl_git_pass(git_oid__fromstr(&tid, tree_oid, GIT_OID_SHA1));
cl_git_pass(git_tree_lookup(&tree, repo, &tid));
cl_git_pass(git_treebuilder_new(&builder, repo, tree));
@@ -107,7 +107,7 @@ void test_object_tree_attributes__normalize_600(void)
git_tree *tree;
const git_tree_entry *entry;
- git_oid_fromstr(&id, "0810fb7818088ff5ac41ee49199b51473b1bd6c7");
+ git_oid__fromstr(&id, "0810fb7818088ff5ac41ee49199b51473b1bd6c7", GIT_OID_SHA1);
cl_git_pass(git_tree_lookup(&tree, repo, &id));
entry = git_tree_entry_byname(tree, "ListaTeste.xml");
diff --git a/tests/libgit2/object/tree/duplicateentries.c b/tests/libgit2/object/tree/duplicateentries.c
index c11ae0d3d..e9774cac3 100644
--- a/tests/libgit2/object/tree/duplicateentries.c
+++ b/tests/libgit2/object/tree/duplicateentries.c
@@ -45,7 +45,7 @@ static void tree_checker(
cl_assert_equal_i(1, (int)git_tree_entrycount(tree));
entry = git_tree_entry_byindex(tree, 0);
- cl_git_pass(git_oid_fromstr(&oid, expected_sha));
+ cl_git_pass(git_oid__fromstr(&oid, expected_sha, GIT_OID_SHA1));
cl_assert_equal_i(0, git_oid_cmp(&oid, git_tree_entry_id(entry)));
cl_assert_equal_i(expected_filemode, git_tree_entry_filemode(entry));
@@ -70,15 +70,17 @@ static void two_blobs(git_treebuilder *bld)
git_oid oid;
const git_tree_entry *entry;
- cl_git_pass(git_oid_fromstr(&oid,
- "a8233120f6ad708f843d861ce2b7228ec4e3dec6")); /* blob oid (README) */
+ cl_git_pass(git_oid__fromstr(&oid,
+ "a8233120f6ad708f843d861ce2b7228ec4e3dec6",
+ GIT_OID_SHA1)); /* blob oid (README) */
cl_git_pass(git_treebuilder_insert(
&entry, bld, "duplicate", &oid,
GIT_FILEMODE_BLOB));
- cl_git_pass(git_oid_fromstr(&oid,
- "a71586c1dfe8a71c6cbf6c129f404c5642ff31bd")); /* blob oid (new.txt) */
+ cl_git_pass(git_oid__fromstr(&oid,
+ "a71586c1dfe8a71c6cbf6c129f404c5642ff31bd",
+ GIT_OID_SHA1)); /* blob oid (new.txt) */
cl_git_pass(git_treebuilder_insert(
&entry, bld, "duplicate", &oid,
@@ -90,15 +92,17 @@ static void one_blob_and_one_tree(git_treebuilder *bld)
git_oid oid;
const git_tree_entry *entry;
- cl_git_pass(git_oid_fromstr(&oid,
- "a8233120f6ad708f843d861ce2b7228ec4e3dec6")); /* blob oid (README) */
+ cl_git_pass(git_oid__fromstr(&oid,
+ "a8233120f6ad708f843d861ce2b7228ec4e3dec6",
+ GIT_OID_SHA1)); /* blob oid (README) */
cl_git_pass(git_treebuilder_insert(
&entry, bld, "duplicate", &oid,
GIT_FILEMODE_BLOB));
- cl_git_pass(git_oid_fromstr(&oid,
- "4e0883eeeeebc1fb1735161cea82f7cb5fab7e63")); /* tree oid (a) */
+ cl_git_pass(git_oid__fromstr(&oid,
+ "4e0883eeeeebc1fb1735161cea82f7cb5fab7e63",
+ GIT_OID_SHA1)); /* tree oid (a) */
cl_git_pass(git_treebuilder_insert(
&entry, bld, "duplicate", &oid,
@@ -127,17 +131,17 @@ static void add_fake_conflicts(git_index *index)
ancestor_entry.path = "duplicate";
ancestor_entry.mode = GIT_FILEMODE_BLOB;
GIT_INDEX_ENTRY_STAGE_SET(&ancestor_entry, 1);
- git_oid_fromstr(&ancestor_entry.id, "a8233120f6ad708f843d861ce2b7228ec4e3dec6");
+ git_oid__fromstr(&ancestor_entry.id, "a8233120f6ad708f843d861ce2b7228ec4e3dec6", GIT_OID_SHA1);
our_entry.path = "duplicate";
our_entry.mode = GIT_FILEMODE_BLOB;
GIT_INDEX_ENTRY_STAGE_SET(&our_entry, 2);
- git_oid_fromstr(&our_entry.id, "45b983be36b73c0788dc9cbcb76cbb80fc7bb057");
+ git_oid__fromstr(&our_entry.id, "45b983be36b73c0788dc9cbcb76cbb80fc7bb057", GIT_OID_SHA1);
their_entry.path = "duplicate";
their_entry.mode = GIT_FILEMODE_BLOB;
GIT_INDEX_ENTRY_STAGE_SET(&their_entry, 3);
- git_oid_fromstr(&their_entry.id, "a71586c1dfe8a71c6cbf6c129f404c5642ff31bd");
+ git_oid__fromstr(&their_entry.id, "a71586c1dfe8a71c6cbf6c129f404c5642ff31bd", GIT_OID_SHA1);
cl_git_pass(git_index_conflict_add(index, &ancestor_entry, &our_entry, &their_entry));
}
diff --git a/tests/libgit2/object/tree/frompath.c b/tests/libgit2/object/tree/frompath.c
index 86ca47e94..147e53e93 100644
--- a/tests/libgit2/object/tree/frompath.c
+++ b/tests/libgit2/object/tree/frompath.c
@@ -11,7 +11,7 @@ void test_object_tree_frompath__initialize(void)
cl_git_pass(git_repository_open(&repo, cl_fixture("testrepo.git")));
cl_assert(repo != NULL);
- cl_git_pass(git_oid_fromstr(&id, tree_with_subtrees_oid));
+ cl_git_pass(git_oid__fromstr(&id, tree_with_subtrees_oid, GIT_OID_SHA1));
cl_git_pass(git_tree_lookup(&tree, repo, &id));
cl_assert(tree != NULL);
}
diff --git a/tests/libgit2/object/tree/parse.c b/tests/libgit2/object/tree/parse.c
index 4e871dcfa..d6d6e5302 100644
--- a/tests/libgit2/object/tree/parse.c
+++ b/tests/libgit2/object/tree/parse.c
@@ -35,7 +35,7 @@ static void assert_tree_parses(const char *data, size_t datalen,
const git_tree_entry *entry;
git_oid oid;
- cl_git_pass(git_oid_fromstr(&oid, expected->oid));
+ cl_git_pass(git_oid__fromstr(&oid, expected->oid, GIT_OID_SHA1));
cl_assert(entry = git_tree_entry_byname(tree, expected->filename));
cl_assert_equal_s(expected->filename, entry->filename);
diff --git a/tests/libgit2/object/tree/read.c b/tests/libgit2/object/tree/read.c
index 95a2e70fb..e18637f03 100644
--- a/tests/libgit2/object/tree/read.c
+++ b/tests/libgit2/object/tree/read.c
@@ -25,7 +25,7 @@ void test_object_tree_read__loaded(void)
git_oid id;
git_tree *tree;
- git_oid_fromstr(&id, tree_oid);
+ git_oid__fromstr(&id, tree_oid, GIT_OID_SHA1);
cl_git_pass(git_tree_lookup(&tree, g_repo, &id));
@@ -48,7 +48,7 @@ void test_object_tree_read__two(void)
const git_tree_entry *entry;
git_object *obj;
- git_oid_fromstr(&id, tree_oid);
+ git_oid__fromstr(&id, tree_oid, GIT_OID_SHA1);
cl_git_pass(git_tree_lookup(&tree, g_repo, &id));
diff --git a/tests/libgit2/object/tree/update.c b/tests/libgit2/object/tree/update.c
index 41b50f3e9..1861ac838 100644
--- a/tests/libgit2/object/tree/update.c
+++ b/tests/libgit2/object/tree/update.c
@@ -21,10 +21,10 @@ void test_object_tree_update__remove_blob(void)
const char *path = "README";
git_tree_update updates[] = {
- { GIT_TREE_UPDATE_REMOVE, {{0}}, GIT_FILEMODE_BLOB /* ignored */, path},
+ { GIT_TREE_UPDATE_REMOVE, GIT_OID_SHA1_ZERO, GIT_FILEMODE_BLOB /* ignored */, path},
};
- cl_git_pass(git_oid_fromstr(&base_id, "c4dc1555e4d4fa0e0c9c3fc46734c7c35b3ce90b"));
+ cl_git_pass(git_oid__fromstr(&base_id, "c4dc1555e4d4fa0e0c9c3fc46734c7c35b3ce90b", GIT_OID_SHA1));
cl_git_pass(git_tree_lookup(&base_tree, g_repo, &base_id));
/* Create it with an index */
@@ -50,10 +50,10 @@ void test_object_tree_update__remove_blob_deeper(void)
const char *path = "subdir/README";
git_tree_update updates[] = {
- { GIT_TREE_UPDATE_REMOVE, {{0}}, GIT_FILEMODE_BLOB /* ignored */, path},
+ { GIT_TREE_UPDATE_REMOVE, GIT_OID_SHA1_ZERO, GIT_FILEMODE_BLOB /* ignored */, path},
};
- cl_git_pass(git_oid_fromstr(&base_id, "c4dc1555e4d4fa0e0c9c3fc46734c7c35b3ce90b"));
+ cl_git_pass(git_oid__fromstr(&base_id, "c4dc1555e4d4fa0e0c9c3fc46734c7c35b3ce90b", GIT_OID_SHA1));
cl_git_pass(git_tree_lookup(&base_tree, g_repo, &base_id));
/* Create it with an index */
@@ -80,11 +80,11 @@ void test_object_tree_update__remove_all_entries(void)
const char *path2 = "subdir/subdir2/new.txt";
git_tree_update updates[] = {
- { GIT_TREE_UPDATE_REMOVE, {{0}}, GIT_FILEMODE_BLOB /* ignored */, path1},
- { GIT_TREE_UPDATE_REMOVE, {{0}}, GIT_FILEMODE_BLOB /* ignored */, path2},
+ { GIT_TREE_UPDATE_REMOVE, GIT_OID_SHA1_ZERO, GIT_FILEMODE_BLOB /* ignored */, path1},
+ { GIT_TREE_UPDATE_REMOVE, GIT_OID_SHA1_ZERO, GIT_FILEMODE_BLOB /* ignored */, path2},
};
- cl_git_pass(git_oid_fromstr(&base_id, "c4dc1555e4d4fa0e0c9c3fc46734c7c35b3ce90b"));
+ cl_git_pass(git_oid__fromstr(&base_id, "c4dc1555e4d4fa0e0c9c3fc46734c7c35b3ce90b", GIT_OID_SHA1));
cl_git_pass(git_tree_lookup(&base_tree, g_repo, &base_id));
/* Create it with an index */
@@ -112,10 +112,10 @@ void test_object_tree_update__replace_blob(void)
git_index_entry entry = { {0} };
git_tree_update updates[] = {
- { GIT_TREE_UPDATE_UPSERT, {{0}}, GIT_FILEMODE_BLOB, path},
+ { GIT_TREE_UPDATE_UPSERT, GIT_OID_SHA1_ZERO, GIT_FILEMODE_BLOB, path},
};
- cl_git_pass(git_oid_fromstr(&base_id, "c4dc1555e4d4fa0e0c9c3fc46734c7c35b3ce90b"));
+ cl_git_pass(git_oid__fromstr(&base_id, "c4dc1555e4d4fa0e0c9c3fc46734c7c35b3ce90b", GIT_OID_SHA1));
cl_git_pass(git_tree_lookup(&base_tree, g_repo, &base_id));
/* Create it with an index */
@@ -123,7 +123,7 @@ void test_object_tree_update__replace_blob(void)
cl_git_pass(git_index_read_tree(idx, base_tree));
entry.path = path;
- cl_git_pass(git_oid_fromstr(&entry.id, "fa49b077972391ad58037050f2a75f74e3671e92"));
+ cl_git_pass(git_oid__fromstr(&entry.id, "fa49b077972391ad58037050f2a75f74e3671e92", GIT_OID_SHA1));
entry.mode = GIT_FILEMODE_BLOB;
cl_git_pass(git_index_add(idx, &entry));
@@ -131,7 +131,7 @@ void test_object_tree_update__replace_blob(void)
git_index_free(idx);
/* Perform the same operation via the tree updater */
- cl_git_pass(git_oid_fromstr(&updates[0].id, "fa49b077972391ad58037050f2a75f74e3671e92"));
+ cl_git_pass(git_oid__fromstr(&updates[0].id, "fa49b077972391ad58037050f2a75f74e3671e92", GIT_OID_SHA1));
cl_git_pass(git_tree_create_updated(&tree_updater_id, g_repo, base_tree, 1, updates));
cl_assert_equal_oid(&tree_index_id, &tree_updater_id);
@@ -153,18 +153,18 @@ void test_object_tree_update__add_blobs(void)
};
git_tree_update updates[] = {
- { GIT_TREE_UPDATE_UPSERT, {{0}}, GIT_FILEMODE_BLOB, paths[0]},
- { GIT_TREE_UPDATE_UPSERT, {{0}}, GIT_FILEMODE_BLOB, paths[1]},
- { GIT_TREE_UPDATE_UPSERT, {{0}}, GIT_FILEMODE_BLOB, paths[2]},
+ { GIT_TREE_UPDATE_UPSERT, GIT_OID_SHA1_ZERO, GIT_FILEMODE_BLOB, paths[0]},
+ { GIT_TREE_UPDATE_UPSERT, GIT_OID_SHA1_ZERO, GIT_FILEMODE_BLOB, paths[1]},
+ { GIT_TREE_UPDATE_UPSERT, GIT_OID_SHA1_ZERO, GIT_FILEMODE_BLOB, paths[2]},
};
- cl_git_pass(git_oid_fromstr(&base_id, "c4dc1555e4d4fa0e0c9c3fc46734c7c35b3ce90b"));
+ cl_git_pass(git_oid__fromstr(&base_id, "c4dc1555e4d4fa0e0c9c3fc46734c7c35b3ce90b", GIT_OID_SHA1));
entry.mode = GIT_FILEMODE_BLOB;
- cl_git_pass(git_oid_fromstr(&entry.id, "fa49b077972391ad58037050f2a75f74e3671e92"));
+ cl_git_pass(git_oid__fromstr(&entry.id, "fa49b077972391ad58037050f2a75f74e3671e92", GIT_OID_SHA1));
for (i = 0; i < 3; i++) {
- cl_git_pass(git_oid_fromstr(&updates[i].id, "fa49b077972391ad58037050f2a75f74e3671e92"));
+ cl_git_pass(git_oid__fromstr(&updates[i].id, "fa49b077972391ad58037050f2a75f74e3671e92", GIT_OID_SHA1));
}
for (i = 0; i < 2; i++) {
@@ -210,18 +210,18 @@ void test_object_tree_update__add_blobs_unsorted(void)
};
git_tree_update updates[] = {
- { GIT_TREE_UPDATE_UPSERT, {{0}}, GIT_FILEMODE_BLOB, paths[0]},
- { GIT_TREE_UPDATE_UPSERT, {{0}}, GIT_FILEMODE_BLOB, paths[1]},
- { GIT_TREE_UPDATE_UPSERT, {{0}}, GIT_FILEMODE_BLOB, paths[2]},
+ { GIT_TREE_UPDATE_UPSERT, GIT_OID_SHA1_ZERO, GIT_FILEMODE_BLOB, paths[0]},
+ { GIT_TREE_UPDATE_UPSERT, GIT_OID_SHA1_ZERO, GIT_FILEMODE_BLOB, paths[1]},
+ { GIT_TREE_UPDATE_UPSERT, GIT_OID_SHA1_ZERO, GIT_FILEMODE_BLOB, paths[2]},
};
- cl_git_pass(git_oid_fromstr(&base_id, "c4dc1555e4d4fa0e0c9c3fc46734c7c35b3ce90b"));
+ cl_git_pass(git_oid__fromstr(&base_id, "c4dc1555e4d4fa0e0c9c3fc46734c7c35b3ce90b", GIT_OID_SHA1));
entry.mode = GIT_FILEMODE_BLOB;
- cl_git_pass(git_oid_fromstr(&entry.id, "fa49b077972391ad58037050f2a75f74e3671e92"));
+ cl_git_pass(git_oid__fromstr(&entry.id, "fa49b077972391ad58037050f2a75f74e3671e92", GIT_OID_SHA1));
for (i = 0; i < 3; i++) {
- cl_git_pass(git_oid_fromstr(&updates[i].id, "fa49b077972391ad58037050f2a75f74e3671e92"));
+ cl_git_pass(git_oid__fromstr(&updates[i].id, "fa49b077972391ad58037050f2a75f74e3671e92", GIT_OID_SHA1));
}
for (i = 0; i < 2; i++) {
@@ -258,12 +258,12 @@ void test_object_tree_update__add_conflict(void)
int i;
git_oid tree_updater_id;
git_tree_update updates[] = {
- { GIT_TREE_UPDATE_UPSERT, {{0}}, GIT_FILEMODE_BLOB, "a/dir/blob"},
- { GIT_TREE_UPDATE_UPSERT, {{0}}, GIT_FILEMODE_BLOB, "a/dir"},
+ { GIT_TREE_UPDATE_UPSERT, GIT_OID_SHA1_ZERO, GIT_FILEMODE_BLOB, "a/dir/blob"},
+ { GIT_TREE_UPDATE_UPSERT, GIT_OID_SHA1_ZERO, GIT_FILEMODE_BLOB, "a/dir"},
};
for (i = 0; i < 2; i++) {
- cl_git_pass(git_oid_fromstr(&updates[i].id, "a71586c1dfe8a71c6cbf6c129f404c5642ff31bd"));
+ cl_git_pass(git_oid__fromstr(&updates[i].id, "a71586c1dfe8a71c6cbf6c129f404c5642ff31bd", GIT_OID_SHA1));
}
cl_git_fail(git_tree_create_updated(&tree_updater_id, g_repo, NULL, 2, updates));
@@ -274,12 +274,12 @@ void test_object_tree_update__add_conflict2(void)
int i;
git_oid tree_updater_id;
git_tree_update updates[] = {
- { GIT_TREE_UPDATE_UPSERT, {{0}}, GIT_FILEMODE_BLOB, "a/dir/blob"},
- { GIT_TREE_UPDATE_UPSERT, {{0}}, GIT_FILEMODE_TREE, "a/dir/blob"},
+ { GIT_TREE_UPDATE_UPSERT, GIT_OID_SHA1_ZERO, GIT_FILEMODE_BLOB, "a/dir/blob"},
+ { GIT_TREE_UPDATE_UPSERT, GIT_OID_SHA1_ZERO, GIT_FILEMODE_TREE, "a/dir/blob"},
};
for (i = 0; i < 2; i++) {
- cl_git_pass(git_oid_fromstr(&updates[i].id, "a71586c1dfe8a71c6cbf6c129f404c5642ff31bd"));
+ cl_git_pass(git_oid__fromstr(&updates[i].id, "a71586c1dfe8a71c6cbf6c129f404c5642ff31bd", GIT_OID_SHA1));
}
cl_git_fail(git_tree_create_updated(&tree_updater_id, g_repo, NULL, 2, updates));
@@ -290,11 +290,11 @@ void test_object_tree_update__remove_invalid_submodule(void)
git_tree *baseline;
git_oid updated_tree_id, baseline_id;
git_tree_update updates[] = {
- {GIT_TREE_UPDATE_REMOVE, {{0}}, GIT_FILEMODE_BLOB, "submodule"},
+ {GIT_TREE_UPDATE_REMOVE, GIT_OID_SHA1_ZERO, GIT_FILEMODE_BLOB, "submodule"},
};
/* This tree contains a submodule with an all-zero commit for a submodule named 'submodule' */
- cl_git_pass(git_oid_fromstr(&baseline_id, "396c7f1adb7925f51ba13a75f48252f44c5a14a2"));
+ cl_git_pass(git_oid__fromstr(&baseline_id, "396c7f1adb7925f51ba13a75f48252f44c5a14a2", GIT_OID_SHA1));
cl_git_pass(git_tree_lookup(&baseline, g_repo, &baseline_id));
cl_git_pass(git_tree_create_updated(&updated_tree_id, g_repo, baseline, 1, updates));
diff --git a/tests/libgit2/object/tree/walk.c b/tests/libgit2/object/tree/walk.c
index d1fdaa3a0..573a27849 100644
--- a/tests/libgit2/object/tree/walk.c
+++ b/tests/libgit2/object/tree/walk.c
@@ -33,7 +33,7 @@ void test_object_tree_walk__0(void)
git_tree *tree;
int ct;
- git_oid_fromstr(&id, tree_oid);
+ git_oid__fromstr(&id, tree_oid, GIT_OID_SHA1);
cl_git_pass(git_tree_lookup(&tree, g_repo, &id));
@@ -77,7 +77,7 @@ void test_object_tree_walk__1(void)
git_tree *tree;
int ct;
- git_oid_fromstr(&id, tree_oid);
+ git_oid__fromstr(&id, tree_oid, GIT_OID_SHA1);
cl_git_pass(git_tree_lookup(&tree, g_repo, &id));
@@ -138,7 +138,7 @@ void test_object_tree_walk__2(void)
struct treewalk_skip_data data;
/* look up a deep tree */
- git_oid_fromstr(&id, "ae90f12eea699729ed24555e40b9fd669da12a12");
+ git_oid__fromstr(&id, "ae90f12eea699729ed24555e40b9fd669da12a12", GIT_OID_SHA1);
cl_git_pass(git_tree_lookup(&tree, g_repo, &id));
memset(&data, 0, sizeof(data));
diff --git a/tests/libgit2/object/tree/write.c b/tests/libgit2/object/tree/write.c
index a4ceb35b6..71a4c54f6 100644
--- a/tests/libgit2/object/tree/write.c
+++ b/tests/libgit2/object/tree/write.c
@@ -29,9 +29,9 @@ void test_object_tree_write__from_memory(void)
git_tree *tree;
git_oid id, bid, rid, id2;
- git_oid_fromstr(&id, first_tree);
- git_oid_fromstr(&id2, second_tree);
- git_oid_fromstr(&bid, blob_oid);
+ git_oid__fromstr(&id, first_tree, GIT_OID_SHA1);
+ git_oid__fromstr(&id2, second_tree, GIT_OID_SHA1);
+ git_oid__fromstr(&bid, blob_oid, GIT_OID_SHA1);
/* create a second tree from first tree using `git_treebuilder_insert`
* on REPOSITORY_FOLDER.
@@ -71,10 +71,10 @@ void test_object_tree_write__subtree(void)
git_oid id, bid, subtree_id, id2, id3;
git_oid id_hiearar;
- git_oid_fromstr(&id, first_tree);
- git_oid_fromstr(&id2, second_tree);
- git_oid_fromstr(&id3, third_tree);
- git_oid_fromstr(&bid, blob_oid);
+ git_oid__fromstr(&id, first_tree, GIT_OID_SHA1);
+ git_oid__fromstr(&id2, second_tree, GIT_OID_SHA1);
+ git_oid__fromstr(&id3, third_tree, GIT_OID_SHA1);
+ git_oid__fromstr(&bid, blob_oid, GIT_OID_SHA1);
/* create subtree */
cl_git_pass(git_treebuilder_new(&builder, g_repo, NULL));
@@ -135,8 +135,8 @@ void test_object_tree_write__sorted_subtrees(void)
git_oid bid, tid, tree_oid;
- cl_git_pass(git_oid_fromstr(&bid, blob_oid));
- cl_git_pass(git_oid_fromstr(&tid, first_tree));
+ cl_git_pass(git_oid__fromstr(&bid, blob_oid, GIT_OID_SHA1));
+ cl_git_pass(git_oid__fromstr(&tid, first_tree, GIT_OID_SHA1));
cl_git_pass(git_treebuilder_new(&builder, g_repo, NULL));
@@ -195,7 +195,7 @@ void test_object_tree_write__removing_and_re_adding_in_treebuilder(void)
git_oid entry_oid, tree_oid;
git_tree *tree;
- cl_git_pass(git_oid_fromstr(&entry_oid, blob_oid));
+ cl_git_pass(git_oid__fromstr(&entry_oid, blob_oid, GIT_OID_SHA1));
cl_git_pass(git_treebuilder_new(&builder, g_repo, NULL));
@@ -286,7 +286,7 @@ void test_object_tree_write__filtering(void)
git_oid entry_oid, tree_oid;
git_tree *tree;
- git_oid_fromstr(&entry_oid, blob_oid);
+ git_oid__fromstr(&entry_oid, blob_oid, GIT_OID_SHA1);
cl_git_pass(git_treebuilder_new(&builder, g_repo, NULL));
@@ -348,7 +348,7 @@ void test_object_tree_write__cruel_paths(void)
int count = 0, i, j;
git_tree_entry *te;
- git_oid_fromstr(&bid, blob_oid);
+ git_oid__fromstr(&bid, blob_oid, GIT_OID_SHA1);
/* create tree */
cl_git_pass(git_treebuilder_new(&builder, g_repo, NULL));
@@ -411,7 +411,7 @@ void test_object_tree_write__protect_filesystems(void)
git_treebuilder *builder;
git_oid bid;
- cl_git_pass(git_oid_fromstr(&bid, "fa49b077972391ad58037050f2a75f74e3671e92"));
+ cl_git_pass(git_oid__fromstr(&bid, "fa49b077972391ad58037050f2a75f74e3671e92", GIT_OID_SHA1));
/* Ensure that (by default) we can write objects with funny names on
* platforms that are not affected.
@@ -460,12 +460,14 @@ static void test_invalid_objects(bool should_allow_invalid)
"Expected function call to fail: " #expr), \
NULL, 1)
- cl_git_pass(git_oid_fromstr(&valid_blob_id, blob_oid));
- cl_git_pass(git_oid_fromstr(&invalid_blob_id,
- "1234567890123456789012345678901234567890"));
- cl_git_pass(git_oid_fromstr(&valid_tree_id, first_tree));
- cl_git_pass(git_oid_fromstr(&invalid_tree_id,
- "0000000000111111111122222222223333333333"));
+ cl_git_pass(git_oid__fromstr(&valid_blob_id, blob_oid, GIT_OID_SHA1));
+ cl_git_pass(git_oid__fromstr(&invalid_blob_id,
+ "1234567890123456789012345678901234567890",
+ GIT_OID_SHA1));
+ cl_git_pass(git_oid__fromstr(&valid_tree_id, first_tree, GIT_OID_SHA1));
+ cl_git_pass(git_oid__fromstr(&invalid_tree_id,
+ "0000000000111111111122222222223333333333",
+ GIT_OID_SHA1));
cl_git_pass(git_treebuilder_new(&builder, g_repo, NULL));
@@ -495,7 +497,7 @@ static void test_inserting_submodule(void)
git_treebuilder *bld;
git_oid sm_id;
- cl_git_pass(git_oid_fromstr(&sm_id, "da39a3ee5e6b4b0d3255bfef95601890afd80709"));
+ cl_git_pass(git_oid__fromstr(&sm_id, "da39a3ee5e6b4b0d3255bfef95601890afd80709", GIT_OID_SHA1));
cl_git_pass(git_treebuilder_new(&bld, g_repo, NULL));
cl_git_pass(git_treebuilder_insert(NULL, bld, "sm", &sm_id, GIT_FILEMODE_COMMIT));
git_treebuilder_free(bld);
@@ -516,7 +518,7 @@ void test_object_tree_write__object_validity(void)
void test_object_tree_write__invalid_null_oid(void)
{
git_treebuilder *bld;
- git_oid null_oid = {{0}};
+ git_oid null_oid = GIT_OID_SHA1_ZERO;
cl_git_pass(git_treebuilder_new(&bld, g_repo, NULL));
cl_git_fail(git_treebuilder_insert(NULL, bld, "null_oid_file", &null_oid, GIT_FILEMODE_BLOB));