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 ...@@ -79,6 +79,7 @@ module Pod
git! "reset --hard HEAD" git! "reset --hard HEAD"
git! "clean -d -x -f" git! "clean -d -x -f"
git! "pull origin master" git! "pull origin master"
git! "fetch"
git! "fetch --tags" git! "fetch --tags"
end end
end end
...@@ -95,10 +96,15 @@ module Pod ...@@ -95,10 +96,15 @@ module Pod
raise Informative, "[!] Cache unable to find git reference `#{ref}' for `#{url}'.".red unless ref_exists?(ref) raise Informative, "[!] Cache unable to find git reference `#{ref}' for `#{url}'.".red unless ref_exists?(ref)
end 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) Dir.chdir(cache_path) { git "branch -r | grep #{branch}$" } # check for remote branch and do suffix matching ($ anchor)
return if $? == 0 $? == 0
raise Informative, "[!] Cache unable to find git reference `#{branch}' for `#{url}' (#{$?}).".red 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 end
def download_head 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