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

@ -154,6 +154,17 @@ export type EngineEventPayload =
repo: unknown;
/** Always true: re-query `git.status`. */
filesChanged: unknown;
}
| {
kind: "gitProgress";
/** Whether a fetch, pull, push or clone runs; unchecked. */
active: unknown;
/** `fetch`, `pull`, `push` or `clone`; unchecked. */
operation?: unknown;
/** The phase of git's latest progress line, or the line; unchecked. */
phase?: unknown;
/** 0–100; unchecked. */
percent?: unknown;
};
/** Callback receiving engine events. */
@ -355,3 +366,20 @@ export async function pickFile(title: string): Promise<RunResult<string | null>>
return { ok: false, error: toEngineError(reason) };
}
}
/**
* Shows the native folder picker of the desktop shell (the "Browse…"
* button of "Clone Repository…").
*
* @param title - the picker's title, from the catalog.
* @returns the chosen folder's absolute path, null when the user cancelled,
* or the error the call failed with (for example outside the shell).
*/
export async function pickDir(title: string): Promise<RunResult<string | null>> {
try {
const value = await invoke<string | null>("pick_dir", { title });
return { ok: true, value: typeof value === "string" ? value : null };
} catch (reason: unknown) {
return { ok: false, error: toEngineError(reason) };
}
}