mirror of
https://github.com/git/git.git
synced 2026-06-30 19:58:12 +00:00
odb/source-loose: store pointer to "files" instead of generic source
The `struct odb_source_loose` holds a pointer to its owning parent source. The way that Git is currently structured, this parent is always the "files" source. In subsequent commits we're going to detangle that so that the "loose" source doesn't have any owning parent source at all so that it can be used as a completely standalone source. Detangling this mess is somewhat intricate though, and is made even more intricate because it's not always clear which kind of source one is holding at a specific point in time -- either the parent "files" source, or the child "loose" source. Make this relationship more explicit by storing a pointer to the "files" source instead of storing a pointer to a generic `struct odb_source`. This will help make subsequent steps a bit clearer. Note that this is a temporary step, only. At the end of this series we will have dropped the parent pointer completely. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
committed by
Junio C Hamano
parent
514f039c90
commit
1d451ba6fe
@@ -178,7 +178,7 @@ static int open_loose_object(struct odb_source_loose *loose,
|
||||
static struct strbuf buf = STRBUF_INIT;
|
||||
int fd;
|
||||
|
||||
*path = odb_loose_path(loose->source, &buf, oid);
|
||||
*path = odb_loose_path(&loose->files->base, &buf, oid);
|
||||
fd = git_open(*path);
|
||||
if (fd >= 0)
|
||||
return fd;
|
||||
@@ -189,7 +189,7 @@ static int open_loose_object(struct odb_source_loose *loose,
|
||||
static int quick_has_loose(struct odb_source_loose *loose,
|
||||
const struct object_id *oid)
|
||||
{
|
||||
return !!oidtree_contains(odb_source_loose_cache(loose->source, oid), oid);
|
||||
return !!oidtree_contains(odb_source_loose_cache(&loose->files->base, oid), oid);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user