Re: [PATCHv3 1/8] Introduce commit notes
From: Johannes Schindelin <hidden>
Date: 2016-06-15 22:47:07
Subsystem:
documentation, the rest · Maintainers:
Jonathan Corbet, Linus Torvalds
Hi, On Thu, 30 Jul 2009, Johan Herland wrote:
On Wednesday 29 July 2009, Johannes Schindelin wrote:quoted
On Wed, 29 Jul 2009, Alex Riesen wrote:quoted
On Wed, Jul 29, 2009 at 04:25, Johan Herland[off-list ref] wrote:quoted
@@ -963,5 +964,9 @@ void pretty_print_commit(enum cmit_fmt fmt, conststruct commit *commit, + + if (fmt != CMIT_FMT_ONELINE) + get_commit_notes(commit, sb, encoding); +Someday we will need a way to switch off the display of notes without resolving to oneline format. Is there a notes specifier for the printf-like log message formatting (--pretty=format: or --format) planned, BTW?That would probably be something like "GIT_NOTES_REF=nyanyanya git log"?Yes, that works, although I suspect some users will prefer a command-line argument instead. Nonetheless, I think it makes sense to add a notes specifier to be used in --pretty/--format. I'll try to remember to look into this later, but I'll be grateful if someone gets to it before me.
Probably you will not want to show the "\nNotes:" prefix, and also not indent the string, but that is something you could make conditional upon a flag to get_commit_notes(). But this should get you started: -- snipsnap --
diff --git a/Documentation/pretty-formats.txt b/Documentation/pretty-formats.txt
index 2a845b1..5fb10b3 100644
--- a/Documentation/pretty-formats.txt
+++ b/Documentation/pretty-formats.txt@@ -123,6 +123,7 @@ The placeholders are: - '%s': subject - '%f': sanitized subject line, suitable for a filename - '%b': body +- '%N': commit notes - '%Cred': switch color to red - '%Cgreen': switch color to green - '%Cblue': switch color to blue
diff --git a/pretty.c b/pretty.c
index fee6789..7349697 100644
--- a/pretty.c
+++ b/pretty.c@@ -690,6 +690,10 @@ static size_t format_commit_item(struct strbuf *sb, const char *placeholder, case 'd': format_decoration(sb, commit); return 1; + case 'N': + get_commit_notes(commit, sb, git_log_output_encoding ? + git_log_output_encoding : git_commit_encoding); + return 1; } /* For the rest we have to parse the commit header. */