Add a minimum of config

This lets us revive the reflog test by letting us set
core.logallrefupdates to true.
This commit is contained in:
Carlos Martín Nieto
2014-05-18 12:03:53 +02:00
parent 688c052f6d
commit 98b176c925
6 changed files with 62 additions and 3 deletions

View File

@@ -15,6 +15,7 @@
reference_dwim/2, handle/1, iterator/2]).
-export([reference_has_log/2]).
-export([reflog_read/2, reflog_delete/2]).
-export([config/1]).
-include("geef_records.hrl").
-record(state, {handle}).
@@ -79,6 +80,10 @@ references(Pid) ->
lookup_object(Pid, Oid) ->
gen_server:call(Pid, {lookup_object, Oid}).
%% @doc Get the repository's configuration
config(Pid) ->
gen_server:call(Pid, config).
%% @private
-spec iterator(pid(), iolist() | undefined) -> {ok, geef_ref:iterator()} | {error, term()}.
iterator(Pid, Regexp) ->
@@ -158,6 +163,11 @@ handle_call({reflog_delete, Name}, _From, State = #state{handle=Handle}) ->
Reply = geef_nif:reflog_delete(Handle, Name),
{reply, Reply, State};
handle_call(config, _From, State = #state{handle=Handle}) ->
Reply = handle_config(Handle),
{reply, Reply, State};
handle_call(stop, _From, State) ->
{stop, normal, ok, State};
handle_call(revwalk, _From, State = #state{handle=Handle}) ->
@@ -212,3 +222,11 @@ handle_revwalk(Handle) ->
Error ->
Error
end.
handle_config(Handle) ->
case geef_nif:repository_get_config(Handle) of
{ok, ConfigHandle} ->
geef_config:start_link(ConfigHandle);
Error ->
Error
end.