Implements the Git.Command behaviour for git show.
When no custom :format or :oneline option is provided, uses ASCII
control-character delimiters (the same technique as Git.Commands.Log)
to reliably parse the commit header into a Git.Commit struct, with
the remaining output captured as diff and stat text.
When a custom format is provided or --oneline is used, the raw output is
returned without structured commit parsing.
Summary
Types
Functions
Builds the argument list for git show.
When no custom format or oneline flag is set, injects a control-character format string to enable structured parsing of the commit header.
Examples
iex> Git.Commands.Show.args(%Git.Commands.Show{})
["show", "--format=\x1e%H\x1f%h\x1f%an\x1f%ae\x1f%aI\x1f%s\x1f%b\x1e", "HEAD"]
iex> Git.Commands.Show.args(%Git.Commands.Show{ref: "abc123", stat: true})
["show", "--format=\x1e%H\x1f%h\x1f%an\x1f%ae\x1f%aI\x1f%s\x1f%b\x1e", "--stat", "abc123"]
iex> Git.Commands.Show.args(%Git.Commands.Show{oneline: true})
["show", "--oneline", "HEAD"]
iex> Git.Commands.Show.args(%Git.Commands.Show{format: "%H %s"})
["show", "--format=%H %s", "HEAD"]
@spec parse_output(String.t(), non_neg_integer()) :: {:ok, Git.ShowResult.t()} | {:error, {String.t(), non_neg_integer()}}
Parses the output of git show.
When structured mode is active (no custom format), parses the commit header using control-character delimiters and captures the remaining output as diff/stat text. In raw mode, wraps the full output in the result struct.
On failure, returns {:error, {stdout, exit_code}}.