git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] '%S' option for pretty printing to support --source
@ 2009-03-05  7:18 Petri Hodju
  2009-03-05  9:17 ` Jeff King
  0 siblings, 1 reply; 5+ messages in thread
From: Petri Hodju @ 2009-03-05  7:18 UTC (permalink / raw)
  To: git, gitster

From 79f817e25aada377ccb40ebf76c29af7f21e1ec4 Mon Sep 17 00:00:00 2001
From: Petri Hodju <petrihodju@yahoo.com>
Date: Thu, 5 Mar 2009 09:00:39 +0200
Subject: [PATCH] '%S' option for pretty printing to support --source
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit

Print out the ref name by which each commit was reached. Works only when --source option is used

Examples:

git-log --graph --pretty=format:"%h(%S) — %s (%cr)" --abbrev-commit --date=relative --source

Show ref by which each commit is reachable in current branch

git-log --graph --pretty=format:"%h(%S) — %s (%cr)" --abbrev-commit --date=relative --source --all

Show ref by which each commit is reachable globally

Signed-off-by: Petri Hodju <petrihodju@yahoo.com>
---
 pretty.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/pretty.c b/pretty.c
index 6cd9149..cf05b37 100644
--- a/pretty.c
+++ b/pretty.c
@@ -544,6 +544,12 @@ static void format_decoration(struct strbuf *sb, const struct commit *commit)
 		strbuf_addch(sb, ')');
 }
 
+static void format_source(struct strbuf *sb, const struct commit *commit)
+{
+    if (commit->util)
+	strbuf_addstr(sb, (char *) commit->util);
+}
+
 static size_t format_commit_item(struct strbuf *sb, const char *placeholder,
                                void *context)
 {
@@ -650,6 +656,9 @@ static size_t format_commit_item(struct strbuf *sb, const char *placeholder,
 	case 'd':
 		format_decoration(sb, commit);
 		return 1;
+	case 'S':
+		format_source(sb, commit);
+		return 1;
 	}
 
 	/* For the rest we have to parse the commit header. */
-- 
1.6.2.rc2.22.g1d035.dirty

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2009-03-06  5:28 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-03-05  7:18 [PATCH] '%S' option for pretty printing to support --source Petri Hodju
2009-03-05  9:17 ` Jeff King
2009-03-05 10:59   ` Johannes Schindelin
2009-03-05 19:41   ` Deskin Miller
2009-03-06  5:25     ` Jeff King

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).