Implements the Git.Command behaviour for git merge.
Supports merging a branch, the --no-ff flag to force a merge commit, and
--abort to abort an in-progress merge.
Summary
Types
Functions
Returns the argument list for git merge.
- When
:abortistrue, buildsgit merge --abort. - Otherwise builds
git merge [--no-ff] <branch>.
Examples
iex> Git.Commands.Merge.args(%Git.Commands.Merge{branch: "feature"})
["merge", "feature"]
iex> Git.Commands.Merge.args(%Git.Commands.Merge{branch: "feature", no_ff: true})
["merge", "--no-ff", "feature"]
iex> Git.Commands.Merge.args(%Git.Commands.Merge{abort: true})
["merge", "--abort"]
iex> Git.Commands.Merge.args(%Git.Commands.Merge{branch: "feature", squash: true})
["merge", "--squash", "feature"]
@spec parse_output(String.t(), non_neg_integer()) :: {:ok, Git.MergeResult.t()} | {:ok, :done} | {:error, {String.t(), non_neg_integer()}}
Parses the output of git merge.
For --abort operations (exit code 0), returns {:ok, :done}.
For merge operations (exit code 0), parses into a Git.MergeResult struct.
On failure, returns {:error, {stdout, exit_code}}.