M4.10: remotes: fetch, pull, push, clone and manage remotes

Owner decision D23: Lutra runs fetch, pull (merge or rebase per the new
git.pull.mode setting), push (upstream set on the first push) and clone
through the user's git. Any HTTPS or SSH server works; sign-in stays with
git's credential helper (its own window is allowed for network calls only)
and the ssh agent. Terminal prompts stay off, ext:: is refused, and URL
userinfo is redacted in every message, progress line and remote listing.

- vcs: Call::network with a 30 min timeout, a stderr progress sink and a
  Cancel flag that kills git's process group; remote.rs with clone_repo,
  fetch, pull, push (--porcelain rejections), remotes and add/set-url/
  remove; explained refusals (rejected push, sign-in, host key, not found,
  unreachable, no upstream, local changes, conflicts).
- engine: git.fetch/pull/push/clone/cancel/remotes/remoteAdd/remoteSetUrl/
  remoteRemove, one network call at a time, gitProgress events,
  gitChanged after changes.
- ui: status-bar progress with Cancel and ahead/behind, vcs.fetch/pull/
  push/clone/manageRemotes (Git menu, no default shortcuts), Clone
  Repository and Manage Remotes dialogs; desktop pick_dir IPC.
- Tests against local bare repositories only (vcs 8, engine 3, Vitest 11)
  plus unit and property tests; docs updated.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
danny 2026-10-28 18:29:38 +01:00
parent 48b892a6d5
commit d097558ba5
36 changed files with 4426 additions and 45 deletions

View file

@ -7,12 +7,16 @@
//! - [`Repo`] runs status, stage, unstage, commit, show, branches,
//! checkout and branch creation. Calls that change the repository are
//! serialised per repository.
//! - Remotes (M4.10, owner decision D23): fetch, pull, push, clone and
//! remote management, with progress and cancel; credentials stay with
//! git's credential helper and the ssh agent (see `remote.rs`).
//! - [`RepoWatch`] notices changes inside `.git` (HEAD, index, refs).
//!
//! Every call goes through [`runner::run`]: arguments as an array, never a
//! shell; no terminal or credential prompts; a timeout; capped output;
//! machine-readable output only (porcelain v2, `-z`, NUL-separated
//! formats). No network operation exists here.
//! shell; no terminal prompts (network calls allow the credential helper's
//! own window); a timeout; capped output; machine-readable output only
//! (porcelain v2, `-z`, NUL-separated formats); URL userinfo redacted in
//! messages.
//!
//! Calls block for as long as git runs, so the engine runs them on their
//! own threads, off its lock.
@ -20,6 +24,7 @@
mod error;
pub mod log;
pub mod porcelain;
mod remote;
mod repo;
pub mod runner;
mod watch;
@ -27,8 +32,13 @@ mod watch;
pub use error::VcsError;
pub use log::{CommitDetails, CommitFile, LOG_LIMIT, LogCommit, LogQuery};
pub use porcelain::{FileState, FileStatus, Head, Status, Version};
pub use remote::{
MAX_URL_LEN, Network, PullMode, Pushed, Remote, check_remote_name, check_url, explain,
parse_progress,
};
pub use repo::{
Branch, Branches, CommitInfo, Contents, FILE_CAP, Git, MIN_VERSION, Repo, Rev, STATUS_CAP,
decode,
};
pub use runner::{Cancel, ProgressSink, redact_urls};
pub use watch::{RepoWatch, fingerprint};