Merge branch 'jt/grep-wo-submodule-odb-as-alternate'
The code to make "git grep" recurse into submodules has been updated to migrate away from the "add submodule's object store as an alternate object store" mechanism (which is suboptimal). * jt/grep-wo-submodule-odb-as-alternate: t7814: show lack of alternate ODB-adding submodule-config: pass repo upon blob config read grep: add repository to OID grep sources grep: allocate subrepos on heap grep: read submodule entry with explicit repo grep: typesafe versions of grep_source_init grep: use submodule-ODB-as-alternate lazy-addition submodule: lazily add submodule ODBs as alternates
This commit is contained in:
20
config.c
20
config.c
@ -1796,6 +1796,7 @@ int git_config_from_mem(config_fn_t fn,
|
||||
|
||||
int git_config_from_blob_oid(config_fn_t fn,
|
||||
const char *name,
|
||||
struct repository *repo,
|
||||
const struct object_id *oid,
|
||||
void *data)
|
||||
{
|
||||
@ -1804,7 +1805,7 @@ int git_config_from_blob_oid(config_fn_t fn,
|
||||
unsigned long size;
|
||||
int ret;
|
||||
|
||||
buf = read_object_file(oid, &type, &size);
|
||||
buf = repo_read_object_file(repo, oid, &type, &size);
|
||||
if (!buf)
|
||||
return error(_("unable to load config blob object '%s'"), name);
|
||||
if (type != OBJ_BLOB) {
|
||||
@ -1820,14 +1821,15 @@ int git_config_from_blob_oid(config_fn_t fn,
|
||||
}
|
||||
|
||||
static int git_config_from_blob_ref(config_fn_t fn,
|
||||
struct repository *repo,
|
||||
const char *name,
|
||||
void *data)
|
||||
{
|
||||
struct object_id oid;
|
||||
|
||||
if (get_oid(name, &oid) < 0)
|
||||
if (repo_get_oid(repo, name, &oid) < 0)
|
||||
return error(_("unable to resolve config blob '%s'"), name);
|
||||
return git_config_from_blob_oid(fn, name, &oid, data);
|
||||
return git_config_from_blob_oid(fn, name, repo, &oid, data);
|
||||
}
|
||||
|
||||
char *git_system_config(void)
|
||||
@ -1958,12 +1960,16 @@ int config_with_options(config_fn_t fn, void *data,
|
||||
* If we have a specific filename, use it. Otherwise, follow the
|
||||
* regular lookup sequence.
|
||||
*/
|
||||
if (config_source && config_source->use_stdin)
|
||||
if (config_source && config_source->use_stdin) {
|
||||
return git_config_from_stdin(fn, data);
|
||||
else if (config_source && config_source->file)
|
||||
} else if (config_source && config_source->file) {
|
||||
return git_config_from_file(fn, config_source->file, data);
|
||||
else if (config_source && config_source->blob)
|
||||
return git_config_from_blob_ref(fn, config_source->blob, data);
|
||||
} else if (config_source && config_source->blob) {
|
||||
struct repository *repo = config_source->repo ?
|
||||
config_source->repo : the_repository;
|
||||
return git_config_from_blob_ref(fn, repo, config_source->blob,
|
||||
data);
|
||||
}
|
||||
|
||||
return do_git_config_sequence(opts, fn, data);
|
||||
}
|
||||
|
Reference in New Issue
Block a user