Wrap commit creation in elixir
This commit is contained in:
@@ -1,7 +1,11 @@
|
|||||||
defmodule Geef.Commit do
|
defmodule Geef.Commit do
|
||||||
alias Geef.Object
|
alias Geef.Object
|
||||||
|
alias Geef.Signature
|
||||||
|
alias Geef.Oid
|
||||||
import Object, only: :macros
|
import Object, only: :macros
|
||||||
|
|
||||||
|
@type t :: Object[type: :commit]
|
||||||
|
|
||||||
def lookup(repo, id) do
|
def lookup(repo, id) do
|
||||||
case :geef_commit.lookup(repo, id) do
|
case :geef_commit.lookup(repo, id) do
|
||||||
{:ok, commit} ->
|
{:ok, commit} ->
|
||||||
@@ -15,4 +19,9 @@ defmodule Geef.Commit do
|
|||||||
:geef_commit.tree_id(rebind(commit))
|
:geef_commit.tree_id(rebind(commit))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@type create(pid, Signature.t, Signature.t, iolist, Tree.t, Commit.t, [atom]) :: {:ok, Oid.t} | {:error, term}
|
||||||
|
def create(repo, author = Signature[], committer = Signature[], message, tree, parents, opts // []) do
|
||||||
|
:geef_commit.create(repo, author, committer, message, tree, parents, opts)
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -11,6 +11,8 @@ defrecord Geef.Tree, Record.extract(:geef_object, from: "src/geef_records.hrl")
|
|||||||
|
|
||||||
import Object, only: :macros
|
import Object, only: :macros
|
||||||
|
|
||||||
|
@type t :: Object[type: :commit]
|
||||||
|
|
||||||
def lookup(repo, id) do
|
def lookup(repo, id) do
|
||||||
case :geef_tree.lookup(repo, id) do
|
case :geef_tree.lookup(repo, id) do
|
||||||
{:ok, obj} ->
|
{:ok, obj} ->
|
||||||
|
|||||||
Reference in New Issue
Block a user