Repository navigation
paths: key an ssh clone whose owner starts with a digit as its https clone - #203
Open
Muhammad Abdullah Butt (1AbdullahButt) wants to merge 1 commit into
Conversation
…s clone `normalize_remote` kept the colon of `git@github.com:42wim/repo.git` because a digit follows it, which it reads as a port. A port can only follow a scheme; in git's scp form the path may start with a digit. So an ssh and an https clone of such a repository got two state keys, and the ssh one the label `github.com:42wim/repo`. Fixes microsoft#202 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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 #202
normalize_remotechanges the colon of an scp remote (git@github.com:owner/repo.git) into a slash, so an ssh clone and an https clone get one state key. It skipped that when a digit follows the colon, to keep a port such asssh://git@host:2222/.... But a port can only come after a scheme. In git's scp form there is no port, and the path may start with a digit: GitHub owners such as1Password,42wimor01-ai. For those, an ssh clone was keyed asgithub.com:42wim/widgetand an https clone asgithub.com/42wim/widget. The two learned apart, and the ssh clone's label wasgithub.com:42wim/widget.This PR keeps the digit check only when the remote had a scheme. Without one, any colon that is not a Windows drive is the scp separator. Remotes with a scheme, Windows paths and
host:/abs/pathkeep their old spelling, so no other key changes.State that an affected ssh clone learned under its old key is not lost.
repos.adoptalready looks up the key thatindex.jsonlast recorded for the checkout, and moves that state to the new key.The test is in
tests/test_live_repos.py, next to the test that clones and worktrees share one key. It checks that an ssh and an https clone of42wim/widgetget the same key and the label42wim/widget, and that a URL with a scheme and a port keeps its port. It also writes state under the old key, records that key inindex.jsonthe way an earlier session would, and checks thatrepos.adoptcarries the state over.How it was produced: Claude Code, an AI coding agent, found the bug by reading
plugin/paths.py. It also wrote the fix and the test. I directed the work.What was checked, on Windows 11 with Python 3.10, on
mainat81e32e5:widget-fdae18ebe0, notwidget-ae7bad507a.tests/test_live_repos.py,tests/test_windows_identity.py,tests/test_repo_key_env.py,tests/test_live_config.pyandtests/test_history_import.pypass.testsrun:python -m pytest testsreports 888 passed, 24 skipped and 0 failed (912 collected). The skips need tools this machine does not have, such as a real Codex, Hermes or opencode CLI. I did not runexperiments/tests.🤖 Generated with Claude Code