Merge branch 'jt/no-abuse-alternate-odb-for-submodules'
Follow through the work to use the repo interface to access
submodule objects in-process, instead of abusing the alternate
object database interface.
* jt/no-abuse-alternate-odb-for-submodules:
submodule: trace adding submodule ODB as alternate
submodule: pass repo to check_has_commit()
object-file: only register submodule ODB if needed
merge-{ort,recursive}: remove add_submodule_odb()
refs: peeling non-the_repository iterators is BUG
refs: teach arbitrary repo support to iterators
refs: plumb repo into ref stores
This commit is contained in:
18
submodule.c
18
submodule.c
@ -201,6 +201,8 @@ int register_all_submodule_odb_as_alternates(void)
|
||||
add_to_alternates_memory(added_submodule_odb_paths.items[i].string);
|
||||
if (ret) {
|
||||
string_list_clear(&added_submodule_odb_paths, 0);
|
||||
trace2_data_intmax("submodule", the_repository,
|
||||
"register_all_submodule_odb_as_alternates/registered", ret);
|
||||
if (git_env_bool("GIT_TEST_FATAL_REGISTER_SUBMODULE_ODB", 0))
|
||||
BUG("register_all_submodule_odb_as_alternates() called");
|
||||
}
|
||||
@ -928,23 +930,33 @@ struct has_commit_data {
|
||||
static int check_has_commit(const struct object_id *oid, void *data)
|
||||
{
|
||||
struct has_commit_data *cb = data;
|
||||
struct repository subrepo;
|
||||
enum object_type type;
|
||||
|
||||
enum object_type type = oid_object_info(cb->repo, oid, NULL);
|
||||
if (repo_submodule_init(&subrepo, cb->repo, cb->path, null_oid())) {
|
||||
cb->result = 0;
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
type = oid_object_info(&subrepo, oid, NULL);
|
||||
|
||||
switch (type) {
|
||||
case OBJ_COMMIT:
|
||||
return 0;
|
||||
goto cleanup;
|
||||
case OBJ_BAD:
|
||||
/*
|
||||
* Object is missing or invalid. If invalid, an error message
|
||||
* has already been printed.
|
||||
*/
|
||||
cb->result = 0;
|
||||
return 0;
|
||||
goto cleanup;
|
||||
default:
|
||||
die(_("submodule entry '%s' (%s) is a %s, not a commit"),
|
||||
cb->path, oid_to_hex(oid), type_name(type));
|
||||
}
|
||||
cleanup:
|
||||
repo_clear(&subrepo);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int submodule_has_commits(struct repository *r,
|
||||
|
||||
Reference in New Issue
Block a user