Jeff King <peff@xxxxxxxx> writes: > 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). Now, finally we start changing the behaviour. Is the reason why --left-right and --objects do not work well together because same trees and blobs can be shared between commits on both sides? > diff --git a/t/t6000-rev-list-misc.sh b/t/t6000-rev-list-misc.sh > index b8cf82349b..383f2c457d 100755 > --- a/t/t6000-rev-list-misc.sh > +++ b/t/t6000-rev-list-misc.sh > @@ -148,4 +148,16 @@ test_expect_success 'rev-list --end-of-options' ' > test_cmp expect actual > ' > > +test_expect_success 'rev-list --count' ' > + count=$(git rev-list --count HEAD) && > + git rev-list HEAD >actual && > + test_line_count = $count actual > +' > + > +test_expect_success 'rev-list --count --objects' ' > + count=$(git rev-list --count --objects HEAD) && > + git rev-list --objects HEAD >actual && > + test_line_count = $count actual > +' Makes sense to define --count as the same as number of objects shown and verify it.