rev-list: make --count work with --objects
authorJeff King <redacted>
Fri, 14 Feb 2020 18:22:20 +0000 (13:22 -0500)
committerJunio C Hamano <redacted>
Fri, 14 Feb 2020 18:46:22 +0000 (10:46 -0800)
commit55cb10f9b5cd7216652a5879b792bcd7ac173035
tree2b8cf0ac838c177bc8c16ecc596d0d03ef3936e4
parent792f8119986bd354eb4ea0858dfd45904120c257
rev-list: make --count work with --objects

The current behavior from "rev-list --count --objects" is nonsensical:
we enumerate all of the objects except commits, but then give a count of
commits. This wasn't planned, and is just what the code happens to do.

Instead, let's give the answer the user almost certainly wanted: the
full count of objects.

Note that there are more complicated cases around cherry-marking, etc.
We'll punt on those for now, but let the user know that we can't produce
an answer (rather than giving them something useless).

We'll test both the new feature as well as a vanilla --count of commits,
since that surprisingly doesn't seem to be covered in the existing
tests.

Signed-off-by: Jeff King <redacted>
Signed-off-by: Junio C Hamano <redacted>
builtin/rev-list.c
t/t6000-rev-list-misc.sh
git clone https://git.99rst.org/PROJECT