# `Juggernaut.Engine.Checkout`
[🔗](https://github.com/holsee/juggernaut/blob/v0.4.0/lib/juggernaut/engine/checkout.ex#L1)

What a run records about the checkout it ran in (design notes §7.2): the commit, whether
the tree was dirty, and a hash of the dirt.

Only the run's inputs count (the pathspecs given: a run passes its `paths`, test paths,
`config`, `priv`, `mix.exs`, `mix.lock`, `.juggernaut.exs` and the triage file:
`Juggernaut.Engine.Reuse.checkout_inputs/2`), so a
notes file or a log directory beside the project never makes a run dirty.
`dirty_hash` is the SHA-256 of `git diff HEAD` plus the path and contents of each
untracked file there, so two runs on the same uncommitted work share it. Without git
(or outside a repository) everything is `nil` and the tree counts as clean: the run
still happens, it only records less.

# `t`

```elixir
@type t() :: %{
  commit: String.t() | nil,
  dirty?: boolean(),
  dirty_hash: String.t() | nil
}
```

# `quiet`

```elixir
@spec quiet([String.t()], Path.t()) :: {:ok, String.t()} | {:error, String.t()}
```

Runs git with `args` in `root`, its stderr merged into the output.

# `read`

```elixir
@spec read(Path.t(), Juggernaut.Plan.Git.runner(), [String.t()]) :: t()
```

The checkout facts of the project at `root` for the pathspecs `specs` (default the
whole project), with git run through `git` (by default `quiet/2`: a project outside a
repository is normal here, and git's message about it is not shown).

---

*Consult [api-reference.md](api-reference.md) for complete listing*
