summaryrefslogtreecommitdiff
path: root/packfile.c
diff options
context:
space:
mode:
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>2019-04-06 11:34:23 (GMT)
committerJunio C Hamano <gitster@pobox.com>2019-04-08 08:26:32 (GMT)
commit5038de19377ccc334c0ce3e1f206dddc20ac88c1 (patch)
treeeef5f36964f6ebe9f07760c89876f6cbc0d1bc4a /packfile.c
parentd2c4e6292a29b9c59a11aa342ea168d4accf0ac2 (diff)
downloadgit-5038de19377ccc334c0ce3e1f206dddc20ac88c1.zip
git-5038de19377ccc334c0ce3e1f206dddc20ac88c1.tar.gz
git-5038de19377ccc334c0ce3e1f206dddc20ac88c1.tar.bz2
packfile.c: add repo_approximate_object_count()
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 'packfile.c')
-rw-r--r--packfile.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/packfile.c b/packfile.c
index 16bcb75..2ad4fab 100644
--- a/packfile.c
+++ b/packfile.c
@@ -893,25 +893,25 @@ static void prepare_packed_git(struct repository *r);
* all unreachable objects about to be pruned, in which case they're not really
* interesting as a measure of repo size in the first place.
*/
-unsigned long approximate_object_count(void)
+unsigned long repo_approximate_object_count(struct repository *r)
{
- if (!the_repository->objects->approximate_object_count_valid) {
+ if (!r->objects->approximate_object_count_valid) {
unsigned long count;
struct multi_pack_index *m;
struct packed_git *p;
- prepare_packed_git(the_repository);
+ prepare_packed_git(r);
count = 0;
- for (m = get_multi_pack_index(the_repository); m; m = m->next)
+ for (m = get_multi_pack_index(r); m; m = m->next)
count += m->num_objects;
- for (p = the_repository->objects->packed_git; p; p = p->next) {
+ for (p = r->objects->packed_git; p; p = p->next) {
if (open_pack_index(p))
continue;
count += p->num_objects;
}
- the_repository->objects->approximate_object_count = count;
+ r->objects->approximate_object_count = count;
}
- return the_repository->objects->approximate_object_count;
+ return r->objects->approximate_object_count;
}
static void *get_next_packed_git(const void *p)