Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2020-02-14 21:22:20 +0300
committerJunio C Hamano <gitster@pobox.com>2020-02-14 21:46:22 +0300
commit55cb10f9b5cd7216652a5879b792bcd7ac173035 (patch)
tree2b8cf0ac838c177bc8c16ecc596d0d03ef3936e4 /t/t6000-rev-list-misc.sh
parent792f8119986bd354eb4ea0858dfd45904120c257 (diff)
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 <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t6000-rev-list-misc.sh')
-rwxr-xr-xt/t6000-rev-list-misc.sh12
1 files changed, 12 insertions, 0 deletions
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
+'
+
test_done