Skip to content

Commit

Permalink
Merge pull request #11 from vincentlepot/reset_submodules
Browse files Browse the repository at this point in the history
Add a reset of all submodules to avoid update issues
  • Loading branch information
Bladrak committed Jul 7, 2015
2 parents e527d30 + 5b75561 commit e73aaa0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions lib/capistrano/rsync.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -167,6 +169,10 @@ def has_roles?
execute :git, :reset, '--quiet', '--hard', "#{rsync_target.call}"

if fetch(:enable_git_submodules)
if fetch(:reset_git_submodules_before_update)
execute :git, :submodule, :foreach, "git reset --hard HEAD"
end

execute :git, :submodule, :update
end
end
Expand Down

0 comments on commit e73aaa0

Please sign in to comment.