VulnCheck.Git (VulnCheck v1.0.1)

Copy Markdown View Source

Minimal read-only access to the project's Git repository through the git executable.

Summary

Functions

Files changed between ref and the working tree (including untracked files), relative to root.

Picks the comparison base: the given ref, otherwise origin/main or HEAD~1, whichever exists first.

Returns true when ref resolves to a commit.

Reads path (relative to root) as it was at ref. Returns {:error, :not_found} when the file did not exist there.

Functions

changed_files(root, ref)

@spec changed_files(String.t(), String.t()) :: {:ok, [String.t()]} | {:error, term()}

Files changed between ref and the working tree (including untracked files), relative to root.

default_base(root, ref)

@spec default_base(String.t(), String.t() | nil) ::
  {:ok, String.t()} | {:error, term()}

Picks the comparison base: the given ref, otherwise origin/main or HEAD~1, whichever exists first.

ref?(root, ref)

@spec ref?(String.t(), String.t()) :: boolean()

Returns true when ref resolves to a commit.

show(root, ref, path)

@spec show(String.t(), String.t(), String.t()) :: {:ok, binary()} | {:error, term()}

Reads path (relative to root) as it was at ref. Returns {:error, :not_found} when the file did not exist there.