Basic reflog support

For now it simply includes reading in the reflog as a list of
entries. This does mean that the drop/append functions don't need to be
wrapped, as we can use erlang's list handling.

It however also means that we cannot write this back out, as there is
currently no way to create an empty reflog that we can fill with our own
list.
This commit is contained in:
Carlos Martín Nieto
2014-02-13 17:19:51 +01:00
parent d9822de604
commit 22ab293910
12 changed files with 127 additions and 12 deletions

View File

@@ -59,11 +59,13 @@ ref_test(Repo) ->
{ok, Ref1} = geef_ref:lookup(Repo, "refs/heads/other"),
{ok, Ref2} = geef_ref:resolve(Ref0),
{ok, Dwimed} = geef_ref:dwim(Repo, "branch"),
{ok, Reflog} = geef_reflog:read(Repo, "refs/heads/branch"),
[?_assertEqual(Ref0#geef_reference.target, Id),
?_assertEqual(Ref1#geef_reference.target, <<"refs/heads/branch">>),
?_assertEqual(<<"branch">>, geef_ref:shorthand(Ref0)),
?_assertEqual(Ref2#geef_reference.target, Id),
?_assertEqual({ok, true}, geef_ref:has_log(Ref0)),
?_assertEqual(1, length(Reflog)),
?_assertEqual(Ref0, Dwimed)].
ref_iter_test(Repo) ->