summaryrefslogtreecommitdiff
path: root/builtin/rev-list.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2016-06-20 18:01:03 (GMT)
committerJunio C Hamano <gitster@pobox.com>2016-06-20 18:01:03 (GMT)
commit6d8c5454b6f29568cd4ed231160f82c9579fe1f2 (patch)
tree5c4b22af79f0fca61163396da277293b8519d3ec /builtin/rev-list.c
parent8699b74ae1190b90facdbe83a879251c8a9e07ac (diff)
parentfb85db84dcc36dcc3cdd5fc744280334bbe8eb47 (diff)
downloadgit-6d8c5454b6f29568cd4ed231160f82c9579fe1f2.zip
git-6d8c5454b6f29568cd4ed231160f82c9579fe1f2.tar.gz
git-6d8c5454b6f29568cd4ed231160f82c9579fe1f2.tar.bz2
Merge branch 'jk/rev-list-count-with-bitmap'
"git rev-list --count" whose walk-length is limited with "-n" option did not work well with the counting optimized to look at the bitmap index. * jk/rev-list-count-with-bitmap: rev-list: disable bitmaps when "-n" is used with listing objects rev-list: "adjust" results of "--count --use-bitmap-index -n"
Diffstat (limited to 'builtin/rev-list.c')
-rw-r--r--builtin/rev-list.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/builtin/rev-list.c b/builtin/rev-list.c
index 275da0d..b82bcc3 100644
--- a/builtin/rev-list.c
+++ b/builtin/rev-list.c
@@ -358,12 +358,16 @@ int cmd_rev_list(int argc, const char **argv, const char *prefix)
if (use_bitmap_index && !revs.prune) {
if (revs.count && !revs.left_right && !revs.cherry_mark) {
uint32_t commit_count;
+ int max_count = revs.max_count;
if (!prepare_bitmap_walk(&revs)) {
count_bitmap_commit_list(&commit_count, NULL, NULL, NULL);
+ if (max_count >= 0 && max_count < commit_count)
+ commit_count = max_count;
printf("%d\n", commit_count);
return 0;
}
- } else if (revs.tag_objects && revs.tree_objects && revs.blob_objects) {
+ } else if (revs.max_count < 0 &&
+ revs.tag_objects && revs.tree_objects && revs.blob_objects) {
if (!prepare_bitmap_walk(&revs)) {
traverse_bitmap_commit_list(&show_object_fast);
return 0;