With this patch, "git log --decorate --pretty=format:%d", shows the name decoration (i.e. whenever a commit matches a ref, that ref's name is shown). Signed-off-by: Johannes Schindelin <johannes.schindelin@xxxxxx> --- Maybe %d should expand to " (<name decoration>)" instead of "<name decoration>"? Documentation/pretty-formats.txt | 1 + pretty.c | 9 +++++++++ 2 files changed, 10 insertions(+), 0 deletions(-) diff --git a/Documentation/pretty-formats.txt b/Documentation/pretty-formats.txt index e8bea3e..9d8a8d4 100644 --- a/Documentation/pretty-formats.txt +++ b/Documentation/pretty-formats.txt @@ -117,6 +117,7 @@ The placeholders are: - '%e': encoding - '%s': subject - '%b': body +- '%d': decoration (needs --decorate) - '%Cred': switch color to red - '%Cgreen': switch color to green - '%Cblue': switch color to blue diff --git a/pretty.c b/pretty.c index 6c04176..37f7c3e 100644 --- a/pretty.c +++ b/pretty.c @@ -489,6 +489,15 @@ static size_t format_commit_item(struct strbuf *sb, const char *placeholder, return 3; } else return 0; + case 'd': + { + struct name_decoration *decoration = + lookup_decoration(&name_decoration, + &commit->object); + if (decoration) + strbuf_addstr(sb, decoration->name); + return 1; + } } /* these depend on the commit */ -- 1.5.5.rc0.208.g1d50 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html