Fix how we resolve current branch according to http://stackoverflow.com/a/1593487 and http://devcenter.wercker.com/articles/introduction/pipeline.html#envvars