Merge branch 'ao/config-from-gitmodules'
Tighten the API to make it harder to misuse in-tree .gitmodules file, even though it shares the same syntax with configuration files, to read random configuration items from it. * ao/config-from-gitmodules: submodule-config: reuse config_from_gitmodules in repo_read_gitmodules submodule-config: pass repository as argument to config_from_gitmodules submodule-config: make 'config_from_gitmodules' private submodule-config: add helper to get 'update-clone' config from .gitmodules submodule-config: add helper function to get 'fetch' config from .gitmodules config: move config_from_gitmodules to submodule-config.c
This commit is contained in:
17
config.c
17
config.c
@ -2173,23 +2173,6 @@ int git_config_get_pathname(const char *key, const char **dest)
|
||||
return repo_config_get_pathname(the_repository, key, dest);
|
||||
}
|
||||
|
||||
/*
|
||||
* Note: This function exists solely to maintain backward compatibility with
|
||||
* 'fetch' and 'update_clone' storing configuration in '.gitmodules' and should
|
||||
* NOT be used anywhere else.
|
||||
*
|
||||
* Runs the provided config function on the '.gitmodules' file found in the
|
||||
* working directory.
|
||||
*/
|
||||
void config_from_gitmodules(config_fn_t fn, void *data)
|
||||
{
|
||||
if (the_repository->worktree) {
|
||||
char *file = repo_worktree_path(the_repository, GITMODULES_FILE);
|
||||
git_config_from_file(fn, file, data);
|
||||
free(file);
|
||||
}
|
||||
}
|
||||
|
||||
int git_config_get_expiry(const char *key, const char **output)
|
||||
{
|
||||
int ret = git_config_get_string_const(key, output);
|
||||
|
Reference in New Issue
Block a user