Git.Commands.Rerere (git v0.4.0)

Copy Markdown View Source

Implements the Git.Command behaviour for git rerere.

Reuse recorded resolution of conflicted merges. Supports the status, diff, clear, forget, gc, and remaining subcommands.

Summary

Functions

Returns the argument list for git rerere.

Parses the output of git rerere.

Types

t()

@type t() :: %Git.Commands.Rerere{
  clear: boolean(),
  diff: boolean(),
  forget: String.t() | nil,
  gc: boolean(),
  remaining: boolean(),
  status: boolean()
}

Functions

args(rerere)

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

Returns the argument list for git rerere.

Examples

iex> Git.Commands.Rerere.args(%Git.Commands.Rerere{})
["rerere", "status"]

iex> Git.Commands.Rerere.args(%Git.Commands.Rerere{status: true})
["rerere", "status"]

iex> Git.Commands.Rerere.args(%Git.Commands.Rerere{diff: true})
["rerere", "diff"]

iex> Git.Commands.Rerere.args(%Git.Commands.Rerere{clear: true})
["rerere", "clear"]

iex> Git.Commands.Rerere.args(%Git.Commands.Rerere{forget: "path/to/file"})
["rerere", "forget", "path/to/file"]

iex> Git.Commands.Rerere.args(%Git.Commands.Rerere{gc: true})
["rerere", "gc"]

iex> Git.Commands.Rerere.args(%Git.Commands.Rerere{remaining: true})
["rerere", "remaining"]

parse_output(stdout, exit_code)

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

Parses the output of git rerere.

  • For status and remaining modes, returns {:ok, [String.t()]} with a list of file paths.
  • For diff mode, returns {:ok, String.t()} with raw diff output.
  • For clear, forget, and gc modes, returns {:ok, :done}.