Implements the Git.Command behaviour for git push.
Supports pushing to a remote with options for force push, upstream tracking, tags, delete, dry run, and more.
Summary
Types
Functions
Returns the argument list for git push.
Builds the argument list from the struct fields. Boolean flags are appended
when set to true. The remote and branch positional arguments are
appended at the end when present.
Examples
iex> Git.Commands.Push.args(%Git.Commands.Push{})
["push"]
iex> Git.Commands.Push.args(%Git.Commands.Push{remote: "origin", branch: "main"})
["push", "origin", "main"]
iex> Git.Commands.Push.args(%Git.Commands.Push{remote: "origin", set_upstream: true, branch: "feature"})
["push", "-u", "origin", "feature"]
iex> Git.Commands.Push.args(%Git.Commands.Push{force: true, tags: true})
["push", "--force", "--tags"]
@spec parse_output(String.t(), non_neg_integer()) :: {:ok, :done} | {:error, {String.t(), non_neg_integer()}}
Parses the output of git push.
On success (exit code 0), returns {:ok, :done}. On failure, returns
{:error, {stdout, exit_code}}.