Signed-off-by: Ronnie Sahlberg <[email protected]>
---
refs-be-files.c | 21 +++++++++++++++------
refs.c | 32 ++++++++++++++++++++++++++++++++
refs.h | 16 ++++++++++++++++
3 files changed, 63 insertions(+), 6 deletions(-)
diff --git a/refs-be-files.c b/refs-be-files.c
index 27eafd0..464d488 100644
--- a/refs-be-files.c
+++ b/refs-be-files.c
@@ -2251,7 +2251,7 @@ static int copy_msg(char *buf, const char *msg)
}
/* This function must set a meaningful errno on failure */
-int create_reflog(const char *refname)
+static int files_create_reflog(const char *refname)
{
int logfd, oflags = O_APPEND | O_WRONLY;
char logfile[PATH_MAX];
@@ -2516,7 +2516,7 @@ int create_symref(const char *ref_target, const char
*refs_heads_master,
return 0;
}
-int reflog_exists(const char *refname)
+static int files_reflog_exists(const char *refname)
{
struct stat st;
@@ -2524,7 +2524,7 @@ int reflog_exists(const char *refname)
S_ISREG(st.st_mode);
}
-int delete_reflog(const char *refname)
+static int files_delete_reflog(const char *refname)
{
return remove_path(git_path("logs/%s", refname));
}
@@ -2568,7 +2568,9 @@ static char *find_beginning_of_line(char *bob, char *scan)
return scan;
}
-int for_each_reflog_ent_reverse(const char *refname, each_reflog_ent_fn fn,
void *cb_data)
+static int files_for_each_reflog_ent_reverse(const char *refname,
+ each_reflog_ent_fn fn,
+ void *cb_data)
{
struct strbuf sb = STRBUF_INIT;
FILE *logfp;
@@ -2645,7 +2647,8 @@ int for_each_reflog_ent_reverse(const char *refname,
each_reflog_ent_fn fn, void
return ret;
}
-int for_each_reflog_ent(const char *refname, each_reflog_ent_fn fn, void
*cb_data)
+static int files_for_each_reflog_ent(const char *refname,
+ each_reflog_ent_fn fn, void *cb_data)
{
FILE *logfp;
struct strbuf sb = STRBUF_INIT;
@@ -2706,7 +2709,7 @@ static int do_for_each_reflog(struct strbuf *name,
each_ref_fn fn, void *cb_data
return retval;
}
-int for_each_reflog(each_ref_fn fn, void *cb_data)
+static int files_for_each_reflog(each_ref_fn fn, void *cb_data)
{
int retval;
struct strbuf name;
@@ -3295,6 +3298,12 @@ struct ref_be refs_files = {
files_transaction_update_reflog,
files_transaction_commit,
files_transaction_free,
+ files_for_each_reflog_ent,
+ files_for_each_reflog_ent_reverse,
+ files_for_each_reflog,
+ files_reflog_exists,
+ files_create_reflog,
+ files_delete_reflog,
};
struct ref_be *refs = &refs_files;
diff --git a/refs.c b/refs.c
index b8c942f..2db1a74 100644
--- a/refs.c
+++ b/refs.c
@@ -856,3 +856,35 @@ void transaction_free(struct ref_transaction *transaction)
{
return refs->transaction_free(transaction);
}
+
+int for_each_reflog_ent_reverse(const char *refname, each_reflog_ent_fn fn,
+ void *cb_data)
+{
+ return refs->for_each_reflog_ent_reverse(refname, fn, cb_data);
+}
+
+int for_each_reflog_ent(const char *refname, each_reflog_ent_fn fn,
+ void *cb_data)
+{
+ return refs->for_each_reflog_ent(refname, fn, cb_data);
+}
+
+int for_each_reflog(each_ref_fn fn, void *cb_data)
+{
+ return refs->for_each_reflog(fn, cb_data);
+}
+
+int reflog_exists(const char *refname)
+{
+ return refs->reflog_exists(refname);
+}
+
+int create_reflog(const char *refname)
+{
+ return refs->create_reflog(refname);
+}
+
+int delete_reflog(const char *refname)
+{
+ return refs->delete_reflog(refname);
+}
diff --git a/refs.h b/refs.h
index 4b669f5..0a68986 100644
--- a/refs.h
+++ b/refs.h
@@ -372,6 +372,16 @@ typedef int (*transaction_update_reflog_fn)(
typedef int (*transaction_commit_fn)(struct ref_transaction *transaction,
struct strbuf *err);
typedef void (*transaction_free_fn)(struct ref_transaction *transaction);
+typedef int (*for_each_reflog_ent_fn)(const char *refname,
+ each_reflog_ent_fn fn,
+ void *cb_data);
+typedef int (*for_each_reflog_ent_reverse_fn)(const char *refname,
+ each_reflog_ent_fn fn,
+ void *cb_data);
+typedef int (*for_each_reflog_fn)(each_ref_fn fn, void *cb_data);
+typedef int (*reflog_exists_fn)(const char *refname);
+typedef int (*create_reflog_fn)(const char *refname);
+typedef int (*delete_reflog_fn)(const char *refname);
struct ref_be {
transaction_begin_fn transaction_begin;
@@ -381,6 +391,12 @@ struct ref_be {
transaction_update_reflog_fn transaction_update_reflog;
transaction_commit_fn transaction_commit;
transaction_free_fn transaction_free;
+ for_each_reflog_ent_fn for_each_reflog_ent;
+ for_each_reflog_ent_reverse_fn for_each_reflog_ent_reverse;
+ for_each_reflog_fn for_each_reflog;
+ reflog_exists_fn reflog_exists;
+ create_reflog_fn create_reflog;
+ delete_reflog_fn delete_reflog;
};
extern struct ref_be *refs;
--
2.0.1.552.g1af257a
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html