Wrap commit creation in elixir

This commit is contained in:
Carlos Martín Nieto
2013-11-24 16:34:08 +01:00
parent 3110f37ff7
commit 568f9b2daf
2 changed files with 11 additions and 0 deletions

View File

@@ -1,7 +1,11 @@
defmodule Geef.Commit do
alias Geef.Object
alias Geef.Signature
alias Geef.Oid
import Object, only: :macros
@type t :: Object[type: :commit]
def lookup(repo, id) do
case :geef_commit.lookup(repo, id) do
{:ok, commit} ->
@@ -15,4 +19,9 @@ defmodule Geef.Commit do
:geef_commit.tree_id(rebind(commit))
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

View File

@@ -11,6 +11,8 @@ defrecord Geef.Tree, Record.extract(:geef_object, from: "src/geef_records.hrl")
import Object, only: :macros
@type t :: Object[type: :commit]
def lookup(repo, id) do
case :geef_tree.lookup(repo, id) do
{:ok, obj} ->