lib/capistrano/git-submodule-strategy.rb in capistrano-git-submodule-strategy-0.1.5 vs lib/capistrano/git-submodule-strategy.rb in capistrano-git-submodule-strategy-0.1.6

- old
+ new

@@ -4,11 +4,11 @@ module SubmoduleStrategy # do all the things a normal capistrano git session would do include Capistrano::Git::DefaultStrategy def test - test! " [ -d #{repo_path}/.git ] " + test! " [ -f #{repo_path}/HEAD ] " end def check unless test!(:git, :'ls-remote', repo_url) context.error "Repo `#{repo_url}` does not exists" @@ -22,23 +22,21 @@ true end def clone - git :clone, '-b', fetch(:branch), '--recursive', repo_url, repo_path + git :clone, '--mirror', repo_url, repo_path end def update git :remote, :update end # put the working tree in a release-branch, # make sure the submodules are up-to-date # and copy everything to the release path def release - git :checkout, fetch(:branch) - git :reset, '--hard', "origin/#{fetch(:branch)}" - git :submodule, :update, '--init', '--recursive' - context.execute "rsync -ar --exclude=.git\* #{repo_path}/ #{release_path}" + git :clone, '--depth=1', '--recursive', '-b', fetch(:branch), "file://#{repo_path}", release_path + context.execute("find #{release_path} -name '.git*' | xargs -I {} rm -rfv {}") end end end