The only git subprocess spawner in ancora.
Every git invocation in the library goes through this module. Ancora.Git.BatchPort
is the long-lived cat-file --batch reader; read_blob/2 is the single
function head for base-side blob reads, with per-file git show as the
escape hatch when the run has no batch port.
Summary
Functions
Lists a tree recursively through one ls-tree -r -z subprocess.
Reads one base-side blob.
Runs a git plumbing command against root.
Types
@type git_error() :: {:error, {:git, [String.t()], String.t(), non_neg_integer()}}
Functions
@spec ls_tree_entries(Path.t(), String.t(), [String.t()]) :: {:ok, [%{mode: String.t(), type: String.t(), oid: String.t(), path: String.t()}]} | git_error() | {:error, term()}
Lists a tree recursively through one ls-tree -r -z subprocess.
Each entry is %{mode:, type:, oid:, path:}. Optional pathspecs narrow
the listing. -z keeps paths unquoted so names round-trip byte-identical.
@spec read_blob(Ancora.Derive.RunContext.t(), String.t()) :: {:ok, binary()} | {:error, term()}
Reads one base-side blob.
When the run context owns a BatchPort, the read goes through that port.
When it does not, the same function head falls back to git show <base>:<path>.
Runs a git plumbing command against root.
Returns {:ok, output} or {:error, {:git, args, output, status}}.