Listen to dialyzer
This commit is contained in:
@@ -1,7 +1,5 @@
|
|||||||
defmodule Geef.Commit do
|
defmodule Geef.Commit do
|
||||||
alias Geef.Object
|
use Geef
|
||||||
alias Geef.Signature
|
|
||||||
alias Geef.Oid
|
|
||||||
import Object, only: :macros
|
import Object, only: :macros
|
||||||
|
|
||||||
@type t :: Object[type: :commit]
|
@type t :: Object[type: :commit]
|
||||||
@@ -33,9 +31,9 @@ defmodule Geef.Commit do
|
|||||||
@spec tree!(t) :: Tree.t
|
@spec tree!(t) :: Tree.t
|
||||||
def tree!(commit = Object[type: :commit]), do: tree(commit) |> Geef.assert_ok
|
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}
|
@spec create(pid, Signature.t, Signature.t, iolist, Oid.t, [Oid.t], [:proplists.property()]) :: {:ok, Oid.t} | {:error, term}
|
||||||
def create(repo, author = Signature[], committer = Signature[], message, tree, parents, opts // []) do
|
def create(repo, author = Signature[], committer = Signature[], message, tree, parents, opts // []) do
|
||||||
:geef_commit.create(repo, author, committer, message, tree, parents, opts)
|
:geef_commit.create(repo, Signature.to_erl(author), Signature.to_erl(committer), message, tree, parents, opts)
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -9,4 +9,7 @@ defrecord Geef.Signature, Record.extract(:geef_signature, from: "src/geef_record
|
|||||||
|
|
||||||
defp from_erl(sig), do: set_elem(sig, 0, Geef.Signature)
|
defp from_erl(sig), do: set_elem(sig, 0, Geef.Signature)
|
||||||
|
|
||||||
|
@spec to_erl(t) :: :geef_sig.signature
|
||||||
|
def to_erl(sig), do: set_elem(sig, 0, :geef_signature)
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -34,11 +34,15 @@ create(Repo, Ref, Author = #geef_signature{}, Committer = #geef_signature{}, Enc
|
|||||||
geef_nif:commit_create(Handle, Ref, Author, Committer, Encoding, Message, Tree, Parents).
|
geef_nif:commit_create(Handle, Ref, Author, Committer, Encoding, Message, Tree, Parents).
|
||||||
|
|
||||||
% Common version, accepts ref and encoding as options
|
% Common version, accepts ref and encoding as options
|
||||||
|
-spec create(pid(), geef_sig:signature(), geef_sig:signature(), iolist(), geef_oid:oid(), [geef_oid:oid()],
|
||||||
|
[proplists:property()]) -> {ok, geef_oid:oid()} | {error, term()}.
|
||||||
create(Repo, Author = #geef_signature{}, Committer = #geef_signature{}, Message, Tree, Parents, Opts) ->
|
create(Repo, Author = #geef_signature{}, Committer = #geef_signature{}, Message, Tree, Parents, Opts) ->
|
||||||
Ref = proplists:get_value(update_ref, Opts, undefined),
|
Ref = proplists:get_value(update_ref, Opts, undefined),
|
||||||
Encoding = proplists:get_value(encoding, Opts, undefined),
|
Encoding = proplists:get_value(encoding, Opts, undefined),
|
||||||
create(Repo, Ref, Author, Committer, Encoding, Message, Tree, Parents).
|
create(Repo, Ref, Author, Committer, Encoding, Message, Tree, Parents).
|
||||||
|
|
||||||
|
-spec create(pid(), geef_sig:signature(), geef_sig:signature(), iolist(), geef_oid:oid(), [geef_oid:oid()])
|
||||||
|
-> {ok, geef_oid:oid()} | {error, term()}.
|
||||||
create(Repo, Author = #geef_signature{}, Committer = #geef_signature{}, Message, Tree, Parents) ->
|
create(Repo, Author = #geef_signature{}, Committer = #geef_signature{}, Message, Tree, Parents) ->
|
||||||
create(Repo, Author, Committer, Message, Tree, Parents, []);
|
create(Repo, Author, Committer, Message, Tree, Parents, []);
|
||||||
|
|
||||||
|
|||||||
@@ -175,7 +175,7 @@ index_add(_Handle, _Entry) ->
|
|||||||
index_clear(_Handle) ->
|
index_clear(_Handle) ->
|
||||||
?NIF_FN.
|
?NIF_FN.
|
||||||
|
|
||||||
-spec signature_default(term()) -> {ok, geef_sig:signature()} | {error, term()}.
|
-spec signature_default(term()) -> {ok, binary(), binary(), non_neg_integer(), non_neg_integer()} | {error, term()}.
|
||||||
signature_default(_Repo) ->
|
signature_default(_Repo) ->
|
||||||
?NIF_FN.
|
?NIF_FN.
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user