Skip to content

Document lossy SCP-like SSH URL conversion#2681

Merged
Sebastian Thiel (Byron) merged 2 commits into
mainfrom
lossy-url-conversion
Jun 29, 2026
Merged

Document lossy SCP-like SSH URL conversion#2681
Sebastian Thiel (Byron) merged 2 commits into
mainfrom
lossy-url-conversion

Conversation

@Byron

@Byron Sebastian Thiel (Byron) commented Jun 29, 2026

Copy link
Copy Markdown
Member

Tasks

This section is for Byron only. Models continuing this PR must not add, remove, check, uncheck, rename, or reorder checkboxes here.

  • refackiew

Everything below this line was generated by Codex GPT-5.

Created by Codex on behalf of Byron. Byron will review before this is ready to merge.

Fixes #2467

Summary

This documents that forcing an SCP-like SSH URL into canonical ssh:// form is lossy for the relative /path/repo distinction, and adds unit coverage for the SSH upload-pack invocation path that already matches Git.

Git Baseline

Git's /Users/byron/dev/github.com/git/git/connect.c parses SCP-like SSH URLs with : as the separator, so [email protected]:path/repo yields path/repo, while URL-form ssh://[email protected]/path/repo yields /path/repo. Git then quotes that parsed path into the remote service command.

During commit review, a local fake-SSH check also showed Git invoking git-upload-pack 'path/repo' for the SCP-like relative form and git-upload-pack '/path/repo' for the ssh:// form.

Changes

  • Document the lossy forced-canonical ssh:// serialization behavior on Url::serialize_alternate_form(false).
  • Factor SSH/local command preparation into a private helper used by handshake().
  • Add a focused gix-transport unit test pinning git-upload-pack path arguments for SCP-like and ssh:// forms.

Validation

  • cargo test -p gix-url
  • cargo test -p gix-transport --features blocking-client upload_pack_invocation_preserves_scp_like_path_distinction --lib
  • cargo test -p gix-transport --features blocking-client --lib

Commit Reviews

  • 568b0e6710a83a7f19d860a56d2eda3eae478ad4: Codex review found no actionable issues.
  • 41c070b2eca5e1f824d4011dab7731e9a444a070: Codex review found no actionable issues.

Codex (codex) and others added 2 commits June 29, 2026 15:20
Issue #2467 notes that forcing an SCP-like URL such as `user@host:path/repo`
into canonical `ssh://` form collapses it with `user@host:/path/repo`, even
though the parsed URL path still keeps the distinction.

Git baseline: `git/git/connect.c` parses
SCP-like SSH URLs with `:` as the separator, yielding `path/repo`, while
`ssh://user@host/path/repo` yields `/path/repo`; Git then quotes that parsed
path for the remote service command.

Co-authored-by: Sebastian Thiel <[email protected]>
Add unit coverage for the SSH invocation built by gix-transport so the parsed
repository path distinction is preserved when invoking `git-upload-pack`.

Git baseline: Git's `git/git/connect.c` parses
SCP-like URLs with `:` as the separator and URL-form SSH URLs with `/`, then
quotes the resulting path into the remote service command. A local fake-SSH
check during review showed Git invoking `git-upload-pack 'path/repo'` for
SCP-like relative paths and `git-upload-pack '/path/repo'` for URL-form paths.

Co-authored-by: Sebastian Thiel <[email protected]>
@Byron
Sebastian Thiel (Byron) marked this pull request as ready for review June 29, 2026 07:22
Copilot AI review requested due to automatic review settings June 29, 2026 07:22

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@Byron
Sebastian Thiel (Byron) merged commit b893e01 into main Jun 29, 2026
32 checks passed
@Byron
Sebastian Thiel (Byron) deleted the lossy-url-conversion branch June 29, 2026 07:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SCP-like URL to ssh conversion is lossy

3 participants