ExGit (ex_git v0.11.0)
The shim between elixir and rust that gets overloaded
You can see more examples in the tests but here is a quick example:
clone_prefix = "/tmp/example_git"
# init bare repo
{:ok, _} = ExGit.init_bare(clone_prefix <> "init_bare")
# clone to another directory
assert {:ok, "clone success"} ==
ExGit.clone(clone_prefix <> "init_bare", clone_prefix <> "push_a")
# clone another copy
assert {:ok, "clone success"} ==
ExGit.clone(clone_prefix <> "init_bare", clone_prefix <> "push_b")
# commit to a
:ok = File.write(clone_prefix <> "push_a/test.txt", "123")
ExGit.add_commit(clone_prefix <> "push_a", "push 123")
# push back changes so b can see it
assert {:ok, "Pushed Successfully"} == ExGit.push_remote(clone_prefix <> "push_a", "master")
# pull to check the file from b
assert {:ok, "Updated"} ==
ExGit.fast_forward(clone_prefix <> "push_b", "master")
assert {:ok, "Up to date already"} ==
ExGit.fast_forward(clone_prefix <> "push_b", "master")
Link to this section Summary
Link to this section Functions
Link to this function
add_commit(destination, commit_message)
Link to this function
checkout_branch(destination, branch)
Link to this function
clone(to_clone, destination)
Link to this function
fast_forward(destination, branch)
Link to this function
init(destination)
Link to this function
init_bare(destination)
Link to this function
latest_message(destination)
Link to this function
list_references(path)
Link to this function
list_references_rust(path)
Link to this function