Skip to content
Browse files

Added `git submodule sync` to the commands ran when updating submodules.

  • Loading branch information...
1 parent df0935c commit 0def477a8c7836be0c7e438492caa4c21609ab4d Nolan Eakins committed May 13, 2009
Showing with 15 additions and 0 deletions.
  1. +2 −0 lib/capistrano/recipes/deploy/scm/git.rb
  2. +13 −0 test/deploy/scm/git_test.rb
View
2 lib/capistrano/recipes/deploy/scm/git.rb
@@ -151,6 +151,7 @@ def checkout(revision, destination)
if configuration[:git_enable_submodules]
execute << "#{git} submodule #{verbose} init"
+ execute << "#{git} submodule #{verbose} sync"
execute << "#{git} submodule #{verbose} update"
end
@@ -188,6 +189,7 @@ def sync(revision, destination)
if configuration[:git_enable_submodules]
execute << "#{git} submodule #{verbose} init"
+ execute << "#{git} submodule sync"
execute << "#{git} submodule #{verbose} update"
end
View
13 test/deploy/scm/git_test.rb
@@ -37,6 +37,10 @@ def test_checkout
git = "/opt/local/bin/git"
@config[:scm_command] = git
assert_equal "#{git} clone -q git@somehost.com:project.git /var/www && cd /var/www && #{git} checkout -q -b deploy #{rev}", @source.checkout(rev, dest)
+
+ # with submodules
+ @config[:git_enable_submodules] = true
+ assert_equal "#{git} clone -q git@somehost.com:project.git /var/www && cd /var/www && #{git} checkout -q -b deploy #{rev} && #{git} submodule -q init && #{git} submodule -q sync && #{git} submodule -q update", @source.checkout(rev, dest)
end
def test_checkout_with_verbose_should_not_use_q_switch
@@ -124,6 +128,15 @@ def test_remote_clone
assert_equal "git clone -q -o username git@somehost.com:project.git /var/www && cd /var/www && git checkout -q -b deploy #{rev}", @source.checkout(rev, dest)
end
+ def test_remote_clone_with_submodules
+ @config[:repository] = "git@somehost.com:project.git"
+ @config[:remote] = "username"
+ @config[:git_enable_submodules] = true
+ dest = "/var/www"
+ rev = 'c2d9e79'
+ assert_equal "git clone -q -o username git@somehost.com:project.git /var/www && cd /var/www && git checkout -q -b deploy #{rev} && git submodule -q init && git submodule -q sync && git submodule -q update", @source.checkout(rev, dest)
+ end
+
# Tests from base_test.rb, makin' sure we didn't break anything up there!
def test_command_should_default_to_default_command
assert_equal "git", @source.command

0 comments on commit 0def477

Please sign in to comment.
Something went wrong with that request. Please try again.