From 44d836bec7fb188a20e5da32ac9720a34fbe4de0 Mon Sep 17 00:00:00 2001 From: Vincent Lepot Date: Mon, 6 Jul 2015 14:10:49 +0200 Subject: [PATCH 1/3] Add a reset of all submodules to avoid update issues --- lib/capistrano/rsync.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/capistrano/rsync.rb b/lib/capistrano/rsync.rb index 1470231..7a997d9 100644 --- a/lib/capistrano/rsync.rb +++ b/lib/capistrano/rsync.rb @@ -167,6 +167,8 @@ def has_roles? execute :git, :reset, '--quiet', '--hard', "#{rsync_target.call}" if fetch(:enable_git_submodules) + execute :git, :submodule, :foreach, "git reset --hard HEAD" + execute :git, :submodule, :update end end From b573202072727471de1592959749ffce320d33bd Mon Sep 17 00:00:00 2001 From: Vincent Lepot Date: Tue, 7 Jul 2015 10:43:05 +0200 Subject: [PATCH 2/3] Add an option for reset --- lib/capistrano/rsync.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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 From 5b75561f05800768b8bead5676eba3e2b2d76c59 Mon Sep 17 00:00:00 2001 From: Vincent Lepot Date: Tue, 7 Jul 2015 10:47:22 +0200 Subject: [PATCH 3/3] Add the option to the documentation --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index ab90fd9..5db8fff 100644 --- a/README.md +++ b/README.md @@ -135,6 +135,7 @@ rsync_checkout_tag | `false` | Is the ``:branch`` symbol containing a branch or rsync_copy | `rsync --archive --acls --xattrs` | The command used to copy from remote cache to remote release rsync_target_dir | `.` | The local directory within ``:rsync_stage`` to clone to & deploy (useful if you want to keep cache of several branches/tags for instance) enable_git_submodules | `false` | Should we fetch submodules as well? +reset_git_submodules_before_update | `false` | Do a reset hard on submodules (in case you do modifications on working copies)? License