Re: [PATCH] Initialize notes trees if %N is used and no --show-notes given
- From
Jeff King <peff@peff.net>
- Date
- Apr 6, 2010, 05:32 UTC
- Message-ID
- <20100406053234.GC3901@coredump.intra.peff.net>
- In-Reply-To
- <20100405115548.GA19971@macbook.lan.lan>
On Mon, Apr 05, 2010 at 01:55:48PM +0200, Johannes Gilger wrote:
Show 15 quoted lines
> While this patch fixes this behaviour, I'm not sure it's at the right
> place or doesn't impact performance. So this is meant more as a
> bug-report.
> [...]
> --- a/notes.c
> +++ b/notes.c
> @@ -1183,6 +1183,8 @@ void format_display_notes(const unsigned char *object_sha1,
> struct strbuf *sb, const char *output_encoding, int flags)
> {
> int i;
> + if (!display_notes_trees)
> + init_display_notes(NULL);
> assert(display_notes_trees);
> for (i = 0; display_notes_trees[i]; i++)
> format_note(display_notes_trees[i], object_sha1, sb,I'm not sure if it is right to just pass NULL. We shouldn't have any extra_refs in our display_notes_opt, because we would have had to pass --show-notes to do so (at least from my brief reading of the code).
But shouldn't "git show --no-standard-notes --format=%N" pass a display_notes_opt with suppress_default_notes set?
I don't see it as all that likely (since without --show-notes, you wouldn't have _any_ notes, so why are you using %N?), but it seems to be the correct behavior, and might be useful for a script that uses '%N' in combination with user-provided options.
-Peff