Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/libgit2.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlos Martín Nieto <cmn@dwim.me>2013-08-19 15:01:49 +0400
committerCarlos Martín Nieto <cmn@dwim.me>2013-10-02 08:53:24 +0400
commitb976f3c2c228413d124be8fea3280a44bd5e3136 (patch)
tree32e6712711c61a5d27bbed347901afc242bdc8dd /src/refdb.c
parent71e33d2649f990086237a6cd0fdb7f7d6f742b51 (diff)
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.
Diffstat (limited to 'src/refdb.c')
-rw-r--r--src/refdb.c16
1 files changed, 16 insertions, 0 deletions
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;
+}