Skip to content

Commit 101a07a

Browse files
committed
refactor: simplify SSH and HTTPS handling for GitHub URLs
1 parent e9f2073 commit 101a07a

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/apm_cli/deps/github_downloader.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -624,16 +624,15 @@ def _build_repo_url(self, repo_ref: str, use_ssh: bool = False, dep_ref: Depende
624624
if dep_ref is not None:
625625
is_insecure = bool(getattr(dep_ref, "is_insecure", False))
626626
if use_ssh:
627-
# Method 2: SSH fallback
628627
return build_ssh_url(host, repo_ref)
629-
elif is_github and github_token and not is_insecure:
630-
# Method 1: Only send GitHub tokens to GitHub HTTPS hosts
628+
elif is_github and github_token:
629+
# # Only send GitHub tokens to GitHub hosts
631630
return build_https_clone_url(host, repo_ref, token=github_token)
632631
elif is_insecure:
633-
# HTTP direct only: _clone_with_fallback() returns before Method 1/2/3.
632+
# HTTP direct only: _clone_with_fallback() returns.
634633
return f"http://{host}/{repo_ref}.git"
635634
else:
636-
# Method 3: Plain HTTPS, let git credential helpers handle auth
635+
# Generic hosts: plain HTTPS, let git credential helpers handle auth
637636
return build_https_clone_url(host, repo_ref, token=None)
638637

639638
def _clone_with_fallback(self, repo_url_base: str, target_path: Path, progress_reporter=None, dep_ref: DependencyReference = None, verbose_callback=None, **clone_kwargs) -> Repo:

0 commit comments

Comments
 (0)