Commit f33d3284 authored by Ray Lillywhite's avatar Ray Lillywhite

Update a pod's cached git repo if the specified branch isn't found.

parent f0541a81
......@@ -79,6 +79,7 @@ module Pod
git! "reset --hard HEAD"
git! "clean -d -x -f"
git! "pull origin master"
git! "fetch"
git! "fetch --tags"
end
end
......@@ -95,10 +96,15 @@ module Pod
raise Informative, "[!] Cache unable to find git reference `#{ref}' for `#{url}'.".red unless ref_exists?(ref)
end
def ensure_remote_branch_exists(branch)
def branch_exists?(branch)
Dir.chdir(cache_path) { git "branch -r | grep #{branch}$" } # check for remote branch and do suffix matching ($ anchor)
return if $? == 0
raise Informative, "[!] Cache unable to find git reference `#{branch}' for `#{url}' (#{$?}).".red
$? == 0
end
def ensure_remote_branch_exists(branch)
return if branch_exists?(branch)
update_cache
raise Informative, "[!] Cache unable to find git reference `#{branch}' for `#{url}' (#{$?}).".red unless branch_exists?(branch)
end
def download_head
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment