[PATCH v7 10/11] files_log_ref_write: new function
From: Michael Haggerty <hidden>
Date: 2016-06-15 23:07:13
Subsystem:
the rest · Maintainer:
Linus Torvalds
From: David Turner <redacted> Because HEAD and stash are per-worktree, every refs backend needs to go through the files backend to write these refs. So create a new function, files_log_ref_write, and add it to refs/refs-internal.h. Later, we will use this to handle reflog updates for per-worktree symbolic refs (HEAD). Signed-off-by: David Turner <redacted> Signed-off-by: Junio C Hamano <redacted> Signed-off-by: Michael Haggerty <redacted> --- refs/files-backend.c | 8 ++++++++ refs/refs-internal.h | 4 ++++ 2 files changed, 12 insertions(+)
diff --git a/refs/files-backend.c b/refs/files-backend.c
index a2e5a56..1094348 100644
--- a/refs/files-backend.c
+++ b/refs/files-backend.c@@ -2735,6 +2735,14 @@ static int log_ref_write(const char *refname, const unsigned char *old_sha1, const unsigned char *new_sha1, const char *msg, int flags, struct strbuf *err) { + return files_log_ref_write(refname, old_sha1, new_sha1, msg, flags, + err); +} + +int files_log_ref_write(const char *refname, const unsigned char *old_sha1, + const unsigned char *new_sha1, const char *msg, + int flags, struct strbuf *err) +{ struct strbuf sb = STRBUF_INIT; int ret = log_ref_write_1(refname, old_sha1, new_sha1, msg, &sb, flags, err);
diff --git a/refs/refs-internal.h b/refs/refs-internal.h
index 8f5cfb4..88a5be0 100644
--- a/refs/refs-internal.h
+++ b/refs/refs-internal.h@@ -179,4 +179,8 @@ struct ref_transaction { enum ref_transaction_state state; }; +int files_log_ref_write(const char *refname, const unsigned char *old_sha1, + const unsigned char *new_sha1, const char *msg, + int flags, struct strbuf *err); + #endif /* REFS_REFS_INTERNAL_H */
--
2.6.2