From 345048301c5306201bdc697fd65aaca56c39ed16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mart=C3=ADn=20Nieto?= Date: Mon, 21 Jan 2013 12:22:41 +0100 Subject: [PATCH] Paremetrize reference --- ebin/geef.app | 5 ++++- src/reference.erl | 9 +++++++++ src/repository.erl | 10 +++++++++- 3 files changed, 22 insertions(+), 2 deletions(-) create mode 100644 src/reference.erl diff --git a/ebin/geef.app b/ebin/geef.app index 999ac22..179e61c 100644 --- a/ebin/geef.app +++ b/ebin/geef.app @@ -3,7 +3,10 @@ {description, ""}, {vsn, "0.0.1"}, {modules, [ - geef, repository, odb + geef, + repository, + odb, + reference ]}, {registered, []}, {applications, [ diff --git a/src/reference.erl b/src/reference.erl new file mode 100644 index 0000000..e0a6b4c --- /dev/null +++ b/src/reference.erl @@ -0,0 +1,9 @@ +-module(reference, [Handle]). +-export([resolve/0]). + +resolve() -> + case geef:reference_resolve(Handle) of + {ok, Ref} -> + reference:new(Ref); + other -> other + end. diff --git a/src/repository.erl b/src/repository.erl index e977d2d..1510859 100644 --- a/src/repository.erl +++ b/src/repository.erl @@ -1,5 +1,5 @@ -module(repository, [Handle]). --export([path/0, workdir/0, bare/0, references/0]). +-export([path/0, workdir/0, bare/0, references/0, odb/0, lookup/1]). path() -> geef:repository_get_path(Handle). @@ -20,3 +20,11 @@ odb() -> other -> other end. + +lookup(Refname) -> + case geef:repositiory_lookup_reference(Handle, Refname) of + {ok, Ref} -> + reference:new(Ref); + other -> + other + end.