mirror of
https://git.proxmox.com/git/libgit2
synced 2025-08-05 04:11:49 +00:00
reflog: add GIT_OID_HEX_ZERO constant
This commit is contained in:
parent
1cb157184b
commit
7c458e3aee
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user