Implements the Git.Command behaviour for git hash-object.
Computes the object ID for a file and optionally writes it into the object database. Only file-based hashing is supported (no stdin).
Summary
Types
Functions
Returns the argument list for git hash-object.
Examples
iex> Git.Commands.HashObject.args(%Git.Commands.HashObject{file: "README.md"})
["hash-object", "README.md"]
iex> Git.Commands.HashObject.args(%Git.Commands.HashObject{file: "README.md", write: true})
["hash-object", "-w", "README.md"]
iex> Git.Commands.HashObject.args(%Git.Commands.HashObject{file: "README.md", type: "commit"})
["hash-object", "-t", "commit", "README.md"]
iex> Git.Commands.HashObject.args(%Git.Commands.HashObject{file: "README.md", literally: true})
["hash-object", "--literally", "README.md"]
@spec parse_output(String.t(), non_neg_integer()) :: {:ok, String.t()} | {:error, {String.t(), non_neg_integer()}}
Parses the output of git hash-object.
On success (exit code 0), returns {:ok, hash} where hash is the
trimmed SHA string. On failure, returns {:error, {stdout, exit_code}}.