summaryrefslogtreecommitdiff
path: root/packfile.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2019-01-04 21:33:32 (GMT)
committerJunio C Hamano <gitster@pobox.com>2019-01-04 21:33:32 (GMT)
commit3b2f8a02fa9a9e68d5215828e1d97bb4f6996976 (patch)
tree95480e645fe16f17fd9ccc43a893699476b60a63 /packfile.c
parent13d991929810ebfdf6b75d91cdc72561213d548a (diff)
parent7317aa7153c063a01750cda625e1a4580af89ef3 (diff)
downloadgit-3b2f8a02fa9a9e68d5215828e1d97bb4f6996976.zip
git-3b2f8a02fa9a9e68d5215828e1d97bb4f6996976.tar.gz
git-3b2f8a02fa9a9e68d5215828e1d97bb4f6996976.tar.bz2
Merge branch 'jk/loose-object-cache'
Code clean-up with optimization for the codepath that checks (non-)existence of loose objects. * jk/loose-object-cache: odb_load_loose_cache: fix strbuf leak fetch-pack: drop custom loose object cache sha1-file: use loose object cache for quick existence check object-store: provide helpers for loose_objects_cache sha1-file: use an object_directory for the main object dir handle alternates paths the same as the main object dir sha1_file_name(): overwrite buffer instead of appending rename "alternate_object_database" to "object_directory" submodule--helper: prefer strip_suffix() to ends_with() fsck: do not reuse child_process structs
Diffstat (limited to 'packfile.c')
-rw-r--r--packfile.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/packfile.c b/packfile.c
index d1e6683..8c6b47c 100644
--- a/packfile.c
+++ b/packfile.c
@@ -971,16 +971,16 @@ static void prepare_packed_git_mru(struct repository *r)
static void prepare_packed_git(struct repository *r)
{
- struct alternate_object_database *alt;
+ struct object_directory *odb;
if (r->objects->packed_git_initialized)
return;
- prepare_multi_pack_index_one(r, r->objects->objectdir, 1);
- prepare_packed_git_one(r, r->objects->objectdir, 1);
+
prepare_alt_odb(r);
- for (alt = r->objects->alt_odb_list; alt; alt = alt->next) {
- prepare_multi_pack_index_one(r, alt->path, 0);
- prepare_packed_git_one(r, alt->path, 0);
+ for (odb = r->objects->odb; odb; odb = odb->next) {
+ int local = (odb == r->objects->odb);
+ prepare_multi_pack_index_one(r, odb->path, local);
+ prepare_packed_git_one(r, odb->path, local);
}
rearrange_packed_git(r);
@@ -992,6 +992,14 @@ static void prepare_packed_git(struct repository *r)
void reprepare_packed_git(struct repository *r)
{
+ struct object_directory *odb;
+
+ for (odb = r->objects->odb; odb; odb = odb->next) {
+ oid_array_clear(&odb->loose_objects_cache);
+ memset(&odb->loose_objects_subdir_seen, 0,
+ sizeof(odb->loose_objects_subdir_seen));
+ }
+
r->objects->approximate_object_count_valid = 0;
r->objects->packed_git_initialized = 0;
prepare_packed_git(r);