#include"cache.h"#include"submodule-config.h"#include"submodule.h"#include"dir.h"#include"diff.h"#include"commit.h"#include"revision.h"#include"run-command.h"#include"diffcore.h"#include"refs.h"#include"string-list.h"#include"sha1-array.h"#include"argv-array.h"#include"blob.h"#include"thread-utils.h"#include"quote.h"#include"worktree.h"staticint config_fetch_recurse_submodules = RECURSE_SUBMODULES_ON_DEMAND;
staticint parallel_jobs = 1;
staticstruct string_list changed_submodule_paths = STRING_LIST_INIT_NODUP;
staticint initialized_fetch_ref_tips;
staticstruct sha1_array ref_tips_before_fetch;
staticstruct sha1_array ref_tips_after_fetch;
/*
* The following flag is set if the .gitmodules file is unmerged. We then
* disable recursion for all submodules where .git/config doesn't have a
* matching config entry because we can't guess what might be configured in
* .gitmodules unless the user resolves the conflict. When a command line
* option is given (which always overrides configuration) this flag will be
* ignored.
*/staticint gitmodules_is_unmerged;
/*
* This flag is set if the .gitmodules file had unstaged modifications on
* startup. This must be checked before allowing modifications to the
* .gitmodules file with the intention to stage them later, because when
* continuing we would stage the modifications the user didn't stage herself
* too. That might change in a future version when we learn to stage the
* changes we do ourselves without staging any previous modifications.
*/staticint gitmodules_is_modified;
intis_staging_gitmodules_ok(void)
{
return !gitmodules_is_modified;
}
/*
* Try to update the "path" entry in the "submodule.<name>" section of the
* .gitmodules file. Return 0 only if a .gitmodules file was found, a section
* with the correct path=<oldpath> setting was found and we could update it.
*/intupdate_path_in_gitmodules(constchar *oldpath, constchar *newpath)
{
struct strbuf entry = STRBUF_INIT;
const