Git.RebaseResult (git v0.4.0)

Copy Markdown View Source

Represents the parsed result of a git rebase command.

Returned by the rebase command on a successful (exit code 0) rebase operation. For abort, continue, and skip operations, {:ok, :done} is returned instead.

Summary

Functions

Parses the output of git rebase into a Git.RebaseResult struct.

Types

t()

@type t() :: %Git.RebaseResult{
  conflicts: boolean(),
  fast_forward: boolean(),
  raw: String.t(),
  up_to_date: boolean()
}

Functions

parse(output)

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

Parses the output of git rebase into a Git.RebaseResult struct.

Checks for known output patterns:

  • "is up to date" -- nothing to rebase
  • "Fast-forwarded" -- the rebase was a fast-forward
  • "CONFLICT" -- merge conflicts were encountered

Examples

iex> Git.RebaseResult.parse("Current branch main is up to date.\n")
%Git.RebaseResult{up_to_date: true, fast_forward: false, conflicts: false, raw: "Current branch main is up to date.\n"}

iex> Git.RebaseResult.parse("Successfully rebased and updated refs/heads/feat.\n")
%Git.RebaseResult{up_to_date: false, fast_forward: false, conflicts: false, raw: "Successfully rebased and updated refs/heads/feat.\n"}