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

[PATCH] git-log -g --pretty=oneline should display the reflog message

From
Nicolas Pitre <nico@cam.org>
Date
Jan 28, 2007, 03:40 UTC
Message-ID
<Pine.LNX.4.64.0701272235190.3021@xanadu.home>
In-Reply-To
<Pine.LNX.4.64.0701272049480.3021@xanadu.home>

In the context of reflog output the reflog message is more useful than the commit message's first line. When relevant the reflog message will contain that line anyway.

Signed-off-by: Nicolas Pitre <nico@cam.org>
---
On Sat, 27 Jan 2007, Nicolas Pitre wrote:
> The --pretty=oneline output when using -g should probably display the 
> reflog message instead of the commit message as well.
And this patch does just that.
diff --git a/log-tree.c b/log-tree.c
index c0fa096..d8ca36b 100644
--- a/log-tree.c
+++ b/log-tree.c
@@ -224,9 +224,14 @@ void show_log(struct rev_info *opt, const char *sep)
 		printf("%s",
 		       diff_get_color(opt->diffopt.color_diff, DIFF_RESET));
 		putchar(opt->commit_format == CMIT_FMT_ONELINE ? ' ' : '\n');
-		if (opt->reflog_info)
+		if (opt->reflog_info) {
 			show_reflog_message(opt->reflog_info,
 				    opt->commit_format == CMIT_FMT_ONELINE);;
+			if (opt->commit_format == CMIT_FMT_ONELINE) {
+				printf("%s", sep);
+				return;
+			}
+		}
 	}
 
 	/*
diff --git a/reflog-walk.c b/reflog-walk.c
index 8e2cd2f..8262160 100644
--- a/reflog-walk.c
+++ b/reflog-walk.c
@@ -233,7 +233,7 @@ void show_reflog_message(struct reflog_walk_info* info, int oneline)
 			else
 				printf("%d", commit_reflog->reflogs->nr
 				       - 2 - commit_reflog->recno);
-			printf("}: ");
+			printf("}: %s", info->message);
 		}
 		else {
 			printf("Reflog: %s@{", commit_reflog->reflogs->ref);
Previous: Nicolas PitreNext: Junio C Hamano
Message 5 of 7 in “What's cooking in git.git (topics)”
  1. Junio C HamanoJan 27, 2007
  2. Nicolas PitreJan 27, 2007
  3. Junio C HamanoJan 27, 2007
  4. Nicolas PitreJan 28, 2007
  5. git-log -g --pretty=oneline should display the reflog messageNicolas Pitre, Jan 28, 2007
  6. Junio C HamanoJan 28, 2007
  7. Nicolas PitreJan 29, 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.