View Source egit - Erlang interface to Git
This project is an Erlang NIF wrapper to libgit2
library.
The project is currently in the alpha stage and more functionality is being added.
installation
Installation
Make sure you have
libgit2
installed.- On Ubuntu run:
sudo apt-get install libgit2-dev
- On Arch Linux run:
sudo pacman -S libgit2
- On Mac OS run:
brew install libgit2
- On Ubuntu run:
If you are building locally from source, clone egit and run:
$ make
For Erlang projects add dependency in
rebar.config
:{deps, [% ... {egit, "~> 0.1"} ]}.
For Elixir projects add dependency in
mix.exs
:def deps do [ egit: "~> 0.1" ] end
usage
Usage
Include To clone a repository, give it a URL and a local path:
1> Repo = egit:clone("http://github.com/saleyn/egit.git", "/tmp").
#Ref<...>
To open a local repository, give it a path:
1> Repo = egit:open(<<".">>).
#Ref<...>
The cloned/opened repository resource is owned by the current process, and will be automatically garbage collected when the current process exits.
After obtaining a repository reference, you can call functions in the
egit
module. E.g.:
2> egit:cat_file(Repo, <<"main">>).
{ok,{commit,#{message => <<"Initial commit\n">>,
author =>
{<<"Serge Aleynikov">>,<<"saleyn@gmail.com">>,1685857770,
-14400},
committer =>
{<<"Serge Aleynikov">>,<<"saleyn@gmail.com">>,1685857770,
-14400},
parents => []}}}
author
Author
Serge Aleynikov saleyn@gmail.com
license
License
Apache 2.0