summaryrefslogtreecommitdiff
path: root/object-store.h
diff options
context:
space:
mode:
authorStefan Beller <sbeller@google.com>2018-03-23 17:21:02 (GMT)
committerJunio C Hamano <gitster@pobox.com>2018-03-26 17:05:55 (GMT)
commit9a00580d0383fe60c70e966e66584e626ca3a846 (patch)
tree3baff3d5f186ea0134d4b25acea0b23a37a2bd72 /object-store.h
parent5508f69348ee1073666d3611a4a62ecdb0849e4e (diff)
downloadgit-9a00580d0383fe60c70e966e66584e626ca3a846.zip
git-9a00580d0383fe60c70e966e66584e626ca3a846.tar.gz
git-9a00580d0383fe60c70e966e66584e626ca3a846.tar.bz2
pack: move approximate object count to object store
The approximate_object_count() function maintains a rough count of objects in a repository to estimate how long object name abbreviates should be. Object names are scoped to a repository and the appropriate length may differ by repository, so the object count should not be global. Signed-off-by: Stefan Beller <sbeller@google.com> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'object-store.h')
-rw-r--r--object-store.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/object-store.h b/object-store.h
index 6a07a14..b53e125 100644
--- a/object-store.h
+++ b/object-store.h
@@ -100,6 +100,14 @@ struct raw_object_store {
struct list_head packed_git_mru;
/*
+ * A fast, rough count of the number of objects in the repository.
+ * These two fields are not meant for direct access. Use
+ * approximate_object_count() instead.
+ */
+ unsigned long approximate_object_count;
+ unsigned approximate_object_count_valid : 1;
+
+ /*
* Whether packed_git has already been populated with this repository's
* packs.
*/