Merge branch 'create-commit'

This commit is contained in:
Carlos Martín Nieto
2013-11-24 16:34:54 +01:00
10 changed files with 237 additions and 2 deletions

View File

@@ -1,5 +1,7 @@
defmodule Geef.Commit do
alias Geef.Object
alias Geef.Signature
alias Geef.Oid
import Object, only: :macros
@type t :: Object[type: :commit]
@@ -31,4 +33,9 @@ defmodule Geef.Commit do
@spec tree!(t) :: Tree.t
def tree!(commit = Object[type: :commit]), do: tree(commit) |> Geef.assert_ok
@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} ->