Implements the Git.Command behaviour for git update-index.
Populates and modifies the index directly. :cacheinfo inserts a
{mode, object, path} entry without a working-tree file (pairs with
write-tree/mktree to assemble arbitrary trees), and the
:assume_unchanged / :skip_worktree bits hide local changes to tracked
files.
:index_info reads the bulk index-info format on stdin, so that mode needs
the default Git.Runner.Forcola runner; under Git.Runner.SystemCmd it
returns {:error, :stdin_unsupported}.
Summary
Functions
Returns the argument list for git update-index.
Returns the --index-info stdin payload when set, otherwise nil.
Parses the output of git update-index.
Types
Functions
Returns the argument list for git update-index.
Examples
iex> Git.Commands.UpdateIndex.args(%Git.Commands.UpdateIndex{add: true, files: ["a.txt"]})
["update-index", "--add", "--", "a.txt"]
iex> Git.Commands.UpdateIndex.args(%Git.Commands.UpdateIndex{cacheinfo: [{"100644", "abc123", "f.txt"}]})
["update-index", "--cacheinfo", "100644,abc123,f.txt"]
iex> Git.Commands.UpdateIndex.args(%Git.Commands.UpdateIndex{skip_worktree: true, files: ["cfg"]})
["update-index", "--skip-worktree", "--", "cfg"]
iex> Git.Commands.UpdateIndex.args(%Git.Commands.UpdateIndex{index_info: true})
["update-index", "--index-info"]
Returns the --index-info stdin payload when set, otherwise nil.
@spec parse_output(String.t(), non_neg_integer()) :: {:ok, :done} | {:error, {String.t(), non_neg_integer()}}
Parses the output of git update-index.
On success (exit code 0), returns {:ok, :done}. On failure, returns
{:error, {stdout, exit_code}}.