summaryrefslogtreecommitdiff
path: root/src/reflog.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/reflog.c')
-rw-r--r--src/reflog.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/reflog.c b/src/reflog.c
index c10ae9fd4..923d5a32d 100644
--- a/src/reflog.c
+++ b/src/reflog.c
@@ -158,3 +158,22 @@ int git_reflog_drop(
db = reflog->db;
return db->backend->reflog_drop(db->backend, reflog, idx, rewrite_previous_entry);
}
+
+int git_reflog_append_to(git_repository *repo, const char *name, const git_oid *id,
+ const git_signature *committer, const char *msg)
+{
+ int error;
+ git_reflog *reflog;
+
+ if ((error = git_reflog_read(&reflog, repo, name)) < 0)
+ return error;
+
+ if ((error = git_reflog_append(reflog, id, committer, msg)) < 0)
+ goto cleanup;
+
+ error = git_reflog_write(reflog);
+
+cleanup:
+ git_reflog_free(reflog);
+ return error;
+}