From 5ad4015bd45a621a08b678eccfb807d8728d2406 Mon Sep 17 00:00:00 2001 From: Srini Date: Mon, 26 Jun 2023 17:28:22 -0700 Subject: [PATCH 1/4] Being more specific while checking remote Cocoapods spec repo URL Currently, the check to detect if the public Cocoapods spec repo is being used is a simple Regex match on github.com This backfires when we use private instances in github.com to host the spec repo (As is the case at LinkedIn) This patch makes the Regex more specific and only targets the public Cocoapods spec repo instance. The following two regex matches verify that claim: HTTPS remote URL match: https://rubular.com/r/oIsVWngbVcPTGT SSH remote URL match: https://rubular.com/r/HvnyKImgQptFU8 --- lib/cocoapods-core/source.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/cocoapods-core/source.rb b/lib/cocoapods-core/source.rb index 294da72f..10c46e64 100644 --- a/lib/cocoapods-core/source.rb +++ b/lib/cocoapods-core/source.rb @@ -467,7 +467,7 @@ def repo_git(args, include_error: false) end def unchanged_github_repo? - return unless url =~ /github.com/ + return unless url =~ /github\.com[:\/]CocoaPods\/CocoaPods\.git/ !GitHub.modified_since_commit(url, git_commit_hash) end From 478257924ecd346efe957c8f0d8515a0e6f00c59 Mon Sep 17 00:00:00 2001 From: Srini Date: Tue, 27 Jun 2023 08:47:56 -0700 Subject: [PATCH 2/4] Keeping the regex /github.com/ for compatibility reasons --- lib/cocoapods-core/source.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/cocoapods-core/source.rb b/lib/cocoapods-core/source.rb index 10c46e64..294da72f 100644 --- a/lib/cocoapods-core/source.rb +++ b/lib/cocoapods-core/source.rb @@ -467,7 +467,7 @@ def repo_git(args, include_error: false) end def unchanged_github_repo? - return unless url =~ /github\.com[:\/]CocoaPods\/CocoaPods\.git/ + return unless url =~ /github.com/ !GitHub.modified_since_commit(url, git_commit_hash) end From 3478cb6c2c3de5e260bc93fc0c67b55446e39a27 Mon Sep 17 00:00:00 2001 From: Srini Date: Tue, 27 Jun 2023 08:55:54 -0700 Subject: [PATCH 3/4] If modified_since_commit fails, repo update should still continue --- lib/cocoapods-core/github.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/cocoapods-core/github.rb b/lib/cocoapods-core/github.rb index c3b0b7e2..41c84393 100644 --- a/lib/cocoapods-core/github.rb +++ b/lib/cocoapods-core/github.rb @@ -102,7 +102,7 @@ def self.modified_since_commit(url, commit) code = response.status_code code != 304 rescue - raise Informative, "Failed to connect to GitHub to update the #{repo_id} specs repo - Please check if you are offline, or that GitHub is down" + puts "Failed to verify if #{repod_id} specs repo remote has been modified since commit #{commit} via /GET request to #{request_url}, continuing repo update..".yellow end end From 433fc6f2e3b47cd65fd51f7c26403b002edf9bb0 Mon Sep 17 00:00:00 2001 From: Srini Date: Tue, 27 Jun 2023 09:02:58 -0700 Subject: [PATCH 4/4] Typo in repo_id --- lib/cocoapods-core/github.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/cocoapods-core/github.rb b/lib/cocoapods-core/github.rb index 41c84393..e1c8e898 100644 --- a/lib/cocoapods-core/github.rb +++ b/lib/cocoapods-core/github.rb @@ -102,7 +102,7 @@ def self.modified_since_commit(url, commit) code = response.status_code code != 304 rescue - puts "Failed to verify if #{repod_id} specs repo remote has been modified since commit #{commit} via /GET request to #{request_url}, continuing repo update..".yellow + puts "Failed to verify if #{repo_id} specs repo remote has been modified since commit #{commit} via /GET request to #{request_url}, continuing repo update..".yellow end end