Permalink
Browse files

Handle the situation where the git submodule status block is called s…

…eparately for each submodule.

capistrano-deepmodules was working fine, then all of a sudden it started only recursively updating the last of my submodules.  I must have updated some gem that now calls the block of run("cd #{dir} && #{source.submodule('status')}") for each submodule instead of once for all of them.  Documentation says "The block will be invoked every time the command produces output (stderr or stdout)." and that seems sufficiently ambiguous to allow "output" to be one submodule or all of them. capistrano-deepmodules is now robust enough to handle either situation.
  • Loading branch information...
1 parent d6432f7 commit 1d1d54de68109ed185f9a7f88cfea9ed972d4d92 @jgarber jgarber committed Mar 1, 2009
Showing with 3 additions and 3 deletions.
  1. +2 −2 capistrano-deepmodules.gemspec
  2. +1 −1 lib/capistrano/deepmodules.rb
@@ -1,7 +1,7 @@
Gem::Specification.new do |s|
s.name = 'capistrano-deepmodules'
- s.version = "0.1"
- s.date = "2008-10-28"
+ s.version = "0.2"
+ s.date = "2009-03-01"
s.summary = "Capistrano plugin to deploy Git repos with nested submodules."
s.description = %{This plugin allows you to easily deploy git repositories with
submodules nested at more then one level.%}
@@ -45,7 +45,7 @@ def update_submodules(dir)
run("cd #{dir} && #{source.submodule('status')}") do |state, stream, text|
# parsing the output of "git submodule status" command
# and collecting paths of all submodules into an array
- submodules = text.split(/\n/).collect do |submodule|
+ submodules += text.split(/\n/).collect do |submodule|
$~[1] if submodule.rstrip =~ /.\w{40} ([^()]+)($| \(.*\)$)/
end
end

2 comments on commit 1d1d54d

@mperham

We get an infinite loop when deploying with 0.2. 0.1 works perfect for us. I don’t know if this has anything to do with it but we see this with 0.2:

updating submodule at /var/www/rails/products/dash/collector/shared/cached-copy//test/fixtures

Note the duplicate slash.

@mperham

It should be noted that we only have one “deep” submodule – perhaps that’s why 0.1 works fine for us.

Please sign in to comment.