Avoid pulling a SHA if specified with -s revision=, just branches.

This commit is contained in:
Barrie Bremner
2013-01-30 16:43:08 +00:00
parent e84f6a359d
commit e8013426a7
+15 -3
View File
@@ -45,10 +45,22 @@ module Capistrano
logger.log Capistrano::Logger::IMPORTANT, "Sorry, you have uncommitted changes. Please commit or stash them."
end
logger.log Capistrano::Logger::IMPORTANT, "Preparing to deploy HEAD from branch '#{branch}' to '#{stage}'"
cdt.safe_run "git", "fetch"
cdt.safe_run "git", "checkout", branch
cdt.safe_run "git", "pull", "origin", branch if cdt.has_remote?
ref = fetch(:revision, branch)
if exists?(:revision)
logger.log Capistrano::Logger::IMPORTANT, "Preparing to deploy '#{ref}' to '#{stage}'"
else
logger.log Capistrano::Logger::IMPORTANT, "Preparing to deploy HEAD from '#{ref}' to '#{stage}'"
end
cdt.safe_run "git", "checkout", ref
# It doesn't make sense to pull a SHA, only a branch.
if cdt.has_remote? && ! exists?(:revision)
cdt.safe_run "git", "pull", "origin", ref
end
end
desc 'add git tags for each successful deployment'