From 0433f3e332260a539bb6ff4b35cafa0b3c0160b3 Mon Sep 17 00:00:00 2001 From: Oscar Madera <80536682+oscarbol09@users.noreply.github.com> Date: Sun, 2 Aug 2026 14:15:28 -0500 Subject: [PATCH] fix(check_upstream_updates): compare template repo URL case-insensitively (#273) GitHub serves repo paths case-insensitively, so a direct clone from https://github.com/madslorentzen/ai-job-search (lowercased) triggered the fork-vs-self warning even though origin is the template repo itself. Lowercase both sides of the check. New test clones with a lowercased URL: fails on the previous check, passes with this fix. --- tests/test_check_upstream_updates.py | 16 ++++++++++++++++ tools/check_upstream_updates.py | 3 ++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/tests/test_check_upstream_updates.py b/tests/test_check_upstream_updates.py index 6eb49a0..a78b4c3 100644 --- a/tests/test_check_upstream_updates.py +++ b/tests/test_check_upstream_updates.py @@ -98,6 +98,22 @@ class DirectCloneFallbackTests(UpstreamCheckerRepoFixture): self.assertNotIn("does not point to the ai-job-search template repo", result.stdout) self.assertIn("up to date with origin/master", result.stdout) + def test_clone_with_lowercased_template_url_falls_back_without_fork_warning(self): + # GitHub serves repo paths case-insensitively, so a clone from + # https://github.com/madslorentzen/ai-job-search is still the template. + subprocess.run( + ["git", "remote", "set-url", "origin", TEMPLATE_URL.lower()], + cwd=self.root, + check=True, + capture_output=True, + ) + + result = self.run_checker("--remote", "upstream") + + self.assertEqual(result.returncode, 0, result.stdout + result.stderr) + self.assertIn("Falling back to 'origin'", result.stdout) + self.assertNotIn("does not point to the ai-job-search template repo", result.stdout) + class UpstreamRemotePresentTests(UpstreamCheckerRepoFixture): def setUp(self): diff --git a/tools/check_upstream_updates.py b/tools/check_upstream_updates.py index f431fcb..0c9a1b1 100755 --- a/tools/check_upstream_updates.py +++ b/tools/check_upstream_updates.py @@ -85,7 +85,8 @@ def main() -> int: # A fork's own 'origin' can never reveal upstream updates: warn so the # user is not misled by the final '[OK]' line below. (Direct clones of # the template repo have origin == the upstream repo, so no warning.) - if remote != args.remote and UPSTREAM_REPO_SLUG not in get_remote_url(remote): + # GitHub serves repo paths case-insensitively, so compare lowercased. + if remote != args.remote and UPSTREAM_REPO_SLUG.lower() not in get_remote_url(remote).lower(): print( f"Warning: Remote '{remote}' does not point to the ai-job-search " f"template repo ({UPSTREAM_REPO_SLUG}), so this check compares your "