summaryrefslogtreecommitdiff
path: root/tests/libgit2
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@edwardthomson.com>2022-01-22 23:10:03 -0500
committerEdward Thomson <ethomson@edwardthomson.com>2022-06-14 22:29:57 -0400
commitdbc4ac1c76827e954e0aa27afe8bb7e0b8993a93 (patch)
tree56f18a11bca8d17490a176cddf9e3756c2cebe91 /tests/libgit2
parentf98dd5438f8d7bfd557b612fdf1605b1c3fb8eaf (diff)
downloadlibgit2-dbc4ac1c76827e954e0aa27afe8bb7e0b8993a93.tar.gz
oid: `GIT_OID_*SZ` is now `GIT_OID_SHA1_*SIZE`
In preparation for SHA256 support, `GIT_OID_RAWSZ` and `GIT_OID_HEXSZ` need to indicate that they're the size of _SHA1_ OIDs.
Diffstat (limited to 'tests/libgit2')
-rw-r--r--tests/libgit2/blame/blame_helpers.c2
-rw-r--r--tests/libgit2/checkout/conflict.c2
-rw-r--r--tests/libgit2/core/oidmap.c2
-rw-r--r--tests/libgit2/core/pool.c2
-rw-r--r--tests/libgit2/diff/binary.c16
-rw-r--r--tests/libgit2/diff/parse.c2
-rw-r--r--tests/libgit2/graph/commitgraph.c6
-rw-r--r--tests/libgit2/merge/merge_helpers.h8
-rw-r--r--tests/libgit2/network/remote/rename.c4
-rw-r--r--tests/libgit2/object/raw/compare.c16
-rw-r--r--tests/libgit2/object/raw/convert.c36
-rw-r--r--tests/libgit2/object/raw/short.c6
-rw-r--r--tests/libgit2/object/raw/size.c8
-rw-r--r--tests/libgit2/odb/backend/backend_helpers.c6
-rw-r--r--tests/libgit2/odb/mixed.c6
-rw-r--r--tests/libgit2/pack/midx.c4
-rw-r--r--tests/libgit2/patch/parse.c2
-rw-r--r--tests/libgit2/refs/reflog/reflog_helpers.c6
-rw-r--r--tests/libgit2/refs/revparse.c12
-rw-r--r--tests/libgit2/repo/init.c2
-rw-r--r--tests/libgit2/reset/soft.c4
-rw-r--r--tests/libgit2/revwalk/basic.c8
22 files changed, 80 insertions, 80 deletions
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/checkout/conflict.c b/tests/libgit2/checkout/conflict.c
index 4a9e4b9fa..30838940e 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];
};
diff --git a/tests/libgit2/core/oidmap.c b/tests/libgit2/core/oidmap.c
index 7f98287a6..6854e3432 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);
diff --git a/tests/libgit2/core/pool.c b/tests/libgit2/core/pool.c
index 5746e35b8..af132132a 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;
diff --git a/tests/libgit2/diff/binary.c b/tests/libgit2/diff/binary.c
index 4e71f39c6..284a1b1af 100644
--- a/tests/libgit2/diff/binary.c
+++ b/tests/libgit2/diff/binary.c
@@ -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,7 +285,7 @@ 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");
@@ -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));
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/graph/commitgraph.c b/tests/libgit2/graph/commitgraph.c
index 7607c35a3..850f1947c 100644
--- a/tests/libgit2/graph/commitgraph.c
+++ b/tests/libgit2/graph/commitgraph.c
@@ -20,7 +20,7 @@ void test_graph_commitgraph__parse(void)
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_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_assert_equal_oid(&e.tree_oid, &id);
@@ -29,7 +29,7 @@ void test_graph_commitgraph__parse(void)
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_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));
@@ -63,7 +63,7 @@ void test_graph_commitgraph__parse_octopus_merge(void)
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_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_assert_equal_oid(&e.tree_oid, &id);
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/network/remote/rename.c b/tests/libgit2/network/remote/rename.c
index 1fd2affba..d4446b8aa 100644
--- a/tests/libgit2/network/remote/rename.c
+++ b/tests/libgit2/network/remote/rename.c
@@ -164,7 +164,7 @@ 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;
@@ -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/object/raw/compare.c b/tests/libgit2/object/raw/compare.c
index 56c016b72..9369bc21f 100644
--- a/tests/libgit2/object/raw/compare.c
+++ b/tests/libgit2/object/raw/compare.c
@@ -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));
/* 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);
}
@@ -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));
/* 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..ebf2bb8e4 100644
--- a/tests/libgit2/object/raw/convert.c
+++ b/tests/libgit2/object/raw/convert.c
@@ -7,7 +7,7 @@ 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;
@@ -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));
/* 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));
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/short.c b/tests/libgit2/object/raw/short.c
index cc2b5f62a..102526844 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);
}
@@ -38,9 +38,9 @@ static int insert_sequential_oids(
git_oid_fromraw(&oid, hashbuf);
- 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..ab6b1ffdf 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_SHA1_SIZE);
}
diff --git a/tests/libgit2/odb/backend/backend_helpers.c b/tests/libgit2/odb/backend/backend_helpers.c
index 542799242..c595e4744 100644
--- a/tests/libgit2/odb/backend/backend_helpers.c
+++ b/tests/libgit2/odb/backend/backend_helpers.c
@@ -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(
@@ -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);
diff --git a/tests/libgit2/odb/mixed.c b/tests/libgit2/odb/mixed.c
index 87e945c83..cbab8e362 100644
--- a/tests/libgit2/odb/mixed.c
+++ b/tests/libgit2/odb/mixed.c
@@ -21,10 +21,10 @@ void test_odb_mixed__dup_oid(void) {
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_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_odb_read_prefix(&obj, _odb, &oid, sizeof(short_hex) - 1));
@@ -192,7 +192,7 @@ static void assert_found_objects(git_odb_expand_id *ids)
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;
+ expected_len = GIT_OID_SHA1_HEXSIZE;
expected_type = expand_id_test_data[i].expected_type;
}
diff --git a/tests/libgit2/pack/midx.c b/tests/libgit2/pack/midx.c
index 9dd949363..2a5c5a328 100644
--- a/tests/libgit2/pack/midx.c
+++ b/tests/libgit2/pack/midx.c
@@ -20,7 +20,7 @@ void test_pack_midx__parse(void)
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_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),
@@ -40,7 +40,7 @@ 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_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/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/refs/reflog/reflog_helpers.c b/tests/libgit2/refs/reflog/reflog_helpers.c
index 2ea41ee06..f62d27edd 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));
}
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/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/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/revwalk/basic.c b/tests/libgit2/revwalk/basic.c
index 2c8d885e2..358f57716 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);
}*/
}