# `Git.Status`
[🔗](https://github.com/joshrotenberg/git_wrapper_ex/blob/main/lib/git/status.ex#L1)

Parsed representation of `git status --porcelain=v1 -b` output.

Contains branch tracking information and a list of file entries
with their index and working tree status codes.

# `file_entry`

```elixir
@type file_entry() :: %{index: String.t(), working_tree: String.t(), path: String.t()}
```

# `t`

```elixir
@type t() :: %Git.Status{
  ahead: non_neg_integer(),
  behind: non_neg_integer(),
  branch: String.t() | nil,
  entries: [file_entry()],
  tracking: String.t() | nil
}
```

# `parse`

```elixir
@spec parse(String.t()) :: t()
```

Parses porcelain v1 output (with `-b` flag) into a `Git.Status` struct.

The first line is the branch header: `## branch...tracking [ahead N, behind N]`.
Subsequent lines are file entries in `XY path` format, where X is the index
status and Y is the working tree status.

## Examples

    iex> Git.Status.parse("## main\n?? foo.txt\n")
    %Git.Status{
      branch: "main",
      tracking: nil,
      ahead: 0,
      behind: 0,
      entries: [%{index: "?", working_tree: "?", path: "foo.txt"}]
    }

---

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