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

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

Supports starting, marking good/bad commits, skipping, resetting,
viewing the bisect log, and replaying a bisect session.

## Unsupported subcommands

- `visualize` - requires a GUI (gitk) and is not suitable for CLI wrapping.
- `run` - requires script execution which adds complexity beyond simple
  command wrapping. May be added in a future release.

# `t`

```elixir
@type t() :: %Git.Commands.Bisect{
  bad: String.t() | nil | :head,
  good: String.t() | nil | :head,
  log: boolean(),
  new_ref: String.t() | nil,
  old_ref: String.t() | nil,
  replay: String.t() | nil,
  reset: boolean(),
  skip: String.t() | nil | :head,
  start: boolean()
}
```

# `args`

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

Returns the argument list for `git bisect`.

Builds the subcommand and optional ref argument based on the struct fields.

## Examples

    iex> Git.Commands.Bisect.args(%Git.Commands.Bisect{start: true})
    ["bisect", "start"]

    iex> Git.Commands.Bisect.args(%Git.Commands.Bisect{bad: :head})
    ["bisect", "bad"]

    iex> Git.Commands.Bisect.args(%Git.Commands.Bisect{bad: "abc1234"})
    ["bisect", "bad", "abc1234"]

    iex> Git.Commands.Bisect.args(%Git.Commands.Bisect{good: :head})
    ["bisect", "good"]

    iex> Git.Commands.Bisect.args(%Git.Commands.Bisect{reset: true})
    ["bisect", "reset"]

    iex> Git.Commands.Bisect.args(%Git.Commands.Bisect{log: true})
    ["bisect", "log"]

# `parse_output`

```elixir
@spec parse_output(String.t(), non_neg_integer()) ::
  {:ok, Git.BisectResult.t()} | {:error, {String.t(), non_neg_integer()}}
```

Parses the output of `git bisect`.

Returns `{:ok, %Git.BisectResult{}}` on success. The `status` field
indicates the current state of the bisect session. On failure, returns
`{:error, {stdout, exit_code}}`.

---

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