Skip to main content

Module ssh

Module ssh 

Source
Expand description

Pure-Rust git-over-SSH (via russh) — no ssh subprocess, honoring nornir’s no-shellout rule (gix’s own SSH transport execs ssh, which is why crate::gitio refuses SSH and defers here).

Implemented:

  • ls-remote — connect, authenticate with the nornir ed25519 deploy key, run git-upload-pack '<path>', and parse the server’s ref advertisement (pkt-line) into (sha, refname) pairs. The cheap poll primitive.
  • pack transfer (fetch/clone)connect_upload_pack execs git-upload-pack and exposes the channel as blocking Read/Write (bridged from russh’s async channel via tokio_util’s SyncIoBridge). crate::gitio hands that to gix’s blocking git transport (ConnectMode::Process), so gix drives the full object negotiation and pack indexing — no ssh/git subprocess, no hand-rolled packfile code.

Not yet: git-receive-pack (SSH push). The URL- and pkt-line parsers below are transport-agnostic and unit-tested.

Structs§

SshLocation
A parsed SSH git location.
UploadPack
An authenticated git-upload-pack channel exposed as blocking Read/Write.

Functions§

connect_upload_pack
Open an authenticated git-upload-pack channel to loc and return it as blocking I/O for gix’s transport. See UploadPack.
ls_remote
ls-remote over SSH: connect to loc, run git-upload-pack, and return the advertised refs (reading only the initial ref advertisement — no negotiation).
ls_remote_blocking
Blocking wrapper for the sync fetch/poll path: spins a small current-thread runtime and runs ls_remote.
parse_ref_advertisement
Parse a git smart-protocol ref advertisement (the bytes a server emits right after git-upload-pack) into (sha, refname) pairs.
parse_ssh_url
Parse git@host:owner/repo(.git) (scp-like) or ssh://[user@]host[:port]/path into an SshLocation. Defaults: user git, port 22.