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

[puzzled and solved] "shortlog" not quite understanding all "log" options

From
Junio C Hamano <gitster@pobox.com>
Date
May 30, 2014, 19:28 UTC
Message-ID
<xmqqzjhz83rk.fsf@gitster.dls.corp.google.com>

This gives the list of all recent commits but not the ones that are only reachable from the notes hierarchy:

$ git log --exclude=refs/notes/\* --all --no-merges --since=18.hours |
  git shortlog

and we are supposed to be able to write the same with shortlog itself, i.e.

$ git shortlog --exclude=refs/notes/\* --all --no-merges --since=18.hours
but this does not understand the ref exclusion command-line option.
A funny and puzzling thing is that this is understood:
$ git shortlog --all --no-merges --since=18.hours

What is strange is that --all, --no-merges, etc. and the ref exclusion option all are handled in revision.c and only one of them is being rejected.

.... Aaaand, it turns out that the answer is in the big comment at the beginning of handle_revision_pseudo_opt().

-- >8 --
Subject: shortlog: allow --exclude=<glob> to be passed

e7b432c5 (revision: introduce --exclude=<glob> to tame wildcards, 2013-08-30) taught a new option to the command-line parser of "log" and friends, but did not wire it fully so that it can also be used by "shortlog".

Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 revision.c | 1 +
 1 file changed, 1 insertion(+)
diff --git a/revision.c b/revision.c
index 71e2337..3818b46 100644
--- a/revision.c
+++ b/revision.c
@@ -1633,6 +1633,7 @@ static int handle_revision_opt(struct rev_info *revs, int argc, const char **arg
 	    !strcmp(arg, "--reflog") || !strcmp(arg, "--not") ||
 	    !strcmp(arg, "--no-walk") || !strcmp(arg, "--do-walk") ||
 	    !strcmp(arg, "--bisect") || starts_with(arg, "--glob=") ||
+	    starts_with(arg, "--exclude=") ||
 	    starts_with(arg, "--branches=") || starts_with(arg, "--tags=") ||
 	    starts_with(arg, "--remotes=") || starts_with(arg, "--no-walk="))
 	{
Next: Jeff King
Message 1 of 4 in “[puzzled and solved] "shortlog" not quite understanding all "log" options”
  1. Junio C HamanoMay 30, 2014
  2. Jeff KingMay 30, 2014
  3. Junio C HamanoMay 30, 2014
  4. Jeff KingJun 18, 2014

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.