diff --git a/src/geef_repo.erl b/src/geef_repo.erl index 7037217..d3d8ff6 100644 --- a/src/geef_repo.erl +++ b/src/geef_repo.erl @@ -116,7 +116,7 @@ handle_call({lookup_object, Oid}, _From, State = #state{handle=Handle}) -> Reply = geef:object_lookup(Handle, Oid), {reply, Reply, State}; handle_call(stop, _From, State) -> - {stop, normal, State}; + {stop, normal, ok, State}; handle_call(revwalk, _From, State = #state{handle=Handle}) -> Reply = handle_revwalk(Handle), {reply, Reply, State}; diff --git a/src/geef_revwalk.erl b/src/geef_revwalk.erl index dd0308d..adf8ca8 100644 --- a/src/geef_revwalk.erl +++ b/src/geef_revwalk.erl @@ -12,7 +12,7 @@ %% API -export([start_link/1]). --export([push/2, hide/2, next/1, sorting/2]). +-export([push/2, hide/2, next/1, sorting/2, stop/1]). %% gen_server callbacks -export([init/1, handle_call/3, handle_cast/2, handle_info/2, @@ -49,6 +49,10 @@ sorting(Pid, Opt) when is_atom(Opt) -> next(Pid) -> gen_server:call(Pid, next). +%% @doc Stop the revwalk server +stop(Pid) -> + gen_server:call(Pid, stop). + %%-------------------------------------------------------------------- %% @doc %% Starts the server @@ -79,7 +83,9 @@ handle_call({hide, Oid}, _From, State = #state{handle=Handle}) -> {reply, Reply, State}; handle_call(next, _From, State = #state{handle=Handle}) -> Reply = handle_next(Handle), - {reply, Reply, State}. + {reply, Reply, State}; +handle_call(stop, _From, State) -> + {stop, normal, ok, State}. %% @private handle_cast(_Msg, State) -> diff --git a/test/repo_test.erl b/test/repo_test.erl index d647fa4..679d878 100644 --- a/test/repo_test.erl +++ b/test/repo_test.erl @@ -22,5 +22,5 @@ odb_write_test(Repo) -> Expected = geef_oid:parse("c300118399f01fe52b316061b5d32beb27e0adfd"), [?_assertEqual(Actual, Expected)]. -stop(_Repo) -> - ok. +stop(Repo) -> + geef_repo:stop(Repo). diff --git a/test/revwalk_test.erl b/test/revwalk_test.erl index 8d0b87c..79334ac 100644 --- a/test/revwalk_test.erl +++ b/test/revwalk_test.erl @@ -28,7 +28,9 @@ amount_test(Repo) -> {ok, Walk} = geef_repo:revwalk(Repo), Id = geef_oid:parse("a4a7dce85cf63874e984719f4fdd239f5145052f"), ok = geef_revwalk:push(Walk, Id), - [?_assertEqual(6, count_walk(Walk, 0))]. + Count = count_walk(Walk, 0), + geef_revwalk:stop(Walk), + [?_assertEqual(6, Count)]. -stop(_Repo) -> - ok. +stop(Repo) -> + geef_repo:stop(Repo).