diff options
Diffstat (limited to 'submodule-config.c')
-rw-r--r-- | submodule-config.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/submodule-config.c b/submodule-config.c index 388ef1f892..b431555db4 100644 --- a/submodule-config.c +++ b/submodule-config.c @@ -671,3 +671,20 @@ void submodule_free(struct repository *r) if (r->submodule_cache) submodule_cache_clear(r->submodule_cache); } + +/* + * 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); + } +} |