Skip to content

Commit 2aea7a5

Browse files
peffgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 552a736 commit 2aea7a5

File tree

4 files changed

+9
-0
lines changed

4 files changed

+9
-0
lines changed

Documentation/pretty-formats.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,9 @@ The placeholders are:
139139
- '%f': sanitized subject line, suitable for a filename
140140
- '%b': body
141141
- '%B': raw body (unwrapped subject and body)
142+
ifndef::git-rev-list[]
142143
- '%N': commit notes
144+
endif::git-rev-list[]
143145
- '%GG': raw verification message from GPG for a signed commit
144146
- '%G?': show "G" for a Good signature, "B" for a Bad signature, "U" for a good,
145147
untrusted signature and "N" for no signature

Documentation/pretty-options.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ people using 80-column terminals.
4242
verbatim; this means that invalid sequences in the original
4343
commit may be copied to the output.
4444

45+
ifndef::git-rev-list[]
4546
--notes[=<ref>]::
4647
Show the notes (see linkgit:git-notes[1]) that annotate the
4748
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
7374
--[no-]standard-notes::
7475
These options are deprecated. Use the above --notes/--no-notes
7576
options instead.
77+
endif::git-rev-list[]
7678

7779
--show-signature::
7880
Check the validity of a signed commit object by passing the signature

Documentation/rev-list-options.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,11 @@ endif::git-rev-list[]
5858
more than one `--grep=<pattern>`, commits whose message
5959
matches any of the given patterns are chosen (but see
6060
`--all-match`).
61+
ifndef::git-rev-list[]
6162
+
6263
When `--show-notes` is in effect, the message from the notes is
6364
matched as if it were part of the log message.
65+
endif::git-rev-list[]
6466

6567
--all-match::
6668
Limit the commits output to ones that match all given `--grep`,

builtin/rev-list.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -350,6 +350,9 @@ int cmd_rev_list(int argc, const char **argv, const char *prefix)
350350
revs.diff)
351351
usage(rev_list_usage);
352352

353+
if (revs.show_notes)
354+
die(_("rev-list does not support display of notes"));
355+
353356
save_commit_buffer = (revs.verbose_header ||
354357
revs.grep_filter.pattern_list ||
355358
revs.grep_filter.header_list);

0 commit comments

Comments
 (0)