Implements the Git.Command behaviour for git revert.
Supports reverting one or more commits, aborting an in-progress revert, continuing after conflict resolution, and skipping a commit during a multi-commit revert.
Summary
Types
Functions
Returns the argument list for git revert.
- When
:abortistrue, buildsgit revert --abort. - When
:continue_revertistrue, buildsgit revert --continue. - When
:skipistrue, buildsgit revert --skip. - Otherwise builds
git revert [options] <commits>.
Examples
iex> Git.Commands.Revert.args(%Git.Commands.Revert{commits: ["HEAD"]})
["revert", "HEAD"]
iex> Git.Commands.Revert.args(%Git.Commands.Revert{commits: ["HEAD"], no_commit: true})
["revert", "--no-commit", "HEAD"]
iex> Git.Commands.Revert.args(%Git.Commands.Revert{abort: true})
["revert", "--abort"]
iex> Git.Commands.Revert.args(%Git.Commands.Revert{continue_revert: true})
["revert", "--continue"]
iex> Git.Commands.Revert.args(%Git.Commands.Revert{skip: true})
["revert", "--skip"]
@spec parse_output(String.t(), non_neg_integer()) :: {:ok, Git.RevertResult.t()} | {:ok, :done} | {:error, {String.t(), non_neg_integer()}}
Parses the output of git revert.
For --abort, --continue, and --skip operations (exit code 0), returns
{:ok, :done}. For normal revert operations (exit code 0), parses into a
Git.RevertResult struct. On failure, returns
{:error, {stdout, exit_code}}.