lib/capistrano/git-submodule-strategy.rb in capistrano-git-submodule-strategy-0.1.3 vs lib/capistrano/git-submodule-strategy.rb in capistrano-git-submodule-strategy-0.1.4
- old
+ new
@@ -8,10 +8,18 @@
def test
test! " [ -d #{repo_path}/.git ] "
end
def check
- test! :git, :'ls-remote', repo_url
+ unless test!(:git, :'ls-remote', repo_url)
+ context.error "Repo `#{repo_url}` does not exists"
+ return false
+ end
+
+ if context.capture(:git, :'ls-remote', repo_url).split("\n").select{ |i| i.include?("refs/heads/#{fetch(:branch)}") }.empty?
+ context.error "Branch `#{fetch(:branch)}` not found in repo `#{repo_url}`"
+ return false
+ end
end
def clone
git :clone, '-b', fetch(:branch), '--recursive', repo_url, repo_path
end