Implements the Git.Command behaviour for git add.
Builds git add [flags] [-- <paths>]. Flags and a pathspec compose, so a
path can be staged together with any of --all, --update, --force,
--dry-run, --intent-to-add, --renormalize, and --chmod.
Summary
Types
Functions
Returns the argument list for git add.
Emits the enabled flags followed by the pathspec, so flags and files compose
(unlike the previous behavior, where :all dropped :files).
Examples
iex> Git.Commands.Add.args(%Git.Commands.Add{all: true})
["add", "--all"]
iex> Git.Commands.Add.args(%Git.Commands.Add{files: ["foo.txt", "bar.txt"]})
["add", "foo.txt", "bar.txt"]
iex> Git.Commands.Add.args(%Git.Commands.Add{update: true, files: ["lib"]})
["add", "--update", "lib"]
iex> Git.Commands.Add.args(%Git.Commands.Add{intent_to_add: true, files: ["new.ex"]})
["add", "--intent-to-add", "new.ex"]
iex> Git.Commands.Add.args(%Git.Commands.Add{chmod: "+x", files: ["run.sh"]})
["add", "--chmod=+x", "run.sh"]
@spec parse_output(String.t(), non_neg_integer()) :: {:ok, :done} | {:error, {String.t(), non_neg_integer()}}
Parses the output of git add.
On success (exit code 0), returns {:ok, :done}. On failure, returns
{:error, {stdout, exit_code}}.