lib/shuttle/strategy.rb in shuttle-deploy-0.2.0.beta11 vs lib/shuttle/strategy.rb in shuttle-deploy-0.2.0.beta12
- old
+ new
@@ -60,10 +60,12 @@
end
error "Git is not installed" if !git_installed?
error "Git source url is not defined. Please define :git option first" if config.app.git.nil?
+ branch = config.app.branch || 'master'
+
if ssh.directory_exists?(scm_path)
# Check if git remote has changed
current_remote = git_remote
if current_remote != config.app.git
@@ -74,11 +76,11 @@
error("Failed to change git remote: #{res.output}")
end
end
log "Fetching latest code"
- res = ssh.run "cd #{scm_path} && git pull origin master"
+ res = ssh.run "cd #{scm_path} && git pull origin #{branch}"
if res.failure?
error "Unable to fetch latest code: #{res.output}"
end
else
@@ -87,11 +89,9 @@
if res.failure?
error "Failed to clone repository: #{res.output}"
end
end
-
- branch = config.app.branch || 'master'
ssh.run("cd #{scm_path} && git fetch")
# Make sure to pull changes from current non-master branch
if branch != 'master'
\ No newline at end of file