Merge branch 'nd/sha1-name-c-wo-the-repository'
Further code clean-up to allow the lowest level of name-to-object mapping layer to work with a passed-in repository other than the default one. * nd/sha1-name-c-wo-the-repository: (34 commits) sha1-name.c: remove the_repo from get_oid_mb() sha1-name.c: remove the_repo from other get_oid_* sha1-name.c: remove the_repo from maybe_die_on_misspelt_object_name submodule-config.c: use repo_get_oid for reading .gitmodules sha1-name.c: add repo_get_oid() sha1-name.c: remove the_repo from get_oid_with_context_1() sha1-name.c: remove the_repo from resolve_relative_path() sha1-name.c: remove the_repo from diagnose_invalid_index_path() sha1-name.c: remove the_repo from handle_one_ref() sha1-name.c: remove the_repo from get_oid_1() sha1-name.c: remove the_repo from get_oid_basic() sha1-name.c: remove the_repo from get_describe_name() sha1-name.c: remove the_repo from get_oid_oneline() sha1-name.c: add repo_interpret_branch_name() sha1-name.c: remove the_repo from interpret_branch_mark() sha1-name.c: remove the_repo from interpret_nth_prior_checkout() sha1-name.c: remove the_repo from get_short_oid() sha1-name.c: add repo_for_each_abbrev() sha1-name.c: store and use repo in struct disambiguate_state sha1-name.c: add repo_find_unique_abbrev_r() ...
This commit is contained in:
14
packfile.c
14
packfile.c
@ -903,25 +903,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)
|
||||
|
Reference in New Issue
Block a user