Re: [PATCH 10/44] object-store: move packed_git and packed_git_mru to object store
From: Jonathan Tan <hidden>
Date: 2018-03-19 19:39:24
On Sat, 3 Mar 2018 18:36:03 +0700 Nguyễn Thái Ngọc Duy [off-list ref] wrote:
From: Stefan Beller <redacted> In a process with multiple repositories open, packfile accessors should be associated to a single repository and not shared globally. Move packed_git and packed_git_mru into the_repository and adjust callers to reflect this. [nd: while at there, wrap access to these two fields in get_packed_git() and get_packed_git_mru(). This allows us to lazily initialize these fields without caller doing that explicitly]
The patches up to this one look good. (I didn't reply for each individual one to avoid unnecessarily sending messages to the list.) About this patch: will lazily initializing these fields be done in a later patch?
Patch generated by
1. Moving the struct packed_git declaration to object-store.h
and packed_git, packed_git_mru globals to struct object_store.
2. Apply the following semantic patch to adjust callers:
@@ @@
- packed_git
+ the_repository->objects.packed_git
@@ @@
- packed_git_mru
+ the_repository->objects.packed_git_mruThis doesn't seem up-to-date - they are being replaced with a function call, not a field access. I would be OK with just removing this "Patch generated by" section. [snip remainder of "Patch generated by" section]
quoted hunk ↗ jump to hunk
@@ -246,7 +244,7 @@ static int unuse_one_window(struct packed_git *current) if (current) scan_windows(current, &lru_p, &lru_w, &lru_l); - for (p = packed_git; p; p = p->next) + for (p = the_repository->objects.packed_git; p; p = p->next) scan_windows(p, &lru_p, &lru_w, &lru_l); if (lru_p) { munmap(lru_w->base, lru_w->len);
Here (and elsewhere), "the_repository->objects.packed_git" instead of "get_packed_git" is still used.