summaryrefslogtreecommitdiffstats
path: root/Source/CTest/cmCTestGIT.cxx
diff options
context:
space:
mode:
authorBen Boeckel <ben.boeckel@kitware.com>2016-03-31 16:28:46 (GMT)
committerBrad King <brad.king@kitware.com>2016-04-01 19:50:31 (GMT)
commit06b310b5d5d8a38fb17df02fee8df750904cfcd0 (patch)
treee8ad256a6192696abd62997200841baa2486f4ce /Source/CTest/cmCTestGIT.cxx
parent56c1ea40c5e278155025f3823089e2d0fa34054a (diff)
downloadCMake-06b310b5d5d8a38fb17df02fee8df750904cfcd0.zip
CMake-06b310b5d5d8a38fb17df02fee8df750904cfcd0.tar.gz
CMake-06b310b5d5d8a38fb17df02fee8df750904cfcd0.tar.bz2
cmCTestGIT: add an option to initialize submodules on update
Currently, CTest will not initialize any submodules within the already checked out source tree. Add an option to do so. The use case for not doing so is that some submodules may not be necessary for the current test and keeping network usage down may be important.
Diffstat (limited to 'Source/CTest/cmCTestGIT.cxx')
-rw-r--r--Source/CTest/cmCTestGIT.cxx19
1 files changed, 18 insertions, 1 deletions
diff --git a/Source/CTest/cmCTestGIT.cxx b/Source/CTest/cmCTestGIT.cxx
index da086be..9ee18e6 100644
--- a/Source/CTest/cmCTestGIT.cxx
+++ b/Source/CTest/cmCTestGIT.cxx
@@ -285,9 +285,26 @@ bool cmCTestGIT::UpdateImpl()
}
}
- char const* git_submodule[] = {git, "submodule", "update", recursive, 0};
OutputLogger submodule_out(this->Log, "submodule-out> ");
OutputLogger submodule_err(this->Log, "submodule-err> ");
+
+ bool ret;
+
+ std::string init_submodules =
+ this->CTest->GetCTestConfiguration("GITInitSubmodules");
+ if (cmSystemTools::IsOn(init_submodules.c_str()))
+ {
+ char const* git_submodule_init[] = {git, "submodule", "init", 0};
+ ret = this->RunChild(git_submodule_init, &submodule_out, &submodule_err,
+ top_dir.c_str());
+
+ if (!ret)
+ {
+ return false;
+ }
+ }
+
+ char const* git_submodule[] = {git, "submodule", "update", recursive, 0};
return this->RunChild(git_submodule, &submodule_out, &submodule_err,
top_dir.c_str());
}