Ancora.BaseView (ancora v1.0.0)

Copy Markdown View Source

Materializes a git ref's blobs via ls-tree and Ancora.Git.read_blob/2. Parsing of those files is a later stage's job.

Ported from SpecLedEx.BaseView; git plumbing lives in Ancora.Git.

Summary

Functions

Reads every blob under base (optionally narrowed by :pathspecs) into a %{path => content} map.

Writes blobs/3 into an isolated temp workspace and returns its path.

Functions

blobs(source, base \\ nil, opts \\ [])

@spec blobs(Ancora.Derive.RunContext.t() | Path.t(), String.t() | nil, keyword()) ::
  {:ok, %{required(String.t()) => binary()}} | {:error, term()}

Reads every blob under base (optionally narrowed by :pathspecs) into a %{path => content} map.

Every blob goes through Git.read_blob/2: the run's batch port when present, otherwise per-file git show. A repo path (no run context) does not open an ephemeral batch port.

materialize(source, base \\ nil, opts \\ [])

@spec materialize(
  Ancora.Derive.RunContext.t() | Path.t(),
  String.t() | nil,
  keyword()
) ::
  {:ok, Path.t()} | {:error, term()}

Writes blobs/3 into an isolated temp workspace and returns its path.

The caller owns cleanup.