summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorYuang Li <yuangli88@hotmail.com>2022-07-29 01:32:40 +0100
committerGitHub <noreply@github.com>2022-07-29 01:32:40 +0100
commit09acf6986513381316c8797c4529323bff8525a5 (patch)
tree2802cfbafd3e7d94e6a3153848ed0edf3ac1aebc /tests
parent3d7a609d632d7a16d099897735f41dae248e943b (diff)
parent7f46bfac14f0502711f8441348fd361175953fd5 (diff)
downloadlibgit2-09acf6986513381316c8797c4529323bff8525a5.tar.gz
Merge branch 'mw_dev' into shallow-clone-local
Diffstat (limited to 'tests')
-rw-r--r--tests/clar/clar_libgit2.h24
-rw-r--r--tests/libgit2/CMakeLists.txt2
-rw-r--r--tests/libgit2/apply/apply_helpers.c2
-rw-r--r--tests/libgit2/apply/both.c12
-rw-r--r--tests/libgit2/apply/callbacks.c2
-rw-r--r--tests/libgit2/apply/check.c6
-rw-r--r--tests/libgit2/apply/index.c10
-rw-r--r--tests/libgit2/apply/tree.c6
-rw-r--r--tests/libgit2/apply/workdir.c8
-rw-r--r--tests/libgit2/blame/blame_helpers.c2
-rw-r--r--tests/libgit2/blame/getters.c10
-rw-r--r--tests/libgit2/checkout/binaryunicode.c9
-rw-r--r--tests/libgit2/checkout/conflict.c6
-rw-r--r--tests/libgit2/checkout/index.c6
-rw-r--r--tests/libgit2/checkout/tree.c36
-rw-r--r--tests/libgit2/checkout/typechange.c2
-rw-r--r--tests/libgit2/cherrypick/bare.c12
-rw-r--r--tests/libgit2/cherrypick/workdir.c36
-rw-r--r--tests/libgit2/commit/commit.c12
-rw-r--r--tests/libgit2/commit/parent.c2
-rw-r--r--tests/libgit2/commit/parse.c10
-rw-r--r--tests/libgit2/commit/write.c50
-rw-r--r--tests/libgit2/core/oid.c215
-rw-r--r--tests/libgit2/core/oidmap.c17
-rw-r--r--tests/libgit2/core/pool.c9
-rw-r--r--tests/libgit2/diff/binary.c26
-rw-r--r--tests/libgit2/diff/blob.c36
-rw-r--r--tests/libgit2/diff/diff_helpers.c2
-rw-r--r--tests/libgit2/diff/format_email.c8
-rw-r--r--tests/libgit2/diff/index.c8
-rw-r--r--tests/libgit2/diff/parse.c2
-rw-r--r--tests/libgit2/diff/patchid.c2
-rw-r--r--tests/libgit2/diff/rename.c2
-rw-r--r--tests/libgit2/diff/stats.c2
-rw-r--r--tests/libgit2/diff/workdir.c10
-rw-r--r--tests/libgit2/email/create.c4
-rw-r--r--tests/libgit2/email/create.c.bak4
-rw-r--r--tests/libgit2/fetch/local.c4
-rw-r--r--tests/libgit2/fetchhead/nonetwork.c40
-rw-r--r--tests/libgit2/filter/bare.c4
-rw-r--r--tests/libgit2/graph/ahead_behind.c6
-rw-r--r--tests/libgit2/graph/commitgraph.c26
-rw-r--r--tests/libgit2/graph/descendant_of.c4
-rw-r--r--tests/libgit2/graph/reachable_from_any.c2
-rw-r--r--tests/libgit2/index/add.c2
-rw-r--r--tests/libgit2/index/bypath.c6
-rw-r--r--tests/libgit2/index/cache.c16
-rw-r--r--tests/libgit2/index/conflicts.c74
-rw-r--r--tests/libgit2/index/crlf.c19
-rw-r--r--tests/libgit2/index/names.c6
-rw-r--r--tests/libgit2/index/read_index.c14
-rw-r--r--tests/libgit2/index/rename.c2
-rw-r--r--tests/libgit2/index/reuc.c70
-rw-r--r--tests/libgit2/index/tests.c16
-rw-r--r--tests/libgit2/iterator/index.c10
-rw-r--r--tests/libgit2/iterator/tree.c6
-rw-r--r--tests/libgit2/iterator/workdir.c4
-rw-r--r--tests/libgit2/merge/driver.c6
-rw-r--r--tests/libgit2/merge/files.c6
-rw-r--r--tests/libgit2/merge/merge_helpers.c10
-rw-r--r--tests/libgit2/merge/merge_helpers.h8
-rw-r--r--tests/libgit2/merge/trees/renames.c2
-rw-r--r--tests/libgit2/merge/trees/treediff.c6
-rw-r--r--tests/libgit2/merge/trees/trivial.c4
-rw-r--r--tests/libgit2/merge/workdir/dirty.c2
-rw-r--r--tests/libgit2/merge/workdir/setup.c110
-rw-r--r--tests/libgit2/merge/workdir/simple.c18
-rw-r--r--tests/libgit2/merge/workdir/trivial.c4
-rw-r--r--tests/libgit2/network/remote/push.c5
-rw-r--r--tests/libgit2/network/remote/rename.c6
-rw-r--r--tests/libgit2/notes/notes.c48
-rw-r--r--tests/libgit2/notes/notesref.c2
-rw-r--r--tests/libgit2/object/blob/fromstream.c4
-rw-r--r--tests/libgit2/object/cache.c14
-rw-r--r--tests/libgit2/object/commit/commitstagedfile.c6
-rw-r--r--tests/libgit2/object/commit/parse.c2
-rw-r--r--tests/libgit2/object/lookup.c12
-rw-r--r--tests/libgit2/object/peel.c6
-rw-r--r--tests/libgit2/object/raw/chars.c10
-rw-r--r--tests/libgit2/object/raw/compare.c38
-rw-r--r--tests/libgit2/object/raw/convert.c42
-rw-r--r--tests/libgit2/object/raw/fromstr.c15
-rw-r--r--tests/libgit2/object/raw/hash.c38
-rw-r--r--tests/libgit2/object/raw/short.c8
-rw-r--r--tests/libgit2/object/raw/size.c8
-rw-r--r--tests/libgit2/object/raw/write.c4
-rw-r--r--tests/libgit2/object/shortid.c8
-rw-r--r--tests/libgit2/object/tag/parse.c2
-rw-r--r--tests/libgit2/object/tag/peel.c2
-rw-r--r--tests/libgit2/object/tag/read.c16
-rw-r--r--tests/libgit2/object/tag/write.c18
-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
-rw-r--r--tests/libgit2/odb/alternates.c4
-rw-r--r--tests/libgit2/odb/backend/backend_helpers.c12
-rw-r--r--tests/libgit2/odb/backend/mempack.c7
-rw-r--r--tests/libgit2/odb/backend/multiple.c2
-rw-r--r--tests/libgit2/odb/backend/nobackend.c3
-rw-r--r--tests/libgit2/odb/backend/nonrefreshing.c4
-rw-r--r--tests/libgit2/odb/backend/refreshing.c4
-rw-r--r--tests/libgit2/odb/backend/simple.c28
-rw-r--r--tests/libgit2/odb/emptyobjects.c6
-rw-r--r--tests/libgit2/odb/foreach.c2
-rw-r--r--tests/libgit2/odb/freshen.c12
-rw-r--r--tests/libgit2/odb/largefiles.c4
-rw-r--r--tests/libgit2/odb/loose.c144
-rw-r--r--tests/libgit2/odb/loose_data.h387
-rw-r--r--tests/libgit2/odb/mixed.c38
-rw-r--r--tests/libgit2/odb/packed.c8
-rw-r--r--tests/libgit2/odb/packed_one.c6
-rw-r--r--tests/libgit2/odb/sorting.c7
-rw-r--r--tests/libgit2/online/clone.c8
-rw-r--r--tests/libgit2/online/fetch.c4
-rw-r--r--tests/libgit2/online/push.c28
-rw-r--r--tests/libgit2/online/push_util.c2
-rw-r--r--tests/libgit2/pack/indexer.c4
-rw-r--r--tests/libgit2/pack/midx.c8
-rw-r--r--tests/libgit2/pack/sharing.c2
-rw-r--r--tests/libgit2/patch/parse.c2
-rw-r--r--tests/libgit2/perf/helper__perf__do_merge.c4
-rw-r--r--tests/libgit2/rebase/abort.c12
-rw-r--r--tests/libgit2/rebase/inmemory.c10
-rw-r--r--tests/libgit2/rebase/iterator.c20
-rw-r--r--tests/libgit2/rebase/merge.c30
-rw-r--r--tests/libgit2/rebase/setup.c30
-rw-r--r--tests/libgit2/rebase/sign.c10
-rw-r--r--tests/libgit2/refs/basic.c2
-rw-r--r--tests/libgit2/refs/branches/delete.c8
-rw-r--r--tests/libgit2/refs/branches/iterator.c2
-rw-r--r--tests/libgit2/refs/create.c22
-rw-r--r--tests/libgit2/refs/delete.c2
-rw-r--r--tests/libgit2/refs/foreachglob.c2
-rw-r--r--tests/libgit2/refs/iterator.c3
-rw-r--r--tests/libgit2/refs/lookup.c2
-rw-r--r--tests/libgit2/refs/peel.c2
-rw-r--r--tests/libgit2/refs/races.c24
-rw-r--r--tests/libgit2/refs/read.c4
-rw-r--r--tests/libgit2/refs/reflog/drop.c4
-rw-r--r--tests/libgit2/refs/reflog/messages.c12
-rw-r--r--tests/libgit2/refs/reflog/reflog.c24
-rw-r--r--tests/libgit2/refs/reflog/reflog_helpers.c26
-rw-r--r--tests/libgit2/refs/revparse.c12
-rw-r--r--tests/libgit2/refs/transactions.c10
-rw-r--r--tests/libgit2/repo/env.c6
-rw-r--r--tests/libgit2/repo/hashfile.c41
-rw-r--r--tests/libgit2/repo/head.c2
-rw-r--r--tests/libgit2/repo/init.c2
-rw-r--r--tests/libgit2/repo/setters.c3
-rw-r--r--tests/libgit2/reset/hard.c6
-rw-r--r--tests/libgit2/reset/soft.c4
-rw-r--r--tests/libgit2/revert/bare.c10
-rw-r--r--tests/libgit2/revert/rename.c2
-rw-r--r--tests/libgit2/revert/workdir.c40
-rw-r--r--tests/libgit2/revwalk/basic.c36
-rw-r--r--tests/libgit2/revwalk/hidecb.c4
-rw-r--r--tests/libgit2/revwalk/mergebase.c66
-rw-r--r--tests/libgit2/revwalk/simplify.c4
-rw-r--r--tests/libgit2/status/single.c9
-rw-r--r--tests/libgit2/status/submodules.c2
-rw-r--r--tests/libgit2/status/worktree.c34
-rw-r--r--tests/libgit2/submodule/add.c2
-rw-r--r--tests/libgit2/transports/smart/packet.c4
-rw-r--r--tests/libgit2/win32/forbidden.c4
169 files changed, 1760 insertions, 1125 deletions
diff --git a/tests/clar/clar_libgit2.h b/tests/clar/clar_libgit2.h
index da3f41524..d2d9da0aa 100644
--- a/tests/clar/clar_libgit2.h
+++ b/tests/clar/clar_libgit2.h
@@ -5,6 +5,7 @@
#include <git2.h>
#include "common.h"
#include "posix.h"
+#include "oid.h"
/**
* Replace for `clar_must_pass` that passes the last library error as the
@@ -136,13 +137,32 @@ GIT_INLINE(void) clar__assert_equal_oid(
const char *file, const char *func, int line, const char *desc,
const git_oid *one, const git_oid *two)
{
- if (git_oid_cmp(one, two)) {
- char err[] = "\"........................................\" != \"........................................\"";
+ if (git_oid_equal(one, two))
+ return;
+
+ if (git_oid_type(one) != git_oid_type(two)) {
+ char err[64];
+
+ snprintf(err, 64, "different oid types: %d vs %d", git_oid_type(one), git_oid_type(two));
+ clar__fail(file, func, line, desc, err, 1);
+ } else if (git_oid_type(one) == GIT_OID_SHA1) {
+ char err[] = "\"........................................\" != \"........................................\"";
git_oid_fmt(&err[1], one);
git_oid_fmt(&err[47], two);
clar__fail(file, func, line, desc, err, 1);
+#ifdef GIT_EXPERIMENTAL_SHA256
+ } else if (one->type == GIT_OID_SHA256) {
+ char err[] = "\"................................................................\" != \"................................................................\"";
+
+ git_oid_fmt(&err[1], one);
+ git_oid_fmt(&err[71], one);
+
+ clar__fail(file, func, line, desc, err, 1);
+#endif
+ } else {
+ clar__fail(file, func, line, desc, "unknown oid types", 1);
}
}
diff --git a/tests/libgit2/CMakeLists.txt b/tests/libgit2/CMakeLists.txt
index 27f421ad6..7f6fafe77 100644
--- a/tests/libgit2/CMakeLists.txt
+++ b/tests/libgit2/CMakeLists.txt
@@ -65,7 +65,7 @@ endif()
include(AddClarTest)
add_clar_test(libgit2_tests offline -v -xonline)
-add_clar_test(libgit2_tests invasive -v -score::ftruncate -sfilter::stream::bigfile -sodb::largefiles -siterator::workdir::filesystem_gunk -srepo::init -srepo::init::at_filesystem_root)
+add_clar_test(libgit2_tests invasive -v -sfilter::stream::bigfile -sodb::largefiles -siterator::workdir::filesystem_gunk -srepo::init -srepo::init::at_filesystem_root)
add_clar_test(libgit2_tests online -v -sonline -xonline::customcert)
add_clar_test(libgit2_tests online_customcert -v -sonline::customcert)
add_clar_test(libgit2_tests gitdaemon -v -sonline::push)
diff --git a/tests/libgit2/apply/apply_helpers.c b/tests/libgit2/apply/apply_helpers.c
index 91cc51a71..e78b8ffcb 100644
--- a/tests/libgit2/apply/apply_helpers.c
+++ b/tests/libgit2/apply/apply_helpers.c
@@ -14,7 +14,7 @@ static int iterator_compare(const git_index_entry *entry, void *_data)
struct iterator_compare_data *data = (struct iterator_compare_data *)_data;
cl_assert_equal_i(GIT_INDEX_ENTRY_STAGE(entry), data->expected[data->idx].stage);
- cl_git_pass(git_oid_fromstr(&expected_id, data->expected[data->idx].oid_str));
+ cl_git_pass(git_oid__fromstr(&expected_id, data->expected[data->idx].oid_str, GIT_OID_SHA1));
cl_assert_equal_oid(&entry->id, &expected_id);
cl_assert_equal_i(entry->mode, data->expected[data->idx].mode);
cl_assert_equal_s(entry->path, data->expected[data->idx].path);
diff --git a/tests/libgit2/apply/both.c b/tests/libgit2/apply/both.c
index 108963270..1331e7ea4 100644
--- a/tests/libgit2/apply/both.c
+++ b/tests/libgit2/apply/both.c
@@ -12,7 +12,7 @@ void test_apply_both__initialize(void)
repo = cl_git_sandbox_init(TEST_REPO_PATH);
- git_oid_fromstr(&oid, "539bd011c4822c560c1d17cab095006b7a10f707");
+ git_oid__fromstr(&oid, "539bd011c4822c560c1d17cab095006b7a10f707", GIT_OID_SHA1);
cl_git_pass(git_commit_lookup(&commit, repo, &oid));
cl_git_pass(git_reset(repo, (git_object *)commit, GIT_RESET_HARD, NULL));
git_commit_free(commit);
@@ -42,8 +42,8 @@ void test_apply_both__generated_diff(void)
size_t both_expected_cnt = sizeof(both_expected) /
sizeof(struct merge_index_entry);
- git_oid_fromstr(&a_oid, "539bd011c4822c560c1d17cab095006b7a10f707");
- git_oid_fromstr(&b_oid, "7c7bf85e978f1d18c0566f702d2cb7766b9c8d4f");
+ git_oid__fromstr(&a_oid, "539bd011c4822c560c1d17cab095006b7a10f707", GIT_OID_SHA1);
+ git_oid__fromstr(&b_oid, "7c7bf85e978f1d18c0566f702d2cb7766b9c8d4f", GIT_OID_SHA1);
cl_git_pass(git_commit_lookup(&a_commit, repo, &a_oid));
cl_git_pass(git_commit_lookup(&b_commit, repo, &b_oid));
@@ -192,7 +192,7 @@ void test_apply_both__index_must_match_workdir(void)
memset(&idx_entry, 0, sizeof(git_index_entry));
idx_entry.mode = 0100644;
idx_entry.path = "asparagus.txt";
- cl_git_pass(git_oid_fromstr(&idx_entry.id, "06d3fefb8726ab1099acc76e02dfb85e034b2538"));
+ cl_git_pass(git_oid__fromstr(&idx_entry.id, "06d3fefb8726ab1099acc76e02dfb85e034b2538", GIT_OID_SHA1));
cl_git_pass(git_index_add(index, &idx_entry));
cl_git_pass(git_index_write(index));
@@ -290,7 +290,7 @@ void test_apply_both__keeps_nonconflicting_changes(void)
memset(&idx_entry, 0, sizeof(git_index_entry));
idx_entry.mode = 0100644;
idx_entry.path = "beef.txt";
- cl_git_pass(git_oid_fromstr(&idx_entry.id, "898d12687fb35be271c27c795a6b32c8b51da79e"));
+ cl_git_pass(git_oid__fromstr(&idx_entry.id, "898d12687fb35be271c27c795a6b32c8b51da79e", GIT_OID_SHA1));
cl_git_pass(git_index_add(index, &idx_entry));
cl_git_pass(git_index_remove(index, "bouilli.txt", 0));
@@ -386,7 +386,7 @@ void test_apply_both__honors_crlf_attributes(void)
cl_git_rmfile("merge-recursive/asparagus.txt");
cl_git_rmfile("merge-recursive/veal.txt");
- git_oid_fromstr(&oid, "539bd011c4822c560c1d17cab095006b7a10f707");
+ git_oid__fromstr(&oid, "539bd011c4822c560c1d17cab095006b7a10f707", GIT_OID_SHA1);
cl_git_pass(git_commit_lookup(&commit, repo, &oid));
cl_git_pass(git_reset(repo, (git_object *)commit, GIT_RESET_HARD, NULL));
git_commit_free(commit);
diff --git a/tests/libgit2/apply/callbacks.c b/tests/libgit2/apply/callbacks.c
index 1b759dc9b..2f9af3101 100644
--- a/tests/libgit2/apply/callbacks.c
+++ b/tests/libgit2/apply/callbacks.c
@@ -12,7 +12,7 @@ void test_apply_callbacks__initialize(void)
repo = cl_git_sandbox_init(TEST_REPO_PATH);
- git_oid_fromstr(&oid, "539bd011c4822c560c1d17cab095006b7a10f707");
+ git_oid__fromstr(&oid, "539bd011c4822c560c1d17cab095006b7a10f707", GIT_OID_SHA1);
cl_git_pass(git_commit_lookup(&commit, repo, &oid));
cl_git_pass(git_reset(repo, (git_object *)commit, GIT_RESET_HARD, NULL));
git_commit_free(commit);
diff --git a/tests/libgit2/apply/check.c b/tests/libgit2/apply/check.c
index 9e42365ed..d055d455b 100644
--- a/tests/libgit2/apply/check.c
+++ b/tests/libgit2/apply/check.c
@@ -12,7 +12,7 @@ void test_apply_check__initialize(void)
repo = cl_git_sandbox_init(TEST_REPO_PATH);
- git_oid_fromstr(&oid, "539bd011c4822c560c1d17cab095006b7a10f707");
+ git_oid__fromstr(&oid, "539bd011c4822c560c1d17cab095006b7a10f707", GIT_OID_SHA1);
cl_git_pass(git_commit_lookup(&commit, repo, &oid));
cl_git_pass(git_reset(repo, (git_object *)commit, GIT_RESET_HARD, NULL));
git_commit_free(commit);
@@ -32,8 +32,8 @@ void test_apply_check__generate_diff(void)
git_diff_options diff_opts = GIT_DIFF_OPTIONS_INIT;
git_apply_options opts = GIT_APPLY_OPTIONS_INIT;
- cl_git_pass(git_oid_fromstr(&a_oid, "539bd011c4822c560c1d17cab095006b7a10f707"));
- cl_git_pass(git_oid_fromstr(&b_oid, "7c7bf85e978f1d18c0566f702d2cb7766b9c8d4f"));
+ cl_git_pass(git_oid__fromstr(&a_oid, "539bd011c4822c560c1d17cab095006b7a10f707", GIT_OID_SHA1));
+ cl_git_pass(git_oid__fromstr(&b_oid, "7c7bf85e978f1d18c0566f702d2cb7766b9c8d4f", GIT_OID_SHA1));
cl_git_pass(git_commit_lookup(&a_commit, repo, &a_oid));
cl_git_pass(git_commit_lookup(&b_commit, repo, &b_oid));
diff --git a/tests/libgit2/apply/index.c b/tests/libgit2/apply/index.c
index 9c9094cce..2dc0d53cb 100644
--- a/tests/libgit2/apply/index.c
+++ b/tests/libgit2/apply/index.c
@@ -12,7 +12,7 @@ void test_apply_index__initialize(void)
repo = cl_git_sandbox_init(TEST_REPO_PATH);
- git_oid_fromstr(&oid, "539bd011c4822c560c1d17cab095006b7a10f707");
+ git_oid__fromstr(&oid, "539bd011c4822c560c1d17cab095006b7a10f707", GIT_OID_SHA1);
cl_git_pass(git_commit_lookup(&commit, repo, &oid));
cl_git_pass(git_reset(repo, (git_object *)commit, GIT_RESET_HARD, NULL));
git_commit_free(commit);
@@ -42,8 +42,8 @@ void test_apply_index__generate_diff(void)
size_t index_expected_cnt = sizeof(index_expected) /
sizeof(struct merge_index_entry);
- git_oid_fromstr(&a_oid, "539bd011c4822c560c1d17cab095006b7a10f707");
- git_oid_fromstr(&b_oid, "7c7bf85e978f1d18c0566f702d2cb7766b9c8d4f");
+ git_oid__fromstr(&a_oid, "539bd011c4822c560c1d17cab095006b7a10f707", GIT_OID_SHA1);
+ git_oid__fromstr(&b_oid, "7c7bf85e978f1d18c0566f702d2cb7766b9c8d4f", GIT_OID_SHA1);
cl_git_pass(git_commit_lookup(&a_commit, repo, &a_oid));
cl_git_pass(git_commit_lookup(&b_commit, repo, &b_oid));
@@ -233,7 +233,7 @@ void test_apply_index__keeps_nonconflicting_changes(void)
memset(&idx_entry, 0, sizeof(git_index_entry));
idx_entry.mode = 0100644;
idx_entry.path = "beef.txt";
- cl_git_pass(git_oid_fromstr(&idx_entry.id, "898d12687fb35be271c27c795a6b32c8b51da79e"));
+ cl_git_pass(git_oid__fromstr(&idx_entry.id, "898d12687fb35be271c27c795a6b32c8b51da79e", GIT_OID_SHA1));
cl_git_pass(git_index_add(index, &idx_entry));
cl_git_pass(git_index_remove(index, "bouilli.txt", 0));
@@ -279,7 +279,7 @@ void test_apply_index__can_apply_nonconflicting_file_changes(void)
memset(&idx_entry, 0, sizeof(git_index_entry));
idx_entry.mode = 0100644;
idx_entry.path = "asparagus.txt";
- cl_git_pass(git_oid_fromstr(&idx_entry.id, "06d3fefb8726ab1099acc76e02dfb85e034b2538"));
+ cl_git_pass(git_oid__fromstr(&idx_entry.id, "06d3fefb8726ab1099acc76e02dfb85e034b2538", GIT_OID_SHA1));
cl_git_pass(git_index_add(index, &idx_entry));
cl_git_pass(git_index_write(index));
diff --git a/tests/libgit2/apply/tree.c b/tests/libgit2/apply/tree.c
index 5154f134f..667bb9d40 100644
--- a/tests/libgit2/apply/tree.c
+++ b/tests/libgit2/apply/tree.c
@@ -35,8 +35,8 @@ void test_apply_tree__one(void)
{ 0100644, "a7b066537e6be7109abfe4ff97b675d4e077da20", 0, "veal.txt" },
};
- git_oid_fromstr(&a_oid, "539bd011c4822c560c1d17cab095006b7a10f707");
- git_oid_fromstr(&b_oid, "7c7bf85e978f1d18c0566f702d2cb7766b9c8d4f");
+ git_oid__fromstr(&a_oid, "539bd011c4822c560c1d17cab095006b7a10f707", GIT_OID_SHA1);
+ git_oid__fromstr(&b_oid, "7c7bf85e978f1d18c0566f702d2cb7766b9c8d4f", GIT_OID_SHA1);
cl_git_pass(git_commit_lookup(&a_commit, repo, &a_oid));
cl_git_pass(git_commit_lookup(&b_commit, repo, &b_oid));
@@ -75,7 +75,7 @@ void test_apply_tree__adds_file(void)
{ 0100644, "94d2c01087f48213bd157222d54edfefd77c9bba", 0, "veal.txt" },
};
- git_oid_fromstr(&a_oid, "539bd011c4822c560c1d17cab095006b7a10f707");
+ git_oid__fromstr(&a_oid, "539bd011c4822c560c1d17cab095006b7a10f707", GIT_OID_SHA1);
cl_git_pass(git_commit_lookup(&a_commit, repo, &a_oid));
diff --git a/tests/libgit2/apply/workdir.c b/tests/libgit2/apply/workdir.c
index d0d9c1aba..e1011d114 100644
--- a/tests/libgit2/apply/workdir.c
+++ b/tests/libgit2/apply/workdir.c
@@ -12,7 +12,7 @@ void test_apply_workdir__initialize(void)
repo = cl_git_sandbox_init(TEST_REPO_PATH);
- git_oid_fromstr(&oid, "539bd011c4822c560c1d17cab095006b7a10f707");
+ git_oid__fromstr(&oid, "539bd011c4822c560c1d17cab095006b7a10f707", GIT_OID_SHA1);
cl_git_pass(git_commit_lookup(&commit, repo, &oid));
cl_git_pass(git_reset(repo, (git_object *)commit, GIT_RESET_HARD, NULL));
git_commit_free(commit);
@@ -42,8 +42,8 @@ void test_apply_workdir__generated_diff(void)
size_t workdir_expected_cnt = sizeof(workdir_expected) /
sizeof(struct merge_index_entry);
- git_oid_fromstr(&a_oid, "539bd011c4822c560c1d17cab095006b7a10f707");
- git_oid_fromstr(&b_oid, "7c7bf85e978f1d18c0566f702d2cb7766b9c8d4f"); cl_git_pass(git_commit_lookup(&a_commit, repo, &a_oid));
+ git_oid__fromstr(&a_oid, "539bd011c4822c560c1d17cab095006b7a10f707", GIT_OID_SHA1);
+ git_oid__fromstr(&b_oid, "7c7bf85e978f1d18c0566f702d2cb7766b9c8d4f", GIT_OID_SHA1); cl_git_pass(git_commit_lookup(&a_commit, repo, &a_oid));
cl_git_pass(git_commit_lookup(&b_commit, repo, &b_oid));
cl_git_pass(git_commit_tree(&a_tree, a_commit));
@@ -171,7 +171,7 @@ void test_apply_workdir__modified_index_with_unmodified_workdir_is_ok(void)
idx_entry.mode = 0100644;
idx_entry.path = "veal.txt";
- cl_git_pass(git_oid_fromstr(&idx_entry.id, "ffb36e513f5fdf8a6ba850a20142676a2ac4807d"));
+ cl_git_pass(git_oid__fromstr(&idx_entry.id, "ffb36e513f5fdf8a6ba850a20142676a2ac4807d", GIT_OID_SHA1));
cl_git_pass(git_index_add(index, &idx_entry));
cl_git_pass(git_index_remove(index, "asparagus.txt", 0));
diff --git a/tests/libgit2/blame/blame_helpers.c b/tests/libgit2/blame/blame_helpers.c
index 6b3ce677d..8aeaa5886 100644
--- a/tests/libgit2/blame/blame_helpers.c
+++ b/tests/libgit2/blame/blame_helpers.c
@@ -17,7 +17,7 @@ void hunk_message(size_t idx, const git_blame_hunk *hunk, const char *fmt, ...)
void check_blame_hunk_index(git_repository *repo, git_blame *blame, int idx,
size_t start_line, size_t len, char boundary, const char *commit_id, const char *orig_path)
{
- char expected[GIT_OID_HEXSZ+1] = {0}, actual[GIT_OID_HEXSZ+1] = {0};
+ char expected[GIT_OID_SHA1_HEXSIZE+1] = {0}, actual[GIT_OID_SHA1_HEXSIZE+1] = {0};
const git_blame_hunk *hunk = git_blame_get_hunk_byindex(blame, idx);
cl_assert(hunk);
diff --git a/tests/libgit2/blame/getters.c b/tests/libgit2/blame/getters.c
index 66eaeecf9..c160cd383 100644
--- a/tests/libgit2/blame/getters.c
+++ b/tests/libgit2/blame/getters.c
@@ -10,11 +10,11 @@ void test_blame_getters__initialize(void)
git_blame_options opts = GIT_BLAME_OPTIONS_INIT;
git_blame_hunk hunks[] = {
- { 3, {{0}}, 1, NULL, {{0}}, "a", 0},
- { 3, {{0}}, 4, NULL, {{0}}, "b", 0},
- { 3, {{0}}, 7, NULL, {{0}}, "c", 0},
- { 3, {{0}}, 10, NULL, {{0}}, "d", 0},
- { 3, {{0}}, 13, NULL, {{0}}, "e", 0},
+ { 3, GIT_OID_SHA1_ZERO, 1, NULL, GIT_OID_SHA1_ZERO, "a", 0},
+ { 3, GIT_OID_SHA1_ZERO, 4, NULL, GIT_OID_SHA1_ZERO, "b", 0},
+ { 3, GIT_OID_SHA1_ZERO, 7, NULL, GIT_OID_SHA1_ZERO, "c", 0},
+ { 3, GIT_OID_SHA1_ZERO, 10, NULL, GIT_OID_SHA1_ZERO, "d", 0},
+ { 3, GIT_OID_SHA1_ZERO, 13, NULL, GIT_OID_SHA1_ZERO, "e", 0},
};
g_blame = git_blame__alloc(NULL, opts, "");
diff --git a/tests/libgit2/checkout/binaryunicode.c b/tests/libgit2/checkout/binaryunicode.c
index edb5cfaf5..b8c6c079e 100644
--- a/tests/libgit2/checkout/binaryunicode.c
+++ b/tests/libgit2/checkout/binaryunicode.c
@@ -3,6 +3,7 @@
#include "repo/repo_helpers.h"
#include "path.h"
#include "futils.h"
+#include "odb.h"
static git_repository *g_repo;
@@ -35,13 +36,13 @@ static void execute_test(void)
git_commit_free(commit);
/* Verify that the lenna.jpg file was checked out correctly */
- cl_git_pass(git_oid_fromstr(&check, "8ab005d890fe53f65eda14b23672f60d9f4ec5a1"));
- cl_git_pass(git_odb_hashfile(&oid, "binaryunicode/lenna.jpg", GIT_OBJECT_BLOB));
+ cl_git_pass(git_oid__fromstr(&check, "8ab005d890fe53f65eda14b23672f60d9f4ec5a1", GIT_OID_SHA1));
+ cl_git_pass(git_odb__hashfile(&oid, "binaryunicode/lenna.jpg", GIT_OBJECT_BLOB, GIT_OID_SHA1));
cl_assert_equal_oid(&oid, &check);
/* Verify that the text file was checked out correctly */
- cl_git_pass(git_oid_fromstr(&check, "965b223880dd4249e2c66a0cc0b4cffe1dc40f5a"));
- cl_git_pass(git_odb_hashfile(&oid, "binaryunicode/utf16_withbom_noeol_crlf.txt", GIT_OBJECT_BLOB));
+ cl_git_pass(git_oid__fromstr(&check, "965b223880dd4249e2c66a0cc0b4cffe1dc40f5a", GIT_OID_SHA1));
+ cl_git_pass(git_odb__hashfile(&oid, "binaryunicode/utf16_withbom_noeol_crlf.txt", GIT_OBJECT_BLOB, GIT_OID_SHA1));
cl_assert_equal_oid(&oid, &check);
}
diff --git a/tests/libgit2/checkout/conflict.c b/tests/libgit2/checkout/conflict.c
index 4a9e4b9fa..b2eb939dc 100644
--- a/tests/libgit2/checkout/conflict.c
+++ b/tests/libgit2/checkout/conflict.c
@@ -49,7 +49,7 @@ static git_index *g_index;
struct checkout_index_entry {
uint16_t mode;
- char oid_str[GIT_OID_HEXSZ+1];
+ char oid_str[GIT_OID_SHA1_HEXSIZE+1];
int stage;
char path[128];
};
@@ -104,7 +104,7 @@ static void create_index(struct checkout_index_entry *entries, size_t entries_le
entry.mode = entries[i].mode;
GIT_INDEX_ENTRY_STAGE_SET(&entry, entries[i].stage);
- git_oid_fromstr(&entry.id, entries[i].oid_str);
+ git_oid__fromstr(&entry.id, entries[i].oid_str, GIT_OID_SHA1);
entry.path = entries[i].path;
cl_git_pass(git_index_add(g_index, &entry));
@@ -155,7 +155,7 @@ static void ensure_workdir_oid(const char *path, const char *oid_str)
{
git_oid expected, actual;
- cl_git_pass(git_oid_fromstr(&expected, oid_str));
+ cl_git_pass(git_oid__fromstr(&expected, oid_str, GIT_OID_SHA1));
cl_git_pass(git_repository_hashfile(&actual, g_repo, path, GIT_OBJECT_BLOB, NULL));
cl_assert_equal_oid(&expected, &actual);
}
diff --git a/tests/libgit2/checkout/index.c b/tests/libgit2/checkout/index.c
index 6a80d22c5..6432cba84 100644
--- a/tests/libgit2/checkout/index.c
+++ b/tests/libgit2/checkout/index.c
@@ -791,15 +791,15 @@ static void add_conflict(git_index *index, const char *path)
entry.mode = 0100644;
entry.path = path;
- git_oid_fromstr(&entry.id, "d427e0b2e138501a3d15cc376077a3631e15bd46");
+ git_oid__fromstr(&entry.id, "d427e0b2e138501a3d15cc376077a3631e15bd46", GIT_OID_SHA1);
GIT_INDEX_ENTRY_STAGE_SET(&entry, 1);
cl_git_pass(git_index_add(index, &entry));
- git_oid_fromstr(&entry.id, "4e886e602529caa9ab11d71f86634bd1b6e0de10");
+ git_oid__fromstr(&entry.id, "4e886e602529caa9ab11d71f86634bd1b6e0de10", GIT_OID_SHA1);
GIT_INDEX_ENTRY_STAGE_SET(&entry, 2);
cl_git_pass(git_index_add(index, &entry));
- git_oid_fromstr(&entry.id, "2bd0a343aeef7a2cf0d158478966a6e587ff3863");
+ git_oid__fromstr(&entry.id, "2bd0a343aeef7a2cf0d158478966a6e587ff3863", GIT_OID_SHA1);
GIT_INDEX_ENTRY_STAGE_SET(&entry, 3);
cl_git_pass(git_index_add(index, &entry));
}
diff --git a/tests/libgit2/checkout/tree.c b/tests/libgit2/checkout/tree.c
index d4b57f5d1..65df00cd8 100644
--- a/tests/libgit2/checkout/tree.c
+++ b/tests/libgit2/checkout/tree.c
@@ -139,8 +139,8 @@ void test_checkout_tree__doesnt_write_unrequested_files_to_worktree(void)
git_commit* p_chomped_commit;
git_checkout_options opts = GIT_CHECKOUT_OPTIONS_INIT;
- git_oid_fromstr(&master_oid, "a65fedf39aefe402d3bb6e24df4d4f5fe4547750");
- git_oid_fromstr(&chomped_oid, "e90810b8df3e80c413d903f631643c716887138d");
+ git_oid__fromstr(&master_oid, "a65fedf39aefe402d3bb6e24df4d4f5fe4547750", GIT_OID_SHA1);
+ git_oid__fromstr(&chomped_oid, "e90810b8df3e80c413d903f631643c716887138d", GIT_OID_SHA1);
cl_git_pass(git_commit_lookup(&p_master_commit, g_repo, &master_oid));
cl_git_pass(git_commit_lookup(&p_chomped_commit, g_repo, &chomped_oid));
@@ -615,7 +615,7 @@ void test_checkout_tree__donot_update_deleted_file_by_default(void)
cl_git_pass(git_repository_index(&index, g_repo));
- cl_git_pass(git_oid_fromstr(&old_id, "be3563ae3f795b2b4353bcce3a527ad0a4f7f644"));
+ cl_git_pass(git_oid__fromstr(&old_id, "be3563ae3f795b2b4353bcce3a527ad0a4f7f644", GIT_OID_SHA1));
cl_git_pass(git_commit_lookup(&old_commit, g_repo, &old_id));
cl_git_pass(git_reset(g_repo, (git_object *)old_commit, GIT_RESET_HARD, NULL));
@@ -625,7 +625,7 @@ void test_checkout_tree__donot_update_deleted_file_by_default(void)
cl_assert(!git_fs_path_exists("testrepo/branch_file.txt"));
- cl_git_pass(git_oid_fromstr(&new_id, "099fabac3a9ea935598528c27f866e34089c2eff"));
+ cl_git_pass(git_oid__fromstr(&new_id, "099fabac3a9ea935598528c27f866e34089c2eff", GIT_OID_SHA1));
cl_git_pass(git_commit_lookup(&new_commit, g_repo, &new_id));
@@ -941,16 +941,16 @@ static void create_conflict(const char *path)
memset(&entry, 0x0, sizeof(git_index_entry));
entry.mode = 0100644;
GIT_INDEX_ENTRY_STAGE_SET(&entry, 1);
- git_oid_fromstr(&entry.id, "d427e0b2e138501a3d15cc376077a3631e15bd46");
+ git_oid__fromstr(&entry.id, "d427e0b2e138501a3d15cc376077a3631e15bd46", GIT_OID_SHA1);
entry.path = path;
cl_git_pass(git_index_add(index, &entry));
GIT_INDEX_ENTRY_STAGE_SET(&entry, 2);
- git_oid_fromstr(&entry.id, "ee3fa1b8c00aff7fe02065fdb50864bb0d932ccf");
+ git_oid__fromstr(&entry.id, "ee3fa1b8c00aff7fe02065fdb50864bb0d932ccf", GIT_OID_SHA1);
cl_git_pass(git_index_add(index, &entry));
GIT_INDEX_ENTRY_STAGE_SET(&entry, 3);
- git_oid_fromstr(&entry.id, "2bd0a343aeef7a2cf0d158478966a6e587ff3863");
+ git_oid__fromstr(&entry.id, "2bd0a343aeef7a2cf0d158478966a6e587ff3863", GIT_OID_SHA1);
cl_git_pass(git_index_add(index, &entry));
cl_git_pass(git_index_write(index));
@@ -988,7 +988,7 @@ void test_checkout_tree__filemode_preserved_in_index(void)
cl_git_pass(git_repository_index(&index, g_repo));
/* test a freshly added executable */
- cl_git_pass(git_oid_fromstr(&executable_oid, "afe4393b2b2a965f06acf2ca9658eaa01e0cd6b6"));
+ cl_git_pass(git_oid__fromstr(&executable_oid, "afe4393b2b2a965f06acf2ca9658eaa01e0cd6b6", GIT_OID_SHA1));
cl_git_pass(git_commit_lookup(&commit, g_repo, &executable_oid));
cl_git_pass(git_checkout_tree(g_repo, (const git_object *)commit, &opts));
@@ -999,7 +999,7 @@ void test_checkout_tree__filemode_preserved_in_index(void)
/* Now start with a commit which has a text file */
- cl_git_pass(git_oid_fromstr(&executable_oid, "cf80f8de9f1185bf3a05f993f6121880dd0cfbc9"));
+ cl_git_pass(git_oid__fromstr(&executable_oid, "cf80f8de9f1185bf3a05f993f6121880dd0cfbc9", GIT_OID_SHA1));
cl_git_pass(git_commit_lookup(&commit, g_repo, &executable_oid));
cl_git_pass(git_checkout_tree(g_repo, (const git_object *)commit, &opts));
@@ -1010,7 +1010,7 @@ void test_checkout_tree__filemode_preserved_in_index(void)
/* And then check out to a commit which converts the text file to an executable */
- cl_git_pass(git_oid_fromstr(&executable_oid, "144344043ba4d4a405da03de3844aa829ae8be0e"));
+ cl_git_pass(git_oid__fromstr(&executable_oid, "144344043ba4d4a405da03de3844aa829ae8be0e", GIT_OID_SHA1));
cl_git_pass(git_commit_lookup(&commit, g_repo, &executable_oid));
cl_git_pass(git_checkout_tree(g_repo, (const git_object *)commit, &opts));
@@ -1021,7 +1021,7 @@ void test_checkout_tree__filemode_preserved_in_index(void)
/* Finally, check out the text file again and check that the exec bit is cleared */
- cl_git_pass(git_oid_fromstr(&executable_oid, "cf80f8de9f1185bf3a05f993f6121880dd0cfbc9"));
+ cl_git_pass(git_oid__fromstr(&executable_oid, "cf80f8de9f1185bf3a05f993f6121880dd0cfbc9", GIT_OID_SHA1));
cl_git_pass(git_commit_lookup(&commit, g_repo, &executable_oid));
cl_git_pass(git_checkout_tree(g_repo, (const git_object *)commit, &opts));
@@ -1063,7 +1063,7 @@ void test_checkout_tree__filemode_preserved_in_workdir(void)
opts.checkout_strategy = GIT_CHECKOUT_FORCE;
/* test a freshly added executable */
- cl_git_pass(git_oid_fromstr(&executable_oid, "afe4393b2b2a965f06acf2ca9658eaa01e0cd6b6"));
+ cl_git_pass(git_oid__fromstr(&executable_oid, "afe4393b2b2a965f06acf2ca9658eaa01e0cd6b6", GIT_OID_SHA1));
cl_git_pass(git_commit_lookup(&commit, g_repo, &executable_oid));
cl_git_pass(git_checkout_tree(g_repo, (const git_object *)commit, &opts));
@@ -1073,7 +1073,7 @@ void test_checkout_tree__filemode_preserved_in_workdir(void)
/* Now start with a commit which has a text file */
- cl_git_pass(git_oid_fromstr(&executable_oid, "cf80f8de9f1185bf3a05f993f6121880dd0cfbc9"));
+ cl_git_pass(git_oid__fromstr(&executable_oid, "cf80f8de9f1185bf3a05f993f6121880dd0cfbc9", GIT_OID_SHA1));
cl_git_pass(git_commit_lookup(&commit, g_repo, &executable_oid));
cl_git_pass(git_checkout_tree(g_repo, (const git_object *)commit, &opts));
@@ -1083,7 +1083,7 @@ void test_checkout_tree__filemode_preserved_in_workdir(void)
/* And then check out to a commit which converts the text file to an executable */
- cl_git_pass(git_oid_fromstr(&executable_oid, "144344043ba4d4a405da03de3844aa829ae8be0e"));
+ cl_git_pass(git_oid__fromstr(&executable_oid, "144344043ba4d4a405da03de3844aa829ae8be0e", GIT_OID_SHA1));
cl_git_pass(git_commit_lookup(&commit, g_repo, &executable_oid));
cl_git_pass(git_checkout_tree(g_repo, (const git_object *)commit, &opts));
@@ -1093,7 +1093,7 @@ void test_checkout_tree__filemode_preserved_in_workdir(void)
/* Finally, check out the text file again and check that the exec bit is cleared */
- cl_git_pass(git_oid_fromstr(&executable_oid, "cf80f8de9f1185bf3a05f993f6121880dd0cfbc9"));
+ cl_git_pass(git_oid__fromstr(&executable_oid, "cf80f8de9f1185bf3a05f993f6121880dd0cfbc9", GIT_OID_SHA1));
cl_git_pass(git_commit_lookup(&commit, g_repo, &executable_oid));
cl_git_pass(git_checkout_tree(g_repo, (const git_object *)commit, &opts));
@@ -1112,7 +1112,7 @@ void test_checkout_tree__removes_conflicts(void)
git_checkout_options opts = GIT_CHECKOUT_OPTIONS_INIT;
git_index *index;
- cl_git_pass(git_oid_fromstr(&commit_id, "afe4393b2b2a965f06acf2ca9658eaa01e0cd6b6"));
+ cl_git_pass(git_oid__fromstr(&commit_id, "afe4393b2b2a965f06acf2ca9658eaa01e0cd6b6", GIT_OID_SHA1));
cl_git_pass(git_commit_lookup(&commit, g_repo, &commit_id));
opts.checkout_strategy = GIT_CHECKOUT_FORCE;
@@ -1155,7 +1155,7 @@ void test_checkout_tree__removes_conflicts_only_by_pathscope(void)
git_index *index;
const char *path = "executable.txt";
- cl_git_pass(git_oid_fromstr(&commit_id, "afe4393b2b2a965f06acf2ca9658eaa01e0cd6b6"));
+ cl_git_pass(git_oid__fromstr(&commit_id, "afe4393b2b2a965f06acf2ca9658eaa01e0cd6b6", GIT_OID_SHA1));
cl_git_pass(git_commit_lookup(&commit, g_repo, &commit_id));
opts.checkout_strategy = GIT_CHECKOUT_FORCE;
@@ -1583,7 +1583,7 @@ static void modify_index_ondisk(void)
cl_git_pass(git_repository_open(&other_repo, git_repository_workdir(g_repo)));
cl_git_pass(git_repository_index(&other_index, other_repo));
- cl_git_pass(git_oid_fromstr(&entry.id, "1385f264afb75a56a5bec74243be9b367ba4ca08"));
+ cl_git_pass(git_oid__fromstr(&entry.id, "1385f264afb75a56a5bec74243be9b367ba4ca08", GIT_OID_SHA1));
entry.mode = 0100644;
entry.path = "README";
diff --git a/tests/libgit2/checkout/typechange.c b/tests/libgit2/checkout/typechange.c
index b888843f0..1fa2d3095 100644
--- a/tests/libgit2/checkout/typechange.c
+++ b/tests/libgit2/checkout/typechange.c
@@ -319,7 +319,7 @@ void test_checkout_typechange__status_char(void)
git_diff_options diffopts = GIT_DIFF_OPTIONS_INIT;
char expected[8] = {'M', 'M', 'R', 'T', 'D', 'R', 'A', 'R'};
- git_oid_fromstr(&oid, "9b19edf33a03a0c59cdfc113bfa5c06179bf9b1a");
+ git_oid__fromstr(&oid, "9b19edf33a03a0c59cdfc113bfa5c06179bf9b1a", GIT_OID_SHA1);
cl_git_pass(git_commit_lookup(&commit, g_repo, &oid));
diffopts.flags |= GIT_DIFF_INCLUDE_TYPECHANGE;
cl_git_pass(git_diff__commit(&diff, g_repo, commit, &diffopts));
diff --git a/tests/libgit2/cherrypick/bare.c b/tests/libgit2/cherrypick/bare.c
index f90ce0226..664468899 100644
--- a/tests/libgit2/cherrypick/bare.c
+++ b/tests/libgit2/cherrypick/bare.c
@@ -32,10 +32,10 @@ void test_cherrypick_bare__automerge(void)
{ 0100644, "df6b290e0bd6a89b01d69f66687e8abf385283ca", 0, "file3.txt" },
};
- git_oid_fromstr(&head_oid, "d3d77487660ee3c0194ee01dc5eaf478782b1c7e");
+ git_oid__fromstr(&head_oid, "d3d77487660ee3c0194ee01dc5eaf478782b1c7e", GIT_OID_SHA1);
cl_git_pass(git_commit_lookup(&head, repo, &head_oid));
- git_oid_fromstr(&cherry_oid, "cfc4f0999a8367568e049af4f72e452d40828a15");
+ git_oid__fromstr(&cherry_oid, "cfc4f0999a8367568e049af4f72e452d40828a15", GIT_OID_SHA1);
cl_git_pass(git_commit_lookup(&commit, repo, &cherry_oid));
cl_git_pass(git_cherrypick_commit(&index, repo, commit, head, 0, NULL));
@@ -62,10 +62,10 @@ void test_cherrypick_bare__conflicts(void)
{ 0100644, "e233b9ed408a95e9d4b65fec7fc34943a556deb2", 3, "file3.txt" },
};
- git_oid_fromstr(&head_oid, "bafbf6912c09505ac60575cd43d3f2aba3bd84d8");
+ git_oid__fromstr(&head_oid, "bafbf6912c09505ac60575cd43d3f2aba3bd84d8", GIT_OID_SHA1);
cl_git_pass(git_commit_lookup(&head, repo, &head_oid));
- git_oid_fromstr(&cherry_oid, "e9b63f3655b2ad80c0ff587389b5a9589a3a7110");
+ git_oid__fromstr(&cherry_oid, "e9b63f3655b2ad80c0ff587389b5a9589a3a7110", GIT_OID_SHA1);
cl_git_pass(git_commit_lookup(&commit, repo, &cherry_oid));
cl_git_pass(git_cherrypick_commit(&index, repo, commit, head, 0, NULL));
@@ -89,10 +89,10 @@ void test_cherrypick_bare__orphan(void)
{ 0100644, "9ccb9bf50c011fd58dcbaa65df917bf79539717f", 0, "orphan.txt" },
};
- git_oid_fromstr(&head_oid, "d3d77487660ee3c0194ee01dc5eaf478782b1c7e");
+ git_oid__fromstr(&head_oid, "d3d77487660ee3c0194ee01dc5eaf478782b1c7e", GIT_OID_SHA1);
cl_git_pass(git_commit_lookup(&head, repo, &head_oid));
- git_oid_fromstr(&cherry_oid, "74f06b5bfec6d33d7264f73606b57a7c0b963819");
+ git_oid__fromstr(&cherry_oid, "74f06b5bfec6d33d7264f73606b57a7c0b963819", GIT_OID_SHA1);
cl_git_pass(git_commit_lookup(&commit, repo, &cherry_oid));
cl_git_pass(git_cherrypick_commit(&index, repo, commit, head, 0, NULL));
diff --git a/tests/libgit2/cherrypick/workdir.c b/tests/libgit2/cherrypick/workdir.c
index 8fd1ecbdf..c16b7814a 100644
--- a/tests/libgit2/cherrypick/workdir.c
+++ b/tests/libgit2/cherrypick/workdir.c
@@ -57,7 +57,7 @@ void test_cherrypick_workdir__automerge(void)
cl_git_pass(git_signature_new(&signature, "Picker", "picker@example.org", time(NULL), 0));
- git_oid_fromstr(&head_oid, "d3d77487660ee3c0194ee01dc5eaf478782b1c7e");
+ git_oid__fromstr(&head_oid, "d3d77487660ee3c0194ee01dc5eaf478782b1c7e", GIT_OID_SHA1);
for (i = 0; i < 3; ++i) {
git_commit *head = NULL, *commit = NULL;
@@ -67,7 +67,7 @@ void test_cherrypick_workdir__automerge(void)
cl_git_pass(git_commit_lookup(&head, repo, &head_oid));
cl_git_pass(git_reset(repo, (git_object *)head, GIT_RESET_HARD, NULL));
- git_oid_fromstr(&cherry_oid, cherrypick_oids[i]);
+ git_oid__fromstr(&cherry_oid, cherrypick_oids[i], GIT_OID_SHA1);
cl_git_pass(git_commit_lookup(&commit, repo, &cherry_oid));
cl_git_pass(git_cherrypick(repo, commit, NULL));
@@ -110,7 +110,7 @@ void test_cherrypick_workdir__empty_result(void)
cl_git_pass(git_signature_new(&signature, "Picker", "picker@example.org", time(NULL), 0));
- git_oid_fromstr(&head_oid, "cfc4f0999a8367568e049af4f72e452d40828a15");
+ git_oid__fromstr(&head_oid, "cfc4f0999a8367568e049af4f72e452d40828a15", GIT_OID_SHA1);
/* Create an untracked file that should not conflict */
cl_git_mkfile(TEST_REPO_PATH "/file4.txt", "");
@@ -119,7 +119,7 @@ void test_cherrypick_workdir__empty_result(void)
cl_git_pass(git_commit_lookup(&head, repo, &head_oid));
cl_git_pass(git_reset(repo, (git_object *)head, GIT_RESET_HARD, NULL));
- git_oid_fromstr(&cherry_oid, cherrypick_oid);
+ git_oid__fromstr(&cherry_oid, cherrypick_oid, GIT_OID_SHA1);
cl_git_pass(git_commit_lookup(&commit, repo, &cherry_oid));
cl_git_pass(git_cherrypick(repo, commit, NULL));
@@ -151,12 +151,12 @@ void test_cherrypick_workdir__conflicts(void)
{ 0100644, "e233b9ed408a95e9d4b65fec7fc34943a556deb2", 3, "file3.txt" },
};
- git_oid_fromstr(&head_oid, "bafbf6912c09505ac60575cd43d3f2aba3bd84d8");
+ git_oid__fromstr(&head_oid, "bafbf6912c09505ac60575cd43d3f2aba3bd84d8", GIT_OID_SHA1);
cl_git_pass(git_commit_lookup(&head, repo, &head_oid));
cl_git_pass(git_reset(repo, (git_object *)head, GIT_RESET_HARD, NULL));
- git_oid_fromstr(&cherry_oid, "e9b63f3655b2ad80c0ff587389b5a9589a3a7110");
+ git_oid__fromstr(&cherry_oid, "e9b63f3655b2ad80c0ff587389b5a9589a3a7110", GIT_OID_SHA1);
cl_git_pass(git_commit_lookup(&commit, repo, &cherry_oid));
cl_git_pass(git_cherrypick(repo, commit, NULL));
@@ -259,12 +259,12 @@ void test_cherrypick_workdir__conflict_use_ours(void)
/* leave the index in a conflicted state, but checkout "ours" to the workdir */
opts.checkout_opts.checkout_strategy = GIT_CHECKOUT_SAFE | GIT_CHECKOUT_USE_OURS;
- git_oid_fromstr(&head_oid, "bafbf6912c09505ac60575cd43d3f2aba3bd84d8");
+ git_oid__fromstr(&head_oid, "bafbf6912c09505ac60575cd43d3f2aba3bd84d8", GIT_OID_SHA1);
cl_git_pass(git_commit_lookup(&head, repo, &head_oid));
cl_git_pass(git_reset(repo, (git_object *)head, GIT_RESET_HARD, NULL));
- git_oid_fromstr(&cherry_oid, "e9b63f3655b2ad80c0ff587389b5a9589a3a7110");
+ git_oid__fromstr(&cherry_oid, "e9b63f3655b2ad80c0ff587389b5a9589a3a7110", GIT_OID_SHA1);
cl_git_pass(git_commit_lookup(&commit, repo, &cherry_oid));
cl_git_pass(git_cherrypick(repo, commit, &opts));
@@ -302,11 +302,11 @@ void test_cherrypick_workdir__rename(void)
opts.merge_opts.flags |= GIT_MERGE_FIND_RENAMES;
opts.merge_opts.rename_threshold = 50;
- git_oid_fromstr(&head_oid, "cfc4f0999a8367568e049af4f72e452d40828a15");
+ git_oid__fromstr(&head_oid, "cfc4f0999a8367568e049af4f72e452d40828a15", GIT_OID_SHA1);
cl_git_pass(git_commit_lookup(&head, repo, &head_oid));
cl_git_pass(git_reset(repo, (git_object *)head, GIT_RESET_HARD, NULL));
- git_oid_fromstr(&cherry_oid, "2a26c7e88b285613b302ba76712bc998863f3cbc");
+ git_oid__fromstr(&cherry_oid, "2a26c7e88b285613b302ba76712bc998863f3cbc", GIT_OID_SHA1);
cl_git_pass(git_commit_lookup(&commit, repo, &cherry_oid));
cl_git_pass(git_cherrypick(repo, commit, &opts));
@@ -337,11 +337,11 @@ void test_cherrypick_workdir__both_renamed(void)
opts.merge_opts.flags |= GIT_MERGE_FIND_RENAMES;
opts.merge_opts.rename_threshold = 50;
- git_oid_fromstr(&head_oid, "44cd2ed2052c9c68f9a439d208e9614dc2a55c70");
+ git_oid__fromstr(&head_oid, "44cd2ed2052c9c68f9a439d208e9614dc2a55c70", GIT_OID_SHA1);
cl_git_pass(git_commit_lookup(&head, repo, &head_oid));
cl_git_pass(git_reset(repo, (git_object *)head, GIT_RESET_HARD, NULL));
- git_oid_fromstr(&cherry_oid, "2a26c7e88b285613b302ba76712bc998863f3cbc");
+ git_oid__fromstr(&cherry_oid, "2a26c7e88b285613b302ba76712bc998863f3cbc", GIT_OID_SHA1);
cl_git_pass(git_commit_lookup(&commit, repo, &cherry_oid));
cl_git_pass(git_cherrypick(repo, commit, &opts));
@@ -388,11 +388,11 @@ void test_cherrypick_workdir__merge_fails_without_mainline_specified(void)
git_commit *head, *commit;
git_oid head_oid, cherry_oid;
- git_oid_fromstr(&head_oid, "cfc4f0999a8367568e049af4f72e452d40828a15");
+ git_oid__fromstr(&head_oid, "cfc4f0999a8367568e049af4f72e452d40828a15", GIT_OID_SHA1);
cl_git_pass(git_commit_lookup(&head, repo, &head_oid));
cl_git_pass(git_reset(repo, (git_object *)head, GIT_RESET_HARD, NULL));
- git_oid_fromstr(&cherry_oid, "abe4603bc7cd5b8167a267e0e2418fd2348f8cff");
+ git_oid__fromstr(&cherry_oid, "abe4603bc7cd5b8167a267e0e2418fd2348f8cff", GIT_OID_SHA1);
cl_git_pass(git_commit_lookup(&commit, repo, &cherry_oid));
cl_must_fail(git_cherrypick(repo, commit, NULL));
@@ -420,11 +420,11 @@ void test_cherrypick_workdir__merge_first_parent(void)
opts.mainline = 1;
- git_oid_fromstr(&head_oid, "cfc4f0999a8367568e049af4f72e452d40828a15");
+ git_oid__fromstr(&head_oid, "cfc4f0999a8367568e049af4f72e452d40828a15", GIT_OID_SHA1);
cl_git_pass(git_commit_lookup(&head, repo, &head_oid));
cl_git_pass(git_reset(repo, (git_object *)head, GIT_RESET_HARD, NULL));
- git_oid_fromstr(&cherry_oid, "abe4603bc7cd5b8167a267e0e2418fd2348f8cff");
+ git_oid__fromstr(&cherry_oid, "abe4603bc7cd5b8167a267e0e2418fd2348f8cff", GIT_OID_SHA1);
cl_git_pass(git_commit_lookup(&commit, repo, &cherry_oid));
cl_git_pass(git_cherrypick(repo, commit, &opts));
@@ -452,11 +452,11 @@ void test_cherrypick_workdir__merge_second_parent(void)
opts.mainline = 2;
- git_oid_fromstr(&head_oid, "cfc4f0999a8367568e049af4f72e452d40828a15");
+ git_oid__fromstr(&head_oid, "cfc4f0999a8367568e049af4f72e452d40828a15", GIT_OID_SHA1);
cl_git_pass(git_commit_lookup(&head, repo, &head_oid));
cl_git_pass(git_reset(repo, (git_object *)head, GIT_RESET_HARD, NULL));
- git_oid_fromstr(&cherry_oid, "abe4603bc7cd5b8167a267e0e2418fd2348f8cff");
+ git_oid__fromstr(&cherry_oid, "abe4603bc7cd5b8167a267e0e2418fd2348f8cff", GIT_OID_SHA1);
cl_git_pass(git_commit_lookup(&commit, repo, &cherry_oid));
cl_git_pass(git_cherrypick(repo, commit, &opts));
diff --git a/tests/libgit2/commit/commit.c b/tests/libgit2/commit/commit.c
index fd574f7f2..140f87d0c 100644
--- a/tests/libgit2/commit/commit.c
+++ b/tests/libgit2/commit/commit.c
@@ -26,10 +26,10 @@ void test_commit_commit__create_unexisting_update_ref(void)
git_signature *s;
git_reference *ref;
- git_oid_fromstr(&oid, "a65fedf39aefe402d3bb6e24df4d4f5fe4547750");
+ git_oid__fromstr(&oid, "a65fedf39aefe402d3bb6e24df4d4f5fe4547750", GIT_OID_SHA1);
cl_git_pass(git_commit_lookup(&commit, _repo, &oid));
- git_oid_fromstr(&oid, "944c0f6e4dfa41595e6eb3ceecdb14f50fe18162");
+ git_oid__fromstr(&oid, "944c0f6e4dfa41595e6eb3ceecdb14f50fe18162", GIT_OID_SHA1);
cl_git_pass(git_tree_lookup(&tree, _repo, &oid));
cl_git_pass(git_signature_now(&s, "alice", "alice@example.com"));
@@ -59,10 +59,10 @@ void test_commit_commit__create_initial_commit(void)
git_signature *s;
git_reference *ref;
- git_oid_fromstr(&oid, "a65fedf39aefe402d3bb6e24df4d4f5fe4547750");
+ git_oid__fromstr(&oid, "a65fedf39aefe402d3bb6e24df4d4f5fe4547750", GIT_OID_SHA1);
cl_git_pass(git_commit_lookup(&commit, _repo, &oid));
- git_oid_fromstr(&oid, "944c0f6e4dfa41595e6eb3ceecdb14f50fe18162");
+ git_oid__fromstr(&oid, "944c0f6e4dfa41595e6eb3ceecdb14f50fe18162", GIT_OID_SHA1);
cl_git_pass(git_tree_lookup(&tree, _repo, &oid));
cl_git_pass(git_signature_now(&s, "alice", "alice@example.com"));
@@ -89,10 +89,10 @@ void test_commit_commit__create_initial_commit_parent_not_current(void)
git_commit *commit;
git_signature *s;
- git_oid_fromstr(&oid, "a65fedf39aefe402d3bb6e24df4d4f5fe4547750");
+ git_oid__fromstr(&oid, "a65fedf39aefe402d3bb6e24df4d4f5fe4547750", GIT_OID_SHA1);
cl_git_pass(git_commit_lookup(&commit, _repo, &oid));
- git_oid_fromstr(&oid, "944c0f6e4dfa41595e6eb3ceecdb14f50fe18162");
+ git_oid__fromstr(&oid, "944c0f6e4dfa41595e6eb3ceecdb14f50fe18162", GIT_OID_SHA1);
cl_git_pass(git_tree_lookup(&tree, _repo, &oid));
cl_git_pass(git_signature_now(&s, "alice", "alice@example.com"));
diff --git a/tests/libgit2/commit/parent.c b/tests/libgit2/commit/parent.c
index 18ce0bba6..1ec96babb 100644
--- a/tests/libgit2/commit/parent.c
+++ b/tests/libgit2/commit/parent.c
@@ -9,7 +9,7 @@ void test_commit_parent__initialize(void)
cl_git_pass(git_repository_open(&_repo, cl_fixture("testrepo.git")));
- git_oid_fromstr(&oid, "be3563ae3f795b2b4353bcce3a527ad0a4f7f644");
+ git_oid__fromstr(&oid, "be3563ae3f795b2b4353bcce3a527ad0a4f7f644", GIT_OID_SHA1);
cl_git_pass(git_commit_lookup(&commit, _repo, &oid));
}
diff --git a/tests/libgit2/commit/parse.c b/tests/libgit2/commit/parse.c
index 04366d7d2..b313fc308 100644
--- a/tests/libgit2/commit/parse.c
+++ b/tests/libgit2/commit/parse.c
@@ -56,7 +56,8 @@ void test_commit_parse__header(void)
const char *line = testcase->line;
const char *line_end = line + strlen(line);
- cl_git_pass(git_oid__parse(&oid, &line, line_end, testcase->header));
+ cl_git_pass(git_object__parse_oid_header(&oid,
+ &line, line_end, testcase->header, GIT_OID_SHA1));
cl_assert(line == line_end);
}
@@ -65,7 +66,8 @@ void test_commit_parse__header(void)
const char *line = testcase->line;
const char *line_end = line + strlen(line);
- cl_git_fail(git_oid__parse(&oid, &line, line_end, testcase->header));
+ cl_git_fail(git_object__parse_oid_header(&oid,
+ &line, line_end, testcase->header, GIT_OID_SHA1));
}
}
@@ -341,7 +343,7 @@ void test_commit_parse__details0(void) {
unsigned int parents, p;
git_commit *parent = NULL, *old_parent = NULL;
- git_oid_fromstr(&id, commit_ids[i]);
+ git_oid__fromstr(&id, commit_ids[i], GIT_OID_SHA1);
cl_git_pass(git_commit_lookup(&commit, g_repo, &id));
@@ -531,7 +533,7 @@ corrupt signature\n";
git_buf_dispose(&signed_data);
/* Try to parse a tree */
- cl_git_pass(git_oid_fromstr(&commit_id, "45dd856fdd4d89b884c340ba0e047752d9b085d6"));
+ cl_git_pass(git_oid__fromstr(&commit_id, "45dd856fdd4d89b884c340ba0e047752d9b085d6", GIT_OID_SHA1));
cl_git_fail_with(GIT_ENOTFOUND, git_commit_extract_signature(&signature, &signed_data, g_repo, &commit_id, NULL));
cl_assert_equal_i(GIT_ERROR_INVALID, git_error_last()->klass);
diff --git a/tests/libgit2/commit/write.c b/tests/libgit2/commit/write.c
index 5a9c9d5a5..890f7384b 100644
--- a/tests/libgit2/commit/write.c
+++ b/tests/libgit2/commit/write.c
@@ -51,10 +51,10 @@ void test_commit_write__from_memory(void)
git_commit *parent;
git_tree *tree;
- git_oid_fromstr(&tree_id, tree_id_str);
+ git_oid__fromstr(&tree_id, tree_id_str, GIT_OID_SHA1);
cl_git_pass(git_tree_lookup(&tree, g_repo, &tree_id));
- git_oid_fromstr(&parent_id, parent_id_str);
+ git_oid__fromstr(&parent_id, parent_id_str, GIT_OID_SHA1);
cl_git_pass(git_commit_lookup(&parent, g_repo, &parent_id));
/* create signatures */
@@ -107,14 +107,14 @@ void test_commit_write__into_buf(void)
git_oid parent_id;
git_buf commit = GIT_BUF_INIT;
- git_oid_fromstr(&tree_id, tree_id_str);
+ git_oid__fromstr(&tree_id, tree_id_str, GIT_OID_SHA1);
cl_git_pass(git_tree_lookup(&tree, g_repo, &tree_id));
/* create signatures */
cl_git_pass(git_signature_new(&committer, committer_name, committer_email, 123456789, 60));
cl_git_pass(git_signature_new(&author, committer_name, committer_email, 987654321, 90));
- git_oid_fromstr(&parent_id, parent_id_str);
+ git_oid__fromstr(&parent_id, parent_id_str, GIT_OID_SHA1);
cl_git_pass(git_commit_lookup(&parent, g_repo, &parent_id));
cl_git_pass(git_commit_create_buffer(&commit, g_repo, author, committer,
@@ -148,7 +148,7 @@ void test_commit_write__root(void)
git_reflog *log;
const git_reflog_entry *entry;
- git_oid_fromstr(&tree_id, tree_id_str);
+ git_oid__fromstr(&tree_id, tree_id_str, GIT_OID_SHA1);
cl_git_pass(git_tree_lookup(&tree, g_repo, &tree_id));
/* create signatures */
@@ -242,34 +242,34 @@ void test_commit_write__can_write_invalid_objects(void)
cl_git_pass(git_libgit2_opts(GIT_OPT_ENABLE_STRICT_OBJECT_CREATION, 0));
/* this is a valid tree and parent */
- git_oid_fromstr(&tree_id, tree_id_str);
- git_oid_fromstr(&parent_id, parent_id_str);
+ git_oid__fromstr(&tree_id, tree_id_str, GIT_OID_SHA1);
+ git_oid__fromstr(&parent_id, parent_id_str, GIT_OID_SHA1);
- git_oid_fromstr(&expected_id, "c8571bbec3a72c4bcad31648902e5a453f1adece");
+ git_oid__fromstr(&expected_id, "c8571bbec3a72c4bcad31648902e5a453f1adece", GIT_OID_SHA1);
cl_git_pass(create_commit_from_ids(&commit_id, &tree_id, &parent_id));
cl_assert_equal_oid(&expected_id, &commit_id);
/* this is a wholly invented tree id */
- git_oid_fromstr(&tree_id, "1234567890123456789012345678901234567890");
- git_oid_fromstr(&parent_id, parent_id_str);
+ git_oid__fromstr(&tree_id, "1234567890123456789012345678901234567890", GIT_OID_SHA1);
+ git_oid__fromstr(&parent_id, parent_id_str, GIT_OID_SHA1);
- git_oid_fromstr(&expected_id, "996008340b8e68d69bf3c28d7c57fb7ec3c8e202");
+ git_oid__fromstr(&expected_id, "996008340b8e68d69bf3c28d7c57fb7ec3c8e202", GIT_OID_SHA1);
cl_git_pass(create_commit_from_ids(&commit_id, &tree_id, &parent_id));
cl_assert_equal_oid(&expected_id, &commit_id);
/* this is a wholly invented parent id */
- git_oid_fromstr(&tree_id, tree_id_str);
- git_oid_fromstr(&parent_id, "1234567890123456789012345678901234567890");
+ git_oid__fromstr(&tree_id, tree_id_str, GIT_OID_SHA1);
+ git_oid__fromstr(&parent_id, "1234567890123456789012345678901234567890", GIT_OID_SHA1);
- git_oid_fromstr(&expected_id, "d78f660cab89d9791ca6714b57978bf2a7e709fd");
+ git_oid__fromstr(&expected_id, "d78f660cab89d9791ca6714b57978bf2a7e709fd", GIT_OID_SHA1);
cl_git_pass(create_commit_from_ids(&commit_id, &tree_id, &parent_id));
cl_assert_equal_oid(&expected_id, &commit_id);
/* these are legitimate objects, but of the wrong type */
- git_oid_fromstr(&tree_id, parent_id_str);
- git_oid_fromstr(&parent_id, tree_id_str);
+ git_oid__fromstr(&tree_id, parent_id_str, GIT_OID_SHA1);
+ git_oid__fromstr(&parent_id, tree_id_str, GIT_OID_SHA1);
- git_oid_fromstr(&expected_id, "5d80c07414e3f18792949699dfcacadf7748f361");
+ git_oid__fromstr(&expected_id, "5d80c07414e3f18792949699dfcacadf7748f361", GIT_OID_SHA1);
cl_git_pass(create_commit_from_ids(&commit_id, &tree_id, &parent_id));
cl_assert_equal_oid(&expected_id, &commit_id);
}
@@ -279,23 +279,23 @@ void test_commit_write__can_validate_objects(void)
git_oid tree_id, parent_id, commit_id;
/* this is a valid tree and parent */
- git_oid_fromstr(&tree_id, tree_id_str);
- git_oid_fromstr(&parent_id, parent_id_str);
+ git_oid__fromstr(&tree_id, tree_id_str, GIT_OID_SHA1);
+ git_oid__fromstr(&parent_id, parent_id_str, GIT_OID_SHA1);
cl_git_pass(create_commit_from_ids(&commit_id, &tree_id, &parent_id));
/* this is a wholly invented tree id */
- git_oid_fromstr(&tree_id, "1234567890123456789012345678901234567890");
- git_oid_fromstr(&parent_id, parent_id_str);
+ git_oid__fromstr(&tree_id, "1234567890123456789012345678901234567890", GIT_OID_SHA1);
+ git_oid__fromstr(&parent_id, parent_id_str, GIT_OID_SHA1);
cl_git_fail(create_commit_from_ids(&commit_id, &tree_id, &parent_id));
/* this is a wholly invented parent id */
- git_oid_fromstr(&tree_id, tree_id_str);
- git_oid_fromstr(&parent_id, "1234567890123456789012345678901234567890");
+ git_oid__fromstr(&tree_id, tree_id_str, GIT_OID_SHA1);
+ git_oid__fromstr(&parent_id, "1234567890123456789012345678901234567890", GIT_OID_SHA1);
cl_git_fail(create_commit_from_ids(&commit_id, &tree_id, &parent_id));
/* these are legitimate objects, but of the wrong type */
- git_oid_fromstr(&tree_id, parent_id_str);
- git_oid_fromstr(&parent_id, tree_id_str);
+ git_oid__fromstr(&tree_id, parent_id_str, GIT_OID_SHA1);
+ git_oid__fromstr(&parent_id, tree_id_str, GIT_OID_SHA1);
cl_git_fail(create_commit_from_ids(&commit_id, &tree_id, &parent_id));
}
diff --git a/tests/libgit2/core/oid.c b/tests/libgit2/core/oid.c
index 894feadf6..9fe4413b7 100644
--- a/tests/libgit2/core/oid.c
+++ b/tests/libgit2/core/oid.c
@@ -1,79 +1,188 @@
#include "clar_libgit2.h"
#include "oid.h"
-static git_oid id;
-static git_oid idp;
-static git_oid idm;
-const char *str_oid = "ae90f12eea699729ed24555e40b9fd669da12a12";
-const char *str_oid_p = "ae90f12eea699729ed";
-const char *str_oid_m = "ae90f12eea699729ed24555e40b9fd669da12a12THIS IS EXTRA TEXT THAT SHOULD GET IGNORED";
+static git_oid id_sha1;
+static git_oid idp_sha1;
+static git_oid idm_sha1;
+
+const char *str_oid_sha1 = "ae90f12eea699729ed24555e40b9fd669da12a12";
+const char *str_oid_sha1_p = "ae90f12eea699729ed";
+const char *str_oid_sha1_m = "ae90f12eea699729ed24555e40b9fd669da12a12THIS IS EXTRA TEXT THAT SHOULD GET IGNORED";
+
+#ifdef GIT_EXPERIMENTAL_SHA256
+static git_oid id_sha256;
+static git_oid idp_sha256;
+static git_oid idm_sha256;
+
+const char *str_oid_sha256 = "d3e63d2f2e43d1fee23a74bf19a0ede156cba2d1bd602eba13de433cea1bb512";
+const char *str_oid_sha256_p = "d3e63d2f2e43d1fee2";
+const char *str_oid_sha256_m = "d3e63d2f2e43d1fee23a74bf19a0ede156cba2d1bd602eba13de433cea1bb512 GARBAGE EXTRA TEXT AT THE END";
+#endif
void test_core_oid__initialize(void)
{
- cl_git_pass(git_oid_fromstr(&id, str_oid));
- cl_git_pass(git_oid_fromstrp(&idp, str_oid_p));
- cl_git_fail(git_oid_fromstrp(&idm, str_oid_m));
+ cl_git_pass(git_oid__fromstr(&id_sha1, str_oid_sha1, GIT_OID_SHA1));
+ cl_git_pass(git_oid__fromstrp(&idp_sha1, str_oid_sha1_p, GIT_OID_SHA1));
+ cl_git_fail(git_oid__fromstrp(&idm_sha1, str_oid_sha1_m, GIT_OID_SHA1));
+
+#ifdef GIT_EXPERIMENTAL_SHA256
+ cl_git_pass(git_oid__fromstr(&id_sha256, str_oid_sha256, GIT_OID_SHA256));
+ cl_git_pass(git_oid__fromstrp(&idp_sha256, str_oid_sha256_p, GIT_OID_SHA256));
+ cl_git_fail(git_oid__fromstrp(&idm_sha256, str_oid_sha256_m, GIT_OID_SHA256));
+#endif
}
-void test_core_oid__streq(void)
+void test_core_oid__streq_sha1(void)
{
- cl_assert_equal_i(0, git_oid_streq(&id, str_oid));
- cl_assert_equal_i(-1, git_oid_streq(&id, "deadbeefdeadbeefdeadbeefdeadbeefdeadbeef"));
+ cl_assert_equal_i(0, git_oid_streq(&id_sha1, str_oid_sha1));
+ cl_assert_equal_i(-1, git_oid_streq(&id_sha1, "deadbeefdeadbeefdeadbeefdeadbeefdeadbeef"));
- cl_assert_equal_i(-1, git_oid_streq(&id, "deadbeef"));
- cl_assert_equal_i(-1, git_oid_streq(&id, "I'm not an oid.... :)"));
+ cl_assert_equal_i(-1, git_oid_streq(&id_sha1, "deadbeef"));
+ cl_assert_equal_i(-1, git_oid_streq(&id_sha1, "I'm not an oid.... :)"));
- cl_assert_equal_i(0, git_oid_streq(&idp, "ae90f12eea699729ed0000000000000000000000"));
- cl_assert_equal_i(0, git_oid_streq(&idp, "ae90f12eea699729ed"));
- cl_assert_equal_i(-1, git_oid_streq(&idp, "ae90f12eea699729ed1"));
- cl_assert_equal_i(-1, git_oid_streq(&idp, "ae90f12eea699729ec"));
- cl_assert_equal_i(-1, git_oid_streq(&idp, "deadbeefdeadbeefdeadbeefdeadbeefdeadbeef"));
+ cl_assert_equal_i(0, git_oid_streq(&idp_sha1, "ae90f12eea699729ed0000000000000000000000"));
+ cl_assert_equal_i(0, git_oid_streq(&idp_sha1, "ae90f12eea699729ed"));
+ cl_assert_equal_i(-1, git_oid_streq(&idp_sha1, "ae90f12eea699729ed1"));
+ cl_assert_equal_i(-1, git_oid_streq(&idp_sha1, "ae90f12eea699729ec"));
+ cl_assert_equal_i(-1, git_oid_streq(&idp_sha1, "deadbeefdeadbeefdeadbeefdeadbeefdeadbeef"));
- cl_assert_equal_i(-1, git_oid_streq(&idp, "deadbeef"));
- cl_assert_equal_i(-1, git_oid_streq(&idp, "I'm not an oid.... :)"));
+ cl_assert_equal_i(-1, git_oid_streq(&idp_sha1, "deadbeef"));
+ cl_assert_equal_i(-1, git_oid_streq(&idp_sha1, "I'm not an oid.... :)"));
}
-void test_core_oid__strcmp(void)
+void test_core_oid__streq_sha256(void)
{
- cl_assert_equal_i(0, git_oid_strcmp(&id, str_oid));
- cl_assert(git_oid_strcmp(&id, "deadbeefdeadbeefdeadbeefdeadbeefdeadbeef") < 0);
+#ifdef GIT_EXPERIMENTAL_SHA256
+ cl_assert_equal_i(0, git_oid_streq(&id_sha256, str_oid_sha256));
+ cl_assert_equal_i(-1, git_oid_streq(&id_sha256, "deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef"));
- cl_assert(git_oid_strcmp(&id, "deadbeef") < 0);
- cl_assert_equal_i(-1, git_oid_strcmp(&id, "I'm not an oid.... :)"));
+ cl_assert_equal_i(-1, git_oid_streq(&id_sha256, "deadbeef"));
+ cl_assert_equal_i(-1, git_oid_streq(&id_sha256, "I'm not an oid.... :)"));
- cl_assert_equal_i(0, git_oid_strcmp(&idp, "ae90f12eea699729ed0000000000000000000000"));
- cl_assert_equal_i(0, git_oid_strcmp(&idp, "ae90f12eea699729ed"));
- cl_assert(git_oid_strcmp(&idp, "ae90f12eea699729ed1") < 0);
- cl_assert(git_oid_strcmp(&idp, "ae90f12eea699729ec") > 0);
- cl_assert(git_oid_strcmp(&idp, "deadbeefdeadbeefdeadbeefdeadbeefdeadbeef") < 0);
+ cl_assert_equal_i(0, git_oid_streq(&idp_sha256, "d3e63d2f2e43d1fee20000000000000000000000000000000000000000000000"));
+ cl_assert_equal_i(0, git_oid_streq(&idp_sha256, "d3e63d2f2e43d1fee2"));
+ cl_assert_equal_i(-1, git_oid_streq(&idp_sha1, "d3e63d2f2e43d1fee21"));
+ cl_assert_equal_i(-1, git_oid_streq(&idp_sha1, "d3e63d2f2e43d1fee1"));
+ cl_assert_equal_i(-1, git_oid_streq(&idp_sha256, "deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef"));
- cl_assert(git_oid_strcmp(&idp, "deadbeef") < 0);
- cl_assert_equal_i(-1, git_oid_strcmp(&idp, "I'm not an oid.... :)"));
+ cl_assert_equal_i(-1, git_oid_streq(&idp_sha1, "deadbeef"));
+ cl_assert_equal_i(-1, git_oid_streq(&idp_sha1, "I'm not an oid.... :)"));
+#endif
}
-void test_core_oid__ncmp(void)
+void test_core_oid__strcmp_sha1(void)
{
- cl_assert(!git_oid_ncmp(&id, &idp, 0));
- cl_assert(!git_oid_ncmp(&id, &idp, 1));
- cl_assert(!git_oid_ncmp(&id, &idp, 2));
- cl_assert(!git_oid_ncmp(&id, &idp, 17));
- cl_assert(!git_oid_ncmp(&id, &idp, 18));
- cl_assert(git_oid_ncmp(&id, &idp, 19));
- cl_assert(git_oid_ncmp(&id, &idp, 40));
- cl_assert(git_oid_ncmp(&id, &idp, 41));
- cl_assert(git_oid_ncmp(&id, &idp, 42));
-
- cl_assert(!git_oid_ncmp(&id, &id, 0));
- cl_assert(!git_oid_ncmp(&id, &id, 1));
- cl_assert(!git_oid_ncmp(&id, &id, 39));
- cl_assert(!git_oid_ncmp(&id, &id, 40));
- cl_assert(!git_oid_ncmp(&id, &id, 41));
+ cl_assert_equal_i(0, git_oid_strcmp(&id_sha1, str_oid_sha1));
+ cl_assert(git_oid_strcmp(&id_sha1, "deadbeefdeadbeefdeadbeefdeadbeefdeadbeef") < 0);
+
+ cl_assert(git_oid_strcmp(&id_sha1, "deadbeef") < 0);
+ cl_assert_equal_i(-1, git_oid_strcmp(&id_sha1, "I'm not an oid.... :)"));
+
+ cl_assert_equal_i(0, git_oid_strcmp(&idp_sha1, "ae90f12eea699729ed0000000000000000000000"));
+ cl_assert_equal_i(0, git_oid_strcmp(&idp_sha1, "ae90f12eea699729ed"));
+ cl_assert(git_oid_strcmp(&idp_sha1, "ae90f12eea699729ed1") < 0);
+ cl_assert(git_oid_strcmp(&idp_sha1, "ae90f12eea699729ec") > 0);
+ cl_assert(git_oid_strcmp(&idp_sha1, "deadbeefdeadbeefdeadbeefdeadbeefdeadbeef") < 0);
+
+ cl_assert(git_oid_strcmp(&idp_sha1, "deadbeef") < 0);
+ cl_assert_equal_i(-1, git_oid_strcmp(&idp_sha1, "I'm not an oid.... :)"));
+}
+
+void test_core_oid__strcmp_sha256(void)
+{
+#ifdef GIT_EXPERIMENTAL_SHA256
+ cl_assert_equal_i(0, git_oid_strcmp(&id_sha256, str_oid_sha256));
+ cl_assert(git_oid_strcmp(&id_sha256, "deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef") < 0);
+
+ cl_assert(git_oid_strcmp(&id_sha256, "deadbeef") < 0);
+ cl_assert_equal_i(-1, git_oid_strcmp(&id_sha256, "I'm not an oid.... :)"));
+
+ cl_assert_equal_i(0, git_oid_strcmp(&idp_sha256, "d3e63d2f2e43d1fee20000000000000000000000"));
+ cl_assert_equal_i(0, git_oid_strcmp(&idp_sha256, "d3e63d2f2e43d1fee2"));
+ cl_assert(git_oid_strcmp(&idp_sha256, "d3e63d2f2e43d1fee21") < 0);
+ cl_assert(git_oid_strcmp(&idp_sha256, "d3e63d2f2e43d1fee1") > 0);
+ cl_assert(git_oid_strcmp(&idp_sha256, "deadbeefdeadbeefdeadbeefdeadbeefdeadbeef") < 0);
+
+ cl_assert(git_oid_strcmp(&idp_sha256, "deadbeef") < 0);
+ cl_assert_equal_i(-1, git_oid_strcmp(&idp_sha256, "I'm not an oid.... :)"));
+#endif
+}
+
+void test_core_oid__ncmp_sha1(void)
+{
+ cl_assert(!git_oid_ncmp(&id_sha1, &idp_sha1, 0));
+ cl_assert(!git_oid_ncmp(&id_sha1, &idp_sha1, 1));
+ cl_assert(!git_oid_ncmp(&id_sha1, &idp_sha1, 2));
+ cl_assert(!git_oid_ncmp(&id_sha1, &idp_sha1, 17));
+ cl_assert(!git_oid_ncmp(&id_sha1, &idp_sha1, 18));
+ cl_assert(git_oid_ncmp(&id_sha1, &idp_sha1, 19));
+ cl_assert(git_oid_ncmp(&id_sha1, &idp_sha1, 40));
+ cl_assert(git_oid_ncmp(&id_sha1, &idp_sha1, 41));
+ cl_assert(git_oid_ncmp(&id_sha1, &idp_sha1, 42));
+
+ cl_assert(!git_oid_ncmp(&id_sha1, &id_sha1, 0));
+ cl_assert(!git_oid_ncmp(&id_sha1, &id_sha1, 1));
+ cl_assert(!git_oid_ncmp(&id_sha1, &id_sha1, 39));
+ cl_assert(!git_oid_ncmp(&id_sha1, &id_sha1, 40));
+ cl_assert(!git_oid_ncmp(&id_sha1, &id_sha1, 41));
+}
+
+void test_core_oid__ncmp_sha256(void)
+{
+#ifdef GIT_EXPERIMENTAL_SHA256
+ cl_assert(!git_oid_ncmp(&id_sha256, &idp_sha256, 0));
+ cl_assert(!git_oid_ncmp(&id_sha256, &idp_sha256, 1));
+ cl_assert(!git_oid_ncmp(&id_sha256, &idp_sha256, 2));
+ cl_assert(!git_oid_ncmp(&id_sha256, &idp_sha256, 17));
+ cl_assert(!git_oid_ncmp(&id_sha256, &idp_sha256, 18));
+ cl_assert(git_oid_ncmp(&id_sha256, &idp_sha256, 19));
+ cl_assert(git_oid_ncmp(&id_sha256, &idp_sha256, 40));
+ cl_assert(git_oid_ncmp(&id_sha256, &idp_sha256, 41));
+ cl_assert(git_oid_ncmp(&id_sha256, &idp_sha256, 42));
+ cl_assert(git_oid_ncmp(&id_sha256, &idp_sha256, 63));
+ cl_assert(git_oid_ncmp(&id_sha256, &idp_sha256, 64));
+ cl_assert(git_oid_ncmp(&id_sha256, &idp_sha256, 65));
+
+ cl_assert(!git_oid_ncmp(&id_sha256, &id_sha256, 0));
+ cl_assert(!git_oid_ncmp(&id_sha256, &id_sha256, 1));
+ cl_assert(!git_oid_ncmp(&id_sha256, &id_sha256, 39));
+ cl_assert(!git_oid_ncmp(&id_sha256, &id_sha256, 40));
+ cl_assert(!git_oid_ncmp(&id_sha256, &id_sha256, 41));
+ cl_assert(!git_oid_ncmp(&id_sha256, &id_sha256, 63));
+ cl_assert(!git_oid_ncmp(&id_sha256, &id_sha256, 64));
+ cl_assert(!git_oid_ncmp(&id_sha256, &id_sha256, 65));
+#endif
}
void test_core_oid__is_hexstr(void)
{
- cl_assert(git_oid__is_hexstr("deadbeefdeadbeefdeadbeefdeadbeefdeadbeef"));
- cl_assert(!git_oid__is_hexstr("deadbeefdeadbeef"));
- cl_assert(!git_oid__is_hexstr("zeadbeefdeadbeefdeadbeefdeadbeefdeadbeef"));
- cl_assert(!git_oid__is_hexstr("deadbeefdeadbeefdeadbeefdeadbeefdeadbeef1"));
+ cl_assert(git_oid__is_hexstr("deadbeefdeadbeefdeadbeefdeadbeefdeadbeef", GIT_OID_SHA1));
+ cl_assert(!git_oid__is_hexstr("deadbeefdeadbeef", GIT_OID_SHA1));
+ cl_assert(!git_oid__is_hexstr("zeadbeefdeadbeefdeadbeefdeadbeefdeadbeef", GIT_OID_SHA1));
+ cl_assert(!git_oid__is_hexstr("deadbeefdeadbeefdeadbeefdeadbeefdeadbeef1", GIT_OID_SHA1));
+}
+
+void test_core_oid__fmt_substr_sha1(void)
+{
+ char buf[GIT_OID_MAX_HEXSIZE + 1];
+
+ memset(buf, 0, GIT_OID_MAX_HEXSIZE + 1);
+ git_oid_fmt_substr(buf, &id_sha1, 0, 40);
+ cl_assert_equal_s(buf, str_oid_sha1);
+
+ memset(buf, 0, GIT_OID_MAX_HEXSIZE + 1);
+ git_oid_fmt_substr(buf, &id_sha1, 0, 18);
+ cl_assert_equal_s(buf, str_oid_sha1_p);
+
+ memset(buf, 0, GIT_OID_MAX_HEXSIZE + 1);
+ git_oid_fmt_substr(buf, &id_sha1, 0, 5);
+ cl_assert_equal_s(buf, "ae90f");
+
+ memset(buf, 0, GIT_OID_MAX_HEXSIZE + 1);
+ git_oid_fmt_substr(buf, &id_sha1, 5, 5);
+ cl_assert_equal_s(buf, "12eea");
+
+ memset(buf, 0, GIT_OID_MAX_HEXSIZE + 1);
+ git_oid_fmt_substr(buf, &id_sha1, 5, 6);
+ cl_assert_equal_s(buf, "12eea6");
}
diff --git a/tests/libgit2/core/oidmap.c b/tests/libgit2/core/oidmap.c
index 7f98287a6..34374ceef 100644
--- a/tests/libgit2/core/oidmap.c
+++ b/tests/libgit2/core/oidmap.c
@@ -17,7 +17,7 @@ void test_core_oidmap__initialize(void)
test_oids[i].extra = i;
- for (j = 0; j < GIT_OID_RAWSZ / 4; ++j) {
+ for (j = 0; j < GIT_OID_SHA1_SIZE / 4; ++j) {
test_oids[i].oid.id[j * 4 ] = (unsigned char)modi;
test_oids[i].oid.id[j * 4 + 1] = (unsigned char)(modi >> 8);
test_oids[i].oid.id[j * 4 + 2] = (unsigned char)(modi >> 16);
@@ -28,6 +28,9 @@ void test_core_oidmap__initialize(void)
test_oids[i].oid.id[ 9] = (unsigned char)(i >> 8);
test_oids[i].oid.id[10] = (unsigned char)(i >> 16);
test_oids[i].oid.id[11] = (unsigned char)(i >> 24);
+#ifdef GIT_EXPERIMENTAL_SHA256
+ test_oids[i].oid.type = GIT_OID_SHA1;
+#endif
}
cl_git_pass(git_oidmap_new(&g_map));
@@ -93,9 +96,9 @@ void test_core_oidmap__get_fails_with_nonexisting_key(void)
void test_core_oidmap__setting_oid_persists(void)
{
git_oid oids[] = {
- {{ 0x01 }},
- {{ 0x02 }},
- {{ 0x03 }}
+ GIT_OID_INIT(GIT_OID_SHA1, { 0x01 }),
+ GIT_OID_INIT(GIT_OID_SHA1, { 0x02 }),
+ GIT_OID_INIT(GIT_OID_SHA1, { 0x03 })
};
cl_git_pass(git_oidmap_set(g_map, &oids[0], "one"));
@@ -110,9 +113,9 @@ void test_core_oidmap__setting_oid_persists(void)
void test_core_oidmap__setting_existing_key_updates(void)
{
git_oid oids[] = {
- {{ 0x01 }},
- {{ 0x02 }},
- {{ 0x03 }}
+ GIT_OID_INIT(GIT_OID_SHA1, { 0x01 }),
+ GIT_OID_INIT(GIT_OID_SHA1, { 0x02 }),
+ GIT_OID_INIT(GIT_OID_SHA1, { 0x03 })
};
cl_git_pass(git_oidmap_set(g_map, &oids[0], "one"));
diff --git a/tests/libgit2/core/pool.c b/tests/libgit2/core/pool.c
index 5746e35b8..cf01cb9d1 100644
--- a/tests/libgit2/core/pool.c
+++ b/tests/libgit2/core/pool.c
@@ -7,7 +7,7 @@ static char to_hex[] = "0123456789abcdef";
void test_core_pool__oid(void)
{
git_pool p;
- char oid_hex[GIT_OID_HEXSZ];
+ char oid_hex[GIT_OID_SHA1_HEXSIZE];
git_oid *oid;
int i, j;
@@ -22,12 +22,17 @@ void test_core_pool__oid(void)
for (j = 0; j < 8; j++)
oid_hex[j] = to_hex[(i >> (4 * j)) & 0x0f];
- cl_git_pass(git_oid_fromstr(oid, oid_hex));
+ cl_git_pass(git_oid__fromstr(oid, oid_hex, GIT_OID_SHA1));
}
#ifndef GIT_DEBUG_POOL
/* with fixed page size, allocation must end up with these values */
+
+# ifdef GIT_EXPERIMENTAL_SHA256
+ cl_assert_equal_i(sizeof(void *) == 8 ? 90 : 82, git_pool__open_pages(&p));
+# else
cl_assert_equal_i(sizeof(void *) == 8 ? 55 : 45, git_pool__open_pages(&p));
+# endif
#endif
git_pool_clear(&p);
}
diff --git a/tests/libgit2/diff/binary.c b/tests/libgit2/diff/binary.c
index 4e71f39c6..3bf39f34a 100644
--- a/tests/libgit2/diff/binary.c
+++ b/tests/libgit2/diff/binary.c
@@ -31,12 +31,12 @@ static void test_patch(
git_patch *patch;
git_buf actual = GIT_BUF_INIT;
- cl_git_pass(git_oid_fromstr(&id_one, one));
+ cl_git_pass(git_oid__fromstr(&id_one, one, GIT_OID_SHA1));
cl_git_pass(git_commit_lookup(&commit_one, repo, &id_one));
cl_git_pass(git_commit_tree(&tree_one, commit_one));
if (two) {
- cl_git_pass(git_oid_fromstr(&id_two, two));
+ cl_git_pass(git_oid__fromstr(&id_two, two, GIT_OID_SHA1));
cl_git_pass(git_commit_lookup(&commit_two, repo, &id_two));
cl_git_pass(git_commit_tree(&tree_two, commit_two));
} else {
@@ -100,7 +100,7 @@ void test_diff_binary__add(void)
"\n";
opts.flags = GIT_DIFF_SHOW_BINARY;
- opts.id_abbrev = GIT_OID_HEXSZ;
+ opts.id_abbrev = GIT_OID_SHA1_HEXSIZE;
repo = cl_git_sandbox_init("diff_format_email");
test_patch(
@@ -183,7 +183,7 @@ void test_diff_binary__delete(void)
"\n";
opts.flags = GIT_DIFF_SHOW_BINARY;
- opts.id_abbrev = GIT_OID_HEXSZ;
+ opts.id_abbrev = GIT_OID_SHA1_HEXSIZE;
repo = cl_git_sandbox_init("diff_format_email");
test_patch(
@@ -215,7 +215,7 @@ void test_diff_binary__delta(void)
"\n";
opts.flags = GIT_DIFF_SHOW_BINARY | GIT_DIFF_FORCE_BINARY;
- opts.id_abbrev = GIT_OID_HEXSZ;
+ opts.id_abbrev = GIT_OID_SHA1_HEXSIZE;
repo = cl_git_sandbox_init("renames");
cl_git_pass(git_repository_index(&index, repo));
@@ -257,7 +257,7 @@ void test_diff_binary__delta_append(void)
"\n";
opts.flags = GIT_DIFF_SHOW_BINARY | GIT_DIFF_FORCE_BINARY;
- opts.id_abbrev = GIT_OID_HEXSZ;
+ opts.id_abbrev = GIT_OID_SHA1_HEXSIZE;
repo = cl_git_sandbox_init("renames");
cl_git_pass(git_repository_index(&index, repo));
@@ -285,11 +285,11 @@ void test_diff_binary__empty_for_no_diff(void)
git_str actual = GIT_STR_INIT;
opts.flags = GIT_DIFF_SHOW_BINARY | GIT_DIFF_FORCE_BINARY;
- opts.id_abbrev = GIT_OID_HEXSZ;
+ opts.id_abbrev = GIT_OID_SHA1_HEXSIZE;
repo = cl_git_sandbox_init("renames");
- cl_git_pass(git_oid_fromstr(&id, "19dd32dfb1520a64e5bbaae8dce6ef423dfa2f13"));
+ cl_git_pass(git_oid__fromstr(&id, "19dd32dfb1520a64e5bbaae8dce6ef423dfa2f13", GIT_OID_SHA1));
cl_git_pass(git_commit_lookup(&commit, repo, &id));
cl_git_pass(git_commit_tree(&tree, commit));
@@ -323,7 +323,7 @@ void test_diff_binary__index_to_workdir(void)
"\n";
opts.flags = GIT_DIFF_SHOW_BINARY | GIT_DIFF_FORCE_BINARY;
- opts.id_abbrev = GIT_OID_HEXSZ;
+ opts.id_abbrev = GIT_OID_SHA1_HEXSIZE;
repo = cl_git_sandbox_init("renames");
cl_git_pass(git_repository_index(&index, repo));
@@ -389,7 +389,7 @@ void test_diff_binary__print_patch_from_diff(void)
"\n";
opts.flags = GIT_DIFF_SHOW_BINARY | GIT_DIFF_FORCE_BINARY;
- opts.id_abbrev = GIT_OID_HEXSZ;
+ opts.id_abbrev = GIT_OID_SHA1_HEXSIZE;
repo = cl_git_sandbox_init("renames");
cl_git_pass(git_repository_index(&index, repo));
@@ -501,7 +501,7 @@ void test_diff_binary__blob_to_blob(void)
struct diff_data diff_data = {0};
opts.flags = GIT_DIFF_SHOW_BINARY | GIT_DIFF_FORCE_BINARY;
- opts.id_abbrev = GIT_OID_HEXSZ;
+ opts.id_abbrev = GIT_OID_SHA1_HEXSIZE;
repo = cl_git_sandbox_init("renames");
cl_git_pass(git_repository_index__weakptr(&index, repo));
@@ -510,8 +510,8 @@ void test_diff_binary__blob_to_blob(void)
cl_git_pass(git_index_add_bypath(index, "untimely.txt"));
cl_git_pass(git_index_write(index));
- git_oid_fromstr(&old_id, "9a69d960ae94b060f56c2a8702545e2bb1abb935");
- git_oid_fromstr(&new_id, "1111d4f11f4b35bf6759e0fb714fe09731ef0840");
+ git_oid__fromstr(&old_id, "9a69d960ae94b060f56c2a8702545e2bb1abb935", GIT_OID_SHA1);
+ git_oid__fromstr(&new_id, "1111d4f11f4b35bf6759e0fb714fe09731ef0840", GIT_OID_SHA1);
cl_git_pass(git_blob_lookup(&old_blob, repo, &old_id));
cl_git_pass(git_blob_lookup(&new_blob, repo, &new_id));
diff --git a/tests/libgit2/diff/blob.c b/tests/libgit2/diff/blob.c
index d2f42207d..cb7e48b8d 100644
--- a/tests/libgit2/diff/blob.c
+++ b/tests/libgit2/diff/blob.c
@@ -45,11 +45,11 @@ void test_diff_blob__initialize(void)
memset(&expected, 0, sizeof(expected));
/* tests/resources/attr/root_test4.txt */
- cl_git_pass(git_oid_fromstrn(&oid, "a0f7217a", 8));
+ cl_git_pass(git_oid__fromstrn(&oid, "a0f7217a", 8, GIT_OID_SHA1));
cl_git_pass(git_blob_lookup_prefix(&d, g_repo, &oid, 8));
/* alien.png */
- cl_git_pass(git_oid_fromstrn(&oid, "edf3dcee", 8));
+ cl_git_pass(git_oid__fromstrn(&oid, "edf3dcee", 8, GIT_OID_SHA1));
cl_git_pass(git_blob_lookup_prefix(&alien, g_repo, &oid, 8));
}
@@ -86,10 +86,10 @@ void test_diff_blob__patch_with_freed_blobs(void)
git_buf buf = GIT_BUF_INIT;
/* tests/resources/attr/root_test1 */
- cl_git_pass(git_oid_fromstrn(&a_oid, "45141a79", 8));
+ cl_git_pass(git_oid__fromstrn(&a_oid, "45141a79", 8, GIT_OID_SHA1));
cl_git_pass(git_blob_lookup_prefix(&a, g_repo, &a_oid, 4));
/* tests/resources/attr/root_test2 */
- cl_git_pass(git_oid_fromstrn(&b_oid, "4d713dc4", 8));
+ cl_git_pass(git_oid__fromstrn(&b_oid, "4d713dc4", 8, GIT_OID_SHA1));
cl_git_pass(git_blob_lookup_prefix(&b, g_repo, &b_oid, 4));
cl_git_pass(git_patch_from_blobs(&p, a, NULL, b, NULL, NULL));
@@ -110,15 +110,15 @@ void test_diff_blob__can_compare_text_blobs(void)
git_oid a_oid, b_oid, c_oid;
/* tests/resources/attr/root_test1 */
- cl_git_pass(git_oid_fromstrn(&a_oid, "45141a79", 8));
+ cl_git_pass(git_oid__fromstrn(&a_oid, "45141a79", 8, GIT_OID_SHA1));
cl_git_pass(git_blob_lookup_prefix(&a, g_repo, &a_oid, 4));
/* tests/resources/attr/root_test2 */
- cl_git_pass(git_oid_fromstrn(&b_oid, "4d713dc4", 8));
+ cl_git_pass(git_oid__fromstrn(&b_oid, "4d713dc4", 8, GIT_OID_SHA1));
cl_git_pass(git_blob_lookup_prefix(&b, g_repo, &b_oid, 4));
/* tests/resources/attr/root_test3 */
- cl_git_pass(git_oid_fromstrn(&c_oid, "c96bbb2c2557a832", 16));
+ cl_git_pass(git_oid__fromstrn(&c_oid, "c96bbb2c2557a832", 16, GIT_OID_SHA1));
cl_git_pass(git_blob_lookup_prefix(&c, g_repo, &c_oid, 16));
/* Doing the equivalent of a `git diff -U1` on these files */
@@ -201,15 +201,15 @@ void test_diff_blob__can_compare_text_blobs_with_patch(void)
git_patch *p;
/* tests/resources/attr/root_test1 */
- cl_git_pass(git_oid_fromstrn(&a_oid, "45141a79", 8));
+ cl_git_pass(git_oid__fromstrn(&a_oid, "45141a79", 8, GIT_OID_SHA1));
cl_git_pass(git_blob_lookup_prefix(&a, g_repo, &a_oid, 8));
/* tests/resources/attr/root_test2 */
- cl_git_pass(git_oid_fromstrn(&b_oid, "4d713dc4", 8));
+ cl_git_pass(git_oid__fromstrn(&b_oid, "4d713dc4", 8, GIT_OID_SHA1));
cl_git_pass(git_blob_lookup_prefix(&b, g_repo, &b_oid, 8));
/* tests/resources/attr/root_test3 */
- cl_git_pass(git_oid_fromstrn(&c_oid, "c96bbb2c2557a832", 16));
+ cl_git_pass(git_oid__fromstrn(&c_oid, "c96bbb2c2557a832", 16, GIT_OID_SHA1));
cl_git_pass(git_blob_lookup_prefix(&c, g_repo, &c_oid, 16));
/* Doing the equivalent of a `git diff -U1` on these files */
@@ -475,7 +475,7 @@ void test_diff_blob__can_compare_two_binary_blobs(void)
git_oid h_oid;
/* heart.png */
- cl_git_pass(git_oid_fromstrn(&h_oid, "de863bff", 8));
+ cl_git_pass(git_oid__fromstrn(&h_oid, "de863bff", 8, GIT_OID_SHA1));
cl_git_pass(git_blob_lookup_prefix(&heart, g_repo, &h_oid, 8));
cl_git_pass(git_diff_blobs(
@@ -543,7 +543,7 @@ void test_diff_blob__comparing_two_text_blobs_honors_interhunkcontext(void)
opts.context_lines = 3;
/* tests/resources/attr/root_test1 from commit f5b0af1 */
- cl_git_pass(git_oid_fromstrn(&old_d_oid, "fe773770", 8));
+ cl_git_pass(git_oid__fromstrn(&old_d_oid, "fe773770", 8, GIT_OID_SHA1));
cl_git_pass(git_blob_lookup_prefix(&old_d, g_repo, &old_d_oid, 8));
/* Test with default inter-hunk-context (not set) => default is 0 */
@@ -652,7 +652,7 @@ void test_diff_blob__can_compare_blob_to_buffer(void)
const char *b_content = "Hello from the root\n\nSome additional lines\n\nDown here below\n\n";
/* tests/resources/attr/root_test1 */
- cl_git_pass(git_oid_fromstrn(&a_oid, "45141a79", 8));
+ cl_git_pass(git_oid__fromstrn(&a_oid, "45141a79", 8, GIT_OID_SHA1));
cl_git_pass(git_blob_lookup_prefix(&a, g_repo, &a_oid, 8));
/* diff from blob a to content of b */
@@ -694,7 +694,7 @@ void test_diff_blob__can_compare_blob_to_buffer_with_patch(void)
size_t tc, ta, td;
/* tests/resources/attr/root_test1 */
- cl_git_pass(git_oid_fromstrn(&a_oid, "45141a79", 8));
+ cl_git_pass(git_oid__fromstrn(&a_oid, "45141a79", 8, GIT_OID_SHA1));
cl_git_pass(git_blob_lookup_prefix(&a, g_repo, &a_oid, 8));
/* diff from blob a to content of b */
@@ -773,10 +773,10 @@ void test_diff_blob__binary_data_comparisons(void)
opts.flags |= GIT_DIFF_INCLUDE_UNMODIFIED;
- cl_git_pass(git_oid_fromstrn(&oid, "45141a79", 8));
+ cl_git_pass(git_oid__fromstrn(&oid, "45141a79", 8, GIT_OID_SHA1));
cl_git_pass(git_blob_lookup_prefix(&nonbin, g_repo, &oid, 8));
- cl_git_pass(git_oid_fromstrn(&oid, "b435cd56", 8));
+ cl_git_pass(git_oid__fromstrn(&oid, "b435cd56", 8, GIT_OID_SHA1));
cl_git_pass(git_blob_lookup_prefix(&bin, g_repo, &oid, 8));
/* non-binary to reference content */
@@ -879,11 +879,11 @@ void test_diff_blob__using_path_and_attributes(void)
opts.context_lines = 0;
opts.flags |= GIT_DIFF_INCLUDE_UNMODIFIED;
- cl_git_pass(git_oid_fromstrn(&oid, "45141a79", 8));
+ cl_git_pass(git_oid__fromstrn(&oid, "45141a79", 8, GIT_OID_SHA1));
cl_git_pass(git_blob_lookup_prefix(&nonbin, g_repo, &oid, 8));
/* 20b: "Hello from the root\n" */
- cl_git_pass(git_oid_fromstrn(&oid, "b435cd56", 8));
+ cl_git_pass(git_oid__fromstrn(&oid, "b435cd56", 8, GIT_OID_SHA1));
cl_git_pass(git_blob_lookup_prefix(&bin, g_repo, &oid, 8));
/* 33b: "0123456789\n\x01\x02\x03\x04\x05\x06\x07\x08\x09\n0123456789\n" */
diff --git a/tests/libgit2/diff/diff_helpers.c b/tests/libgit2/diff/diff_helpers.c
index e9900339f..341b0a448 100644
--- a/tests/libgit2/diff/diff_helpers.c
+++ b/tests/libgit2/diff/diff_helpers.c
@@ -11,7 +11,7 @@ git_tree *resolve_commit_oid_to_tree(
git_object *obj = NULL;
git_tree *tree = NULL;
- if (git_oid_fromstrn(&oid, partial_oid, len) == 0)
+ if (git_oid__fromstrn(&oid, partial_oid, len, GIT_OID_SHA1) == 0)
cl_git_pass(git_object_lookup_prefix(&obj, repo, &oid, len, GIT_OBJECT_ANY));
cl_git_pass(git_object_peel((git_object **) &tree, obj, GIT_OBJECT_TREE));
diff --git a/tests/libgit2/diff/format_email.c b/tests/libgit2/diff/format_email.c
index 612804c42..2726edb0d 100644
--- a/tests/libgit2/diff/format_email.c
+++ b/tests/libgit2/diff/format_email.c
@@ -28,7 +28,7 @@ static void assert_email_match(
git_diff *diff = NULL;
git_buf buf = GIT_BUF_INIT;
- git_oid_fromstr(&oid, oidstr);
+ git_oid__fromstr(&oid, oidstr, GIT_OID_SHA1);
cl_git_pass(git_commit_lookup(&commit, repo, &oid));
@@ -228,7 +228,7 @@ void test_diff_format_email__multiple(void)
"\n";
- git_oid_fromstr(&oid, "10808fe9c9be5a190c0ba68d1a002233fb363508");
+ git_oid__fromstr(&oid, "10808fe9c9be5a190c0ba68d1a002233fb363508", GIT_OID_SHA1);
cl_git_pass(git_commit_lookup(&commit, repo, &oid));
opts.id = git_commit_id(commit);
@@ -245,7 +245,7 @@ void test_diff_format_email__multiple(void)
diff = NULL;
commit = NULL;
- git_oid_fromstr(&oid, "873806f6f27e631eb0b23e4b56bea2bfac14a373");
+ git_oid__fromstr(&oid, "873806f6f27e631eb0b23e4b56bea2bfac14a373", GIT_OID_SHA1);
cl_git_pass(git_commit_lookup(&commit, repo, &oid));
opts.id = git_commit_id(commit);
@@ -324,7 +324,7 @@ void test_diff_format_email__invalid_no(void)
git_diff_format_email_options opts = GIT_DIFF_FORMAT_EMAIL_OPTIONS_INIT;
git_buf buf = GIT_BUF_INIT;
- git_oid_fromstr(&oid, "9264b96c6d104d0e07ae33d3007b6a48246c6f92");
+ git_oid__fromstr(&oid, "9264b96c6d104d0e07ae33d3007b6a48246c6f92", GIT_OID_SHA1);
cl_git_pass(git_commit_lookup(&commit, repo, &oid));
diff --git a/tests/libgit2/diff/index.c b/tests/libgit2/diff/index.c
index b616a372b..5773b748e 100644
--- a/tests/libgit2/diff/index.c
+++ b/tests/libgit2/diff/index.c
@@ -185,9 +185,9 @@ static void do_conflicted_diff(diff_expects *exp, unsigned long flags)
ancestor.path = ours.path = theirs.path = "staged_changes";
ancestor.mode = ours.mode = theirs.mode = GIT_FILEMODE_BLOB;
- git_oid_fromstr(&ancestor.id, "d427e0b2e138501a3d15cc376077a3631e15bd46");
- git_oid_fromstr(&ours.id, "ee3fa1b8c00aff7fe02065fdb50864bb0d932ccf");
- git_oid_fromstr(&theirs.id, "2bd0a343aeef7a2cf0d158478966a6e587ff3863");
+ git_oid__fromstr(&ancestor.id, "d427e0b2e138501a3d15cc376077a3631e15bd46", GIT_OID_SHA1);
+ git_oid__fromstr(&ours.id, "ee3fa1b8c00aff7fe02065fdb50864bb0d932ccf", GIT_OID_SHA1);
+ git_oid__fromstr(&theirs.id, "2bd0a343aeef7a2cf0d158478966a6e587ff3863", GIT_OID_SHA1);
cl_git_pass(git_index_conflict_add(index, &ancestor, &ours, &theirs));
cl_git_pass(git_diff_tree_to_index(&diff, g_repo, a, index, &opts));
@@ -255,7 +255,7 @@ void test_diff_index__not_in_head_conflicted(void)
theirs.path = "file_not_in_head";
theirs.mode = GIT_FILEMODE_BLOB;
- git_oid_fromstr(&theirs.id, "2bd0a343aeef7a2cf0d158478966a6e587ff3863");
+ git_oid__fromstr(&theirs.id, "2bd0a343aeef7a2cf0d158478966a6e587ff3863", GIT_OID_SHA1);
cl_git_pass(git_index_conflict_add(index, NULL, NULL, &theirs));
cl_git_pass(git_diff_tree_to_index(&diff, g_repo, a, index, NULL));
diff --git a/tests/libgit2/diff/parse.c b/tests/libgit2/diff/parse.c
index 9c3f798e4..cae843cc8 100644
--- a/tests/libgit2/diff/parse.c
+++ b/tests/libgit2/diff/parse.c
@@ -151,7 +151,7 @@ static void test_tree_to_tree_computed_to_parsed(
repo = cl_git_sandbox_init(sandbox);
- opts.id_abbrev = GIT_OID_HEXSZ;
+ opts.id_abbrev = GIT_OID_SHA1_HEXSIZE;
opts.flags = GIT_DIFF_SHOW_BINARY | diff_flags;
findopts.flags = find_flags;
diff --git a/tests/libgit2/diff/patchid.c b/tests/libgit2/diff/patchid.c
index 621a720f7..1cc368e21 100644
--- a/tests/libgit2/diff/patchid.c
+++ b/tests/libgit2/diff/patchid.c
@@ -6,7 +6,7 @@ static void verify_patch_id(const char *diff_content, const char *expected_id)
git_oid expected_oid, actual_oid;
git_diff *diff;
- cl_git_pass(git_oid_fromstr(&expected_oid, expected_id));
+ cl_git_pass(git_oid__fromstr(&expected_oid, expected_id, GIT_OID_SHA1));
cl_git_pass(git_diff_from_buffer(&diff, diff_content, strlen(diff_content)));
cl_git_pass(git_diff_patchid(&actual_oid, diff, NULL));
diff --git a/tests/libgit2/diff/rename.c b/tests/libgit2/diff/rename.c
index 30e9ea432..9d4439462 100644
--- a/tests/libgit2/diff/rename.c
+++ b/tests/libgit2/diff/rename.c
@@ -574,7 +574,7 @@ void test_diff_rename__working_directory_changes(void)
/* again with exact match blob */
- cl_git_pass(git_oid_fromstr(&id, blobsha));
+ cl_git_pass(git_oid__fromstr(&id, blobsha, GIT_OID_SHA1));
cl_git_pass(git_blob_lookup(&blob, g_repo, &id));
cl_git_pass(git_str_set(
&content, git_blob_rawcontent(blob), (size_t)git_blob_rawsize(blob)));
diff --git a/tests/libgit2/diff/stats.c b/tests/libgit2/diff/stats.c
index f69dba9b3..b076ad5a9 100644
--- a/tests/libgit2/diff/stats.c
+++ b/tests/libgit2/diff/stats.c
@@ -26,7 +26,7 @@ static void diff_stats_from_commit_oid(
git_commit *commit;
git_diff *diff;
- git_oid_fromstr(&oid, oidstr);
+ git_oid__fromstr(&oid, oidstr, GIT_OID_SHA1);
cl_git_pass(git_commit_lookup(&commit, _repo, &oid));
cl_git_pass(git_diff__commit(&diff, _repo, commit, NULL));
if (rename)
diff --git a/tests/libgit2/diff/workdir.c b/tests/libgit2/diff/workdir.c
index 20e000906..8ccde41ff 100644
--- a/tests/libgit2/diff/workdir.c
+++ b/tests/libgit2/diff/workdir.c
@@ -86,11 +86,11 @@ void test_diff_workdir__to_index_with_conflicts(void)
/* Adding an entry that represents a rename gets two files in conflict */
our_entry.path = "subdir/modified_file";
our_entry.mode = 0100644;
- git_oid_fromstr(&our_entry.id, "ee3fa1b8c00aff7fe02065fdb50864bb0d932ccf");
+ git_oid__fromstr(&our_entry.id, "ee3fa1b8c00aff7fe02065fdb50864bb0d932ccf", GIT_OID_SHA1);
their_entry.path = "subdir/rename_conflict";
their_entry.mode = 0100644;
- git_oid_fromstr(&their_entry.id, "2bd0a343aeef7a2cf0d158478966a6e587ff3863");
+ git_oid__fromstr(&their_entry.id, "2bd0a343aeef7a2cf0d158478966a6e587ff3863", GIT_OID_SHA1);
cl_git_pass(git_repository_index(&index, g_repo));
cl_git_pass(git_index_conflict_add(index, NULL, &our_entry, &their_entry));
@@ -1979,9 +1979,9 @@ void test_diff_workdir__to_index_conflicted(void) {
ancestor.path = ours.path = theirs.path = "_file";
ancestor.mode = ours.mode = theirs.mode = 0100644;
- git_oid_fromstr(&ancestor.id, "d427e0b2e138501a3d15cc376077a3631e15bd46");
- git_oid_fromstr(&ours.id, "ee3fa1b8c00aff7fe02065fdb50864bb0d932ccf");
- git_oid_fromstr(&theirs.id, "2bd0a343aeef7a2cf0d158478966a6e587ff3863");
+ git_oid__fromstr(&ancestor.id, "d427e0b2e138501a3d15cc376077a3631e15bd46", GIT_OID_SHA1);
+ git_oid__fromstr(&ours.id, "ee3fa1b8c00aff7fe02065fdb50864bb0d932ccf", GIT_OID_SHA1);
+ git_oid__fromstr(&theirs.id, "2bd0a343aeef7a2cf0d158478966a6e587ff3863", GIT_OID_SHA1);
cl_git_pass(git_index_conflict_add(index, &ancestor, &ours, &theirs));
cl_git_pass(git_diff_tree_to_index(&diff1, g_repo, a, index, NULL));
diff --git a/tests/libgit2/email/create.c b/tests/libgit2/email/create.c
index 27a665582..cf40ff552 100644
--- a/tests/libgit2/email/create.c
+++ b/tests/libgit2/email/create.c
@@ -24,7 +24,7 @@ static void email_for_commit(
git_commit *commit = NULL;
git_diff *diff = NULL;
- git_oid_fromstr(&oid, commit_id);
+ git_oid__fromstr(&oid, commit_id, GIT_OID_SHA1);
cl_git_pass(git_commit_lookup(&commit, repo, &oid));
@@ -323,7 +323,7 @@ void test_email_create__custom_summary_and_body(void)
opts.subject_prefix = "PPPPPATCH";
- git_oid_fromstr(&oid, "627e7e12d87e07a83fad5b6bfa25e86ead4a5270");
+ git_oid__fromstr(&oid, "627e7e12d87e07a83fad5b6bfa25e86ead4a5270", GIT_OID_SHA1);
cl_git_pass(git_commit_lookup(&commit, repo, &oid));
cl_git_pass(git_diff__commit(&diff, repo, commit, NULL));
cl_git_pass(git_email_create_from_diff(&buf, diff, 2, 4, &oid, summary, body, git_commit_author(commit), &opts));
diff --git a/tests/libgit2/email/create.c.bak b/tests/libgit2/email/create.c.bak
index 3bb95a6f6..cbb140bd2 100644
--- a/tests/libgit2/email/create.c.bak
+++ b/tests/libgit2/email/create.c.bak
@@ -25,7 +25,7 @@ static void email_for_commit(
git_commit *commit = NULL;
git_diff *diff = NULL;
- git_oid_fromstr(&oid, commit_id);
+ git_oid_fromstr(&oid, commit_id, GIT_OID_SHA1);
cl_git_pass(git_commit_lookup(&commit, repo, &oid));
@@ -156,7 +156,7 @@ void test_email_create__custom_summary_and_body(void)
opts.subject_prefix = "PPPPPATCH";
- git_oid_fromstr(&oid, "627e7e12d87e07a83fad5b6bfa25e86ead4a5270");
+ git_oid_fromstr(&oid, "627e7e12d87e07a83fad5b6bfa25e86ead4a5270", GIT_OID_SHA1);
cl_git_pass(git_commit_lookup(&commit, repo, &oid));
cl_git_pass(git_diff__commit(&diff, repo, commit, NULL));
cl_git_pass(git_email_create_from_diff(&buf, diff, 2, 4, &oid, summary, body, git_commit_author(commit), &opts));
diff --git a/tests/libgit2/fetch/local.c b/tests/libgit2/fetch/local.c
index 20bd7adf4..5d2417f1c 100644
--- a/tests/libgit2/fetch/local.c
+++ b/tests/libgit2/fetch/local.c
@@ -26,7 +26,7 @@ void test_fetch_local__defaults(void)
cl_fixture("testrepo.git")));
cl_git_pass(git_remote_fetch(remote, NULL, NULL, NULL));
- git_oid_fromstr(&expected_id, "258f0e2a959a364e40ed6603d5d44fbb24765b10");
+ git_oid__fromstr(&expected_id, "258f0e2a959a364e40ed6603d5d44fbb24765b10", GIT_OID_SHA1);
cl_git_pass(git_revparse_single(&obj, repo, "refs/remotes/test/haacked"));
cl_assert_equal_oid(&expected_id, git_object_id(obj));
@@ -47,7 +47,7 @@ void test_fetch_local__reachable_commit(void)
refspecs.strings = &refspec;
refspecs.count = 1;
- git_oid_fromstr(&expected_id, "5b5b025afb0b4c913b4c338a42934a3863bf3644");
+ git_oid__fromstr(&expected_id, "5b5b025afb0b4c913b4c338a42934a3863bf3644", GIT_OID_SHA1);
cl_git_pass(git_remote_create(&remote, repo, "test",
cl_fixture("testrepo.git")));
diff --git a/tests/libgit2/fetchhead/nonetwork.c b/tests/libgit2/fetchhead/nonetwork.c
index aadcc7880..2519d895e 100644
--- a/tests/libgit2/fetchhead/nonetwork.c
+++ b/tests/libgit2/fetchhead/nonetwork.c
@@ -29,43 +29,49 @@ static void populate_fetchhead(git_vector *out, git_repository *repo)
git_fetchhead_ref *fetchhead_ref;
git_oid oid;
- cl_git_pass(git_oid_fromstr(&oid,
- "49322bb17d3acc9146f98c97d078513228bbf3c0"));
+ cl_git_pass(git_oid__fromstr(&oid,
+ "49322bb17d3acc9146f98c97d078513228bbf3c0",
+ GIT_OID_SHA1));
cl_git_pass(git_fetchhead_ref_create(&fetchhead_ref, &oid, 1,
"refs/heads/master",
"https://github.com/libgit2/TestGitRepository"));
cl_git_pass(git_vector_insert(out, fetchhead_ref));
- cl_git_pass(git_oid_fromstr(&oid,
- "0966a434eb1a025db6b71485ab63a3bfbea520b6"));
+ cl_git_pass(git_oid__fromstr(&oid,
+ "0966a434eb1a025db6b71485ab63a3bfbea520b6",
+ GIT_OID_SHA1));
cl_git_pass(git_fetchhead_ref_create(&fetchhead_ref, &oid, 0,
"refs/heads/first-merge",
"https://github.com/libgit2/TestGitRepository"));
cl_git_pass(git_vector_insert(out, fetchhead_ref));
- cl_git_pass(git_oid_fromstr(&oid,
- "42e4e7c5e507e113ebbb7801b16b52cf867b7ce1"));
+ cl_git_pass(git_oid__fromstr(&oid,
+ "42e4e7c5e507e113ebbb7801b16b52cf867b7ce1",
+ GIT_OID_SHA1));
cl_git_pass(git_fetchhead_ref_create(&fetchhead_ref, &oid, 0,
"refs/heads/no-parent",
"https://github.com/libgit2/TestGitRepository"));
cl_git_pass(git_vector_insert(out, fetchhead_ref));
- cl_git_pass(git_oid_fromstr(&oid,
- "d96c4e80345534eccee5ac7b07fc7603b56124cb"));
+ cl_git_pass(git_oid__fromstr(&oid,
+ "d96c4e80345534eccee5ac7b07fc7603b56124cb",
+ GIT_OID_SHA1));
cl_git_pass(git_fetchhead_ref_create(&fetchhead_ref, &oid, 0,
"refs/tags/annotated_tag",
"https://github.com/libgit2/TestGitRepository"));
cl_git_pass(git_vector_insert(out, fetchhead_ref));
- cl_git_pass(git_oid_fromstr(&oid,
- "55a1a760df4b86a02094a904dfa511deb5655905"));
+ cl_git_pass(git_oid__fromstr(&oid,
+ "55a1a760df4b86a02094a904dfa511deb5655905",
+ GIT_OID_SHA1));
cl_git_pass(git_fetchhead_ref_create(&fetchhead_ref, &oid, 0,
"refs/tags/blob",
"https://github.com/libgit2/TestGitRepository"));
cl_git_pass(git_vector_insert(out, fetchhead_ref));
- cl_git_pass(git_oid_fromstr(&oid,
- "8f50ba15d49353813cc6e20298002c0d17b0a9ee"));
+ cl_git_pass(git_oid__fromstr(&oid,
+ "8f50ba15d49353813cc6e20298002c0d17b0a9ee",
+ GIT_OID_SHA1));
cl_git_pass(git_fetchhead_ref_create(&fetchhead_ref, &oid, 0,
"refs/tags/commit_tree",
"https://github.com/libgit2/TestGitRepository"));
@@ -170,7 +176,7 @@ static int read_old_style_cb(const char *name, const char *url,
GIT_UNUSED(payload);
- git_oid_fromstr(&expected, "49322bb17d3acc9146f98c97d078513228bbf3c0");
+ git_oid__fromstr(&expected, "49322bb17d3acc9146f98c97d078513228bbf3c0", GIT_OID_SHA1);
cl_assert(name == NULL);
cl_assert(url == NULL);
@@ -197,7 +203,7 @@ static int read_type_missing(const char *ref_name, const char *remote_url,
GIT_UNUSED(payload);
- git_oid_fromstr(&expected, "49322bb17d3acc9146f98c97d078513228bbf3c0");
+ git_oid__fromstr(&expected, "49322bb17d3acc9146f98c97d078513228bbf3c0", GIT_OID_SHA1);
cl_assert_equal_s("name", ref_name);
cl_assert_equal_s("remote_url", remote_url);
@@ -224,7 +230,7 @@ static int read_name_missing(const char *ref_name, const char *remote_url,
GIT_UNUSED(payload);
- git_oid_fromstr(&expected, "49322bb17d3acc9146f98c97d078513228bbf3c0");
+ git_oid__fromstr(&expected, "49322bb17d3acc9146f98c97d078513228bbf3c0", GIT_OID_SHA1);
cl_assert(ref_name == NULL);
cl_assert_equal_s("remote_url", remote_url);
@@ -528,13 +534,13 @@ void test_fetchhead_nonetwork__credentials_are_stripped(void)
git_fetchhead_ref *ref;
git_oid oid;
- cl_git_pass(git_oid_fromstr(&oid, "49322bb17d3acc9146f98c97d078513228bbf3c0"));
+ cl_git_pass(git_oid__fromstr(&oid, "49322bb17d3acc9146f98c97d078513228bbf3c0", GIT_OID_SHA1));
cl_git_pass(git_fetchhead_ref_create(&ref, &oid, 0,
"refs/tags/commit_tree", "http://foo:bar@github.com/libgit2/TestGitRepository"));
cl_assert_equal_s(ref->remote_url, "http://github.com/libgit2/TestGitRepository");
git_fetchhead_ref_free(ref);
- cl_git_pass(git_oid_fromstr(&oid, "49322bb17d3acc9146f98c97d078513228bbf3c0"));
+ cl_git_pass(git_oid__fromstr(&oid, "49322bb17d3acc9146f98c97d078513228bbf3c0", GIT_OID_SHA1));
cl_git_pass(git_fetchhead_ref_create(&ref, &oid, 0,
"refs/tags/commit_tree", "https://foo:bar@github.com/libgit2/TestGitRepository"));
cl_assert_equal_s(ref->remote_url, "https://github.com/libgit2/TestGitRepository");
diff --git a/tests/libgit2/filter/bare.c b/tests/libgit2/filter/bare.c
index 8402638ce..f53cfcb49 100644
--- a/tests/libgit2/filter/bare.c
+++ b/tests/libgit2/filter/bare.c
@@ -140,7 +140,7 @@ void test_filter_bare__from_specific_commit_one(void)
opts.flags |= GIT_BLOB_FILTER_NO_SYSTEM_ATTRIBUTES;
opts.flags |= GIT_BLOB_FILTER_ATTRIBUTES_FROM_COMMIT;
- cl_git_pass(git_oid_fromstr(&opts.attr_commit_id, "b8986fec0f7bde90f78ac72706e782d82f24f2f0"));
+ cl_git_pass(git_oid__fromstr(&opts.attr_commit_id, "b8986fec0f7bde90f78ac72706e782d82f24f2f0", GIT_OID_SHA1));
cl_git_pass(git_revparse_single(
(git_object **)&blob, g_repo, "055c872")); /* ident */
@@ -165,7 +165,7 @@ void test_filter_bare__from_specific_commit_with_no_attributes_file(void)
opts.flags |= GIT_BLOB_FILTER_NO_SYSTEM_ATTRIBUTES;
opts.flags |= GIT_BLOB_FILTER_ATTRIBUTES_FROM_COMMIT;
- cl_git_pass(git_oid_fromstr(&opts.attr_commit_id, "5afb6a14a864e30787857dd92af837e8cdd2cb1b"));
+ cl_git_pass(git_oid__fromstr(&opts.attr_commit_id, "5afb6a14a864e30787857dd92af837e8cdd2cb1b", GIT_OID_SHA1));
cl_git_pass(git_revparse_single(
(git_object **)&blob, g_repo, "799770d")); /* all-lf */
diff --git a/tests/libgit2/graph/ahead_behind.c b/tests/libgit2/graph/ahead_behind.c
index 77d7768af..dd828c5f3 100644
--- a/tests/libgit2/graph/ahead_behind.c
+++ b/tests/libgit2/graph/ahead_behind.c
@@ -10,7 +10,7 @@ void test_graph_ahead_behind__initialize(void)
git_oid oid;
cl_git_pass(git_repository_open(&_repo, cl_fixture("testrepo.git")));
- cl_git_pass(git_oid_fromstr(&oid, "be3563ae3f795b2b4353bcce3a527ad0a4f7f644"));
+ cl_git_pass(git_oid__fromstr(&oid, "be3563ae3f795b2b4353bcce3a527ad0a4f7f644", GIT_OID_SHA1));
cl_git_pass(git_commit_lookup(&commit, _repo, &oid));
}
@@ -29,8 +29,8 @@ void test_graph_ahead_behind__returns_correct_result(void)
git_oid oid2;
git_commit *other;
- cl_git_pass(git_oid_fromstr(&oid, "e90810b8df3e80c413d903f631643c716887138d"));
- cl_git_pass(git_oid_fromstr(&oid2, "be3563ae3f795b2b4353bcce3a527ad0a4f7f644"));
+ cl_git_pass(git_oid__fromstr(&oid, "e90810b8df3e80c413d903f631643c716887138d", GIT_OID_SHA1));
+ cl_git_pass(git_oid__fromstr(&oid2, "be3563ae3f795b2b4353bcce3a527ad0a4f7f644", GIT_OID_SHA1));
cl_git_pass(git_graph_ahead_behind(&ahead, &behind, _repo, &oid, &oid2));
cl_assert_equal_sz(2, ahead);
diff --git a/tests/libgit2/graph/commitgraph.c b/tests/libgit2/graph/commitgraph.c
index 7607c35a3..e2452000d 100644
--- a/tests/libgit2/graph/commitgraph.c
+++ b/tests/libgit2/graph/commitgraph.c
@@ -19,28 +19,28 @@ void test_graph_commitgraph__parse(void)
cl_git_pass(git_commit_graph_file_open(&file, git_str_cstr(&commit_graph_path)));
cl_assert_equal_i(git_commit_graph_file_needs_refresh(file, git_str_cstr(&commit_graph_path)), 0);
- cl_git_pass(git_oid_fromstr(&id, "5001298e0c09ad9c34e4249bc5801c75e9754fa5"));
- cl_git_pass(git_commit_graph_entry_find(&e, file, &id, GIT_OID_HEXSZ));
+ cl_git_pass(git_oid__fromstr(&id, "5001298e0c09ad9c34e4249bc5801c75e9754fa5", GIT_OID_SHA1));
+ cl_git_pass(git_commit_graph_entry_find(&e, file, &id, GIT_OID_SHA1_HEXSIZE));
cl_assert_equal_oid(&e.sha1, &id);
- cl_git_pass(git_oid_fromstr(&id, "418382dff1ffb8bdfba833f4d8bbcde58b1e7f47"));
+ cl_git_pass(git_oid__fromstr(&id, "418382dff1ffb8bdfba833f4d8bbcde58b1e7f47", GIT_OID_SHA1));
cl_assert_equal_oid(&e.tree_oid, &id);
cl_assert_equal_i(e.generation, 1);
cl_assert_equal_i(e.commit_time, UINT64_C(1273610423));
cl_assert_equal_i(e.parent_count, 0);
- cl_git_pass(git_oid_fromstr(&id, "be3563ae3f795b2b4353bcce3a527ad0a4f7f644"));
- cl_git_pass(git_commit_graph_entry_find(&e, file, &id, GIT_OID_HEXSZ));
+ cl_git_pass(git_oid__fromstr(&id, "be3563ae3f795b2b4353bcce3a527ad0a4f7f644", GIT_OID_SHA1));
+ cl_git_pass(git_commit_graph_entry_find(&e, file, &id, GIT_OID_SHA1_HEXSIZE));
cl_assert_equal_oid(&e.sha1, &id);
cl_assert_equal_i(e.generation, 5);
cl_assert_equal_i(e.commit_time, UINT64_C(1274813907));
cl_assert_equal_i(e.parent_count, 2);
- cl_git_pass(git_oid_fromstr(&id, "9fd738e8f7967c078dceed8190330fc8648ee56a"));
+ cl_git_pass(git_oid__fromstr(&id, "9fd738e8f7967c078dceed8190330fc8648ee56a", GIT_OID_SHA1));
cl_git_pass(git_commit_graph_entry_parent(&parent, file, &e, 0));
cl_assert_equal_oid(&parent.sha1, &id);
cl_assert_equal_i(parent.generation, 4);
- cl_git_pass(git_oid_fromstr(&id, "c47800c7266a2be04c571c04d5a6614691ea99bd"));
+ cl_git_pass(git_oid__fromstr(&id, "c47800c7266a2be04c571c04d5a6614691ea99bd", GIT_OID_SHA1));
cl_git_pass(git_commit_graph_entry_parent(&parent, file, &e, 1));
cl_assert_equal_oid(&parent.sha1, &id);
cl_assert_equal_i(parent.generation, 3);
@@ -62,26 +62,26 @@ void test_graph_commitgraph__parse_octopus_merge(void)
cl_git_pass(git_str_joinpath(&commit_graph_path, git_repository_path(repo), "objects/info/commit-graph"));
cl_git_pass(git_commit_graph_file_open(&file, git_str_cstr(&commit_graph_path)));
- cl_git_pass(git_oid_fromstr(&id, "d71c24b3b113fd1d1909998c5bfe33b86a65ee03"));
- cl_git_pass(git_commit_graph_entry_find(&e, file, &id, GIT_OID_HEXSZ));
+ cl_git_pass(git_oid__fromstr(&id, "d71c24b3b113fd1d1909998c5bfe33b86a65ee03", GIT_OID_SHA1));
+ cl_git_pass(git_commit_graph_entry_find(&e, file, &id, GIT_OID_SHA1_HEXSIZE));
cl_assert_equal_oid(&e.sha1, &id);
- cl_git_pass(git_oid_fromstr(&id, "348f16ffaeb73f319a75cec5b16a0a47d2d5e27c"));
+ cl_git_pass(git_oid__fromstr(&id, "348f16ffaeb73f319a75cec5b16a0a47d2d5e27c", GIT_OID_SHA1));
cl_assert_equal_oid(&e.tree_oid, &id);
cl_assert_equal_i(e.generation, 7);
cl_assert_equal_i(e.commit_time, UINT64_C(1447083009));
cl_assert_equal_i(e.parent_count, 3);
- cl_git_pass(git_oid_fromstr(&id, "ad2ace9e15f66b3d1138922e6ffdc3ea3f967fa6"));
+ cl_git_pass(git_oid__fromstr(&id, "ad2ace9e15f66b3d1138922e6ffdc3ea3f967fa6", GIT_OID_SHA1));
cl_git_pass(git_commit_graph_entry_parent(&parent, file, &e, 0));
cl_assert_equal_oid(&parent.sha1, &id);
cl_assert_equal_i(parent.generation, 6);
- cl_git_pass(git_oid_fromstr(&id, "483065df53c0f4a02cdc6b2910b05d388fc17ffb"));
+ cl_git_pass(git_oid__fromstr(&id, "483065df53c0f4a02cdc6b2910b05d388fc17ffb", GIT_OID_SHA1));
cl_git_pass(git_commit_graph_entry_parent(&parent, file, &e, 1));
cl_assert_equal_oid(&parent.sha1, &id);
cl_assert_equal_i(parent.generation, 2);
- cl_git_pass(git_oid_fromstr(&id, "815b5a1c80ca749d705c7aa0cb294a00cbedd340"));
+ cl_git_pass(git_oid__fromstr(&id, "815b5a1c80ca749d705c7aa0cb294a00cbedd340", GIT_OID_SHA1));
cl_git_pass(git_commit_graph_entry_parent(&parent, file, &e, 2));
cl_assert_equal_oid(&parent.sha1, &id);
cl_assert_equal_i(parent.generation, 6);
diff --git a/tests/libgit2/graph/descendant_of.c b/tests/libgit2/graph/descendant_of.c
index 8e9952a09..b6dffae06 100644
--- a/tests/libgit2/graph/descendant_of.c
+++ b/tests/libgit2/graph/descendant_of.c
@@ -9,7 +9,7 @@ void test_graph_descendant_of__initialize(void)
cl_git_pass(git_repository_open(&_repo, cl_fixture("testrepo.git")));
- git_oid_fromstr(&oid, "be3563ae3f795b2b4353bcce3a527ad0a4f7f644");
+ git_oid__fromstr(&oid, "be3563ae3f795b2b4353bcce3a527ad0a4f7f644", GIT_OID_SHA1);
cl_git_pass(git_commit_lookup(&commit, _repo, &oid));
}
@@ -50,6 +50,6 @@ void test_graph_descendant_of__nopath(void)
{
git_oid oid;
- git_oid_fromstr(&oid, "e90810b8df3e80c413d903f631643c716887138d");
+ git_oid__fromstr(&oid, "e90810b8df3e80c413d903f631643c716887138d", GIT_OID_SHA1);
cl_assert_equal_i(0, git_graph_descendant_of(_repo, git_commit_id(commit), &oid));
}
diff --git a/tests/libgit2/graph/reachable_from_any.c b/tests/libgit2/graph/reachable_from_any.c
index 9693d7d67..8e1c23874 100644
--- a/tests/libgit2/graph/reachable_from_any.c
+++ b/tests/libgit2/graph/reachable_from_any.c
@@ -17,7 +17,7 @@ void test_graph_reachable_from_any__initialize(void)
repo = cl_git_sandbox_init(TEST_REPO_PATH);
- git_oid_fromstr(&oid, "539bd011c4822c560c1d17cab095006b7a10f707");
+ git_oid__fromstr(&oid, "539bd011c4822c560c1d17cab095006b7a10f707", GIT_OID_SHA1);
cl_git_pass(git_commit_lookup(&commit, repo, &oid));
cl_git_pass(git_reset(repo, (git_object *)commit, GIT_RESET_HARD, NULL));
git_commit_free(commit);
diff --git a/tests/libgit2/index/add.c b/tests/libgit2/index/add.c
index f101ea266..b0c3bd2b7 100644
--- a/tests/libgit2/index/add.c
+++ b/tests/libgit2/index/add.c
@@ -28,7 +28,7 @@ static void test_add_entry(
{
git_index_entry entry = {{0}};
- cl_git_pass(git_oid_fromstr(&entry.id, idstr));
+ cl_git_pass(git_oid__fromstr(&entry.id, idstr, GIT_OID_SHA1));
entry.path = mode == GIT_FILEMODE_TREE ? "test_folder" : "test_file";
entry.mode = mode;
diff --git a/tests/libgit2/index/bypath.c b/tests/libgit2/index/bypath.c
index b32a0a789..15c11af5f 100644
--- a/tests/libgit2/index/bypath.c
+++ b/tests/libgit2/index/bypath.c
@@ -131,7 +131,7 @@ void test_index_bypath__add_honors_existing_case_2(void)
clar__skip();
dummy.mode = GIT_FILEMODE_BLOB;
- cl_git_pass(git_oid_fromstr(&dummy.id, "f990a25a74d1a8281ce2ab018ea8df66795cd60b"));
+ cl_git_pass(git_oid__fromstr(&dummy.id, "f990a25a74d1a8281ce2ab018ea8df66795cd60b", GIT_OID_SHA1));
/* note that `git_index_add` does no checking to canonical directories */
dummy.path = "Just_a_dir/file0.txt";
@@ -187,7 +187,7 @@ void test_index_bypath__add_honors_existing_case_3(void)
clar__skip();
dummy.mode = GIT_FILEMODE_BLOB;
- cl_git_pass(git_oid_fromstr(&dummy.id, "f990a25a74d1a8281ce2ab018ea8df66795cd60b"));
+ cl_git_pass(git_oid__fromstr(&dummy.id, "f990a25a74d1a8281ce2ab018ea8df66795cd60b", GIT_OID_SHA1));
dummy.path = "just_a_dir/filea.txt";
cl_git_pass(git_index_add(g_idx, &dummy));
@@ -218,7 +218,7 @@ void test_index_bypath__add_honors_existing_case_4(void)
clar__skip();
dummy.mode = GIT_FILEMODE_BLOB;
- cl_git_pass(git_oid_fromstr(&dummy.id, "f990a25a74d1a8281ce2ab018ea8df66795cd60b"));
+ cl_git_pass(git_oid__fromstr(&dummy.id, "f990a25a74d1a8281ce2ab018ea8df66795cd60b", GIT_OID_SHA1));
dummy.path = "just_a_dir/a/b/c/d/e/file1.txt";
cl_git_pass(git_index_add(g_idx, &dummy));
diff --git a/tests/libgit2/index/cache.c b/tests/libgit2/index/cache.c
index 56885aff7..7576331b0 100644
--- a/tests/libgit2/index/cache.c
+++ b/tests/libgit2/index/cache.c
@@ -26,7 +26,7 @@ void test_index_cache__write_extension_at_root(void)
cl_git_pass(git_index_open(&index, index_file));
cl_assert(index->tree == NULL);
- cl_git_pass(git_oid_fromstr(&id, tree_id_str));
+ cl_git_pass(git_oid__fromstr(&id, tree_id_str, GIT_OID_SHA1));
cl_git_pass(git_tree_lookup(&tree, g_repo, &id));
cl_git_pass(git_index_read_tree(index, tree));
git_tree_free(tree);
@@ -58,7 +58,7 @@ void test_index_cache__write_extension_invalidated_root(void)
cl_git_pass(git_index_open(&index, index_file));
cl_assert(index->tree == NULL);
- cl_git_pass(git_oid_fromstr(&id, tree_id_str));
+ cl_git_pass(git_oid__fromstr(&id, tree_id_str, GIT_OID_SHA1));
cl_git_pass(git_tree_lookup(&tree, g_repo, &id));
cl_git_pass(git_index_read_tree(index, tree));
git_tree_free(tree);
@@ -98,7 +98,7 @@ void test_index_cache__read_tree_no_children(void)
cl_git_pass(git_index_new(&index));
cl_assert(index->tree == NULL);
- cl_git_pass(git_oid_fromstr(&id, "45dd856fdd4d89b884c340ba0e047752d9b085d6"));
+ cl_git_pass(git_oid__fromstr(&id, "45dd856fdd4d89b884c340ba0e047752d9b085d6", GIT_OID_SHA1));
cl_git_pass(git_tree_lookup(&tree, g_repo, &id));
cl_git_pass(git_index_read_tree(index, tree));
git_tree_free(tree);
@@ -111,7 +111,7 @@ void test_index_cache__read_tree_no_children(void)
memset(&entry, 0x0, sizeof(git_index_entry));
entry.path = "new.txt";
entry.mode = GIT_FILEMODE_BLOB;
- git_oid_fromstr(&entry.id, "d4bcc68acd4410bf836a39f20afb2c2ece09584e");
+ git_oid__fromstr(&entry.id, "d4bcc68acd4410bf836a39f20afb2c2ece09584e", GIT_OID_SHA1);
cl_git_pass(git_index_add(index, &entry));
cl_assert_equal_i(-1, index->tree->entry_count);
@@ -132,7 +132,7 @@ void test_index_cache__two_levels(void)
memset(&entry, 0x0, sizeof(entry));
entry.mode = GIT_FILEMODE_BLOB;
- cl_git_pass(git_oid_fromstr(&entry.id, "a8233120f6ad708f843d861ce2b7228ec4e3dec6"));
+ cl_git_pass(git_oid__fromstr(&entry.id, "a8233120f6ad708f843d861ce2b7228ec4e3dec6", GIT_OID_SHA1));
entry.path = "top-level.txt";
cl_git_pass(git_index_add(index, &entry));
@@ -156,7 +156,7 @@ void test_index_cache__two_levels(void)
cl_assert(git_tree_cache_get(index->tree, "subdir"));
entry.path = "top-level.txt";
- cl_git_pass(git_oid_fromstr(&entry.id, "3697d64be941a53d4ae8f6a271e4e3fa56b022cc"));
+ cl_git_pass(git_oid__fromstr(&entry.id, "3697d64be941a53d4ae8f6a271e4e3fa56b022cc", GIT_OID_SHA1));
cl_git_pass(git_index_add(index, &entry));
/* writ out the index after we invalidate the root */
@@ -191,7 +191,7 @@ void test_index_cache__read_tree_children(void)
memset(&entry, 0x0, sizeof(git_index_entry));
entry.path = "top-level";
entry.mode = GIT_FILEMODE_BLOB;
- git_oid_fromstr(&entry.id, "ee3fa1b8c00aff7fe02065fdb50864bb0d932ccf");
+ git_oid__fromstr(&entry.id, "ee3fa1b8c00aff7fe02065fdb50864bb0d932ccf", GIT_OID_SHA1);
cl_git_pass(git_index_add(index, &entry));
@@ -217,7 +217,7 @@ void test_index_cache__read_tree_children(void)
/* override with a slightly different id, also dummy */
entry.path = "subdir/some-file";
- git_oid_fromstr(&entry.id, "ee3fa1b8c00aff7fe02065fdb50864bb0d932ccf");
+ git_oid__fromstr(&entry.id, "ee3fa1b8c00aff7fe02065fdb50864bb0d932ccf", GIT_OID_SHA1);
cl_git_pass(git_index_add(index, &entry));
cl_assert_equal_i(-1, index->tree->entry_count);
diff --git a/tests/libgit2/index/conflicts.c b/tests/libgit2/index/conflicts.c
index 41d0e219c..353886f7b 100644
--- a/tests/libgit2/index/conflicts.c
+++ b/tests/libgit2/index/conflicts.c
@@ -37,17 +37,17 @@ void test_index_conflicts__add(void)
ancestor_entry.path = "test-one.txt";
ancestor_entry.mode = 0100644;
GIT_INDEX_ENTRY_STAGE_SET(&ancestor_entry, 1);
- git_oid_fromstr(&ancestor_entry.id, CONFLICTS_ONE_ANCESTOR_OID);
+ git_oid__fromstr(&ancestor_entry.id, CONFLICTS_ONE_ANCESTOR_OID, GIT_OID_SHA1);
our_entry.path = "test-one.txt";
our_entry.mode = 0100644;
GIT_INDEX_ENTRY_STAGE_SET(&our_entry, 2);
- git_oid_fromstr(&our_entry.id, CONFLICTS_ONE_OUR_OID);
+ git_oid__fromstr(&our_entry.id, CONFLICTS_ONE_OUR_OID, GIT_OID_SHA1);
their_entry.path = "test-one.txt";
their_entry.mode = 0100644;
GIT_INDEX_ENTRY_STAGE_SET(&ancestor_entry, 2);
- git_oid_fromstr(&their_entry.id, CONFLICTS_ONE_THEIR_OID);
+ git_oid__fromstr(&their_entry.id, CONFLICTS_ONE_THEIR_OID, GIT_OID_SHA1);
cl_git_pass(git_index_conflict_add(repo_index, &ancestor_entry, &our_entry, &their_entry));
@@ -68,17 +68,17 @@ void test_index_conflicts__add_fixes_incorrect_stage(void)
ancestor_entry.path = "test-one.txt";
ancestor_entry.mode = 0100644;
GIT_INDEX_ENTRY_STAGE_SET(&ancestor_entry, 3);
- git_oid_fromstr(&ancestor_entry.id, CONFLICTS_ONE_ANCESTOR_OID);
+ git_oid__fromstr(&ancestor_entry.id, CONFLICTS_ONE_ANCESTOR_OID, GIT_OID_SHA1);
our_entry.path = "test-one.txt";
our_entry.mode = 0100644;
GIT_INDEX_ENTRY_STAGE_SET(&our_entry, 1);
- git_oid_fromstr(&our_entry.id, CONFLICTS_ONE_OUR_OID);
+ git_oid__fromstr(&our_entry.id, CONFLICTS_ONE_OUR_OID, GIT_OID_SHA1);
their_entry.path = "test-one.txt";
their_entry.mode = 0100644;
GIT_INDEX_ENTRY_STAGE_SET(&their_entry, 2);
- git_oid_fromstr(&their_entry.id, CONFLICTS_ONE_THEIR_OID);
+ git_oid__fromstr(&their_entry.id, CONFLICTS_ONE_THEIR_OID, GIT_OID_SHA1);
cl_git_pass(git_index_conflict_add(repo_index, &ancestor_entry, &our_entry, &their_entry));
@@ -111,17 +111,17 @@ void test_index_conflicts__add_detects_invalid_filemode(void)
ancestor_entry.path = "test-one.txt";
ancestor_entry.mode = 0100644;
GIT_INDEX_ENTRY_STAGE_SET(&ancestor_entry, 3);
- git_oid_fromstr(&ancestor_entry.id, CONFLICTS_ONE_ANCESTOR_OID);
+ git_oid__fromstr(&ancestor_entry.id, CONFLICTS_ONE_ANCESTOR_OID, GIT_OID_SHA1);
our_entry.path = "test-one.txt";
our_entry.mode = 0100644;
GIT_INDEX_ENTRY_STAGE_SET(&our_entry, 1);
- git_oid_fromstr(&our_entry.id, CONFLICTS_ONE_OUR_OID);
+ git_oid__fromstr(&our_entry.id, CONFLICTS_ONE_OUR_OID, GIT_OID_SHA1);
their_entry.path = "test-one.txt";
their_entry.mode = 0100644;
GIT_INDEX_ENTRY_STAGE_SET(&their_entry, 2);
- git_oid_fromstr(&their_entry.id, CONFLICTS_ONE_THEIR_OID);
+ git_oid__fromstr(&their_entry.id, CONFLICTS_ONE_THEIR_OID, GIT_OID_SHA1);
/* Corrupt the conflict entry's mode */
conflict_entry[i]->mode = 027431745;
@@ -151,17 +151,17 @@ void test_index_conflicts__add_removes_stage_zero(void)
ancestor_entry.path = "test-one.txt";
ancestor_entry.mode = 0100644;
GIT_INDEX_ENTRY_STAGE_SET(&ancestor_entry, 3);
- git_oid_fromstr(&ancestor_entry.id, CONFLICTS_ONE_ANCESTOR_OID);
+ git_oid__fromstr(&ancestor_entry.id, CONFLICTS_ONE_ANCESTOR_OID, GIT_OID_SHA1);
our_entry.path = "test-one.txt";
our_entry.mode = 0100644;
GIT_INDEX_ENTRY_STAGE_SET(&our_entry, 1);
- git_oid_fromstr(&our_entry.id, CONFLICTS_ONE_OUR_OID);
+ git_oid__fromstr(&our_entry.id, CONFLICTS_ONE_OUR_OID, GIT_OID_SHA1);
their_entry.path = "test-one.txt";
their_entry.mode = 0100644;
GIT_INDEX_ENTRY_STAGE_SET(&their_entry, 2);
- git_oid_fromstr(&their_entry.id, CONFLICTS_ONE_THEIR_OID);
+ git_oid__fromstr(&their_entry.id, CONFLICTS_ONE_THEIR_OID, GIT_OID_SHA1);
cl_git_pass(git_index_conflict_add(repo_index, &ancestor_entry, &our_entry, &their_entry));
@@ -189,13 +189,13 @@ void test_index_conflicts__get(void)
cl_assert_equal_s("conflicts-one.txt", conflict_entry[0]->path);
- git_oid_fromstr(&oid, CONFLICTS_ONE_ANCESTOR_OID);
+ git_oid__fromstr(&oid, CONFLICTS_ONE_ANCESTOR_OID, GIT_OID_SHA1);
cl_assert_equal_oid(&oid, &conflict_entry[0]->id);
- git_oid_fromstr(&oid, CONFLICTS_ONE_OUR_OID);
+ git_oid__fromstr(&oid, CONFLICTS_ONE_OUR_OID, GIT_OID_SHA1);
cl_assert_equal_oid(&oid, &conflict_entry[1]->id);
- git_oid_fromstr(&oid, CONFLICTS_ONE_THEIR_OID);
+ git_oid__fromstr(&oid, CONFLICTS_ONE_THEIR_OID, GIT_OID_SHA1);
cl_assert_equal_oid(&oid, &conflict_entry[2]->id);
cl_git_pass(git_index_conflict_get(&conflict_entry[0], &conflict_entry[1],
@@ -203,13 +203,13 @@ void test_index_conflicts__get(void)
cl_assert_equal_s("conflicts-two.txt", conflict_entry[0]->path);
- git_oid_fromstr(&oid, CONFLICTS_TWO_ANCESTOR_OID);
+ git_oid__fromstr(&oid, CONFLICTS_TWO_ANCESTOR_OID, GIT_OID_SHA1);
cl_assert_equal_oid(&oid, &conflict_entry[0]->id);
- git_oid_fromstr(&oid, CONFLICTS_TWO_OUR_OID);
+ git_oid__fromstr(&oid, CONFLICTS_TWO_OUR_OID, GIT_OID_SHA1);
cl_assert_equal_oid(&oid, &conflict_entry[1]->id);
- git_oid_fromstr(&oid, CONFLICTS_TWO_THEIR_OID);
+ git_oid__fromstr(&oid, CONFLICTS_TWO_THEIR_OID, GIT_OID_SHA1);
cl_assert_equal_oid(&oid, &conflict_entry[2]->id);
}
@@ -223,29 +223,29 @@ void test_index_conflicts__iterate(void)
cl_git_pass(git_index_conflict_next(&conflict_entry[0], &conflict_entry[1], &conflict_entry[2], iterator));
- git_oid_fromstr(&oid, CONFLICTS_ONE_ANCESTOR_OID);
+ git_oid__fromstr(&oid, CONFLICTS_ONE_ANCESTOR_OID, GIT_OID_SHA1);
cl_assert_equal_oid(&oid, &conflict_entry[0]->id);
cl_assert(git__strcmp(conflict_entry[0]->path, "conflicts-one.txt") == 0);
- git_oid_fromstr(&oid, CONFLICTS_ONE_OUR_OID);
+ git_oid__fromstr(&oid, CONFLICTS_ONE_OUR_OID, GIT_OID_SHA1);
cl_assert_equal_oid(&oid, &conflict_entry[1]->id);
cl_assert(git__strcmp(conflict_entry[0]->path, "conflicts-one.txt") == 0);
- git_oid_fromstr(&oid, CONFLICTS_ONE_THEIR_OID);
+ git_oid__fromstr(&oid, CONFLICTS_ONE_THEIR_OID, GIT_OID_SHA1);
cl_assert_equal_oid(&oid, &conflict_entry[2]->id);
cl_assert(git__strcmp(conflict_entry[0]->path, "conflicts-one.txt") == 0);
cl_git_pass(git_index_conflict_next(&conflict_entry[0], &conflict_entry[1], &conflict_entry[2], iterator));
- git_oid_fromstr(&oid, CONFLICTS_TWO_ANCESTOR_OID);
+ git_oid__fromstr(&oid, CONFLICTS_TWO_ANCESTOR_OID, GIT_OID_SHA1);
cl_assert_equal_oid(&oid, &conflict_entry[0]->id);
cl_assert(git__strcmp(conflict_entry[0]->path, "conflicts-two.txt") == 0);
- git_oid_fromstr(&oid, CONFLICTS_TWO_OUR_OID);
+ git_oid__fromstr(&oid, CONFLICTS_TWO_OUR_OID, GIT_OID_SHA1);
cl_assert_equal_oid(&oid, &conflict_entry[1]->id);
cl_assert(git__strcmp(conflict_entry[0]->path, "conflicts-two.txt") == 0);
- git_oid_fromstr(&oid, CONFLICTS_TWO_THEIR_OID);
+ git_oid__fromstr(&oid, CONFLICTS_TWO_THEIR_OID, GIT_OID_SHA1);
cl_assert_equal_oid(&oid, &conflict_entry[2]->id);
cl_assert(git__strcmp(conflict_entry[0]->path, "conflicts-two.txt") == 0);
@@ -357,7 +357,7 @@ void test_index_conflicts__partial(void)
ancestor_entry.path = "test-one.txt";
ancestor_entry.mode = 0100644;
GIT_INDEX_ENTRY_STAGE_SET(&ancestor_entry, 1);
- git_oid_fromstr(&ancestor_entry.id, CONFLICTS_ONE_ANCESTOR_OID);
+ git_oid__fromstr(&ancestor_entry.id, CONFLICTS_ONE_ANCESTOR_OID, GIT_OID_SHA1);
cl_git_pass(git_index_conflict_add(repo_index, &ancestor_entry, NULL, NULL));
cl_assert(git_index_entrycount(repo_index) == 9);
@@ -387,17 +387,17 @@ void test_index_conflicts__case_matters(void)
ancestor_entry.path = upper_case;
GIT_INDEX_ENTRY_STAGE_SET(&ancestor_entry, GIT_INDEX_STAGE_ANCESTOR);
- git_oid_fromstr(&ancestor_entry.id, CONFLICTS_ONE_ANCESTOR_OID);
+ git_oid__fromstr(&ancestor_entry.id, CONFLICTS_ONE_ANCESTOR_OID, GIT_OID_SHA1);
ancestor_entry.mode = GIT_FILEMODE_BLOB;
our_entry.path = upper_case;
GIT_INDEX_ENTRY_STAGE_SET(&our_entry, GIT_INDEX_STAGE_OURS);
- git_oid_fromstr(&our_entry.id, CONFLICTS_ONE_OUR_OID);
+ git_oid__fromstr(&our_entry.id, CONFLICTS_ONE_OUR_OID, GIT_OID_SHA1);
our_entry.mode = GIT_FILEMODE_BLOB;
their_entry.path = upper_case;
GIT_INDEX_ENTRY_STAGE_SET(&their_entry, GIT_INDEX_STAGE_THEIRS);
- git_oid_fromstr(&their_entry.id, CONFLICTS_ONE_THEIR_OID);
+ git_oid__fromstr(&their_entry.id, CONFLICTS_ONE_THEIR_OID, GIT_OID_SHA1);
their_entry.mode = GIT_FILEMODE_BLOB;
cl_git_pass(git_index_conflict_add(repo_index,
@@ -405,17 +405,17 @@ void test_index_conflicts__case_matters(void)
ancestor_entry.path = mixed_case;
GIT_INDEX_ENTRY_STAGE_SET(&ancestor_entry, GIT_INDEX_STAGE_ANCESTOR);
- git_oid_fromstr(&ancestor_entry.id, CONFLICTS_TWO_ANCESTOR_OID);
+ git_oid__fromstr(&ancestor_entry.id, CONFLICTS_TWO_ANCESTOR_OID, GIT_OID_SHA1);
ancestor_entry.mode = GIT_FILEMODE_BLOB;
our_entry.path = mixed_case;
GIT_INDEX_ENTRY_STAGE_SET(&ancestor_entry, GIT_INDEX_STAGE_ANCESTOR);
- git_oid_fromstr(&our_entry.id, CONFLICTS_TWO_OUR_OID);
+ git_oid__fromstr(&our_entry.id, CONFLICTS_TWO_OUR_OID, GIT_OID_SHA1);
ancestor_entry.mode = GIT_FILEMODE_BLOB;
their_entry.path = mixed_case;
GIT_INDEX_ENTRY_STAGE_SET(&their_entry, GIT_INDEX_STAGE_THEIRS);
- git_oid_fromstr(&their_entry.id, CONFLICTS_TWO_THEIR_OID);
+ git_oid__fromstr(&their_entry.id, CONFLICTS_TWO_THEIR_OID, GIT_OID_SHA1);
their_entry.mode = GIT_FILEMODE_BLOB;
cl_git_pass(git_index_conflict_add(repo_index,
@@ -434,29 +434,29 @@ void test_index_conflicts__case_matters(void)
correct_case = upper_case;
cl_assert_equal_s(correct_case, conflict_entry[0]->path);
- git_oid_fromstr(&oid, ignorecase ? CONFLICTS_TWO_ANCESTOR_OID : CONFLICTS_ONE_ANCESTOR_OID);
+ git_oid__fromstr(&oid, ignorecase ? CONFLICTS_TWO_ANCESTOR_OID : CONFLICTS_ONE_ANCESTOR_OID, GIT_OID_SHA1);
cl_assert_equal_oid(&oid, &conflict_entry[0]->id);
cl_assert_equal_s(correct_case, conflict_entry[1]->path);
- git_oid_fromstr(&oid, ignorecase ? CONFLICTS_TWO_OUR_OID : CONFLICTS_ONE_OUR_OID);
+ git_oid__fromstr(&oid, ignorecase ? CONFLICTS_TWO_OUR_OID : CONFLICTS_ONE_OUR_OID, GIT_OID_SHA1);
cl_assert_equal_oid(&oid, &conflict_entry[1]->id);
cl_assert_equal_s(correct_case, conflict_entry[2]->path);
- git_oid_fromstr(&oid, ignorecase ? CONFLICTS_TWO_THEIR_OID : CONFLICTS_ONE_THEIR_OID);
+ git_oid__fromstr(&oid, ignorecase ? CONFLICTS_TWO_THEIR_OID : CONFLICTS_ONE_THEIR_OID, GIT_OID_SHA1);
cl_assert_equal_oid(&oid, &conflict_entry[2]->id);
cl_git_pass(git_index_conflict_get(&conflict_entry[0], &conflict_entry[1],
&conflict_entry[2], repo_index, mixed_case));
cl_assert_equal_s(mixed_case, conflict_entry[0]->path);
- git_oid_fromstr(&oid, CONFLICTS_TWO_ANCESTOR_OID);
+ git_oid__fromstr(&oid, CONFLICTS_TWO_ANCESTOR_OID, GIT_OID_SHA1);
cl_assert_equal_oid(&oid, &conflict_entry[0]->id);
cl_assert_equal_s(mixed_case, conflict_entry[1]->path);
- git_oid_fromstr(&oid, CONFLICTS_TWO_OUR_OID);
+ git_oid__fromstr(&oid, CONFLICTS_TWO_OUR_OID, GIT_OID_SHA1);
cl_assert_equal_oid(&oid, &conflict_entry[1]->id);
cl_assert_equal_s(mixed_case, conflict_entry[2]->path);
- git_oid_fromstr(&oid, CONFLICTS_TWO_THEIR_OID);
+ git_oid__fromstr(&oid, CONFLICTS_TWO_THEIR_OID, GIT_OID_SHA1);
cl_assert_equal_oid(&oid, &conflict_entry[2]->id);
}
diff --git a/tests/libgit2/index/crlf.c b/tests/libgit2/index/crlf.c
index 7520c23a3..666ac1a0c 100644
--- a/tests/libgit2/index/crlf.c
+++ b/tests/libgit2/index/crlf.c
@@ -243,8 +243,9 @@ void test_index_crlf__autocrlf_false_no_attrs(void)
cl_git_pass(git_index_add_bypath(g_index, "newfile.txt"));
entry = git_index_get_bypath(g_index, "newfile.txt", 0);
- cl_git_pass(git_oid_fromstr(&oid,
- (GIT_EOL_NATIVE == GIT_EOL_CRLF) ? FILE_OID_CRLF : FILE_OID_LF));
+ cl_git_pass(git_oid__fromstr(&oid,
+ (GIT_EOL_NATIVE == GIT_EOL_CRLF) ? FILE_OID_CRLF : FILE_OID_LF,
+ GIT_OID_SHA1));
cl_assert_equal_oid(&oid, &entry->id);
}
@@ -261,7 +262,7 @@ void test_index_crlf__autocrlf_true_no_attrs(void)
cl_git_pass(git_index_add_bypath(g_index, "newfile.txt"));
entry = git_index_get_bypath(g_index, "newfile.txt", 0);
- cl_git_pass(git_oid_fromstr(&oid, FILE_OID_LF));
+ cl_git_pass(git_oid__fromstr(&oid, FILE_OID_LF, GIT_OID_SHA1));
cl_assert_equal_oid(&oid, &entry->id);
}
@@ -278,7 +279,7 @@ void test_index_crlf__autocrlf_input_no_attrs(void)
cl_git_pass(git_index_add_bypath(g_index, "newfile.txt"));
entry = git_index_get_bypath(g_index, "newfile.txt", 0);
- cl_git_pass(git_oid_fromstr(&oid, FILE_OID_LF));
+ cl_git_pass(git_oid__fromstr(&oid, FILE_OID_LF, GIT_OID_SHA1));
cl_assert_equal_oid(&oid, &entry->id);
}
@@ -297,7 +298,7 @@ void test_index_crlf__autocrlf_false_text_auto_attr(void)
cl_git_pass(git_index_add_bypath(g_index, "newfile.txt"));
entry = git_index_get_bypath(g_index, "newfile.txt", 0);
- cl_git_pass(git_oid_fromstr(&oid, FILE_OID_LF));
+ cl_git_pass(git_oid__fromstr(&oid, FILE_OID_LF, GIT_OID_SHA1));
cl_assert_equal_oid(&oid, &entry->id);
}
@@ -316,7 +317,7 @@ void test_index_crlf__autocrlf_true_text_auto_attr(void)
cl_git_pass(git_index_add_bypath(g_index, "newfile.txt"));
entry = git_index_get_bypath(g_index, "newfile.txt", 0);
- cl_git_pass(git_oid_fromstr(&oid, FILE_OID_LF));
+ cl_git_pass(git_oid__fromstr(&oid, FILE_OID_LF, GIT_OID_SHA1));
cl_assert_equal_oid(&oid, &entry->id);
}
@@ -335,7 +336,7 @@ void test_index_crlf__autocrlf_input_text_auto_attr(void)
cl_git_pass(git_index_add_bypath(g_index, "newfile.txt"));
entry = git_index_get_bypath(g_index, "newfile.txt", 0);
- cl_git_pass(git_oid_fromstr(&oid, FILE_OID_LF));
+ cl_git_pass(git_oid__fromstr(&oid, FILE_OID_LF, GIT_OID_SHA1));
cl_assert_equal_oid(&oid, &entry->id);
}
@@ -355,7 +356,7 @@ void test_index_crlf__safecrlf_true_autocrlf_input_text_auto_attr(void)
entry = git_index_get_bypath(g_index, "newfile.txt", 0);
cl_assert(entry);
- cl_git_pass(git_oid_fromstr(&oid, FILE_OID_LF));
+ cl_git_pass(git_oid__fromstr(&oid, FILE_OID_LF, GIT_OID_SHA1));
cl_assert_equal_oid(&oid, &entry->id);
cl_git_mkfile("./crlf/newfile2.txt", FILE_CONTENTS_CRLF);
@@ -376,7 +377,7 @@ void test_index_crlf__safecrlf_true_autocrlf_input_text__no_attr(void)
entry = git_index_get_bypath(g_index, "newfile.txt", 0);
cl_assert(entry);
- cl_git_pass(git_oid_fromstr(&oid, FILE_OID_LF));
+ cl_git_pass(git_oid__fromstr(&oid, FILE_OID_LF, GIT_OID_SHA1));
cl_assert_equal_oid(&oid, &entry->id);
cl_git_mkfile("./crlf/newfile2.txt", FILE_CONTENTS_CRLF);
diff --git a/tests/libgit2/index/names.c b/tests/libgit2/index/names.c
index 369318b03..2a41100aa 100644
--- a/tests/libgit2/index/names.c
+++ b/tests/libgit2/index/names.c
@@ -42,21 +42,21 @@ static void index_add_conflicts(void)
entry.path = conflict[0];
entry.mode = GIT_FILEMODE_BLOB;
GIT_INDEX_ENTRY_STAGE_SET(&entry, GIT_INDEX_STAGE_ANCESTOR);
- git_oid_fromstr(&entry.id, "1f85ca51b8e0aac893a621b61a9c2661d6aa6d81");
+ git_oid__fromstr(&entry.id, "1f85ca51b8e0aac893a621b61a9c2661d6aa6d81", GIT_OID_SHA1);
cl_git_pass(git_index_add(repo_index, &entry));
/* ours */
entry.path = conflict[1];
entry.mode = GIT_FILEMODE_BLOB;
GIT_INDEX_ENTRY_STAGE_SET(&entry, GIT_INDEX_STAGE_OURS);
- git_oid_fromstr(&entry.id, "1f85ca51b8e0aac893a621b61a9c2661d6aa6d81");
+ git_oid__fromstr(&entry.id, "1f85ca51b8e0aac893a621b61a9c2661d6aa6d81", GIT_OID_SHA1);
cl_git_pass(git_index_add(repo_index, &entry));
/* theirs */
entry.path = conflict[2];
entry.mode = GIT_FILEMODE_BLOB;
GIT_INDEX_ENTRY_STAGE_SET(&entry, GIT_INDEX_STAGE_THEIRS);
- git_oid_fromstr(&entry.id, "1f85ca51b8e0aac893a621b61a9c2661d6aa6d81");
+ git_oid__fromstr(&entry.id, "1f85ca51b8e0aac893a621b61a9c2661d6aa6d81", GIT_OID_SHA1);
cl_git_pass(git_index_add(repo_index, &entry));
}
}
diff --git a/tests/libgit2/index/read_index.c b/tests/libgit2/index/read_index.c
index 836c12b0e..ac03cf177 100644
--- a/tests/libgit2/index/read_index.c
+++ b/tests/libgit2/index/read_index.c
@@ -49,7 +49,7 @@ void test_index_read_index__maintains_stat_cache(void)
/* add a new entry that will not have stat data */
memset(&new_entry, 0, sizeof(git_index_entry));
new_entry.path = "Hello";
- git_oid_fromstr(&new_entry.id, "0123456789012345678901234567890123456789");
+ git_oid__fromstr(&new_entry.id, "0123456789012345678901234567890123456789", GIT_OID_SHA1);
new_entry.file_size = 1234;
new_entry.mode = 0100644;
cl_git_pass(git_index_add(new_index, &new_entry));
@@ -79,7 +79,7 @@ static bool roundtrip_with_read_index(const char *tree_idstr)
git_tree *tree;
git_index *tree_index;
- cl_git_pass(git_oid_fromstr(&tree_id, tree_idstr));
+ cl_git_pass(git_oid__fromstr(&tree_id, tree_idstr, GIT_OID_SHA1));
cl_git_pass(git_tree_lookup(&tree, _repo, &tree_id));
cl_git_pass(git_index_new(&tree_index));
cl_git_pass(git_index_read_tree(tree_index, tree));
@@ -111,7 +111,7 @@ void test_index_read_index__read_and_writes(void)
git_tree *tree;
git_index *tree_index, *new_index;
- cl_git_pass(git_oid_fromstr(&tree_id, "ae90f12eea699729ed24555e40b9fd669da12a12"));
+ cl_git_pass(git_oid__fromstr(&tree_id, "ae90f12eea699729ed24555e40b9fd669da12a12", GIT_OID_SHA1));
cl_git_pass(git_tree_lookup(&tree, _repo, &tree_id));
cl_git_pass(git_index_new(&tree_index));
cl_git_pass(git_index_read_tree(tree_index, tree));
@@ -148,17 +148,17 @@ static void add_conflicts(git_index *index, const char *filename)
ancestor_entry.path = filename;
ancestor_entry.mode = 0100644;
GIT_INDEX_ENTRY_STAGE_SET(&ancestor_entry, 1);
- git_oid_fromstr(&ancestor_entry.id, ancestor_ids[conflict_idx]);
+ git_oid__fromstr(&ancestor_entry.id, ancestor_ids[conflict_idx], GIT_OID_SHA1);
our_entry.path = filename;
our_entry.mode = 0100644;
GIT_INDEX_ENTRY_STAGE_SET(&our_entry, 2);
- git_oid_fromstr(&our_entry.id, our_ids[conflict_idx]);
+ git_oid__fromstr(&our_entry.id, our_ids[conflict_idx], GIT_OID_SHA1);
their_entry.path = filename;
their_entry.mode = 0100644;
GIT_INDEX_ENTRY_STAGE_SET(&ancestor_entry, 2);
- git_oid_fromstr(&their_entry.id, their_ids[conflict_idx]);
+ git_oid__fromstr(&their_entry.id, their_ids[conflict_idx], GIT_OID_SHA1);
cl_git_pass(git_index_conflict_add(index, &ancestor_entry,
&our_entry, &their_entry));
@@ -172,7 +172,7 @@ void test_index_read_index__handles_conflicts(void)
git_index_conflict_iterator *conflict_iterator;
const git_index_entry *ancestor, *ours, *theirs;
- cl_git_pass(git_oid_fromstr(&tree_id, "ae90f12eea699729ed24555e40b9fd669da12a12"));
+ cl_git_pass(git_oid__fromstr(&tree_id, "ae90f12eea699729ed24555e40b9fd669da12a12", GIT_OID_SHA1));
cl_git_pass(git_tree_lookup(&tree, _repo, &tree_id));
cl_git_pass(git_index_new(&index));
cl_git_pass(git_index_new(&new_index));
diff --git a/tests/libgit2/index/rename.c b/tests/libgit2/index/rename.c
index 86eaf0053..9b132cb61 100644
--- a/tests/libgit2/index/rename.c
+++ b/tests/libgit2/index/rename.c
@@ -22,7 +22,7 @@ void test_index_rename__single_file(void)
cl_git_pass(git_index_add_bypath(index, "lame.name.txt"));
cl_assert(git_index_entrycount(index) == 1);
- cl_git_pass(git_oid_fromstr(&expected, "d4fa8600b4f37d7516bef4816ae2c64dbf029e3a"));
+ cl_git_pass(git_oid__fromstr(&expected, "d4fa8600b4f37d7516bef4816ae2c64dbf029e3a", GIT_OID_SHA1));
cl_assert(!git_index_find(&position, index, "lame.name.txt"));
diff --git a/tests/libgit2/index/reuc.c b/tests/libgit2/index/reuc.c
index 1f95c4136..7d8766c57 100644
--- a/tests/libgit2/index/reuc.c
+++ b/tests/libgit2/index/reuc.c
@@ -38,9 +38,9 @@ void test_index_reuc__add(void)
git_oid ancestor_oid, our_oid, their_oid;
const git_index_reuc_entry *reuc;
- git_oid_fromstr(&ancestor_oid, ONE_ANCESTOR_OID);
- git_oid_fromstr(&our_oid, ONE_OUR_OID);
- git_oid_fromstr(&their_oid, ONE_THEIR_OID);
+ git_oid__fromstr(&ancestor_oid, ONE_ANCESTOR_OID, GIT_OID_SHA1);
+ git_oid__fromstr(&our_oid, ONE_OUR_OID, GIT_OID_SHA1);
+ git_oid__fromstr(&their_oid, ONE_THEIR_OID, GIT_OID_SHA1);
cl_git_pass(git_index_reuc_add(repo_index, "newfile.txt",
0100644, &ancestor_oid,
@@ -66,8 +66,8 @@ void test_index_reuc__add_no_ancestor(void)
const git_index_reuc_entry *reuc;
memset(&ancestor_oid, 0x0, sizeof(git_oid));
- git_oid_fromstr(&our_oid, ONE_OUR_OID);
- git_oid_fromstr(&their_oid, ONE_THEIR_OID);
+ git_oid__fromstr(&our_oid, ONE_OUR_OID, GIT_OID_SHA1);
+ git_oid__fromstr(&their_oid, ONE_THEIR_OID, GIT_OID_SHA1);
cl_git_pass(git_index_reuc_add(repo_index, "newfile.txt",
0, NULL,
@@ -100,11 +100,11 @@ void test_index_reuc__read_bypath(void)
cl_assert(reuc->mode[0] == 0100644);
cl_assert(reuc->mode[1] == 0100644);
cl_assert(reuc->mode[2] == 0100644);
- git_oid_fromstr(&oid, TWO_ANCESTOR_OID);
+ git_oid__fromstr(&oid, TWO_ANCESTOR_OID, GIT_OID_SHA1);
cl_assert_equal_oid(&reuc->oid[0], &oid);
- git_oid_fromstr(&oid, TWO_OUR_OID);
+ git_oid__fromstr(&oid, TWO_OUR_OID, GIT_OID_SHA1);
cl_assert_equal_oid(&reuc->oid[1], &oid);
- git_oid_fromstr(&oid, TWO_THEIR_OID);
+ git_oid__fromstr(&oid, TWO_THEIR_OID, GIT_OID_SHA1);
cl_assert_equal_oid(&reuc->oid[2], &oid);
cl_assert(reuc = git_index_reuc_get_bypath(repo_index, "one.txt"));
@@ -113,11 +113,11 @@ void test_index_reuc__read_bypath(void)
cl_assert(reuc->mode[0] == 0100644);
cl_assert(reuc->mode[1] == 0100644);
cl_assert(reuc->mode[2] == 0100644);
- git_oid_fromstr(&oid, ONE_ANCESTOR_OID);
+ git_oid__fromstr(&oid, ONE_ANCESTOR_OID, GIT_OID_SHA1);
cl_assert_equal_oid(&reuc->oid[0], &oid);
- git_oid_fromstr(&oid, ONE_OUR_OID);
+ git_oid__fromstr(&oid, ONE_OUR_OID, GIT_OID_SHA1);
cl_assert_equal_oid(&reuc->oid[1], &oid);
- git_oid_fromstr(&oid, ONE_THEIR_OID);
+ git_oid__fromstr(&oid, ONE_THEIR_OID, GIT_OID_SHA1);
cl_assert_equal_oid(&reuc->oid[2], &oid);
}
@@ -145,11 +145,11 @@ void test_index_reuc__ignore_case(void)
cl_assert(reuc->mode[0] == 0100644);
cl_assert(reuc->mode[1] == 0100644);
cl_assert(reuc->mode[2] == 0100644);
- git_oid_fromstr(&oid, TWO_ANCESTOR_OID);
+ git_oid__fromstr(&oid, TWO_ANCESTOR_OID, GIT_OID_SHA1);
cl_assert_equal_oid(&reuc->oid[0], &oid);
- git_oid_fromstr(&oid, TWO_OUR_OID);
+ git_oid__fromstr(&oid, TWO_OUR_OID, GIT_OID_SHA1);
cl_assert_equal_oid(&reuc->oid[1], &oid);
- git_oid_fromstr(&oid, TWO_THEIR_OID);
+ git_oid__fromstr(&oid, TWO_THEIR_OID, GIT_OID_SHA1);
cl_assert_equal_oid(&reuc->oid[2], &oid);
}
@@ -166,11 +166,11 @@ void test_index_reuc__read_byindex(void)
cl_assert(reuc->mode[0] == 0100644);
cl_assert(reuc->mode[1] == 0100644);
cl_assert(reuc->mode[2] == 0100644);
- git_oid_fromstr(&oid, ONE_ANCESTOR_OID);
+ git_oid__fromstr(&oid, ONE_ANCESTOR_OID, GIT_OID_SHA1);
cl_assert_equal_oid(&reuc->oid[0], &oid);
- git_oid_fromstr(&oid, ONE_OUR_OID);
+ git_oid__fromstr(&oid, ONE_OUR_OID, GIT_OID_SHA1);
cl_assert_equal_oid(&reuc->oid[1], &oid);
- git_oid_fromstr(&oid, ONE_THEIR_OID);
+ git_oid__fromstr(&oid, ONE_THEIR_OID, GIT_OID_SHA1);
cl_assert_equal_oid(&reuc->oid[2], &oid);
cl_assert(reuc = git_index_reuc_get_byindex(repo_index, 1));
@@ -179,11 +179,11 @@ void test_index_reuc__read_byindex(void)
cl_assert(reuc->mode[0] == 0100644);
cl_assert(reuc->mode[1] == 0100644);
cl_assert(reuc->mode[2] == 0100644);
- git_oid_fromstr(&oid, TWO_ANCESTOR_OID);
+ git_oid__fromstr(&oid, TWO_ANCESTOR_OID, GIT_OID_SHA1);
cl_assert_equal_oid(&reuc->oid[0], &oid);
- git_oid_fromstr(&oid, TWO_OUR_OID);
+ git_oid__fromstr(&oid, TWO_OUR_OID, GIT_OID_SHA1);
cl_assert_equal_oid(&reuc->oid[1], &oid);
- git_oid_fromstr(&oid, TWO_THEIR_OID);
+ git_oid__fromstr(&oid, TWO_THEIR_OID, GIT_OID_SHA1);
cl_assert_equal_oid(&reuc->oid[2], &oid);
}
@@ -200,9 +200,9 @@ void test_index_reuc__updates_existing(void)
index_caps |= GIT_INDEX_CAPABILITY_IGNORE_CASE;
cl_git_pass(git_index_set_caps(repo_index, index_caps));
- git_oid_fromstr(&ancestor_oid, TWO_ANCESTOR_OID);
- git_oid_fromstr(&our_oid, TWO_OUR_OID);
- git_oid_fromstr(&their_oid, TWO_THEIR_OID);
+ git_oid__fromstr(&ancestor_oid, TWO_ANCESTOR_OID, GIT_OID_SHA1);
+ git_oid__fromstr(&our_oid, TWO_OUR_OID, GIT_OID_SHA1);
+ git_oid__fromstr(&their_oid, TWO_THEIR_OID, GIT_OID_SHA1);
cl_git_pass(git_index_reuc_add(repo_index, "two.txt",
0100644, &ancestor_oid,
@@ -219,11 +219,11 @@ void test_index_reuc__updates_existing(void)
cl_assert(reuc = git_index_reuc_get_byindex(repo_index, 0));
cl_assert_equal_s("TWO.txt", reuc->path);
- git_oid_fromstr(&oid, TWO_OUR_OID);
+ git_oid__fromstr(&oid, TWO_OUR_OID, GIT_OID_SHA1);
cl_assert_equal_oid(&reuc->oid[0], &oid);
- git_oid_fromstr(&oid, TWO_THEIR_OID);
+ git_oid__fromstr(&oid, TWO_THEIR_OID, GIT_OID_SHA1);
cl_assert_equal_oid(&reuc->oid[1], &oid);
- git_oid_fromstr(&oid, TWO_ANCESTOR_OID);
+ git_oid__fromstr(&oid, TWO_ANCESTOR_OID, GIT_OID_SHA1);
cl_assert_equal_oid(&reuc->oid[2], &oid);
}
@@ -245,11 +245,11 @@ void test_index_reuc__remove(void)
cl_assert(reuc->mode[0] == 0100644);
cl_assert(reuc->mode[1] == 0100644);
cl_assert(reuc->mode[2] == 0100644);
- git_oid_fromstr(&oid, TWO_ANCESTOR_OID);
+ git_oid__fromstr(&oid, TWO_ANCESTOR_OID, GIT_OID_SHA1);
cl_assert_equal_oid(&reuc->oid[0], &oid);
- git_oid_fromstr(&oid, TWO_OUR_OID);
+ git_oid__fromstr(&oid, TWO_OUR_OID, GIT_OID_SHA1);
cl_assert_equal_oid(&reuc->oid[1], &oid);
- git_oid_fromstr(&oid, TWO_THEIR_OID);
+ git_oid__fromstr(&oid, TWO_THEIR_OID, GIT_OID_SHA1);
cl_assert_equal_oid(&reuc->oid[2], &oid);
}
@@ -261,18 +261,18 @@ void test_index_reuc__write(void)
git_index_clear(repo_index);
/* Write out of order to ensure sorting is correct */
- git_oid_fromstr(&ancestor_oid, TWO_ANCESTOR_OID);
- git_oid_fromstr(&our_oid, TWO_OUR_OID);
- git_oid_fromstr(&their_oid, TWO_THEIR_OID);
+ git_oid__fromstr(&ancestor_oid, TWO_ANCESTOR_OID, GIT_OID_SHA1);
+ git_oid__fromstr(&our_oid, TWO_OUR_OID, GIT_OID_SHA1);
+ git_oid__fromstr(&their_oid, TWO_THEIR_OID, GIT_OID_SHA1);
cl_git_pass(git_index_reuc_add(repo_index, "two.txt",
0100644, &ancestor_oid,
0100644, &our_oid,
0100644, &their_oid));
- git_oid_fromstr(&ancestor_oid, ONE_ANCESTOR_OID);
- git_oid_fromstr(&our_oid, ONE_OUR_OID);
- git_oid_fromstr(&their_oid, ONE_THEIR_OID);
+ git_oid__fromstr(&ancestor_oid, ONE_ANCESTOR_OID, GIT_OID_SHA1);
+ git_oid__fromstr(&our_oid, ONE_OUR_OID, GIT_OID_SHA1);
+ git_oid__fromstr(&their_oid, ONE_THEIR_OID, GIT_OID_SHA1);
cl_git_pass(git_index_reuc_add(repo_index, "one.txt",
0100644, &ancestor_oid,
diff --git a/tests/libgit2/index/tests.c b/tests/libgit2/index/tests.c
index 205d12e5b..da3ff6dd7 100644
--- a/tests/libgit2/index/tests.c
+++ b/tests/libgit2/index/tests.c
@@ -259,7 +259,7 @@ void test_index_tests__add(void)
* This has been generated by executing the following
* $ echo "hey there" | git hash-object --stdin
*/
- cl_git_pass(git_oid_fromstr(&id1, "a8233120f6ad708f843d861ce2b7228ec4e3dec6"));
+ cl_git_pass(git_oid__fromstr(&id1, "a8233120f6ad708f843d861ce2b7228ec4e3dec6", GIT_OID_SHA1));
/* Add the new file to the index */
cl_git_pass(git_index_add_bypath(index, "test.txt"));
@@ -304,7 +304,7 @@ void test_index_tests__add_frombuffer(void)
* This has been generated by executing the following
* $ echo "hey there" | git hash-object --stdin
*/
- cl_git_pass(git_oid_fromstr(&id1, "a8233120f6ad708f843d861ce2b7228ec4e3dec6"));
+ cl_git_pass(git_oid__fromstr(&id1, "a8233120f6ad708f843d861ce2b7228ec4e3dec6", GIT_OID_SHA1));
/* Add the new file to the index */
memset(&entry, 0x0, sizeof(git_index_entry));
@@ -447,7 +447,7 @@ void test_index_tests__add_frombuffer_reset_entry(void)
* This has been generated by executing the following
* $ echo "hey there" | git hash-object --stdin
*/
- cl_git_pass(git_oid_fromstr(&id1, "a8233120f6ad708f843d861ce2b7228ec4e3dec6"));
+ cl_git_pass(git_oid__fromstr(&id1, "a8233120f6ad708f843d861ce2b7228ec4e3dec6", GIT_OID_SHA1));
cl_git_pass(git_index_add_bypath(index, "test.txt"));
@@ -511,7 +511,7 @@ void test_index_tests__add_issue_1397(void)
* This has been generated by executing the following
* $ git hash-object crlf_file.txt
*/
- cl_git_pass(git_oid_fromstr(&id1, "8312e0889a9cbab77c732b6bc39b51a683e3a318"));
+ cl_git_pass(git_oid__fromstr(&id1, "8312e0889a9cbab77c732b6bc39b51a683e3a318", GIT_OID_SHA1));
/* Make sure the initial SHA-1 is correct */
cl_assert((entry = git_index_get_bypath(index, "crlf_file.txt", 0)) != NULL);
@@ -600,7 +600,7 @@ static void assert_add_fails(git_repository *repo, const char *fn)
entry.path = fn;
entry.mode = GIT_FILEMODE_BLOB;
- cl_git_pass(git_oid_fromstr(&entry.id, "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391"));
+ cl_git_pass(git_oid__fromstr(&entry.id, "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391", GIT_OID_SHA1));
cl_git_fail(git_index_add(index, &entry));
@@ -705,7 +705,7 @@ void test_index_tests__write_tree_invalid_unowned_index(void)
cl_git_pass(git_index_new(&idx));
- cl_git_pass(git_oid_fromstr(&entry.id, "8312e0a89a9cbab77c732b6bc39b51a783e3a318"));
+ cl_git_pass(git_oid__fromstr(&entry.id, "8312e0a89a9cbab77c732b6bc39b51a783e3a318", GIT_OID_SHA1));
entry.path = "foo";
entry.mode = GIT_FILEMODE_BLOB;
cl_git_pass(git_index_add(idx, &entry));
@@ -1147,12 +1147,12 @@ void test_index_tests__can_modify_while_iterating(void)
* ensure that our iterator is backed by a snapshot and thus returns
* the number of entries from when the iterator was created.
*/
- cl_git_pass(git_oid_fromstr(&new_entry.id, "8312e0a89a9cbab77c732b6bc39b51a783e3a318"));
+ cl_git_pass(git_oid__fromstr(&new_entry.id, "8312e0a89a9cbab77c732b6bc39b51a783e3a318", GIT_OID_SHA1));
new_entry.path = "newfile";
new_entry.mode = GIT_FILEMODE_BLOB;
cl_git_pass(git_index_add(index, &new_entry));
- cl_git_pass(git_oid_fromstr(&new_entry.id, "4141414141414141414141414141414141414141"));
+ cl_git_pass(git_oid__fromstr(&new_entry.id, "4141414141414141414141414141414141414141", GIT_OID_SHA1));
new_entry.path = "Makefile";
new_entry.mode = GIT_FILEMODE_BLOB;
cl_git_pass(git_index_add(index, &new_entry));
diff --git a/tests/libgit2/iterator/index.c b/tests/libgit2/iterator/index.c
index 7218b4f75..a0083479d 100644
--- a/tests/libgit2/iterator/index.c
+++ b/tests/libgit2/iterator/index.c
@@ -52,7 +52,7 @@ static void index_iterator_test(
if (expected_oids != NULL) {
git_oid oid;
- cl_git_pass(git_oid_fromstr(&oid, expected_oids[count]));
+ cl_git_pass(git_oid__fromstr(&oid, expected_oids[count], GIT_OID_SHA1));
cl_assert_equal_oid(&oid, &entry->id);
}
@@ -999,7 +999,7 @@ static void create_paths(git_index *index, const char *root, int depth)
memset(&entry, 0, sizeof(git_index_entry));
entry.path = fullpath.ptr;
entry.mode = GIT_FILEMODE_BLOB;
- git_oid_fromstr(&entry.id, "d44e18fb93b7107b5cd1b95d601591d77869a1b6");
+ git_oid__fromstr(&entry.id, "d44e18fb93b7107b5cd1b95d601591d77869a1b6", GIT_OID_SHA1);
cl_git_pass(git_index_add(index, &entry));
} else if (depth > 0) {
@@ -1296,17 +1296,17 @@ static void add_conflict(
ancestor.path = ancestor_path;
ancestor.mode = GIT_FILEMODE_BLOB;
- git_oid_fromstr(&ancestor.id, "d44e18fb93b7107b5cd1b95d601591d77869a1b6");
+ git_oid__fromstr(&ancestor.id, "d44e18fb93b7107b5cd1b95d601591d77869a1b6", GIT_OID_SHA1);
GIT_INDEX_ENTRY_STAGE_SET(&ancestor, 1);
ours.path = our_path;
ours.mode = GIT_FILEMODE_BLOB;
- git_oid_fromstr(&ours.id, "d44e18fb93b7107b5cd1b95d601591d77869a1b6");
+ git_oid__fromstr(&ours.id, "d44e18fb93b7107b5cd1b95d601591d77869a1b6", GIT_OID_SHA1);
GIT_INDEX_ENTRY_STAGE_SET(&ours, 2);
theirs.path = their_path;
theirs.mode = GIT_FILEMODE_BLOB;
- git_oid_fromstr(&theirs.id, "d44e18fb93b7107b5cd1b95d601591d77869a1b6");
+ git_oid__fromstr(&theirs.id, "d44e18fb93b7107b5cd1b95d601591d77869a1b6", GIT_OID_SHA1);
GIT_INDEX_ENTRY_STAGE_SET(&theirs, 3);
cl_git_pass(git_index_conflict_add(index, &ancestor, &ours, &theirs));
diff --git a/tests/libgit2/iterator/tree.c b/tests/libgit2/iterator/tree.c
index 06a920a18..7dfee28be 100644
--- a/tests/libgit2/iterator/tree.c
+++ b/tests/libgit2/iterator/tree.c
@@ -675,7 +675,7 @@ void test_iterator_tree__case_conflicts_0(void)
g_repo = cl_git_sandbox_init("icase");
- cl_git_pass(git_oid_fromstr(&blob_id, blob_sha)); /* lookup blob */
+ cl_git_pass(git_oid__fromstr(&blob_id, blob_sha, GIT_OID_SHA1)); /* lookup blob */
/* create tree with: A/1.file, A/3.file, a/2.file, a/4.file */
build_test_tree(
@@ -729,7 +729,7 @@ void test_iterator_tree__case_conflicts_1(void)
g_repo = cl_git_sandbox_init("icase");
- cl_git_pass(git_oid_fromstr(&blob_id, blob_sha)); /* lookup blob */
+ cl_git_pass(git_oid__fromstr(&blob_id, blob_sha, GIT_OID_SHA1)); /* lookup blob */
/* create: A/a A/b/1 A/c a/a a/b a/C */
build_test_tree(&Ab_id, g_repo, "b|1|", &blob_id);
@@ -798,7 +798,7 @@ void test_iterator_tree__case_conflicts_2(void)
g_repo = cl_git_sandbox_init("icase");
- cl_git_pass(git_oid_fromstr(&blob_id, blob_sha)); /* lookup blob */
+ cl_git_pass(git_oid__fromstr(&blob_id, blob_sha, GIT_OID_SHA1)); /* lookup blob */
build_test_tree(&d1, g_repo, "b|16|,b|foo|", &blob_id, &blob_id);
build_test_tree(&d2, g_repo, "b|15|,b|FOO|", &blob_id, &blob_id);
diff --git a/tests/libgit2/iterator/workdir.c b/tests/libgit2/iterator/workdir.c
index 86b847cab..7634997e1 100644
--- a/tests/libgit2/iterator/workdir.c
+++ b/tests/libgit2/iterator/workdir.c
@@ -1481,7 +1481,7 @@ void test_iterator_workdir__hash_when_requested(void)
git_iterator *iter;
const git_index_entry *entry;
git_iterator_options iter_opts = GIT_ITERATOR_OPTIONS_INIT;
- git_oid expected_id = {{0}};
+ git_oid expected_id = GIT_OID_SHA1_ZERO;
size_t i;
struct merge_index_entry expected[] = {
@@ -1514,7 +1514,7 @@ void test_iterator_workdir__hash_when_requested(void)
for (i = 0; i < sizeof(expected) / sizeof(struct merge_index_entry); i++) {
cl_git_pass(git_iterator_advance(&entry, iter));
- cl_git_pass(git_oid_fromstr(&expected_id, expected[i].oid_str));
+ cl_git_pass(git_oid__fromstr(&expected_id, expected[i].oid_str, GIT_OID_SHA1));
cl_assert_equal_oid(&expected_id, &entry->id);
cl_assert_equal_s(expected[i].path, entry->path);
}
diff --git a/tests/libgit2/merge/driver.c b/tests/libgit2/merge/driver.c
index b7d320cbb..fd73c3770 100644
--- a/tests/libgit2/merge/driver.c
+++ b/tests/libgit2/merge/driver.c
@@ -22,7 +22,7 @@ void test_merge_driver__initialize(void)
repo = cl_git_sandbox_init(TEST_REPO_PATH);
git_repository_index(&repo_index, repo);
- git_oid_fromstr(&automergeable_id, AUTOMERGEABLE_IDSTR);
+ git_oid__fromstr(&automergeable_id, AUTOMERGEABLE_IDSTR, GIT_OID_SHA1);
/* Ensure that the user's merge.conflictstyle doesn't interfere */
cl_git_pass(git_repository_config(&cfg, repo));
@@ -145,7 +145,7 @@ static void merge_branch(void)
git_oid their_id;
git_annotated_commit *their_head;
- cl_git_pass(git_oid_fromstr(&their_id, BRANCH_ID));
+ cl_git_pass(git_oid__fromstr(&their_id, BRANCH_ID, GIT_OID_SHA1));
cl_git_pass(git_annotated_commit_lookup(&their_head, repo, &their_id));
cl_git_pass(git_merge(repo, (const git_annotated_commit **)&their_head,
@@ -299,7 +299,7 @@ void test_merge_driver__default_can_be_specified(void)
merge_opts.default_driver = "custom";
- cl_git_pass(git_oid_fromstr(&their_id, BRANCH_ID));
+ cl_git_pass(git_oid__fromstr(&their_id, BRANCH_ID, GIT_OID_SHA1));
cl_git_pass(git_annotated_commit_lookup(&their_head, repo, &their_id));
cl_git_pass(git_merge(repo, (const git_annotated_commit **)&their_head,
diff --git a/tests/libgit2/merge/files.c b/tests/libgit2/merge/files.c
index 6296f3b7b..6c1c2e13f 100644
--- a/tests/libgit2/merge/files.c
+++ b/tests/libgit2/merge/files.c
@@ -149,15 +149,15 @@ void test_merge_files__automerge_from_index(void)
git_merge_file_result result = {0};
git_index_entry ancestor, ours, theirs;
- git_oid_fromstr(&ancestor.id, "6212c31dab5e482247d7977e4f0dd3601decf13b");
+ git_oid__fromstr(&ancestor.id, "6212c31dab5e482247d7977e4f0dd3601decf13b", GIT_OID_SHA1);
ancestor.path = "automergeable.txt";
ancestor.mode = 0100644;
- git_oid_fromstr(&ours.id, "ee3fa1b8c00aff7fe02065fdb50864bb0d932ccf");
+ git_oid__fromstr(&ours.id, "ee3fa1b8c00aff7fe02065fdb50864bb0d932ccf", GIT_OID_SHA1);
ours.path = "automergeable.txt";
ours.mode = 0100755;
- git_oid_fromstr(&theirs.id, "058541fc37114bfc1dddf6bd6bffc7fae5c2e6fe");
+ git_oid__fromstr(&theirs.id, "058541fc37114bfc1dddf6bd6bffc7fae5c2e6fe", GIT_OID_SHA1);
theirs.path = "newname.txt";
theirs.mode = 0100644;
diff --git a/tests/libgit2/merge/merge_helpers.c b/tests/libgit2/merge/merge_helpers.c
index ce3cd229b..1406987e5 100644
--- a/tests/libgit2/merge/merge_helpers.c
+++ b/tests/libgit2/merge/merge_helpers.c
@@ -165,7 +165,7 @@ static int index_entry_eq_merge_index_entry(const struct merge_index_entry *expe
bool test_oid;
if (strlen(expected->oid_str) != 0) {
- cl_git_pass(git_oid_fromstr(&expected_oid, expected->oid_str));
+ cl_git_pass(git_oid__fromstr(&expected_oid, expected->oid_str, GIT_OID_SHA1));
test_oid = 1;
} else
test_oid = 0;
@@ -304,21 +304,21 @@ int merge_test_reuc(git_index *index, const struct merge_reuc_entry expected[],
return 0;
if (expected[i].ancestor_mode > 0) {
- cl_git_pass(git_oid_fromstr(&expected_oid, expected[i].ancestor_oid_str));
+ cl_git_pass(git_oid__fromstr(&expected_oid, expected[i].ancestor_oid_str, GIT_OID_SHA1));
if (git_oid_cmp(&reuc_entry->oid[0], &expected_oid) != 0)
return 0;
}
if (expected[i].our_mode > 0) {
- cl_git_pass(git_oid_fromstr(&expected_oid, expected[i].our_oid_str));
+ cl_git_pass(git_oid__fromstr(&expected_oid, expected[i].our_oid_str, GIT_OID_SHA1));
if (git_oid_cmp(&reuc_entry->oid[1], &expected_oid) != 0)
return 0;
}
if (expected[i].their_mode > 0) {
- cl_git_pass(git_oid_fromstr(&expected_oid, expected[i].their_oid_str));
+ cl_git_pass(git_oid__fromstr(&expected_oid, expected[i].their_oid_str, GIT_OID_SHA1));
if (git_oid_cmp(&reuc_entry->oid[2], &expected_oid) != 0)
return 0;
@@ -353,7 +353,7 @@ int merge_test_workdir(git_repository *repo, const struct merge_index_entry expe
for (i = 0; i < expected_len; i++) {
git_blob_create_from_workdir(&actual_oid, repo, expected[i].path);
- git_oid_fromstr(&expected_oid, expected[i].oid_str);
+ git_oid__fromstr(&expected_oid, expected[i].oid_str, GIT_OID_SHA1);
if (git_oid_cmp(&actual_oid, &expected_oid) != 0)
return 0;
diff --git a/tests/libgit2/merge/merge_helpers.h b/tests/libgit2/merge/merge_helpers.h
index 339812ba5..72c6e61f7 100644
--- a/tests/libgit2/merge/merge_helpers.h
+++ b/tests/libgit2/merge/merge_helpers.h
@@ -6,7 +6,7 @@
struct merge_index_entry {
uint16_t mode;
- char oid_str[GIT_OID_HEXSZ+1];
+ char oid_str[GIT_OID_SHA1_HEXSIZE+1];
int stage;
char path[128];
};
@@ -27,9 +27,9 @@ struct merge_reuc_entry {
unsigned int ancestor_mode;
unsigned int our_mode;
unsigned int their_mode;
- char ancestor_oid_str[GIT_OID_HEXSZ+1];
- char our_oid_str[GIT_OID_HEXSZ+1];
- char their_oid_str[GIT_OID_HEXSZ+1];
+ char ancestor_oid_str[GIT_OID_SHA1_HEXSIZE+1];
+ char our_oid_str[GIT_OID_SHA1_HEXSIZE+1];
+ char their_oid_str[GIT_OID_SHA1_HEXSIZE+1];
};
struct merge_index_conflict_data {
diff --git a/tests/libgit2/merge/trees/renames.c b/tests/libgit2/merge/trees/renames.c
index 26f6d3306..a27945ee0 100644
--- a/tests/libgit2/merge/trees/renames.c
+++ b/tests/libgit2/merge/trees/renames.c
@@ -286,7 +286,7 @@ void test_merge_trees_renames__cache_recomputation(void)
void *data;
size_t i;
- cl_git_pass(git_oid_fromstr(&blob, "a2d8d1824c68541cca94ffb90f79291eba495921"));
+ cl_git_pass(git_oid__fromstr(&blob, "a2d8d1824c68541cca94ffb90f79291eba495921", GIT_OID_SHA1));
/*
* Create a 50MB blob that consists of NUL bytes only. It is important
diff --git a/tests/libgit2/merge/trees/treediff.c b/tests/libgit2/merge/trees/treediff.c
index cd2cf7827..094018d3c 100644
--- a/tests/libgit2/merge/trees/treediff.c
+++ b/tests/libgit2/merge/trees/treediff.c
@@ -61,9 +61,9 @@ static void test_find_differences(
opts.metric->similarity = git_diff_find_similar__calc_similarity;
opts.metric->payload = (void *)GIT_HASHSIG_SMART_WHITESPACE;
- cl_git_pass(git_oid_fromstr(&ancestor_oid, ancestor_oidstr));
- cl_git_pass(git_oid_fromstr(&ours_oid, ours_oidstr));
- cl_git_pass(git_oid_fromstr(&theirs_oid, theirs_oidstr));
+ cl_git_pass(git_oid__fromstr(&ancestor_oid, ancestor_oidstr, GIT_OID_SHA1));
+ cl_git_pass(git_oid__fromstr(&ours_oid, ours_oidstr, GIT_OID_SHA1));
+ cl_git_pass(git_oid__fromstr(&theirs_oid, theirs_oidstr, GIT_OID_SHA1));
cl_git_pass(git_tree_lookup(&ancestor_tree, repo, &ancestor_oid));
cl_git_pass(git_tree_lookup(&ours_tree, repo, &ours_oid));
diff --git a/tests/libgit2/merge/trees/trivial.c b/tests/libgit2/merge/trees/trivial.c
index dce392c86..287a53cfe 100644
--- a/tests/libgit2/merge/trees/trivial.c
+++ b/tests/libgit2/merge/trees/trivial.c
@@ -258,7 +258,7 @@ void test_merge_trees_trivial__13(void)
cl_git_pass(merge_trivial(&result, "trivial-13", "trivial-13-branch"));
cl_assert(entry = git_index_get_bypath(result, "modified-in-13.txt", 0));
- cl_git_pass(git_oid_fromstr(&expected_oid, "1cff9ec6a47a537380dedfdd17c9e76d74259a2b"));
+ cl_git_pass(git_oid__fromstr(&expected_oid, "1cff9ec6a47a537380dedfdd17c9e76d74259a2b", GIT_OID_SHA1));
cl_assert_equal_oid(&expected_oid, &entry->id);
cl_assert(git_index_reuc_entrycount(result) == 0);
@@ -277,7 +277,7 @@ void test_merge_trees_trivial__14(void)
cl_git_pass(merge_trivial(&result, "trivial-14", "trivial-14-branch"));
cl_assert(entry = git_index_get_bypath(result, "modified-in-14-branch.txt", 0));
- cl_git_pass(git_oid_fromstr(&expected_oid, "26153a3ff3649b6c2bb652d3f06878c6e0a172f9"));
+ cl_git_pass(git_oid__fromstr(&expected_oid, "26153a3ff3649b6c2bb652d3f06878c6e0a172f9", GIT_OID_SHA1));
cl_assert(git_oid_cmp(&entry->id, &expected_oid) == 0);
cl_assert(git_index_reuc_entrycount(result) == 0);
diff --git a/tests/libgit2/merge/workdir/dirty.c b/tests/libgit2/merge/workdir/dirty.c
index b9c2ad033..36b42a103 100644
--- a/tests/libgit2/merge/workdir/dirty.c
+++ b/tests/libgit2/merge/workdir/dirty.c
@@ -94,7 +94,7 @@ static int merge_branch(void)
git_checkout_options checkout_opts = GIT_CHECKOUT_OPTIONS_INIT;
int error;
- cl_git_pass(git_oid_fromstr(&their_oids[0], MERGE_BRANCH_OID));
+ cl_git_pass(git_oid__fromstr(&their_oids[0], MERGE_BRANCH_OID, GIT_OID_SHA1));
cl_git_pass(git_annotated_commit_lookup(&their_head, repo, &their_oids[0]));
checkout_opts.checkout_strategy = GIT_CHECKOUT_SAFE;
diff --git a/tests/libgit2/merge/workdir/setup.c b/tests/libgit2/merge/workdir/setup.c
index 3db2d074f..98ccdf700 100644
--- a/tests/libgit2/merge/workdir/setup.c
+++ b/tests/libgit2/merge/workdir/setup.c
@@ -78,7 +78,7 @@ void test_merge_workdir_setup__one_branch(void)
git_reference *octo1_ref;
git_annotated_commit *our_head, *their_heads[1];
- cl_git_pass(git_oid_fromstr(&our_oid, ORIG_HEAD));
+ cl_git_pass(git_oid__fromstr(&our_oid, ORIG_HEAD, GIT_OID_SHA1));
cl_git_pass(git_annotated_commit_lookup(&our_head, repo, &our_oid));
cl_git_pass(git_reference_lookup(&octo1_ref, repo, GIT_REFS_HEADS_DIR OCTO1_BRANCH));
@@ -104,10 +104,10 @@ void test_merge_workdir_setup__one_oid(void)
git_oid octo1_oid;
git_annotated_commit *our_head, *their_heads[1];
- cl_git_pass(git_oid_fromstr(&our_oid, ORIG_HEAD));
+ cl_git_pass(git_oid__fromstr(&our_oid, ORIG_HEAD, GIT_OID_SHA1));
cl_git_pass(git_annotated_commit_lookup(&our_head, repo, &our_oid));
- cl_git_pass(git_oid_fromstr(&octo1_oid, OCTO1_OID));
+ cl_git_pass(git_oid__fromstr(&octo1_oid, OCTO1_OID, GIT_OID_SHA1));
cl_git_pass(git_annotated_commit_lookup(&their_heads[0], repo, &octo1_oid));
cl_git_pass(git_merge__setup(repo, our_head, (const git_annotated_commit **)their_heads, 1));
@@ -129,7 +129,7 @@ void test_merge_workdir_setup__two_branches(void)
git_reference *octo2_ref;
git_annotated_commit *our_head, *their_heads[2];
- cl_git_pass(git_oid_fromstr(&our_oid, ORIG_HEAD));
+ cl_git_pass(git_oid__fromstr(&our_oid, ORIG_HEAD, GIT_OID_SHA1));
cl_git_pass(git_annotated_commit_lookup(&our_head, repo, &our_oid));
cl_git_pass(git_reference_lookup(&octo1_ref, repo, GIT_REFS_HEADS_DIR OCTO1_BRANCH));
@@ -162,7 +162,7 @@ void test_merge_workdir_setup__three_branches(void)
git_reference *octo3_ref;
git_annotated_commit *our_head, *their_heads[3];
- cl_git_pass(git_oid_fromstr(&our_oid, ORIG_HEAD));
+ cl_git_pass(git_oid__fromstr(&our_oid, ORIG_HEAD, GIT_OID_SHA1));
cl_git_pass(git_annotated_commit_lookup(&our_head, repo, &our_oid));
cl_git_pass(git_reference_lookup(&octo1_ref, repo, GIT_REFS_HEADS_DIR OCTO1_BRANCH));
@@ -200,16 +200,16 @@ void test_merge_workdir_setup__three_oids(void)
git_oid octo3_oid;
git_annotated_commit *our_head, *their_heads[3];
- cl_git_pass(git_oid_fromstr(&our_oid, ORIG_HEAD));
+ cl_git_pass(git_oid__fromstr(&our_oid, ORIG_HEAD, GIT_OID_SHA1));
cl_git_pass(git_annotated_commit_lookup(&our_head, repo, &our_oid));
- cl_git_pass(git_oid_fromstr(&octo1_oid, OCTO1_OID));
+ cl_git_pass(git_oid__fromstr(&octo1_oid, OCTO1_OID, GIT_OID_SHA1));
cl_git_pass(git_annotated_commit_lookup(&their_heads[0], repo, &octo1_oid));
- cl_git_pass(git_oid_fromstr(&octo2_oid, OCTO2_OID));
+ cl_git_pass(git_oid__fromstr(&octo2_oid, OCTO2_OID, GIT_OID_SHA1));
cl_git_pass(git_annotated_commit_lookup(&their_heads[1], repo, &octo2_oid));
- cl_git_pass(git_oid_fromstr(&octo3_oid, OCTO3_OID));
+ cl_git_pass(git_oid__fromstr(&octo3_oid, OCTO3_OID, GIT_OID_SHA1));
cl_git_pass(git_annotated_commit_lookup(&their_heads[2], repo, &octo3_oid));
cl_git_pass(git_merge__setup(repo, our_head, (const git_annotated_commit **)their_heads, 3));
@@ -233,13 +233,13 @@ void test_merge_workdir_setup__branches_and_oids_1(void)
git_oid octo2_oid;
git_annotated_commit *our_head, *their_heads[2];
- cl_git_pass(git_oid_fromstr(&our_oid, ORIG_HEAD));
+ cl_git_pass(git_oid__fromstr(&our_oid, ORIG_HEAD, GIT_OID_SHA1));
cl_git_pass(git_annotated_commit_lookup(&our_head, repo, &our_oid));
cl_git_pass(git_reference_lookup(&octo1_ref, repo, GIT_REFS_HEADS_DIR OCTO1_BRANCH));
cl_git_pass(git_annotated_commit_from_ref(&their_heads[0], repo, octo1_ref));
- cl_git_pass(git_oid_fromstr(&octo2_oid, OCTO2_OID));
+ cl_git_pass(git_oid__fromstr(&octo2_oid, OCTO2_OID, GIT_OID_SHA1));
cl_git_pass(git_annotated_commit_lookup(&their_heads[1], repo, &octo2_oid));
cl_git_pass(git_merge__setup(repo, our_head, (const git_annotated_commit **)their_heads, 2));
@@ -266,19 +266,19 @@ void test_merge_workdir_setup__branches_and_oids_2(void)
git_oid octo4_oid;
git_annotated_commit *our_head, *their_heads[4];
- cl_git_pass(git_oid_fromstr(&our_oid, ORIG_HEAD));
+ cl_git_pass(git_oid__fromstr(&our_oid, ORIG_HEAD, GIT_OID_SHA1));
cl_git_pass(git_annotated_commit_lookup(&our_head, repo, &our_oid));
cl_git_pass(git_reference_lookup(&octo1_ref, repo, GIT_REFS_HEADS_DIR OCTO1_BRANCH));
cl_git_pass(git_annotated_commit_from_ref(&their_heads[0], repo, octo1_ref));
- cl_git_pass(git_oid_fromstr(&octo2_oid, OCTO2_OID));
+ cl_git_pass(git_oid__fromstr(&octo2_oid, OCTO2_OID, GIT_OID_SHA1));
cl_git_pass(git_annotated_commit_lookup(&their_heads[1], repo, &octo2_oid));
cl_git_pass(git_reference_lookup(&octo3_ref, repo, GIT_REFS_HEADS_DIR OCTO3_BRANCH));
cl_git_pass(git_annotated_commit_from_ref(&their_heads[2], repo, octo3_ref));
- cl_git_pass(git_oid_fromstr(&octo4_oid, OCTO4_OID));
+ cl_git_pass(git_oid__fromstr(&octo4_oid, OCTO4_OID, GIT_OID_SHA1));
cl_git_pass(git_annotated_commit_lookup(&their_heads[3], repo, &octo4_oid));
cl_git_pass(git_merge__setup(repo, our_head, (const git_annotated_commit **)their_heads, 4));
@@ -308,16 +308,16 @@ void test_merge_workdir_setup__branches_and_oids_3(void)
git_reference *octo4_ref;
git_annotated_commit *our_head, *their_heads[4];
- cl_git_pass(git_oid_fromstr(&our_oid, ORIG_HEAD));
+ cl_git_pass(git_oid__fromstr(&our_oid, ORIG_HEAD, GIT_OID_SHA1));
cl_git_pass(git_annotated_commit_lookup(&our_head, repo, &our_oid));
- cl_git_pass(git_oid_fromstr(&octo1_oid, OCTO1_OID));
+ cl_git_pass(git_oid__fromstr(&octo1_oid, OCTO1_OID, GIT_OID_SHA1));
cl_git_pass(git_annotated_commit_lookup(&their_heads[0], repo, &octo1_oid));
cl_git_pass(git_reference_lookup(&octo2_ref, repo, GIT_REFS_HEADS_DIR OCTO2_BRANCH));
cl_git_pass(git_annotated_commit_from_ref(&their_heads[1], repo, octo2_ref));
- cl_git_pass(git_oid_fromstr(&octo3_oid, OCTO3_OID));
+ cl_git_pass(git_oid__fromstr(&octo3_oid, OCTO3_OID, GIT_OID_SHA1));
cl_git_pass(git_annotated_commit_lookup(&their_heads[2], repo, &octo3_oid));
cl_git_pass(git_reference_lookup(&octo4_ref, repo, GIT_REFS_HEADS_DIR OCTO4_BRANCH));
@@ -351,16 +351,16 @@ void test_merge_workdir_setup__branches_and_oids_4(void)
git_reference *octo5_ref;
git_annotated_commit *our_head, *their_heads[5];
- cl_git_pass(git_oid_fromstr(&our_oid, ORIG_HEAD));
+ cl_git_pass(git_oid__fromstr(&our_oid, ORIG_HEAD, GIT_OID_SHA1));
cl_git_pass(git_annotated_commit_lookup(&our_head, repo, &our_oid));
- cl_git_pass(git_oid_fromstr(&octo1_oid, OCTO1_OID));
+ cl_git_pass(git_oid__fromstr(&octo1_oid, OCTO1_OID, GIT_OID_SHA1));
cl_git_pass(git_annotated_commit_lookup(&their_heads[0], repo, &octo1_oid));
cl_git_pass(git_reference_lookup(&octo2_ref, repo, GIT_REFS_HEADS_DIR OCTO2_BRANCH));
cl_git_pass(git_annotated_commit_from_ref(&their_heads[1], repo, octo2_ref));
- cl_git_pass(git_oid_fromstr(&octo3_oid, OCTO3_OID));
+ cl_git_pass(git_oid__fromstr(&octo3_oid, OCTO3_OID, GIT_OID_SHA1));
cl_git_pass(git_annotated_commit_lookup(&their_heads[2], repo, &octo3_oid));
cl_git_pass(git_reference_lookup(&octo4_ref, repo, GIT_REFS_HEADS_DIR OCTO4_BRANCH));
@@ -397,7 +397,7 @@ void test_merge_workdir_setup__three_same_branches(void)
git_reference *octo1_3_ref;
git_annotated_commit *our_head, *their_heads[3];
- cl_git_pass(git_oid_fromstr(&our_oid, ORIG_HEAD));
+ cl_git_pass(git_oid__fromstr(&our_oid, ORIG_HEAD, GIT_OID_SHA1));
cl_git_pass(git_annotated_commit_lookup(&our_head, repo, &our_oid));
cl_git_pass(git_reference_lookup(&octo1_1_ref, repo, GIT_REFS_HEADS_DIR OCTO1_BRANCH));
@@ -435,16 +435,16 @@ void test_merge_workdir_setup__three_same_oids(void)
git_oid octo1_3_oid;
git_annotated_commit *our_head, *their_heads[3];
- cl_git_pass(git_oid_fromstr(&our_oid, ORIG_HEAD));
+ cl_git_pass(git_oid__fromstr(&our_oid, ORIG_HEAD, GIT_OID_SHA1));
cl_git_pass(git_annotated_commit_lookup(&our_head, repo, &our_oid));
- cl_git_pass(git_oid_fromstr(&octo1_1_oid, OCTO1_OID));
+ cl_git_pass(git_oid__fromstr(&octo1_1_oid, OCTO1_OID, GIT_OID_SHA1));
cl_git_pass(git_annotated_commit_lookup(&their_heads[0], repo, &octo1_1_oid));
- cl_git_pass(git_oid_fromstr(&octo1_2_oid, OCTO1_OID));
+ cl_git_pass(git_oid__fromstr(&octo1_2_oid, OCTO1_OID, GIT_OID_SHA1));
cl_git_pass(git_annotated_commit_lookup(&their_heads[1], repo, &octo1_2_oid));
- cl_git_pass(git_oid_fromstr(&octo1_3_oid, OCTO1_OID));
+ cl_git_pass(git_oid__fromstr(&octo1_3_oid, OCTO1_OID, GIT_OID_SHA1));
cl_git_pass(git_annotated_commit_lookup(&their_heads[2], repo, &octo1_3_oid));
cl_git_pass(git_merge__setup(repo, our_head, (const git_annotated_commit **)their_heads, 3));
@@ -512,7 +512,7 @@ void test_merge_workdir_setup__remote_tracking_one_branch(void)
cl_git_pass(create_remote_tracking_branch(OCTO1_BRANCH, OCTO1_OID));
- cl_git_pass(git_oid_fromstr(&our_oid, ORIG_HEAD));
+ cl_git_pass(git_oid__fromstr(&our_oid, ORIG_HEAD, GIT_OID_SHA1));
cl_git_pass(git_annotated_commit_lookup(&our_head, repo, &our_oid));
cl_git_pass(git_reference_lookup(&octo1_ref, repo, GIT_REFS_REMOTES_DIR "origin/" OCTO1_BRANCH));
@@ -542,7 +542,7 @@ void test_merge_workdir_setup__remote_tracking_two_branches(void)
cl_git_pass(create_remote_tracking_branch(OCTO1_BRANCH, OCTO1_OID));
cl_git_pass(create_remote_tracking_branch(OCTO2_BRANCH, OCTO2_OID));
- cl_git_pass(git_oid_fromstr(&our_oid, ORIG_HEAD));
+ cl_git_pass(git_oid__fromstr(&our_oid, ORIG_HEAD, GIT_OID_SHA1));
cl_git_pass(git_annotated_commit_lookup(&our_head, repo, &our_oid));
cl_git_pass(git_reference_lookup(&octo1_ref, repo, GIT_REFS_REMOTES_DIR "origin/" OCTO1_BRANCH));
@@ -579,7 +579,7 @@ void test_merge_workdir_setup__remote_tracking_three_branches(void)
cl_git_pass(create_remote_tracking_branch(OCTO2_BRANCH, OCTO2_OID));
cl_git_pass(create_remote_tracking_branch(OCTO3_BRANCH, OCTO3_OID));
- cl_git_pass(git_oid_fromstr(&our_oid, ORIG_HEAD));
+ cl_git_pass(git_oid__fromstr(&our_oid, ORIG_HEAD, GIT_OID_SHA1));
cl_git_pass(git_annotated_commit_lookup(&our_head, repo, &our_oid));
cl_git_pass(git_reference_lookup(&octo1_ref, repo, GIT_REFS_REMOTES_DIR "origin/" OCTO1_BRANCH));
@@ -618,7 +618,7 @@ void test_merge_workdir_setup__normal_branch_and_remote_tracking_branch(void)
cl_git_pass(create_remote_tracking_branch(OCTO2_BRANCH, OCTO2_OID));
- cl_git_pass(git_oid_fromstr(&our_oid, ORIG_HEAD));
+ cl_git_pass(git_oid__fromstr(&our_oid, ORIG_HEAD, GIT_OID_SHA1));
cl_git_pass(git_annotated_commit_lookup(&our_head, repo, &our_oid));
cl_git_pass(git_reference_lookup(&octo1_ref, repo, GIT_REFS_HEADS_DIR OCTO1_BRANCH));
@@ -652,7 +652,7 @@ void test_merge_workdir_setup__remote_tracking_branch_and_normal_branch(void)
cl_git_pass(create_remote_tracking_branch(OCTO1_BRANCH, OCTO1_OID));
- cl_git_pass(git_oid_fromstr(&our_oid, ORIG_HEAD));
+ cl_git_pass(git_oid__fromstr(&our_oid, ORIG_HEAD, GIT_OID_SHA1));
cl_git_pass(git_annotated_commit_lookup(&our_head, repo, &our_oid));
cl_git_pass(git_reference_lookup(&octo1_ref, repo, GIT_REFS_REMOTES_DIR "origin/" OCTO1_BRANCH));
@@ -689,7 +689,7 @@ void test_merge_workdir_setup__two_remote_tracking_branch_and_two_normal_branche
cl_git_pass(create_remote_tracking_branch(OCTO2_BRANCH, OCTO2_OID));
cl_git_pass(create_remote_tracking_branch(OCTO4_BRANCH, OCTO4_OID));
- cl_git_pass(git_oid_fromstr(&our_oid, ORIG_HEAD));
+ cl_git_pass(git_oid__fromstr(&our_oid, ORIG_HEAD, GIT_OID_SHA1));
cl_git_pass(git_annotated_commit_lookup(&our_head, repo, &our_oid));
cl_git_pass(git_reference_lookup(&octo1_ref, repo, GIT_REFS_HEADS_DIR OCTO1_BRANCH));
@@ -730,10 +730,10 @@ void test_merge_workdir_setup__pull_one(void)
git_oid octo1_1_oid;
git_annotated_commit *our_head, *their_heads[1];
- cl_git_pass(git_oid_fromstr(&our_oid, ORIG_HEAD));
+ cl_git_pass(git_oid__fromstr(&our_oid, ORIG_HEAD, GIT_OID_SHA1));
cl_git_pass(git_annotated_commit_lookup(&our_head, repo, &our_oid));
- cl_git_pass(git_oid_fromstr(&octo1_1_oid, OCTO1_OID));
+ cl_git_pass(git_oid__fromstr(&octo1_1_oid, OCTO1_OID, GIT_OID_SHA1));
cl_git_pass(git_annotated_commit_from_fetchhead(&their_heads[0], repo, GIT_REFS_HEADS_DIR OCTO1_BRANCH, "http://remote.url/repo.git", &octo1_1_oid));
cl_git_pass(git_merge__setup(repo, our_head, (const git_annotated_commit **)their_heads, 1));
@@ -755,13 +755,13 @@ void test_merge_workdir_setup__pull_two(void)
git_oid octo2_oid;
git_annotated_commit *our_head, *their_heads[2];
- cl_git_pass(git_oid_fromstr(&our_oid, ORIG_HEAD));
+ cl_git_pass(git_oid__fromstr(&our_oid, ORIG_HEAD, GIT_OID_SHA1));
cl_git_pass(git_annotated_commit_lookup(&our_head, repo, &our_oid));
- cl_git_pass(git_oid_fromstr(&octo1_oid, OCTO1_OID));
+ cl_git_pass(git_oid__fromstr(&octo1_oid, OCTO1_OID, GIT_OID_SHA1));
cl_git_pass(git_annotated_commit_from_fetchhead(&their_heads[0], repo, GIT_REFS_HEADS_DIR OCTO1_BRANCH, "http://remote.url/repo.git", &octo1_oid));
- cl_git_pass(git_oid_fromstr(&octo2_oid, OCTO2_OID));
+ cl_git_pass(git_oid__fromstr(&octo2_oid, OCTO2_OID, GIT_OID_SHA1));
cl_git_pass(git_annotated_commit_from_fetchhead(&their_heads[1], repo, GIT_REFS_HEADS_DIR OCTO2_BRANCH, "http://remote.url/repo.git", &octo2_oid));
cl_git_pass(git_merge__setup(repo, our_head, (const git_annotated_commit **)their_heads, 2));
@@ -785,16 +785,16 @@ void test_merge_workdir_setup__pull_three(void)
git_oid octo3_oid;
git_annotated_commit *our_head, *their_heads[3];
- cl_git_pass(git_oid_fromstr(&our_oid, ORIG_HEAD));
+ cl_git_pass(git_oid__fromstr(&our_oid, ORIG_HEAD, GIT_OID_SHA1));
cl_git_pass(git_annotated_commit_lookup(&our_head, repo, &our_oid));
- cl_git_pass(git_oid_fromstr(&octo1_oid, OCTO1_OID));
+ cl_git_pass(git_oid__fromstr(&octo1_oid, OCTO1_OID, GIT_OID_SHA1));
cl_git_pass(git_annotated_commit_from_fetchhead(&their_heads[0], repo, GIT_REFS_HEADS_DIR OCTO1_BRANCH, "http://remote.url/repo.git", &octo1_oid));
- cl_git_pass(git_oid_fromstr(&octo2_oid, OCTO2_OID));
+ cl_git_pass(git_oid__fromstr(&octo2_oid, OCTO2_OID, GIT_OID_SHA1));
cl_git_pass(git_annotated_commit_from_fetchhead(&their_heads[1], repo, GIT_REFS_HEADS_DIR OCTO2_BRANCH, "http://remote.url/repo.git", &octo2_oid));
- cl_git_pass(git_oid_fromstr(&octo3_oid, OCTO3_OID));
+ cl_git_pass(git_oid__fromstr(&octo3_oid, OCTO3_OID, GIT_OID_SHA1));
cl_git_pass(git_annotated_commit_from_fetchhead(&their_heads[2], repo, GIT_REFS_HEADS_DIR OCTO3_BRANCH, "http://remote.url/repo.git", &octo3_oid));
cl_git_pass(git_merge__setup(repo, our_head, (const git_annotated_commit **)their_heads, 3));
@@ -818,16 +818,16 @@ void test_merge_workdir_setup__three_remotes(void)
git_oid octo3_oid;
git_annotated_commit *our_head, *their_heads[3];
- cl_git_pass(git_oid_fromstr(&our_oid, ORIG_HEAD));
+ cl_git_pass(git_oid__fromstr(&our_oid, ORIG_HEAD, GIT_OID_SHA1));
cl_git_pass(git_annotated_commit_lookup(&our_head, repo, &our_oid));
- cl_git_pass(git_oid_fromstr(&octo1_oid, OCTO1_OID));
+ cl_git_pass(git_oid__fromstr(&octo1_oid, OCTO1_OID, GIT_OID_SHA1));
cl_git_pass(git_annotated_commit_from_fetchhead(&their_heads[0], repo, GIT_REFS_HEADS_DIR OCTO1_BRANCH, "http://remote.first/repo.git", &octo1_oid));
- cl_git_pass(git_oid_fromstr(&octo2_oid, OCTO2_OID));
+ cl_git_pass(git_oid__fromstr(&octo2_oid, OCTO2_OID, GIT_OID_SHA1));
cl_git_pass(git_annotated_commit_from_fetchhead(&their_heads[1], repo, GIT_REFS_HEADS_DIR OCTO2_BRANCH, "http://remote.second/repo.git", &octo2_oid));
- cl_git_pass(git_oid_fromstr(&octo3_oid, OCTO3_OID));
+ cl_git_pass(git_oid__fromstr(&octo3_oid, OCTO3_OID, GIT_OID_SHA1));
cl_git_pass(git_annotated_commit_from_fetchhead(&their_heads[2], repo, GIT_REFS_HEADS_DIR OCTO3_BRANCH, "http://remote.third/repo.git", &octo3_oid));
cl_git_pass(git_merge__setup(repo, our_head, (const git_annotated_commit **)their_heads, 3));
@@ -852,19 +852,19 @@ void test_merge_workdir_setup__two_remotes(void)
git_oid octo4_oid;
git_annotated_commit *our_head, *their_heads[4];
- cl_git_pass(git_oid_fromstr(&our_oid, ORIG_HEAD));
+ cl_git_pass(git_oid__fromstr(&our_oid, ORIG_HEAD, GIT_OID_SHA1));
cl_git_pass(git_annotated_commit_lookup(&our_head, repo, &our_oid));
- cl_git_pass(git_oid_fromstr(&octo1_oid, OCTO1_OID));
+ cl_git_pass(git_oid__fromstr(&octo1_oid, OCTO1_OID, GIT_OID_SHA1));
cl_git_pass(git_annotated_commit_from_fetchhead(&their_heads[0], repo, GIT_REFS_HEADS_DIR OCTO1_BRANCH, "http://remote.first/repo.git", &octo1_oid));
- cl_git_pass(git_oid_fromstr(&octo2_oid, OCTO2_OID));
+ cl_git_pass(git_oid__fromstr(&octo2_oid, OCTO2_OID, GIT_OID_SHA1));
cl_git_pass(git_annotated_commit_from_fetchhead(&their_heads[1], repo, GIT_REFS_HEADS_DIR OCTO2_BRANCH, "http://remote.second/repo.git", &octo2_oid));
- cl_git_pass(git_oid_fromstr(&octo3_oid, OCTO3_OID));
+ cl_git_pass(git_oid__fromstr(&octo3_oid, OCTO3_OID, GIT_OID_SHA1));
cl_git_pass(git_annotated_commit_from_fetchhead(&their_heads[2], repo, GIT_REFS_HEADS_DIR OCTO3_BRANCH, "http://remote.first/repo.git", &octo3_oid));
- cl_git_pass(git_oid_fromstr(&octo4_oid, OCTO4_OID));
+ cl_git_pass(git_oid__fromstr(&octo4_oid, OCTO4_OID, GIT_OID_SHA1));
cl_git_pass(git_annotated_commit_from_fetchhead(&their_heads[3], repo, GIT_REFS_HEADS_DIR OCTO4_BRANCH, "http://remote.second/repo.git", &octo4_oid));
cl_git_pass(git_merge__setup(repo, our_head, (const git_annotated_commit **)their_heads, 4));
@@ -888,7 +888,7 @@ void test_merge_workdir_setup__id_from_head(void)
git_reference *ref;
git_annotated_commit *heads[3];
- cl_git_pass(git_oid_fromstr(&expected_id, OCTO1_OID));
+ cl_git_pass(git_oid__fromstr(&expected_id, OCTO1_OID, GIT_OID_SHA1));
cl_git_pass(git_annotated_commit_from_fetchhead(&heads[0], repo, GIT_REFS_HEADS_DIR OCTO1_BRANCH, "http://remote.url/repo.git", &expected_id));
id = git_annotated_commit_id(heads[0]);
cl_assert_equal_i(1, git_oid_equal(id, &expected_id));
@@ -920,7 +920,7 @@ static int annotated_commit_foreach_cb(const git_oid *oid, void *payload)
git_oid expected_oid;
struct annotated_commit_cb_data *cb_data = payload;
- git_oid_fromstr(&expected_oid, cb_data->oid_str[cb_data->i]);
+ git_oid__fromstr(&expected_oid, cb_data->oid_str[cb_data->i], GIT_OID_SHA1);
cl_assert(git_oid_cmp(&expected_oid, oid) == 0);
cb_data->i++;
return 0;
@@ -998,7 +998,7 @@ void test_merge_workdir_setup__retained_after_success(void)
git_reference *octo1_ref;
git_annotated_commit *our_head, *their_heads[1];
- cl_git_pass(git_oid_fromstr(&our_oid, ORIG_HEAD));
+ cl_git_pass(git_oid__fromstr(&our_oid, ORIG_HEAD, GIT_OID_SHA1));
cl_git_pass(git_annotated_commit_lookup(&our_head, repo, &our_oid));
cl_git_pass(git_reference_lookup(&octo1_ref, repo, GIT_REFS_HEADS_DIR OCTO1_BRANCH));
@@ -1025,7 +1025,7 @@ void test_merge_workdir_setup__removed_after_failure(void)
git_reference *octo1_ref;
git_annotated_commit *our_head, *their_heads[1];
- cl_git_pass(git_oid_fromstr(&our_oid, ORIG_HEAD));
+ cl_git_pass(git_oid__fromstr(&our_oid, ORIG_HEAD, GIT_OID_SHA1));
cl_git_pass(git_annotated_commit_lookup(&our_head, repo, &our_oid));
cl_git_pass(git_reference_lookup(&octo1_ref, repo, GIT_REFS_HEADS_DIR OCTO1_BRANCH));
@@ -1052,7 +1052,7 @@ void test_merge_workdir_setup__unlocked_after_success(void)
git_reference *octo1_ref;
git_annotated_commit *our_head, *their_heads[1];
- cl_git_pass(git_oid_fromstr(&our_oid, ORIG_HEAD));
+ cl_git_pass(git_oid__fromstr(&our_oid, ORIG_HEAD, GIT_OID_SHA1));
cl_git_pass(git_annotated_commit_lookup(&our_head, repo, &our_oid));
cl_git_pass(git_reference_lookup(&octo1_ref, repo, GIT_REFS_HEADS_DIR OCTO1_BRANCH));
@@ -1075,7 +1075,7 @@ void test_merge_workdir_setup__unlocked_after_conflict(void)
git_reference *octo1_ref;
git_annotated_commit *our_head, *their_heads[1];
- cl_git_pass(git_oid_fromstr(&our_oid, ORIG_HEAD));
+ cl_git_pass(git_oid__fromstr(&our_oid, ORIG_HEAD, GIT_OID_SHA1));
cl_git_pass(git_annotated_commit_lookup(&our_head, repo, &our_oid));
cl_git_pass(git_reference_lookup(&octo1_ref, repo, GIT_REFS_HEADS_DIR OCTO1_BRANCH));
diff --git a/tests/libgit2/merge/workdir/simple.c b/tests/libgit2/merge/workdir/simple.c
index b9d3fc24c..e9cffeea8 100644
--- a/tests/libgit2/merge/workdir/simple.c
+++ b/tests/libgit2/merge/workdir/simple.c
@@ -99,7 +99,7 @@ static void merge_simple_branch(int merge_file_favor, int addl_checkout_strategy
git_merge_options merge_opts = GIT_MERGE_OPTIONS_INIT;
git_checkout_options checkout_opts = GIT_CHECKOUT_OPTIONS_INIT;
- cl_git_pass(git_oid_fromstr(&their_oids[0], THEIRS_SIMPLE_OID));
+ cl_git_pass(git_oid__fromstr(&their_oids[0], THEIRS_SIMPLE_OID, GIT_OID_SHA1));
cl_git_pass(git_annotated_commit_lookup(&their_heads[0], repo, &their_oids[0]));
merge_opts.file_favor = merge_file_favor;
@@ -180,14 +180,14 @@ void test_merge_workdir_simple__index_reload(void)
cl_git_pass(git_index_read(repo_index, 0));
entry.mode = GIT_FILEMODE_BLOB;
- cl_git_pass(git_oid_fromstr(&entry.id, "11deab00b2d3a6f5a3073988ac050c2d7b6655e2"));
+ cl_git_pass(git_oid__fromstr(&entry.id, "11deab00b2d3a6f5a3073988ac050c2d7b6655e2", GIT_OID_SHA1));
entry.path = "automergeable.txt";
cl_git_pass(git_index_add(repo_index, &entry));
cl_git_pass(git_index_add_bypath(tmp_index, "automergeable.txt"));
cl_git_pass(git_index_write(tmp_index));
- cl_git_pass(git_oid_fromstr(&their_oid, THEIRS_SIMPLE_OID));
+ cl_git_pass(git_oid__fromstr(&their_oid, THEIRS_SIMPLE_OID, GIT_OID_SHA1));
cl_git_pass(git_annotated_commit_lookup(&their_heads[0], repo, &their_oid));
cl_git_pass(git_merge(repo, (const git_annotated_commit **)their_heads, 1, NULL, NULL));
@@ -669,7 +669,7 @@ void test_merge_workdir_simple__directory_file(void)
cl_git_pass(git_commit_lookup(&head_commit, repo, &head_commit_id));
cl_git_pass(git_reset(repo, (git_object *)head_commit, GIT_RESET_HARD, NULL));
- cl_git_pass(git_oid_fromstr(&their_oids[0], THEIRS_DIRECTORY_FILE));
+ cl_git_pass(git_oid__fromstr(&their_oids[0], THEIRS_DIRECTORY_FILE, GIT_OID_SHA1));
cl_git_pass(git_annotated_commit_lookup(&their_heads[0], repo, &their_oids[0]));
merge_opts.file_favor = 0;
@@ -700,7 +700,7 @@ void test_merge_workdir_simple__unrelated(void)
{ 0100644, "c8f06f2e3bb2964174677e91f0abead0e43c9e5d", 0, "unchanged.txt" },
};
- cl_git_pass(git_oid_fromstr(&their_oids[0], THEIRS_UNRELATED_PARENT));
+ cl_git_pass(git_oid__fromstr(&their_oids[0], THEIRS_UNRELATED_PARENT, GIT_OID_SHA1));
cl_git_pass(git_annotated_commit_lookup(&their_heads[0], repo, &their_oids[0]));
merge_opts.file_favor = 0;
@@ -731,7 +731,7 @@ void test_merge_workdir_simple__unrelated_with_conflicts(void)
{ 0100644, "c8f06f2e3bb2964174677e91f0abead0e43c9e5d", 0, "unchanged.txt" },
};
- cl_git_pass(git_oid_fromstr(&their_oids[0], THEIRS_UNRELATED_OID));
+ cl_git_pass(git_oid__fromstr(&their_oids[0], THEIRS_UNRELATED_OID, GIT_OID_SHA1));
cl_git_pass(git_annotated_commit_lookup(&their_heads[0], repo, &their_oids[0]));
merge_opts.file_favor = 0;
@@ -755,8 +755,8 @@ void test_merge_workdir_simple__binary(void)
{ 0100644, "836b8b82b26cab22eaaed8820877c76d6c8bca19", 3, "binary" },
};
- cl_git_pass(git_oid_fromstr(&our_oid, "cc338e4710c9b257106b8d16d82f86458d5beaf1"));
- cl_git_pass(git_oid_fromstr(&their_oid, "ad01aebfdf2ac13145efafe3f9fcf798882f1730"));
+ cl_git_pass(git_oid__fromstr(&our_oid, "cc338e4710c9b257106b8d16d82f86458d5beaf1", GIT_OID_SHA1));
+ cl_git_pass(git_oid__fromstr(&their_oid, "ad01aebfdf2ac13145efafe3f9fcf798882f1730", GIT_OID_SHA1));
cl_git_pass(git_commit_lookup(&our_commit, repo, &our_oid));
cl_git_pass(git_reset(repo, (git_object *)our_commit, GIT_RESET_HARD, NULL));
@@ -770,7 +770,7 @@ void test_merge_workdir_simple__binary(void)
cl_git_pass(git_index_add_bypath(repo_index, "binary"));
cl_assert((binary_entry = git_index_get_bypath(repo_index, "binary", 0)) != NULL);
- cl_git_pass(git_oid_fromstr(&our_file_oid, "23ed141a6ae1e798b2f721afedbe947c119111ba"));
+ cl_git_pass(git_oid__fromstr(&our_file_oid, "23ed141a6ae1e798b2f721afedbe947c119111ba", GIT_OID_SHA1));
cl_assert(git_oid_cmp(&binary_entry->id, &our_file_oid) == 0);
git_annotated_commit_free(their_head);
diff --git a/tests/libgit2/merge/workdir/trivial.c b/tests/libgit2/merge/workdir/trivial.c
index fe8374851..364182c89 100644
--- a/tests/libgit2/merge/workdir/trivial.c
+++ b/tests/libgit2/merge/workdir/trivial.c
@@ -222,7 +222,7 @@ void test_merge_workdir_trivial__13(void)
cl_git_pass(merge_trivial("trivial-13", "trivial-13-branch"));
cl_assert(entry = git_index_get_bypath(repo_index, "modified-in-13.txt", 0));
- cl_git_pass(git_oid_fromstr(&expected_oid, "1cff9ec6a47a537380dedfdd17c9e76d74259a2b"));
+ cl_git_pass(git_oid__fromstr(&expected_oid, "1cff9ec6a47a537380dedfdd17c9e76d74259a2b", GIT_OID_SHA1));
cl_assert(git_oid_cmp(&entry->id, &expected_oid) == 0);
cl_assert(git_index_reuc_entrycount(repo_index) == 0);
@@ -238,7 +238,7 @@ void test_merge_workdir_trivial__14(void)
cl_git_pass(merge_trivial("trivial-14", "trivial-14-branch"));
cl_assert(entry = git_index_get_bypath(repo_index, "modified-in-14-branch.txt", 0));
- cl_git_pass(git_oid_fromstr(&expected_oid, "26153a3ff3649b6c2bb652d3f06878c6e0a172f9"));
+ cl_git_pass(git_oid__fromstr(&expected_oid, "26153a3ff3649b6c2bb652d3f06878c6e0a172f9", GIT_OID_SHA1));
cl_assert(git_oid_cmp(&entry->id, &expected_oid) == 0);
cl_assert(git_index_reuc_entrycount(repo_index) == 0);
diff --git a/tests/libgit2/network/remote/push.c b/tests/libgit2/network/remote/push.c
index 3905debdf..16588a292 100644
--- a/tests/libgit2/network/remote/push.c
+++ b/tests/libgit2/network/remote/push.c
@@ -1,5 +1,6 @@
#include "clar_libgit2.h"
#include "git2/sys/commit.h"
+#include "oid.h"
static git_remote *_remote;
static git_repository *_repo, *_dummy;
@@ -57,7 +58,7 @@ void test_network_remote_push__delete_notification(void)
expected.src_refname = "";
expected.dst_refname = "refs/heads/master";
- memset(&expected.dst, 0, sizeof(git_oid));
+ git_oid_clear(&expected.dst, GIT_OID_SHA1);
git_oid_cpy(&expected.src, git_reference_target(ref));
opts.callbacks.push_negotiation = negotiation_cb;
@@ -102,7 +103,7 @@ void test_network_remote_push__create_notification(void)
expected.src_refname = "refs/heads/empty-tree";
expected.dst_refname = "refs/heads/empty-tree";
git_oid_cpy(&expected.dst, git_reference_target(ref));
- memset(&expected.src, 0, sizeof(git_oid));
+ git_oid_clear(&expected.src, GIT_OID_SHA1);
opts.callbacks.push_negotiation = negotiation_cb;
opts.callbacks.payload = &expected;
diff --git a/tests/libgit2/network/remote/rename.c b/tests/libgit2/network/remote/rename.c
index 1fd2affba..b071f9cef 100644
--- a/tests/libgit2/network/remote/rename.c
+++ b/tests/libgit2/network/remote/rename.c
@@ -164,13 +164,13 @@ void test_network_remote_rename__renaming_a_remote_moves_the_underlying_referenc
void test_network_remote_rename__overwrite_ref_in_target(void)
{
git_oid id;
- char idstr[GIT_OID_HEXSZ + 1] = {0};
+ char idstr[GIT_OID_SHA1_HEXSIZE + 1] = {0};
git_reference *ref;
git_branch_t btype;
git_branch_iterator *iter;
git_strarray problems = {0};
- cl_git_pass(git_oid_fromstr(&id, "a65fedf39aefe402d3bb6e24df4d4f5fe4547750"));
+ cl_git_pass(git_oid__fromstr(&id, "a65fedf39aefe402d3bb6e24df4d4f5fe4547750", GIT_OID_SHA1));
cl_git_pass(git_reference_create(&ref, _repo, "refs/remotes/renamed/master", &id, 1, NULL));
git_reference_free(ref);
@@ -206,7 +206,7 @@ void test_network_remote_rename__symref_head(void)
git_branch_t btype;
git_branch_iterator *iter;
git_strarray problems = {0};
- char idstr[GIT_OID_HEXSZ + 1] = {0};
+ char idstr[GIT_OID_SHA1_HEXSIZE + 1] = {0};
git_vector refs;
cl_git_pass(git_reference_symbolic_create(&ref, _repo, "refs/remotes/test/HEAD", "refs/remotes/test/master", 0, NULL));
diff --git a/tests/libgit2/notes/notes.c b/tests/libgit2/notes/notes.c
index a36cddb8a..06c440955 100644
--- a/tests/libgit2/notes/notes.c
+++ b/tests/libgit2/notes/notes.c
@@ -33,7 +33,7 @@ static void create_note(git_oid *note_oid, const char *canonical_namespace, cons
{
git_oid oid;
- cl_git_pass(git_oid_fromstr(&oid, target_sha));
+ cl_git_pass(git_oid__fromstr(&oid, target_sha, GIT_OID_SHA1));
cl_git_pass(git_note_create(note_oid, _repo, canonical_namespace, _sig, _sig, &oid, message, 0));
}
@@ -60,10 +60,10 @@ static int note_list_cb(
cl_assert(*count < EXPECTATIONS_COUNT);
- cl_git_pass(git_oid_fromstr(&expected_note_oid, list_expectations[*count].note_sha));
+ cl_git_pass(git_oid__fromstr(&expected_note_oid, list_expectations[*count].note_sha, GIT_OID_SHA1));
cl_assert_equal_oid(&expected_note_oid, blob_id);
- cl_git_pass(git_oid_fromstr(&expected_target_oid, list_expectations[*count].annotated_object_sha));
+ cl_git_pass(git_oid__fromstr(&expected_target_oid, list_expectations[*count].annotated_object_sha, GIT_OID_SHA1));
cl_assert_equal_oid(&expected_target_oid, annotated_obj_id);
(*count)++;
@@ -85,12 +85,12 @@ static int note_list_create_cb(
size_t i;
for (i = 0; notes[i].note_oid != NULL; i++) {
- cl_git_pass(git_oid_fromstr(&expected_note_oid, notes[i].note_oid));
+ cl_git_pass(git_oid__fromstr(&expected_note_oid, notes[i].note_oid, GIT_OID_SHA1));
if (git_oid_cmp(&expected_note_oid, blob_oid) != 0)
continue;
- cl_git_pass(git_oid_fromstr(&expected_target_oid, notes[i].object_oid));
+ cl_git_pass(git_oid__fromstr(&expected_target_oid, notes[i].object_oid, GIT_OID_SHA1));
if (git_oid_cmp(&expected_target_oid, annotated_obj_id) != 0)
continue;
@@ -140,7 +140,7 @@ void test_notes_notes__can_create_a_note_from_commit(void)
{ NULL, NULL, 0 }
};
- cl_git_pass(git_oid_fromstr(&oid, can_create_a_note_from_commit[0].object_oid));
+ cl_git_pass(git_oid__fromstr(&oid, can_create_a_note_from_commit[0].object_oid, GIT_OID_SHA1));
cl_git_pass(git_note_commit_create(&notes_commit_out, NULL, _repo, NULL, _sig, _sig, &oid, "I decorate 4a20\n", 1));
@@ -169,11 +169,11 @@ void test_notes_notes__can_create_a_note_from_commit_given_an_existing_commit(vo
{ NULL, NULL, 0 }
};
- cl_git_pass(git_oid_fromstr(&oid, "4a202b346bb0fb0db7eff3cffeb3c70babbd2045"));
+ cl_git_pass(git_oid__fromstr(&oid, "4a202b346bb0fb0db7eff3cffeb3c70babbd2045", GIT_OID_SHA1));
cl_git_pass(git_note_commit_create(&notes_commit_out, NULL, _repo, NULL, _sig, _sig, &oid, "I decorate 4a20\n", 0));
- cl_git_pass(git_oid_fromstr(&oid, "9fd738e8f7967c078dceed8190330fc8648ee56a"));
+ cl_git_pass(git_oid__fromstr(&oid, "9fd738e8f7967c078dceed8190330fc8648ee56a", GIT_OID_SHA1));
git_commit_lookup(&existing_notes_commit, _repo, &notes_commit_out);
@@ -274,7 +274,7 @@ void test_notes_notes__inserting_a_note_without_passing_a_namespace_uses_the_def
git_note *note, *default_namespace_note;
git_buf default_ref = GIT_BUF_INIT;
- cl_git_pass(git_oid_fromstr(&target_oid, "08b041783f40edfe12bb406c9c9a8a040177c125"));
+ cl_git_pass(git_oid__fromstr(&target_oid, "08b041783f40edfe12bb406c9c9a8a040177c125", GIT_OID_SHA1));
cl_git_pass(git_note_default_ref(&default_ref, _repo));
create_note(&note_oid, NULL, "08b041783f40edfe12bb406c9c9a8a040177c125", "hello world\n");
@@ -295,7 +295,7 @@ void test_notes_notes__can_insert_a_note_with_a_custom_namespace(void)
git_oid note_oid, target_oid;
git_note *note;
- cl_git_pass(git_oid_fromstr(&target_oid, "08b041783f40edfe12bb406c9c9a8a040177c125"));
+ cl_git_pass(git_oid__fromstr(&target_oid, "08b041783f40edfe12bb406c9c9a8a040177c125", GIT_OID_SHA1));
create_note(&note_oid, "refs/notes/some/namespace", "08b041783f40edfe12bb406c9c9a8a040177c125", "hello world on a custom namespace\n");
@@ -315,7 +315,7 @@ void test_notes_notes__creating_a_note_on_a_target_which_already_has_one_returns
int error;
git_oid note_oid, target_oid;
- cl_git_pass(git_oid_fromstr(&target_oid, "08b041783f40edfe12bb406c9c9a8a040177c125"));
+ cl_git_pass(git_oid__fromstr(&target_oid, "08b041783f40edfe12bb406c9c9a8a040177c125", GIT_OID_SHA1));
create_note(&note_oid, NULL, "08b041783f40edfe12bb406c9c9a8a040177c125", "hello world\n");
error = git_note_create(&note_oid, _repo, NULL, _sig, _sig, &target_oid, "hello world\n", 0);
@@ -334,7 +334,7 @@ void test_notes_notes__creating_a_note_on_a_target_can_overwrite_existing_note(v
git_oid note_oid, target_oid;
git_note *note, *namespace_note;
- cl_git_pass(git_oid_fromstr(&target_oid, "08b041783f40edfe12bb406c9c9a8a040177c125"));
+ cl_git_pass(git_oid__fromstr(&target_oid, "08b041783f40edfe12bb406c9c9a8a040177c125", GIT_OID_SHA1));
create_note(&note_oid, NULL, "08b041783f40edfe12bb406c9c9a8a040177c125", "hello old world\n");
cl_git_pass(git_note_create(&note_oid, _repo, NULL, _sig, _sig, &target_oid, "hello new world\n", 1));
@@ -381,7 +381,7 @@ void test_notes_notes__can_read_a_note(void)
create_note(&note_oid, "refs/notes/i-can-see-dead-notes", "4a202b346bb0fb0db7eff3cffeb3c70babbd2045", "I decorate 4a20\n");
- cl_git_pass(git_oid_fromstr(&target_oid, "4a202b346bb0fb0db7eff3cffeb3c70babbd2045"));
+ cl_git_pass(git_oid__fromstr(&target_oid, "4a202b346bb0fb0db7eff3cffeb3c70babbd2045", GIT_OID_SHA1));
cl_git_pass(git_note_read(&note, _repo, "refs/notes/i-can-see-dead-notes", &target_oid));
@@ -397,7 +397,7 @@ void test_notes_notes__can_read_a_note_from_a_commit(void)
git_commit *notes_commit;
git_note *note;
- cl_git_pass(git_oid_fromstr(&oid, "4a202b346bb0fb0db7eff3cffeb3c70babbd2045"));
+ cl_git_pass(git_oid__fromstr(&oid, "4a202b346bb0fb0db7eff3cffeb3c70babbd2045", GIT_OID_SHA1));
cl_git_pass(git_note_commit_create(&notes_commit_oid, NULL, _repo, NULL, _sig, _sig, &oid, "I decorate 4a20\n", 1));
cl_git_pass(git_commit_lookup(&notes_commit, _repo, &notes_commit_oid));
cl_assert(notes_commit);
@@ -416,7 +416,7 @@ void test_notes_notes__attempt_to_read_a_note_from_a_commit_with_no_note_fails(v
git_commit *notes_commit;
git_note *note;
- cl_git_pass(git_oid_fromstr(&oid, "4a202b346bb0fb0db7eff3cffeb3c70babbd2045"));
+ cl_git_pass(git_oid__fromstr(&oid, "4a202b346bb0fb0db7eff3cffeb3c70babbd2045", GIT_OID_SHA1));
cl_git_pass(git_note_commit_create(&notes_commit_oid, NULL, _repo, NULL, _sig, _sig, &oid, "I decorate 4a20\n", 1));
@@ -450,7 +450,7 @@ void test_notes_notes__can_insert_a_note_in_an_existing_fanout(void)
git_oid note_oid, target_oid;
git_note *_note;
- cl_git_pass(git_oid_fromstr(&target_oid, "08b041783f40edfe12bb406c9c9a8a040177c125"));
+ cl_git_pass(git_oid__fromstr(&target_oid, "08b041783f40edfe12bb406c9c9a8a040177c125", GIT_OID_SHA1));
for (i = 0; i < MESSAGES_COUNT; i++) {
cl_git_pass(git_note_create(&note_oid, _repo, "refs/notes/fanout", _sig, _sig, &target_oid, messages[i], 0));
@@ -470,10 +470,10 @@ void test_notes_notes__can_read_a_note_in_an_existing_fanout(void)
git_oid note_oid, target_oid;
git_note *note;
- cl_git_pass(git_oid_fromstr(&target_oid, "8496071c1b46c854b31185ea97743be6a8774479"));
+ cl_git_pass(git_oid__fromstr(&target_oid, "8496071c1b46c854b31185ea97743be6a8774479", GIT_OID_SHA1));
cl_git_pass(git_note_read(&note, _repo, "refs/notes/fanout", &target_oid));
- cl_git_pass(git_oid_fromstr(&note_oid, "08b041783f40edfe12bb406c9c9a8a040177c125"));
+ cl_git_pass(git_oid__fromstr(&note_oid, "08b041783f40edfe12bb406c9c9a8a040177c125", GIT_OID_SHA1));
cl_assert_equal_oid(git_note_id(note), &note_oid);
git_note_free(note);
@@ -487,7 +487,7 @@ void test_notes_notes__can_remove_a_note(void)
create_note(&note_oid, "refs/notes/i-can-see-dead-notes", "4a202b346bb0fb0db7eff3cffeb3c70babbd2045", "I decorate 4a20\n");
- cl_git_pass(git_oid_fromstr(&target_oid, "4a202b346bb0fb0db7eff3cffeb3c70babbd2045"));
+ cl_git_pass(git_oid__fromstr(&target_oid, "4a202b346bb0fb0db7eff3cffeb3c70babbd2045", GIT_OID_SHA1));
cl_git_pass(git_note_remove(_repo, "refs/notes/i-can-see-dead-notes", _sig, _sig, &target_oid));
cl_git_fail(git_note_read(&note, _repo, "refs/notes/i-can-see-dead-notes", &target_oid));
@@ -501,7 +501,7 @@ void test_notes_notes__can_remove_a_note_from_commit(void)
git_commit *existing_notes_commit;
git_reference *ref;
- cl_git_pass(git_oid_fromstr(&oid, "4a202b346bb0fb0db7eff3cffeb3c70babbd2045"));
+ cl_git_pass(git_oid__fromstr(&oid, "4a202b346bb0fb0db7eff3cffeb3c70babbd2045", GIT_OID_SHA1));
cl_git_pass(git_note_commit_create(&notes_commit_oid, NULL, _repo, NULL, _sig, _sig, &oid, "I decorate 4a20\n", 0));
@@ -528,7 +528,7 @@ void test_notes_notes__can_remove_a_note_in_an_existing_fanout(void)
git_oid target_oid;
git_note *note;
- cl_git_pass(git_oid_fromstr(&target_oid, "8496071c1b46c854b31185ea97743be6a8774479"));
+ cl_git_pass(git_oid__fromstr(&target_oid, "8496071c1b46c854b31185ea97743be6a8774479", GIT_OID_SHA1));
cl_git_pass(git_note_remove(_repo, "refs/notes/fanout", _sig, _sig, &target_oid));
cl_git_fail(git_note_read(&note, _repo, "refs/notes/fanout", &target_oid));
@@ -539,7 +539,7 @@ void test_notes_notes__removing_a_note_which_doesnt_exists_returns_ENOTFOUND(voi
int error;
git_oid target_oid;
- cl_git_pass(git_oid_fromstr(&target_oid, "8496071c1b46c854b31185ea97743be6a8774479"));
+ cl_git_pass(git_oid__fromstr(&target_oid, "8496071c1b46c854b31185ea97743be6a8774479", GIT_OID_SHA1));
cl_git_pass(git_note_remove(_repo, "refs/notes/fanout", _sig, _sig, &target_oid));
error = git_note_remove(_repo, "refs/notes/fanout", _sig, _sig, &target_oid);
@@ -628,8 +628,8 @@ void test_notes_notes__iterate_from_commit(void)
};
int i, err;
- cl_git_pass(git_oid_fromstr(&(oids[0]), "a65fedf39aefe402d3bb6e24df4d4f5fe4547750"));
- cl_git_pass(git_oid_fromstr(&(oids[1]), "c47800c7266a2be04c571c04d5a6614691ea99bd"));
+ cl_git_pass(git_oid__fromstr(&(oids[0]), "a65fedf39aefe402d3bb6e24df4d4f5fe4547750", GIT_OID_SHA1));
+ cl_git_pass(git_oid__fromstr(&(oids[1]), "c47800c7266a2be04c571c04d5a6614691ea99bd", GIT_OID_SHA1));
cl_git_pass(git_note_commit_create(&notes_commit_oids[0], NULL, _repo, NULL, _sig, _sig, &(oids[0]), note_message[0], 0));
diff --git a/tests/libgit2/notes/notesref.c b/tests/libgit2/notes/notesref.c
index 6ba324c76..8696ff66a 100644
--- a/tests/libgit2/notes/notesref.c
+++ b/tests/libgit2/notes/notesref.c
@@ -36,7 +36,7 @@ void test_notes_notesref__config_corenotesref(void)
git_buf default_ref = GIT_BUF_INIT;
cl_git_pass(git_signature_now(&_sig, "alice", "alice@example.com"));
- cl_git_pass(git_oid_fromstr(&oid, "8496071c1b46c854b31185ea97743be6a8774479"));
+ cl_git_pass(git_oid__fromstr(&oid, "8496071c1b46c854b31185ea97743be6a8774479", GIT_OID_SHA1));
cl_git_pass(git_repository_config(&_cfg, _repo));
diff --git a/tests/libgit2/object/blob/fromstream.c b/tests/libgit2/object/blob/fromstream.c
index 60ff3991b..dad0b52e1 100644
--- a/tests/libgit2/object/blob/fromstream.c
+++ b/tests/libgit2/object/blob/fromstream.c
@@ -23,7 +23,7 @@ void test_object_blob_fromstream__multiple_write(void)
git_writestream *stream;
int i, howmany = 6;
- cl_git_pass(git_oid_fromstr(&expected_id, "321cbdf08803c744082332332838df6bd160f8f9"));
+ cl_git_pass(git_oid__fromstr(&expected_id, "321cbdf08803c744082332332838df6bd160f8f9", GIT_OID_SHA1));
cl_git_fail_with(GIT_ENOTFOUND,
git_object_lookup(&blob, repo, &expected_id, GIT_OBJECT_ANY));
@@ -64,7 +64,7 @@ static void assert_named_chunked_blob(const char *expected_sha, const char *fake
git_writestream *stream;
int i, howmany = 6;
- cl_git_pass(git_oid_fromstr(&expected_id, expected_sha));
+ cl_git_pass(git_oid__fromstr(&expected_id, expected_sha, GIT_OID_SHA1));
cl_git_pass(git_blob_create_from_stream(&stream, repo, fake_name));
diff --git a/tests/libgit2/object/cache.c b/tests/libgit2/object/cache.c
index 08bf03648..bf8c6fb53 100644
--- a/tests/libgit2/object/cache.c
+++ b/tests/libgit2/object/cache.c
@@ -91,7 +91,7 @@ void test_object_cache__cache_counts(void)
for (i = 0; g_data[i].sha != NULL; ++i) {
int count = (int)git_cache_size(&g_repo->objects);
- cl_git_pass(git_oid_fromstr(&oid, g_data[i].sha));
+ cl_git_pass(git_oid__fromstr(&oid, g_data[i].sha, GIT_OID_SHA1));
/* alternate between loading raw and parsed objects */
if ((i & 1) == 0) {
@@ -118,7 +118,7 @@ void test_object_cache__cache_counts(void)
for (i = 0; g_data[i].sha != NULL; ++i) {
int count = (int)git_cache_size(&g_repo->objects);
- cl_git_pass(git_oid_fromstr(&oid, g_data[i].sha));
+ cl_git_pass(git_oid__fromstr(&oid, g_data[i].sha, GIT_OID_SHA1));
cl_git_pass(git_object_lookup(&obj, g_repo, &oid, GIT_OBJECT_ANY));
cl_assert(g_data[i].type == git_object_type(obj));
git_object_free(obj);
@@ -136,14 +136,14 @@ static void *cache_parsed(void *arg)
git_object *obj;
for (i = ((int *)arg)[1]; g_data[i].sha != NULL; i += 2) {
- cl_git_pass(git_oid_fromstr(&oid, g_data[i].sha));
+ cl_git_pass(git_oid__fromstr(&oid, g_data[i].sha, GIT_OID_SHA1));
cl_git_pass(git_object_lookup(&obj, g_repo, &oid, GIT_OBJECT_ANY));
cl_assert(g_data[i].type == git_object_type(obj));
git_object_free(obj);
}
for (i = 0; i < ((int *)arg)[1]; i += 2) {
- cl_git_pass(git_oid_fromstr(&oid, g_data[i].sha));
+ cl_git_pass(git_oid__fromstr(&oid, g_data[i].sha, GIT_OID_SHA1));
cl_git_pass(git_object_lookup(&obj, g_repo, &oid, GIT_OBJECT_ANY));
cl_assert(g_data[i].type == git_object_type(obj));
git_object_free(obj);
@@ -162,14 +162,14 @@ static void *cache_raw(void *arg)
cl_git_pass(git_repository_odb(&odb, g_repo));
for (i = ((int *)arg)[1]; g_data[i].sha != NULL; i += 2) {
- cl_git_pass(git_oid_fromstr(&oid, g_data[i].sha));
+ cl_git_pass(git_oid__fromstr(&oid, g_data[i].sha, GIT_OID_SHA1));
cl_git_pass(git_odb_read(&odb_obj, odb, &oid));
cl_assert(g_data[i].type == git_odb_object_type(odb_obj));
git_odb_object_free(odb_obj);
}
for (i = 0; i < ((int *)arg)[1]; i += 2) {
- cl_git_pass(git_oid_fromstr(&oid, g_data[i].sha));
+ cl_git_pass(git_oid__fromstr(&oid, g_data[i].sha, GIT_OID_SHA1));
cl_git_pass(git_odb_read(&odb_obj, odb, &oid));
cl_assert(g_data[i].type == git_odb_object_type(odb_obj));
git_odb_object_free(odb_obj);
@@ -234,7 +234,7 @@ static void *cache_quick(void *arg)
git_oid oid;
git_object *obj;
- cl_git_pass(git_oid_fromstr(&oid, g_data[4].sha));
+ cl_git_pass(git_oid__fromstr(&oid, g_data[4].sha, GIT_OID_SHA1));
cl_git_pass(git_object_lookup(&obj, g_repo, &oid, GIT_OBJECT_ANY));
cl_assert(g_data[4].type == git_object_type(obj));
git_object_free(obj);
diff --git a/tests/libgit2/object/commit/commitstagedfile.c b/tests/libgit2/object/commit/commitstagedfile.c
index 7322a4e86..61f50b2af 100644
--- a/tests/libgit2/object/commit/commitstagedfile.c
+++ b/tests/libgit2/object/commit/commitstagedfile.c
@@ -64,9 +64,9 @@ void test_object_commit_commitstagedfile__generate_predictable_object_ids(void)
* 100644 blob 9daeafb9864cf43055ae93beb0afd6c7d144bfa4 test.txt
*/
- cl_git_pass(git_oid_fromstr(&expected_commit_oid, "1fe3126578fc4eca68c193e4a3a0a14a0704624d"));
- cl_git_pass(git_oid_fromstr(&expected_tree_oid, "2b297e643c551e76cfa1f93810c50811382f9117"));
- cl_git_pass(git_oid_fromstr(&expected_blob_oid, "9daeafb9864cf43055ae93beb0afd6c7d144bfa4"));
+ cl_git_pass(git_oid__fromstr(&expected_commit_oid, "1fe3126578fc4eca68c193e4a3a0a14a0704624d", GIT_OID_SHA1));
+ cl_git_pass(git_oid__fromstr(&expected_tree_oid, "2b297e643c551e76cfa1f93810c50811382f9117", GIT_OID_SHA1));
+ cl_git_pass(git_oid__fromstr(&expected_blob_oid, "9daeafb9864cf43055ae93beb0afd6c7d144bfa4", GIT_OID_SHA1));
/*
* Add a new file to the index
diff --git a/tests/libgit2/object/commit/parse.c b/tests/libgit2/object/commit/parse.c
index 4ff1ad62a..28a3ccd85 100644
--- a/tests/libgit2/object/commit/parse.c
+++ b/tests/libgit2/object/commit/parse.c
@@ -51,7 +51,7 @@ static void assert_commit_parses(const char *data, size_t datalen,
if (expected_treeid) {
git_oid tree_oid;
- cl_git_pass(git_oid_fromstr(&tree_oid, expected_treeid));
+ cl_git_pass(git_oid__fromstr(&tree_oid, expected_treeid, GIT_OID_SHA1));
cl_assert_equal_oid(&tree_oid, &commit->tree_id);
}
diff --git a/tests/libgit2/object/lookup.c b/tests/libgit2/object/lookup.c
index a7b1ceeb4..7ef1dbd1c 100644
--- a/tests/libgit2/object/lookup.c
+++ b/tests/libgit2/object/lookup.c
@@ -20,7 +20,7 @@ void test_object_lookup__lookup_wrong_type_returns_enotfound(void)
git_oid oid;
git_object *object;
- cl_git_pass(git_oid_fromstr(&oid, commit));
+ cl_git_pass(git_oid__fromstr(&oid, commit, GIT_OID_SHA1));
cl_assert_equal_i(
GIT_ENOTFOUND, git_object_lookup(&object, g_repo, &oid, GIT_OBJECT_TAG));
}
@@ -31,7 +31,7 @@ void test_object_lookup__lookup_nonexisting_returns_enotfound(void)
git_oid oid;
git_object *object;
- cl_git_pass(git_oid_fromstr(&oid, unknown));
+ cl_git_pass(git_oid__fromstr(&oid, unknown, GIT_OID_SHA1));
cl_assert_equal_i(
GIT_ENOTFOUND, git_object_lookup(&object, g_repo, &oid, GIT_OBJECT_ANY));
}
@@ -42,7 +42,7 @@ void test_object_lookup__lookup_wrong_type_by_abbreviated_id_returns_enotfound(v
git_oid oid;
git_object *object;
- cl_git_pass(git_oid_fromstrn(&oid, commit, strlen(commit)));
+ cl_git_pass(git_oid__fromstrn(&oid, commit, strlen(commit), GIT_OID_SHA1));
cl_assert_equal_i(
GIT_ENOTFOUND, git_object_lookup_prefix(&object, g_repo, &oid, strlen(commit), GIT_OBJECT_TAG));
}
@@ -53,7 +53,7 @@ void test_object_lookup__lookup_wrong_type_eventually_returns_enotfound(void)
git_oid oid;
git_object *object;
- cl_git_pass(git_oid_fromstr(&oid, commit));
+ cl_git_pass(git_oid__fromstr(&oid, commit, GIT_OID_SHA1));
cl_git_pass(git_object_lookup(&object, g_repo, &oid, GIT_OBJECT_COMMIT));
git_object_free(object);
@@ -71,7 +71,7 @@ void test_object_lookup__lookup_corrupt_object_returns_error(void)
git_object *object;
size_t i;
- cl_git_pass(git_oid_fromstr(&oid, commit));
+ cl_git_pass(git_oid__fromstr(&oid, commit, GIT_OID_SHA1));
cl_git_pass(git_str_joinpath(&path, git_repository_path(g_repo), file));
cl_git_pass(git_futils_readbuffer(&contents, path.ptr));
@@ -101,7 +101,7 @@ void test_object_lookup__lookup_object_with_wrong_hash_returns_error(void)
git_object *object;
git_oid oid;
- cl_git_pass(git_oid_fromstr(&oid, commit));
+ cl_git_pass(git_oid__fromstr(&oid, commit, GIT_OID_SHA1));
/* Copy object to another location with wrong hash */
cl_git_pass(git_str_joinpath(&oldpath, git_repository_path(g_repo), oldloose));
diff --git a/tests/libgit2/object/peel.c b/tests/libgit2/object/peel.c
index 8be6e42d4..da3ef17e2 100644
--- a/tests/libgit2/object/peel.c
+++ b/tests/libgit2/object/peel.c
@@ -23,12 +23,12 @@ static void assert_peel(
git_object *obj;
git_object *peeled;
- cl_git_pass(git_oid_fromstr(&oid, sha));
+ cl_git_pass(git_oid__fromstr(&oid, sha, GIT_OID_SHA1));
cl_git_pass(git_object_lookup(&obj, g_repo, &oid, GIT_OBJECT_ANY));
cl_git_pass(git_object_peel(&peeled, obj, requested_type));
- cl_git_pass(git_oid_fromstr(&expected_oid, expected_sha));
+ cl_git_pass(git_oid__fromstr(&expected_oid, expected_sha, GIT_OID_SHA1));
cl_assert_equal_oid(&expected_oid, git_object_id(peeled));
cl_assert_equal_i(expected_type, git_object_type(peeled));
@@ -43,7 +43,7 @@ static void assert_peel_error(int error, const char *sha, git_object_t requested
git_object *obj;
git_object *peeled;
- cl_git_pass(git_oid_fromstr(&oid, sha));
+ cl_git_pass(git_oid__fromstr(&oid, sha, GIT_OID_SHA1));
cl_git_pass(git_object_lookup(&obj, g_repo, &oid, GIT_OBJECT_ANY));
cl_assert_equal_i(error, git_object_peel(&peeled, obj, requested_type));
diff --git a/tests/libgit2/object/raw/chars.c b/tests/libgit2/object/raw/chars.c
index cde0bdbf6..cb159e9ac 100644
--- a/tests/libgit2/object/raw/chars.c
+++ b/tests/libgit2/object/raw/chars.c
@@ -19,10 +19,10 @@ void test_object_raw_chars__find_invalid_chars_in_oid(void)
in[38] = (char)i;
if (git__fromhex(i) >= 0) {
exp[19] = (unsigned char)(git__fromhex(i) << 4);
- cl_git_pass(git_oid_fromstr(&out, in));
- cl_assert(memcmp(out.id, exp, sizeof(out.id)) == 0);
+ cl_git_pass(git_oid__fromstr(&out, in, GIT_OID_SHA1));
+ cl_assert(memcmp(out.id, exp, GIT_OID_SHA1_SIZE) == 0);
} else {
- cl_git_fail(git_oid_fromstr(&out, in));
+ cl_git_fail(git_oid__fromstr(&out, in, GIT_OID_SHA1));
}
}
}
@@ -36,6 +36,6 @@ void test_object_raw_chars__build_valid_oid_from_raw_bytes(void)
0xb7, 0x75, 0x21, 0x3c, 0x23,
0xa8, 0xbd, 0x74, 0xf5, 0xe0,
};
- git_oid_fromraw(&out, exp);
- cl_git_pass(memcmp(out.id, exp, sizeof(out.id)));
+ git_oid__fromraw(&out, exp, GIT_OID_SHA1);
+ cl_git_pass(memcmp(out.id, exp, GIT_OID_SHA1_SIZE));
}
diff --git a/tests/libgit2/object/raw/compare.c b/tests/libgit2/object/raw/compare.c
index 56c016b72..9258eef41 100644
--- a/tests/libgit2/object/raw/compare.c
+++ b/tests/libgit2/object/raw/compare.c
@@ -13,9 +13,9 @@ void test_object_raw_compare__succeed_on_copy_oid(void)
0xa8, 0xbd, 0x74, 0xf5, 0xe0,
};
memset(&b, 0, sizeof(b));
- git_oid_fromraw(&a, exp);
+ git_oid__fromraw(&a, exp, GIT_OID_SHA1);
git_oid_cpy(&b, &a);
- cl_git_pass(memcmp(a.id, exp, sizeof(a.id)));
+ cl_git_pass(memcmp(a.id, exp, GIT_OID_SHA1_SIZE));
}
void test_object_raw_compare__succeed_on_oid_comparison_lesser(void)
@@ -33,8 +33,8 @@ void test_object_raw_compare__succeed_on_oid_comparison_lesser(void)
0xb7, 0x75, 0x21, 0x3c, 0x23,
0xa8, 0xbd, 0x74, 0xf5, 0xf0,
};
- git_oid_fromraw(&a, a_in);
- git_oid_fromraw(&b, b_in);
+ git_oid__fromraw(&a, a_in, GIT_OID_SHA1);
+ git_oid__fromraw(&b, b_in, GIT_OID_SHA1);
cl_assert(git_oid_cmp(&a, &b) < 0);
}
@@ -47,8 +47,8 @@ void test_object_raw_compare__succeed_on_oid_comparison_equal(void)
0xb7, 0x75, 0x21, 0x3c, 0x23,
0xa8, 0xbd, 0x74, 0xf5, 0xe0,
};
- git_oid_fromraw(&a, a_in);
- git_oid_fromraw(&b, a_in);
+ git_oid__fromraw(&a, a_in, GIT_OID_SHA1);
+ git_oid__fromraw(&b, a_in, GIT_OID_SHA1);
cl_assert(git_oid_cmp(&a, &b) == 0);
}
@@ -67,8 +67,8 @@ void test_object_raw_compare__succeed_on_oid_comparison_greater(void)
0xb7, 0x75, 0x21, 0x3c, 0x23,
0xa8, 0xbd, 0x74, 0xf5, 0xd0,
};
- git_oid_fromraw(&a, a_in);
- git_oid_fromraw(&b, b_in);
+ git_oid__fromraw(&a, a_in, GIT_OID_SHA1);
+ git_oid__fromraw(&b, b_in, GIT_OID_SHA1);
cl_assert(git_oid_cmp(&a, &b) > 0);
}
@@ -76,17 +76,17 @@ void test_object_raw_compare__compare_fmt_oids(void)
{
const char *exp = "16a0123456789abcdef4b775213c23a8bd74f5e0";
git_oid in;
- char out[GIT_OID_HEXSZ + 1];
+ char out[GIT_OID_SHA1_HEXSIZE + 1];
- cl_git_pass(git_oid_fromstr(&in, exp));
+ cl_git_pass(git_oid__fromstr(&in, exp, GIT_OID_SHA1));
/* Format doesn't touch the last byte */
- out[GIT_OID_HEXSZ] = 'Z';
+ out[GIT_OID_SHA1_HEXSIZE] = 'Z';
git_oid_fmt(out, &in);
- cl_assert(out[GIT_OID_HEXSZ] == 'Z');
+ cl_assert(out[GIT_OID_SHA1_HEXSIZE] == 'Z');
/* Format produced the right result */
- out[GIT_OID_HEXSZ] = '\0';
+ out[GIT_OID_SHA1_HEXSIZE] = '\0';
cl_assert_equal_s(exp, out);
}
@@ -96,7 +96,7 @@ void test_object_raw_compare__compare_static_oids(void)
git_oid in;
char *out;
- cl_git_pass(git_oid_fromstr(&in, exp));
+ cl_git_pass(git_oid__fromstr(&in, exp, GIT_OID_SHA1));
out = git_oid_tostr_s(&in);
cl_assert(out);
@@ -108,16 +108,16 @@ void test_object_raw_compare__compare_pathfmt_oids(void)
const char *exp1 = "16a0123456789abcdef4b775213c23a8bd74f5e0";
const char *exp2 = "16/a0123456789abcdef4b775213c23a8bd74f5e0";
git_oid in;
- char out[GIT_OID_HEXSZ + 2];
+ char out[GIT_OID_SHA1_HEXSIZE + 2];
- cl_git_pass(git_oid_fromstr(&in, exp1));
+ cl_git_pass(git_oid__fromstr(&in, exp1, GIT_OID_SHA1));
/* Format doesn't touch the last byte */
- out[GIT_OID_HEXSZ + 1] = 'Z';
+ out[GIT_OID_SHA1_HEXSIZE + 1] = 'Z';
git_oid_pathfmt(out, &in);
- cl_assert(out[GIT_OID_HEXSZ + 1] == 'Z');
+ cl_assert(out[GIT_OID_SHA1_HEXSIZE + 1] == 'Z');
/* Format produced the right result */
- out[GIT_OID_HEXSZ + 1] = '\0';
+ out[GIT_OID_SHA1_HEXSIZE + 1] = '\0';
cl_assert_equal_s(exp2, out);
}
diff --git a/tests/libgit2/object/raw/convert.c b/tests/libgit2/object/raw/convert.c
index 40a01ae09..962476b97 100644
--- a/tests/libgit2/object/raw/convert.c
+++ b/tests/libgit2/object/raw/convert.c
@@ -7,11 +7,11 @@ void test_object_raw_convert__succeed_on_oid_to_string_conversion(void)
{
const char *exp = "16a0123456789abcdef4b775213c23a8bd74f5e0";
git_oid in;
- char out[GIT_OID_HEXSZ + 1];
+ char out[GIT_OID_SHA1_HEXSIZE + 1];
char *str;
int i;
- cl_git_pass(git_oid_fromstr(&in, exp));
+ cl_git_pass(git_oid__fromstr(&in, exp, GIT_OID_SHA1));
/* NULL buffer pointer, returns static empty string */
str = git_oid_tostr(NULL, sizeof(out), &in);
@@ -29,7 +29,7 @@ void test_object_raw_convert__succeed_on_oid_to_string_conversion(void)
str = git_oid_tostr(out, 1, &in);
cl_assert(str && *str == '\0' && str == out);
- for (i = 1; i < GIT_OID_HEXSZ; i++) {
+ for (i = 1; i < GIT_OID_SHA1_HEXSIZE; i++) {
out[i+1] = 'Z';
str = git_oid_tostr(out, i+1, &in);
/* returns out containing c-string */
@@ -44,7 +44,7 @@ void test_object_raw_convert__succeed_on_oid_to_string_conversion(void)
/* returns out as hex formatted c-string */
str = git_oid_tostr(out, sizeof(out), &in);
- cl_assert(str && str == out && *(str+GIT_OID_HEXSZ) == '\0');
+ cl_assert(str && str == out && *(str+GIT_OID_SHA1_HEXSIZE) == '\0');
cl_assert_equal_s(exp, out);
}
@@ -52,26 +52,26 @@ void test_object_raw_convert__succeed_on_oid_to_string_conversion_big(void)
{
const char *exp = "16a0123456789abcdef4b775213c23a8bd74f5e0";
git_oid in;
- char big[GIT_OID_HEXSZ + 1 + 3]; /* note + 4 => big buffer */
+ char big[GIT_OID_SHA1_HEXSIZE + 1 + 3]; /* note + 4 => big buffer */
char *str;
- cl_git_pass(git_oid_fromstr(&in, exp));
+ cl_git_pass(git_oid__fromstr(&in, exp, GIT_OID_SHA1));
/* place some tail material */
- big[GIT_OID_HEXSZ+0] = 'W'; /* should be '\0' afterwards */
- big[GIT_OID_HEXSZ+1] = 'X'; /* should remain untouched */
- big[GIT_OID_HEXSZ+2] = 'Y'; /* ditto */
- big[GIT_OID_HEXSZ+3] = 'Z'; /* ditto */
+ big[GIT_OID_SHA1_HEXSIZE+0] = 'W'; /* should be '\0' afterwards */
+ big[GIT_OID_SHA1_HEXSIZE+1] = 'X'; /* should remain untouched */
+ big[GIT_OID_SHA1_HEXSIZE+2] = 'Y'; /* ditto */
+ big[GIT_OID_SHA1_HEXSIZE+3] = 'Z'; /* ditto */
/* returns big as hex formatted c-string */
str = git_oid_tostr(big, sizeof(big), &in);
- cl_assert(str && str == big && *(str+GIT_OID_HEXSZ) == '\0');
+ cl_assert(str && str == big && *(str+GIT_OID_SHA1_HEXSIZE) == '\0');
cl_assert_equal_s(exp, big);
/* check tail material is untouched */
- cl_assert(str && str == big && *(str+GIT_OID_HEXSZ+1) == 'X');
- cl_assert(str && str == big && *(str+GIT_OID_HEXSZ+2) == 'Y');
- cl_assert(str && str == big && *(str+GIT_OID_HEXSZ+3) == 'Z');
+ cl_assert(str && str == big && *(str+GIT_OID_SHA1_HEXSIZE+1) == 'X');
+ cl_assert(str && str == big && *(str+GIT_OID_SHA1_HEXSIZE+2) == 'Y');
+ cl_assert(str && str == big && *(str+GIT_OID_SHA1_HEXSIZE+3) == 'Z');
}
static void check_partial_oid(
@@ -86,14 +86,14 @@ void test_object_raw_convert__convert_oid_partially(void)
{
const char *exp = "16a0123456789abcdef4b775213c23a8bd74f5e0";
git_oid in;
- char big[GIT_OID_HEXSZ + 1 + 3]; /* note + 4 => big buffer */
+ char big[GIT_OID_SHA1_HEXSIZE + 1 + 3]; /* note + 4 => big buffer */
- cl_git_pass(git_oid_fromstr(&in, exp));
+ cl_git_pass(git_oid__fromstr(&in, exp, GIT_OID_SHA1));
git_oid_nfmt(big, sizeof(big), &in);
cl_assert_equal_s(exp, big);
- git_oid_nfmt(big, GIT_OID_HEXSZ + 1, &in);
+ git_oid_nfmt(big, GIT_OID_SHA1_HEXSIZE + 1, &in);
cl_assert_equal_s(exp, big);
check_partial_oid(big, 1, &in, "1");
@@ -102,11 +102,11 @@ void test_object_raw_convert__convert_oid_partially(void)
check_partial_oid(big, 4, &in, "16a0");
check_partial_oid(big, 5, &in, "16a01");
- check_partial_oid(big, GIT_OID_HEXSZ, &in, exp);
+ check_partial_oid(big, GIT_OID_SHA1_HEXSIZE, &in, exp);
check_partial_oid(
- big, GIT_OID_HEXSZ - 1, &in, "16a0123456789abcdef4b775213c23a8bd74f5e");
+ big, GIT_OID_SHA1_HEXSIZE - 1, &in, "16a0123456789abcdef4b775213c23a8bd74f5e");
check_partial_oid(
- big, GIT_OID_HEXSZ - 2, &in, "16a0123456789abcdef4b775213c23a8bd74f5");
+ big, GIT_OID_SHA1_HEXSIZE - 2, &in, "16a0123456789abcdef4b775213c23a8bd74f5");
check_partial_oid(
- big, GIT_OID_HEXSZ - 3, &in, "16a0123456789abcdef4b775213c23a8bd74f");
+ big, GIT_OID_SHA1_HEXSIZE - 3, &in, "16a0123456789abcdef4b775213c23a8bd74f");
}
diff --git a/tests/libgit2/object/raw/fromstr.c b/tests/libgit2/object/raw/fromstr.c
index 8c11c105f..302d362d7 100644
--- a/tests/libgit2/object/raw/fromstr.c
+++ b/tests/libgit2/object/raw/fromstr.c
@@ -6,9 +6,9 @@
void test_object_raw_fromstr__fail_on_invalid_oid_string(void)
{
git_oid out;
- cl_git_fail(git_oid_fromstr(&out, ""));
- cl_git_fail(git_oid_fromstr(&out, "moo"));
- cl_git_fail(git_oid_fromstr(&out, "16a67770b7d8d72317c4b775213c23a8bd74f5ez"));
+ cl_git_fail(git_oid__fromstr(&out, "", GIT_OID_SHA1));
+ cl_git_fail(git_oid__fromstr(&out, "moo", GIT_OID_SHA1));
+ cl_git_fail(git_oid__fromstr(&out, "16a67770b7d8d72317c4b775213c23a8bd74f5ez", GIT_OID_SHA1));
}
void test_object_raw_fromstr__succeed_on_valid_oid_string(void)
@@ -21,10 +21,9 @@ void test_object_raw_fromstr__succeed_on_valid_oid_string(void)
0xa8, 0xbd, 0x74, 0xf5, 0xe0,
};
- cl_git_pass(git_oid_fromstr(&out, "16a67770b7d8d72317c4b775213c23a8bd74f5e0"));
- cl_git_pass(memcmp(out.id, exp, sizeof(out.id)));
-
- cl_git_pass(git_oid_fromstr(&out, "16A67770B7D8D72317C4b775213C23A8BD74F5E0"));
- cl_git_pass(memcmp(out.id, exp, sizeof(out.id)));
+ cl_git_pass(git_oid__fromstr(&out, "16a67770b7d8d72317c4b775213c23a8bd74f5e0", GIT_OID_SHA1));
+ cl_git_pass(memcmp(out.id, exp, GIT_OID_SHA1_SIZE));
+ cl_git_pass(git_oid__fromstr(&out, "16A67770B7D8D72317C4b775213C23A8BD74F5E0", GIT_OID_SHA1));
+ cl_git_pass(memcmp(out.id, exp, GIT_OID_SHA1_SIZE));
}
diff --git a/tests/libgit2/object/raw/hash.c b/tests/libgit2/object/raw/hash.c
index 8f22fe0ee..0df1afc3a 100644
--- a/tests/libgit2/object/raw/hash.c
+++ b/tests/libgit2/object/raw/hash.c
@@ -8,11 +8,11 @@
static void hash_object_pass(git_oid *oid, git_rawobj *obj)
{
- cl_git_pass(git_odb_hash(oid, obj->data, obj->len, obj->type));
+ cl_git_pass(git_odb__hash(oid, obj->data, obj->len, obj->type, GIT_OID_SHA1));
}
static void hash_object_fail(git_oid *oid, git_rawobj *obj)
{
- cl_git_fail(git_odb_hash(oid, obj->data, obj->len, obj->type));
+ cl_git_fail(git_odb__hash(oid, obj->data, obj->len, obj->type, GIT_OID_SHA1));
}
static char *hello_id = "22596363b3de40b06f981fb85d82312e8c0ed511";
@@ -32,16 +32,16 @@ void test_object_raw_hash__hash_by_blocks(void)
/* should already be init'd */
cl_git_pass(git_hash_update(&ctx, hello_text, strlen(hello_text)));
cl_git_pass(git_hash_final(hash, &ctx));
- cl_git_pass(git_oid_fromraw(&id2, hash));
- cl_git_pass(git_oid_fromstr(&id1, hello_id));
+ cl_git_pass(git_oid__fromraw(&id2, hash, GIT_OID_SHA1));
+ cl_git_pass(git_oid__fromstr(&id1, hello_id, GIT_OID_SHA1));
cl_assert(git_oid_cmp(&id1, &id2) == 0);
/* reinit should permit reuse */
cl_git_pass(git_hash_init(&ctx));
cl_git_pass(git_hash_update(&ctx, bye_text, strlen(bye_text)));
cl_git_pass(git_hash_final(hash, &ctx));
- cl_git_pass(git_oid_fromraw(&id2, hash));
- cl_git_pass(git_oid_fromstr(&id1, bye_id));
+ cl_git_pass(git_oid__fromraw(&id2, hash, GIT_OID_SHA1));
+ cl_git_pass(git_oid__fromstr(&id1, bye_id, GIT_OID_SHA1));
cl_assert(git_oid_cmp(&id1, &id2) == 0);
git_hash_ctx_cleanup(&ctx);
@@ -52,9 +52,9 @@ void test_object_raw_hash__hash_buffer_in_single_call(void)
git_oid id1, id2;
unsigned char hash[GIT_HASH_SHA1_SIZE];
- cl_git_pass(git_oid_fromstr(&id1, hello_id));
+ cl_git_pass(git_oid__fromstr(&id1, hello_id, GIT_OID_SHA1));
cl_git_pass(git_hash_buf(hash, hello_text, strlen(hello_text), GIT_HASH_ALGORITHM_SHA1));
- cl_git_pass(git_oid_fromraw(&id2, hash));
+ cl_git_pass(git_oid__fromraw(&id2, hash, GIT_OID_SHA1));
cl_assert(git_oid_cmp(&id1, &id2) == 0);
}
@@ -62,15 +62,17 @@ void test_object_raw_hash__hash_vector(void)
{
git_oid id1, id2;
git_str_vec vec[2];
+ unsigned char hash[GIT_HASH_SHA1_SIZE];
- cl_git_pass(git_oid_fromstr(&id1, hello_id));
+ cl_git_pass(git_oid__fromstr(&id1, hello_id, GIT_OID_SHA1));
vec[0].data = hello_text;
vec[0].len = 4;
vec[1].data = hello_text+4;
vec[1].len = strlen(hello_text)-4;
- git_hash_vec(id2.id, vec, 2, GIT_HASH_ALGORITHM_SHA1);
+ git_hash_vec(hash, vec, 2, GIT_HASH_ALGORITHM_SHA1);
+ git_oid__fromraw(&id2, hash, GIT_OID_SHA1);
cl_assert(git_oid_cmp(&id1, &id2) == 0);
}
@@ -79,7 +81,7 @@ void test_object_raw_hash__hash_junk_data(void)
{
git_oid id, id_zero;
- cl_git_pass(git_oid_fromstr(&id_zero, zero_id));
+ cl_git_pass(git_oid__fromstr(&id_zero, zero_id, GIT_OID_SHA1));
/* invalid types: */
junk_obj.data = some_data;
@@ -114,7 +116,7 @@ void test_object_raw_hash__hash_commit_object(void)
{
git_oid id1, id2;
- cl_git_pass(git_oid_fromstr(&id1, commit_id));
+ cl_git_pass(git_oid__fromstr(&id1, commit_id, GIT_OID_SHA1));
hash_object_pass(&id2, &commit_obj);
cl_assert(git_oid_cmp(&id1, &id2) == 0);
}
@@ -123,7 +125,7 @@ void test_object_raw_hash__hash_tree_object(void)
{
git_oid id1, id2;
- cl_git_pass(git_oid_fromstr(&id1, tree_id));
+ cl_git_pass(git_oid__fromstr(&id1, tree_id, GIT_OID_SHA1));
hash_object_pass(&id2, &tree_obj);
cl_assert(git_oid_cmp(&id1, &id2) == 0);
}
@@ -132,7 +134,7 @@ void test_object_raw_hash__hash_tag_object(void)
{
git_oid id1, id2;
- cl_git_pass(git_oid_fromstr(&id1, tag_id));
+ cl_git_pass(git_oid__fromstr(&id1, tag_id, GIT_OID_SHA1));
hash_object_pass(&id2, &tag_obj);
cl_assert(git_oid_cmp(&id1, &id2) == 0);
}
@@ -141,7 +143,7 @@ void test_object_raw_hash__hash_zero_length_object(void)
{
git_oid id1, id2;
- cl_git_pass(git_oid_fromstr(&id1, zero_id));
+ cl_git_pass(git_oid__fromstr(&id1, zero_id, GIT_OID_SHA1));
hash_object_pass(&id2, &zero_obj);
cl_assert(git_oid_cmp(&id1, &id2) == 0);
}
@@ -150,7 +152,7 @@ void test_object_raw_hash__hash_one_byte_object(void)
{
git_oid id1, id2;
- cl_git_pass(git_oid_fromstr(&id1, one_id));
+ cl_git_pass(git_oid__fromstr(&id1, one_id, GIT_OID_SHA1));
hash_object_pass(&id2, &one_obj);
cl_assert(git_oid_cmp(&id1, &id2) == 0);
}
@@ -159,7 +161,7 @@ void test_object_raw_hash__hash_two_byte_object(void)
{
git_oid id1, id2;
- cl_git_pass(git_oid_fromstr(&id1, two_id));
+ cl_git_pass(git_oid__fromstr(&id1, two_id, GIT_OID_SHA1));
hash_object_pass(&id2, &two_obj);
cl_assert(git_oid_cmp(&id1, &id2) == 0);
}
@@ -168,7 +170,7 @@ void test_object_raw_hash__hash_multi_byte_object(void)
{
git_oid id1, id2;
- cl_git_pass(git_oid_fromstr(&id1, some_id));
+ cl_git_pass(git_oid__fromstr(&id1, some_id, GIT_OID_SHA1));
hash_object_pass(&id2, &some_obj);
cl_assert(git_oid_cmp(&id1, &id2) == 0);
}
diff --git a/tests/libgit2/object/raw/short.c b/tests/libgit2/object/raw/short.c
index cc2b5f62a..f867e6ba1 100644
--- a/tests/libgit2/object/raw/short.c
+++ b/tests/libgit2/object/raw/short.c
@@ -17,7 +17,7 @@ void test_object_raw_short__oid_shortener_no_duplicates(void)
git_oid_shorten_add(os, "16a0123456789abcdef4b775213c23a8bd74f5e0");
min_len = git_oid_shorten_add(os, "ce08fe4884650f067bd5703b6a59a8b3b3c99a09");
- cl_assert(min_len == GIT_OID_HEXSZ + 1);
+ cl_assert(min_len == GIT_OID_SHA1_HEXSIZE + 1);
git_oid_shorten_free(os);
}
@@ -36,11 +36,11 @@ static int insert_sequential_oids(
p_snprintf(numbuf, sizeof(numbuf), "%u", (unsigned int)i);
git_hash_buf(hashbuf, numbuf, strlen(numbuf), GIT_HASH_ALGORITHM_SHA1);
- git_oid_fromraw(&oid, hashbuf);
+ git_oid__fromraw(&oid, hashbuf, GIT_OID_SHA1);
- oids[i] = git__malloc(GIT_OID_HEXSZ + 1);
+ oids[i] = git__malloc(GIT_OID_SHA1_HEXSIZE + 1);
cl_assert(oids[i]);
- git_oid_nfmt(oids[i], GIT_OID_HEXSZ + 1, &oid);
+ git_oid_nfmt(oids[i], GIT_OID_SHA1_HEXSIZE + 1, &oid);
min_len = git_oid_shorten_add(os, oids[i]);
diff --git a/tests/libgit2/object/raw/size.c b/tests/libgit2/object/raw/size.c
index 930c6de23..a45e1d272 100644
--- a/tests/libgit2/object/raw/size.c
+++ b/tests/libgit2/object/raw/size.c
@@ -6,8 +6,8 @@
void test_object_raw_size__validate_oid_size(void)
{
git_oid out;
- cl_assert(20 == GIT_OID_RAWSZ);
- cl_assert(40 == GIT_OID_HEXSZ);
- cl_assert(sizeof(out) == GIT_OID_RAWSZ);
- cl_assert(sizeof(out.id) == GIT_OID_RAWSZ);
+
+ cl_assert(20 == GIT_OID_SHA1_SIZE);
+ cl_assert(40 == GIT_OID_SHA1_HEXSIZE);
+ cl_assert(sizeof(out.id) == GIT_OID_MAX_SIZE);
}
diff --git a/tests/libgit2/object/raw/write.c b/tests/libgit2/object/raw/write.c
index 40e05f357..346053df5 100644
--- a/tests/libgit2/object/raw/write.c
+++ b/tests/libgit2/object/raw/write.c
@@ -66,8 +66,8 @@ void test_body(object_data *d, git_rawobj *o)
git_rawobj tmp;
make_odb_dir();
- cl_git_pass(git_odb_open(&db, odb_dir));
- cl_git_pass(git_oid_fromstr(&id1, d->id));
+ cl_git_pass(git_odb__open(&db, odb_dir, NULL));
+ cl_git_pass(git_oid__fromstr(&id1, d->id, GIT_OID_SHA1));
streaming_write(&id2, db, o);
cl_assert(git_oid_cmp(&id1, &id2) == 0);
diff --git a/tests/libgit2/object/shortid.c b/tests/libgit2/object/shortid.c
index 9b673efeb..69fceeeda 100644
--- a/tests/libgit2/object/shortid.c
+++ b/tests/libgit2/object/shortid.c
@@ -19,28 +19,28 @@ void test_object_shortid__select(void)
git_object *obj;
git_buf shorty = {0};
- git_oid_fromstr(&full, "ce013625030ba8dba906f756967f9e9ca394464a");
+ git_oid__fromstr(&full, "ce013625030ba8dba906f756967f9e9ca394464a", GIT_OID_SHA1);
cl_git_pass(git_object_lookup(&obj, _repo, &full, GIT_OBJECT_ANY));
cl_git_pass(git_object_short_id(&shorty, obj));
cl_assert_equal_i(7, shorty.size);
cl_assert_equal_s("ce01362", shorty.ptr);
git_object_free(obj);
- git_oid_fromstr(&full, "038d718da6a1ebbc6a7780a96ed75a70cc2ad6e2");
+ git_oid__fromstr(&full, "038d718da6a1ebbc6a7780a96ed75a70cc2ad6e2", GIT_OID_SHA1);
cl_git_pass(git_object_lookup(&obj, _repo, &full, GIT_OBJECT_ANY));
cl_git_pass(git_object_short_id(&shorty, obj));
cl_assert_equal_i(7, shorty.size);
cl_assert_equal_s("038d718", shorty.ptr);
git_object_free(obj);
- git_oid_fromstr(&full, "dea509d097ce692e167dfc6a48a7a280cc5e877e");
+ git_oid__fromstr(&full, "dea509d097ce692e167dfc6a48a7a280cc5e877e", GIT_OID_SHA1);
cl_git_pass(git_object_lookup(&obj, _repo, &full, GIT_OBJECT_ANY));
cl_git_pass(git_object_short_id(&shorty, obj));
cl_assert_equal_i(9, shorty.size);
cl_assert_equal_s("dea509d09", shorty.ptr);
git_object_free(obj);
- git_oid_fromstr(&full, "dea509d0b3cb8ee0650f6ca210bc83f4678851ba");
+ git_oid__fromstr(&full, "dea509d0b3cb8ee0650f6ca210bc83f4678851ba", GIT_OID_SHA1);
cl_git_pass(git_object_lookup(&obj, _repo, &full, GIT_OBJECT_ANY));
cl_git_pass(git_object_short_id(&shorty, obj));
cl_assert_equal_i(9, shorty.size);
diff --git a/tests/libgit2/object/tag/parse.c b/tests/libgit2/object/tag/parse.c
index 2c0635ae4..92298b5ce 100644
--- a/tests/libgit2/object/tag/parse.c
+++ b/tests/libgit2/object/tag/parse.c
@@ -19,7 +19,7 @@ static void assert_tag_parses(const char *data, size_t datalen,
if (expected_oid) {
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_equal_oid(&oid, &tag->target);
}
diff --git a/tests/libgit2/object/tag/peel.c b/tests/libgit2/object/tag/peel.c
index 7456a8e17..db81c5aee 100644
--- a/tests/libgit2/object/tag/peel.c
+++ b/tests/libgit2/object/tag/peel.c
@@ -29,7 +29,7 @@ static void retrieve_tag_from_oid(git_tag **tag_out, git_repository *repo, const
{
git_oid oid;
- cl_git_pass(git_oid_fromstr(&oid, sha));
+ cl_git_pass(git_oid__fromstr(&oid, sha, GIT_OID_SHA1));
cl_git_pass(git_tag_lookup(tag_out, repo, &oid));
}
diff --git a/tests/libgit2/object/tag/read.c b/tests/libgit2/object/tag/read.c
index 90ba58029..6270b567a 100644
--- a/tests/libgit2/object/tag/read.c
+++ b/tests/libgit2/object/tag/read.c
@@ -32,9 +32,9 @@ void test_object_tag_read__parse(void)
git_commit *commit;
git_oid id1, id2, id_commit;
- git_oid_fromstr(&id1, tag1_id);
- git_oid_fromstr(&id2, tag2_id);
- git_oid_fromstr(&id_commit, tagged_commit);
+ git_oid__fromstr(&id1, tag1_id, GIT_OID_SHA1);
+ git_oid__fromstr(&id2, tag2_id, GIT_OID_SHA1);
+ git_oid__fromstr(&id_commit, tagged_commit, GIT_OID_SHA1);
cl_git_pass(git_tag_lookup(&tag1, g_repo, &id1));
@@ -67,8 +67,8 @@ void test_object_tag_read__parse_without_tagger(void)
/* TODO: This is a little messy */
cl_git_pass(git_repository_open(&bad_tag_repo, cl_fixture("bad_tag.git")));
- git_oid_fromstr(&id, bad_tag_id);
- git_oid_fromstr(&id_commit, badly_tagged_commit);
+ git_oid__fromstr(&id, bad_tag_id, GIT_OID_SHA1);
+ git_oid__fromstr(&id_commit, badly_tagged_commit, GIT_OID_SHA1);
cl_git_pass(git_tag_lookup(&bad_tag, bad_tag_repo, &id));
cl_assert(bad_tag != NULL);
@@ -99,8 +99,8 @@ void test_object_tag_read__parse_without_message(void)
/* TODO: This is a little messy */
cl_git_pass(git_repository_open(&short_tag_repo, cl_fixture("short_tag.git")));
- git_oid_fromstr(&id, short_tag_id);
- git_oid_fromstr(&id_commit, short_tagged_commit);
+ git_oid__fromstr(&id, short_tag_id, GIT_OID_SHA1);
+ git_oid__fromstr(&id_commit, short_tagged_commit, GIT_OID_SHA1);
cl_git_pass(git_tag_lookup(&short_tag, short_tag_repo, &id));
cl_assert(short_tag != NULL);
@@ -127,7 +127,7 @@ void test_object_tag_read__without_tagger_nor_message(void)
cl_git_pass(git_repository_open(&repo, cl_fixture("testrepo.git")));
- cl_git_pass(git_oid_fromstr(&id, taggerless));
+ cl_git_pass(git_oid__fromstr(&id, taggerless, GIT_OID_SHA1));
cl_git_pass(git_tag_lookup(&tag, repo, &id));
diff --git a/tests/libgit2/object/tag/write.c b/tests/libgit2/object/tag/write.c
index 064f328fd..79e01452a 100644
--- a/tests/libgit2/object/tag/write.c
+++ b/tests/libgit2/object/tag/write.c
@@ -30,7 +30,7 @@ void test_object_tag_write__basic(void)
git_reference *ref_tag;
git_object *target;
- git_oid_fromstr(&target_id, tagged_commit);
+ git_oid__fromstr(&target_id, tagged_commit, GIT_OID_SHA1);
cl_git_pass(git_object_lookup(&target, g_repo, &target_id, GIT_OBJECT_COMMIT));
/* create signature */
@@ -72,7 +72,7 @@ void test_object_tag_write__overwrite(void)
git_signature *tagger;
git_object *target;
- git_oid_fromstr(&target_id, tagged_commit);
+ git_oid__fromstr(&target_id, tagged_commit, GIT_OID_SHA1);
cl_git_pass(git_object_lookup(&target, g_repo, &target_id, GIT_OBJECT_COMMIT));
/* create signature */
@@ -99,7 +99,7 @@ void test_object_tag_write__replace(void)
git_reference *ref_tag;
git_object *target;
- git_oid_fromstr(&target_id, tagged_commit);
+ git_oid__fromstr(&target_id, tagged_commit, GIT_OID_SHA1);
cl_git_pass(git_object_lookup(&target, g_repo, &target_id, GIT_OBJECT_COMMIT));
cl_git_pass(git_reference_lookup(&ref_tag, g_repo, "refs/tags/e90810b"));
@@ -135,7 +135,7 @@ void test_object_tag_write__lightweight(void)
git_reference *ref_tag;
git_object *target;
- git_oid_fromstr(&target_id, tagged_commit);
+ git_oid__fromstr(&target_id, tagged_commit, GIT_OID_SHA1);
cl_git_pass(git_object_lookup(&target, g_repo, &target_id, GIT_OBJECT_COMMIT));
cl_git_pass(git_tag_create_lightweight(
@@ -163,7 +163,7 @@ void test_object_tag_write__lightweight_over_existing(void)
git_oid target_id, object_id, existing_object_id;
git_object *target;
- git_oid_fromstr(&target_id, tagged_commit);
+ git_oid__fromstr(&target_id, tagged_commit, GIT_OID_SHA1);
cl_git_pass(git_object_lookup(&target, g_repo, &target_id, GIT_OBJECT_COMMIT));
cl_assert_equal_i(GIT_EEXISTS, git_tag_create_lightweight(
@@ -173,7 +173,7 @@ void test_object_tag_write__lightweight_over_existing(void)
target,
0));
- git_oid_fromstr(&existing_object_id, tag2_id);
+ git_oid__fromstr(&existing_object_id, tag2_id, GIT_OID_SHA1);
cl_assert(git_oid_cmp(&object_id, &existing_object_id) == 0);
git_object_free(target);
@@ -197,7 +197,7 @@ void test_object_tag_write__creating_with_an_invalid_name_returns_EINVALIDSPEC(v
git_signature *tagger;
git_object *target;
- git_oid_fromstr(&target_id, tagged_commit);
+ git_oid__fromstr(&target_id, tagged_commit, GIT_OID_SHA1);
cl_git_pass(git_object_lookup(&target, g_repo, &target_id, GIT_OBJECT_COMMIT));
cl_git_pass(git_signature_new(&tagger, tagger_name, tagger_email, 123456789, 60));
@@ -229,7 +229,7 @@ static void create_annotation(git_oid *tag_id, const char *name)
cl_git_pass(git_signature_new(&tagger, tagger_name, tagger_email, 123456789, 60));
- git_oid_fromstr(&target_id, tagged_commit);
+ git_oid__fromstr(&target_id, tagged_commit, GIT_OID_SHA1);
cl_git_pass(git_object_lookup(&target, g_repo, &target_id, GIT_OBJECT_COMMIT));
cl_git_pass(git_tag_annotation_create(tag_id, g_repo, name, target, tagger, "boom!"));
@@ -265,7 +265,7 @@ void test_object_tag_write__error_when_create_tag_with_invalid_name(void)
git_signature *tagger;
git_object *target;
- git_oid_fromstr(&target_id, tagged_commit);
+ git_oid__fromstr(&target_id, tagged_commit, GIT_OID_SHA1);
cl_git_pass(git_object_lookup(&target, g_repo, &target_id, GIT_OBJECT_COMMIT));
cl_git_pass(git_signature_new(&tagger, tagger_name, tagger_email, 123456789, 60));
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));
diff --git a/tests/libgit2/odb/alternates.c b/tests/libgit2/odb/alternates.c
index 6c00fda2f..4d2da6b1f 100644
--- a/tests/libgit2/odb/alternates.c
+++ b/tests/libgit2/odb/alternates.c
@@ -52,7 +52,7 @@ void test_odb_alternates__chained(void)
/* Now load B and see if we can find an object from testrepo.git */
cl_git_pass(git_repository_open(&repo, paths[1]));
- git_oid_fromstr(&oid, "a65fedf39aefe402d3bb6e24df4d4f5fe4547750");
+ git_oid__fromstr(&oid, "a65fedf39aefe402d3bb6e24df4d4f5fe4547750", GIT_OID_SHA1);
cl_git_pass(git_commit_lookup(&commit, repo, &oid));
git_commit_free(commit);
git_repository_free(repo);
@@ -74,7 +74,7 @@ void test_odb_alternates__long_chain(void)
/* Now load the last one and see if we can find an object from testrepo.git */
cl_git_pass(git_repository_open(&repo, paths[ARRAY_SIZE(paths)-1]));
- git_oid_fromstr(&oid, "a65fedf39aefe402d3bb6e24df4d4f5fe4547750");
+ git_oid__fromstr(&oid, "a65fedf39aefe402d3bb6e24df4d4f5fe4547750", GIT_OID_SHA1);
cl_git_fail(git_commit_lookup(&commit, repo, &oid));
git_repository_free(repo);
}
diff --git a/tests/libgit2/odb/backend/backend_helpers.c b/tests/libgit2/odb/backend/backend_helpers.c
index 542799242..c1a0070d6 100644
--- a/tests/libgit2/odb/backend/backend_helpers.c
+++ b/tests/libgit2/odb/backend/backend_helpers.c
@@ -9,7 +9,7 @@ static int search_object(const fake_object **out, fake_backend *fake, const git_
while (obj && obj->oid) {
git_oid current_oid;
- git_oid_fromstr(&current_oid, obj->oid);
+ git_oid__fromstr(&current_oid, obj->oid, GIT_OID_SHA1);
if (git_oid_ncmp(&current_oid, oid, len) == 0) {
if (found)
@@ -34,7 +34,7 @@ static int fake_backend__exists(git_odb_backend *backend, const git_oid *oid)
fake->exists_calls++;
- return search_object(NULL, fake, oid, GIT_OID_HEXSZ) == GIT_OK;
+ return search_object(NULL, fake, oid, GIT_OID_SHA1_HEXSIZE) == GIT_OK;
}
static int fake_backend__exists_prefix(
@@ -52,7 +52,7 @@ static int fake_backend__exists_prefix(
return error;
if (out)
- git_oid_fromstr(out, obj->oid);
+ git_oid__fromstr(out, obj->oid, GIT_OID_SHA1);
return 0;
}
@@ -69,7 +69,7 @@ static int fake_backend__read(
fake->read_calls++;
- if ((error = search_object(&obj, fake, oid, GIT_OID_HEXSZ)) < 0)
+ if ((error = search_object(&obj, fake, oid, GIT_OID_SHA1_HEXSIZE)) < 0)
return error;
*len_p = strlen(obj->content);
@@ -91,7 +91,7 @@ static int fake_backend__read_header(
fake->read_header_calls++;
- if ((error = search_object(&obj, fake, oid, GIT_OID_HEXSZ)) < 0)
+ if ((error = search_object(&obj, fake, oid, GIT_OID_SHA1_HEXSIZE)) < 0)
return error;
*len_p = strlen(obj->content);
@@ -115,7 +115,7 @@ static int fake_backend__read_prefix(
if ((error = search_object(&obj, fake, short_oid, len)) < 0)
return error;
- git_oid_fromstr(out_oid, obj->oid);
+ git_oid__fromstr(out_oid, obj->oid, GIT_OID_SHA1);
*len_p = strlen(obj->content);
*buffer_p = git__strdup(obj->content);
*type_p = GIT_OBJECT_BLOB;
diff --git a/tests/libgit2/odb/backend/mempack.c b/tests/libgit2/odb/backend/mempack.c
index 2eeed51aa..eb8ab3cb0 100644
--- a/tests/libgit2/odb/backend/mempack.c
+++ b/tests/libgit2/odb/backend/mempack.c
@@ -1,5 +1,6 @@
#include "clar_libgit2.h"
#include "repository.h"
+#include "odb.h"
#include "backend_helpers.h"
#include "git2/sys/mempack.h"
@@ -13,7 +14,7 @@ void test_odb_backend_mempack__initialize(void)
git_odb_backend *backend;
cl_git_pass(git_mempack_new(&backend));
- cl_git_pass(git_odb_new(&_odb));
+ cl_git_pass(git_odb__new(&_odb, NULL));
cl_git_pass(git_odb_add_backend(_odb, backend, 10));
cl_git_pass(git_repository_wrap_odb(&_repo, _odb));
}
@@ -34,13 +35,13 @@ void test_odb_backend_mempack__write_succeeds(void)
void test_odb_backend_mempack__read_of_missing_object_fails(void)
{
- cl_git_pass(git_oid_fromstr(&_oid, "f6ea0495187600e7b2288c8ac19c5886383a4633"));
+ cl_git_pass(git_oid__fromstr(&_oid, "f6ea0495187600e7b2288c8ac19c5886383a4633", GIT_OID_SHA1));
cl_git_fail_with(GIT_ENOTFOUND, git_odb_read(&_obj, _odb, &_oid));
}
void test_odb_backend_mempack__exists_of_missing_object_fails(void)
{
- cl_git_pass(git_oid_fromstr(&_oid, "f6ea0495187600e7b2288c8ac19c5886383a4633"));
+ cl_git_pass(git_oid__fromstr(&_oid, "f6ea0495187600e7b2288c8ac19c5886383a4633", GIT_OID_SHA1));
cl_assert(git_odb_exists(_odb, &_oid) == 0);
}
diff --git a/tests/libgit2/odb/backend/multiple.c b/tests/libgit2/odb/backend/multiple.c
index 5f1eacd52..97588164d 100644
--- a/tests/libgit2/odb/backend/multiple.c
+++ b/tests/libgit2/odb/backend/multiple.c
@@ -24,7 +24,7 @@ void test_odb_backend_multiple__initialize(void)
{
git_odb_backend *backend;
- git_oid_fromstr(&_existing_oid, EXISTING_HASH);
+ git_oid__fromstr(&_existing_oid, EXISTING_HASH, GIT_OID_SHA1);
_obj = NULL;
_repo = cl_git_sandbox_init("testrepo.git");
diff --git a/tests/libgit2/odb/backend/nobackend.c b/tests/libgit2/odb/backend/nobackend.c
index 7484d423b..7d9394c6f 100644
--- a/tests/libgit2/odb/backend/nobackend.c
+++ b/tests/libgit2/odb/backend/nobackend.c
@@ -1,5 +1,6 @@
#include "clar_libgit2.h"
#include "repository.h"
+#include "odb.h"
#include "git2/sys/repository.h"
static git_repository *_repo;
@@ -12,7 +13,7 @@ void test_odb_backend_nobackend__initialize(void)
cl_git_pass(git_repository_new(&_repo));
cl_git_pass(git_config_new(&config));
- cl_git_pass(git_odb_new(&odb));
+ cl_git_pass(git_odb__new(&odb, NULL));
cl_git_pass(git_refdb_new(&refdb, _repo));
git_repository_set_config(_repo, config);
diff --git a/tests/libgit2/odb/backend/nonrefreshing.c b/tests/libgit2/odb/backend/nonrefreshing.c
index 2db10efbc..5084eb7f7 100644
--- a/tests/libgit2/odb/backend/nonrefreshing.c
+++ b/tests/libgit2/odb/backend/nonrefreshing.c
@@ -33,8 +33,8 @@ static void setup_repository_and_backend(void)
void test_odb_backend_nonrefreshing__initialize(void)
{
- git_oid_fromstr(&_nonexisting_oid, NONEXISTING_HASH);
- git_oid_fromstr(&_existing_oid, EXISTING_HASH);
+ git_oid__fromstr(&_nonexisting_oid, NONEXISTING_HASH, GIT_OID_SHA1);
+ git_oid__fromstr(&_existing_oid, EXISTING_HASH, GIT_OID_SHA1);
setup_repository_and_backend();
}
diff --git a/tests/libgit2/odb/backend/refreshing.c b/tests/libgit2/odb/backend/refreshing.c
index 9e49298a8..fcba748ee 100644
--- a/tests/libgit2/odb/backend/refreshing.c
+++ b/tests/libgit2/odb/backend/refreshing.c
@@ -33,8 +33,8 @@ static void setup_repository_and_backend(void)
void test_odb_backend_refreshing__initialize(void)
{
- git_oid_fromstr(&_nonexisting_oid, NONEXISTING_HASH);
- git_oid_fromstr(&_existing_oid, EXISTING_HASH);
+ git_oid__fromstr(&_nonexisting_oid, NONEXISTING_HASH, GIT_OID_SHA1);
+ git_oid__fromstr(&_existing_oid, EXISTING_HASH, GIT_OID_SHA1);
setup_repository_and_backend();
}
diff --git a/tests/libgit2/odb/backend/simple.c b/tests/libgit2/odb/backend/simple.c
index 6c9293ac0..25dfd90a2 100644
--- a/tests/libgit2/odb/backend/simple.c
+++ b/tests/libgit2/odb/backend/simple.c
@@ -49,7 +49,7 @@ void test_odb_backend_simple__read_of_object_succeeds(void)
setup_backend(objs);
- cl_git_pass(git_oid_fromstr(&_oid, objs[0].oid));
+ cl_git_pass(git_oid__fromstr(&_oid, objs[0].oid, GIT_OID_SHA1));
cl_git_pass(git_odb_read(&_obj, _odb, &_oid));
assert_object_contains(_obj, objs[0].content);
@@ -64,7 +64,7 @@ void test_odb_backend_simple__read_of_nonexisting_object_fails(void)
setup_backend(objs);
- cl_git_pass(git_oid_fromstr(&_oid, "f6ea0495187600e7b2288c8ac19c5886383a4633"));
+ cl_git_pass(git_oid__fromstr(&_oid, "f6ea0495187600e7b2288c8ac19c5886383a4633", GIT_OID_SHA1));
cl_git_fail_with(GIT_ENOTFOUND, git_odb_read(&_obj, _odb, &_oid));
}
@@ -77,7 +77,7 @@ void test_odb_backend_simple__read_with_hash_mismatch_fails(void)
setup_backend(objs);
- cl_git_pass(git_oid_fromstr(&_oid, objs[0].oid));
+ cl_git_pass(git_oid__fromstr(&_oid, objs[0].oid, GIT_OID_SHA1));
cl_git_fail_with(GIT_EMISMATCH, git_odb_read(&_obj, _odb, &_oid));
}
@@ -89,7 +89,7 @@ void test_odb_backend_simple__read_with_hash_mismatch_succeeds_without_verificat
};
setup_backend(objs);
- cl_git_pass(git_oid_fromstr(&_oid, objs[0].oid));
+ cl_git_pass(git_oid__fromstr(&_oid, objs[0].oid, GIT_OID_SHA1));
cl_git_pass(git_libgit2_opts(GIT_OPT_ENABLE_STRICT_HASH_VERIFICATION, 0));
cl_git_pass(git_odb_read(&_obj, _odb, &_oid));
@@ -106,7 +106,7 @@ void test_odb_backend_simple__read_prefix_succeeds(void)
setup_backend(objs);
- cl_git_pass(git_oid_fromstr(&_oid, "f6ea0495187600e7b2288c8ac19c5886383a4632"));
+ cl_git_pass(git_oid__fromstr(&_oid, "f6ea0495187600e7b2288c8ac19c5886383a4632", GIT_OID_SHA1));
cl_git_pass(git_odb_read(&_obj, _odb, &_oid));
assert_object_contains(_obj, objs[0].content);
@@ -122,7 +122,7 @@ void test_odb_backend_simple__read_prefix_of_nonexisting_object_fails(void)
setup_backend(objs);
- cl_git_pass(git_oid_fromstrn(&_oid, hash, strlen(hash)));
+ cl_git_pass(git_oid__fromstrn(&_oid, hash, strlen(hash), GIT_OID_SHA1));
cl_git_fail_with(GIT_ENOTFOUND, git_odb_read(&_obj, _odb, &_oid));
}
@@ -136,7 +136,7 @@ void test_odb_backend_simple__read_with_ambiguous_prefix_fails(void)
setup_backend(objs);
- cl_git_pass(git_oid_fromstr(&_oid, objs[0].oid));
+ cl_git_pass(git_oid__fromstr(&_oid, objs[0].oid, GIT_OID_SHA1));
cl_git_fail_with(GIT_EAMBIGUOUS, git_odb_read_prefix(&_obj, _odb, &_oid, 7));
}
@@ -150,7 +150,7 @@ void test_odb_backend_simple__read_with_highly_ambiguous_prefix(void)
setup_backend(objs);
- cl_git_pass(git_oid_fromstr(&_oid, objs[0].oid));
+ cl_git_pass(git_oid__fromstr(&_oid, objs[0].oid, GIT_OID_SHA1));
cl_git_pass(git_libgit2_opts(GIT_OPT_ENABLE_STRICT_HASH_VERIFICATION, 0));
cl_git_fail_with(GIT_EAMBIGUOUS, git_odb_read_prefix(&_obj, _odb, &_oid, 39));
cl_git_pass(git_odb_read_prefix(&_obj, _odb, &_oid, 40));
@@ -166,7 +166,7 @@ void test_odb_backend_simple__exists_succeeds(void)
setup_backend(objs);
- cl_git_pass(git_oid_fromstr(&_oid, objs[0].oid));
+ cl_git_pass(git_oid__fromstr(&_oid, objs[0].oid, GIT_OID_SHA1));
cl_assert(git_odb_exists(_odb, &_oid));
}
@@ -179,7 +179,7 @@ void test_odb_backend_simple__exists_fails_for_nonexisting_object(void)
setup_backend(objs);
- cl_git_pass(git_oid_fromstr(&_oid, "f6ea0495187600e7b2288c8ac19c5886383a4633"));
+ cl_git_pass(git_oid__fromstr(&_oid, "f6ea0495187600e7b2288c8ac19c5886383a4633", GIT_OID_SHA1));
cl_assert(git_odb_exists(_odb, &_oid) == 0);
}
@@ -194,7 +194,7 @@ void test_odb_backend_simple__exists_prefix_succeeds(void)
setup_backend(objs);
- cl_git_pass(git_oid_fromstr(&_oid, objs[0].oid));
+ cl_git_pass(git_oid__fromstr(&_oid, objs[0].oid, GIT_OID_SHA1));
cl_git_pass(git_odb_exists_prefix(&found, _odb, &_oid, 12));
cl_assert(git_oid_equal(&found, &_oid));
}
@@ -209,7 +209,7 @@ void test_odb_backend_simple__exists_with_ambiguous_prefix_fails(void)
setup_backend(objs);
- cl_git_pass(git_oid_fromstr(&_oid, objs[0].oid));
+ cl_git_pass(git_oid__fromstr(&_oid, objs[0].oid, GIT_OID_SHA1));
cl_git_fail_with(GIT_EAMBIGUOUS, git_odb_exists_prefix(NULL, _odb, &_oid, 7));
}
@@ -224,7 +224,7 @@ void test_odb_backend_simple__exists_with_highly_ambiguous_prefix(void)
setup_backend(objs);
- cl_git_pass(git_oid_fromstr(&_oid, objs[0].oid));
+ cl_git_pass(git_oid__fromstr(&_oid, objs[0].oid, GIT_OID_SHA1));
cl_git_pass(git_libgit2_opts(GIT_OPT_ENABLE_STRICT_HASH_VERIFICATION, 0));
cl_git_fail_with(GIT_EAMBIGUOUS, git_odb_exists_prefix(&found, _odb, &_oid, 39));
cl_git_pass(git_odb_exists_prefix(&found, _odb, &_oid, 40));
@@ -237,7 +237,7 @@ void test_odb_backend_simple__null_oid_is_ignored(void)
{ "0000000000000000000000000000000000000000", "null oid content" },
{ NULL, NULL }
};
- git_oid null_oid = {{0}};
+ git_oid null_oid = GIT_OID_SHA1_ZERO;
git_odb_object *obj;
setup_backend(objs);
diff --git a/tests/libgit2/odb/emptyobjects.c b/tests/libgit2/odb/emptyobjects.c
index e3ec62d3f..e7cc668d1 100644
--- a/tests/libgit2/odb/emptyobjects.c
+++ b/tests/libgit2/odb/emptyobjects.c
@@ -24,7 +24,7 @@ void test_odb_emptyobjects__blob_notfound(void)
git_oid id, written_id;
git_blob *blob;
- cl_git_pass(git_oid_fromstr(&id, "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391"));
+ cl_git_pass(git_oid__fromstr(&id, "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391", GIT_OID_SHA1));
cl_git_fail_with(GIT_ENOTFOUND, git_blob_lookup(&blob, g_repo, &id));
cl_git_pass(git_odb_write(&written_id, g_odb, "", 0, GIT_OBJECT_BLOB));
@@ -36,7 +36,7 @@ void test_odb_emptyobjects__read_tree(void)
git_oid id;
git_tree *tree;
- cl_git_pass(git_oid_fromstr(&id, "4b825dc642cb6eb9a060e54bf8d69288fbee4904"));
+ cl_git_pass(git_oid__fromstr(&id, "4b825dc642cb6eb9a060e54bf8d69288fbee4904", GIT_OID_SHA1));
cl_git_pass(git_tree_lookup(&tree, g_repo, &id));
cl_assert_equal_i(GIT_OBJECT_TREE, git_object_type((git_object *) tree));
cl_assert_equal_i(0, git_tree_entrycount(tree));
@@ -49,7 +49,7 @@ void test_odb_emptyobjects__read_tree_odb(void)
git_oid id;
git_odb_object *tree_odb;
- cl_git_pass(git_oid_fromstr(&id, "4b825dc642cb6eb9a060e54bf8d69288fbee4904"));
+ cl_git_pass(git_oid__fromstr(&id, "4b825dc642cb6eb9a060e54bf8d69288fbee4904", GIT_OID_SHA1));
cl_git_pass(git_odb_read(&tree_odb, g_odb, &id));
cl_assert(git_odb_object_data(tree_odb));
cl_assert_equal_s("", git_odb_object_data(tree_odb));
diff --git a/tests/libgit2/odb/foreach.c b/tests/libgit2/odb/foreach.c
index c2a448363..165a511a0 100644
--- a/tests/libgit2/odb/foreach.c
+++ b/tests/libgit2/odb/foreach.c
@@ -51,7 +51,7 @@ void test_odb_foreach__one_pack(void)
git_odb_backend *backend = NULL;
int nobj = 0;
- cl_git_pass(git_odb_new(&_odb));
+ cl_git_pass(git_odb__new(&_odb, NULL));
cl_git_pass(git_odb_backend_one_pack(&backend, cl_fixture("testrepo.git/objects/pack/pack-a81e489679b7d3418f9ab594bda8ceb37dd4c695.idx")));
cl_git_pass(git_odb_add_backend(_odb, backend, 1));
_repo = NULL;
diff --git a/tests/libgit2/odb/freshen.c b/tests/libgit2/odb/freshen.c
index 2396e3774..e337c82b7 100644
--- a/tests/libgit2/odb/freshen.c
+++ b/tests/libgit2/odb/freshen.c
@@ -43,7 +43,7 @@ void test_odb_freshen__loose_blob(void)
git_oid expected_id, id;
struct stat before, after;
- cl_git_pass(git_oid_fromstr(&expected_id, LOOSE_BLOB_ID));
+ cl_git_pass(git_oid__fromstr(&expected_id, LOOSE_BLOB_ID, GIT_OID_SHA1));
set_time_wayback(&before, LOOSE_BLOB_FN);
/* make sure we freshen a blob */
@@ -64,7 +64,7 @@ void test_odb_freshen__readonly_object(void)
git_oid expected_id, id;
struct stat before, after;
- cl_git_pass(git_oid_fromstr(&expected_id, UNIQUE_BLOB_ID));
+ cl_git_pass(git_oid__fromstr(&expected_id, UNIQUE_BLOB_ID, GIT_OID_SHA1));
cl_git_pass(git_blob_create_from_buffer(&id, repo, UNIQUE_STR, CONST_STRLEN(UNIQUE_STR)));
cl_assert_equal_oid(&expected_id, &id);
@@ -89,7 +89,7 @@ void test_odb_freshen__loose_tree(void)
git_tree *tree;
struct stat before, after;
- cl_git_pass(git_oid_fromstr(&expected_id, LOOSE_TREE_ID));
+ cl_git_pass(git_oid__fromstr(&expected_id, LOOSE_TREE_ID, GIT_OID_SHA1));
set_time_wayback(&before, LOOSE_TREE_FN);
cl_git_pass(git_tree_lookup(&tree, repo, &expected_id));
@@ -113,11 +113,11 @@ void test_odb_freshen__tree_during_commit(void)
git_signature *signature;
struct stat before, after;
- cl_git_pass(git_oid_fromstr(&tree_id, LOOSE_TREE_ID));
+ cl_git_pass(git_oid__fromstr(&tree_id, LOOSE_TREE_ID, GIT_OID_SHA1));
cl_git_pass(git_tree_lookup(&tree, repo, &tree_id));
set_time_wayback(&before, LOOSE_TREE_FN);
- cl_git_pass(git_oid_fromstr(&parent_id, "a65fedf39aefe402d3bb6e24df4d4f5fe4547750"));
+ cl_git_pass(git_oid__fromstr(&parent_id, "a65fedf39aefe402d3bb6e24df4d4f5fe4547750", GIT_OID_SHA1));
cl_git_pass(git_commit_lookup(&parent, repo, &parent_id));
cl_git_pass(git_signature_new(&signature,
@@ -147,7 +147,7 @@ void test_odb_freshen__packed_object(void)
struct stat before, after;
struct p_timeval old_times[2];
- cl_git_pass(git_oid_fromstr(&expected_id, PACKED_ID));
+ cl_git_pass(git_oid__fromstr(&expected_id, PACKED_ID, GIT_OID_SHA1));
old_times[0].tv_sec = 1234567890;
old_times[0].tv_usec = 0;
diff --git a/tests/libgit2/odb/largefiles.c b/tests/libgit2/odb/largefiles.c
index acc786ee4..2ec48102b 100644
--- a/tests/libgit2/odb/largefiles.c
+++ b/tests/libgit2/odb/largefiles.c
@@ -57,7 +57,7 @@ void test_odb_largefiles__write_from_memory(void)
for (i = 0; i < (3041*126103); i++)
cl_git_pass(git_str_puts(&buf, "Hello, world.\n"));
- git_oid_fromstr(&expected, "3fb56989cca483b21ba7cb0a6edb229d10e1c26c");
+ git_oid__fromstr(&expected, "3fb56989cca483b21ba7cb0a6edb229d10e1c26c", GIT_OID_SHA1);
cl_git_pass(git_odb_write(&oid, odb, buf.ptr, buf.size, GIT_OBJECT_BLOB));
cl_assert_equal_oid(&expected, &oid);
@@ -75,7 +75,7 @@ void test_odb_largefiles__streamwrite(void)
!cl_is_env_set("GITTEST_SLOW"))
cl_skip();
- git_oid_fromstr(&expected, "3fb56989cca483b21ba7cb0a6edb229d10e1c26c");
+ git_oid__fromstr(&expected, "3fb56989cca483b21ba7cb0a6edb229d10e1c26c", GIT_OID_SHA1);
writefile(&oid);
cl_assert_equal_oid(&expected, &oid);
diff --git a/tests/libgit2/odb/loose.c b/tests/libgit2/odb/loose.c
index fe013a78c..e79525478 100644
--- a/tests/libgit2/odb/loose.c
+++ b/tests/libgit2/odb/loose.c
@@ -34,24 +34,27 @@ static void cmp_objects(git_rawobj *o, object_data *d)
static void test_read_object(object_data *data)
{
- git_oid id;
- git_odb_object *obj;
+ git_oid id;
+ git_odb_object *obj;
git_odb *odb;
git_rawobj tmp;
+ git_odb_options opts = GIT_ODB_OPTIONS_INIT;
+
+ opts.oid_type = data->id_type;
- write_object_files(data);
+ write_object_files(data);
- cl_git_pass(git_odb_open(&odb, "test-objects"));
- cl_git_pass(git_oid_fromstr(&id, data->id));
- cl_git_pass(git_odb_read(&obj, odb, &id));
+ cl_git_pass(git_odb__open(&odb, "test-objects", &opts));
+ cl_git_pass(git_oid__fromstr(&id, data->id, data->id_type));
+ cl_git_pass(git_odb_read(&obj, odb, &id));
tmp.data = obj->buffer;
tmp.len = obj->cached.size;
tmp.type = obj->cached.type;
- cmp_objects(&tmp, data);
+ cmp_objects(&tmp, data);
- git_odb_object_free(obj);
+ git_odb_object_free(obj);
git_odb_free(odb);
}
@@ -61,11 +64,14 @@ static void test_read_header(object_data *data)
git_odb *odb;
size_t len;
git_object_t type;
+ git_odb_options opts = GIT_ODB_OPTIONS_INIT;
+
+ opts.oid_type = data->id_type;
write_object_files(data);
- cl_git_pass(git_odb_open(&odb, "test-objects"));
- cl_git_pass(git_oid_fromstr(&id, data->id));
+ cl_git_pass(git_odb__open(&odb, "test-objects", &opts));
+ cl_git_pass(git_oid__fromstr(&id, data->id, data->id_type));
cl_git_pass(git_odb_read_header(&len, &type, odb, &id));
cl_assert_equal_sz(data->dlen, len);
@@ -83,11 +89,14 @@ static void test_readstream_object(object_data *data, size_t blocksize)
char buf[2048], *ptr = buf;
size_t remain;
int ret;
+ git_odb_options opts = GIT_ODB_OPTIONS_INIT;
+
+ opts.oid_type = data->id_type;
write_object_files(data);
- cl_git_pass(git_odb_open(&odb, "test-objects"));
- cl_git_pass(git_oid_fromstr(&id, data->id));
+ cl_git_pass(git_odb__open(&odb, "test-objects", &opts));
+ cl_git_pass(git_oid__fromstr(&id, data->id, data->id_type));
cl_git_pass(git_odb_open_rstream(&stream, &tmp.len, &tmp.type, odb, &id));
remain = tmp.len;
@@ -124,32 +133,62 @@ void test_odb_loose__cleanup(void)
cl_fixture_cleanup("test-objects");
}
-void test_odb_loose__exists(void)
+void test_odb_loose__exists_sha1(void)
{
git_oid id, id2;
git_odb *odb;
write_object_files(&one);
- cl_git_pass(git_odb_open(&odb, "test-objects"));
+ cl_git_pass(git_odb__open(&odb, "test-objects", NULL));
- cl_git_pass(git_oid_fromstr(&id, one.id));
+ cl_git_pass(git_oid__fromstr(&id, one.id, GIT_OID_SHA1));
cl_assert(git_odb_exists(odb, &id));
- cl_git_pass(git_oid_fromstrp(&id, "8b137891"));
+ cl_git_pass(git_oid__fromstrp(&id, "8b137891", GIT_OID_SHA1));
cl_git_pass(git_odb_exists_prefix(&id2, odb, &id, 8));
cl_assert_equal_i(0, git_oid_streq(&id2, one.id));
/* Test for a missing object */
- cl_git_pass(git_oid_fromstr(&id, "8b137891791fe96927ad78e64b0aad7bded08baa"));
+ cl_git_pass(git_oid__fromstr(&id, "8b137891791fe96927ad78e64b0aad7bded08baa", GIT_OID_SHA1));
cl_assert(!git_odb_exists(odb, &id));
- cl_git_pass(git_oid_fromstrp(&id, "8b13789a"));
+ cl_git_pass(git_oid__fromstrp(&id, "8b13789a", GIT_OID_SHA1));
cl_assert_equal_i(GIT_ENOTFOUND, git_odb_exists_prefix(&id2, odb, &id, 8));
git_odb_free(odb);
}
-void test_odb_loose__simple_reads(void)
+void test_odb_loose__exists_sha256(void)
+{
+#ifdef GIT_EXPERIMENTAL_SHA256
+ git_oid id, id2;
+ git_odb *odb;
+ git_odb_options odb_opts = GIT_ODB_OPTIONS_INIT;
+
+ odb_opts.oid_type = GIT_OID_SHA256;
+
+ write_object_files(&one_sha256);
+ cl_git_pass(git_odb__open(&odb, "test-objects", &odb_opts));
+
+ cl_git_pass(git_oid__fromstr(&id, one_sha256.id, GIT_OID_SHA256));
+ cl_assert(git_odb_exists(odb, &id));
+
+ cl_git_pass(git_oid__fromstrp(&id, "4c0d52d1", GIT_OID_SHA256));
+ cl_git_pass(git_odb_exists_prefix(&id2, odb, &id, 8));
+ cl_assert_equal_i(0, git_oid_streq(&id2, one_sha256.id));
+
+ /* Test for a missing object */
+ cl_git_pass(git_oid__fromstr(&id, "4c0d52d180c61d01ce1a91dec5ee58f0cbe65fd59433aea803ab927965493faa", GIT_OID_SHA256));
+ cl_assert(!git_odb_exists(odb, &id));
+
+ cl_git_pass(git_oid__fromstrp(&id, "4c0d52da", GIT_OID_SHA256));
+ cl_assert_equal_i(GIT_ENOTFOUND, git_odb_exists_prefix(&id2, odb, &id, 8));
+
+ git_odb_free(odb);
+#endif
+}
+
+void test_odb_loose__simple_reads_sha1(void)
{
test_read_object(&commit);
test_read_object(&tree);
@@ -160,7 +199,20 @@ void test_odb_loose__simple_reads(void)
test_read_object(&some);
}
-void test_odb_loose__streaming_reads(void)
+void test_odb_loose__simple_reads_sha256(void)
+{
+#ifdef GIT_EXPERIMENTAL_SHA256
+ test_read_object(&commit_sha256);
+ test_read_object(&tree_sha256);
+ test_read_object(&tag_sha256);
+ test_read_object(&zero_sha256);
+ test_read_object(&one_sha256);
+ test_read_object(&two_sha256);
+ test_read_object(&some_sha256);
+#endif
+}
+
+void test_odb_loose__streaming_reads_sha1(void)
{
size_t blocksizes[] = { 1, 2, 4, 16, 99, 1024, 123456789 };
size_t i;
@@ -176,7 +228,25 @@ void test_odb_loose__streaming_reads(void)
}
}
-void test_odb_loose__read_header(void)
+void test_odb_loose__streaming_reads_sha256(void)
+{
+#ifdef GIT_EXPERIMENTAL_SHA256
+ size_t blocksizes[] = { 1, 2, 4, 16, 99, 1024, 123456789 };
+ size_t i;
+
+ for (i = 0; i < ARRAY_SIZE(blocksizes); i++) {
+ test_readstream_object(&commit_sha256, blocksizes[i]);
+ test_readstream_object(&tree_sha256, blocksizes[i]);
+ test_readstream_object(&tag_sha256, blocksizes[i]);
+ test_readstream_object(&zero_sha256, blocksizes[i]);
+ test_readstream_object(&one_sha256, blocksizes[i]);
+ test_readstream_object(&two_sha256, blocksizes[i]);
+ test_readstream_object(&some_sha256, blocksizes[i]);
+ }
+#endif
+}
+
+void test_odb_loose__read_header_sha1(void)
{
test_read_header(&commit);
test_read_header(&tree);
@@ -187,6 +257,19 @@ void test_odb_loose__read_header(void)
test_read_header(&some);
}
+void test_odb_loose__read_header_sha256(void)
+{
+#ifdef GIT_EXPERIMENTAL_SHA256
+ test_read_header(&commit_sha256);
+ test_read_header(&tree_sha256);
+ test_read_header(&tag_sha256);
+ test_read_header(&zero_sha256);
+ test_read_header(&one_sha256);
+ test_read_header(&two_sha256);
+ test_read_header(&some_sha256);
+#endif
+}
+
static void test_write_object_permission(
mode_t dir_mode, mode_t file_mode,
mode_t expected_dir_mode, mode_t expected_file_mode)
@@ -196,6 +279,7 @@ static void test_write_object_permission(
git_oid oid;
struct stat statbuf;
mode_t mask, os_mask;
+ git_odb_backend_loose_options opts = GIT_ODB_BACKEND_LOOSE_OPTIONS_INIT;
/* Windows does not return group/user bits from stat,
* files are never executable.
@@ -209,8 +293,11 @@ static void test_write_object_permission(
mask = p_umask(0);
p_umask(mask);
- cl_git_pass(git_odb_new(&odb));
- cl_git_pass(git_odb_backend_loose(&backend, "test-objects", -1, 0, dir_mode, file_mode));
+ opts.dir_mode = dir_mode;
+ opts.file_mode = file_mode;
+
+ cl_git_pass(git_odb__new(&odb, NULL));
+ cl_git_pass(git_odb__backend_loose(&backend, "test-objects", &opts));
cl_git_pass(git_odb_add_backend(odb, backend, 1));
cl_git_pass(git_odb_write(&oid, odb, "Test data\n", 10, GIT_OBJECT_BLOB));
@@ -243,9 +330,16 @@ static void write_object_to_loose_odb(int fsync)
git_odb *odb;
git_odb_backend *backend;
git_oid oid;
+ git_odb_backend_loose_options opts = GIT_ODB_BACKEND_LOOSE_OPTIONS_INIT;
+
+ if (fsync)
+ opts.flags |= GIT_ODB_BACKEND_LOOSE_FSYNC;
+
+ opts.dir_mode = 0777;
+ opts.file_mode = 0666;
- cl_git_pass(git_odb_new(&odb));
- cl_git_pass(git_odb_backend_loose(&backend, "test-objects", -1, fsync, 0777, 0666));
+ cl_git_pass(git_odb__new(&odb, NULL));
+ cl_git_pass(git_odb__backend_loose(&backend, "test-objects", &opts));
cl_git_pass(git_odb_add_backend(odb, backend, 1));
cl_git_pass(git_odb_write(&oid, odb, "Test data\n", 10, GIT_OBJECT_BLOB));
git_odb_free(odb);
diff --git a/tests/libgit2/odb/loose_data.h b/tests/libgit2/odb/loose_data.h
index c10c9bc7f..1a830740d 100644
--- a/tests/libgit2/odb/loose_data.h
+++ b/tests/libgit2/odb/loose_data.h
@@ -1,7 +1,8 @@
typedef struct object_data {
unsigned char *bytes; /* (compressed) bytes stored in object store */
size_t blen; /* length of data in object store */
- char *id; /* object id (sha1) */
+ char *id; /* object id (hex chars) */
+ git_oid_t id_type; /* type of object id (sha1 or sha256) */
char *type; /* object type */
char *dir; /* object store (fan-out) directory name */
char *file; /* object store filename */
@@ -9,7 +10,10 @@ typedef struct object_data {
size_t dlen; /* length of (uncompressed) object data */
} object_data;
-/* one == 8b137891791fe96927ad78e64b0aad7bded08bdc */
+/*
+ * one == 8b137891791fe96927ad78e64b0aad7bded08bdc (sha1)
+ * 4c0d52d180c61d01ce1a91dec5ee58f0cbe65fd59433aea803ab927965493fd7 (sha256)
+ */
static unsigned char one_bytes[] = {
0x31, 0x78, 0x9c, 0xe3, 0x02, 0x00, 0x00, 0x0b,
0x00, 0x0b,
@@ -23,6 +27,7 @@ static object_data one = {
one_bytes,
sizeof(one_bytes),
"8b137891791fe96927ad78e64b0aad7bded08bdc",
+ GIT_OID_SHA1,
"blob",
"test-objects/8b",
"test-objects/8b/137891791fe96927ad78e64b0aad7bded08bdc",
@@ -30,8 +35,25 @@ static object_data one = {
sizeof(one_data),
};
+#ifdef GIT_EXPERIMENTAL_SHA256
+static object_data one_sha256 = {
+ one_bytes,
+ sizeof(one_bytes),
+ "4c0d52d180c61d01ce1a91dec5ee58f0cbe65fd59433aea803ab927965493fd7",
+ GIT_OID_SHA256,
+ "blob",
+ "test-objects/4c",
+ "test-objects/4c/0d52d180c61d01ce1a91dec5ee58f0cbe65fd59433aea803ab927965493fd7",
+ one_data,
+ sizeof(one_data),
+};
+#endif
-/* commit == 3d7f8a6af076c8c3f20071a8935cdbe8228594d1 */
+
+/*
+ * commit == 3d7f8a6af076c8c3f20071a8935cdbe8228594d1 (sha1)
+ * a2a430fb63b294f868af4ef6ccc9c3e8256e370859ce578a23837ac85337f562 (sha256)
+ */
static unsigned char commit_bytes[] = {
0x78, 0x01, 0x85, 0x50, 0xc1, 0x6a, 0xc3, 0x30,
0x0c, 0xdd, 0xd9, 0x5f, 0xa1, 0xfb, 0x96, 0x12,
@@ -64,6 +86,42 @@ static unsigned char commit_bytes[] = {
0x1f, 0x78, 0x35,
};
+#ifdef GIT_EXPERIMENTAL_SHA256
+static unsigned char commit_bytes_sha256[] = {
+ 0x78, 0x01, 0x85, 0x90, 0xc1, 0x4e, 0xc3, 0x30,
+ 0x0c, 0x86, 0x39, 0xe7, 0x29, 0x7c, 0x87, 0x4e,
+ 0x5d, 0x93, 0xa6, 0x2d, 0x9a, 0x10, 0x13, 0x67,
+ 0xc4, 0x81, 0xf1, 0x00, 0x4e, 0xe3, 0xb4, 0x91,
+ 0x9a, 0xa4, 0x4a, 0x53, 0x69, 0x7d, 0x7b, 0x82,
+ 0x3a, 0x4d, 0x9c, 0xc0, 0xa7, 0xcf, 0xbf, 0xfd,
+ 0xff, 0xb2, 0xdc, 0x07, 0xe7, 0x6c, 0x02, 0xde,
+ 0xb4, 0x0f, 0x29, 0x12, 0x01, 0x17, 0x28, 0xda,
+ 0x5a, 0xa8, 0x5a, 0x54, 0xd2, 0x74, 0x95, 0x90,
+ 0xa5, 0x12, 0x48, 0xbc, 0x26, 0xa9, 0x9b, 0xae,
+ 0x11, 0x52, 0x91, 0x94, 0x3d, 0x6f, 0x95, 0x31,
+ 0x5a, 0x92, 0xe1, 0xaa, 0x17, 0xa6, 0xac, 0x39,
+ 0xe9, 0xa6, 0x45, 0x2e, 0x15, 0x0a, 0x86, 0x6b,
+ 0x1a, 0x43, 0x84, 0x33, 0x7c, 0xc1, 0xe5, 0x07,
+ 0x4e, 0xbb, 0xf0, 0x4a, 0x57, 0x74, 0xf3, 0x44,
+ 0x87, 0x3e, 0xb8, 0x17, 0x38, 0x56, 0x55, 0xd3,
+ 0x1e, 0x45, 0xd5, 0x35, 0xf0, 0x58, 0xe6, 0x62,
+ 0x59, 0xcd, 0x67, 0x24, 0x8a, 0xf0, 0x06, 0x1f,
+ 0xf0, 0xbe, 0xe3, 0xe9, 0xae, 0xfe, 0xe3, 0x66,
+ 0x67, 0x08, 0x9e, 0x8a, 0xc9, 0x7a, 0x82, 0xdd,
+ 0x03, 0xcb, 0xea, 0x1c, 0xc6, 0x8d, 0xb1, 0xcb,
+ 0x48, 0xa0, 0x82, 0xde, 0x20, 0x18, 0x48, 0x99,
+ 0x6f, 0x73, 0x47, 0xcb, 0x82, 0x03, 0x3d, 0xe5,
+ 0xde, 0x27, 0xb4, 0xde, 0xfa, 0x01, 0xcc, 0x1a,
+ 0xf3, 0x46, 0x04, 0xba, 0xce, 0x13, 0x7a, 0x4c,
+ 0x36, 0x78, 0x76, 0x73, 0xcd, 0x6b, 0x9c, 0xc3,
+ 0x42, 0xf7, 0x90, 0x11, 0xfd, 0x40, 0x0b, 0x58,
+ 0x9f, 0x62, 0xd0, 0x6b, 0x4f, 0x1a, 0xd4, 0xf6,
+ 0x2b, 0xfe, 0xc0, 0xd8, 0xa7, 0x1d, 0x3c, 0xe9,
+ 0x22, 0x98, 0x42, 0x6d, 0xcf, 0x7f, 0xbf, 0x83,
+ 0x7d, 0x03, 0x6d, 0x1e, 0x7e, 0xa9
+};
+#endif
+
static unsigned char commit_data[] = {
0x74, 0x72, 0x65, 0x65, 0x20, 0x64, 0x66, 0x66,
0x32, 0x64, 0x61, 0x39, 0x30, 0x62, 0x32, 0x35,
@@ -112,10 +170,64 @@ static unsigned char commit_data[] = {
0x3e, 0x0a,
};
+#ifdef GIT_EXPERIMENTAL_SHA256
+static unsigned char commit_data_sha256[] = {
+ 0x74, 0x72, 0x65, 0x65, 0x20, 0x33, 0x34, 0x61,
+ 0x34, 0x38, 0x35, 0x34, 0x62, 0x35, 0x34, 0x32,
+ 0x36, 0x66, 0x39, 0x32, 0x34, 0x36, 0x30, 0x62,
+ 0x34, 0x61, 0x65, 0x33, 0x35, 0x65, 0x36, 0x64,
+ 0x37, 0x39, 0x37, 0x34, 0x36, 0x62, 0x65, 0x36,
+ 0x36, 0x63, 0x33, 0x38, 0x62, 0x66, 0x66, 0x64,
+ 0x36, 0x65, 0x66, 0x33, 0x62, 0x63, 0x34, 0x66,
+ 0x30, 0x35, 0x33, 0x65, 0x64, 0x37, 0x38, 0x61,
+ 0x33, 0x36, 0x62, 0x61, 0x34, 0x0a, 0x61, 0x75,
+ 0x74, 0x68, 0x6f, 0x72, 0x20, 0x41, 0x20, 0x55,
+ 0x20, 0x54, 0x68, 0x6f, 0x72, 0x20, 0x3c, 0x61,
+ 0x75, 0x74, 0x68, 0x6f, 0x72, 0x40, 0x65, 0x78,
+ 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2e, 0x63, 0x6f,
+ 0x6d, 0x3e, 0x20, 0x31, 0x32, 0x32, 0x37, 0x38,
+ 0x31, 0x34, 0x32, 0x39, 0x37, 0x20, 0x2b, 0x30,
+ 0x30, 0x30, 0x30, 0x0a, 0x63, 0x6f, 0x6d, 0x6d,
+ 0x69, 0x74, 0x74, 0x65, 0x72, 0x20, 0x43, 0x20,
+ 0x4f, 0x20, 0x4d, 0x69, 0x74, 0x74, 0x65, 0x72,
+ 0x20, 0x3c, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74,
+ 0x74, 0x65, 0x72, 0x40, 0x65, 0x78, 0x61, 0x6d,
+ 0x70, 0x6c, 0x65, 0x2e, 0x63, 0x6f, 0x6d, 0x3e,
+ 0x20, 0x31, 0x32, 0x32, 0x37, 0x38, 0x31, 0x34,
+ 0x32, 0x39, 0x37, 0x20, 0x2b, 0x30, 0x30, 0x30,
+ 0x30, 0x0a, 0x0a, 0x41, 0x20, 0x6f, 0x6e, 0x65,
+ 0x2d, 0x6c, 0x69, 0x6e, 0x65, 0x20, 0x63, 0x6f,
+ 0x6d, 0x6d, 0x69, 0x74, 0x20, 0x73, 0x75, 0x6d,
+ 0x6d, 0x61, 0x72, 0x79, 0x0a, 0x0a, 0x54, 0x68,
+ 0x65, 0x20, 0x62, 0x6f, 0x64, 0x79, 0x20, 0x6f,
+ 0x66, 0x20, 0x74, 0x68, 0x65, 0x20, 0x63, 0x6f,
+ 0x6d, 0x6d, 0x69, 0x74, 0x20, 0x6d, 0x65, 0x73,
+ 0x73, 0x61, 0x67, 0x65, 0x2c, 0x20, 0x63, 0x6f,
+ 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x69, 0x6e, 0x67,
+ 0x20, 0x66, 0x75, 0x72, 0x74, 0x68, 0x65, 0x72,
+ 0x20, 0x65, 0x78, 0x70, 0x6c, 0x61, 0x6e, 0x61,
+ 0x74, 0x69, 0x6f, 0x6e, 0x0a, 0x6f, 0x66, 0x20,
+ 0x74, 0x68, 0x65, 0x20, 0x70, 0x75, 0x72, 0x70,
+ 0x6f, 0x73, 0x65, 0x20, 0x6f, 0x66, 0x20, 0x74,
+ 0x68, 0x65, 0x20, 0x63, 0x68, 0x61, 0x6e, 0x67,
+ 0x65, 0x73, 0x20, 0x69, 0x6e, 0x74, 0x72, 0x6f,
+ 0x64, 0x75, 0x63, 0x65, 0x64, 0x20, 0x62, 0x79,
+ 0x20, 0x74, 0x68, 0x65, 0x20, 0x63, 0x6f, 0x6d,
+ 0x6d, 0x69, 0x74, 0x2e, 0x0a, 0x0a, 0x53, 0x69,
+ 0x67, 0x6e, 0x65, 0x64, 0x2d, 0x6f, 0x66, 0x2d,
+ 0x62, 0x79, 0x3a, 0x20, 0x41, 0x20, 0x55, 0x20,
+ 0x54, 0x68, 0x6f, 0x72, 0x20, 0x3c, 0x61, 0x75,
+ 0x74, 0x68, 0x6f, 0x72, 0x40, 0x65, 0x78, 0x61,
+ 0x6d, 0x70, 0x6c, 0x65, 0x2e, 0x63, 0x6f, 0x6d,
+ 0x3e, 0x0a
+};
+#endif
+
static object_data commit = {
commit_bytes,
sizeof(commit_bytes),
"3d7f8a6af076c8c3f20071a8935cdbe8228594d1",
+ GIT_OID_SHA1,
"commit",
"test-objects/3d",
"test-objects/3d/7f8a6af076c8c3f20071a8935cdbe8228594d1",
@@ -123,7 +235,24 @@ static object_data commit = {
sizeof(commit_data),
};
-/* tree == dff2da90b254e1beb889d1f1f1288be1803782df */
+#ifdef GIT_EXPERIMENTAL_SHA256
+static object_data commit_sha256 = {
+ commit_bytes_sha256,
+ sizeof(commit_bytes_sha256),
+ "a2a430fb63b294f868af4ef6ccc9c3e8256e370859ce578a23837ac85337f562",
+ GIT_OID_SHA256,
+ "commit",
+ "test-objects/a2",
+ "test-objects/a2/a430fb63b294f868af4ef6ccc9c3e8256e370859ce578a23837ac85337f562",
+ commit_data_sha256,
+ sizeof(commit_data_sha256),
+};
+#endif
+
+/*
+ * tree == dff2da90b254e1beb889d1f1f1288be1803782df (sha1)
+ * 34a4854b5426f92460b4ae35e6d79746be66c38bffd6ef3bc4f053ed78a36ba4 (sha256)
+ */
static unsigned char tree_bytes[] = {
0x78, 0x01, 0x2b, 0x29, 0x4a, 0x4d, 0x55, 0x30,
0x34, 0x32, 0x63, 0x30, 0x34, 0x30, 0x30, 0x33,
@@ -163,10 +292,76 @@ static unsigned char tree_data[] = {
0xd8, 0xc2, 0xe4, 0x8c, 0x53, 0x91,
};
+#ifdef GIT_EXPERIMENTAL_SHA256
+static unsigned char tree_bytes_sha256[] = {
+ 0x78, 0x01, 0x2b, 0x29, 0x4a, 0x4d, 0x55, 0x30,
+ 0x32, 0x32, 0x66, 0x30, 0x34, 0x30, 0x30, 0x33,
+ 0x31, 0x51, 0xc8, 0x48, 0xcd, 0xc9, 0xc9, 0xd7,
+ 0x2b, 0xa9, 0x28, 0x61, 0x28, 0x65, 0x3b, 0x7d,
+ 0xde, 0x27, 0x5c, 0xfb, 0xe5, 0x83, 0x2c, 0xf9,
+ 0xb7, 0xa6, 0x6b, 0xa2, 0x65, 0x7f, 0x6c, 0x5d,
+ 0xee, 0xab, 0x76, 0xa0, 0x9e, 0x49, 0xcd, 0xe3,
+ 0xe9, 0xcd, 0xa8, 0xf9, 0xf9, 0x5a, 0x50, 0x0d,
+ 0xf9, 0x79, 0xa9, 0x0c, 0x3e, 0xbc, 0x41, 0x17,
+ 0x1b, 0x8e, 0xc9, 0x32, 0x9e, 0x93, 0x9a, 0x78,
+ 0xef, 0xe8, 0xbb, 0x88, 0x0f, 0xa7, 0x9f, 0xc5,
+ 0x5f, 0x9d, 0x62, 0xbc, 0x6e, 0x05, 0xf3, 0xea,
+ 0x49, 0x95, 0xa9, 0x9e, 0xf6, 0xd7, 0xa1, 0x4a,
+ 0x8b, 0xf3, 0x73, 0x53, 0x19, 0x38, 0x6c, 0xb4,
+ 0xbb, 0x5d, 0xc2, 0x1c, 0x2e, 0x16, 0x3e, 0x5f,
+ 0x95, 0x56, 0xcd, 0x6d, 0xc4, 0x50, 0xc0, 0xf6,
+ 0xbd, 0xad, 0x50, 0xc0, 0xe8, 0xf5, 0x0e, 0x4d,
+ 0xc3, 0x33, 0xcb, 0xe6, 0x1c, 0x8c, 0x86, 0xaa,
+ 0x2d, 0x29, 0xcf, 0x67, 0xf8, 0x91, 0x14, 0xe7,
+ 0xfc, 0xf3, 0x81, 0xbf, 0x8a, 0xa6, 0x7c, 0xf9,
+ 0xd9, 0x7d, 0x3e, 0x85, 0x9b, 0x0f, 0x2d, 0xde,
+ 0xc0, 0x60, 0x9f, 0xe0, 0x38, 0xdb, 0xee, 0x42,
+ 0x16, 0x6b, 0x6f, 0x59, 0x4e, 0x37, 0x54, 0x69,
+ 0x55, 0x6a, 0x51, 0x3e, 0x83, 0xcb, 0xbc, 0xd9,
+ 0x95, 0x21, 0x0a, 0x67, 0xc5, 0xfe, 0x25, 0xac,
+ 0x0d, 0x9a, 0x71, 0x3e, 0x83, 0x5f, 0x74, 0xf9,
+ 0x59, 0xad, 0x93, 0x5b, 0xbc, 0x6e, 0x7d, 0x7f,
+ 0x6b, 0x77, 0x87, 0x97, 0xe3, 0x6e, 0x05, 0x00,
+ 0xba, 0xd1, 0x5f, 0x75
+};
+
+static unsigned char tree_data_sha256[] = {
+ 0x31, 0x30, 0x30, 0x36, 0x34, 0x34, 0x20, 0x68,
+ 0x65, 0x6c, 0x6c, 0x6f, 0x2e, 0x74, 0x78, 0x74,
+ 0x00, 0x75, 0x06, 0xcb, 0xcf, 0x4c, 0x57, 0x2b,
+ 0xe9, 0xe0, 0x6a, 0x1f, 0xed, 0x35, 0xac, 0x5b,
+ 0x1d, 0xf8, 0xb5, 0xa7, 0x4d, 0x26, 0xc0, 0x7f,
+ 0x02, 0x26, 0x48, 0xe5, 0xd9, 0x5a, 0x9f, 0x6f,
+ 0x2a, 0x31, 0x30, 0x30, 0x36, 0x34, 0x34, 0x20,
+ 0x6f, 0x6e, 0x65, 0x00, 0x4c, 0x0d, 0x52, 0xd1,
+ 0x80, 0xc6, 0x1d, 0x01, 0xce, 0x1a, 0x91, 0xde,
+ 0xc5, 0xee, 0x58, 0xf0, 0xcb, 0xe6, 0x5f, 0xd5,
+ 0x94, 0x33, 0xae, 0xa8, 0x03, 0xab, 0x92, 0x79,
+ 0x65, 0x49, 0x3f, 0xd7, 0x31, 0x30, 0x30, 0x36,
+ 0x34, 0x34, 0x20, 0x73, 0x6f, 0x6d, 0x65, 0x00,
+ 0x08, 0x3c, 0x2b, 0x8b, 0x44, 0x56, 0x40, 0xd1,
+ 0x71, 0xe7, 0xaa, 0x66, 0x7b, 0x0b, 0x32, 0x00,
+ 0x70, 0x06, 0xf7, 0x86, 0x71, 0x10, 0x32, 0xeb,
+ 0xb8, 0x29, 0x31, 0xcc, 0xa6, 0x9c, 0xc1, 0x5b,
+ 0x31, 0x30, 0x30, 0x36, 0x34, 0x34, 0x20, 0x74,
+ 0x77, 0x6f, 0x00, 0xf8, 0x62, 0x5e, 0x43, 0xf9,
+ 0xe0, 0x4f, 0x24, 0x29, 0x1f, 0x77, 0xcd, 0xbe,
+ 0x4c, 0x71, 0xb3, 0xc2, 0xa3, 0xb0, 0x00, 0x3f,
+ 0x60, 0x41, 0x9b, 0x3e, 0xd0, 0x6a, 0x05, 0x8d,
+ 0x76, 0x6c, 0x8b, 0x31, 0x30, 0x30, 0x36, 0x34,
+ 0x34, 0x20, 0x7a, 0x65, 0x72, 0x6f, 0x00, 0x44,
+ 0x9e, 0x9b, 0x79, 0x54, 0x20, 0xcd, 0x16, 0xfe,
+ 0x60, 0xad, 0x52, 0x98, 0xcf, 0x68, 0x0f, 0x15,
+ 0xa7, 0xcd, 0x2a, 0xc9, 0xb4, 0x4a, 0xda, 0xf7,
+ 0xed, 0x3e, 0xdc, 0x0d, 0x08, 0xdd, 0x78
+};
+#endif
+
static object_data tree = {
tree_bytes,
sizeof(tree_bytes),
"dff2da90b254e1beb889d1f1f1288be1803782df",
+ GIT_OID_SHA1,
"tree",
"test-objects/df",
"test-objects/df/f2da90b254e1beb889d1f1f1288be1803782df",
@@ -174,7 +369,24 @@ static object_data tree = {
sizeof(tree_data),
};
-/* tag == 09d373e1dfdc16b129ceec6dd649739911541e05 */
+#ifdef GIT_EXPERIMENTAL_SHA256
+static object_data tree_sha256 = {
+ tree_bytes_sha256,
+ sizeof(tree_bytes_sha256),
+ "34a4854b5426f92460b4ae35e6d79746be66c38bffd6ef3bc4f053ed78a36ba4",
+ GIT_OID_SHA256,
+ "tree",
+ "test-objects/34",
+ "test-objects/34/a4854b5426f92460b4ae35e6d79746be66c38bffd6ef3bc4f053ed78a36ba4",
+ tree_data_sha256,
+ sizeof(tree_data_sha256),
+};
+#endif
+
+/*
+ * tag == 09d373e1dfdc16b129ceec6dd649739911541e05 (sha1)
+ * f535d7595d5d0e5e530b5deb34542c96491fea300a1318036b605306548cb225 (sha256)
+ */
static unsigned char tag_bytes[] = {
0x78, 0x01, 0x35, 0x4e, 0xcb, 0x0a, 0xc2, 0x40,
0x10, 0xf3, 0xbc, 0x5f, 0x31, 0x77, 0xa1, 0xec,
@@ -222,10 +434,101 @@ static unsigned char tag_data[] = {
0x2e, 0x30, 0x2e, 0x31, 0x0a,
};
+#ifdef GIT_EXPERIMENTAL_SHA256
+static unsigned char tag_bytes_sha256[] = {
+ 0x78, 0x01, 0x55, 0x8f, 0xd1, 0x4e, 0x84, 0x30,
+ 0x10, 0x45, 0x7d, 0xee, 0x57, 0xcc, 0xbb, 0x2e,
+ 0x81, 0x16, 0x68, 0x31, 0x1b, 0xa3, 0xf1, 0xd9,
+ 0xf8, 0xe0, 0xfa, 0x01, 0x43, 0x99, 0x42, 0x0d,
+ 0xb4, 0xa4, 0x14, 0xb3, 0xfc, 0xbd, 0xc5, 0xdd,
+ 0x4d, 0xb4, 0x69, 0xd2, 0x9b, 0xc9, 0xdc, 0x7b,
+ 0x6e, 0x23, 0xf6, 0x20, 0xa4, 0xba, 0xf3, 0xed,
+ 0x17, 0xe9, 0x08, 0xc8, 0xb1, 0x14, 0xb9, 0x69,
+ 0x6b, 0xd1, 0xf2, 0xa6, 0x34, 0xaa, 0x56, 0x68,
+ 0x4a, 0x32, 0xb5, 0xd6, 0xba, 0xd1, 0x82, 0x14,
+ 0xaf, 0x6a, 0x12, 0x32, 0x57, 0x55, 0xa3, 0xa9,
+ 0x92, 0x0a, 0xb9, 0x50, 0x42, 0xa2, 0x56, 0x95,
+ 0x10, 0xd2, 0x54, 0x35, 0x67, 0x71, 0x9b, 0x09,
+ 0xb4, 0x9f, 0x26, 0x1b, 0x59, 0x4c, 0xd9, 0xdf,
+ 0x79, 0x96, 0x67, 0xc5, 0x2e, 0x7b, 0x0a, 0xf0,
+ 0x0a, 0xef, 0xf0, 0x66, 0x63, 0x4c, 0xf2, 0x78,
+ 0x59, 0x4a, 0xf2, 0x99, 0xce, 0x38, 0xcd, 0x23,
+ 0x65, 0x69, 0xf2, 0x04, 0x05, 0xe7, 0x52, 0x15,
+ 0x25, 0x6f, 0x24, 0xdc, 0xe7, 0xe9, 0x30, 0x76,
+ 0x1a, 0xec, 0x02, 0xe9, 0xc6, 0x81, 0x60, 0x8f,
+ 0xbc, 0x56, 0x35, 0x3e, 0x40, 0xa0, 0x91, 0x70,
+ 0xa1, 0x1b, 0xe5, 0x0a, 0x86, 0x65, 0x9d, 0x26,
+ 0x0c, 0xdb, 0x6e, 0x25, 0x68, 0x7d, 0xb7, 0x81,
+ 0x37, 0xbf, 0xf6, 0x0b, 0x13, 0x26, 0x5a, 0x16,
+ 0xec, 0xe9, 0x21, 0xed, 0xbb, 0x88, 0xd6, 0x59,
+ 0xd7, 0x83, 0x59, 0x43, 0x02, 0x04, 0xa0, 0xf3,
+ 0x3c, 0xa2, 0xc3, 0x68, 0xbd, 0x63, 0x57, 0xd7,
+ 0xbc, 0x86, 0xd9, 0x27, 0xca, 0x2d, 0x64, 0x40,
+ 0xd7, 0x53, 0xaa, 0xe4, 0x62, 0xf0, 0xdd, 0xaa,
+ 0xa9, 0x83, 0x76, 0xfb, 0x13, 0x9f, 0x31, 0xf6,
+ 0x61, 0x7b, 0x47, 0xdd, 0xc1, 0x9b, 0x43, 0xbb,
+ 0x3d, 0xc2, 0x0b, 0x7c, 0xc2, 0x69, 0x48, 0x75,
+ 0x8f, 0xb8, 0xc6, 0xf4, 0xfe, 0xfb, 0x30, 0xfb,
+ 0x01, 0xc9, 0x32, 0x7d, 0xbb
+};
+
+static unsigned char tag_data_sha256[] = {
+ 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x20, 0x61,
+ 0x32, 0x61, 0x34, 0x33, 0x30, 0x66, 0x62, 0x36,
+ 0x33, 0x62, 0x32, 0x39, 0x34, 0x66, 0x38, 0x36,
+ 0x38, 0x61, 0x66, 0x34, 0x65, 0x66, 0x36, 0x63,
+ 0x63, 0x63, 0x39, 0x63, 0x33, 0x65, 0x38, 0x32,
+ 0x35, 0x36, 0x65, 0x33, 0x37, 0x30, 0x38, 0x35,
+ 0x39, 0x63, 0x65, 0x35, 0x37, 0x38, 0x61, 0x32,
+ 0x33, 0x38, 0x33, 0x37, 0x61, 0x63, 0x38, 0x35,
+ 0x33, 0x33, 0x37, 0x66, 0x35, 0x36, 0x32, 0x0a,
+ 0x74, 0x79, 0x70, 0x65, 0x20, 0x63, 0x6f, 0x6d,
+ 0x6d, 0x69, 0x74, 0x0a, 0x74, 0x61, 0x67, 0x20,
+ 0x76, 0x30, 0x2e, 0x30, 0x2e, 0x31, 0x0a, 0x74,
+ 0x61, 0x67, 0x67, 0x65, 0x72, 0x20, 0x43, 0x20,
+ 0x4f, 0x20, 0x4d, 0x69, 0x74, 0x74, 0x65, 0x72,
+ 0x20, 0x3c, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74,
+ 0x74, 0x65, 0x72, 0x40, 0x65, 0x78, 0x61, 0x6d,
+ 0x70, 0x6c, 0x65, 0x2e, 0x63, 0x6f, 0x6d, 0x3e,
+ 0x20, 0x31, 0x32, 0x32, 0x37, 0x38, 0x31, 0x34,
+ 0x32, 0x39, 0x37, 0x20, 0x2b, 0x30, 0x30, 0x30,
+ 0x30, 0x0a, 0x0a, 0x54, 0x68, 0x69, 0x73, 0x20,
+ 0x69, 0x73, 0x20, 0x74, 0x68, 0x65, 0x20, 0x74,
+ 0x61, 0x67, 0x20, 0x6f, 0x62, 0x6a, 0x65, 0x63,
+ 0x74, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x72, 0x65,
+ 0x6c, 0x65, 0x61, 0x73, 0x65, 0x20, 0x76, 0x30,
+ 0x2e, 0x30, 0x2e, 0x31, 0x0a, 0x20, 0x63, 0x6f,
+ 0x6d, 0x6d, 0x69, 0x74, 0x20, 0x73, 0x75, 0x6d,
+ 0x6d, 0x61, 0x72, 0x79, 0x0a, 0x0a, 0x54, 0x68,
+ 0x65, 0x20, 0x62, 0x6f, 0x64, 0x79, 0x20, 0x6f,
+ 0x66, 0x20, 0x74, 0x68, 0x65, 0x20, 0x63, 0x6f,
+ 0x6d, 0x6d, 0x69, 0x74, 0x20, 0x6d, 0x65, 0x73,
+ 0x73, 0x61, 0x67, 0x65, 0x2c, 0x20, 0x63, 0x6f,
+ 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x69, 0x6e, 0x67,
+ 0x20, 0x66, 0x75, 0x72, 0x74, 0x68, 0x65, 0x72,
+ 0x20, 0x65, 0x78, 0x70, 0x6c, 0x61, 0x6e, 0x61,
+ 0x74, 0x69, 0x6f, 0x6e, 0x0a, 0x6f, 0x66, 0x20,
+ 0x74, 0x68, 0x65, 0x20, 0x70, 0x75, 0x72, 0x70,
+ 0x6f, 0x73, 0x65, 0x20, 0x6f, 0x66, 0x20, 0x74,
+ 0x68, 0x65, 0x20, 0x63, 0x68, 0x61, 0x6e, 0x67,
+ 0x65, 0x73, 0x20, 0x69, 0x6e, 0x74, 0x72, 0x6f,
+ 0x64, 0x75, 0x63, 0x65, 0x64, 0x20, 0x62, 0x79,
+ 0x20, 0x74, 0x68, 0x65, 0x20, 0x63, 0x6f, 0x6d,
+ 0x6d, 0x69, 0x74, 0x2e, 0x0a, 0x0a, 0x53, 0x69,
+ 0x67, 0x6e, 0x65, 0x64, 0x2d, 0x6f, 0x66, 0x2d,
+ 0x62, 0x79, 0x3a, 0x20, 0x41, 0x20, 0x55, 0x20,
+ 0x54, 0x68, 0x6f, 0x72, 0x20, 0x3c, 0x61, 0x75,
+ 0x74, 0x68, 0x6f, 0x72, 0x40, 0x65, 0x78, 0x61,
+ 0x6d, 0x70, 0x6c, 0x65, 0x2e, 0x63, 0x6f, 0x6d,
+ 0x3e, 0x0a
+};
+#endif
+
static object_data tag = {
tag_bytes,
sizeof(tag_bytes),
"09d373e1dfdc16b129ceec6dd649739911541e05",
+ GIT_OID_SHA1,
"tag",
"test-objects/09",
"test-objects/09/d373e1dfdc16b129ceec6dd649739911541e05",
@@ -233,7 +536,24 @@ static object_data tag = {
sizeof(tag_data),
};
-/* zero == e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 */
+#ifdef GIT_EXPERIMENTAL_SHA256
+static object_data tag_sha256 = {
+ tag_bytes_sha256,
+ sizeof(tag_bytes_sha256),
+ "f535d7595d5d0e5e530b5deb34542c96491fea300a1318036b605306548cb225",
+ GIT_OID_SHA256,
+ "tag",
+ "test-objects/f5",
+ "test-objects/f5/35d7595d5d0e5e530b5deb34542c96491fea300a1318036b605306548cb225",
+ tag_data_sha256,
+ sizeof(tag_data_sha256),
+};
+#endif
+
+/*
+ * zero == e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 (sha1)
+ * 473a0f4c3be8a93681a267e3b1e9a7dcda1185436fe141f7749120a303721813 (sha256)
+ */
static unsigned char zero_bytes[] = {
0x78, 0x01, 0x4b, 0xca, 0xc9, 0x4f, 0x52, 0x30,
0x60, 0x00, 0x00, 0x09, 0xb0, 0x01, 0xf0,
@@ -247,6 +567,7 @@ static object_data zero = {
zero_bytes,
sizeof(zero_bytes),
"e69de29bb2d1d6434b8b29ae775ad8c2e48c5391",
+ GIT_OID_SHA1,
"blob",
"test-objects/e6",
"test-objects/e6/9de29bb2d1d6434b8b29ae775ad8c2e48c5391",
@@ -254,7 +575,24 @@ static object_data zero = {
0,
};
-/* two == 78981922613b2afb6025042ff6bd878ac1994e85 */
+#ifdef GIT_EXPERIMENTAL_SHA256
+static object_data zero_sha256 = {
+ zero_bytes,
+ sizeof(zero_bytes),
+ "473a0f4c3be8a93681a267e3b1e9a7dcda1185436fe141f7749120a303721813",
+ GIT_OID_SHA256,
+ "blob",
+ "test-objects/47",
+ "test-objects/47/3a0f4c3be8a93681a267e3b1e9a7dcda1185436fe141f7749120a303721813",
+ zero_data,
+ 0,
+};
+#endif
+
+/*
+ * two == 78981922613b2afb6025042ff6bd878ac1994e85 (sha1)
+ * f8625e43f9e04f24291f77cdbe4c71b3c2a3b0003f60419b3ed06a058d766c8b (sha256)
+ */
static unsigned char two_bytes[] = {
0x78, 0x01, 0x4b, 0xca, 0xc9, 0x4f, 0x52, 0x30,
0x62, 0x48, 0xe4, 0x02, 0x00, 0x0e, 0x64, 0x02,
@@ -269,6 +607,7 @@ static object_data two = {
two_bytes,
sizeof(two_bytes),
"78981922613b2afb6025042ff6bd878ac1994e85",
+ GIT_OID_SHA1,
"blob",
"test-objects/78",
"test-objects/78/981922613b2afb6025042ff6bd878ac1994e85",
@@ -276,7 +615,24 @@ static object_data two = {
sizeof(two_data),
};
-/* some == fd8430bc864cfcd5f10e5590f8a447e01b942bfe */
+#ifdef GIT_EXPERIMENTAL_SHA256
+static object_data two_sha256 = {
+ two_bytes,
+ sizeof(two_bytes),
+ "f8625e43f9e04f24291f77cdbe4c71b3c2a3b0003f60419b3ed06a058d766c8b",
+ GIT_OID_SHA256,
+ "blob",
+ "test-objects/f8",
+ "test-objects/f8/625e43f9e04f24291f77cdbe4c71b3c2a3b0003f60419b3ed06a058d766c8b",
+ two_data,
+ sizeof(two_data),
+};
+#endif
+
+/*
+ * some == fd8430bc864cfcd5f10e5590f8a447e01b942bfe (sha1)
+ * 083c2b8b445640d171e7aa667b0b32007006f786711032ebb82931cca69cc15b (sha256)
+ */
static unsigned char some_bytes[] = {
0x78, 0x01, 0x7d, 0x54, 0xc1, 0x4e, 0xe3, 0x30,
0x10, 0xdd, 0x33, 0x5f, 0x31, 0xc7, 0x5d, 0x94,
@@ -514,9 +870,24 @@ static object_data some = {
some_bytes,
sizeof(some_bytes),
"fd8430bc864cfcd5f10e5590f8a447e01b942bfe",
+ GIT_OID_SHA1,
"blob",
"test-objects/fd",
"test-objects/fd/8430bc864cfcd5f10e5590f8a447e01b942bfe",
some_data,
sizeof(some_data),
};
+
+#ifdef GIT_EXPERIMENTAL_SHA256
+static object_data some_sha256 = {
+ some_bytes,
+ sizeof(some_bytes),
+ "083c2b8b445640d171e7aa667b0b32007006f786711032ebb82931cca69cc15b",
+ GIT_OID_SHA256,
+ "blob",
+ "test-objects/08",
+ "test-objects/08/3c2b8b445640d171e7aa667b0b32007006f786711032ebb82931cca69cc15b",
+ some_data,
+ sizeof(some_data),
+};
+#endif
diff --git a/tests/libgit2/odb/mixed.c b/tests/libgit2/odb/mixed.c
index 87e945c83..19e6dcebf 100644
--- a/tests/libgit2/odb/mixed.c
+++ b/tests/libgit2/odb/mixed.c
@@ -5,7 +5,7 @@ static git_odb *_odb;
void test_odb_mixed__initialize(void)
{
- cl_git_pass(git_odb_open(&_odb, cl_fixture("duplicate.git/objects")));
+ cl_git_pass(git_odb__open(&_odb, cl_fixture("duplicate.git/objects"), NULL));
}
void test_odb_mixed__cleanup(void)
@@ -20,13 +20,13 @@ void test_odb_mixed__dup_oid(void) {
git_oid oid;
git_odb_object *obj;
- cl_git_pass(git_oid_fromstr(&oid, hex));
- cl_git_pass(git_odb_read_prefix(&obj, _odb, &oid, GIT_OID_HEXSZ));
+ cl_git_pass(git_oid__fromstr(&oid, hex, GIT_OID_SHA1));
+ cl_git_pass(git_odb_read_prefix(&obj, _odb, &oid, GIT_OID_SHA1_HEXSIZE));
git_odb_object_free(obj);
- cl_git_pass(git_odb_exists_prefix(NULL, _odb, &oid, GIT_OID_HEXSZ));
+ cl_git_pass(git_odb_exists_prefix(NULL, _odb, &oid, GIT_OID_SHA1_HEXSIZE));
- cl_git_pass(git_oid_fromstrn(&oid, short_hex, sizeof(short_hex) - 1));
+ cl_git_pass(git_oid__fromstrn(&oid, short_hex, sizeof(short_hex) - 1, GIT_OID_SHA1));
cl_git_pass(git_odb_read_prefix(&obj, _odb, &oid, sizeof(short_hex) - 1));
git_odb_object_free(obj);
@@ -48,63 +48,63 @@ void test_odb_mixed__dup_oid_prefix_0(void) {
/* ambiguous in the same pack file */
strncpy(hex, "dea509d0", sizeof(hex));
- cl_git_pass(git_oid_fromstrn(&oid, hex, strlen(hex)));
+ cl_git_pass(git_oid__fromstrn(&oid, hex, strlen(hex), GIT_OID_SHA1));
cl_assert_equal_i(
GIT_EAMBIGUOUS, git_odb_read_prefix(&obj, _odb, &oid, strlen(hex)));
cl_assert_equal_i(
GIT_EAMBIGUOUS, git_odb_exists_prefix(&found, _odb, &oid, strlen(hex)));
strncpy(hex, "dea509d09", sizeof(hex));
- cl_git_pass(git_oid_fromstrn(&oid, hex, strlen(hex)));
+ cl_git_pass(git_oid__fromstrn(&oid, hex, strlen(hex), GIT_OID_SHA1));
cl_git_pass(git_odb_read_prefix(&obj, _odb, &oid, strlen(hex)));
cl_git_pass(git_odb_exists_prefix(&found, _odb, &oid, strlen(hex)));
cl_assert_equal_oid(&found, git_odb_object_id(obj));
git_odb_object_free(obj);
strncpy(hex, "dea509d0b", sizeof(hex));
- cl_git_pass(git_oid_fromstrn(&oid, hex, strlen(hex)));
+ cl_git_pass(git_oid__fromstrn(&oid, hex, strlen(hex), GIT_OID_SHA1));
cl_git_pass(git_odb_read_prefix(&obj, _odb, &oid, strlen(hex)));
git_odb_object_free(obj);
/* ambiguous in different pack files */
strncpy(hex, "81b5bff5", sizeof(hex));
- cl_git_pass(git_oid_fromstrn(&oid, hex, strlen(hex)));
+ cl_git_pass(git_oid__fromstrn(&oid, hex, strlen(hex), GIT_OID_SHA1));
cl_assert_equal_i(
GIT_EAMBIGUOUS, git_odb_read_prefix(&obj, _odb, &oid, strlen(hex)));
cl_assert_equal_i(
GIT_EAMBIGUOUS, git_odb_exists_prefix(&found, _odb, &oid, strlen(hex)));
strncpy(hex, "81b5bff5b", sizeof(hex));
- cl_git_pass(git_oid_fromstrn(&oid, hex, strlen(hex)));
+ cl_git_pass(git_oid__fromstrn(&oid, hex, strlen(hex), GIT_OID_SHA1));
cl_git_pass(git_odb_read_prefix(&obj, _odb, &oid, strlen(hex)));
cl_git_pass(git_odb_exists_prefix(&found, _odb, &oid, strlen(hex)));
cl_assert_equal_oid(&found, git_odb_object_id(obj));
git_odb_object_free(obj);
strncpy(hex, "81b5bff5f", sizeof(hex));
- cl_git_pass(git_oid_fromstrn(&oid, hex, strlen(hex)));
+ cl_git_pass(git_oid__fromstrn(&oid, hex, strlen(hex), GIT_OID_SHA1));
cl_git_pass(git_odb_read_prefix(&obj, _odb, &oid, strlen(hex)));
git_odb_object_free(obj);
/* ambiguous in pack file and loose */
strncpy(hex, "0ddeaded", sizeof(hex));
- cl_git_pass(git_oid_fromstrn(&oid, hex, strlen(hex)));
+ cl_git_pass(git_oid__fromstrn(&oid, hex, strlen(hex), GIT_OID_SHA1));
cl_assert_equal_i(
GIT_EAMBIGUOUS, git_odb_read_prefix(&obj, _odb, &oid, strlen(hex)));
cl_assert_equal_i(
GIT_EAMBIGUOUS, git_odb_exists_prefix(&found, _odb, &oid, strlen(hex)));
strncpy(hex, "0ddeaded9", sizeof(hex));
- cl_git_pass(git_oid_fromstrn(&oid, hex, strlen(hex)));
+ cl_git_pass(git_oid__fromstrn(&oid, hex, strlen(hex), GIT_OID_SHA1));
cl_git_pass(git_odb_read_prefix(&obj, _odb, &oid, strlen(hex)));
cl_git_pass(git_odb_exists_prefix(&found, _odb, &oid, strlen(hex)));
cl_assert_equal_oid(&found, git_odb_object_id(obj));
git_odb_object_free(obj);
strncpy(hex, "0ddeadede", sizeof(hex));
- cl_git_pass(git_oid_fromstrn(&oid, hex, strlen(hex)));
+ cl_git_pass(git_oid__fromstrn(&oid, hex, strlen(hex), GIT_OID_SHA1));
cl_git_pass(git_odb_read_prefix(&obj, _odb, &oid, strlen(hex)));
git_odb_object_free(obj);
}
@@ -170,7 +170,7 @@ static void setup_prefix_query(
size_t len = strlen(expand_id_test_data[i].lookup_id);
- git_oid_fromstrn(&id->id, expand_id_test_data[i].lookup_id, len);
+ git_oid__fromstrn(&id->id, expand_id_test_data[i].lookup_id, len, GIT_OID_SHA1);
id->length = (unsigned short)len;
id->type = expand_id_test_data[i].expected_type;
}
@@ -186,13 +186,13 @@ static void assert_found_objects(git_odb_expand_id *ids)
num = ARRAY_SIZE(expand_id_test_data);
for (i = 0; i < num; i++) {
- git_oid expected_id = {{0}};
+ git_oid expected_id = GIT_OID_SHA1_ZERO;
size_t expected_len = 0;
git_object_t expected_type = 0;
if (expand_id_test_data[i].expected_id) {
- git_oid_fromstr(&expected_id, expand_id_test_data[i].expected_id);
- expected_len = GIT_OID_HEXSZ;
+ git_oid__fromstr(&expected_id, expand_id_test_data[i].expected_id, GIT_OID_SHA1);
+ expected_len = GIT_OID_SHA1_HEXSIZE;
expected_type = expand_id_test_data[i].expected_type;
}
@@ -204,7 +204,7 @@ static void assert_found_objects(git_odb_expand_id *ids)
static void assert_notfound_objects(git_odb_expand_id *ids)
{
- git_oid expected_id = {{0}};
+ git_oid expected_id = GIT_OID_SHA1_ZERO;
size_t num, i;
num = ARRAY_SIZE(expand_id_test_data);
diff --git a/tests/libgit2/odb/packed.c b/tests/libgit2/odb/packed.c
index 3d502ed6d..b41041fc1 100644
--- a/tests/libgit2/odb/packed.c
+++ b/tests/libgit2/odb/packed.c
@@ -6,7 +6,7 @@ static git_odb *_odb;
void test_odb_packed__initialize(void)
{
- cl_git_pass(git_odb_open(&_odb, cl_fixture("testrepo.git/objects")));
+ cl_git_pass(git_odb__open(&_odb, cl_fixture("testrepo.git/objects"), NULL));
}
void test_odb_packed__cleanup(void)
@@ -23,7 +23,7 @@ void test_odb_packed__mass_read(void)
git_oid id;
git_odb_object *obj;
- cl_git_pass(git_oid_fromstr(&id, packed_objects[i]));
+ cl_git_pass(git_oid__fromstr(&id, packed_objects[i], GIT_OID_SHA1));
cl_assert(git_odb_exists(_odb, &id) == 1);
cl_git_pass(git_odb_read(&obj, _odb, &id));
@@ -41,7 +41,7 @@ void test_odb_packed__read_header_0(void)
size_t len;
git_object_t type;
- cl_git_pass(git_oid_fromstr(&id, packed_objects[i]));
+ cl_git_pass(git_oid__fromstr(&id, packed_objects[i], GIT_OID_SHA1));
cl_git_pass(git_odb_read(&obj, _odb, &id));
cl_git_pass(git_odb_read_header(&len, &type, _odb, &id));
@@ -63,7 +63,7 @@ void test_odb_packed__read_header_1(void)
size_t len;
git_object_t type;
- cl_git_pass(git_oid_fromstr(&id, loose_objects[i]));
+ cl_git_pass(git_oid__fromstr(&id, loose_objects[i], GIT_OID_SHA1));
cl_assert(git_odb_exists(_odb, &id) == 1);
diff --git a/tests/libgit2/odb/packed_one.c b/tests/libgit2/odb/packed_one.c
index 17cd4f760..7a1d3d913 100644
--- a/tests/libgit2/odb/packed_one.c
+++ b/tests/libgit2/odb/packed_one.c
@@ -10,7 +10,7 @@ void test_odb_packed_one__initialize(void)
{
git_odb_backend *backend = NULL;
- cl_git_pass(git_odb_new(&_odb));
+ cl_git_pass(git_odb__new(&_odb, NULL));
cl_git_pass(git_odb_backend_one_pack(&backend, cl_fixture("testrepo.git/objects/pack/pack-a81e489679b7d3418f9ab594bda8ceb37dd4c695.idx")));
cl_git_pass(git_odb_add_backend(_odb, backend, 1));
}
@@ -29,7 +29,7 @@ void test_odb_packed_one__mass_read(void)
git_oid id;
git_odb_object *obj;
- cl_git_pass(git_oid_fromstr(&id, packed_objects_one[i]));
+ cl_git_pass(git_oid__fromstr(&id, packed_objects_one[i], GIT_OID_SHA1));
cl_assert(git_odb_exists(_odb, &id) == 1);
cl_git_pass(git_odb_read(&obj, _odb, &id));
@@ -47,7 +47,7 @@ void test_odb_packed_one__read_header_0(void)
size_t len;
git_object_t type;
- cl_git_pass(git_oid_fromstr(&id, packed_objects_one[i]));
+ cl_git_pass(git_oid__fromstr(&id, packed_objects_one[i], GIT_OID_SHA1));
cl_git_pass(git_odb_read(&obj, _odb, &id));
cl_git_pass(git_odb_read_header(&len, &type, _odb, &id));
diff --git a/tests/libgit2/odb/sorting.c b/tests/libgit2/odb/sorting.c
index e027230fa..1010872f4 100644
--- a/tests/libgit2/odb/sorting.c
+++ b/tests/libgit2/odb/sorting.c
@@ -37,7 +37,7 @@ static git_odb *_odb;
void test_odb_sorting__initialize(void)
{
- cl_git_pass(git_odb_new(&_odb));
+ cl_git_pass(git_odb__new(&_odb, NULL));
}
void test_odb_sorting__cleanup(void)
@@ -79,12 +79,13 @@ void test_odb_sorting__override_default_backend_priority(void)
{
git_odb *new_odb;
git_odb_backend *loose, *packed, *backend;
+
cl_git_pass(git_libgit2_opts(GIT_OPT_SET_ODB_LOOSE_PRIORITY, 5));
cl_git_pass(git_libgit2_opts(GIT_OPT_SET_ODB_PACKED_PRIORITY, 3));
git_odb_backend_pack(&packed, "./testrepo.git/objects");
- git_odb_backend_loose(&loose, "./testrepo.git/objects", -1, 0, 0, 0);
+ git_odb__backend_loose(&loose, "./testrepo.git/objects", NULL);
- cl_git_pass(git_odb_open(&new_odb, cl_fixture("testrepo.git/objects")));
+ cl_git_pass(git_odb__open(&new_odb, cl_fixture("testrepo.git/objects"), NULL));
cl_assert_equal_sz(2, git_odb_num_backends(new_odb));
cl_git_pass(git_odb_get_backend(&backend, new_odb, 0));
diff --git a/tests/libgit2/online/clone.c b/tests/libgit2/online/clone.c
index dfaee0e85..6a087b1af 100644
--- a/tests/libgit2/online/clone.c
+++ b/tests/libgit2/online/clone.c
@@ -484,9 +484,13 @@ void test_online_clone__bitbucket_falls_back_to_specified_creds(void)
void test_online_clone__googlesource(void)
{
+#ifdef __APPLE__
+ cl_skip();
+#else
cl_git_pass(git_clone(&g_repo, GOOGLESOURCE_REPO_URL, "./foo", &g_options));
git_repository_free(g_repo); g_repo = NULL;
cl_fixture_cleanup("./foo");
+#endif
}
static int cancel_at_half(const git_indexer_progress *stats, void *payload)
@@ -629,14 +633,14 @@ void test_online_clone__ssh_cannot_change_username(void)
static int ssh_certificate_check(git_cert *cert, int valid, const char *host, void *payload)
{
git_cert_hostkey *key;
- git_oid expected = {{0}}, actual = {{0}};
+ git_oid expected = GIT_OID_SHA1_ZERO, actual = GIT_OID_SHA1_ZERO;
GIT_UNUSED(valid);
GIT_UNUSED(payload);
cl_assert(_remote_ssh_fingerprint);
- cl_git_pass(git_oid_fromstrp(&expected, _remote_ssh_fingerprint));
+ cl_git_pass(git_oid__fromstrp(&expected, _remote_ssh_fingerprint, GIT_OID_SHA1));
cl_assert_equal_i(GIT_CERT_HOSTKEY_LIBSSH2, cert->cert_type);
key = (git_cert_hostkey *) cert;
diff --git a/tests/libgit2/online/fetch.c b/tests/libgit2/online/fetch.c
index 5beb5b618..a557bbf75 100644
--- a/tests/libgit2/online/fetch.c
+++ b/tests/libgit2/online/fetch.c
@@ -304,7 +304,7 @@ void test_online_fetch__reachable_commit(void)
refspecs.strings = &refspec;
refspecs.count = 1;
- git_oid_fromstr(&expected_id, "2c349335b7f797072cf729c4f3bb0914ecb6dec9");
+ git_oid__fromstr(&expected_id, "2c349335b7f797072cf729c4f3bb0914ecb6dec9", GIT_OID_SHA1);
cl_git_pass(git_remote_create(&remote, _repo, "test",
"https://github.com/libgit2/TestGitRepository"));
@@ -334,7 +334,7 @@ void test_online_fetch__reachable_commit_without_destination(void)
refspecs.strings = &refspec;
refspecs.count = 1;
- git_oid_fromstr(&expected_id, "2c349335b7f797072cf729c4f3bb0914ecb6dec9");
+ git_oid__fromstr(&expected_id, "2c349335b7f797072cf729c4f3bb0914ecb6dec9", GIT_OID_SHA1);
cl_git_pass(git_remote_create(&remote, _repo, "test",
"https://github.com/libgit2/TestGitRepository"));
diff --git a/tests/libgit2/online/push.c b/tests/libgit2/online/push.c
index 51adc3930..d9208d28a 100644
--- a/tests/libgit2/online/push.c
+++ b/tests/libgit2/online/push.c
@@ -344,18 +344,18 @@ void test_online_push__initialize(void)
* * a78705c3b2725f931d3ee05348d83cc26700f247 (b2, b1) added fold and fold/b.txt
* * 5c0bb3d1b9449d1cc69d7519fd05166f01840915 added a.txt
*/
- git_oid_fromstr(&_oid_b6, "951bbbb90e2259a4c8950db78946784fb53fcbce");
- git_oid_fromstr(&_oid_b5, "fa38b91f199934685819bea316186d8b008c52a2");
- git_oid_fromstr(&_oid_b4, "27b7ce66243eb1403862d05f958c002312df173d");
- git_oid_fromstr(&_oid_b3, "d9b63a88223d8367516f50bd131a5f7349b7f3e4");
- git_oid_fromstr(&_oid_b2, "a78705c3b2725f931d3ee05348d83cc26700f247");
- git_oid_fromstr(&_oid_b1, "a78705c3b2725f931d3ee05348d83cc26700f247");
-
- git_oid_fromstr(&_tag_commit, "805c54522e614f29f70d2413a0470247d8b424ac");
- git_oid_fromstr(&_tag_tree, "ff83aa4c5e5d28e3bcba2f5c6e2adc61286a4e5e");
- git_oid_fromstr(&_tag_blob, "b483ae7ba66decee9aee971f501221dea84b1498");
- git_oid_fromstr(&_tag_lightweight, "951bbbb90e2259a4c8950db78946784fb53fcbce");
- git_oid_fromstr(&_tag_tag, "eea4f2705eeec2db3813f2430829afce99cd00b5");
+ git_oid__fromstr(&_oid_b6, "951bbbb90e2259a4c8950db78946784fb53fcbce", GIT_OID_SHA1);
+ git_oid__fromstr(&_oid_b5, "fa38b91f199934685819bea316186d8b008c52a2", GIT_OID_SHA1);
+ git_oid__fromstr(&_oid_b4, "27b7ce66243eb1403862d05f958c002312df173d", GIT_OID_SHA1);
+ git_oid__fromstr(&_oid_b3, "d9b63a88223d8367516f50bd131a5f7349b7f3e4", GIT_OID_SHA1);
+ git_oid__fromstr(&_oid_b2, "a78705c3b2725f931d3ee05348d83cc26700f247", GIT_OID_SHA1);
+ git_oid__fromstr(&_oid_b1, "a78705c3b2725f931d3ee05348d83cc26700f247", GIT_OID_SHA1);
+
+ git_oid__fromstr(&_tag_commit, "805c54522e614f29f70d2413a0470247d8b424ac", GIT_OID_SHA1);
+ git_oid__fromstr(&_tag_tree, "ff83aa4c5e5d28e3bcba2f5c6e2adc61286a4e5e", GIT_OID_SHA1);
+ git_oid__fromstr(&_tag_blob, "b483ae7ba66decee9aee971f501221dea84b1498", GIT_OID_SHA1);
+ git_oid__fromstr(&_tag_lightweight, "951bbbb90e2259a4c8950db78946784fb53fcbce", GIT_OID_SHA1);
+ git_oid__fromstr(&_tag_tag, "eea4f2705eeec2db3813f2430829afce99cd00b5", GIT_OID_SHA1);
/* Remote URL environment variable must be set. User and password are optional. */
@@ -859,7 +859,7 @@ void test_online_push__notes(void)
expected_ref exp_refs[] = { { "refs/notes/commits", &expected_oid } };
const char *specs_del[] = { ":refs/notes/commits" };
- git_oid_fromstr(&expected_oid, "8461a99b27b7043e58ff6e1f5d2cf07d282534fb");
+ git_oid__fromstr(&expected_oid, "8461a99b27b7043e58ff6e1f5d2cf07d282534fb", GIT_OID_SHA1);
target_oid = &_oid_b6;
@@ -890,7 +890,7 @@ void test_online_push__configured(void)
expected_ref exp_refs[] = { { "refs/notes/commits", &expected_oid } };
const char *specs_del[] = { ":refs/notes/commits" };
- git_oid_fromstr(&expected_oid, "8461a99b27b7043e58ff6e1f5d2cf07d282534fb");
+ git_oid__fromstr(&expected_oid, "8461a99b27b7043e58ff6e1f5d2cf07d282534fb", GIT_OID_SHA1);
target_oid = &_oid_b6;
diff --git a/tests/libgit2/online/push_util.c b/tests/libgit2/online/push_util.c
index cd1831d4c..94919e9b2 100644
--- a/tests/libgit2/online/push_util.c
+++ b/tests/libgit2/online/push_util.c
@@ -2,8 +2,6 @@
#include "vector.h"
#include "push_util.h"
-const git_oid OID_ZERO = {{ 0 }};
-
void updated_tip_free(updated_tip *t)
{
git__free(t->name);
diff --git a/tests/libgit2/pack/indexer.c b/tests/libgit2/pack/indexer.c
index 94b2cc92e..2ac287255 100644
--- a/tests/libgit2/pack/indexer.c
+++ b/tests/libgit2/pack/indexer.c
@@ -157,7 +157,7 @@ void test_pack_indexer__fix_thin(void)
/* Store the missing base into your ODB so the indexer can fix the pack */
cl_git_pass(git_odb_write(&id, odb, base_obj, base_obj_len, GIT_OBJECT_BLOB));
- git_oid_fromstr(&should_id, "e68fe8129b546b101aee9510c5328e7f21ca1d18");
+ git_oid__fromstr(&should_id, "e68fe8129b546b101aee9510c5328e7f21ca1d18", GIT_OID_SHA1);
cl_assert_equal_oid(&should_id, &id);
cl_git_pass(git_indexer_new(&idx, ".", 0, odb, NULL));
@@ -222,7 +222,7 @@ void test_pack_indexer__corrupt_length(void)
/* Store the missing base into your ODB so the indexer can fix the pack */
cl_git_pass(git_odb_write(&id, odb, base_obj, base_obj_len, GIT_OBJECT_BLOB));
- git_oid_fromstr(&should_id, "e68fe8129b546b101aee9510c5328e7f21ca1d18");
+ git_oid__fromstr(&should_id, "e68fe8129b546b101aee9510c5328e7f21ca1d18", GIT_OID_SHA1);
cl_assert_equal_oid(&should_id, &id);
cl_git_pass(git_indexer_new(&idx, ".", 0, odb, NULL));
diff --git a/tests/libgit2/pack/midx.c b/tests/libgit2/pack/midx.c
index 9dd949363..f7d680165 100644
--- a/tests/libgit2/pack/midx.c
+++ b/tests/libgit2/pack/midx.c
@@ -19,8 +19,8 @@ void test_pack_midx__parse(void)
cl_git_pass(git_midx_open(&idx, git_str_cstr(&midx_path)));
cl_assert_equal_i(git_midx_needs_refresh(idx, git_str_cstr(&midx_path)), 0);
- cl_git_pass(git_oid_fromstr(&id, "5001298e0c09ad9c34e4249bc5801c75e9754fa5"));
- cl_git_pass(git_midx_entry_find(&e, idx, &id, GIT_OID_HEXSZ));
+ cl_git_pass(git_oid__fromstr(&id, "5001298e0c09ad9c34e4249bc5801c75e9754fa5", GIT_OID_SHA1));
+ cl_git_pass(git_midx_entry_find(&e, idx, &id, GIT_OID_SHA1_HEXSIZE));
cl_assert_equal_oid(&e.sha1, &id);
cl_assert_equal_s(
(const char *)git_vector_get(&idx->packfile_names, e.pack_index),
@@ -39,8 +39,8 @@ void test_pack_midx__lookup(void)
cl_git_pass(git_repository_open(&repo, cl_fixture("testrepo.git")));
- cl_git_pass(git_oid_fromstr(&id, "5001298e0c09ad9c34e4249bc5801c75e9754fa5"));
- cl_git_pass(git_commit_lookup_prefix(&commit, repo, &id, GIT_OID_HEXSZ));
+ cl_git_pass(git_oid__fromstr(&id, "5001298e0c09ad9c34e4249bc5801c75e9754fa5", GIT_OID_SHA1));
+ cl_git_pass(git_commit_lookup_prefix(&commit, repo, &id, GIT_OID_SHA1_HEXSIZE));
cl_assert_equal_s(git_commit_message(commit), "packed commit one\n");
git_commit_free(commit);
diff --git a/tests/libgit2/pack/sharing.c b/tests/libgit2/pack/sharing.c
index eaf7686b7..2e2042d2b 100644
--- a/tests/libgit2/pack/sharing.c
+++ b/tests/libgit2/pack/sharing.c
@@ -18,7 +18,7 @@ void test_pack_sharing__open_two_repos(void)
cl_git_pass(git_repository_open(&repo1, cl_fixture("testrepo.git")));
cl_git_pass(git_repository_open(&repo2, cl_fixture("testrepo.git")));
- git_oid_fromstr(&id, "a65fedf39aefe402d3bb6e24df4d4f5fe4547750");
+ git_oid__fromstr(&id, "a65fedf39aefe402d3bb6e24df4d4f5fe4547750", GIT_OID_SHA1);
cl_git_pass(git_object_lookup(&obj1, repo1, &id, GIT_OBJECT_ANY));
cl_git_pass(git_object_lookup(&obj2, repo2, &id, GIT_OBJECT_ANY));
diff --git a/tests/libgit2/patch/parse.c b/tests/libgit2/patch/parse.c
index a3c4c6730..d90576e46 100644
--- a/tests/libgit2/patch/parse.c
+++ b/tests/libgit2/patch/parse.c
@@ -7,7 +7,7 @@
static void ensure_patch_validity(git_patch *patch)
{
const git_diff_delta *delta;
- char idstr[GIT_OID_HEXSZ+1] = {0};
+ char idstr[GIT_OID_SHA1_HEXSIZE+1] = {0};
cl_assert((delta = git_patch_get_delta(patch)) != NULL);
cl_assert_equal_i(2, delta->nfiles);
diff --git a/tests/libgit2/perf/helper__perf__do_merge.c b/tests/libgit2/perf/helper__perf__do_merge.c
index c77b46a1f..eb10524ec 100644
--- a/tests/libgit2/perf/helper__perf__do_merge.c
+++ b/tests/libgit2/perf/helper__perf__do_merge.c
@@ -33,7 +33,7 @@ void perf__do_merge(const char *fixture,
cl_git_pass(git_clone(&g_repo, fixture, test_name, &clone_opts));
perf__timer__stop(&t_clone);
- git_oid_fromstr(&oid_a, id_a);
+ git_oid__fromstr(&oid_a, id_a, GIT_OID_SHA1);
cl_git_pass(git_commit_lookup(&commit_a, g_repo, &oid_a));
cl_git_pass(git_branch_create(&ref_branch_a, g_repo,
"A", commit_a,
@@ -45,7 +45,7 @@ void perf__do_merge(const char *fixture,
cl_git_pass(git_repository_set_head(g_repo, git_reference_name(ref_branch_a)));
- git_oid_fromstr(&oid_b, id_b);
+ git_oid__fromstr(&oid_b, id_b, GIT_OID_SHA1);
cl_git_pass(git_commit_lookup(&commit_b, g_repo, &oid_b));
cl_git_pass(git_branch_create(&ref_branch_b, g_repo,
"B", commit_b,
diff --git a/tests/libgit2/rebase/abort.c b/tests/libgit2/rebase/abort.c
index a83c529ce..da0dfe893 100644
--- a/tests/libgit2/rebase/abort.c
+++ b/tests/libgit2/rebase/abort.c
@@ -128,8 +128,8 @@ void test_rebase_abort__merge_by_id(void)
git_oid branch_id, onto_id;
git_annotated_commit *branch_head, *onto_head;
- cl_git_pass(git_oid_fromstr(&branch_id, "b146bd7608eac53d9bf9e1a6963543588b555c64"));
- cl_git_pass(git_oid_fromstr(&onto_id, "efad0b11c47cb2f0220cbd6f5b0f93bb99064b00"));
+ cl_git_pass(git_oid__fromstr(&branch_id, "b146bd7608eac53d9bf9e1a6963543588b555c64", GIT_OID_SHA1));
+ cl_git_pass(git_oid__fromstr(&onto_id, "efad0b11c47cb2f0220cbd6f5b0f93bb99064b00", GIT_OID_SHA1));
cl_git_pass(git_annotated_commit_lookup(&branch_head, repo, &branch_id));
cl_git_pass(git_annotated_commit_lookup(&onto_head, repo, &onto_id));
@@ -170,8 +170,8 @@ void test_rebase_abort__merge_by_id_immediately_after_init(void)
git_oid branch_id, onto_id;
git_annotated_commit *branch_head, *onto_head;
- cl_git_pass(git_oid_fromstr(&branch_id, "b146bd7608eac53d9bf9e1a6963543588b555c64"));
- cl_git_pass(git_oid_fromstr(&onto_id, "efad0b11c47cb2f0220cbd6f5b0f93bb99064b00"));
+ cl_git_pass(git_oid__fromstr(&branch_id, "b146bd7608eac53d9bf9e1a6963543588b555c64", GIT_OID_SHA1));
+ cl_git_pass(git_oid__fromstr(&onto_id, "efad0b11c47cb2f0220cbd6f5b0f93bb99064b00", GIT_OID_SHA1));
cl_git_pass(git_annotated_commit_lookup(&branch_head, repo, &branch_id));
cl_git_pass(git_annotated_commit_lookup(&onto_head, repo, &onto_id));
@@ -195,8 +195,8 @@ void test_rebase_abort__detached_head(void)
git_signature *signature;
git_annotated_commit *branch_head, *onto_head;
- git_oid_fromstr(&branch_id, "b146bd7608eac53d9bf9e1a6963543588b555c64");
- git_oid_fromstr(&onto_id, "efad0b11c47cb2f0220cbd6f5b0f93bb99064b00");
+ git_oid__fromstr(&branch_id, "b146bd7608eac53d9bf9e1a6963543588b555c64", GIT_OID_SHA1);
+ git_oid__fromstr(&onto_id, "efad0b11c47cb2f0220cbd6f5b0f93bb99064b00", GIT_OID_SHA1);
cl_git_pass(git_annotated_commit_lookup(&branch_head, repo, &branch_id));
cl_git_pass(git_annotated_commit_lookup(&onto_head, repo, &onto_id));
diff --git a/tests/libgit2/rebase/inmemory.c b/tests/libgit2/rebase/inmemory.c
index 040a81b1b..287dd9911 100644
--- a/tests/libgit2/rebase/inmemory.c
+++ b/tests/libgit2/rebase/inmemory.c
@@ -74,7 +74,7 @@ void test_rebase_inmemory__can_resolve_conflicts(void)
cl_git_pass(git_rebase_next(&rebase_operation, rebase));
- git_oid_fromstr(&pick_id, "33f915f9e4dbd9f4b24430e48731a59b45b15500");
+ git_oid__fromstr(&pick_id, "33f915f9e4dbd9f4b24430e48731a59b45b15500", GIT_OID_SHA1);
cl_assert_equal_i(GIT_REBASE_OPERATION_PICK, rebase_operation->type);
cl_assert_equal_oid(&pick_id, &rebase_operation->id);
@@ -95,14 +95,14 @@ void test_rebase_inmemory__can_resolve_conflicts(void)
/* ensure that we can work with the in-memory index to resolve the conflict */
resolution.path = "asparagus.txt";
resolution.mode = GIT_FILEMODE_BLOB;
- git_oid_fromstr(&resolution.id, "414dfc71ead79c07acd4ea47fecf91f289afc4b9");
+ git_oid__fromstr(&resolution.id, "414dfc71ead79c07acd4ea47fecf91f289afc4b9", GIT_OID_SHA1);
cl_git_pass(git_index_conflict_remove(rebase_index, "asparagus.txt"));
cl_git_pass(git_index_add(rebase_index, &resolution));
/* and finally create a commit for the resolved rebase operation */
cl_git_pass(git_rebase_commit(&commit_id, rebase, NULL, signature, NULL, NULL));
- cl_git_pass(git_oid_fromstr(&expected_commit_id, "db7af47222181e548810da2ab5fec0e9357c5637"));
+ cl_git_pass(git_oid__fromstr(&expected_commit_id, "db7af47222181e548810da2ab5fec0e9357c5637", GIT_OID_SHA1));
cl_assert_equal_oid(&commit_id, &expected_commit_id);
git_status_list_free(status_list);
@@ -156,7 +156,7 @@ void test_rebase_inmemory__no_common_ancestor(void)
cl_git_pass(git_rebase_finish(rebase, signature));
- git_oid_fromstr(&expected_final_id, "71e7ee8d4fe7d8bf0d107355197e0a953dfdb7f3");
+ git_oid__fromstr(&expected_final_id, "71e7ee8d4fe7d8bf0d107355197e0a953dfdb7f3", GIT_OID_SHA1);
cl_assert_equal_oid(&expected_final_id, &commit_id);
git_annotated_commit_free(branch_head);
@@ -178,7 +178,7 @@ void test_rebase_inmemory__with_directories(void)
opts.inmemory = true;
- git_oid_fromstr(&tree_id, "a4d6d9c3d57308fd8e320cf2525bae8f1adafa57");
+ git_oid__fromstr(&tree_id, "a4d6d9c3d57308fd8e320cf2525bae8f1adafa57", GIT_OID_SHA1);
cl_git_pass(git_reference_lookup(&branch_ref, repo, "refs/heads/deep_gravy"));
cl_git_pass(git_reference_lookup(&upstream_ref, repo, "refs/heads/veal"));
diff --git a/tests/libgit2/rebase/iterator.c b/tests/libgit2/rebase/iterator.c
index a120f28ac..79e9f3e58 100644
--- a/tests/libgit2/rebase/iterator.c
+++ b/tests/libgit2/rebase/iterator.c
@@ -30,11 +30,11 @@ static void test_operations(git_rebase *rebase, size_t expected_current)
git_oid expected_oid[5];
git_rebase_operation *operation;
- git_oid_fromstr(&expected_oid[0], "da9c51a23d02d931a486f45ad18cda05cf5d2b94");
- git_oid_fromstr(&expected_oid[1], "8d1f13f93c4995760ac07d129246ac1ff64c0be9");
- git_oid_fromstr(&expected_oid[2], "3069cc907e6294623e5917ef6de663928c1febfb");
- git_oid_fromstr(&expected_oid[3], "588e5d2f04d49707fe4aab865e1deacaf7ef6787");
- git_oid_fromstr(&expected_oid[4], "b146bd7608eac53d9bf9e1a6963543588b555c64");
+ git_oid__fromstr(&expected_oid[0], "da9c51a23d02d931a486f45ad18cda05cf5d2b94", GIT_OID_SHA1);
+ git_oid__fromstr(&expected_oid[1], "8d1f13f93c4995760ac07d129246ac1ff64c0be9", GIT_OID_SHA1);
+ git_oid__fromstr(&expected_oid[2], "3069cc907e6294623e5917ef6de663928c1febfb", GIT_OID_SHA1);
+ git_oid__fromstr(&expected_oid[3], "588e5d2f04d49707fe4aab865e1deacaf7ef6787", GIT_OID_SHA1);
+ git_oid__fromstr(&expected_oid[4], "b146bd7608eac53d9bf9e1a6963543588b555c64", GIT_OID_SHA1);
cl_assert_equal_i(expected_count, git_rebase_operation_entrycount(rebase));
cl_assert_equal_i(expected_current, git_rebase_operation_current(rebase));
@@ -78,7 +78,7 @@ static void test_iterator(bool inmemory)
NULL, NULL));
test_operations(rebase, 0);
- git_oid_fromstr(&expected_id, "776e4c48922799f903f03f5f6e51da8b01e4cce0");
+ git_oid__fromstr(&expected_id, "776e4c48922799f903f03f5f6e51da8b01e4cce0", GIT_OID_SHA1);
cl_assert_equal_oid(&expected_id, &commit_id);
cl_git_pass(git_rebase_next(&rebase_operation, rebase));
@@ -86,7 +86,7 @@ static void test_iterator(bool inmemory)
NULL, NULL));
test_operations(rebase, 1);
- git_oid_fromstr(&expected_id, "ba1f9b4fd5cf8151f7818be2111cc0869f1eb95a");
+ git_oid__fromstr(&expected_id, "ba1f9b4fd5cf8151f7818be2111cc0869f1eb95a", GIT_OID_SHA1);
cl_assert_equal_oid(&expected_id, &commit_id);
cl_git_pass(git_rebase_next(&rebase_operation, rebase));
@@ -94,7 +94,7 @@ static void test_iterator(bool inmemory)
NULL, NULL));
test_operations(rebase, 2);
- git_oid_fromstr(&expected_id, "948b12fe18b84f756223a61bece4c307787cd5d4");
+ git_oid__fromstr(&expected_id, "948b12fe18b84f756223a61bece4c307787cd5d4", GIT_OID_SHA1);
cl_assert_equal_oid(&expected_id, &commit_id);
if (!inmemory) {
@@ -107,7 +107,7 @@ static void test_iterator(bool inmemory)
NULL, NULL));
test_operations(rebase, 3);
- git_oid_fromstr(&expected_id, "d9d5d59d72c9968687f9462578d79878cd80e781");
+ git_oid__fromstr(&expected_id, "d9d5d59d72c9968687f9462578d79878cd80e781", GIT_OID_SHA1);
cl_assert_equal_oid(&expected_id, &commit_id);
cl_git_pass(git_rebase_next(&rebase_operation, rebase));
@@ -115,7 +115,7 @@ static void test_iterator(bool inmemory)
NULL, NULL));
test_operations(rebase, 4);
- git_oid_fromstr(&expected_id, "9cf383c0a125d89e742c5dec58ed277dd07588b3");
+ git_oid__fromstr(&expected_id, "9cf383c0a125d89e742c5dec58ed277dd07588b3", GIT_OID_SHA1);
cl_assert_equal_oid(&expected_id, &commit_id);
cl_git_fail(error = git_rebase_next(&rebase_operation, rebase));
diff --git a/tests/libgit2/rebase/merge.c b/tests/libgit2/rebase/merge.c
index 5f730f750..870c3ea2f 100644
--- a/tests/libgit2/rebase/merge.c
+++ b/tests/libgit2/rebase/merge.c
@@ -46,8 +46,8 @@ void test_rebase_merge__next(void)
git_oid pick_id, file1_id;
git_oid master_id, beef_id;
- git_oid_fromstr(&master_id, "efad0b11c47cb2f0220cbd6f5b0f93bb99064b00");
- git_oid_fromstr(&beef_id, "b146bd7608eac53d9bf9e1a6963543588b555c64");
+ git_oid__fromstr(&master_id, "efad0b11c47cb2f0220cbd6f5b0f93bb99064b00", GIT_OID_SHA1);
+ git_oid__fromstr(&beef_id, "b146bd7608eac53d9bf9e1a6963543588b555c64", GIT_OID_SHA1);
cl_git_pass(git_reference_lookup(&branch_ref, repo, "refs/heads/beef"));
cl_git_pass(git_reference_lookup(&upstream_ref, repo, "refs/heads/master"));
@@ -65,7 +65,7 @@ void test_rebase_merge__next(void)
cl_git_pass(git_rebase_next(&rebase_operation, rebase));
- git_oid_fromstr(&pick_id, "da9c51a23d02d931a486f45ad18cda05cf5d2b94");
+ git_oid__fromstr(&pick_id, "da9c51a23d02d931a486f45ad18cda05cf5d2b94", GIT_OID_SHA1);
cl_assert_equal_i(GIT_REBASE_OPERATION_PICK, rebase_operation->type);
cl_assert_equal_oid(&pick_id, &rebase_operation->id);
@@ -78,7 +78,7 @@ void test_rebase_merge__next(void)
cl_assert_equal_s("beef.txt", status_entry->head_to_index->new_file.path);
- git_oid_fromstr(&file1_id, "8d95ea62e621f1d38d230d9e7d206e41096d76af");
+ git_oid__fromstr(&file1_id, "8d95ea62e621f1d38d230d9e7d206e41096d76af", GIT_OID_SHA1);
cl_assert_equal_oid(&file1_id, &status_entry->head_to_index->new_file.id);
git_status_list_free(status_list);
@@ -129,7 +129,7 @@ void test_rebase_merge__next_with_conflicts(void)
cl_git_pass(git_rebase_next(&rebase_operation, rebase));
- git_oid_fromstr(&pick_id, "33f915f9e4dbd9f4b24430e48731a59b45b15500");
+ git_oid__fromstr(&pick_id, "33f915f9e4dbd9f4b24430e48731a59b45b15500", GIT_OID_SHA1);
cl_assert_equal_i(GIT_REBASE_OPERATION_PICK, rebase_operation->type);
cl_assert_equal_oid(&pick_id, &rebase_operation->id);
@@ -230,11 +230,11 @@ void test_rebase_merge__commit(void)
cl_git_pass(git_commit_lookup(&commit, repo, &commit_id));
- git_oid_fromstr(&parent_id, "efad0b11c47cb2f0220cbd6f5b0f93bb99064b00");
+ git_oid__fromstr(&parent_id, "efad0b11c47cb2f0220cbd6f5b0f93bb99064b00", GIT_OID_SHA1);
cl_assert_equal_i(1, git_commit_parentcount(commit));
cl_assert_equal_oid(&parent_id, git_commit_parent_id(commit, 0));
- git_oid_fromstr(&tree_id, "4461379789c777d2a6c1f2ee0e9d6c86731b9992");
+ git_oid__fromstr(&tree_id, "4461379789c777d2a6c1f2ee0e9d6c86731b9992", GIT_OID_SHA1);
cl_assert_equal_oid(&tree_id, git_commit_tree_id(commit));
cl_assert_equal_s(NULL, git_commit_message_encoding(commit));
@@ -275,8 +275,8 @@ void test_rebase_merge__commit_with_id(void)
git_reflog *reflog;
const git_reflog_entry *reflog_entry;
- cl_git_pass(git_oid_fromstr(&branch_id, "b146bd7608eac53d9bf9e1a6963543588b555c64"));
- cl_git_pass(git_oid_fromstr(&upstream_id, "efad0b11c47cb2f0220cbd6f5b0f93bb99064b00"));
+ cl_git_pass(git_oid__fromstr(&branch_id, "b146bd7608eac53d9bf9e1a6963543588b555c64", GIT_OID_SHA1));
+ cl_git_pass(git_oid__fromstr(&upstream_id, "efad0b11c47cb2f0220cbd6f5b0f93bb99064b00", GIT_OID_SHA1));
cl_git_pass(git_annotated_commit_lookup(&branch_head, repo, &branch_id));
cl_git_pass(git_annotated_commit_lookup(&upstream_head, repo, &upstream_id));
@@ -289,11 +289,11 @@ void test_rebase_merge__commit_with_id(void)
cl_git_pass(git_commit_lookup(&commit, repo, &commit_id));
- git_oid_fromstr(&parent_id, "efad0b11c47cb2f0220cbd6f5b0f93bb99064b00");
+ git_oid__fromstr(&parent_id, "efad0b11c47cb2f0220cbd6f5b0f93bb99064b00", GIT_OID_SHA1);
cl_assert_equal_i(1, git_commit_parentcount(commit));
cl_assert_equal_oid(&parent_id, git_commit_parent_id(commit, 0));
- git_oid_fromstr(&tree_id, "4461379789c777d2a6c1f2ee0e9d6c86731b9992");
+ git_oid__fromstr(&tree_id, "4461379789c777d2a6c1f2ee0e9d6c86731b9992", GIT_OID_SHA1);
cl_assert_equal_oid(&tree_id, git_commit_tree_id(commit));
cl_assert_equal_s(NULL, git_commit_message_encoding(commit));
@@ -551,8 +551,8 @@ void test_rebase_merge__finish_with_ids(void)
const git_reflog_entry *reflog_entry;
int error;
- cl_git_pass(git_oid_fromstr(&branch_id, "d616d97082eb7bb2dc6f180a7cca940993b7a56f"));
- cl_git_pass(git_oid_fromstr(&upstream_id, "f87d14a4a236582a0278a916340a793714256864"));
+ cl_git_pass(git_oid__fromstr(&branch_id, "d616d97082eb7bb2dc6f180a7cca940993b7a56f", GIT_OID_SHA1));
+ cl_git_pass(git_oid__fromstr(&upstream_id, "f87d14a4a236582a0278a916340a793714256864", GIT_OID_SHA1));
cl_git_pass(git_annotated_commit_lookup(&branch_head, repo, &branch_id));
cl_git_pass(git_annotated_commit_lookup(&upstream_head, repo, &upstream_id));
@@ -627,7 +627,7 @@ void test_rebase_merge__no_common_ancestor(void)
cl_git_pass(git_rebase_finish(rebase, signature));
- git_oid_fromstr(&expected_final_id, "71e7ee8d4fe7d8bf0d107355197e0a953dfdb7f3");
+ git_oid__fromstr(&expected_final_id, "71e7ee8d4fe7d8bf0d107355197e0a953dfdb7f3", GIT_OID_SHA1);
cl_assert_equal_oid(&expected_final_id, &commit_id);
git_annotated_commit_free(branch_head);
@@ -823,7 +823,7 @@ void test_rebase_merge__with_directories(void)
git_oid commit_id, tree_id;
git_commit *commit;
- git_oid_fromstr(&tree_id, "a4d6d9c3d57308fd8e320cf2525bae8f1adafa57");
+ git_oid__fromstr(&tree_id, "a4d6d9c3d57308fd8e320cf2525bae8f1adafa57", GIT_OID_SHA1);
cl_git_pass(git_reference_lookup(&branch_ref, repo, "refs/heads/deep_gravy"));
cl_git_pass(git_reference_lookup(&upstream_ref, repo, "refs/heads/veal"));
diff --git a/tests/libgit2/rebase/setup.c b/tests/libgit2/rebase/setup.c
index 34d5edbf6..ac0d087ea 100644
--- a/tests/libgit2/rebase/setup.c
+++ b/tests/libgit2/rebase/setup.c
@@ -74,7 +74,7 @@ void test_rebase_setup__merge(void)
cl_assert_equal_i(GIT_REPOSITORY_STATE_REBASE_MERGE, git_repository_state(repo));
- git_oid_fromstr(&head_id, "efad0b11c47cb2f0220cbd6f5b0f93bb99064b00");
+ git_oid__fromstr(&head_id, "efad0b11c47cb2f0220cbd6f5b0f93bb99064b00", GIT_OID_SHA1);
cl_git_pass(git_repository_head(&head, repo));
cl_git_pass(git_reference_peel((git_object **)&head_commit, head, GIT_OBJECT_COMMIT));
cl_assert_equal_oid(&head_id, git_commit_id(head_commit));
@@ -120,7 +120,7 @@ void test_rebase_setup__merge_root(void)
cl_git_pass(git_rebase_init(&rebase, repo, branch_head, NULL, onto_head, NULL));
- git_oid_fromstr(&head_id, "efad0b11c47cb2f0220cbd6f5b0f93bb99064b00");
+ git_oid__fromstr(&head_id, "efad0b11c47cb2f0220cbd6f5b0f93bb99064b00", GIT_OID_SHA1);
cl_git_pass(git_repository_head(&head, repo));
cl_git_pass(git_reference_peel((git_object **)&head_commit, head, GIT_OBJECT_COMMIT));
cl_assert_equal_oid(&head_id, git_commit_id(head_commit));
@@ -170,7 +170,7 @@ void test_rebase_setup__merge_onto_and_upstream(void)
cl_git_pass(git_rebase_init(&rebase, repo, branch1_head, branch2_head, onto_head, NULL));
- git_oid_fromstr(&head_id, "efad0b11c47cb2f0220cbd6f5b0f93bb99064b00");
+ git_oid__fromstr(&head_id, "efad0b11c47cb2f0220cbd6f5b0f93bb99064b00", GIT_OID_SHA1);
cl_git_pass(git_repository_head(&head, repo));
cl_git_pass(git_reference_peel((git_object **)&head_commit, head, GIT_OBJECT_COMMIT));
cl_assert_equal_oid(&head_id, git_commit_id(head_commit));
@@ -224,7 +224,7 @@ void test_rebase_setup__merge_onto_upstream_and_branch(void)
cl_git_pass(git_rebase_init(&rebase, repo, branch_head, upstream_head, onto_head, NULL));
- git_oid_fromstr(&head_id, "efad0b11c47cb2f0220cbd6f5b0f93bb99064b00");
+ git_oid__fromstr(&head_id, "efad0b11c47cb2f0220cbd6f5b0f93bb99064b00", GIT_OID_SHA1);
cl_git_pass(git_repository_head(&head, repo));
cl_git_pass(git_reference_peel((git_object **)&head_commit, head, GIT_OBJECT_COMMIT));
cl_assert_equal_oid(&head_id, git_commit_id(head_commit));
@@ -272,9 +272,9 @@ void test_rebase_setup__merge_onto_upstream_and_branch_by_id(void)
cl_git_pass(git_repository_set_head(repo, "refs/heads/beef"));
cl_git_pass(git_checkout_head(repo, &checkout_opts));
- cl_git_pass(git_oid_fromstr(&upstream_id, "f87d14a4a236582a0278a916340a793714256864"));
- cl_git_pass(git_oid_fromstr(&branch_id, "d616d97082eb7bb2dc6f180a7cca940993b7a56f"));
- cl_git_pass(git_oid_fromstr(&onto_id, "efad0b11c47cb2f0220cbd6f5b0f93bb99064b00"));
+ cl_git_pass(git_oid__fromstr(&upstream_id, "f87d14a4a236582a0278a916340a793714256864", GIT_OID_SHA1));
+ cl_git_pass(git_oid__fromstr(&branch_id, "d616d97082eb7bb2dc6f180a7cca940993b7a56f", GIT_OID_SHA1));
+ cl_git_pass(git_oid__fromstr(&onto_id, "efad0b11c47cb2f0220cbd6f5b0f93bb99064b00", GIT_OID_SHA1));
cl_git_pass(git_annotated_commit_lookup(&upstream_head, repo, &upstream_id));
cl_git_pass(git_annotated_commit_lookup(&branch_head, repo, &branch_id));
@@ -282,7 +282,7 @@ void test_rebase_setup__merge_onto_upstream_and_branch_by_id(void)
cl_git_pass(git_rebase_init(&rebase, repo, branch_head, upstream_head, onto_head, NULL));
- git_oid_fromstr(&head_id, "efad0b11c47cb2f0220cbd6f5b0f93bb99064b00");
+ git_oid__fromstr(&head_id, "efad0b11c47cb2f0220cbd6f5b0f93bb99064b00", GIT_OID_SHA1);
cl_git_pass(git_repository_head(&head, repo));
cl_git_pass(git_reference_peel((git_object **)&head_commit, head, GIT_OBJECT_COMMIT));
cl_assert_equal_oid(&head_id, git_commit_id(head_commit));
@@ -328,7 +328,7 @@ void test_rebase_setup__branch_with_merges(void)
cl_assert_equal_i(GIT_REPOSITORY_STATE_REBASE_MERGE, git_repository_state(repo));
- git_oid_fromstr(&head_id, "efad0b11c47cb2f0220cbd6f5b0f93bb99064b00");
+ git_oid__fromstr(&head_id, "efad0b11c47cb2f0220cbd6f5b0f93bb99064b00", GIT_OID_SHA1);
cl_git_pass(git_repository_head(&head, repo));
cl_git_pass(git_reference_peel((git_object **)&head_commit, head, GIT_OBJECT_COMMIT));
cl_assert_equal_oid(&head_id, git_commit_id(head_commit));
@@ -376,7 +376,7 @@ void test_rebase_setup__orphan_branch(void)
cl_assert_equal_i(GIT_REPOSITORY_STATE_REBASE_MERGE, git_repository_state(repo));
- git_oid_fromstr(&head_id, "efad0b11c47cb2f0220cbd6f5b0f93bb99064b00");
+ git_oid__fromstr(&head_id, "efad0b11c47cb2f0220cbd6f5b0f93bb99064b00", GIT_OID_SHA1);
cl_git_pass(git_repository_head(&head, repo));
cl_git_pass(git_reference_peel((git_object **)&head_commit, head, GIT_OBJECT_COMMIT));
cl_assert_equal_oid(&head_id, git_commit_id(head_commit));
@@ -427,7 +427,7 @@ void test_rebase_setup__merge_null_branch_uses_HEAD(void)
cl_assert_equal_i(GIT_REPOSITORY_STATE_REBASE_MERGE, git_repository_state(repo));
- git_oid_fromstr(&head_id, "efad0b11c47cb2f0220cbd6f5b0f93bb99064b00");
+ git_oid__fromstr(&head_id, "efad0b11c47cb2f0220cbd6f5b0f93bb99064b00", GIT_OID_SHA1);
cl_git_pass(git_repository_head(&head, repo));
cl_git_pass(git_reference_peel((git_object **)&head_commit, head, GIT_OBJECT_COMMIT));
cl_assert_equal_oid(&head_id, git_commit_id(head_commit));
@@ -465,7 +465,7 @@ void test_rebase_setup__merge_from_detached(void)
cl_git_pass(git_reference_lookup(&upstream_ref, repo, "refs/heads/master"));
- cl_git_pass(git_oid_fromstr(&branch_id, "b146bd7608eac53d9bf9e1a6963543588b555c64"));
+ cl_git_pass(git_oid__fromstr(&branch_id, "b146bd7608eac53d9bf9e1a6963543588b555c64", GIT_OID_SHA1));
cl_git_pass(git_annotated_commit_lookup(&branch_head, repo, &branch_id));
cl_git_pass(git_annotated_commit_from_ref(&upstream_head, repo, upstream_ref));
@@ -474,7 +474,7 @@ void test_rebase_setup__merge_from_detached(void)
cl_assert_equal_i(GIT_REPOSITORY_STATE_REBASE_MERGE, git_repository_state(repo));
- git_oid_fromstr(&head_id, "efad0b11c47cb2f0220cbd6f5b0f93bb99064b00");
+ git_oid__fromstr(&head_id, "efad0b11c47cb2f0220cbd6f5b0f93bb99064b00", GIT_OID_SHA1);
cl_git_pass(git_repository_head(&head, repo));
cl_git_pass(git_reference_peel((git_object **)&head_commit, head, GIT_OBJECT_COMMIT));
cl_assert_equal_oid(&head_id, git_commit_id(head_commit));
@@ -513,7 +513,7 @@ void test_rebase_setup__merge_branch_by_id(void)
cl_git_pass(git_reference_lookup(&branch_ref, repo, "refs/heads/beef"));
- cl_git_pass(git_oid_fromstr(&upstream_id, "efad0b11c47cb2f0220cbd6f5b0f93bb99064b00"));
+ cl_git_pass(git_oid__fromstr(&upstream_id, "efad0b11c47cb2f0220cbd6f5b0f93bb99064b00", GIT_OID_SHA1));
cl_git_pass(git_annotated_commit_from_ref(&branch_head, repo, branch_ref));
cl_git_pass(git_annotated_commit_lookup(&upstream_head, repo, &upstream_id));
@@ -522,7 +522,7 @@ void test_rebase_setup__merge_branch_by_id(void)
cl_assert_equal_i(GIT_REPOSITORY_STATE_REBASE_MERGE, git_repository_state(repo));
- git_oid_fromstr(&head_id, "efad0b11c47cb2f0220cbd6f5b0f93bb99064b00");
+ git_oid__fromstr(&head_id, "efad0b11c47cb2f0220cbd6f5b0f93bb99064b00", GIT_OID_SHA1);
cl_git_pass(git_repository_head(&head, repo));
cl_git_pass(git_reference_peel((git_object **)&head_commit, head, GIT_OBJECT_COMMIT));
cl_assert_equal_oid(&head_id, git_commit_id(head_commit));
diff --git a/tests/libgit2/rebase/sign.c b/tests/libgit2/rebase/sign.c
index 4064cf79b..69bb1c6f9 100644
--- a/tests/libgit2/rebase/sign.c
+++ b/tests/libgit2/rebase/sign.c
@@ -70,7 +70,7 @@ committer Rebaser <rebaser@rebaser.rb> 1405694510 +0000\n";
cl_git_pass(git_rebase_next(&rebase_operation, rebase));
cl_git_pass(git_rebase_commit(&commit_id, rebase, NULL, signature, NULL, NULL));
- git_oid_fromstr(&expected_id, "129183968a65abd6c52da35bff43325001bfc630");
+ git_oid__fromstr(&expected_id, "129183968a65abd6c52da35bff43325001bfc630", GIT_OID_SHA1);
cl_assert_equal_oid(&expected_id, &commit_id);
cl_git_pass(git_commit_lookup(&commit, repo, &commit_id));
@@ -178,7 +178,7 @@ gpgsig -----BEGIN PGP SIGNATURE-----\n\
cl_git_pass(git_rebase_next(&rebase_operation, rebase));
cl_git_pass(git_rebase_commit(&commit_id, rebase, NULL, signature, NULL, NULL));
- git_oid_fromstr(&expected_id, "bf78348e45c8286f52b760f1db15cb6da030f2ef");
+ git_oid__fromstr(&expected_id, "bf78348e45c8286f52b760f1db15cb6da030f2ef", GIT_OID_SHA1);
cl_assert_equal_oid(&expected_id, &commit_id);
cl_git_pass(git_commit_lookup(&commit, repo, &commit_id));
@@ -300,7 +300,7 @@ committer Rebaser <rebaser@rebaser.rb> 1405694510 +0000\n";
cl_git_pass(git_rebase_next(&rebase_operation, rebase));
cl_git_pass(git_rebase_commit(&commit_id, rebase, NULL, signature, NULL, NULL));
- git_oid_fromstr(&expected_id, "129183968a65abd6c52da35bff43325001bfc630");
+ git_oid__fromstr(&expected_id, "129183968a65abd6c52da35bff43325001bfc630", GIT_OID_SHA1);
cl_assert_equal_oid(&expected_id, &commit_id);
cl_git_pass(git_commit_lookup(&commit, repo, &commit_id));
@@ -398,7 +398,7 @@ gpgsig -----BEGIN PGP SIGNATURE-----\n\
cl_git_pass(git_rebase_next(&rebase_operation, rebase));
cl_git_pass(git_rebase_commit(&commit_id, rebase, NULL, signature, NULL, NULL));
- git_oid_fromstr(&expected_id, "bf78348e45c8286f52b760f1db15cb6da030f2ef");
+ git_oid__fromstr(&expected_id, "bf78348e45c8286f52b760f1db15cb6da030f2ef", GIT_OID_SHA1);
cl_assert_equal_oid(&expected_id, &commit_id);
cl_git_pass(git_commit_lookup(&commit, repo, &commit_id));
@@ -473,7 +473,7 @@ magicsig magic word: pretty please\n";
cl_git_pass(git_rebase_next(&rebase_operation, rebase));
cl_git_pass(git_rebase_commit(&commit_id, rebase, NULL, signature, NULL, NULL));
- git_oid_fromstr(&expected_id, "f46a4a8d26ae411b02aa61b7d69576627f4a1e1c");
+ git_oid__fromstr(&expected_id, "f46a4a8d26ae411b02aa61b7d69576627f4a1e1c", GIT_OID_SHA1);
cl_assert_equal_oid(&expected_id, &commit_id);
cl_git_pass(git_commit_lookup(&commit, repo, &commit_id));
diff --git a/tests/libgit2/refs/basic.c b/tests/libgit2/refs/basic.c
index 32742f9cc..5e41ca074 100644
--- a/tests/libgit2/refs/basic.c
+++ b/tests/libgit2/refs/basic.c
@@ -53,7 +53,7 @@ void test_refs_basic__longpaths(void)
git_reference *one = NULL, *two = NULL;
git_oid id;
- cl_git_pass(git_oid_fromstr(&id, "099fabac3a9ea935598528c27f866e34089c2eff"));
+ cl_git_pass(git_oid__fromstr(&id, "099fabac3a9ea935598528c27f866e34089c2eff", GIT_OID_SHA1));
base = git_repository_path(g_repo);
base_len = git_utf8_char_length(base, strlen(base));
diff --git a/tests/libgit2/refs/branches/delete.c b/tests/libgit2/refs/branches/delete.c
index 27995f9e2..6b3d507a8 100644
--- a/tests/libgit2/refs/branches/delete.c
+++ b/tests/libgit2/refs/branches/delete.c
@@ -14,7 +14,7 @@ void test_refs_branches_delete__initialize(void)
repo = cl_git_sandbox_init("testrepo.git");
- cl_git_pass(git_oid_fromstr(&id, "be3563ae3f795b2b4353bcce3a527ad0a4f7f644"));
+ cl_git_pass(git_oid__fromstr(&id, "be3563ae3f795b2b4353bcce3a527ad0a4f7f644", GIT_OID_SHA1));
cl_git_pass(git_reference_create(&fake_remote, repo, "refs/remotes/nulltoken/master", &id, 0, NULL));
}
@@ -119,7 +119,7 @@ void test_refs_branches_delete__removes_reflog(void)
{
git_reference *branch;
git_reflog *log;
- git_oid oidzero = {{0}};
+ git_oid oidzero = GIT_OID_SHA1_ZERO;
git_signature *sig;
/* Ensure the reflog has at least one entry */
@@ -150,14 +150,14 @@ void test_refs_branches_delete__removes_empty_folders(void)
git_reference *branch;
git_reflog *log;
- git_oid oidzero = {{0}};
+ git_oid oidzero = GIT_OID_SHA1_ZERO;
git_signature *sig;
git_str ref_folder = GIT_STR_INIT;
git_str reflog_folder = GIT_STR_INIT;
/* Create a new branch with a nested name */
- cl_git_pass(git_oid_fromstr(&commit_id, "a65fedf39aefe402d3bb6e24df4d4f5fe4547750"));
+ cl_git_pass(git_oid__fromstr(&commit_id, "a65fedf39aefe402d3bb6e24df4d4f5fe4547750", GIT_OID_SHA1));
cl_git_pass(git_commit_lookup(&commit, repo, &commit_id));
cl_git_pass(git_branch_create(&branch, repo, "some/deep/ref", commit, 0));
git_commit_free(commit);
diff --git a/tests/libgit2/refs/branches/iterator.c b/tests/libgit2/refs/branches/iterator.c
index e086681e5..a295d553b 100644
--- a/tests/libgit2/refs/branches/iterator.c
+++ b/tests/libgit2/refs/branches/iterator.c
@@ -11,7 +11,7 @@ void test_refs_branches_iterator__initialize(void)
cl_fixture_sandbox("testrepo.git");
cl_git_pass(git_repository_open(&repo, "testrepo.git"));
- cl_git_pass(git_oid_fromstr(&id, "be3563ae3f795b2b4353bcce3a527ad0a4f7f644"));
+ cl_git_pass(git_oid__fromstr(&id, "be3563ae3f795b2b4353bcce3a527ad0a4f7f644", GIT_OID_SHA1));
cl_git_pass(git_reference_create(&fake_remote, repo, "refs/remotes/nulltoken/master", &id, 0, NULL));
}
diff --git a/tests/libgit2/refs/create.c b/tests/libgit2/refs/create.c
index 01eb62a52..1dafcf61a 100644
--- a/tests/libgit2/refs/create.c
+++ b/tests/libgit2/refs/create.c
@@ -34,7 +34,7 @@ void test_refs_create__symbolic(void)
const char *new_head_tracker = "ANOTHER_HEAD_TRACKER";
- git_oid_fromstr(&id, current_master_tip);
+ git_oid__fromstr(&id, current_master_tip, GIT_OID_SHA1);
/* Create and write the new symbolic reference */
cl_git_pass(git_reference_symbolic_create(&new_reference, g_repo, new_head_tracker, current_head_target, 0, NULL));
@@ -77,7 +77,7 @@ void test_refs_create__symbolic_with_arbitrary_content(void)
const char *new_head_tracker = "ANOTHER_HEAD_TRACKER";
const char *arbitrary_target = "ARBITRARY DATA";
- git_oid_fromstr(&id, current_master_tip);
+ git_oid__fromstr(&id, current_master_tip, GIT_OID_SHA1);
/* Attempt to create symbolic ref with arbitrary data in target
* fails by default
@@ -124,7 +124,7 @@ void test_refs_create__deep_symbolic(void)
const char *new_head_tracker = "deep/rooted/tracker";
- git_oid_fromstr(&id, current_master_tip);
+ git_oid__fromstr(&id, current_master_tip, GIT_OID_SHA1);
cl_git_pass(git_reference_symbolic_create(&new_reference, g_repo, new_head_tracker, current_head_target, 0, NULL));
cl_git_pass(git_reference_lookup(&looked_up_ref, g_repo, new_head_tracker));
@@ -145,7 +145,7 @@ void test_refs_create__oid(void)
const char *new_head = "refs/heads/new-head";
- git_oid_fromstr(&id, current_master_tip);
+ git_oid__fromstr(&id, current_master_tip, GIT_OID_SHA1);
/* Create and write the new object id reference */
cl_git_pass(git_reference_create(&new_reference, g_repo, new_head, &id, 0, NULL));
@@ -180,7 +180,7 @@ void test_refs_create__oid_unknown_succeeds_without_strict(void)
const char *new_head = "refs/heads/new-head";
- git_oid_fromstr(&id, "deadbeef3f795b2b4353bcce3a527ad0a4f7f644");
+ git_oid__fromstr(&id, "deadbeef3f795b2b4353bcce3a527ad0a4f7f644", GIT_OID_SHA1);
cl_git_pass(git_libgit2_opts(GIT_OPT_ENABLE_STRICT_OBJECT_CREATION, 0));
@@ -201,7 +201,7 @@ void test_refs_create__oid_unknown_fails_by_default(void)
const char *new_head = "refs/heads/new-head";
- git_oid_fromstr(&id, "deadbeef3f795b2b4353bcce3a527ad0a4f7f644");
+ git_oid__fromstr(&id, "deadbeef3f795b2b4353bcce3a527ad0a4f7f644", GIT_OID_SHA1);
/* Create and write the new object id reference */
cl_git_fail(git_reference_create(&new_reference, g_repo, new_head, &id, 0, NULL));
@@ -215,7 +215,7 @@ void test_refs_create__propagate_eexists(void)
git_oid oid;
/* Make sure it works for oid and for symbolic both */
- cl_git_pass(git_oid_fromstr(&oid, current_master_tip));
+ cl_git_pass(git_oid__fromstr(&oid, current_master_tip, GIT_OID_SHA1));
cl_git_fail_with(GIT_EEXISTS, git_reference_create(NULL, g_repo, current_head_target, &oid, false, NULL));
cl_git_fail_with(GIT_EEXISTS, git_reference_symbolic_create(NULL, g_repo, "HEAD", current_head_target, false, NULL));
}
@@ -227,7 +227,7 @@ void test_refs_create__existing_dir_propagates_edirectory(void)
const char *dir_head = "refs/heads/new-dir/new-head",
*fail_head = "refs/heads/new-dir";
- git_oid_fromstr(&id, current_master_tip);
+ git_oid__fromstr(&id, current_master_tip, GIT_OID_SHA1);
/* Create and write the new object id reference */
cl_git_pass(git_reference_create(&new_reference, g_repo, dir_head, &id, 1, NULL));
@@ -242,7 +242,7 @@ static void test_invalid_name(const char *name)
git_reference *new_reference;
git_oid id;
- git_oid_fromstr(&id, current_master_tip);
+ git_oid__fromstr(&id, current_master_tip, GIT_OID_SHA1);
cl_assert_equal_i(GIT_EINVALIDSPEC, git_reference_create(
&new_reference, g_repo, name, &id, 0, NULL));
@@ -272,7 +272,7 @@ static void test_win32_name(const char *name)
git_oid id;
int ret;
- git_oid_fromstr(&id, current_master_tip);
+ git_oid__fromstr(&id, current_master_tip, GIT_OID_SHA1);
ret = git_reference_create(&new_reference, g_repo, name, &id, 0, NULL);
@@ -314,7 +314,7 @@ static void count_fsyncs(size_t *create_count, size_t *compress_count)
p_fsync__cnt = 0;
- git_oid_fromstr(&id, current_master_tip);
+ git_oid__fromstr(&id, current_master_tip, GIT_OID_SHA1);
cl_git_pass(git_reference_create(&ref, g_repo, "refs/heads/fsync_test", &id, 0, "log message"));
git_reference_free(ref);
diff --git a/tests/libgit2/refs/delete.c b/tests/libgit2/refs/delete.c
index 42cc534b5..edb521f4a 100644
--- a/tests/libgit2/refs/delete.c
+++ b/tests/libgit2/refs/delete.c
@@ -63,7 +63,7 @@ void test_refs_delete__packed_only(void)
git_oid id;
const char *new_ref = "refs/heads/new_ref";
- git_oid_fromstr(&id, current_master_tip);
+ git_oid__fromstr(&id, current_master_tip, GIT_OID_SHA1);
/* Create and write the new object id reference */
cl_git_pass(git_reference_create(&ref, g_repo, new_ref, &id, 0, NULL));
diff --git a/tests/libgit2/refs/foreachglob.c b/tests/libgit2/refs/foreachglob.c
index b208a95a2..a586ca08c 100644
--- a/tests/libgit2/refs/foreachglob.c
+++ b/tests/libgit2/refs/foreachglob.c
@@ -11,7 +11,7 @@ void test_refs_foreachglob__initialize(void)
cl_fixture_sandbox("testrepo.git");
cl_git_pass(git_repository_open(&repo, "testrepo.git"));
- cl_git_pass(git_oid_fromstr(&id, "be3563ae3f795b2b4353bcce3a527ad0a4f7f644"));
+ cl_git_pass(git_oid__fromstr(&id, "be3563ae3f795b2b4353bcce3a527ad0a4f7f644", GIT_OID_SHA1));
cl_git_pass(git_reference_create(&fake_remote, repo, "refs/remotes/nulltoken/master", &id, 0, NULL));
}
diff --git a/tests/libgit2/refs/iterator.c b/tests/libgit2/refs/iterator.c
index a4f9e62ec..f40d35d11 100644
--- a/tests/libgit2/refs/iterator.c
+++ b/tests/libgit2/refs/iterator.c
@@ -1,6 +1,7 @@
#include "clar_libgit2.h"
#include "refs.h"
#include "vector.h"
+#include "odb.h"
static git_repository *repo;
@@ -126,7 +127,7 @@ void test_refs_iterator__empty(void)
git_reference *ref;
git_repository *empty;
- cl_git_pass(git_odb_new(&odb));
+ cl_git_pass(git_odb__new(&odb, NULL));
cl_git_pass(git_repository_wrap_odb(&empty, odb));
cl_git_pass(git_reference_iterator_new(&iter, empty));
diff --git a/tests/libgit2/refs/lookup.c b/tests/libgit2/refs/lookup.c
index 01e956de2..2b8be77f8 100644
--- a/tests/libgit2/refs/lookup.c
+++ b/tests/libgit2/refs/lookup.c
@@ -43,7 +43,7 @@ void test_refs_lookup__oid(void)
git_oid tag, expected;
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_git_pass(git_oid__fromstr(&expected, "1385f264afb75a56a5bec74243be9b367ba4ca08", GIT_OID_SHA1));
cl_assert_equal_oid(&expected, &tag);
}
diff --git a/tests/libgit2/refs/peel.c b/tests/libgit2/refs/peel.c
index 38f3465a0..fefd2d260 100644
--- a/tests/libgit2/refs/peel.c
+++ b/tests/libgit2/refs/peel.c
@@ -32,7 +32,7 @@ static void assert_peel_generic(
cl_git_pass(git_reference_peel(&peeled, ref, requested_type));
- cl_git_pass(git_oid_fromstr(&expected_oid, expected_sha));
+ cl_git_pass(git_oid__fromstr(&expected_oid, expected_sha, GIT_OID_SHA1));
cl_assert_equal_oid(&expected_oid, git_object_id(peeled));
cl_assert_equal_i(expected_type, git_object_type(peeled));
diff --git a/tests/libgit2/refs/races.c b/tests/libgit2/refs/races.c
index 476789358..bf46b760e 100644
--- a/tests/libgit2/refs/races.c
+++ b/tests/libgit2/refs/races.c
@@ -27,8 +27,8 @@ void test_refs_races__create_matching_zero_old(void)
git_reference *ref;
git_oid id, zero_id;
- git_oid_fromstr(&id, commit_id);
- git_oid_fromstr(&zero_id, "0000000000000000000000000000000000000000");
+ git_oid__fromstr(&id, commit_id, GIT_OID_SHA1);
+ git_oid__fromstr(&zero_id, "0000000000000000000000000000000000000000", GIT_OID_SHA1);
cl_git_fail(git_reference_create_matching(&ref, g_repo, refname, &id, 1, &zero_id, NULL));
git_reference_free(ref);
@@ -45,8 +45,8 @@ void test_refs_races__create_matching(void)
git_reference *ref, *ref2, *ref3;
git_oid id, other_id;
- git_oid_fromstr(&id, commit_id);
- git_oid_fromstr(&other_id, other_commit_id);
+ git_oid__fromstr(&id, commit_id, GIT_OID_SHA1);
+ git_oid__fromstr(&other_id, other_commit_id, GIT_OID_SHA1);
cl_git_fail_with(GIT_EMODIFIED, git_reference_create_matching(&ref, g_repo, refname, &other_id, 1, &other_id, NULL));
@@ -64,8 +64,8 @@ void test_refs_races__symbolic_create_matching(void)
git_reference *ref, *ref2, *ref3;
git_oid id, other_id;
- git_oid_fromstr(&id, commit_id);
- git_oid_fromstr(&other_id, other_commit_id);
+ git_oid__fromstr(&id, commit_id, GIT_OID_SHA1);
+ git_oid__fromstr(&other_id, other_commit_id, GIT_OID_SHA1);
cl_git_fail_with(GIT_EMODIFIED, git_reference_symbolic_create_matching(&ref, g_repo, "HEAD", other_refname, 1, other_refname, NULL));
@@ -83,8 +83,8 @@ void test_refs_races__delete(void)
git_reference *ref, *ref2;
git_oid id, other_id;
- git_oid_fromstr(&id, commit_id);
- git_oid_fromstr(&other_id, other_commit_id);
+ git_oid__fromstr(&id, commit_id, GIT_OID_SHA1);
+ git_oid__fromstr(&other_id, other_commit_id, GIT_OID_SHA1);
/* We can delete a value that matches */
cl_git_pass(git_reference_lookup(&ref, g_repo, refname));
@@ -116,8 +116,8 @@ void test_refs_races__switch_oid_to_symbolic(void)
git_reference *ref, *ref2, *ref3;
git_oid id, other_id;
- git_oid_fromstr(&id, commit_id);
- git_oid_fromstr(&other_id, other_commit_id);
+ git_oid__fromstr(&id, commit_id, GIT_OID_SHA1);
+ git_oid__fromstr(&other_id, other_commit_id, GIT_OID_SHA1);
/* Removing a direct ref when it's currently symbolic should fail */
cl_git_pass(git_reference_lookup(&ref, g_repo, refname));
@@ -145,8 +145,8 @@ void test_refs_races__switch_symbolic_to_oid(void)
git_reference *ref, *ref2, *ref3;
git_oid id, other_id;
- git_oid_fromstr(&id, commit_id);
- git_oid_fromstr(&other_id, other_commit_id);
+ git_oid__fromstr(&id, commit_id, GIT_OID_SHA1);
+ git_oid__fromstr(&other_id, other_commit_id, GIT_OID_SHA1);
/* Removing a symbolic ref when it's currently direct should fail */
cl_git_pass(git_reference_lookup(&ref, g_repo, "refs/symref"));
diff --git a/tests/libgit2/refs/read.c b/tests/libgit2/refs/read.c
index a622c770b..7253cf137 100644
--- a/tests/libgit2/refs/read.c
+++ b/tests/libgit2/refs/read.c
@@ -82,7 +82,7 @@ void test_refs_read__symbolic(void)
cl_assert(object != NULL);
cl_assert(git_object_type(object) == GIT_OBJECT_COMMIT);
- git_oid_fromstr(&id, current_master_tip);
+ git_oid__fromstr(&id, current_master_tip, GIT_OID_SHA1);
cl_assert_equal_oid(&id, git_object_id(object));
git_object_free(object);
@@ -110,7 +110,7 @@ void test_refs_read__nested_symbolic(void)
cl_assert(object != NULL);
cl_assert(git_object_type(object) == GIT_OBJECT_COMMIT);
- git_oid_fromstr(&id, current_master_tip);
+ git_oid__fromstr(&id, current_master_tip, GIT_OID_SHA1);
cl_assert_equal_oid(&id, git_object_id(object));
git_object_free(object);
diff --git a/tests/libgit2/refs/reflog/drop.c b/tests/libgit2/refs/reflog/drop.c
index 916bd9933..2d7193380 100644
--- a/tests/libgit2/refs/reflog/drop.c
+++ b/tests/libgit2/refs/reflog/drop.c
@@ -70,7 +70,7 @@ void test_refs_reflog_drop__can_drop_the_oldest_entry(void)
cl_assert_equal_sz(entrycount - 1, git_reflog_entrycount(g_reflog));
entry = git_reflog_entry_byindex(g_reflog, entrycount - 2);
- cl_assert(git_oid_streq(&entry->oid_old, GIT_OID_HEX_ZERO) != 0);
+ cl_assert(git_oid_streq(&entry->oid_old, GIT_OID_SHA1_HEXZERO) != 0);
}
void test_refs_reflog_drop__can_drop_the_oldest_entry_and_rewrite_the_log_history(void)
@@ -83,7 +83,7 @@ void test_refs_reflog_drop__can_drop_the_oldest_entry_and_rewrite_the_log_histor
cl_assert_equal_sz(entrycount - 1, git_reflog_entrycount(g_reflog));
entry = git_reflog_entry_byindex(g_reflog, entrycount - 2);
- cl_assert(git_oid_streq(&entry->oid_old, GIT_OID_HEX_ZERO) == 0);
+ cl_assert(git_oid_streq(&entry->oid_old, GIT_OID_SHA1_HEXZERO) == 0);
}
void test_refs_reflog_drop__can_drop_all_the_entries(void)
diff --git a/tests/libgit2/refs/reflog/messages.c b/tests/libgit2/refs/reflog/messages.c
index ed183d2f2..647c00d0d 100644
--- a/tests/libgit2/refs/reflog/messages.c
+++ b/tests/libgit2/refs/reflog/messages.c
@@ -87,7 +87,7 @@ void test_refs_reflog_messages__detaching_writes_reflog(void)
const char *msg;
msg = "checkout: moving from master to e90810b8df3e80c413d903f631643c716887138d";
- git_oid_fromstr(&id, "e90810b8df3e80c413d903f631643c716887138d");
+ git_oid__fromstr(&id, "e90810b8df3e80c413d903f631643c716887138d", GIT_OID_SHA1);
cl_git_pass(git_repository_set_head_detached(g_repo, &id));
cl_reflog_check_entry(g_repo, GIT_HEAD_FILE, 0,
"a65fedf39aefe402d3bb6e24df4d4f5fe4547750",
@@ -109,7 +109,7 @@ void test_refs_reflog_messages__orphan_branch_does_not_count(void)
/* Have something known */
msg = "checkout: moving from master to e90810b8df3e80c413d903f631643c716887138d";
- git_oid_fromstr(&id, "e90810b8df3e80c413d903f631643c716887138d");
+ git_oid__fromstr(&id, "e90810b8df3e80c413d903f631643c716887138d", GIT_OID_SHA1);
cl_git_pass(git_repository_set_head_detached(g_repo, &id));
cl_reflog_check_entry(g_repo, GIT_HEAD_FILE, 0,
"a65fedf39aefe402d3bb6e24df4d4f5fe4547750",
@@ -264,7 +264,7 @@ void test_refs_reflog_messages__creating_a_direct_reference(void)
cl_assert_equal_sz(1, git_reflog_entrycount(reflog));
entry = git_reflog_entry_byindex(reflog, 0);
- cl_assert(git_oid_streq(&entry->oid_old, GIT_OID_HEX_ZERO) == 0);
+ cl_assert(git_oid_streq(&entry->oid_old, GIT_OID_SHA1_HEXZERO) == 0);
cl_assert_equal_oid(&id, &entry->oid_cur);
cl_assert_equal_s(message, entry->msg);
@@ -280,7 +280,7 @@ void test_refs_reflog_messages__newline_gets_replaced(void)
git_oid oid;
cl_git_pass(git_signature_now(&signature, "me", "foo@example.com"));
- cl_git_pass(git_oid_fromstr(&oid, "a65fedf39aefe402d3bb6e24df4d4f5fe4547750"));
+ cl_git_pass(git_oid__fromstr(&oid, "a65fedf39aefe402d3bb6e24df4d4f5fe4547750", GIT_OID_SHA1));
cl_git_pass(git_reflog_read(&reflog, g_repo, "HEAD"));
cl_assert_equal_sz(7, git_reflog_entrycount(reflog));
@@ -352,7 +352,7 @@ void test_refs_reflog_messages__creating_branches_default_messages(void)
cl_git_pass(git_str_printf(&buf, "branch: Created from %s", git_oid_tostr_s(git_commit_id(target))));
cl_reflog_check_entry(g_repo, "refs/heads/" NEW_BRANCH_NAME, 0,
- GIT_OID_HEX_ZERO,
+ GIT_OID_SHA1_HEXZERO,
git_oid_tostr_s(git_commit_id(target)),
g_email, git_str_cstr(&buf));
@@ -362,7 +362,7 @@ void test_refs_reflog_messages__creating_branches_default_messages(void)
cl_git_pass(git_branch_create_from_annotated(&branch2, g_repo, NEW_BRANCH_NAME, annotated, true));
cl_reflog_check_entry(g_repo, "refs/heads/" NEW_BRANCH_NAME, 0,
- GIT_OID_HEX_ZERO,
+ GIT_OID_SHA1_HEXZERO,
git_oid_tostr_s(git_commit_id(target)),
g_email, "branch: Created from e90810b8df3");
diff --git a/tests/libgit2/refs/reflog/reflog.c b/tests/libgit2/refs/reflog/reflog.c
index 32ce7ffb7..774ec6c93 100644
--- a/tests/libgit2/refs/reflog/reflog.c
+++ b/tests/libgit2/refs/reflog/reflog.c
@@ -52,7 +52,7 @@ static void assert_appends(const git_signature *committer, const git_oid *oid)
/* The first one was the creation of the branch */
entry = git_reflog_entry_byindex(reflog, 2);
- cl_assert(git_oid_streq(&entry->oid_old, GIT_OID_HEX_ZERO) == 0);
+ cl_assert(git_oid_streq(&entry->oid_old, GIT_OID_SHA1_HEXZERO) == 0);
entry = git_reflog_entry_byindex(reflog, 1);
assert_signature(committer, entry->committer);
@@ -80,7 +80,7 @@ void test_refs_reflog_reflog__append_then_read(void)
git_reflog *reflog;
/* Create a new branch pointing at the HEAD */
- git_oid_fromstr(&oid, current_master_tip);
+ git_oid__fromstr(&oid, current_master_tip, GIT_OID_SHA1);
cl_git_pass(git_reference_create(&ref, g_repo, new_ref, &oid, 0, NULL));
git_reference_free(ref);
@@ -147,7 +147,7 @@ void test_refs_reflog_reflog__removes_empty_reflog_dir(void)
git_oid id;
/* Create a new branch pointing at the HEAD */
- git_oid_fromstr(&id, current_master_tip);
+ git_oid__fromstr(&id, current_master_tip, GIT_OID_SHA1);
cl_git_pass(git_reference_create(&ref, g_repo, "refs/heads/new-dir/new-head", &id, 0, NULL));
git_str_joinpath(&log_path, git_repository_path(g_repo), GIT_REFLOG_DIR);
@@ -159,7 +159,7 @@ void test_refs_reflog_reflog__removes_empty_reflog_dir(void)
git_reference_free(ref);
/* new ref creation should succeed since new-dir is empty */
- git_oid_fromstr(&id, current_master_tip);
+ git_oid__fromstr(&id, current_master_tip, GIT_OID_SHA1);
cl_git_pass(git_reference_create(&ref, g_repo, "refs/heads/new-dir", &id, 0, NULL));
git_reference_free(ref);
@@ -173,7 +173,7 @@ void test_refs_reflog_reflog__fails_gracefully_on_nonempty_reflog_dir(void)
git_oid id;
/* Create a new branch pointing at the HEAD */
- git_oid_fromstr(&id, current_master_tip);
+ git_oid__fromstr(&id, current_master_tip, GIT_OID_SHA1);
cl_git_pass(git_reference_create(&ref, g_repo, "refs/heads/new-dir/new-head", &id, 0, NULL));
git_reference_free(ref);
@@ -186,7 +186,7 @@ void test_refs_reflog_reflog__fails_gracefully_on_nonempty_reflog_dir(void)
cl_must_pass(p_unlink("testrepo.git/refs/heads/new-dir/new-head"));
/* new ref creation should fail since new-dir contains reflogs still */
- git_oid_fromstr(&id, current_master_tip);
+ git_oid__fromstr(&id, current_master_tip, GIT_OID_SHA1);
cl_git_fail_with(GIT_EDIRECTORY, git_reference_create(&ref, g_repo, "refs/heads/new-dir", &id, 0, NULL));
git_reference_free(ref);
@@ -235,7 +235,7 @@ void test_refs_reflog_reflog__reading_a_reflog_with_invalid_format_succeeds(void
char *star;
/* Create a new branch. */
- cl_git_pass(git_oid_fromstr(&id, current_master_tip));
+ cl_git_pass(git_oid__fromstr(&id, current_master_tip, GIT_OID_SHA1));
cl_git_pass(git_reference_create(&ref, g_repo, refname, &id, 1, refmessage));
/*
@@ -298,7 +298,7 @@ void test_refs_reflog_reflog__write_only_std_locations(void)
git_reference *ref;
git_oid id;
- git_oid_fromstr(&id, current_master_tip);
+ git_oid__fromstr(&id, current_master_tip, GIT_OID_SHA1);
cl_git_pass(git_reference_create(&ref, g_repo, "refs/heads/foo", &id, 1, NULL));
git_reference_free(ref);
@@ -318,7 +318,7 @@ void test_refs_reflog_reflog__write_when_explicitly_active(void)
git_reference *ref;
git_oid id;
- git_oid_fromstr(&id, current_master_tip);
+ git_oid__fromstr(&id, current_master_tip, GIT_OID_SHA1);
git_reference_ensure_log(g_repo, "refs/tags/foo");
cl_git_pass(git_reference_create(&ref, g_repo, "refs/tags/foo", &id, 1, NULL));
@@ -338,7 +338,7 @@ void test_refs_reflog_reflog__append_to_HEAD_when_changing_current_branch(void)
git_reflog_free(log);
/* Move it back */
- git_oid_fromstr(&id, "be3563ae3f795b2b4353bcce3a527ad0a4f7f644");
+ git_oid__fromstr(&id, "be3563ae3f795b2b4353bcce3a527ad0a4f7f644", GIT_OID_SHA1);
cl_git_pass(git_reference_create(&ref, g_repo, "refs/heads/master", &id, 1, NULL));
git_reference_free(ref);
@@ -390,7 +390,7 @@ static void assert_no_reflog_update(void)
git_reflog_free(log);
/* Move it back */
- git_oid_fromstr(&id, "be3563ae3f795b2b4353bcce3a527ad0a4f7f644");
+ git_oid__fromstr(&id, "be3563ae3f795b2b4353bcce3a527ad0a4f7f644", GIT_OID_SHA1);
cl_git_pass(git_reference_create(&ref, g_repo, "refs/heads/master", &id, 1, NULL));
git_reference_free(ref);
@@ -431,7 +431,7 @@ void test_refs_reflog_reflog__logallrefupdates_bare_set_always(void)
cl_git_pass(git_config_set_string(config, "core.logallrefupdates", "always"));
git_config_free(config);
- git_oid_fromstr(&id, "be3563ae3f795b2b4353bcce3a527ad0a4f7f644");
+ git_oid__fromstr(&id, "be3563ae3f795b2b4353bcce3a527ad0a4f7f644", GIT_OID_SHA1);
cl_git_pass(git_reference_create(&ref, g_repo, "refs/bork", &id, 1, "message"));
cl_git_pass(git_reflog_read(&log, g_repo, "refs/bork"));
diff --git a/tests/libgit2/refs/reflog/reflog_helpers.c b/tests/libgit2/refs/reflog/reflog_helpers.c
index 2ea41ee06..6a7e706d6 100644
--- a/tests/libgit2/refs/reflog/reflog_helpers.c
+++ b/tests/libgit2/refs/reflog/reflog_helpers.c
@@ -6,12 +6,12 @@
int reflog_entry_tostr(git_str *out, const git_reflog_entry *entry)
{
- char old_oid[GIT_OID_HEXSZ], new_oid[GIT_OID_HEXSZ];
+ char old_oid[GIT_OID_SHA1_HEXSIZE], new_oid[GIT_OID_SHA1_HEXSIZE];
assert(out && entry);
- git_oid_tostr((char *)&old_oid, GIT_OID_HEXSZ, git_reflog_entry_id_old(entry));
- git_oid_tostr((char *)&new_oid, GIT_OID_HEXSZ, git_reflog_entry_id_new(entry));
+ git_oid_tostr((char *)&old_oid, GIT_OID_SHA1_HEXSIZE, git_reflog_entry_id_old(entry));
+ git_oid_tostr((char *)&new_oid, GIT_OID_SHA1_HEXSIZE, git_reflog_entry_id_new(entry));
return git_str_printf(out, "%s %s %s %s", old_oid, new_oid, "somesig", git_reflog_entry_message(entry));
}
@@ -46,17 +46,17 @@ void cl_reflog_check_entry_(git_repository *repo, const char *reflog, size_t idx
git_object *obj = NULL;
if (git_revparse_single(&obj, repo, old_spec) == GIT_OK) {
if (git_oid_cmp(git_object_id(obj), git_reflog_entry_id_old(entry)) != 0) {
- git_oid__writebuf(&result, "\tOld OID: \"", git_object_id(obj));
- git_oid__writebuf(&result, "\" != \"", git_reflog_entry_id_old(entry));
+ git_object__write_oid_header(&result, "\tOld OID: \"", git_object_id(obj));
+ git_object__write_oid_header(&result, "\" != \"", git_reflog_entry_id_old(entry));
git_str_puts(&result, "\"\n");
}
git_object_free(obj);
} else {
git_oid *oid = git__calloc(1, sizeof(*oid));
- git_oid_fromstr(oid, old_spec);
+ git_oid__fromstr(oid, old_spec, GIT_OID_SHA1);
if (git_oid_cmp(oid, git_reflog_entry_id_old(entry)) != 0) {
- git_oid__writebuf(&result, "\tOld OID: \"", oid);
- git_oid__writebuf(&result, "\" != \"", git_reflog_entry_id_old(entry));
+ git_object__write_oid_header(&result, "\tOld OID: \"", oid);
+ git_object__write_oid_header(&result, "\" != \"", git_reflog_entry_id_old(entry));
git_str_puts(&result, "\"\n");
}
git__free(oid);
@@ -66,17 +66,17 @@ void cl_reflog_check_entry_(git_repository *repo, const char *reflog, size_t idx
git_object *obj = NULL;
if (git_revparse_single(&obj, repo, new_spec) == GIT_OK) {
if (git_oid_cmp(git_object_id(obj), git_reflog_entry_id_new(entry)) != 0) {
- git_oid__writebuf(&result, "\tNew OID: \"", git_object_id(obj));
- git_oid__writebuf(&result, "\" != \"", git_reflog_entry_id_new(entry));
+ git_object__write_oid_header(&result, "\tNew OID: \"", git_object_id(obj));
+ git_object__write_oid_header(&result, "\" != \"", git_reflog_entry_id_new(entry));
git_str_puts(&result, "\"\n");
}
git_object_free(obj);
} else {
git_oid *oid = git__calloc(1, sizeof(*oid));
- git_oid_fromstr(oid, new_spec);
+ git_oid__fromstr(oid, new_spec, GIT_OID_SHA1);
if (git_oid_cmp(oid, git_reflog_entry_id_new(entry)) != 0) {
- git_oid__writebuf(&result, "\tNew OID: \"", oid);
- git_oid__writebuf(&result, "\" != \"", git_reflog_entry_id_new(entry));
+ git_object__write_oid_header(&result, "\tNew OID: \"", oid);
+ git_object__write_oid_header(&result, "\" != \"", git_reflog_entry_id_new(entry));
git_str_puts(&result, "\"\n");
}
git__free(oid);
diff --git a/tests/libgit2/refs/revparse.c b/tests/libgit2/refs/revparse.c
index 56af3c939..02ffe005d 100644
--- a/tests/libgit2/refs/revparse.c
+++ b/tests/libgit2/refs/revparse.c
@@ -652,7 +652,7 @@ void test_refs_revparse__try_to_retrieve_branch_before_described_tag(void)
git_repository *repo;
git_reference *branch;
git_object *target;
- char sha[GIT_OID_HEXSZ + 1];
+ char sha[GIT_OID_SHA1_HEXSIZE + 1];
repo = cl_git_sandbox_init("testrepo.git");
@@ -661,7 +661,7 @@ void test_refs_revparse__try_to_retrieve_branch_before_described_tag(void)
cl_git_pass(git_revparse_single(&target, repo, "HEAD~3"));
cl_git_pass(git_branch_create(&branch, repo, "blah-7-gc47800c", (git_commit *)target, 0));
- git_oid_tostr(sha, GIT_OID_HEXSZ + 1, git_object_id(target));
+ git_oid_tostr(sha, GIT_OID_SHA1_HEXSIZE + 1, git_object_id(target));
test_object_inrepo("blah-7-gc47800c", sha, repo);
@@ -690,7 +690,7 @@ void test_refs_revparse__try_to_retrieve_sha_before_branch(void)
git_repository *repo;
git_reference *branch;
git_object *target;
- char sha[GIT_OID_HEXSZ + 1];
+ char sha[GIT_OID_SHA1_HEXSIZE + 1];
repo = cl_git_sandbox_init("testrepo.git");
@@ -699,7 +699,7 @@ void test_refs_revparse__try_to_retrieve_sha_before_branch(void)
cl_git_pass(git_revparse_single(&target, repo, "HEAD~3"));
cl_git_pass(git_branch_create(&branch, repo, "a65fedf39aefe402d3bb6e24df4d4f5fe4547750", (git_commit *)target, 0));
- git_oid_tostr(sha, GIT_OID_HEXSZ + 1, git_object_id(target));
+ git_oid_tostr(sha, GIT_OID_SHA1_HEXSIZE + 1, git_object_id(target));
test_object_inrepo("a65fedf39aefe402d3bb6e24df4d4f5fe4547750", "a65fedf39aefe402d3bb6e24df4d4f5fe4547750", repo);
test_object_inrepo("heads/a65fedf39aefe402d3bb6e24df4d4f5fe4547750", sha, repo);
@@ -726,7 +726,7 @@ void test_refs_revparse__try_to_retrieve_branch_before_abbrev_sha(void)
git_repository *repo;
git_reference *branch;
git_object *target;
- char sha[GIT_OID_HEXSZ + 1];
+ char sha[GIT_OID_SHA1_HEXSIZE + 1];
repo = cl_git_sandbox_init("testrepo.git");
@@ -735,7 +735,7 @@ void test_refs_revparse__try_to_retrieve_branch_before_abbrev_sha(void)
cl_git_pass(git_revparse_single(&target, repo, "HEAD~3"));
cl_git_pass(git_branch_create(&branch, repo, "c47800", (git_commit *)target, 0));
- git_oid_tostr(sha, GIT_OID_HEXSZ + 1, git_object_id(target));
+ git_oid_tostr(sha, GIT_OID_SHA1_HEXSIZE + 1, git_object_id(target));
test_object_inrepo("c47800", sha, repo);
diff --git a/tests/libgit2/refs/transactions.c b/tests/libgit2/refs/transactions.c
index 50c102ad0..98ae6f73a 100644
--- a/tests/libgit2/refs/transactions.c
+++ b/tests/libgit2/refs/transactions.c
@@ -21,7 +21,7 @@ void test_refs_transactions__single_ref_oid(void)
git_reference *ref;
git_oid id;
- git_oid_fromstr(&id, "a65fedf39aefe402d3bb6e24df4d4f5fe4547750");
+ git_oid__fromstr(&id, "a65fedf39aefe402d3bb6e24df4d4f5fe4547750", GIT_OID_SHA1);
cl_git_pass(git_transaction_lock_ref(g_tx, "refs/heads/master"));
cl_git_pass(git_transaction_set_target(g_tx, "refs/heads/master", &id, NULL, NULL));
@@ -52,7 +52,7 @@ void test_refs_transactions__single_ref_mix_types(void)
git_reference *ref;
git_oid id;
- git_oid_fromstr(&id, "a65fedf39aefe402d3bb6e24df4d4f5fe4547750");
+ git_oid__fromstr(&id, "a65fedf39aefe402d3bb6e24df4d4f5fe4547750", GIT_OID_SHA1);
cl_git_pass(git_transaction_lock_ref(g_tx, "refs/heads/master"));
cl_git_pass(git_transaction_lock_ref(g_tx, "HEAD"));
@@ -90,7 +90,7 @@ void test_refs_transactions__single_create(void)
cl_git_pass(git_transaction_lock_ref(g_tx, name));
- git_oid_fromstr(&id, "a65fedf39aefe402d3bb6e24df4d4f5fe4547750");
+ git_oid__fromstr(&id, "a65fedf39aefe402d3bb6e24df4d4f5fe4547750", GIT_OID_SHA1);
cl_git_pass(git_transaction_set_target(g_tx, name, &id, NULL, NULL));
cl_git_pass(git_transaction_commit(g_tx));
@@ -104,7 +104,7 @@ void test_refs_transactions__unlocked_set(void)
git_oid id;
cl_git_pass(git_transaction_lock_ref(g_tx, "refs/heads/master"));
- git_oid_fromstr(&id, "a65fedf39aefe402d3bb6e24df4d4f5fe4547750");
+ git_oid__fromstr(&id, "a65fedf39aefe402d3bb6e24df4d4f5fe4547750", GIT_OID_SHA1);
cl_git_fail_with(GIT_ENOTFOUND, git_transaction_set_target(g_tx, "refs/heads/foo", &id, NULL, NULL));
cl_git_pass(git_transaction_commit(g_tx));
}
@@ -122,7 +122,7 @@ void test_refs_transactions__error_on_locking_locked_ref(void)
cl_git_pass(git_transaction_lock_ref(g_tx_with_lock, "refs/heads/master"));
/* lock reference for set_target */
- cl_git_pass(git_oid_fromstr(&id, "a65fedf39aefe402d3bb6e24df4d4f5fe4547750"));
+ cl_git_pass(git_oid__fromstr(&id, "a65fedf39aefe402d3bb6e24df4d4f5fe4547750", GIT_OID_SHA1));
cl_git_fail_with(GIT_ELOCKED, git_transaction_lock_ref(g_tx, "refs/heads/master"));
cl_git_fail_with(GIT_ENOTFOUND, git_transaction_set_target(g_tx, "refs/heads/master", &id, NULL, NULL));
diff --git a/tests/libgit2/repo/env.c b/tests/libgit2/repo/env.c
index e3e522480..790ffd40f 100644
--- a/tests/libgit2/repo/env.c
+++ b/tests/libgit2/repo/env.c
@@ -95,9 +95,9 @@ static void env_check_objects_(bool a, bool t, bool p, const char *file, const c
git_repository *repo;
git_oid oid_a, oid_t, oid_p;
git_object *object;
- cl_git_pass(git_oid_fromstr(&oid_a, "45141a79a77842c59a63229403220a4e4be74e3d"));
- cl_git_pass(git_oid_fromstr(&oid_t, "1385f264afb75a56a5bec74243be9b367ba4ca08"));
- cl_git_pass(git_oid_fromstr(&oid_p, "0df1a5865c8abfc09f1f2182e6a31be550e99f07"));
+ cl_git_pass(git_oid__fromstr(&oid_a, "45141a79a77842c59a63229403220a4e4be74e3d", GIT_OID_SHA1));
+ cl_git_pass(git_oid__fromstr(&oid_t, "1385f264afb75a56a5bec74243be9b367ba4ca08", GIT_OID_SHA1));
+ cl_git_pass(git_oid__fromstr(&oid_p, "0df1a5865c8abfc09f1f2182e6a31be550e99f07", GIT_OID_SHA1));
cl_git_expect(git_repository_open_ext(&repo, "attr", GIT_REPOSITORY_OPEN_FROM_ENV, NULL), 0, file, func, line);
if (a) {
diff --git a/tests/libgit2/repo/hashfile.c b/tests/libgit2/repo/hashfile.c
index e23bb77f9..f053cb950 100644
--- a/tests/libgit2/repo/hashfile.c
+++ b/tests/libgit2/repo/hashfile.c
@@ -1,4 +1,5 @@
#include "clar_libgit2.h"
+#include "odb.h"
static git_repository *_repo;
@@ -20,19 +21,19 @@ void test_repo_hashfile__simple(void)
git_str full = GIT_STR_INIT;
/* hash with repo relative path */
- cl_git_pass(git_odb_hashfile(&a, "status/current_file", GIT_OBJECT_BLOB));
+ cl_git_pass(git_odb__hashfile(&a, "status/current_file", GIT_OBJECT_BLOB, GIT_OID_SHA1));
cl_git_pass(git_repository_hashfile(&b, _repo, "current_file", GIT_OBJECT_BLOB, NULL));
cl_assert_equal_oid(&a, &b);
cl_git_pass(git_str_joinpath(&full, git_repository_workdir(_repo), "current_file"));
/* hash with full path */
- cl_git_pass(git_odb_hashfile(&a, full.ptr, GIT_OBJECT_BLOB));
+ cl_git_pass(git_odb__hashfile(&a, full.ptr, GIT_OBJECT_BLOB, GIT_OID_SHA1));
cl_git_pass(git_repository_hashfile(&b, _repo, full.ptr, GIT_OBJECT_BLOB, NULL));
cl_assert_equal_oid(&a, &b);
/* hash with invalid type */
- cl_git_fail(git_odb_hashfile(&a, full.ptr, GIT_OBJECT_ANY));
+ cl_git_fail(git_odb__hashfile(&a, full.ptr, GIT_OBJECT_ANY, GIT_OID_SHA1));
cl_git_fail(git_repository_hashfile(&b, _repo, full.ptr, GIT_OBJECT_OFS_DELTA, NULL));
git_str_dispose(&full);
@@ -59,64 +60,64 @@ void test_repo_hashfile__filtered_in_workdir(void)
cl_git_mkfile("status/testfile.bin", "other\r\nstuff\r\n");
/* not equal hashes because of filtering */
- cl_git_pass(git_odb_hashfile(&a, "status/testfile.txt", GIT_OBJECT_BLOB));
+ cl_git_pass(git_odb__hashfile(&a, "status/testfile.txt", GIT_OBJECT_BLOB, GIT_OID_SHA1));
cl_git_pass(git_repository_hashfile(&b, _repo, "testfile.txt", GIT_OBJECT_BLOB, NULL));
cl_assert(git_oid_cmp(&a, &b));
/* not equal hashes because of filtering when specified by absolute path */
- cl_git_pass(git_odb_hashfile(&a, "status/testfile.txt", GIT_OBJECT_BLOB));
+ cl_git_pass(git_odb__hashfile(&a, "status/testfile.txt", GIT_OBJECT_BLOB, GIT_OID_SHA1));
cl_git_pass(git_repository_hashfile(&b, _repo, txt.ptr, GIT_OBJECT_BLOB, NULL));
cl_assert(git_oid_cmp(&a, &b));
/* equal hashes because filter is binary */
- cl_git_pass(git_odb_hashfile(&a, "status/testfile.bin", GIT_OBJECT_BLOB));
+ cl_git_pass(git_odb__hashfile(&a, "status/testfile.bin", GIT_OBJECT_BLOB, GIT_OID_SHA1));
cl_git_pass(git_repository_hashfile(&b, _repo, "testfile.bin", GIT_OBJECT_BLOB, NULL));
cl_assert_equal_oid(&a, &b);
/* equal hashes because filter is binary when specified by absolute path */
- cl_git_pass(git_odb_hashfile(&a, "status/testfile.bin", GIT_OBJECT_BLOB));
+ cl_git_pass(git_odb__hashfile(&a, "status/testfile.bin", GIT_OBJECT_BLOB, GIT_OID_SHA1));
cl_git_pass(git_repository_hashfile(&b, _repo, bin.ptr, GIT_OBJECT_BLOB, NULL));
cl_assert_equal_oid(&a, &b);
/* equal hashes when 'as_file' points to binary filtering */
- cl_git_pass(git_odb_hashfile(&a, "status/testfile.txt", GIT_OBJECT_BLOB));
+ cl_git_pass(git_odb__hashfile(&a, "status/testfile.txt", GIT_OBJECT_BLOB, GIT_OID_SHA1));
cl_git_pass(git_repository_hashfile(&b, _repo, "testfile.txt", GIT_OBJECT_BLOB, "foo.bin"));
cl_assert_equal_oid(&a, &b);
/* equal hashes when 'as_file' points to binary filtering (absolute path) */
- cl_git_pass(git_odb_hashfile(&a, "status/testfile.txt", GIT_OBJECT_BLOB));
+ cl_git_pass(git_odb__hashfile(&a, "status/testfile.txt", GIT_OBJECT_BLOB, GIT_OID_SHA1));
cl_git_pass(git_repository_hashfile(&b, _repo, txt.ptr, GIT_OBJECT_BLOB, "foo.bin"));
cl_assert_equal_oid(&a, &b);
/* not equal hashes when 'as_file' points to text filtering */
- cl_git_pass(git_odb_hashfile(&a, "status/testfile.bin", GIT_OBJECT_BLOB));
+ cl_git_pass(git_odb__hashfile(&a, "status/testfile.bin", GIT_OBJECT_BLOB, GIT_OID_SHA1));
cl_git_pass(git_repository_hashfile(&b, _repo, "testfile.bin", GIT_OBJECT_BLOB, "foo.txt"));
cl_assert(git_oid_cmp(&a, &b));
/* not equal hashes when 'as_file' points to text filtering */
- cl_git_pass(git_odb_hashfile(&a, "status/testfile.bin", GIT_OBJECT_BLOB));
+ cl_git_pass(git_odb__hashfile(&a, "status/testfile.bin", GIT_OBJECT_BLOB, GIT_OID_SHA1));
cl_git_pass(git_repository_hashfile(&b, _repo, bin.ptr, GIT_OBJECT_BLOB, "foo.txt"));
cl_assert(git_oid_cmp(&a, &b));
/* equal hashes when 'as_file' is empty and turns off filtering */
- cl_git_pass(git_odb_hashfile(&a, "status/testfile.txt", GIT_OBJECT_BLOB));
+ cl_git_pass(git_odb__hashfile(&a, "status/testfile.txt", GIT_OBJECT_BLOB, GIT_OID_SHA1));
cl_git_pass(git_repository_hashfile(&b, _repo, "testfile.txt", GIT_OBJECT_BLOB, ""));
cl_assert_equal_oid(&a, &b);
- cl_git_pass(git_odb_hashfile(&a, "status/testfile.bin", GIT_OBJECT_BLOB));
+ cl_git_pass(git_odb__hashfile(&a, "status/testfile.bin", GIT_OBJECT_BLOB, GIT_OID_SHA1));
cl_git_pass(git_repository_hashfile(&b, _repo, "testfile.bin", GIT_OBJECT_BLOB, ""));
cl_assert_equal_oid(&a, &b);
- cl_git_pass(git_odb_hashfile(&a, "status/testfile.txt", GIT_OBJECT_BLOB));
+ cl_git_pass(git_odb__hashfile(&a, "status/testfile.txt", GIT_OBJECT_BLOB, GIT_OID_SHA1));
cl_git_pass(git_repository_hashfile(&b, _repo, txt.ptr, GIT_OBJECT_BLOB, ""));
cl_assert_equal_oid(&a, &b);
- cl_git_pass(git_odb_hashfile(&a, "status/testfile.bin", GIT_OBJECT_BLOB));
+ cl_git_pass(git_odb__hashfile(&a, "status/testfile.bin", GIT_OBJECT_BLOB, GIT_OID_SHA1));
cl_git_pass(git_repository_hashfile(&b, _repo, bin.ptr, GIT_OBJECT_BLOB, ""));
cl_assert_equal_oid(&a, &b);
/* some hash type failures */
- cl_git_fail(git_odb_hashfile(&a, "status/testfile.txt", 0));
+ cl_git_fail(git_odb__hashfile(&a, "status/testfile.txt", 0, GIT_OID_SHA1));
cl_git_fail(git_repository_hashfile(&b, _repo, "testfile.txt", GIT_OBJECT_ANY, NULL));
git_str_dispose(&txt);
@@ -144,12 +145,12 @@ void test_repo_hashfile__filtered_outside_workdir(void)
cl_git_mkfile("absolute/testfile.bin", "other\r\nstuff\r\n");
/* not equal hashes because of filtering */
- cl_git_pass(git_odb_hashfile(&a, "absolute/testfile.txt", GIT_OBJECT_BLOB));
+ cl_git_pass(git_odb__hashfile(&a, "absolute/testfile.txt", GIT_OBJECT_BLOB, GIT_OID_SHA1));
cl_git_pass(git_repository_hashfile(&b, _repo, txt.ptr, GIT_OBJECT_BLOB, "testfile.txt"));
cl_assert(git_oid_cmp(&a, &b));
/* equal hashes because filter is binary */
- cl_git_pass(git_odb_hashfile(&a, "absolute/testfile.bin", GIT_OBJECT_BLOB));
+ cl_git_pass(git_odb__hashfile(&a, "absolute/testfile.bin", GIT_OBJECT_BLOB, GIT_OID_SHA1));
cl_git_pass(git_repository_hashfile(&b, _repo, bin.ptr, GIT_OBJECT_BLOB, "testfile.bin"));
cl_assert_equal_oid(&a, &b);
@@ -157,11 +158,11 @@ void test_repo_hashfile__filtered_outside_workdir(void)
* equal hashes because no filtering occurs for absolute paths outside the working
* directory unless as_path is specified
*/
- cl_git_pass(git_odb_hashfile(&a, "absolute/testfile.txt", GIT_OBJECT_BLOB));
+ cl_git_pass(git_odb__hashfile(&a, "absolute/testfile.txt", GIT_OBJECT_BLOB, GIT_OID_SHA1));
cl_git_pass(git_repository_hashfile(&b, _repo, txt.ptr, GIT_OBJECT_BLOB, NULL));
cl_assert_equal_oid(&a, &b);
- cl_git_pass(git_odb_hashfile(&a, "absolute/testfile.bin", GIT_OBJECT_BLOB));
+ cl_git_pass(git_odb__hashfile(&a, "absolute/testfile.bin", GIT_OBJECT_BLOB, GIT_OID_SHA1));
cl_git_pass(git_repository_hashfile(&b, _repo, bin.ptr, GIT_OBJECT_BLOB, NULL));
cl_assert_equal_oid(&a, &b);
diff --git a/tests/libgit2/repo/head.c b/tests/libgit2/repo/head.c
index 822990555..c886c3f79 100644
--- a/tests/libgit2/repo/head.c
+++ b/tests/libgit2/repo/head.c
@@ -99,7 +99,7 @@ void test_repo_head__set_head_detached_Return_ENOTFOUND_when_the_object_doesnt_e
{
git_oid oid;
- cl_git_pass(git_oid_fromstr(&oid, "deadbeefdeadbeefdeadbeefdeadbeefdeadbeef"));
+ cl_git_pass(git_oid__fromstr(&oid, "deadbeefdeadbeefdeadbeefdeadbeefdeadbeef", GIT_OID_SHA1));
cl_assert_equal_i(GIT_ENOTFOUND, git_repository_set_head_detached(repo, &oid));
}
diff --git a/tests/libgit2/repo/init.c b/tests/libgit2/repo/init.c
index 7cf6742ca..adcd9e025 100644
--- a/tests/libgit2/repo/init.c
+++ b/tests/libgit2/repo/init.c
@@ -708,7 +708,7 @@ void test_repo_init__defaultbranch_config_empty(void)
void test_repo_init__longpath(void)
{
#ifdef GIT_WIN32
- size_t padding = CONST_STRLEN("objects/pack/pack-.pack.lock") + GIT_OID_HEXSZ;
+ size_t padding = CONST_STRLEN("objects/pack/pack-.pack.lock") + GIT_OID_SHA1_HEXSIZE;
size_t max, i;
git_str path = GIT_STR_INIT;
git_repository *one = NULL, *two = NULL;
diff --git a/tests/libgit2/repo/setters.c b/tests/libgit2/repo/setters.c
index 9a965dec6..66ec7706c 100644
--- a/tests/libgit2/repo/setters.c
+++ b/tests/libgit2/repo/setters.c
@@ -1,6 +1,7 @@
#include "clar_libgit2.h"
#include "git2/sys/repository.h"
+#include "odb.h"
#include "posix.h"
#include "util.h"
#include "path.h"
@@ -90,7 +91,7 @@ void test_repo_setters__setting_a_new_odb_on_a_repo_which_already_loaded_one_pro
{
git_odb *new_odb;
- cl_git_pass(git_odb_open(&new_odb, "./testrepo.git/objects"));
+ cl_git_pass(git_odb__open(&new_odb, "./testrepo.git/objects", NULL));
cl_assert(((git_refcount *)new_odb)->refcount.val == 1);
git_repository_set_odb(repo, new_odb);
diff --git a/tests/libgit2/reset/hard.c b/tests/libgit2/reset/hard.c
index 9d177c021..0b6342cb2 100644
--- a/tests/libgit2/reset/hard.c
+++ b/tests/libgit2/reset/hard.c
@@ -122,9 +122,9 @@ static void unmerged_index_init(git_index *index, int entries)
int write_theirs = 4;
git_oid ancestor, ours, theirs;
- git_oid_fromstr(&ancestor, "452e4244b5d083ddf0460acf1ecc74db9dcfa11a");
- git_oid_fromstr(&ours, "32504b727382542f9f089e24fddac5e78533e96c");
- git_oid_fromstr(&theirs, "061d42a44cacde5726057b67558821d95db96f19");
+ git_oid__fromstr(&ancestor, "452e4244b5d083ddf0460acf1ecc74db9dcfa11a", GIT_OID_SHA1);
+ git_oid__fromstr(&ours, "32504b727382542f9f089e24fddac5e78533e96c", GIT_OID_SHA1);
+ git_oid__fromstr(&theirs, "061d42a44cacde5726057b67558821d95db96f19", GIT_OID_SHA1);
cl_git_rewritefile("status/conflicting_file", "conflicting file\n");
diff --git a/tests/libgit2/reset/soft.c b/tests/libgit2/reset/soft.c
index aca0834f2..128905021 100644
--- a/tests/libgit2/reset/soft.c
+++ b/tests/libgit2/reset/soft.c
@@ -53,11 +53,11 @@ void test_reset_soft__can_reset_the_detached_Head_to_the_specified_commit(void)
void test_reset_soft__resetting_to_the_commit_pointed_at_by_the_Head_does_not_change_the_target_of_the_Head(void)
{
git_oid oid;
- char raw_head_oid[GIT_OID_HEXSZ + 1];
+ char raw_head_oid[GIT_OID_SHA1_HEXSIZE + 1];
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';
+ raw_head_oid[GIT_OID_SHA1_HEXSIZE] = '\0';
cl_git_pass(git_revparse_single(&target, repo, raw_head_oid));
diff --git a/tests/libgit2/revert/bare.c b/tests/libgit2/revert/bare.c
index 9261cfe86..db443024e 100644
--- a/tests/libgit2/revert/bare.c
+++ b/tests/libgit2/revert/bare.c
@@ -34,10 +34,10 @@ void test_revert_bare__automerge(void)
{ 0100644, "0f5bfcf58c558d865da6be0281d7795993646cee", 0, "file6.txt" },
};
- git_oid_fromstr(&head_oid, "72333f47d4e83616630ff3b0ffe4c0faebcc3c45");
+ git_oid__fromstr(&head_oid, "72333f47d4e83616630ff3b0ffe4c0faebcc3c45", GIT_OID_SHA1);
cl_git_pass(git_commit_lookup(&head_commit, repo, &head_oid));
- git_oid_fromstr(&revert_oid, "d1d403d22cbe24592d725f442835cf46fe60c8ac");
+ git_oid__fromstr(&revert_oid, "d1d403d22cbe24592d725f442835cf46fe60c8ac", GIT_OID_SHA1);
cl_git_pass(git_commit_lookup(&revert_commit, repo, &revert_oid));
cl_git_pass(git_revert_commit(&index, repo, revert_commit, head_commit, 0, NULL));
@@ -64,7 +64,7 @@ void test_revert_bare__conflicts(void)
{ 0100644, "0f5bfcf58c558d865da6be0281d7795993646cee", 0, "file6.txt" },
};
- git_oid_fromstr(&revert_oid, "72333f47d4e83616630ff3b0ffe4c0faebcc3c45");
+ git_oid__fromstr(&revert_oid, "72333f47d4e83616630ff3b0ffe4c0faebcc3c45", GIT_OID_SHA1);
cl_git_pass(git_repository_head(&head_ref, repo));
cl_git_pass(git_reference_peel((git_object **)&head_commit, head_ref, GIT_OBJECT_COMMIT));
@@ -91,10 +91,10 @@ void test_revert_bare__orphan(void)
{ 0100644, "296a6d3be1dff05c5d1f631d2459389fa7b619eb", 0, "file-mainline.txt" },
};
- git_oid_fromstr(&head_oid, "39467716290f6df775a91cdb9a4eb39295018145");
+ git_oid__fromstr(&head_oid, "39467716290f6df775a91cdb9a4eb39295018145", GIT_OID_SHA1);
cl_git_pass(git_commit_lookup(&head_commit, repo, &head_oid));
- git_oid_fromstr(&revert_oid, "ebb03002cee5d66c7732dd06241119fe72ab96a5");
+ git_oid__fromstr(&revert_oid, "ebb03002cee5d66c7732dd06241119fe72ab96a5", GIT_OID_SHA1);
cl_git_pass(git_commit_lookup(&revert_commit, repo, &revert_oid));
cl_git_pass(git_revert_commit(&index, repo, revert_commit, head_commit, 0, NULL));
diff --git a/tests/libgit2/revert/rename.c b/tests/libgit2/revert/rename.c
index 0d713c60f..be7a98041 100644
--- a/tests/libgit2/revert/rename.c
+++ b/tests/libgit2/revert/rename.c
@@ -36,7 +36,7 @@ void test_revert_rename__automerge(void)
cl_git_pass(git_repository_head(&head_ref, repo));
cl_git_pass(git_reference_peel((git_object **)&head_commit, head_ref, GIT_OBJECT_COMMIT));
- cl_git_pass(git_oid_fromstr(&revert_oid, "7b4d7c3789b3581973c04087cb774c3c3576de2f"));
+ cl_git_pass(git_oid__fromstr(&revert_oid, "7b4d7c3789b3581973c04087cb774c3c3576de2f", GIT_OID_SHA1));
cl_git_pass(git_commit_lookup(&revert_commit, repo, &revert_oid));
cl_git_pass(git_revert_commit(&index, repo, revert_commit, head_commit, 0, NULL));
diff --git a/tests/libgit2/revert/workdir.c b/tests/libgit2/revert/workdir.c
index 3f54280ca..3e790b77f 100644
--- a/tests/libgit2/revert/workdir.c
+++ b/tests/libgit2/revert/workdir.c
@@ -45,11 +45,11 @@ void test_revert_workdir__automerge(void)
{ 0100644, "0f5bfcf58c558d865da6be0281d7795993646cee", 0, "file6.txt" },
};
- git_oid_fromstr(&head_oid, "72333f47d4e83616630ff3b0ffe4c0faebcc3c45");
+ git_oid__fromstr(&head_oid, "72333f47d4e83616630ff3b0ffe4c0faebcc3c45", GIT_OID_SHA1);
cl_git_pass(git_commit_lookup(&head, repo, &head_oid));
cl_git_pass(git_reset(repo, (git_object *)head, GIT_RESET_HARD, NULL));
- git_oid_fromstr(&revert_oid, "d1d403d22cbe24592d725f442835cf46fe60c8ac");
+ git_oid__fromstr(&revert_oid, "d1d403d22cbe24592d725f442835cf46fe60c8ac", GIT_OID_SHA1);
cl_git_pass(git_commit_lookup(&commit, repo, &revert_oid));
cl_git_pass(git_revert(repo, commit, NULL));
@@ -76,7 +76,7 @@ void test_revert_workdir__conflicts(void)
{ 0100644, "0f5bfcf58c558d865da6be0281d7795993646cee", 0, "file6.txt" },
};
- git_oid_fromstr(&revert_oid, "72333f47d4e83616630ff3b0ffe4c0faebcc3c45");
+ git_oid__fromstr(&revert_oid, "72333f47d4e83616630ff3b0ffe4c0faebcc3c45", GIT_OID_SHA1);
cl_git_pass(git_repository_head(&head_ref, repo));
cl_git_pass(git_reference_peel((git_object **)&head, head_ref, GIT_OBJECT_COMMIT));
@@ -141,11 +141,11 @@ void test_revert_workdir__orphan(void)
{ 0100644, "296a6d3be1dff05c5d1f631d2459389fa7b619eb", 0, "file-mainline.txt" },
};
- git_oid_fromstr(&head_oid, "39467716290f6df775a91cdb9a4eb39295018145");
+ git_oid__fromstr(&head_oid, "39467716290f6df775a91cdb9a4eb39295018145", GIT_OID_SHA1);
cl_git_pass(git_commit_lookup(&head, repo, &head_oid));
cl_git_pass(git_reset(repo, (git_object *)head, GIT_RESET_HARD, NULL));
- git_oid_fromstr(&revert_oid, "ebb03002cee5d66c7732dd06241119fe72ab96a5");
+ git_oid__fromstr(&revert_oid, "ebb03002cee5d66c7732dd06241119fe72ab96a5", GIT_OID_SHA1);
cl_git_pass(git_commit_lookup(&commit, repo, &revert_oid));
cl_git_pass(git_revert(repo, commit, NULL));
@@ -224,11 +224,11 @@ void test_revert_workdir__again_after_automerge(void)
{ 0100644, "0f5bfcf58c558d865da6be0281d7795993646cee", 0, "file6.txt" },
};
- git_oid_fromstr(&head_oid, "72333f47d4e83616630ff3b0ffe4c0faebcc3c45");
+ git_oid__fromstr(&head_oid, "72333f47d4e83616630ff3b0ffe4c0faebcc3c45", GIT_OID_SHA1);
cl_git_pass(git_commit_lookup(&head, repo, &head_oid));
cl_git_pass(git_reset(repo, (git_object *)head, GIT_RESET_HARD, NULL));
- git_oid_fromstr(&revert_oid, "d1d403d22cbe24592d725f442835cf46fe60c8ac");
+ git_oid__fromstr(&revert_oid, "d1d403d22cbe24592d725f442835cf46fe60c8ac", GIT_OID_SHA1);
cl_git_pass(git_commit_lookup(&commit, repo, &revert_oid));
cl_git_pass(git_revert(repo, commit, NULL));
@@ -272,11 +272,11 @@ void test_revert_workdir__again_after_edit(void)
cl_git_pass(git_repository_head(&head_ref, repo));
- cl_git_pass(git_oid_fromstr(&orig_head_oid, "399fb3aba3d9d13f7d40a9254ce4402067ef3149"));
+ cl_git_pass(git_oid__fromstr(&orig_head_oid, "399fb3aba3d9d13f7d40a9254ce4402067ef3149", GIT_OID_SHA1));
cl_git_pass(git_commit_lookup(&orig_head, repo, &orig_head_oid));
cl_git_pass(git_reset(repo, (git_object *)orig_head, GIT_RESET_HARD, NULL));
- cl_git_pass(git_oid_fromstr(&revert_oid, "2d440f2b3147d3dc7ad1085813478d6d869d5a4d"));
+ cl_git_pass(git_oid__fromstr(&revert_oid, "2d440f2b3147d3dc7ad1085813478d6d869d5a4d", GIT_OID_SHA1));
cl_git_pass(git_commit_lookup(&commit, repo, &revert_oid));
cl_git_pass(git_revert(repo, commit, NULL));
@@ -321,11 +321,11 @@ void test_revert_workdir__again_after_edit_two(void)
cl_git_pass(git_repository_config(&config, repo));
cl_git_pass(git_config_set_bool(config, "core.autocrlf", 0));
- cl_git_pass(git_oid_fromstr(&head_commit_oid, "75ec9929465623f17ff3ad68c0438ea56faba815"));
+ cl_git_pass(git_oid__fromstr(&head_commit_oid, "75ec9929465623f17ff3ad68c0438ea56faba815", GIT_OID_SHA1));
cl_git_pass(git_commit_lookup(&head_commit, repo, &head_commit_oid));
cl_git_pass(git_reset(repo, (git_object *)head_commit, GIT_RESET_HARD, NULL));
- cl_git_pass(git_oid_fromstr(&revert_commit_oid, "97e52d5e81f541080cd6b92829fb85bc4d81d90b"));
+ cl_git_pass(git_oid__fromstr(&revert_commit_oid, "97e52d5e81f541080cd6b92829fb85bc4d81d90b", GIT_OID_SHA1));
cl_git_pass(git_commit_lookup(&revert_commit, repo, &revert_commit_oid));
cl_git_pass(git_revert(repo, revert_commit, NULL));
@@ -376,11 +376,11 @@ void test_revert_workdir__conflict_use_ours(void)
opts.checkout_opts.checkout_strategy = GIT_CHECKOUT_SAFE | GIT_CHECKOUT_USE_OURS;
- git_oid_fromstr(&head_oid, "72333f47d4e83616630ff3b0ffe4c0faebcc3c45");
+ git_oid__fromstr(&head_oid, "72333f47d4e83616630ff3b0ffe4c0faebcc3c45", GIT_OID_SHA1);
cl_git_pass(git_commit_lookup(&head, repo, &head_oid));
cl_git_pass(git_reset(repo, (git_object *)head, GIT_RESET_HARD, NULL));
- git_oid_fromstr(&revert_oid, "d1d403d22cbe24592d725f442835cf46fe60c8ac");
+ git_oid__fromstr(&revert_oid, "d1d403d22cbe24592d725f442835cf46fe60c8ac", GIT_OID_SHA1);
cl_git_pass(git_commit_lookup(&commit, repo, &revert_oid));
cl_git_pass(git_revert(repo, commit, &opts));
@@ -412,11 +412,11 @@ void test_revert_workdir__rename_1_of_2(void)
opts.merge_opts.flags |= GIT_MERGE_FIND_RENAMES;
opts.merge_opts.rename_threshold = 50;
- git_oid_fromstr(&head_oid, "cef56612d71a6af8d8015691e4865f7fece905b5");
+ git_oid__fromstr(&head_oid, "cef56612d71a6af8d8015691e4865f7fece905b5", GIT_OID_SHA1);
cl_git_pass(git_commit_lookup(&head, repo, &head_oid));
cl_git_pass(git_reset(repo, (git_object *)head, GIT_RESET_HARD, NULL));
- git_oid_fromstr(&revert_oid, "55568c8de5322ff9a95d72747a239cdb64a19965");
+ git_oid__fromstr(&revert_oid, "55568c8de5322ff9a95d72747a239cdb64a19965", GIT_OID_SHA1);
cl_git_pass(git_commit_lookup(&commit, repo, &revert_oid));
cl_git_pass(git_revert(repo, commit, &opts));
@@ -446,11 +446,11 @@ void test_revert_workdir__rename(void)
opts.merge_opts.flags |= GIT_MERGE_FIND_RENAMES;
opts.merge_opts.rename_threshold = 50;
- git_oid_fromstr(&head_oid, "55568c8de5322ff9a95d72747a239cdb64a19965");
+ git_oid__fromstr(&head_oid, "55568c8de5322ff9a95d72747a239cdb64a19965", GIT_OID_SHA1);
cl_git_pass(git_commit_lookup(&head, repo, &head_oid));
cl_git_pass(git_reset(repo, (git_object *)head, GIT_RESET_HARD, NULL));
- git_oid_fromstr(&revert_oid, "0aa8c7e40d342fff78d60b29a4ba8e993ed79c51");
+ git_oid__fromstr(&revert_oid, "0aa8c7e40d342fff78d60b29a4ba8e993ed79c51", GIT_OID_SHA1);
cl_git_pass(git_commit_lookup(&commit, repo, &revert_oid));
cl_git_pass(git_revert(repo, commit, &opts));
@@ -512,7 +512,7 @@ void test_revert_workdir__merge_fails_without_mainline_specified(void)
git_commit *head;
git_oid head_oid;
- git_oid_fromstr(&head_oid, "5acdc74af27172ec491d213ee36cea7eb9ef2579");
+ git_oid__fromstr(&head_oid, "5acdc74af27172ec491d213ee36cea7eb9ef2579", GIT_OID_SHA1);
cl_git_pass(git_commit_lookup(&head, repo, &head_oid));
cl_git_pass(git_reset(repo, (git_object *)head, GIT_RESET_HARD, NULL));
@@ -539,7 +539,7 @@ void test_revert_workdir__merge_first_parent(void)
opts.mainline = 1;
- git_oid_fromstr(&head_oid, "5acdc74af27172ec491d213ee36cea7eb9ef2579");
+ git_oid__fromstr(&head_oid, "5acdc74af27172ec491d213ee36cea7eb9ef2579", GIT_OID_SHA1);
cl_git_pass(git_commit_lookup(&head, repo, &head_oid));
cl_git_pass(git_reset(repo, (git_object *)head, GIT_RESET_HARD, NULL));
@@ -564,7 +564,7 @@ void test_revert_workdir__merge_second_parent(void)
opts.mainline = 2;
- git_oid_fromstr(&head_oid, "5acdc74af27172ec491d213ee36cea7eb9ef2579");
+ git_oid__fromstr(&head_oid, "5acdc74af27172ec491d213ee36cea7eb9ef2579", GIT_OID_SHA1);
cl_git_pass(git_commit_lookup(&head, repo, &head_oid));
cl_git_pass(git_reset(repo, (git_object *)head, GIT_RESET_HARD, NULL));
diff --git a/tests/libgit2/revwalk/basic.c b/tests/libgit2/revwalk/basic.c
index 2c8d885e2..62a57aaa3 100644
--- a/tests/libgit2/revwalk/basic.c
+++ b/tests/libgit2/revwalk/basic.c
@@ -50,12 +50,12 @@ static const int result_bytes = 24;
static int get_commit_index(git_oid *raw_oid)
{
int i;
- char oid[GIT_OID_HEXSZ];
+ char oid[GIT_OID_SHA1_HEXSIZE];
git_oid_fmt(oid, raw_oid);
for (i = 0; i < commit_count; ++i)
- if (memcmp(oid, commit_ids[i], GIT_OID_HEXSZ) == 0)
+ if (memcmp(oid, commit_ids[i], GIT_OID_SHA1_HEXSIZE) == 0)
return i;
return -1;
@@ -75,9 +75,9 @@ static int test_walk_only(git_revwalk *walk,
while (git_revwalk_next(&oid, walk) == 0) {
result_array[i++] = get_commit_index(&oid);
/*{
- char str[GIT_OID_HEXSZ+1];
+ char str[GIT_OID_SHA1_HEXSIZE+1];
git_oid_fmt(str, &oid);
- str[GIT_OID_HEXSZ] = 0;
+ str[GIT_OID_SHA1_HEXSIZE] = 0;
printf(" %d) %s\n", i, str);
}*/
}
@@ -139,7 +139,7 @@ void test_revwalk_basic__sorting_modes(void)
revwalk_basic_setup_walk(NULL);
- git_oid_fromstr(&id, commit_head);
+ git_oid__fromstr(&id, commit_head, GIT_OID_SHA1);
cl_git_pass(test_walk(_walk, &id, GIT_SORT_TIME, commit_sorting_time, 1));
cl_git_pass(test_walk(_walk, &id, GIT_SORT_TOPOLOGICAL, commit_sorting_topo, 2));
@@ -204,7 +204,7 @@ void test_revwalk_basic__sorted_after_reset(void)
revwalk_basic_setup_walk(NULL);
- git_oid_fromstr(&oid, commit_head);
+ git_oid__fromstr(&oid, commit_head, GIT_OID_SHA1);
/* push, sort, and test the walk */
cl_git_pass(git_revwalk_push(_walk, &oid));
@@ -282,7 +282,7 @@ void test_revwalk_basic__multiple_push_1(void)
cl_git_pass(git_revwalk_hide_ref(_walk, "refs/heads/packed-test"));
- cl_git_pass(git_oid_fromstr(&oid, "5b5b025afb0b4c913b4c338a42934a3863bf3644"));
+ cl_git_pass(git_oid__fromstr(&oid, "5b5b025afb0b4c913b4c338a42934a3863bf3644", GIT_OID_SHA1));
cl_git_pass(git_revwalk_push(_walk, &oid));
while (git_revwalk_next(&oid, _walk) == 0)
@@ -316,7 +316,7 @@ void test_revwalk_basic__multiple_push_2(void)
revwalk_basic_setup_walk(NULL);
- cl_git_pass(git_oid_fromstr(&oid, "5b5b025afb0b4c913b4c338a42934a3863bf3644"));
+ cl_git_pass(git_oid__fromstr(&oid, "5b5b025afb0b4c913b4c338a42934a3863bf3644", GIT_OID_SHA1));
cl_git_pass(git_revwalk_push(_walk, &oid));
cl_git_pass(git_revwalk_hide_ref(_walk, "refs/heads/packed-test"));
@@ -335,7 +335,7 @@ void test_revwalk_basic__disallow_non_commit(void)
revwalk_basic_setup_walk(NULL);
- cl_git_pass(git_oid_fromstr(&oid, "521d87c1ec3aef9824daf6d96cc0ae3710766d91"));
+ cl_git_pass(git_oid__fromstr(&oid, "521d87c1ec3aef9824daf6d96cc0ae3710766d91", GIT_OID_SHA1));
cl_git_fail(git_revwalk_push(_walk, &oid));
}
@@ -345,7 +345,7 @@ void test_revwalk_basic__hide_then_push(void)
int i = 0;
revwalk_basic_setup_walk(NULL);
- cl_git_pass(git_oid_fromstr(&oid, "5b5b025afb0b4c913b4c338a42934a3863bf3644"));
+ cl_git_pass(git_oid__fromstr(&oid, "5b5b025afb0b4c913b4c338a42934a3863bf3644", GIT_OID_SHA1));
cl_git_pass(git_revwalk_hide(_walk, &oid));
cl_git_pass(git_revwalk_push(_walk, &oid));
@@ -359,7 +359,7 @@ void test_revwalk_basic__hide_then_push(void)
void test_revwalk_basic__topo_crash(void)
{
git_oid oid;
- git_oid_fromstr(&oid, "5b5b025afb0b4c913b4c338a42934a3863bf3644");
+ git_oid__fromstr(&oid, "5b5b025afb0b4c913b4c338a42934a3863bf3644", GIT_OID_SHA1);
revwalk_basic_setup_walk(NULL);
git_revwalk_sorting(_walk, GIT_SORT_TOPOLOGICAL);
@@ -378,8 +378,8 @@ void test_revwalk_basic__from_new_to_old(void)
revwalk_basic_setup_walk(NULL);
git_revwalk_sorting(_walk, GIT_SORT_TIME);
- cl_git_pass(git_oid_fromstr(&to_oid, "5b5b025afb0b4c913b4c338a42934a3863bf3644"));
- cl_git_pass(git_oid_fromstr(&from_oid, "a4a7dce85cf63874e984719f4fdd239f5145052f"));
+ cl_git_pass(git_oid__fromstr(&to_oid, "5b5b025afb0b4c913b4c338a42934a3863bf3644", GIT_OID_SHA1));
+ cl_git_pass(git_oid__fromstr(&from_oid, "a4a7dce85cf63874e984719f4fdd239f5145052f", GIT_OID_SHA1));
cl_git_pass(git_revwalk_push(_walk, &to_oid));
cl_git_pass(git_revwalk_hide(_walk, &from_oid));
@@ -479,7 +479,7 @@ void test_revwalk_basic__mimic_git_rev_list(void)
cl_git_pass(git_revwalk_push_ref(_walk, "refs/heads/br2"));
cl_git_pass(git_revwalk_push_ref(_walk, "refs/heads/master"));
- cl_git_pass(git_oid_fromstr(&oid, "e90810b8df3e80c413d903f631643c716887138d"));
+ cl_git_pass(git_oid__fromstr(&oid, "e90810b8df3e80c413d903f631643c716887138d", GIT_OID_SHA1));
cl_git_pass(git_revwalk_push(_walk, &oid));
cl_git_pass(git_revwalk_next(&oid, _walk));
@@ -563,10 +563,10 @@ void test_revwalk_basic__old_hidden_commit_one(void)
revwalk_basic_setup_walk("testrepo.git");
- cl_git_pass(git_oid_fromstr(&new_id, "bd758010071961f28336333bc41e9c64c9a64866"));
+ cl_git_pass(git_oid__fromstr(&new_id, "bd758010071961f28336333bc41e9c64c9a64866", GIT_OID_SHA1));
cl_git_pass(git_revwalk_push(_walk, &new_id));
- cl_git_pass(git_oid_fromstr(&old_id, "8e73b769e97678d684b809b163bebdae2911720f"));
+ cl_git_pass(git_oid__fromstr(&old_id, "8e73b769e97678d684b809b163bebdae2911720f", GIT_OID_SHA1));
cl_git_pass(git_revwalk_hide(_walk, &old_id));
cl_git_pass(git_revwalk_next(&oid, _walk));
@@ -587,10 +587,10 @@ void test_revwalk_basic__old_hidden_commit_two(void)
revwalk_basic_setup_walk("testrepo.git");
- cl_git_pass(git_oid_fromstr(&new_id, "bd758010071961f28336333bc41e9c64c9a64866"));
+ cl_git_pass(git_oid__fromstr(&new_id, "bd758010071961f28336333bc41e9c64c9a64866", GIT_OID_SHA1));
cl_git_pass(git_revwalk_push(_walk, &new_id));
- cl_git_pass(git_oid_fromstr(&old_id, "b91e763008b10db366442469339f90a2b8400d0a"));
+ cl_git_pass(git_oid__fromstr(&old_id, "b91e763008b10db366442469339f90a2b8400d0a", GIT_OID_SHA1));
cl_git_pass(git_revwalk_hide(_walk, &old_id));
cl_git_pass(git_revwalk_next(&oid, _walk));
diff --git a/tests/libgit2/revwalk/hidecb.c b/tests/libgit2/revwalk/hidecb.c
index 54315bc77..2100a54f2 100644
--- a/tests/libgit2/revwalk/hidecb.c
+++ b/tests/libgit2/revwalk/hidecb.c
@@ -32,10 +32,10 @@ void test_revwalk_hidecb__initialize(void)
int i;
cl_git_pass(git_repository_open(&_repo, cl_fixture("testrepo.git")));
- cl_git_pass(git_oid_fromstr(&_head_id, commit_head));
+ cl_git_pass(git_oid__fromstr(&_head_id, commit_head, GIT_OID_SHA1));
for (i = 0; i < commit_count; i++)
- cl_git_pass(git_oid_fromstr(&commit_ids[i], commit_strs[i]));
+ cl_git_pass(git_oid__fromstr(&commit_ids[i], commit_strs[i], GIT_OID_SHA1));
}
diff --git a/tests/libgit2/revwalk/mergebase.c b/tests/libgit2/revwalk/mergebase.c
index 0378c869b..d413a1f6e 100644
--- a/tests/libgit2/revwalk/mergebase.c
+++ b/tests/libgit2/revwalk/mergebase.c
@@ -25,9 +25,9 @@ void test_revwalk_mergebase__single1(void)
git_oid result, one, two, expected;
size_t ahead, behind;
- cl_git_pass(git_oid_fromstr(&one, "c47800c7266a2be04c571c04d5a6614691ea99bd "));
- cl_git_pass(git_oid_fromstr(&two, "9fd738e8f7967c078dceed8190330fc8648ee56a"));
- cl_git_pass(git_oid_fromstr(&expected, "5b5b025afb0b4c913b4c338a42934a3863bf3644"));
+ cl_git_pass(git_oid__fromstr(&one, "c47800c7266a2be04c571c04d5a6614691ea99bd ", GIT_OID_SHA1));
+ cl_git_pass(git_oid__fromstr(&two, "9fd738e8f7967c078dceed8190330fc8648ee56a", GIT_OID_SHA1));
+ cl_git_pass(git_oid__fromstr(&expected, "5b5b025afb0b4c913b4c338a42934a3863bf3644", GIT_OID_SHA1));
cl_git_pass(git_merge_base(&result, _repo, &one, &two));
cl_assert_equal_oid(&expected, &result);
@@ -46,9 +46,9 @@ void test_revwalk_mergebase__single2(void)
git_oid result, one, two, expected;
size_t ahead, behind;
- cl_git_pass(git_oid_fromstr(&one, "763d71aadf09a7951596c9746c024e7eece7c7af"));
- cl_git_pass(git_oid_fromstr(&two, "a65fedf39aefe402d3bb6e24df4d4f5fe4547750"));
- cl_git_pass(git_oid_fromstr(&expected, "c47800c7266a2be04c571c04d5a6614691ea99bd"));
+ cl_git_pass(git_oid__fromstr(&one, "763d71aadf09a7951596c9746c024e7eece7c7af", GIT_OID_SHA1));
+ cl_git_pass(git_oid__fromstr(&two, "a65fedf39aefe402d3bb6e24df4d4f5fe4547750", GIT_OID_SHA1));
+ cl_git_pass(git_oid__fromstr(&expected, "c47800c7266a2be04c571c04d5a6614691ea99bd", GIT_OID_SHA1));
cl_git_pass(git_merge_base(&result, _repo, &one, &two));
cl_assert_equal_oid(&expected, &result);
@@ -67,9 +67,9 @@ void test_revwalk_mergebase__merged_branch(void)
git_oid result, one, two, expected;
size_t ahead, behind;
- cl_git_pass(git_oid_fromstr(&one, "a65fedf39aefe402d3bb6e24df4d4f5fe4547750"));
- cl_git_pass(git_oid_fromstr(&two, "9fd738e8f7967c078dceed8190330fc8648ee56a"));
- cl_git_pass(git_oid_fromstr(&expected, "9fd738e8f7967c078dceed8190330fc8648ee56a"));
+ cl_git_pass(git_oid__fromstr(&one, "a65fedf39aefe402d3bb6e24df4d4f5fe4547750", GIT_OID_SHA1));
+ cl_git_pass(git_oid__fromstr(&two, "9fd738e8f7967c078dceed8190330fc8648ee56a", GIT_OID_SHA1));
+ cl_git_pass(git_oid__fromstr(&expected, "9fd738e8f7967c078dceed8190330fc8648ee56a", GIT_OID_SHA1));
cl_git_pass(git_merge_base(&result, _repo, &one, &two));
cl_assert_equal_oid(&expected, &result);
@@ -91,8 +91,8 @@ void test_revwalk_mergebase__two_way_merge(void)
git_oid one, two;
size_t ahead, behind;
- cl_git_pass(git_oid_fromstr(&one, "9b219343610c88a1187c996d0dc58330b55cee28"));
- cl_git_pass(git_oid_fromstr(&two, "a953a018c5b10b20c86e69fef55ebc8ad4c5a417"));
+ cl_git_pass(git_oid__fromstr(&one, "9b219343610c88a1187c996d0dc58330b55cee28", GIT_OID_SHA1));
+ cl_git_pass(git_oid__fromstr(&two, "a953a018c5b10b20c86e69fef55ebc8ad4c5a417", GIT_OID_SHA1));
cl_git_pass(git_graph_ahead_behind(&ahead, &behind, _repo2, &one, &two));
cl_assert_equal_sz(ahead, 8);
@@ -110,8 +110,8 @@ void test_revwalk_mergebase__no_common_ancestor_returns_ENOTFOUND(void)
size_t ahead, behind;
int error;
- cl_git_pass(git_oid_fromstr(&one, "763d71aadf09a7951596c9746c024e7eece7c7af"));
- cl_git_pass(git_oid_fromstr(&two, "e90810b8df3e80c413d903f631643c716887138d"));
+ cl_git_pass(git_oid__fromstr(&one, "763d71aadf09a7951596c9746c024e7eece7c7af", GIT_OID_SHA1));
+ cl_git_pass(git_oid__fromstr(&two, "e90810b8df3e80c413d903f631643c716887138d", GIT_OID_SHA1));
error = git_merge_base(&result, _repo, &one, &two);
cl_git_fail(error);
@@ -127,9 +127,9 @@ void test_revwalk_mergebase__prefer_youngest_merge_base(void)
{
git_oid result, one, two, expected;
- cl_git_pass(git_oid_fromstr(&one, "a4a7dce85cf63874e984719f4fdd239f5145052f"));
- cl_git_pass(git_oid_fromstr(&two, "be3563ae3f795b2b4353bcce3a527ad0a4f7f644"));
- cl_git_pass(git_oid_fromstr(&expected, "c47800c7266a2be04c571c04d5a6614691ea99bd"));
+ cl_git_pass(git_oid__fromstr(&one, "a4a7dce85cf63874e984719f4fdd239f5145052f", GIT_OID_SHA1));
+ cl_git_pass(git_oid__fromstr(&two, "be3563ae3f795b2b4353bcce3a527ad0a4f7f644", GIT_OID_SHA1));
+ cl_git_pass(git_oid__fromstr(&expected, "c47800c7266a2be04c571c04d5a6614691ea99bd", GIT_OID_SHA1));
cl_git_pass(git_merge_base(&result, _repo, &one, &two));
cl_assert_equal_oid(&expected, &result);
@@ -140,10 +140,10 @@ void test_revwalk_mergebase__multiple_merge_bases(void)
git_oid one, two, expected1, expected2;
git_oidarray result = {NULL, 0};
- cl_git_pass(git_oid_fromstr(&one, "a4a7dce85cf63874e984719f4fdd239f5145052f"));
- cl_git_pass(git_oid_fromstr(&two, "be3563ae3f795b2b4353bcce3a527ad0a4f7f644"));
- cl_git_pass(git_oid_fromstr(&expected1, "c47800c7266a2be04c571c04d5a6614691ea99bd"));
- cl_git_pass(git_oid_fromstr(&expected2, "9fd738e8f7967c078dceed8190330fc8648ee56a"));
+ cl_git_pass(git_oid__fromstr(&one, "a4a7dce85cf63874e984719f4fdd239f5145052f", GIT_OID_SHA1));
+ cl_git_pass(git_oid__fromstr(&two, "be3563ae3f795b2b4353bcce3a527ad0a4f7f644", GIT_OID_SHA1));
+ cl_git_pass(git_oid__fromstr(&expected1, "c47800c7266a2be04c571c04d5a6614691ea99bd", GIT_OID_SHA1));
+ cl_git_pass(git_oid__fromstr(&expected2, "9fd738e8f7967c078dceed8190330fc8648ee56a", GIT_OID_SHA1));
cl_git_pass(git_merge_bases(&result, _repo, &one, &two));
cl_assert_equal_i(2, result.count);
@@ -160,10 +160,10 @@ void test_revwalk_mergebase__multiple_merge_bases_many_commits(void)
git_oid *input = git__malloc(sizeof(git_oid) * 2);
- cl_git_pass(git_oid_fromstr(&input[0], "a4a7dce85cf63874e984719f4fdd239f5145052f"));
- cl_git_pass(git_oid_fromstr(&input[1], "be3563ae3f795b2b4353bcce3a527ad0a4f7f644"));
- cl_git_pass(git_oid_fromstr(&expected1, "c47800c7266a2be04c571c04d5a6614691ea99bd"));
- cl_git_pass(git_oid_fromstr(&expected2, "9fd738e8f7967c078dceed8190330fc8648ee56a"));
+ cl_git_pass(git_oid__fromstr(&input[0], "a4a7dce85cf63874e984719f4fdd239f5145052f", GIT_OID_SHA1));
+ cl_git_pass(git_oid__fromstr(&input[1], "be3563ae3f795b2b4353bcce3a527ad0a4f7f644", GIT_OID_SHA1));
+ cl_git_pass(git_oid__fromstr(&expected1, "c47800c7266a2be04c571c04d5a6614691ea99bd", GIT_OID_SHA1));
+ cl_git_pass(git_oid__fromstr(&expected2, "9fd738e8f7967c078dceed8190330fc8648ee56a", GIT_OID_SHA1));
cl_git_pass(git_merge_bases_many(&result, _repo, 2, input));
cl_assert_equal_i(2, result.count);
@@ -178,8 +178,8 @@ void test_revwalk_mergebase__no_off_by_one_missing(void)
{
git_oid result, one, two;
- cl_git_pass(git_oid_fromstr(&one, "1a443023183e3f2bfbef8ac923cd81c1018a18fd"));
- cl_git_pass(git_oid_fromstr(&two, "9f13f7d0a9402c681f91dc590cf7b5470e6a77d2"));
+ cl_git_pass(git_oid__fromstr(&one, "1a443023183e3f2bfbef8ac923cd81c1018a18fd", GIT_OID_SHA1));
+ cl_git_pass(git_oid__fromstr(&two, "9f13f7d0a9402c681f91dc590cf7b5470e6a77d2", GIT_OID_SHA1));
cl_git_pass(git_merge_base(&result, _repo, &one, &two));
}
@@ -201,7 +201,7 @@ static void assert_mergebase_many(const char *expected_sha, int count, ...)
for (i = 0; i < count; ++i) {
partial_oid = va_arg(ap, char *);
- cl_git_pass(git_oid_fromstrn(&oid, partial_oid, strlen(partial_oid)));
+ cl_git_pass(git_oid__fromstrn(&oid, partial_oid, strlen(partial_oid), GIT_OID_SHA1));
cl_git_pass(git_object_lookup_prefix(&object, _repo, &oid, strlen(partial_oid), GIT_OBJECT_COMMIT));
git_oid_cpy(&oids[i], git_object_id(object));
@@ -214,7 +214,7 @@ static void assert_mergebase_many(const char *expected_sha, int count, ...)
cl_assert_equal_i(GIT_ENOTFOUND, git_merge_base_many(&oid, _repo, count, oids));
else {
cl_git_pass(git_merge_base_many(&oid, _repo, count, oids));
- cl_git_pass(git_oid_fromstr(&expected, expected_sha));
+ cl_git_pass(git_oid__fromstr(&expected, expected_sha, GIT_OID_SHA1));
cl_assert_equal_oid(&expected, &oid);
}
@@ -265,7 +265,7 @@ static void assert_mergebase_octopus(const char *expected_sha, int count, ...)
for (i = 0; i < count; ++i) {
partial_oid = va_arg(ap, char *);
- cl_git_pass(git_oid_fromstrn(&oid, partial_oid, strlen(partial_oid)));
+ cl_git_pass(git_oid__fromstrn(&oid, partial_oid, strlen(partial_oid), GIT_OID_SHA1));
cl_git_pass(git_object_lookup_prefix(&object, _repo, &oid, strlen(partial_oid), GIT_OBJECT_COMMIT));
git_oid_cpy(&oids[i], git_object_id(object));
@@ -278,7 +278,7 @@ static void assert_mergebase_octopus(const char *expected_sha, int count, ...)
cl_assert_equal_i(GIT_ENOTFOUND, git_merge_base_octopus(&oid, _repo, count, oids));
else {
cl_git_pass(git_merge_base_octopus(&oid, _repo, count, oids));
- cl_git_pass(git_oid_fromstr(&expected, expected_sha));
+ cl_git_pass(git_oid__fromstr(&expected, expected_sha, GIT_OID_SHA1));
cl_assert_equal_oid(&expected, &oid);
}
@@ -501,9 +501,9 @@ void test_revwalk_mergebase__remove_redundant(void)
cl_git_pass(git_repository_open(&repo, cl_fixture("redundant.git")));
- cl_git_pass(git_oid_fromstr(&one, "d89137c93ba1ee749214ff4ce52ae9137bc833f9"));
- cl_git_pass(git_oid_fromstr(&two, "91f4b95df4a59504a9813ba66912562931d990e3"));
- cl_git_pass(git_oid_fromstr(&base, "6cb1f2352d974e1c5a776093017e8772416ac97a"));
+ cl_git_pass(git_oid__fromstr(&one, "d89137c93ba1ee749214ff4ce52ae9137bc833f9", GIT_OID_SHA1));
+ cl_git_pass(git_oid__fromstr(&two, "91f4b95df4a59504a9813ba66912562931d990e3", GIT_OID_SHA1));
+ cl_git_pass(git_oid__fromstr(&base, "6cb1f2352d974e1c5a776093017e8772416ac97a", GIT_OID_SHA1));
cl_git_pass(git_merge_bases(&result, repo, &one, &two));
cl_assert_equal_i(1, result.count);
diff --git a/tests/libgit2/revwalk/simplify.c b/tests/libgit2/revwalk/simplify.c
index 6dd068a42..824496d7e 100644
--- a/tests/libgit2/revwalk/simplify.c
+++ b/tests/libgit2/revwalk/simplify.c
@@ -32,13 +32,13 @@ void test_revwalk_simplify__first_parent(void)
int i, error;
for (i = 0; i < 4; i++) {
- git_oid_fromstr(&expected[i], expected_str[i]);
+ git_oid__fromstr(&expected[i], expected_str[i], GIT_OID_SHA1);
}
repo = cl_git_sandbox_init("testrepo.git");
cl_git_pass(git_revwalk_new(&walk, repo));
- git_oid_fromstr(&id, commit_head);
+ git_oid__fromstr(&id, commit_head, GIT_OID_SHA1);
cl_git_pass(git_revwalk_push(walk, &id));
git_revwalk_sorting(walk, GIT_SORT_TOPOLOGICAL);
git_revwalk_simplify_first_parent(walk);
diff --git a/tests/libgit2/status/single.c b/tests/libgit2/status/single.c
index e7f92097c..b9659a031 100644
--- a/tests/libgit2/status/single.c
+++ b/tests/libgit2/status/single.c
@@ -1,5 +1,6 @@
#include "clar_libgit2.h"
#include "posix.h"
+#include "odb.h"
static void
cleanup__remove_file(void *_file)
@@ -17,11 +18,11 @@ void test_status_single__hash_single_file(void)
git_oid expected_id, actual_id;
/* initialization */
- git_oid_fromstr(&expected_id, file_hash);
+ git_oid__fromstr(&expected_id, file_hash, GIT_OID_SHA1);
cl_git_mkfile(file_name, file_contents);
cl_set_cleanup(&cleanup__remove_file, (void *)file_name);
- cl_git_pass(git_odb_hashfile(&actual_id, file_name, GIT_OBJECT_BLOB));
+ cl_git_pass(git_odb__hashfile(&actual_id, file_name, GIT_OBJECT_BLOB, GIT_OID_SHA1));
cl_assert_equal_oid(&expected_id, &actual_id);
}
@@ -35,11 +36,11 @@ void test_status_single__hash_single_empty_file(void)
git_oid expected_id, actual_id;
/* initialization */
- git_oid_fromstr(&expected_id, file_hash);
+ git_oid__fromstr(&expected_id, file_hash, GIT_OID_SHA1);
cl_git_mkfile(file_name, file_contents);
cl_set_cleanup(&cleanup__remove_file, (void *)file_name);
- cl_git_pass(git_odb_hashfile(&actual_id, file_name, GIT_OBJECT_BLOB));
+ cl_git_pass(git_odb__hashfile(&actual_id, file_name, GIT_OBJECT_BLOB, GIT_OID_SHA1));
cl_assert_equal_oid(&expected_id, &actual_id);
}
diff --git a/tests/libgit2/status/submodules.c b/tests/libgit2/status/submodules.c
index d223657b4..90d56d9cc 100644
--- a/tests/libgit2/status/submodules.c
+++ b/tests/libgit2/status/submodules.c
@@ -142,7 +142,7 @@ void test_status_submodules__moved_head(void)
/* move submodule HEAD to c47800c7266a2be04c571c04d5a6614691ea99bd */
cl_git_pass(
- git_oid_fromstr(&oid, "c47800c7266a2be04c571c04d5a6614691ea99bd"));
+ git_oid__fromstr(&oid, "c47800c7266a2be04c571c04d5a6614691ea99bd", GIT_OID_SHA1));
cl_git_pass(git_repository_set_head_detached(smrepo, &oid));
/* first do a normal status, which should now include the submodule */
diff --git a/tests/libgit2/status/worktree.c b/tests/libgit2/status/worktree.c
index 00c6ec2d5..efbf597a7 100644
--- a/tests/libgit2/status/worktree.c
+++ b/tests/libgit2/status/worktree.c
@@ -515,18 +515,21 @@ void test_status_worktree__conflict_with_diff3(void)
ancestor_entry.path = "modified_file";
ancestor_entry.mode = 0100644;
- git_oid_fromstr(&ancestor_entry.id,
- "452e4244b5d083ddf0460acf1ecc74db9dcfa11a");
+ git_oid__fromstr(&ancestor_entry.id,
+ "452e4244b5d083ddf0460acf1ecc74db9dcfa11a",
+ GIT_OID_SHA1);
our_entry.path = "modified_file";
our_entry.mode = 0100644;
- git_oid_fromstr(&our_entry.id,
- "452e4244b5d083ddf0460acf1ecc74db9dcfa11a");
+ git_oid__fromstr(&our_entry.id,
+ "452e4244b5d083ddf0460acf1ecc74db9dcfa11a",
+ GIT_OID_SHA1);
their_entry.path = "modified_file";
their_entry.mode = 0100644;
- git_oid_fromstr(&their_entry.id,
- "452e4244b5d083ddf0460acf1ecc74db9dcfa11a");
+ git_oid__fromstr(&their_entry.id,
+ "452e4244b5d083ddf0460acf1ecc74db9dcfa11a",
+ GIT_OID_SHA1);
cl_git_pass(git_status_file(&status, repo, "modified_file"));
cl_assert_equal_i(GIT_STATUS_WT_MODIFIED, status);
@@ -711,18 +714,21 @@ void test_status_worktree__conflicted_item(void)
ancestor_entry.mode = 0100644;
ancestor_entry.path = "modified_file";
- git_oid_fromstr(&ancestor_entry.id,
- "452e4244b5d083ddf0460acf1ecc74db9dcfa11a");
+ git_oid__fromstr(&ancestor_entry.id,
+ "452e4244b5d083ddf0460acf1ecc74db9dcfa11a",
+ GIT_OID_SHA1);
our_entry.mode = 0100644;
our_entry.path = "modified_file";
- git_oid_fromstr(&our_entry.id,
- "452e4244b5d083ddf0460acf1ecc74db9dcfa11a");
+ git_oid__fromstr(&our_entry.id,
+ "452e4244b5d083ddf0460acf1ecc74db9dcfa11a",
+ GIT_OID_SHA1);
their_entry.mode = 0100644;
their_entry.path = "modified_file";
- git_oid_fromstr(&their_entry.id,
- "452e4244b5d083ddf0460acf1ecc74db9dcfa11a");
+ git_oid__fromstr(&their_entry.id,
+ "452e4244b5d083ddf0460acf1ecc74db9dcfa11a",
+ GIT_OID_SHA1);
cl_git_pass(git_status_file(&status, repo, "modified_file"));
cl_assert_equal_i(GIT_STATUS_WT_MODIFIED, status);
@@ -744,11 +750,11 @@ void test_status_worktree__conflict_has_no_oid(void)
git_index_entry entry = {{0}};
git_status_list *statuslist;
const git_status_entry *status;
- git_oid zero_id = {{0}};
+ git_oid zero_id = GIT_OID_SHA1_ZERO;
entry.mode = 0100644;
entry.path = "modified_file";
- git_oid_fromstr(&entry.id, "452e4244b5d083ddf0460acf1ecc74db9dcfa11a");
+ git_oid__fromstr(&entry.id, "452e4244b5d083ddf0460acf1ecc74db9dcfa11a", GIT_OID_SHA1);
cl_git_pass(git_repository_index(&index, repo));
cl_git_pass(git_index_conflict_add(index, &entry, &entry, &entry));
diff --git a/tests/libgit2/submodule/add.c b/tests/libgit2/submodule/add.c
index ae5507d7f..a2a66e7f5 100644
--- a/tests/libgit2/submodule/add.c
+++ b/tests/libgit2/submodule/add.c
@@ -139,7 +139,7 @@ static void test_add_entry(
{
git_index_entry entry = {{0}};
- cl_git_pass(git_oid_fromstr(&entry.id, idstr));
+ cl_git_pass(git_oid__fromstr(&entry.id, idstr, GIT_OID_SHA1));
entry.path = path;
entry.mode = mode;
diff --git a/tests/libgit2/transports/smart/packet.c b/tests/libgit2/transports/smart/packet.c
index 5b623a378..8801ef833 100644
--- a/tests/libgit2/transports/smart/packet.c
+++ b/tests/libgit2/transports/smart/packet.c
@@ -68,7 +68,7 @@ static void assert_ack_parses(const char *line, const char *expected_oid, enum g
git_pkt_ack *pkt;
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_git_pass(git_pkt_parse_line((git_pkt **) &pkt, &endptr, line, linelen));
cl_assert_equal_i(pkt->type, GIT_PKT_ACK);
@@ -154,7 +154,7 @@ static void assert_ref_parses_(const char *line, size_t linelen, const char *exp
git_pkt_ref *pkt;
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_git_pass(git_pkt_parse_line((git_pkt **) &pkt, &endptr, line, linelen));
cl_assert_equal_i(pkt->type, GIT_PKT_REF);
diff --git a/tests/libgit2/win32/forbidden.c b/tests/libgit2/win32/forbidden.c
index 5c007987b..c4e82e90d 100644
--- a/tests/libgit2/win32/forbidden.c
+++ b/tests/libgit2/win32/forbidden.c
@@ -37,7 +37,7 @@ void test_win32_forbidden__can_add_forbidden_filename_with_entry(void)
entry.path = "aux";
entry.mode = GIT_FILEMODE_BLOB;
- git_oid_fromstr(&entry.id, "da623abd956bb2fd8052c708c7ed43f05d192d37");
+ git_oid__fromstr(&entry.id, "da623abd956bb2fd8052c708c7ed43f05d192d37", GIT_OID_SHA1);
cl_git_pass(git_index_add(index, &entry));
@@ -53,7 +53,7 @@ void test_win32_forbidden__cannot_add_dot_git_even_with_entry(void)
entry.path = "foo/.git";
entry.mode = GIT_FILEMODE_BLOB;
- git_oid_fromstr(&entry.id, "da623abd956bb2fd8052c708c7ed43f05d192d37");
+ git_oid__fromstr(&entry.id, "da623abd956bb2fd8052c708c7ed43f05d192d37", GIT_OID_SHA1);
cl_git_fail(git_index_add(index, &entry));