diff options
author | Brad King <brad.king@kitware.com> | 2010-05-04 13:35:27 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2010-05-04 13:40:04 (GMT) |
commit | 67277bacca15047405a1185d2271ba81b553bdae (patch) | |
tree | d2eca7c94103e0006cc5e2c4cfa9911ab138d964 /Source/CTest | |
parent | f20fd583d8fcc9527de997db3808a75ed9624b90 (diff) | |
download | CMake-67277bacca15047405a1185d2271ba81b553bdae.zip CMake-67277bacca15047405a1185d2271ba81b553bdae.tar.gz CMake-67277bacca15047405a1185d2271ba81b553bdae.tar.bz2 |
Teach ctest_update about Git submodules
Git does not automatically checkout the matching version of a submodule
when it checks out a new version of the parent project in the work tree.
If the submodule reference changed in the parent project then we were
reporting the submodule path as a local modification. Work around the
problem in ctest_update using "git submodule update" after "git pull".
For projects with no submodules this is a no-op. See issue #10662.
Also add a submodule to the test project for CTest.UpdateGIT to test the
work-around.
Diffstat (limited to 'Source/CTest')
-rw-r--r-- | Source/CTest/cmCTestGIT.cxx | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/Source/CTest/cmCTestGIT.cxx b/Source/CTest/cmCTestGIT.cxx index 6d5bf65..8bac518 100644 --- a/Source/CTest/cmCTestGIT.cxx +++ b/Source/CTest/cmCTestGIT.cxx @@ -87,9 +87,11 @@ void cmCTestGIT::NoteNewRevision() //---------------------------------------------------------------------------- bool cmCTestGIT::UpdateImpl() { + const char* git = this->CommandLineTool.c_str(); + // Use "git pull" to update the working tree. std::vector<char const*> git_pull; - git_pull.push_back(this->CommandLineTool.c_str()); + git_pull.push_back(git); git_pull.push_back("pull"); // TODO: if(this->CTest->GetTestModel() == cmCTest::NIGHTLY) @@ -112,7 +114,14 @@ bool cmCTestGIT::UpdateImpl() OutputLogger out(this->Log, "pull-out> "); OutputLogger err(this->Log, "pull-err> "); - return this->RunUpdateCommand(&git_pull[0], &out, &err); + if(this->RunUpdateCommand(&git_pull[0], &out, &err)) + { + char const* git_submodule[] = {git, "submodule", "update", 0}; + OutputLogger out2(this->Log, "submodule-out> "); + OutputLogger err2(this->Log, "submodule-err> "); + return this->RunChild(git_submodule, &out, &err); + } + return false; } //---------------------------------------------------------------------------- |