1
0
Fork 0
mirror of https://github.com/capistrano/capistrano synced 2023-03-27 23:21:18 -04:00

Add support for :git_enable_submodules variable, to enable submodules with git SCM (closes #10240)

git-svn-id: http://svn.rubyonrails.org/rails/tools/capistrano@8755 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
Jamis Buck 2008-01-30 06:21:49 +00:00
parent 9e2de79a38
commit b4a0d3c30a
2 changed files with 22 additions and 8 deletions

View file

@ -1,5 +1,7 @@
*SVN*
* Add support for :git_enable_submodules variable, to enable submodules with the git SCM [halorgium]
* If subversion asks for a password, prompt as a last resort [Jamis Buck]
* Use checkout --lightweight for bzr checkout, instead of branch [michiels]

View file

@ -111,29 +111,41 @@ module Capistrano
fail "No branch specified, use for example 'set :branch, \"origin/master\"' in your deploy.rb" unless branch
execute = []
if depth = configuration[:git_shallow_clone]
execute = "#{git} clone --depth #{depth} #{configuration[:repository]} #{destination} && "
execute << "#{git} clone --depth #{depth} #{configuration[:repository]} #{destination}"
else
execute = "#{git} clone #{configuration[:repository]} #{destination} && "
execute << "#{git} clone #{configuration[:repository]} #{destination}"
end
execute += "cd #{destination} && #{git} checkout -b deploy #{branch}"
execute << "cd #{destination}"
execute << "#{git} checkout -b deploy #{branch}"
if configuration[:git_enable_submodules]
execute << "#{git} submodule init"
execute << "#{git} submodule update"
end
execute
execute.join(" && ")
end
# Merges the changes to 'head' since the last fetch, for remote_cache
# deployment strategy
def sync(revision, destination)
execute = "cd #{destination} && git fetch origin && "
git = command
execute = []
execute << "cd #{destination} && #{git} fetch origin"
if head == 'HEAD'
execute += "git merge origin/HEAD"
execute << "#{git} merge origin/HEAD"
else
execute += "git merge #{head}"
execute << "#{git} merge #{head}"
end
if configuration[:git_enable_submodules]
execute << "#{git} submodule update"
end
execute
execute.join(" && ")
end
# Returns a string of diffs between two revisions