Implements the Git.Command behaviour for git rev-list.
Lists commit objects in reverse chronological order. Supports counting, left-right comparison, ancestry filtering, and various commit-limiting options.
Summary
Types
@type t() :: %Git.Commands.RevList{ all: boolean(), ancestry_path: boolean(), author: String.t() | nil, count: boolean(), first_parent: boolean(), left_right: boolean(), max_count: non_neg_integer() | nil, merges: boolean(), no_merges: boolean(), no_walk: boolean(), objects: boolean(), ref: String.t() | nil, reverse: boolean(), since: String.t() | nil, skip: non_neg_integer() | nil, until_date: String.t() | nil }
Functions
Builds the argument list for git rev-list.
Examples
iex> Git.Commands.RevList.args(%Git.Commands.RevList{ref: "HEAD"})
["rev-list", "HEAD"]
iex> Git.Commands.RevList.args(%Git.Commands.RevList{ref: "HEAD", count: true})
["rev-list", "--count", "HEAD"]
iex> Git.Commands.RevList.args(%Git.Commands.RevList{ref: "main..feature", left_right: true, count: true})
["rev-list", "--count", "--left-right", "main..feature"]
iex> Git.Commands.RevList.args(%Git.Commands.RevList{ref: "HEAD", max_count: 5})
["rev-list", "--max-count=5", "HEAD"]
iex> Git.Commands.RevList.args(%Git.Commands.RevList{all: true})
["rev-list", "--all"]
@spec parse_output(String.t(), non_neg_integer()) :: {:ok, [String.t()] | integer() | map()} | {:error, {String.t(), non_neg_integer()}}
Parses the output of git rev-list.
The output mode depends on the flags used:
- Default: returns
{:ok, [String.t()]}with a list of SHAs - With
count: true: returns{:ok, integer()} - With
left_right: trueandcount: true: returns{:ok, %{left: integer(), right: integer()}}