Skip to content

Replace hardcoded git host detection with HTTP protocol probe#298

Merged
0xallam merged 1 commit into
mainfrom
fix/dynamic-repo-url-handling
Feb 1, 2026
Merged

Replace hardcoded git host detection with HTTP protocol probe#298
0xallam merged 1 commit into
mainfrom
fix/dynamic-repo-url-handling

Conversation

@0xallam

@0xallam 0xallam commented Feb 1, 2026

Copy link
Copy Markdown
Member

Summary

  • Remove hardcoded github.com/gitlab.com/bitbucket.org host lists from infer_target_type
  • Detect git repos on any host by querying the standard /info/refs?service=git-upload-pack endpoint
  • Every compliant git server responds with Content-Type: application/x-git-upload-pack-advertisement — one HTTP request, zero hardcoded domains
Remove hardcoded github.com/gitlab.com/bitbucket.org host lists from
infer_target_type. Instead, detect git repositories on any host by
querying the standard /info/refs?service=git-upload-pack endpoint.

Works for any self-hosted git instance.
@greptile-apps

greptile-apps Bot commented Feb 1, 2026

Copy link
Copy Markdown
Contributor

Greptile Overview

Greptile Summary

Removes hardcoded git hosting provider checks (github.com, gitlab.com, bitbucket.org) and replaces them with a protocol-based detection using the standard Git HTTP endpoint /info/refs?service=git-upload-pack. This makes the function more flexible and capable of detecting git repositories on any compliant git server.

Key changes:

  • Added _is_http_git_repo() helper that probes the git upload-pack endpoint
  • Reorganized logic to check git protocol patterns (git@, git://) earlier
  • Added checks for URLs with credentials, .git suffix, and proper path structure before probing
  • For bare strings like github.com/org/repo, now constructs full URL and probes before classification
  • Updated error message to reflect generic git URL patterns instead of specific hosts

Confidence Score: 4/5

  • This PR is safe to merge with minimal risk - it replaces brittle hardcoded logic with a more robust protocol-based approach
  • The implementation properly handles network errors, uses appropriate timeouts, and maintains backward compatibility while extending functionality. The HTTP probe approach is standard and well-tested in git tooling. Score of 4 (not 5) due to the addition of network calls that could introduce latency or timeout issues in production.
  • No files require special attention

Important Files Changed

Filename Overview
strix/interface/utils.py Replaced hardcoded git host detection with HTTP protocol probe using /info/refs?service=git-upload-pack endpoint. Implementation is generally sound with proper error handling.
@0xallam 0xallam merged commit 5a76fab into main Feb 1, 2026
2 checks passed
@0xallam 0xallam deleted the fix/dynamic-repo-url-handling branch February 1, 2026 07:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant