Commit 7c458e3a by nulltoken

reflog: add GIT_OID_HEX_ZERO constant

parent 1cb15718
......@@ -258,7 +258,7 @@ int git_reflog_write(git_reference *ref, const git_oid *oid_old,
if (oid_old)
git_oid_tostr(old, sizeof(old), oid_old);
else
p_snprintf(old, sizeof(old), "%0*d", GIT_OID_HEXSZ, 0);
memmove(old, GIT_OID_HEX_ZERO, sizeof(old));
error = reflog_write(log_path.ptr, old, new, committer, msg);
......
......@@ -17,6 +17,8 @@
#define GIT_REFLOG_SIZE_MIN (2*GIT_OID_HEXSZ+2+17)
#define GIT_OID_HEX_ZERO "0000000000000000000000000000000000000000"
struct git_reflog_entry {
git_oid oid_old;
git_oid oid_cur;
......
......@@ -73,7 +73,7 @@ void test_refs_reflog_reflog__write_then_read(void)
entry = (git_reflog_entry *)git_vector_get(&reflog->entries, 0);
assert_signature(committer, entry->committer);
git_oid_tostr(oid_str, GIT_OID_HEXSZ+1, &entry->oid_old);
cl_assert_equal_s("0000000000000000000000000000000000000000", oid_str);
cl_assert_equal_s(GIT_OID_HEX_ZERO, oid_str);
git_oid_tostr(oid_str, GIT_OID_HEXSZ+1, &entry->oid_cur);
cl_assert_equal_s(current_master_tip, oid_str);
cl_assert(entry->msg == NULL);
......
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