diff --git a/lib/capistrano/rsync.rb b/lib/capistrano/rsync.rb index 7a997d9..9cbf1b2 100644 --- a/lib/capistrano/rsync.rb +++ b/lib/capistrano/rsync.rb @@ -26,6 +26,8 @@ set_if_empty :enable_git_submodules, false +set_if_empty :reset_git_submodules_before_update, false + # NOTE: Please don't depend on tasks without a description (`desc`) as they # might change between minor or patch version releases. They make up the # private API and internals of Capistrano::Rsync. If you think something should @@ -167,7 +169,9 @@ def has_roles? execute :git, :reset, '--quiet', '--hard', "#{rsync_target.call}" if fetch(:enable_git_submodules) - execute :git, :submodule, :foreach, "git reset --hard HEAD" + if fetch(:reset_git_submodules_before_update) + execute :git, :submodule, :foreach, "git reset --hard HEAD" + end execute :git, :submodule, :update end