diff --git a/lib/geef/commit.ex b/lib/geef/commit.ex index 054baa2..be5642f 100644 --- a/lib/geef/commit.ex +++ b/lib/geef/commit.ex @@ -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 diff --git a/lib/geef/tree.ex b/lib/geef/tree.ex index fb29988..ddb100d 100644 --- a/lib/geef/tree.ex +++ b/lib/geef/tree.ex @@ -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} ->