ExGitEngine.GitRepo protocol (ex_git_engine v0.9.1)

Copy Markdown

Protocol for implementing access to Git repositories.

Summary

Functions

Returns the agent for the given repo.

Validates ref updates before they are applied (pre-push hook). Called before push_cmds to allow custom validation logic. Return :ok to allow, {:error, reason} to reject the push. Optional callback - defaults to always allowing.

Executes after refs have been updated (post-push hook). Can optionally return advisory messages to send to the client. Returns {:ok, repo} or {:ok, repo, advisories :: [binary]} or {:error, term}

Types

t()

@type t() :: term()

Functions

get_agent(repo)

@spec get_agent(t()) :: {:ok, ExGitEngine.GitAgent.agent()} | {:error, term()}

Returns the agent for the given repo.

pre_push(repo, cmds)

@spec pre_push(t(), [ExGitEngine.WireProtocol.ReceivePack.cmd()]) ::
  :ok | {:error, binary()}

Validates ref updates before they are applied (pre-push hook). Called before push_cmds to allow custom validation logic. Return :ok to allow, {:error, reason} to reject the push. Optional callback - defaults to always allowing.

push(repo, cmds)

@spec push(t(), [ExGitEngine.WireProtocol.ReceivePack.cmd()]) ::
  {:ok, t()} | {:ok, t(), [binary()]} | {:error, term()}

Executes after refs have been updated (post-push hook). Can optionally return advisory messages to send to the client. Returns {:ok, repo} or {:ok, repo, advisories :: [binary]} or {:error, term}