summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2020-02-18 21:21:46 (GMT)
committerJunio C Hamano <gitster@pobox.com>2020-02-18 21:21:46 (GMT)
commit20a5fd881a98cfe153fa5a81754994c7046a6e41 (patch)
tree721d7a320f0cdfbd5937b87a6b824ac655f1c932
parent3ab3185f999f5d0d0079ac8246edb8fca5d9d3fd (diff)
downloadgit-20a5fd881a98cfe153fa5a81754994c7046a6e41.zip
git-20a5fd881a98cfe153fa5a81754994c7046a6e41.tar.gz
git-20a5fd881a98cfe153fa5a81754994c7046a6e41.tar.bz2
rev-list --count: comment on the use of count_right++
Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r--builtin/rev-list.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/builtin/rev-list.c b/builtin/rev-list.c
index 35e14ad..f520111 100644
--- a/builtin/rev-list.c
+++ b/builtin/rev-list.c
@@ -262,6 +262,13 @@ static void show_object(struct object *obj, const char *name, void *cb_data)
return;
if (revs->count) {
+ /*
+ * The object count is always accumulated in the .count_right
+ * field for traversal that is not a left-right traversal,
+ * and cmd_rev_list() made sure that a .count request that
+ * wants to count non-commit objects, which is handled by
+ * the show_object() callback, does not ask for .left_right.
+ */
revs->count_right++;
return;
}