git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH v7 10/11] files_log_ref_write: new function

From
Michael Haggerty <mhagger@alum.mit.edu>
Date
Nov 9, 2015, 17:03 UTC
Message-ID
<b017ec518536e9f21c2900b3821b40a8a3a8f375.1447085798.git.mhagger@alum.mit.edu>
In-Reply-To
<cover.1447085798.git.mhagger@alum.mit.edu>
From: David Turner <dturner@twopensource.com>

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 <dturner@twopensource.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
---
 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
Previous: Michael HaggertyNext: Michael Haggerty
Message 16 of 18 in “refs backend pre-vtable”
  1. 00/11 refs backend pre-vtableMichael Haggerty, Nov 9, 2015
  2. 01/11 refs: make is_branch publicMichael Haggerty, Nov 9, 2015
  3. Ramsay JonesNov 9, 2015
  4. David TurnerNov 9, 2015
  5. Michael HaggertyNov 10, 2015
  6. 02/11 verify_refname_available(): rename functionMichael Haggerty, Nov 9, 2015
  7. 03/11 verify_refname_available(): new functionMichael Haggerty, Nov 9, 2015
  8. 04/11 copy_msg(): rename to copy_reflog_msg()Michael Haggerty, Nov 9, 2015
  9. 05/11 pack_if_possible_fn(): use ref_type() instead of is_per_worktree_ref()Michael Haggerty, Nov 9, 2015
  10. 06/11 refname_is_safe(): improve docstringMichael Haggerty, Nov 9, 2015
  11. 07/11 refs/refs-internal.h: new header fileMichael Haggerty, Nov 9, 2015
  12. Ramsay JonesNov 9, 2015
  13. David TurnerNov 9, 2015
  14. Michael HaggertyNov 10, 2015
  15. 09/11 initdb: make safe_create_dir publicMichael Haggerty, Nov 9, 2015
  16. 10/11 files_log_ref_write: new functionMichael Haggerty, Nov 9, 2015
  17. 11/11 refs: break out ref conflict checksMichael Haggerty, Nov 9, 2015
  18. David TurnerNov 9, 2015

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.