Commit a9793ac6 by Yuang Li

refactor grafts tests

parent 4f2f91a3
......@@ -27,10 +27,10 @@ void test_grafts_basic__graft_add(void)
cl_git_pass(git_grafts_new(&grafts));
cl_assert(oid1 = git_array_alloc(parents));
cl_git_pass(git_oid_fromstr(&oid_src, "2f3053cbff8a4ca2f0666de364ddb734a28a31a9"));
cl_git_pass(git_oid__fromstr(&oid_src, "2f3053cbff8a4ca2f0666de364ddb734a28a31a9", GIT_OID_SHA1));
git_oid_cpy(oid1, &oid_src);
git_oid_fromstr(&oid_src, "f503807ffa920e407a600cfaee96b7152259acc7");
git_oid__fromstr(&oid_src, "f503807ffa920e407a600cfaee96b7152259acc7", GIT_OID_SHA1);
cl_git_pass(git_grafts_add(grafts, &oid_src, parents));
git_array_clear(parents);
......@@ -75,17 +75,17 @@ void test_grafts_basic__grafted_objects(void)
git_oid oid;
git_commit *commit;
cl_git_pass(git_oid_fromstr(&oid, "f503807ffa920e407a600cfaee96b7152259acc7"));
cl_git_pass(git_oid__fromstr(&oid, "f503807ffa920e407a600cfaee96b7152259acc7", GIT_OID_SHA1));
cl_git_pass(git_commit_lookup(&commit, g_repo, &oid));
cl_assert_equal_i(1, git_commit_parentcount(commit));
git_commit_free(commit);
cl_git_pass(git_oid_fromstr(&oid, "0512adebd3782157f0d5c9b22b043f87b4aaff9e"));
cl_git_pass(git_oid__fromstr(&oid, "0512adebd3782157f0d5c9b22b043f87b4aaff9e", GIT_OID_SHA1));
cl_git_pass(git_commit_lookup(&commit, g_repo, &oid));
cl_assert_equal_i(1, git_commit_parentcount(commit));
git_commit_free(commit);
cl_git_pass(git_oid_fromstr(&oid, "66cc22a015f6ca75b34c82d28f78ba663876bade"));
cl_git_pass(git_oid__fromstr(&oid, "66cc22a015f6ca75b34c82d28f78ba663876bade", GIT_OID_SHA1));
cl_git_pass(git_commit_lookup(&commit, g_repo, &oid));
cl_assert_equal_i(4, git_commit_parentcount(commit));
git_commit_free(commit);
......
......@@ -46,14 +46,14 @@ static void assert_graft_contains(git_grafts *grafts, const char *graft, size_t
va_list ap;
size_t i = 0;
cl_git_pass(git_oid_fromstr(&oid, graft));
cl_git_pass(git_oid__fromstr(&oid, graft, GIT_OID_SHA1));
cl_git_pass(git_grafts_get(&commit, grafts, &oid));
cl_assert_equal_oid(&commit->oid, &oid);
cl_assert_equal_i(commit->parents.size, n);
va_start(ap, n);
while (i < n) {
cl_git_pass(git_oid_fromstr(&oid, va_arg(ap, const char *)));
cl_git_pass(git_oid__fromstr(&oid, va_arg(ap, const char *), GIT_OID_SHA1));
cl_assert_equal_oid(&commit->parents.ptr[i], &oid);
i++;
}
......
......@@ -20,7 +20,7 @@ void test_grafts_shallow__unset_feature_flag(void)
void test_grafts_shallow__initialize(void)
{
git_libgit2_opts(GIT_OPT_ENABLE_SHALLOW, 1);
cl_git_pass(git_oid_fromstr(&g_shallow_oid, "be3563ae3f795b2b4353bcce3a527ad0a4f7f644"));
cl_git_pass(git_oid__fromstr(&g_shallow_oid, "be3563ae3f795b2b4353bcce3a527ad0a4f7f644", GIT_OID_SHA1));
}
void test_grafts_shallow__cleanup(void)
......@@ -73,7 +73,7 @@ void test_grafts_shallow__cache_clearing(void)
git_grafts *grafts;
git_oid tmp_oid;
cl_git_pass(git_oid_fromstr(&tmp_oid, "0000000000000000000000000000000000000000"));
cl_git_pass(git_oid__fromstr(&tmp_oid, "0000000000000000000000000000000000000000", GIT_OID_SHA1));
g_repo = cl_git_sandbox_init("shallow.git");
cl_git_pass(git_repository_shallow_grafts__weakptr(&grafts, g_repo));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment