Ragex.Git.Blame (Ragex v0.18.2)

View Source

High-level git blame API.

Provides line-level authorship information with optional PR enrichment. Delegates to the active backend (Egit or CLI).

Examples

# Blame an entire file
{:ok, entries} = Ragex.Git.Blame.file("/opt/project", "lib/user.ex")

# Blame a specific line range
{:ok, entries} = Ragex.Git.Blame.file("/opt/project", "lib/user.ex",
  start_line: 10, end_line: 20)

# Blame with PR enrichment
{:ok, entries} = Ragex.Git.Blame.file("/opt/project", "lib/user.ex",
  start_line: 42, enrich_pr: true)

Summary

Functions

Blame a file (or line range) and return per-line authorship.

Group consecutive blame entries by commit SHA for compact display.

Functions

file(path, file_path, opts \\ [])

@spec file(String.t(), String.t(), keyword()) ::
  {:ok, [Ragex.Git.BlameEntry.t() | map()]} | {:error, term()}

Blame a file (or line range) and return per-line authorship.

Options

  • :start_line -- first line (1-indexed)
  • :end_line -- last line (default: same as start_line if start given)
  • :enrich_pr -- if true, attempt to find the PR for each blame SHA

Returns

{:ok, entries} where each entry is a %BlameEntry{}, optionally enriched with :pr_number and :pr_title in a wrapper map.

group_by_commit(entries)

@spec group_by_commit([Ragex.Git.BlameEntry.t()]) :: [map()]

Group consecutive blame entries by commit SHA for compact display.

Returns a list of %{sha, author, email, date, summary, start_line, end_line, line_count}.