All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Nathan W. Panike" <nathan.panike@gmail.com>
To: git@vger.kernel.org
Subject: [PATCH] Make the '%d' for log pretty format look the same as --decorate
Date: Wed, 11 May 2011 22:18:27 -0500	[thread overview]
Message-ID: <4dcb540a.c2d5e70a.1a77.14aa@mx.google.com> (raw)

We teach git to add a "tag: " prefix to tag names when the '%d' pretty format
option is given.  It is then the same format as the --decorate option given
directly to log.
---
 log-tree.c |    9 ---------
 log-tree.h |    9 +++++++++
 pretty.c   |    2 ++
 3 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/log-tree.c b/log-tree.c
index 2a1e3a9..9c24cbf 100644
--- a/log-tree.c
+++ b/log-tree.c
@@ -11,15 +11,6 @@
 
 struct decoration name_decoration = { "object names" };
 
-enum decoration_type {
-	DECORATION_NONE = 0,
-	DECORATION_REF_LOCAL,
-	DECORATION_REF_REMOTE,
-	DECORATION_REF_TAG,
-	DECORATION_REF_STASH,
-	DECORATION_REF_HEAD,
-};
-
 static char decoration_colors[][COLOR_MAXLEN] = {
 	GIT_COLOR_RESET,
 	GIT_COLOR_BOLD_GREEN,	/* REF_LOCAL */
diff --git a/log-tree.h b/log-tree.h
index 5c4cf7c..29861f0 100644
--- a/log-tree.h
+++ b/log-tree.h
@@ -3,6 +3,15 @@
 
 #include "revision.h"
 
+enum decoration_type {
+	DECORATION_NONE = 0,
+	DECORATION_REF_LOCAL,
+	DECORATION_REF_REMOTE,
+	DECORATION_REF_TAG,
+	DECORATION_REF_STASH,
+	DECORATION_REF_HEAD,
+};
+
 struct log_info {
 	struct commit *commit, *parent;
 };
diff --git a/pretty.c b/pretty.c
index dff5c8d..8130556 100644
--- a/pretty.c
+++ b/pretty.c
@@ -786,6 +786,8 @@ static void format_decoration(struct strbuf *sb, const struct commit *commit)
 	while (d) {
 		strbuf_addstr(sb, prefix);
 		prefix = ", ";
+		if(d->type == DECORATION_REF_TAG)
+			strbuf_addstr(sb, "tag: ");
 		strbuf_addstr(sb, d->name);
 		d = d->next;
 	}
-- 
1.7.5.1

                 reply	other threads:[~2011-05-12  3:29 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4dcb540a.c2d5e70a.1a77.14aa@mx.google.com \
    --to=nathan.panike@gmail.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.