Git2.Repository (git2_nif v0.1.0)

Copy Markdown

I provide functions for working with repositories.

Summary

Types

t()

I am a handle to a Git repository.

Functions

I enumerate the branches of a repository.

I enumerate the branches of a repository, and may filter this set to either local or remote branches.

I open a Git repository. On success, I return {:ok, handle}.

I parse a revision string to find a single commit object.

I return the state of a repository.

Types

t()

@type t() :: reference()

I am a handle to a Git repository.

Functions

enumerate_branches(repo)

@spec enumerate_branches(t()) :: [
  %{name: String.t(), id: String.t(), type: :local | :remote}
]

I enumerate the branches of a repository.

enumerate_branches(repo, filter)

@spec enumerate_branches(t(), :local | :remote | nil) :: [
  %{name: String.t(), id: String.t(), type: :local | :remote}
]

I enumerate the branches of a repository, and may filter this set to either local or remote branches.

open(path)

@spec open(String.t()) :: {:ok, t()} | {:error, term()}

I open a Git repository. On success, I return {:ok, handle}.

revparse_single_commit(repo, spec)

@spec revparse_single_commit(t(), String.t()) :: {:ok, String.t()} | {:error, term()}

I parse a revision string to find a single commit object.

state(repo)

@spec state(t()) :: atom()

I return the state of a repository.