{"thread":{"id":"27330","subject":"[PATCH] Make the '%d' for log pretty format look the same as --decorate","startedAt":"2011-05-12T03:18:27Z","lastAt":"2011-05-12T03:18:27Z","messageCount":1,"participants":["Nathan W. Panike"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"167701","messageId":"4dcb540a.c2d5e70a.1a77.14aa@mx.google.com","threadId":"27330","inReplyTo":null,"subject":"[PATCH] Make the '%d' for log pretty format look the same as --decorate","fromName":"Nathan W. Panike","fromEmail":"nathan.panike@gmail.com","sentAt":"2011-05-12T03:18:27Z","receivedAt":"2011-05-12T03:18:27Z","isPatch":true,"sender":{"key":"nathan.panike@gmail.com","avatar":"https://avatars.githubusercontent.com/u/389447?v=4"},"body":"We teach git to add a \"tag: \" prefix to tag names when the '%d' pretty format\noption is given.  It is then the same format as the --decorate option given\ndirectly to log.\n---\n log-tree.c |    9 ---------\n log-tree.h |    9 +++++++++\n pretty.c   |    2 ++\n 3 files changed, 11 insertions(+), 9 deletions(-)\n\ndiff --git a/log-tree.c b/log-tree.c\nindex 2a1e3a9..9c24cbf 100644\n--- a/log-tree.c\n+++ b/log-tree.c\n@@ -11,15 +11,6 @@\n \n struct decoration name_decoration = { \"object names\" };\n \n-enum decoration_type {\n-\tDECORATION_NONE = 0,\n-\tDECORATION_REF_LOCAL,\n-\tDECORATION_REF_REMOTE,\n-\tDECORATION_REF_TAG,\n-\tDECORATION_REF_STASH,\n-\tDECORATION_REF_HEAD,\n-};\n-\n static char decoration_colors[][COLOR_MAXLEN] = {\n \tGIT_COLOR_RESET,\n \tGIT_COLOR_BOLD_GREEN,\t/* REF_LOCAL */\ndiff --git a/log-tree.h b/log-tree.h\nindex 5c4cf7c..29861f0 100644\n--- a/log-tree.h\n+++ b/log-tree.h\n@@ -3,6 +3,15 @@\n \n #include \"revision.h\"\n \n+enum decoration_type {\n+\tDECORATION_NONE = 0,\n+\tDECORATION_REF_LOCAL,\n+\tDECORATION_REF_REMOTE,\n+\tDECORATION_REF_TAG,\n+\tDECORATION_REF_STASH,\n+\tDECORATION_REF_HEAD,\n+};\n+\n struct log_info {\n \tstruct commit *commit, *parent;\n };\ndiff --git a/pretty.c b/pretty.c\nindex dff5c8d..8130556 100644\n--- a/pretty.c\n+++ b/pretty.c\n@@ -786,6 +786,8 @@ static void format_decoration(struct strbuf *sb, const struct commit *commit)\n \twhile (d) {\n \t\tstrbuf_addstr(sb, prefix);\n \t\tprefix = \", \";\n+\t\tif(d->type == DECORATION_REF_TAG)\n+\t\t\tstrbuf_addstr(sb, \"tag: \");\n \t\tstrbuf_addstr(sb, d->name);\n \t\td = d->next;\n \t}\n-- \n1.7.5.1\n"}]}