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

[PATCH] Support ref logs for refs/*

From
NMNeil Macneale <mac4-git@theory.org>
Date
Jan 8, 2009, 08:28 UTC
Message-ID
<20090108082827.GA6177@tesla.theory.org>

The documentation for git update-ref seems to imply that logging of ref updates should be done for anything in refs/, though the code looks like it restricts changes to heads and remotes. Any reason not so support arbitrary refs?

I don't see much point in logging for tags, so the patch ignores refs/tags.

Thanks, Neil

Signed-off-by: Neil Macneale <mac4-git@theory.org>
---
 refs.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/refs.c b/refs.c
index 33ced65..cfff22b 100644
--- a/refs.c
+++ b/refs.c
@@ -1154,9 +1154,9 @@ static int log_ref_write(const char *ref_name, const
unsigned char *old_sha1,
        git_snpath(log_file, sizeof(log_file), "logs/%s", ref_name);
 
        if (log_all_ref_updates &&
-           (!prefixcmp(ref_name, "refs/heads/") ||
-            !prefixcmp(ref_name, "refs/remotes/") ||
-            !strcmp(ref_name, "HEAD"))) {
+           (!prefixcmp(ref_name, "refs/") ||
+            !strcmp(ref_name, "HEAD")) &&
+           prefixcmp(ref_name, "refs/tags/")) {
                if (safe_create_leading_directories(log_file) < 0)
                        return error("unable to create directory for %s",
                                     log_file);
-- 
1.6.1.141.gfe98e.dirty
Next: Nanako Shiraishi
Message 1 of 3 in “Support ref logs for refs/*”
  1. Support ref logs for refs/*Neil Macneale, Jan 8, 2009
  2. Nanako ShiraishiJan 8, 2009
  3. mac4-git@theory.orgJan 8, 2009

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.