Wrap git_revparse_single

This commit is contained in:
Carlos Martín Nieto
2013-09-05 15:11:32 +02:00
parent 72078cb099
commit 21464aeece
8 changed files with 101 additions and 2 deletions

15
src/geef_revparse.erl Normal file
View File

@@ -0,0 +1,15 @@
-module(geef_revparse).
-include("geef_records.hrl").
-export([single/2]).
-spec single(pid(), iolist()) -> {ok, geef_obj:object()} | {error, term()}.
single(Repo, Str) ->
RepoHandle = geef_repo:handle(Repo),
case geef_nif:revparse_single(RepoHandle, Str) of
{ok, ObjHandle, Type, Id} ->
{ok, #geef_object{type=Type, id=Id, handle=ObjHandle}};
Error = {error, _} ->
Error
end.