Write a few docs

This commit is contained in:
Carlos Martín Nieto
2013-03-31 23:17:51 +02:00
parent 2dcd701c53
commit c2d1acbbe6
3 changed files with 17 additions and 2 deletions

View File

@@ -1,3 +1,6 @@
%%% @private
%%% NIF functions, not to be used directly.
-module(geef).
-export([hex_to_raw/1, reference_list/1,
reference_to_id/2, reference_glob/2, reference_lookup/2, reference_resolve/1,

View File

@@ -1,3 +1,4 @@
%%% @doc Dealing with object names
-module(geef_oid).
-ifdef(TEST).
@@ -8,12 +9,13 @@
-export([parse/1, fmt/1]).
%% @doc Get the hex-encoded hash
-spec fmt(oid()) -> binary().
fmt(#oid{oid=Oid}) ->
geef:oid_fmt(Oid).
-spec parse(binary()) -> oid().
%% @doc Parse an iolist as a hash
-spec parse(iolist()) -> oid().
parse(Sha) ->
Oid = geef:oid_parse(Sha),
#oid{oid=Oid}.

View File

@@ -4,14 +4,18 @@
-include("geef_records.hrl").
%% @doc The repository's git-dir path
-spec path(repo()) -> binary().
path(#repo{handle=Handle}) ->
geef:repository_get_path(Handle).
%% @doc The repository's worktree path
-spec workdir(repo()) -> binary().
workdir(#repo{handle=Handle}) ->
geef:repository_get_workdir(Handle).
%% @doc The repository's current object database. This encompasses all
%% the configured backends.
-spec odb(repo()) -> {ok, odb} | {error, term}.
odb(#repo{handle=Handle}) ->
case geef:repository_get_odb(Handle) of
@@ -21,18 +25,23 @@ odb(#repo{handle=Handle}) ->
Other
end.
%% @doc Whether the repository is bare
-spec is_bare(repo()) -> boolean().
is_bare(#repo{handle=Handle}) ->
geef:repository_is_bare(Handle).
%% @doc List of references in the repository.
-spec references(repo()) -> [binary()].
references(#repo{handle=Handle}) ->
geef:reference_list(Handle).
%% @doc Discover a repository's path from a path contained inside it
-spec discover(iolist()) -> {ok, binary()} | error | {error, term()}.
discover(Path) ->
geef:repository_discover(Path).
%% @doc Open an existing repository. Path must point to the git-dir or
%% worktree
-spec open(iolist()) -> {ok, repo()} | {error, term()}.
open(Path) ->
case geef:repository_open(Path) of
@@ -42,6 +51,7 @@ open(Path) ->
Other
end.
%% @doc Initialize a new repository
-spec init(iolist(), boolean()) -> {ok, repo()} | {error, term()}.
init(Path, Bare) ->
case geef:repository_init(Path, Bare) of