Remove geef_ref:target/1, use the record

This commit is contained in:
Carlos Martín Nieto
2013-05-11 04:01:55 +02:00
parent d84338742e
commit 1077a055dc
2 changed files with 3 additions and 7 deletions

View File

@@ -1,6 +1,6 @@
-module(geef_ref). -module(geef_ref).
-export([lookup/2, resolve/1, target/1, name_to_id/2, create/4]). -export([lookup/2, resolve/1, name_to_id/2, create/4]).
-include("geef_records.hrl"). -include("geef_records.hrl").
@@ -40,10 +40,6 @@ resolve(#ref{handle=Handle}) ->
Other Other
end. end.
-spec target(ref()) -> binary() | oid().
target(#ref{target=Target}) ->
Target.
-spec name_to_id(repo(), iolist()) -> {ok, oid()} | {error, binary()}. -spec name_to_id(repo(), iolist()) -> {ok, oid()} | {error, binary()}.
name_to_id(#repo{handle=Handle}, Name) -> name_to_id(#repo{handle=Handle}, Name) ->
case geef_nif:reference_to_id(Handle, Name) of case geef_nif:reference_to_id(Handle, Name) of

View File

@@ -42,8 +42,8 @@ create_ref_test(Repo) ->
{ok, _} = geef_ref:create(Repo, "refs/heads/other", "refs/heads/branch", true), {ok, _} = geef_ref:create(Repo, "refs/heads/other", "refs/heads/branch", true),
{ok, Ref0} = geef_ref:lookup(Repo, "refs/heads/branch"), {ok, Ref0} = geef_ref:lookup(Repo, "refs/heads/branch"),
{ok, Ref1} = geef_ref:lookup(Repo, "refs/heads/other"), {ok, Ref1} = geef_ref:lookup(Repo, "refs/heads/other"),
[?_assertEqual(geef_ref:target(Ref0), Id), [?_assertEqual(Ref0#ref.target, Id),
?_assertEqual(geef_ref:target(Ref1), <<"refs/heads/branch">>)]. ?_assertEqual(Ref1#ref.target, <<"refs/heads/branch">>)].
rm_r(Path) -> rm_r(Path) ->
case filelib:is_dir(Path) of case filelib:is_dir(Path) of