Revert "bump-formula-pr: fix forking logic"

This reverts commit c5da90e0eb2ade879d7e60a0ec6a193aad3f8afb.
This commit is contained in:
Maxim Belkin 2019-11-26 12:10:14 -06:00
parent 2735663dc3
commit 40b0b32a72
No known key found for this signature in database
GPG Key ID: AC71560D4C5F2338

View File

@ -341,7 +341,7 @@ module Homebrew
remote_url = Utils.popen_read("git remote get-url --push origin").chomp
username = formula.tap.user
else
remote_url, username = forked_repo_info(formula, tap_full_name, backup_file)
remote_url, username = forked_repo_info(tap_full_name)
end
safe_system "git", "fetch", "--unshallow", "origin" if shallow
@ -380,16 +380,15 @@ module Homebrew
end
end
def forked_repo_info(formula, tap_full_name, backup_file)
begin
response = GitHub.create_fork(tap_full_name)
# GitHub API responds immediately but fork takes a few seconds to be ready.
sleep 3
rescue GitHub::AuthenticationFailedError, *GitHub.api_errors => e
formula.path.atomic_write(backup_file)
odie "Unable to fork: #{e.message}!"
end
remote_url = if system("git", "config", "--local", "--get-regexp", "remote\..*\.url", "git@github.com:.*")
def forked_repo_info(tap_full_name)
response = GitHub.create_fork(tap_full_name)
rescue GitHub::AuthenticationFailedError, *GitHub.api_errors => e
formula.path.atomic_write(backup_file)
odie "Unable to fork: #{e.message}!"
else
# GitHub API responds immediately but fork takes a few seconds to be ready.
sleep 1 until GitHub.check_fork_exists(tap_full_name)
remote_url = if system("git", "config", "--local", "--get-regexp", "remote\..*\.url", "git@github.com:.*")
response.fetch("ssh_url")
else
response.fetch("clone_url")