Implements the Git.Command behaviour for git apply.
Applies a patch to files and/or to the index. Supports checking whether a patch applies cleanly, showing diffstat/summary, applying to the index or working tree, reverse application, and three-way merges.
Summary
Types
Functions
Returns the argument list for git apply.
Examples
iex> Git.Commands.Apply.args(%Git.Commands.Apply{patch: "fix.patch"})
["apply", "fix.patch"]
iex> Git.Commands.Apply.args(%Git.Commands.Apply{patch: "fix.patch", check: true})
["apply", "--check", "fix.patch"]
iex> Git.Commands.Apply.args(%Git.Commands.Apply{patch: "fix.patch", stat: true, summary: true})
["apply", "--stat", "--summary", "fix.patch"]
iex> Git.Commands.Apply.args(%Git.Commands.Apply{patch: "fix.patch", cached: true})
["apply", "--cached", "fix.patch"]
iex> Git.Commands.Apply.args(%Git.Commands.Apply{patch: "fix.patch", reverse: true})
["apply", "--reverse", "fix.patch"]
iex> Git.Commands.Apply.args(%Git.Commands.Apply{patch: "fix.patch", three_way: true})
["apply", "--3way", "fix.patch"]
@spec parse_output(String.t(), non_neg_integer()) :: {:ok, :done} | {:ok, String.t()} | {:error, {String.t(), non_neg_integer()}}
Parses the output of git apply.
For stat, summary, or check modes, returns {:ok, output} with the
informational text. For normal apply operations, returns {:ok, :done}.
On failure, returns {:error, {stdout, exit_code}}.