Git.PullResult (git v0.4.0)

Copy Markdown View Source

Represents the parsed result of a git pull command.

Contains boolean flags indicating the type of pull that occurred and the raw output string for further inspection.

Summary

Functions

Parses the output of git pull into a Git.PullResult struct.

Types

t()

@type t() :: %Git.PullResult{
  already_up_to_date: boolean(),
  conflicts: boolean(),
  fast_forward: boolean(),
  merge_commit: boolean(),
  raw: String.t()
}

Functions

parse(output)

@spec parse(String.t()) :: t()

Parses the output of git pull into a Git.PullResult struct.

Checks the output for known patterns:

  • "Already up to date" -- no changes pulled
  • "Fast-forward" -- fast-forward merge
  • "Merge made by" -- a merge commit was created
  • "CONFLICT" -- merge conflicts detected

Examples

iex> Git.PullResult.parse("Already up to date.\n")
%Git.PullResult{already_up_to_date: true, fast_forward: false, merge_commit: false, conflicts: false, raw: "Already up to date.\n"}

iex> result = Git.PullResult.parse("Updating abc..def\nFast-forward\n file.txt | 1 +\n")
iex> result.fast_forward
true