summaryrefslogtreecommitdiff
path: root/src/libgit2/reflog.c
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@edwardthomson.com>2022-01-23 09:47:01 -0500
committerEdward Thomson <ethomson@edwardthomson.com>2022-06-20 17:05:29 -0400
commit3fbf580c91935ccdea25a135204419991f503b63 (patch)
tree53ec861796641faf8895a1f19444c1939ac6be9a /src/libgit2/reflog.c
parent61838295a055c8c7a4a7eb730538c6e08a38dd6a (diff)
downloadlibgit2-3fbf580c91935ccdea25a135204419991f503b63.tar.gz
oid: give oids a type
`git_oid`s now have a type, and we require the oid type when creating the object id from creation functions.
Diffstat (limited to 'src/libgit2/reflog.c')
-rw-r--r--src/libgit2/reflog.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/libgit2/reflog.c b/src/libgit2/reflog.c
index ca6d53808..1b03e83e7 100644
--- a/src/libgit2/reflog.c
+++ b/src/libgit2/reflog.c
@@ -104,7 +104,7 @@ int git_reflog_append(git_reflog *reflog, const git_oid *new_oid, const git_sign
previous = git_reflog_entry_byindex(reflog, 0);
if (previous == NULL)
- git_oid_fromstr(&entry->oid_old, GIT_OID_SHA1_HEXZERO);
+ git_oid_fromstr(&entry->oid_old, GIT_OID_SHA1_HEXZERO, GIT_OID_SHA1);
else
git_oid_cpy(&entry->oid_old, &previous->oid_cur);
@@ -218,8 +218,10 @@ int git_reflog_drop(git_reflog *reflog, size_t idx, int rewrite_previous_entry)
/* If the oldest entry has just been removed... */
if (idx == entrycount - 1) {
+ git_oid zero = GIT_OID_SHA1_ZERO;
+
/* ...clear the oid_old member of the "new" oldest entry */
- if (git_oid_fromstr(&entry->oid_old, GIT_OID_SHA1_HEXZERO) < 0)
+ if (git_oid_cpy(&entry->oid_old, &zero) < 0)
return -1;
return 0;