]> git.ipfire.org Git - thirdparty/git.git/commit - submodule-config.c
submodule-config: lazy-load a repository's .gitmodules file
authorBrandon Williams <bmwill@google.com>
Thu, 3 Aug 2017 18:19:58 +0000 (11:19 -0700)
committerJunio C Hamano <gitster@pobox.com>
Thu, 3 Aug 2017 20:11:01 +0000 (13:11 -0700)
commitff6f1f564c48def1f8e1852826bab58af5044b06
treea2ddf3d115dd97abb446a070d8f9c2b70db3fe8f
parent1b796ace7b5566d7cd2ed2ee56d3e5b1f7605272
submodule-config: lazy-load a repository's .gitmodules file

In order to use the submodule-config subsystem, callers first need to
initialize it by calling 'repo_read_gitmodules()' or
'gitmodules_config()' (which just redirects to
'repo_read_gitmodules()').  There are a couple of callers who need to
load an explicit revision of the repository's .gitmodules file (grep) or
need to modify the .gitmodules file so they would need to load it before
modify the file (checkout), but the majority of callers are simply
reading the .gitmodules file present in the working tree.  For the
common case it would be nice to avoid the boilerplate of initializing
the submodule-config system before using it, so instead let's perform
lazy-loading of the submodule-config system.

Remove the calls to reading the gitmodules file from ls-files to show
that lazy-loading the .gitmodules file works.

Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/ls-files.c
submodule-config.c