Git.Commands.DiffFiles (git v0.7.0)

Copy Markdown View Source

Implements the Git.Command behaviour for git diff-files.

Compares the files in the working tree against the index. Output is requested with --raw -z and parsed into Git.DiffRawEntry structs.

Summary

Functions

Returns the argument list for git diff-files.

Parses the output of git diff-files --raw -z.

Types

t()

@type t() :: %Git.Commands.DiffFiles{}

Functions

args(diff_files)

@spec args(t()) :: [String.t()]

Returns the argument list for git diff-files.

Examples

iex> Git.Commands.DiffFiles.args(%Git.Commands.DiffFiles{})
["diff-files", "--raw", "-z"]

parse_output(stdout, exit_code)

@spec parse_output(String.t(), non_neg_integer()) ::
  {:ok, [Git.DiffRawEntry.t()]} | {:error, {String.t(), non_neg_integer()}}

Parses the output of git diff-files --raw -z.

On success (exit code 0), returns {:ok, [Git.DiffRawEntry.t()]}. On failure, returns {:error, {stdout, exit_code}}.