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

[RFC PATCH 3/4] Attach reflog to commit prior to pretty-printing

From
Deskin Miller <deskinm@umich.edu>
Date
Feb 26, 2009, 04:44 UTC
Message-ID
<72f44a4e928e675ad11c6764c3231b0e150cd115.1235622145.git.deskinm@umich.edu>
In-Reply-To
<cover.1235622145.git.deskinm@umich.edu>

Use attach_reflog_info just prior to pretty-printing the commit, so the reflog info may be printed if desired.

Signed-off-by: Deskin Miller <deskinm@umich.edu>
---
 list-objects.c |    3 +++
 log-tree.c     |    3 +++
 2 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/list-objects.c b/list-objects.c
index c8b8375..fd9d23e 100644
--- a/list-objects.c
+++ b/list-objects.c
@@ -5,6 +5,7 @@
 #include "blob.h"
 #include "diff.h"
 #include "tree-walk.h"
+#include "reflog-walk.h"
 #include "revision.h"
 #include "list-objects.h"
 
@@ -146,6 +147,8 @@ void traverse_commit_list(struct rev_info *revs,
 
 	while ((commit = get_revision(revs)) != NULL) {
 		process_tree(revs, commit->tree, &objects, NULL, "");
+		if (revs->reflog_info)
+			attach_reflog_info(revs->reflog_info, commit);
 		show_commit(commit);
 	}
 	for (i = 0; i < revs->pending.nr; i++) {
diff --git a/log-tree.c b/log-tree.c
index 84a74e5..5ccca0e 100644
--- a/log-tree.c
+++ b/log-tree.c
@@ -387,6 +387,9 @@ void show_log(struct rev_info *opt)
 	 */
 	if (need_8bit_cte >= 0)
 		need_8bit_cte = has_non_ascii(opt->add_signoff);
+	if (opt->reflog_info) {
+		attach_reflog_info(opt->reflog_info, commit);
+	}
 	pretty_print_commit(opt->commit_format, commit, &msgbuf,
 			    abbrev, subject, extra_headers, opt->date_mode,
 			    need_8bit_cte);
-- 
1.6.2.rc0.90.g0753
Previous: Deskin MillerNext: Deskin Miller
Message 4 of 7 in “git log -g --pretty=format: learns about reflog”
  1. 0/4 git log -g --pretty=format: learns about reflogDeskin Miller, Feb 26, 2009
  2. 1/4 Expose reflog_info struct in headerDeskin Miller, Feb 26, 2009
  3. 2/4 Add attach_reflog_infoDeskin Miller, Feb 26, 2009
  4. 3/4 Attach reflog to commit prior to pretty-printingDeskin Miller, Feb 26, 2009
  5. 4/4 Teach pretty-printer new reflog format codesDeskin Miller, Feb 26, 2009
  6. Johannes SchindelinFeb 26, 2009
  7. Jeff KingFeb 26, 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.