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

Re: [PATCH] Teach the revision walker to walk by reflogs with --walk-reflogs

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Jan 11, 2007, 10:57 UTC
Message-ID
<Pine.LNX.4.63.0701111156510.22628@wbgn013.biozentrum.uni-wuerzburg.de>
In-Reply-To
<Pine.LNX.4.63.0701111147070.22628@wbgn013.biozentrum.uni-wuerzburg.de>
... and an --amend:
---
 reflog-walk.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/reflog-walk.c b/reflog-walk.c
index 658cba9..d4b49c7 100644
--- a/reflog-walk.c
+++ b/reflog-walk.c
@@ -203,14 +203,16 @@ void fake_reflog_parent(struct reflog_walk_info *info, struct commit *commit)
 
 	reflog = &commit_reflog->reflogs->items[commit_reflog->recno];
 	info->last_commit_reflog = commit_reflog;
+	commit_reflog->recno--;
 	commit_info->commit = (struct commit *)parse_object(reflog->osha1);
-	if (!commit_info->commit)
+	if (!commit_info->commit) {
+		commit->parents = NULL;
 		return;
+	}
 
 	commit->parents = xcalloc(sizeof(struct commit_list), 1);
 	commit->parents->item = commit_info->commit;
 	commit->object.flags &= ~(ADDED | SEEN | SHOWN);
-	commit_reflog->recno--;
 }
 
 void show_reflog_message(struct reflog_walk_info* info)
Previous: Johannes Schindelin
Message 2 of 2 in “Teach the revision walker to walk by reflogs with --walk-reflogs”
  1. Teach the revision walker to walk by reflogs with --walk-reflogsJohannes Schindelin, Jan 11, 2007
  2. Johannes SchindelinJan 11, 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.