Re: [capistrano] branch name on server

19 views
Skip to first unread message

Rafa García

unread,
Feb 27, 2013, 10:44:52 AM2/27/13
to capis...@googlegroups.com
"deploy" branch name is hardcoded in lib/capistrano/recipes/deploy/scm/git.rb at line 146 then you shouldn't change it (actually you can by overriding this  method).

Why you need it?


2013/2/26 fré de vries <f...@sibben.nl>
Hi all,

When i run 'cap deploy' ,  capistrano checks out a new branch in the just created releases/xxxxxxxxx/  directory.
As i can see on my screen during deployment,  Capistrano does this with the command 
git checkout -q -b deploy a4f187cf3dbd4294dc2fb4cc31b222eed79c51d5

as you can see,  a new branch is created  name 'deploy

I do not like this, i'd like to name this branch after the branch being checked out. So if i do 'cap -s branch=MY_BRANCH deploy' , the checkout command should be
git checkout -q -b MY_BRANCH a4f187cf3dbd4294dc2fb4cc31b222eed79c51d5

Can this be done?

--
--
* You received this message because you are subscribed to the Google Groups "Capistrano" group.
* To post to this group, send email to capis...@googlegroups.com
* To unsubscribe from this group, send email to capistrano+...@googlegroups.com For more options, visit this group at http://groups.google.com/group/capistrano?hl=en
---
You received this message because you are subscribed to the Google Groups "Capistrano" group.
To unsubscribe from this group and stop receiving emails from it, send an email to capistrano+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Donovan Bray

unread,
Feb 27, 2013, 11:12:04 AM2/27/13
to capis...@googlegroups.com
Capistrano can deploy branches, tags, and sha's. 

In order to support tags and sha's it needs to ensure there is no ambiguity that's left on the remote box when it's done. 

'deploy' was chosen so that you KNOW that the sha it's pointing to is something other than a real branch name. 

For example lets say you deploy master. Then you deploy tag v1.2.2. 

Git will show that your still on master except HEAD will actually be pointing to the sha at the tip of v1.2.2. Confusing right? I know.  

Same thing occurs with deploying a specific sha. 

When you look closely at what capistrano does you begin finding out that cap enumerates whatever you specify in :branch as a sha; and you are actually always deploying via that sha; not checking out a branch. 

So cap creates a local branch called deploy and then resets its head to point to the sha that was enumerated at deploy time. 

You CAN change the 'deploy' name but you are playing with fire if you are counting on that name pointing to the same sha that origin/<branchname> does. 
Reply all
Reply to author
Forward
0 new messages