summaryrefslogtreecommitdiff
path: root/lib/chef/provider/git.rb
diff options
context:
space:
mode:
authorSteffen Gebert <steffen.gebert@typo3.org>2013-03-07 13:24:56 +0100
committerBryan McLellan <btm@opscode.com>2013-05-24 07:45:04 -0700
commit9d02aee4a447bc1c9c44bf65245eec1206789aa5 (patch)
treef4908cd309d92d5e7500806de8ee7a288db283aa /lib/chef/provider/git.rb
parent8093045e9ce178bd82773ab3659787f48cfc0172 (diff)
downloadchef-9d02aee4a447bc1c9c44bf65245eec1206789aa5.tar.gz
[CHEF-2750] SCM/Git LWRP: Synchronize submodules
If enable_submodules is true, Git submodules should not only be updated (git submodule update --init), but also synchronized (git submodule sync) to support the case, when submodule URLs change.
Diffstat (limited to 'lib/chef/provider/git.rb')
-rw-r--r--lib/chef/provider/git.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/chef/provider/git.rb b/lib/chef/provider/git.rb
index fcc7c81a99..53efdb39de 100644
--- a/lib/chef/provider/git.rb
+++ b/lib/chef/provider/git.rb
@@ -164,7 +164,11 @@ class Chef
def enable_submodules
if @new_resource.enable_submodules
- converge_by("enable git submodules for #{@new_resource}") do
+ converge_by("enable git submodules for #{@new_resource}") do
+ Chef::Log.info "#{@new_resource} synchronizing git submodules"
+ command = "git submodule sync"
+ shell_out!(command, run_options(:cwd => @new_resource.destination, :log_level => :info))
+
Chef::Log.info "#{@new_resource} enabling git submodules"
# the --recursive flag means we require git 1.6.5+ now, see CHEF-1827
command = "git submodule update --init --recursive"