mydrive / capistrano-deploytags

Add timestamped Git tags for each environment on deployment

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

hardcoded assumption that 'origin' remote exists

aspiers opened this issue · comments

The gem does:

        cdt.safe_run "git", "pull", "origin", branch if cdt.has_remote?

but not all git repositories have origin as their remote. This breaks the gem for me. A smarter approach might be to see if there is an upstream tracking branch set for the branch to be deployed, and if so, get the remote from that. Otherwise, refuse to run. And of course it should be possible to override this behaviour by manually specifying the name of the remote:

set :git_remote, 'upstream'

Additionally, I think git pull is an ever so slightly evil thing to do, since it violates the Principle of Least Surprise and could unexpectedly change the working branch. However I understand the need to do it, and I think it's OK as long as this is clearly documented. In particular, if you don't have a separate branch per deployment stage, e.g. if you are using master for everything (agreed - not ideal, but reasonable for a small project with an approach based on Continuous Deployment) then it should be made obvious that this is what's going on.

Good point, I'll have a look this afternoon.

So I added the ability to configure the remote name. You can set :git_remote anywhere that's legal, including from the command line. I also added explicit mention of the pulling behavior in the README and added a log line that says so. This is a good feature addition, and I think a simple solution. Thanks.

Released as 0.8.0.

Awesome, thanks a lot!!