Implements the Git.Command behaviour for git archive.
Creates an archive of files from a named tree. Supports tar, tar.gz, and zip formats.
Limitation: The output option is currently required. When git archive
runs without --output, it writes binary data to stdout which cannot be
reliably captured as a string by System.cmd/3. When output is specified,
git writes directly to the file and stdout is empty.
Summary
Types
Functions
Returns the argument list for git archive.
The tree-ish ref is placed after all flags. Paths are appended after --.
Examples
iex> Git.Commands.Archive.args(%Git.Commands.Archive{})
["archive", "HEAD"]
iex> Git.Commands.Archive.args(%Git.Commands.Archive{format: "zip", output: "out.zip"})
["archive", "--format=zip", "--output=out.zip", "HEAD"]
iex> Git.Commands.Archive.args(%Git.Commands.Archive{prefix: "project/", paths: ["lib/"]})
["archive", "--prefix=project/", "HEAD", "--", "lib/"]
iex> Git.Commands.Archive.args(%Git.Commands.Archive{verbose: true, worktree_attributes: true})
["archive", "-v", "--worktree-attributes", "HEAD"]
@spec parse_output(String.t(), non_neg_integer()) :: {:ok, :done} | {:error, {String.t(), non_neg_integer()}}
Parses the output of git archive.
On success (exit code 0), returns {:ok, :done} since the archive
content is written to the output file.
On failure, returns {:error, {stdout, exit_code}}.