# `Git.Commands.Fsck`
[🔗](https://github.com/joshrotenberg/git_wrapper_ex/blob/main/lib/git/commands/fsck.ex#L1)

Implements the `Git.Command` behaviour for `git fsck`.

Verifies the connectivity and validity of objects in the database.
Parses fsck output into a list of issue maps describing dangling,
missing, or broken objects.

# `t`

```elixir
@type t() :: %Git.Commands.Fsck{
  connectivity_only: boolean(),
  dangling: boolean(),
  full: boolean(),
  lost_found: boolean(),
  name_objects: boolean(),
  no_dangling: boolean(),
  no_progress: boolean(),
  no_reflogs: boolean(),
  progress: boolean(),
  root: boolean(),
  strict: boolean(),
  unreachable: boolean(),
  verbose: boolean()
}
```

# `args`

```elixir
@spec args(t()) :: [String.t()]
```

Returns the argument list for `git fsck`.

## Examples

    iex> Git.Commands.Fsck.args(%Git.Commands.Fsck{})
    ["fsck"]

    iex> Git.Commands.Fsck.args(%Git.Commands.Fsck{full: true, strict: true})
    ["fsck", "--full", "--strict"]

    iex> Git.Commands.Fsck.args(%Git.Commands.Fsck{unreachable: true, no_reflogs: true})
    ["fsck", "--unreachable", "--no-reflogs"]

    iex> Git.Commands.Fsck.args(%Git.Commands.Fsck{connectivity_only: true})
    ["fsck", "--connectivity-only"]

    iex> Git.Commands.Fsck.args(%Git.Commands.Fsck{lost_found: true, name_objects: true})
    ["fsck", "--lost-found", "--name-objects"]

# `parse_output`

```elixir
@spec parse_output(String.t(), non_neg_integer()) ::
  {:ok, [map()]} | {:error, {String.t(), non_neg_integer()}}
```

Parses the output of `git fsck`.

On success (exit code 0), parses each line into an issue map with
`:type`, `:object_type`, and `:sha` keys. Lines that do not match the
expected format (e.g. informational messages) are silently ignored.

Returns `{:ok, [map()]}` on success or `{:error, {stdout, exit_code}}`
on failure.

---

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