class Dependabot::GitMetadataFetcher
def fetch_upload_pack_for(uri)
def fetch_upload_pack_for(uri) response = fetch_raw_upload_pack_for(uri) return response.body if response.status == 200 response_with_git = fetch_raw_upload_pack_with_git_for(uri) return response_with_git.body if response_with_git.status == 200 raise Dependabot::GitDependenciesNotReachable, [uri] unless uri.match?(KNOWN_HOSTS) raise "Unexpected response: #{response.status} - #{response.body}" if response.status < 400 if uri.match?(/github\.com/i) response = response.data response[:response_headers] = response[:headers] raise Octokit::Error.from_response(response) end raise "Server error at #{uri}: #{response.body}" if response.status >= 500 raise Dependabot::GitDependenciesNotReachable, [uri] rescue Excon::Error::Socket, Excon::Error::Timeout raise if uri.match?(KNOWN_HOSTS) raise Dependabot::GitDependenciesNotReachable, [uri] end