Expand description
Git remotes (SPEC 9.6, 9.8): any git URL, through the system git CLI
run in the store folder. The URL is passed to git unchanged; Surjection
has no host-specific code paths besides the optional gh helper.
git [auth flags] push --progress <url> refs/heads/main:refs/heads/main 'refs/tags/*:refs/tags/*'
git [auth flags] fetch --progress <url> +refs/heads/main:refs/remotes/<name>/main '+refs/tags/*:refs/tags/*'Auth (auth in state/remotes.toml):
system(default): no flags; whatever the user’s git does.gh:-c credential.helper= -c 'credential.helper=!gh auth git-credential'.token:-c credential.helper= -c 'credential.helper=!"<surjection>" git-credential --remote <name>'; the token comes from the OS keyring throughsuper::credential.
No token is ever put in git’s environment or arguments. Git’s own
prompts are off (GIT_TERMINAL_PROMPT=0; stdin is closed anyway);
credential managers with their own windows still work. A git that
prints nothing for IDLE_TIMEOUT is stopped. In a process that hides
console windows (the app, crate::process::hide_console_windows),
ssh runs in batch mode unless the user set their own ssh command
(ssh_batch_mode): a passphrase or host-key prompt nobody could see
fails at once instead of hanging until the idle timeout.
Structs§
- GitCli
- How to reach git and, for
auth = token, this binary. - GitPush
- What a push did.
- Invocation
- One process to run: program, arguments, the complete environment and the working directory. Kept as data so tests can check what a git receives.
- RunOutput
- What a finished (or stopped) process left.
- System
Runner - The real thing: stdin closed, stdout and stderr captured, stopped when
silent for
idle_timeout.
Enums§
- GitAuth
- How a git remote authenticates.
Constants§
- IDLE_
TIMEOUT - A git that prints nothing for this long is stopped (SPEC 9.6).
- SSH_
BATCH_ COMMAND - The ssh command git runs from a process without console windows.
Traits§
- Runner
- Runs processes; tests record or script it.
Functions§
- auth_
args - The
-cflags for the remote’sauth. - fetch
git fetchofmainintorefs/remotes/<name>/mainand of every tag.Nonewhen the remote has nomainyet (a new, empty repository).- git_
not_ found tool_not_foundfor a missing git, as one sentence naming what needs it (#29): the app shows this message on its own, never after the generic “a required program is missing” text.- is_
github_ url - Whether
urlpoints at github.com (whereauth = ghis offered). - locate
gitonPATH. RelativePATHentries are skipped, so a project folder cannot shadow it.- pull
- Fetches and merges the remote’s
main(SPEC 9.9): taggedauto/pre-pull/<ts>when it brings anything; conflicts go tostate/merge/MERGE_STATE.jsonand leave HEAD as it was. - push
git pushofmainand every tag. A non-fast-forward rejection pulls (merges) and retries once (SPEC 9.8); a pull with conflicts stops there withmerge_conflict, and a pull that failed with its own error. Other rejections (a protected branch, a hook) areremote_rejectedat once.- ssh_
batch_ mode GIT_SSH_COMMAND=SSH_BATCH_COMMANDfor a git started without a console window (hiding): ssh then fails at once (“Host key verification failed.”, “Permission denied (publickey).”) where it would ask for a passphrase or a new host key on a console nobody sees. Keys in ssh-agent still work.Nonewhenhidingis off, the program is not git, or the user chose an ssh command of their own (GIT_SSH_COMMANDorGIT_SSHin the environment,core.sshCommandin the arguments, orconfigured()saying git’s config sets it; an unknown answer counts as set).configuredruns only when needed.- url_
scheme_ host - The scheme and host (with port) of
url:https://host:port/path,ssh://user@host/pathor scp-styleuser@host:path(schemessh).Nonefor local paths andfile://.