mydrive / capistrano-deploytags

Add timestamped Git tags for each environment on deployment
BSD 2-Clause "Simplified" License
123 stars 20 forks source link

hardcoded assumption that 'origin' remote exists #12

Closed aspiers closed 10 years ago

aspiers commented 10 years ago

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.

relistan commented 10 years ago

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

relistan commented 10 years ago

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.

relistan commented 10 years ago

Released as 0.8.0.

aspiers commented 10 years ago

Awesome, thanks a lot!!