object-store: move packed_git and packed_git_mru to object store
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] 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>
This commit is contained in:

committed by
Junio C Hamano

parent
97501e933a
commit
a80d72db2a
@ -7,7 +7,9 @@
|
||||
*/
|
||||
|
||||
#include "builtin.h"
|
||||
#include "repository.h"
|
||||
#include "packfile.h"
|
||||
#include "object-store.h"
|
||||
|
||||
#define BLKSIZE 512
|
||||
|
||||
@ -571,7 +573,7 @@ static struct pack_list * add_pack(struct packed_git *p)
|
||||
|
||||
static struct pack_list * add_pack_file(const char *filename)
|
||||
{
|
||||
struct packed_git *p = packed_git;
|
||||
struct packed_git *p = get_packed_git(the_repository);
|
||||
|
||||
if (strlen(filename) < 40)
|
||||
die("Bad pack filename: %s", filename);
|
||||
@ -586,7 +588,7 @@ static struct pack_list * add_pack_file(const char *filename)
|
||||
|
||||
static void load_all(void)
|
||||
{
|
||||
struct packed_git *p = packed_git;
|
||||
struct packed_git *p = get_packed_git(the_repository);
|
||||
|
||||
while (p) {
|
||||
add_pack(p);
|
||||
|
Reference in New Issue
Block a user