mirror of
https://github.com/git/git.git
synced 2026-01-10 10:13:33 +00:00
sha1_file: allow prepare_alt_odb to handle arbitrary repositories
Signed-off-by: Stefan Beller <sbeller@google.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
77f012e876
commit
13068bf0a0
@@ -24,8 +24,7 @@ struct alternate_object_database {
|
|||||||
*/
|
*/
|
||||||
char path[FLEX_ARRAY];
|
char path[FLEX_ARRAY];
|
||||||
};
|
};
|
||||||
#define prepare_alt_odb(r) prepare_alt_odb_##r()
|
void prepare_alt_odb(struct repository *r);
|
||||||
void prepare_alt_odb_the_repository(void);
|
|
||||||
char *compute_alternate_path(const char *path, struct strbuf *err);
|
char *compute_alternate_path(const char *path, struct strbuf *err);
|
||||||
typedef int alt_odb_fn(struct alternate_object_database *, void *);
|
typedef int alt_odb_fn(struct alternate_object_database *, void *);
|
||||||
int foreach_alt_odb(alt_odb_fn, void*);
|
int foreach_alt_odb(alt_odb_fn, void*);
|
||||||
|
|||||||
13
sha1_file.c
13
sha1_file.c
@@ -673,18 +673,15 @@ int foreach_alt_odb(alt_odb_fn fn, void *cb)
|
|||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
void prepare_alt_odb_the_repository(void)
|
void prepare_alt_odb(struct repository *r)
|
||||||
{
|
{
|
||||||
if (the_repository->objects->alt_odb_tail)
|
if (r->objects->alt_odb_tail)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
the_repository->objects->alt_odb_tail =
|
r->objects->alt_odb_tail = &r->objects->alt_odb_list;
|
||||||
&the_repository->objects->alt_odb_list;
|
link_alt_odb_entries(r, r->objects->alternate_db, PATH_SEP, NULL, 0);
|
||||||
link_alt_odb_entries(the_repository,
|
|
||||||
the_repository->objects->alternate_db,
|
|
||||||
PATH_SEP, NULL, 0);
|
|
||||||
|
|
||||||
read_info_alternates(the_repository, get_object_directory(), 0);
|
read_info_alternates(r, r->objects->objectdir, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Returns 1 if we have successfully freshened the file, 0 otherwise. */
|
/* Returns 1 if we have successfully freshened the file, 0 otherwise. */
|
||||||
|
|||||||
Reference in New Issue
Block a user