git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] rev-list: make it obvious that we do not support notes

From
Jeff King <peff@peff.net>
Date
Aug 23, 2015, 17:56 UTC
Message-ID
<20150823175640.GB24735@sigill.intra.peff.net>
In-Reply-To
<20150823174309.GA24735@sigill.intra.peff.net>
On Sun, Aug 23, 2015 at 01:43:09PM -0400, Jeff King wrote:
Show 6 quoted lines
> I don't know how deeply anybody _cares_ about showing notes via
> rev-list. It has clearly never worked. But rather than silently
> accepting --show-notes (and not showing any notes!), perhaps we should
> tell the user that it does not work. Likewise, the "%N" --format
> specifier never expands in rev-list, and should probably be removed from
> the rev-list documentation.

I think that would look like this. IMHO this is a strict improvement on the current state. I would be happier still if somebody wanted to plumb the notes options through for rev-list, but I am not personally interested in spending the time on that.

-- >8 --
Subject: rev-list: make it obvious that we do not support notes

The rev-list command does not have the internal infrastructure to display notes. Running:

  git rev-list --notes HEAD
will silently ignore the "--notes" option. Running:
  git rev-list --notes --grep=. HEAD
will crash on an assert. Running:
  git rev-list --format=%N HEAD

will place a literal "%N" in the output (it does not even expand to an empty string).

Let's have rev-list tell the user that it cannot fill the user's request, rather than silently producing wrong data. Likewise, let's remove mention of the notes options from the rev-list documentation.

Signed-off-by: Jeff King <peff@peff.net>
---
 Documentation/pretty-formats.txt   | 2 ++
 Documentation/pretty-options.txt   | 2 ++
 Documentation/rev-list-options.txt | 2 ++
 builtin/rev-list.c                 | 3 +++
 4 files changed, 9 insertions(+)
diff --git a/Documentation/pretty-formats.txt b/Documentation/pretty-formats.txt
index dc865cb..671cebd 100644
--- a/Documentation/pretty-formats.txt
+++ b/Documentation/pretty-formats.txt
@@ -139,7 +139,9 @@ The placeholders are:
 - '%f': sanitized subject line, suitable for a filename
 - '%b': body
 - '%B': raw body (unwrapped subject and body)
+ifndef::git-rev-list[]
 - '%N': commit notes
+endif::git-rev-list[]
 - '%GG': raw verification message from GPG for a signed commit
 - '%G?': show "G" for a Good signature, "B" for a Bad signature, "U" for a good,
   untrusted signature and "N" for no signature
diff --git a/Documentation/pretty-options.txt b/Documentation/pretty-options.txt
index 642af6e..8d6c5ce 100644
--- a/Documentation/pretty-options.txt
+++ b/Documentation/pretty-options.txt
@@ -42,6 +42,7 @@ people using 80-column terminals.
 	verbatim; this means that invalid sequences in the original
 	commit may be copied to the output.
 
+ifndef::git-rev-list[]
 --notes[=<ref>]::
 	Show the notes (see linkgit:git-notes[1]) that annotate the
 	commit, when showing the commit log message.  This is the default
@@ -73,6 +74,7 @@ being displayed. Examples: "--notes=foo" will show only notes from
 --[no-]standard-notes::
 	These options are deprecated. Use the above --notes/--no-notes
 	options instead.
+endif::git-rev-list[]
 
 --show-signature::
 	Check the validity of a signed commit object by passing the signature
diff --git a/Documentation/rev-list-options.txt b/Documentation/rev-list-options.txt
index a9b808f..f1c5220 100644
--- a/Documentation/rev-list-options.txt
+++ b/Documentation/rev-list-options.txt
@@ -58,9 +58,11 @@ endif::git-rev-list[]
 	more than one `--grep=<pattern>`, commits whose message
 	matches any of the given patterns are chosen (but see
 	`--all-match`).
+ifndef::git-rev-list[]
 +
 When `--show-notes` is in effect, the message from the notes is
 matched as if it were part of the log message.
+endif::git-rev-list[]
 
 --all-match::
 	Limit the commits output to ones that match all given `--grep`,
diff --git a/builtin/rev-list.c b/builtin/rev-list.c
index c0b4b53..d80d1ed 100644
--- a/builtin/rev-list.c
+++ b/builtin/rev-list.c
@@ -350,6 +350,9 @@ int cmd_rev_list(int argc, const char **argv, const char *prefix)
 	    revs.diff)
 		usage(rev_list_usage);
 
+	if (revs.show_notes)
+		die(_("rev-list does not support display of notes"));
+
 	save_commit_buffer = (revs.verbose_header ||
 			      revs.grep_filter.pattern_list ||
 			      revs.grep_filter.header_list);
-- 
2.5.0.685.g0ca4974
Previous: Jeff KingNext: Johannes Schindelin
Message 4 of 7 in “Fix `git rev-list --show-notes HEAD` when there are no notes”
  1. Fix `git rev-list --show-notes HEAD` when there are no notesJohannes Schindelin, Aug 22, 2015
  2. Johan HerlandAug 22, 2015
  3. Jeff KingAug 23, 2015
  4. rev-list: make it obvious that we do not support notesJeff King, Aug 23, 2015
  5. Johannes SchindelinAug 24, 2015
  6. Jeff KingAug 24, 2015
  7. Johannes SchindelinAug 24, 2015

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.