Git.ShortlogEntry (git v0.4.0)

Copy Markdown View Source

Parsed representation of a git shortlog entry.

Contains the author name, optional email, commit count, and list of commit subjects (empty when summary: true is used).

Summary

Functions

Parses full (non-summary) shortlog output into entries with commit lists.

Parses the output of git shortlog into a list of Git.ShortlogEntry structs.

Types

t()

@type t() :: %Git.ShortlogEntry{
  author: String.t(),
  commits: [String.t()],
  count: non_neg_integer(),
  email: String.t() | nil
}

Functions

parse_full(output)

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

Parses full (non-summary) shortlog output into entries with commit lists.

parse_summary(output)

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

Parses the output of git shortlog into a list of Git.ShortlogEntry structs.

Handles both summary mode (-s) and full mode output.

Summary mode lines have the form:

count\tAuthor Name
count\tAuthor Name <email>

Full mode output has the form:

Author Name (count):
      commit subject 1
      commit subject 2

Examples

iex> Git.ShortlogEntry.parse_summary("     3\tAlice\n     1\tBob\n")
[
  %Git.ShortlogEntry{author: "Alice", email: nil, count: 3, commits: []},
  %Git.ShortlogEntry{author: "Bob", email: nil, count: 1, commits: []}
]

iex> Git.ShortlogEntry.parse_summary("")
[]