#git

git2

Bindings to libgit2 for interoperating with git repositories. This library is both threadsafe and memory safe and allows both reading and writing git repositories.

68 releases

0.7.5 Aug 2, 2018
0.7.4 Jul 30, 2018
0.7.1 Mar 22, 2018
0.6.10 Dec 20, 2017
0.0.1 Nov 14, 2014

#1 in #git

Download history 13540/week @ 2018-09-18 13651/week @ 2018-09-25 14356/week @ 2018-10-02 14134/week @ 2018-10-09 15311/week @ 2018-10-16 13474/week @ 2018-10-23 14629/week @ 2018-10-30 14326/week @ 2018-11-06 13998/week @ 2018-11-13 14632/week @ 2018-11-20 15211/week @ 2018-11-27 13638/week @ 2018-12-04 13691/week @ 2018-12-11

53,619 downloads per month
Used in 174 crates (124 directly)

MIT/Apache

4MB
106K SLoC

C 91K SLoC // 0.1% comments Rust 15K SLoC // 0.2% comments Shell 252 SLoC // 0.1% comments

git2-rs

Build Status Build Status

Documentation

libgit2 bindings for Rust

[dependencies]
git2 = "0.7"

Version of libgit2

Currently this library requires libgit2 0.25.1. The source for libgit2 is included in the libgit2-sys crate so there's no need to pre-install the libgit2 library, the libgit2-sys crate will figure that and/or build that for you.

Building git2-rs

$ git clone https://github.com/alexcrichton/git2-rs
$ cd git2-rs
$ cargo build

Automating Testing

Running tests and handling all of the associated edge cases on every commit proves tedious very quickly. To automate tests and handle proper stashing and unstashing of unstaged changes and thus avoid nasty surprises, use the pre-commit hook found here and place it into the .git/hooks/ with the name pre-commit. You may need to add execution permissions with chmod +x.

To skip tests on a simple commit or doc-fixes, use git commit --no-verify.

Building on OSX 10.10+

If the ssh feature is enabled (and it is by default) then this library depends on libssh2 which depends on OpenSSL. To get OpenSSL working follow the openssl crate's instructions.

License

This project is licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in git2-rs by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Dependencies

~8MB
~207K SLoC