add Geef.Revwalk module for Elixir

This commit is contained in:
Ramon Snir
2015-07-18 20:36:14 +03:00
committed by Carlos Martín Nieto
parent 01254f2f90
commit 79f89bcd41
11 changed files with 146 additions and 31 deletions

View File

@@ -1,12 +1,33 @@
ExUnit.start
defmodule RepoHelpers do
use Geef
def tmp_bare do
{a, b, c} = :erlang.timestamp()
n = node()
dir = :io_lib.format("geef-~p~p~p~p.git", [n, a, b, c])
path = Path.join(System.tmp_dir!, dir)
{:ok, repo} = Geef.Repository.init(path, true)
{:ok, repo} = Repository.init(path, true)
{repo, path}
end
def tmp_commit_line do
{repo, path} = tmp_bare()
sig = Signature.now("Geef Test", "test@geef")
message = "commit message"
{:ok, idx} = Index.new()
{:ok, empty_index} = Index.write_tree(idx, repo)
{:ok, c} = Commit.create(repo, sig, sig, message, empty_index, [])
{:ok, c} = Commit.create(repo, sig, sig, message, empty_index, [c])
{:ok, c} = Commit.create(repo, sig, sig, message, empty_index, [c])
boring_ancestor = c
{:ok, c} = Commit.create(repo, sig, sig, message, empty_index, [c])
{:ok, c} = Commit.create(repo, sig, sig, message, empty_index, [c])
{:ok, c} = Commit.create(repo, sig, sig, message, empty_index, [c])
head = c
{repo, path, head, boring_ancestor}
end
end