summaryrefslogtreecommitdiff
path: root/tests/libgit2/object
diff options
context:
space:
mode:
Diffstat (limited to 'tests/libgit2/object')
-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
27 files changed, 209 insertions, 202 deletions
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));