Skip to main content

Module git

Module git 

Source
Expand description

Thin wrappers over the git calls the hooks make.

Structs§

Output
Everything a git command said: its exit code, its stdout and its stderr.

Enums§

Probe
How a bounded network probe ended. Exit codes stay visible because the callers need to keep git’s answers apart: ls-remote --exit-code exits 2 for “connected, no such ref” and 128 for “could not connect”, and reading those as one boolean is how offline got reported as “upstream deleted”.

Functions§

output
A git command’s full result, for the caller that must tell one kind of failure from another.
probe
A git command that TALKS TO THE NETWORK, killed at budget_secs.
stdout
stdout of a git command, trimmed. None when git itself failed — which the hooks treat as “cannot tell, do not block”, never as “empty”.
stdout_in
The same, run inside dir.
stdout_paths
A path list from diff --name-only, diff-tree --name-only or ls-files — commands whose output is meant to be split into individual paths, never just read as one blob.
stdout_piped
stdout of a git command that itself reads a list from stdin — diff-tree --stdin, fed a list of commits, is the only caller today. Lossy but untrimmed: every line is a path, and the caller trims those itself.
stdout_piped_in
As stdout_piped, but inside dir and taking raw bytes.
stdout_piped_raw
As stdout_piped, but returning the RAW bytes.
stdout_raw
Raw stdout, untrimmed and not lossy — for a patch, where a trailing newline and any byte in a binary hunk are load-bearing.
succeeds
True when the command exits 0. Output discarded.