Implement SSH upload-pack fetches

This commit is contained in:
2026-08-25 20:31:10 +02:00
parent 5dbda4bbd2
commit 051e14235f
9 changed files with 1367 additions and 53 deletions

View File

@@ -60,6 +60,26 @@ commands. SHA-1 host signatures and `ssh-rsa` authentication are excluded.
Cancellation interrupts connection and authentication without changing Git,
known hosts, or secure storage.
## SSH upload-pack
With the same feature enabled, branch discovery, clone, fetch, and pull open a
session channel without a PTY and request only `git-upload-pack '<path>'`.
Storage single-quotes the repository as one shell argument, preserving the
absolute, account-relative, and tilde path semantics of the two supported SSH
URL forms while preventing whitespace, quotes, metacharacters, environment
assignments, or options from selecting another command. No local Git, SSH,
shell, transport helper, or fetch-pack process is involved.
The channel is a bounded adapter into gix's existing pack-protocol client.
Stdout carries only protocol bytes; stderr is retained only as a bounded,
single-line remote-service diagnostic. Storage requires a zero exit status and
clean channel completion, distinguishes malformed advertisements and packs from
network, trust, authentication, service, and cancellation failures, and closes
the channel promptly when cancellation is requested. Gix continues to own pack
verification, object limits, and atomic ref updates, while the existing
IronStorage code continues to own clone staging, checkout, merge, conflict, and
rollback behavior.
Pull refuses a dirty worktree. It fast-forwards when possible and otherwise
uses the embedded three-way tree merge. Unresolved paths are returned as typed
`MergeConflicts`; no conflict markers or partial checkout are written. Checkout
@@ -72,7 +92,9 @@ Commit signing is optional. The embedded OpenPGP key store signs the canonical
unsigned commit bytes and adds an ASCII-armored `gpgsig` header compatible with
Git/GPG without invoking `gpg`.
The smart-HTTP boundary is injectable for deterministic compatibility tests.
Tests can inspect credentials, advertisements, receive-pack commands, object
counts, pack checksums, non-fast-forward behavior, and server status without a
runtime helper or external Git installation.
The transport boundary is injectable for deterministic compatibility tests.
HTTPS tests inspect credentials, advertisements, receive-pack commands, object
counts, pack checksums, non-fast-forward behavior, and server status. SSH tests
use a pure-Rust in-process Russh server and upload-pack fixture to exercise
chunked reference and pack streams, end-to-end clone/fetch/pull, command
quoting, cancellation, and rollback without an external Git or SSH executable.