Repository navigation
Recognise SSH GitHub remotes when scanning the dev directory [patch] - #471
Merged
Merged
Conversation
IsRemotePathValid accepted only https://github.com/ remotes, so Scan Dev Dir silently dropped every repository cloned over SSH. The scan also derived owner and repo by splitting on '/' and reversing, which a trailing slash broke. GitHubRepository.TryParseRemote now reads owner and repo from the https, scp-style ([email protected]:) and ssh:// forms, with or without .git and a trailing slash, comparing the host ignoring case. Both IsRemotePathValid and the scan use it, and the scan logs each remote it skips. Fixes #441 Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01CaZMWc5xm4vDRcyMefDXyV
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Fixes #441
What changed
GitHubRepository.IsRemotePathValidaccepted only remotes that start withhttps://github.com/(an ordinal comparison). As a result, "Scan Dev Dir" dropped every repository cloned over SSH and logged nothing, even though git operations go through the credential helper and SSH agent precisely so that SSH remotes work. The scan also worked out owner and repo by splitting the remote on/and reversing the parts, so a trailing/produced an empty repo name.New
GitHubRepository.TryParseRemote(remote, out owner, out repo)reads the owner and repo from:https://github.com/o/r[email protected]:o/rssh://[email protected]/o/rEach form is accepted with or without
.gitand a trailing/. The scheme and host are compared ignoring case; the owner and repo are kept as written. Anything other than exactly two non-empty path segments is rejected.IsRemotePathValidand the dev-dir scan both use it. The split-and-reverse parsing is gone.The scan now logs each working tree it skips:
Skipped <dir>: origin <url> is not a GitHub repository.Tests
New
GitHubRemoteTests:EveryGitHubRemoteFormYieldsItsOwnerAndRepositoryhas 13 rows: every form, with and without.gitand/, plus mixed-case hosts.AnythingElseIsNotAGitHubRemotecovers other hosts, a look-alike host (github.com.evil.example), a missing or empty segment, a/tree/mainURL, and a local path.AnSshCloneCreatesAGitHubRepositorychecks thatGitRepository.Createno longer returnsnullfor an scp-style remote.Results:
https://github.com/only, ordinal), 10 of the new cases fail.CloningAnLfsRepositoryRestoresTheFileContentRatherThanThePointer, which fails the same way on unchangedmainin this sandbox.dotnet format --verify-no-changesreports two issues inProjectDirector.cs: import ordering, and IDE0001 near line 1218. Both exist onmainand are outside the lines this PR changes.🤖 Generated with Claude Code
https://claude.ai/code/session_01CaZMWc5xm4vDRcyMefDXyV
Generated by Claude Code