submodule-config: add skip_if_read option to repo_read_gitmodules()

Currently, submodule-config.c doesn't have an externally accessible
function to read gitmodules only if it wasn't already read. But this
exact behavior is internally implemented by gitmodules_read_check(), to
perform a lazy load. Let's merge this function with
repo_read_gitmodules() adding a 'skip_if_read' which allows both
internal and external callers to access this functionality. This
simplifies a little the code. The added option will also be used in
the following patch.

Signed-off-by: Matheus Tavares <matheus.bernardino@usp.br>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Matheus Tavares
2020-01-15 23:39:55 -03:00
committed by Junio C Hamano
parent 1d1729caeb
commit d7992421e1
4 changed files with 10 additions and 16 deletions

View File

@ -420,7 +420,7 @@ static int grep_submodule(struct grep_opt *opt,
return 0;
}
repo_read_gitmodules(&subrepo);
repo_read_gitmodules(&subrepo, 0);
/*
* NEEDSWORK: This adds the submodule's object directory to the list of