Implements the Git.Command behaviour for git update-ref.
Updates the object name stored in a ref safely. Supports conditional updates (compare-and-swap), reflog messages, and deletion.
Summary
Types
Functions
Returns the argument list for git update-ref.
Examples
iex> Git.Commands.UpdateRef.args(%Git.Commands.UpdateRef{ref: "refs/heads/main", new_value: "abc123"})
["update-ref", "refs/heads/main", "abc123"]
iex> Git.Commands.UpdateRef.args(%Git.Commands.UpdateRef{ref: "refs/heads/main", new_value: "abc123", old_value: "def456"})
["update-ref", "refs/heads/main", "abc123", "def456"]
iex> Git.Commands.UpdateRef.args(%Git.Commands.UpdateRef{ref: "refs/heads/main", new_value: "abc123", message: "reset"})
["update-ref", "-m", "reset", "refs/heads/main", "abc123"]
iex> Git.Commands.UpdateRef.args(%Git.Commands.UpdateRef{ref: "refs/heads/old", delete: true})
["update-ref", "-d", "refs/heads/old"]
iex> Git.Commands.UpdateRef.args(%Git.Commands.UpdateRef{ref: "HEAD", new_value: "abc123", no_deref: true})
["update-ref", "--no-deref", "HEAD", "abc123"]
iex> Git.Commands.UpdateRef.args(%Git.Commands.UpdateRef{ref: "refs/heads/main", new_value: "abc123", create_reflog: true})
["update-ref", "--create-reflog", "refs/heads/main", "abc123"]
@spec parse_output(String.t(), non_neg_integer()) :: {:ok, :done} | {:error, {String.t(), non_neg_integer()}}
Parses the output of git update-ref.
Always returns {:ok, :done} on success (exit code 0) since
git update-ref produces no meaningful output.
On failure, returns {:error, {stdout, exit_code}}.