Permalink
Browse files

"Manually" syncing submodules in .git/config

  • Loading branch information...
1 parent 0def477 commit a6b2a20afdc0b29e64440333d21948eec8b2ef89 Nolan Eakins committed May 13, 2009
Showing with 6 additions and 1 deletion.
  1. +2 −1 lib/capistrano/recipes/deploy/scm/git.rb
  2. +4 −0 test/deploy/scm/git_test.rb
View
3 lib/capistrano/recipes/deploy/scm/git.rb
@@ -189,7 +189,8 @@ def sync(revision, destination)
if configuration[:git_enable_submodules]
execute << "#{git} submodule #{verbose} init"
- execute << "#{git} submodule sync"
+ execute << "for mod in `#{git} submodule status | awk '{ print $2 }'`; do #{git} config -f .git/config submodule.${mod}.url `#{git} config -f .gitmodules --get submodule.${mod}.url` && echo Synced $mod; done"
+ execute << "#{git} submodule #{verbose} sync"
execute << "#{git} submodule #{verbose} update"
end
View
4 test/deploy/scm/git_test.rb
@@ -98,6 +98,10 @@ def test_sync
git = "/opt/local/bin/git"
@config[:scm_command] = git
assert_equal "cd #{dest} && #{git} fetch -q origin && #{git} reset -q --hard #{rev}", @source.sync(rev, dest)
+
+ # with submodules
+ @config[:git_enable_submodules] = true
+ assert_equal "cd #{dest} && #{git} fetch -q origin && #{git} reset -q --hard #{rev} && #{git} submodule -q init && for mod in `#{git} submodule status | awk '{ print $2 }'`; do #{git} config -f .git/config submodule.${mod}.url `#{git} config -f .gitmodules --get submodule.${mod}.url` && echo Synced $mod; done && #{git} submodule -q sync && #{git} submodule -q update", @source.sync(rev, dest)
end
def test_sync_with_remote

0 comments on commit a6b2a20

Please sign in to comment.