зеркало из https://github.com/microsoft/git.git
commit: allow prepare_commit_graft to handle arbitrary repositories
Move the global variable 'commit_graft_prepared' into the object pool and convert the function prepare_commit_graft to work an arbitrary repositories. Signed-off-by: Stefan Beller <sbeller@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Родитель
eee4502baa
Коммит
2f6c767fd4
14
commit.c
14
commit.c
|
@ -196,19 +196,17 @@ static int read_graft_file(struct repository *r, const char *graft_file)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define prepare_commit_graft(r) prepare_commit_graft_##r()
|
static void prepare_commit_graft(struct repository *r)
|
||||||
static void prepare_commit_graft_the_repository(void)
|
|
||||||
{
|
{
|
||||||
static int commit_graft_prepared;
|
|
||||||
char *graft_file;
|
char *graft_file;
|
||||||
|
|
||||||
if (commit_graft_prepared)
|
if (r->parsed_objects->commit_graft_prepared)
|
||||||
return;
|
return;
|
||||||
graft_file = get_graft_file(the_repository);
|
graft_file = get_graft_file(r);
|
||||||
read_graft_file(the_repository, graft_file);
|
read_graft_file(r, graft_file);
|
||||||
/* make sure shallows are read */
|
/* make sure shallows are read */
|
||||||
is_repository_shallow(the_repository);
|
is_repository_shallow(r);
|
||||||
commit_graft_prepared = 1;
|
r->parsed_objects->commit_graft_prepared = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct commit_graft *lookup_commit_graft_the_repository(const struct object_id *oid)
|
struct commit_graft *lookup_commit_graft_the_repository(const struct object_id *oid)
|
||||||
|
|
2
object.h
2
object.h
|
@ -20,6 +20,8 @@ struct parsed_object_pool {
|
||||||
int is_shallow;
|
int is_shallow;
|
||||||
struct stat_validity *shallow_stat;
|
struct stat_validity *shallow_stat;
|
||||||
char *alternate_shallow_file;
|
char *alternate_shallow_file;
|
||||||
|
|
||||||
|
int commit_graft_prepared;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct parsed_object_pool *parsed_object_pool_new(void);
|
struct parsed_object_pool *parsed_object_pool_new(void);
|
||||||
|
|
Загрузка…
Ссылка в новой задаче