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

Re: Make "git log --count" work like "git rev-list"

From
Stefan Beller <sbeller@google.com>
Date
Jan 9, 2019, 17:21 UTC
Message-ID
<CAGZ79kaOcoVSRgTR+k9ENoDz6FHh27MzpZ9D-MeFArN2vgBK0w@mail.gmail.com>
In-Reply-To
<CAHk-=wg0NUNFjZumgC-9f=kmU3L4T+qOAgXwiDAfPaNtuFfvFg@mail.gmail.com>

On Sat, Jan 5, 2019 at 2:47 PM Linus Torvalds <torvalds@linux-foundation.org> wrote:

Show 28 quoted lines
>
> This is a ridiculous patch. And I understand entirely if nobody else
> cares, because I don't think anybody else has ever even noticed.
>
> It turns out that I still use "git rev-list" outside of some hard-core
> scripting for one silly reason: the linux-next statistics are all
> about non-merge commits, and so to do a rough comparison with
> linux-next, I do
>
>         git rev-list --count --no-merges v4.20..
>
> to get an approximate idea of how much I've merged compared to what is
> in linux-next.
>
> (See also
>
>         http://neuling.org/linux-next-size.html
>
> for the graphical view of it all, even though it looks a bit odd right
> now because of how linux-next wasn't being updated over the holidats
> and right at the 4.19 release).
>
> Anyway, I've occasionally thought to myself that I should just fix
> "git log" to learn that too, so that I wouldn't have to type out "git
> rev-list". Because "git log" does actually take the "--count"
> argument, it just doesn't honor it.
>
> This is that patch.
Sounds reasonable to me to have such functionality,
as I tend to use
  git log --oneline origin/master..origin/next --no-merges |wc -l
for such queries, which I always assume to be doing useless
work as I'd be interested in *only* the count, and not the
intermediate oneline output, but that is the best output
that wc works on.

So maybe the --count option would want to suppress other output if given (or we'd want to have another option for no output)?

Instead of printing, do we want to redirect to rev->diffopt.file, or send it through the diff codes buffer if we ever anticipate needing this output in buffered?

A test would be nice, too.
Stefan
Previous: Linus TorvaldsNext: Linus Torvalds
Message 2 of 7 in “Make "git log --count" work like "git rev-list"”
  1. Linus TorvaldsJan 5, 2019
  2. Stefan BellerJan 9, 2019
  3. Linus TorvaldsJan 9, 2019
  4. Jeff KingJan 9, 2019
  5. Stefan BellerJan 9, 2019
  6. Junio C HamanoJan 10, 2019
  7. Jeff KingJan 11, 2019

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.