This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".

The branch, next has been updated
       via  d28f403a8c9b3ab5231aa0dfaab006a8f1f116d1 (commit)
       via  df48b7c86d899dee9c5345b782d69f3d4699556f (commit)
      from  5d5a90d31233a2751f47f73e9205cdd594da1d95 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d28f403a8c9b3ab5231aa0dfaab006a8f1f116d1
commit d28f403a8c9b3ab5231aa0dfaab006a8f1f116d1
Merge: 5d5a90d df48b7c
Author:     Brad King <brad.k...@kitware.com>
AuthorDate: Thu Mar 31 08:44:25 2016 -0400
Commit:     CMake Topic Stage <kwro...@kitware.com>
CommitDate: Thu Mar 31 08:44:25 2016 -0400

    Merge topic 'ctest-run-submodule-sync' into next
    
    df48b7c8 cmCTestGIT: run git submodule {init,sync} to update


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=df48b7c86d899dee9c5345b782d69f3d4699556f
commit df48b7c86d899dee9c5345b782d69f3d4699556f
Author:     Ben Boeckel <ben.boec...@kitware.com>
AuthorDate: Tue Mar 29 11:05:15 2016 -0400
Commit:     Brad King <brad.k...@kitware.com>
CommitDate: Thu Mar 31 08:38:14 2016 -0400

    cmCTestGIT: run git submodule {init,sync} to update
    
    Repositories which add submodules or change their URLs are not fixed by
    CTest when updating a git repository.

diff --git a/Help/release/dev/ctest-run-submodule-sync.rst 
b/Help/release/dev/ctest-run-submodule-sync.rst
new file mode 100644
index 0000000..55e87c0
--- /dev/null
+++ b/Help/release/dev/ctest-run-submodule-sync.rst
@@ -0,0 +1,6 @@
+ctest-run-submodule-sync
+------------------------
+
+* The :command:`ctest_update` command will now initialize and synchronize
+  submodules on an update. Updates which add submodules or change a
+  submodule's URL will now be pulled properly.
diff --git a/Source/CTest/cmCTestGIT.cxx b/Source/CTest/cmCTestGIT.cxx
index bbb3b9d..ee462f8 100644
--- a/Source/CTest/cmCTestGIT.cxx
+++ b/Source/CTest/cmCTestGIT.cxx
@@ -273,21 +273,53 @@ bool cmCTestGIT::UpdateImpl()
   std::string top_dir = this->FindTopDir();
   const char* git = this->CommandLineTool.c_str();
   const char* recursive = "--recursive";
+  const char* sync_recursive = "--recursive";
 
-  // Git < 1.6.5.0 did not support --recursive
+  // Git < 1.6.5 did not support submodule --recursive
   if(this->GetGitVersion() < cmCTestGITVersion(1,6,5,0))
     {
     recursive = 0;
-    // No need to require >= 1.6.5.0 if there are no submodules.
+    // No need to require >= 1.6.5 if there are no submodules.
     if(cmSystemTools::FileExists((top_dir + "/.gitmodules").c_str()))
       {
-      this->Log << "Git < 1.6.5.0 cannot update submodules recursively\n";
+      this->Log << "Git < 1.6.5 cannot update submodules recursively\n";
+      }
+    }
+
+  // Git < 1.8.1 did not support sync --recursive
+  if(this->GetGitVersion() < cmCTestGITVersion(1,8,1,0))
+    {
+    sync_recursive = 0;
+    // No need to require >= 1.8.1 if there are no submodules.
+    if(cmSystemTools::FileExists((top_dir + "/.gitmodules").c_str()))
+      {
+      this->Log << "Git < 1.8.1 cannot synchronize submodules recursively\n";
       }
     }
 
-  char const* git_submodule[] = {git, "submodule", "update", recursive, 0};
   OutputLogger submodule_out(this->Log, "submodule-out> ");
   OutputLogger submodule_err(this->Log, "submodule-err> ");
+
+  char const* git_submodule_init[] = {git, "submodule", "init", 0};
+  bool ret = this->RunChild(git_submodule_init, &submodule_out, &submodule_err,
+                            top_dir.c_str());
+
+  if (!ret)
+    {
+    return false;
+    }
+
+  char const* git_submodule_sync[] = {git, "submodule", "sync",
+                                      sync_recursive, 0};
+  ret = this->RunChild(git_submodule_sync, &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());
 }

-----------------------------------------------------------------------

Summary of changes:


hooks/post-receive
-- 
CMake
_______________________________________________
Cmake-commits mailing list
Cmake-commits@cmake.org
http://public.kitware.com/mailman/listinfo/cmake-commits

Reply via email to