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

[PATCH 3/5] builtin-prune: separate ref walking from reflog walking.

From
Junio C Hamano <junkio@cox.net>
Date
Jan 6, 2007, 10:16 UTC
Message-ID
<7vzm8w5ukx.fsf@assigned-by-dhcp.cox.net>

This is necessary for the next step, because the reason I am making the connectivity walker into a library is because I want to use it for cleaning up stale reflog entries.

Signed-off-by: Junio C Hamano <junkio@cox.net>
---
 builtin-prune.c |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/builtin-prune.c b/builtin-prune.c
index 9522864..cd079b4 100644
--- a/builtin-prune.c
+++ b/builtin-prune.c
@@ -203,8 +203,12 @@ static int add_one_ref(const char *path, const unsigned char *sha1, int flag, vo
 		die("bad object ref: %s:%s", path, sha1_to_hex(sha1));
 	add_pending_object(revs, object, "");
 
-	for_each_reflog_ent(path, add_one_reflog_ent, cb_data);
+	return 0;
+}
 
+static int add_one_reflog(const char *path, const unsigned char *sha1, int flag, void *cb_data)
+{
+	for_each_reflog_ent(path, add_one_reflog_ent, cb_data);
 	return 0;
 }
 
@@ -267,12 +271,15 @@ int cmd_prune(int argc, const char **argv, const char *prefix)
 	revs.blob_objects = 1;
 	revs.tree_objects = 1;
 
-	/* Add all external refs, along with its reflog info */
+	/* Add all external refs */
 	for_each_ref(add_one_ref, &revs);
 
 	/* Add all refs from the index file */
 	add_cache_refs(&revs);
 
+	/* Add all reflog info from refs */
+	for_each_ref(add_one_reflog, &revs);
+
 	/*
 	 * Set up the revision walk - this will move all commits
 	 * from the pending list to the commit walking list.
-- 
1.5.0.rc0.ge0f6
Message 1 of 1 in “builtin-prune: separate ref walking from reflog walking.”
  1. 3/5 builtin-prune: separate ref walking from reflog walking.Junio C Hamano, Jan 6, 2007

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.