| 232 | } |
| 233 | |
| 234 | bool cmCTestGIT::UpdateImpl() |
| 235 | { |
| 236 | if (!this->UpdateInternal()) { |
| 237 | return false; |
| 238 | } |
| 239 | |
| 240 | std::string top_dir = this->FindTopDir(); |
| 241 | std::string git = this->CommandLineTool; |
| 242 | std::string recursive = "--recursive"; |
| 243 | std::string sync_recursive = "--recursive"; |
| 244 | |
| 245 | // Git < 1.6.5 did not support submodule --recursive |
| 246 | bool support_recursive = true; |
| 247 | if (this->GetGitVersion() < cmCTestGITVersion(1, 6, 5, 0)) { |
| 248 | support_recursive = false; |
| 249 | // No need to require >= 1.6.5 if there are no submodules. |
| 250 | if (cmSystemTools::FileExists(top_dir + "/.gitmodules")) { |
| 251 | this->Log << "Git < 1.6.5 cannot update submodules recursively\n"; |
| 252 | } |
| 253 | } |
| 254 | |
| 255 | // Git < 1.8.1 did not support sync --recursive |
| 256 | bool support_sync_recursive = true; |
| 257 | if (this->GetGitVersion() < cmCTestGITVersion(1, 8, 1, 0)) { |
| 258 | support_sync_recursive = false; |
| 259 | // No need to require >= 1.8.1 if there are no submodules. |
| 260 | if (cmSystemTools::FileExists(top_dir + "/.gitmodules")) { |
| 261 | this->Log << "Git < 1.8.1 cannot synchronize submodules recursively\n"; |
| 262 | } |
| 263 | } |
| 264 | |
| 265 | OutputLogger submodule_out(this->Log, "submodule-out> "); |
| 266 | OutputLogger submodule_err(this->Log, "submodule-err> "); |
| 267 | |
| 268 | bool ret; |
| 269 | |
| 270 | if (this->Makefile->IsOn("CTEST_GIT_INIT_SUBMODULES")) { |
| 271 | std::vector<std::string> git_submodule_init = { git, "submodule", "init" }; |
| 272 | ret = this->RunChild(git_submodule_init, &submodule_out, &submodule_err, |
| 273 | top_dir); |
| 274 | |
| 275 | if (!ret) { |
| 276 | return false; |
| 277 | } |
| 278 | } |
| 279 | |
| 280 | std::vector<std::string> git_submodule_sync = { git, "submodule", "sync" }; |
| 281 | if (support_sync_recursive) { |
| 282 | git_submodule_sync.push_back(sync_recursive); |
| 283 | } |
| 284 | ret = this->RunChild(git_submodule_sync, &submodule_out, &submodule_err, |
| 285 | top_dir); |
| 286 | |
| 287 | if (!ret) { |
| 288 | return false; |
| 289 | } |
| 290 | |
| 291 | std::vector<std::string> git_submodule = { git, "submodule", "update" }; |
nothing calls this directly
no test coverage detected