From b976f3c2c228413d124be8fea3280a44bd5e3136 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mart=C3=ADn=20Nieto?= Date: Mon, 19 Aug 2013 13:01:49 +0200 Subject: reflog: move the reflog implementation into refdb_fs References and their logs are logically coupled, let's make it so in the code by moving the fs-based reflog implementation to live next to the fs-based refs one. As part of the change, make the function take names rather than references, as only the names are relevant when looking up and handling reflogs. --- src/refdb.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/refdb.c') diff --git a/src/refdb.c b/src/refdb.c index 7df61a577..adb58806e 100644 --- a/src/refdb.c +++ b/src/refdb.c @@ -16,6 +16,7 @@ #include "hash.h" #include "refdb.h" #include "refs.h" +#include "reflog.h" int git_refdb_new(git_refdb **out, git_repository *repo) { @@ -203,3 +204,18 @@ int git_refdb_delete(struct git_refdb *db, const char *ref_name) assert(db && db->backend); return db->backend->del(db->backend, ref_name); } + +int git_refdb_reflog_read(git_reflog **out, git_refdb *db, const char *name) +{ + int error; + + assert(db && db->backend); + + if ((error = db->backend->reflog_read(out, db->backend, name)) < 0) + return error; + + GIT_REFCOUNT_INC(db); + (*out)->db = db; + + return 0; +} -- cgit v1.2.1