Git.Commands.VerifyCommit (git v0.4.0)

Copy Markdown View Source

Implements the Git.Command behaviour for git verify-commit.

Verifies the GPG signature of a commit object.

Summary

Functions

Returns the argument list for git verify-commit.

Parses the output of git verify-commit.

Types

t()

@type t() :: %Git.Commands.VerifyCommit{
  commit: String.t() | nil,
  raw: boolean(),
  verbose: boolean()
}

Functions

args(command)

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

Returns the argument list for git verify-commit.

Examples

iex> Git.Commands.VerifyCommit.args(%Git.Commands.VerifyCommit{commit: "HEAD"})
["verify-commit", "HEAD"]

iex> Git.Commands.VerifyCommit.args(%Git.Commands.VerifyCommit{commit: "HEAD", verbose: true})
["verify-commit", "-v", "HEAD"]

iex> Git.Commands.VerifyCommit.args(%Git.Commands.VerifyCommit{commit: "HEAD", raw: true})
["verify-commit", "--raw", "HEAD"]

iex> Git.Commands.VerifyCommit.args(%Git.Commands.VerifyCommit{commit: "abc123", verbose: true, raw: true})
["verify-commit", "-v", "--raw", "abc123"]

parse_output(stdout, exit_code)

@spec parse_output(String.t(), non_neg_integer()) ::
  {:ok, map()} | {:error, {String.t(), non_neg_integer()}}

Parses the output of git verify-commit.

Exit code 0 means the commit has a valid GPG signature. Exit code 1 means the signature is bad or missing. Other exit codes are treated as errors.