dlibgit ~development

D bindings for libgit2


To use this package, run the following command in your project's root directory:

Manual usage
Put the following dependency into your project's dependences section:

dlibgit - libgit2 D bindings

These are the D bindings to the libgit2 library.

Requirements

[DMD] 2.060+.

GDC can be used but you will have to compile on your own. For GDC use the import lib libgit2.dll.a in the bin folder when linking.

Windows:

You're already set.

Posix:

You need to build the libgit2 shared library (a specific commit is required):

$ git clone -b development git://github.com/libgit2/libgit2.git
$ cd libgit2 && git checkout acd1700630ea1159a55dc5e8cee12e4a725afe18

  • Follow these instructions: http://libgit2.github.com/#install
  • You might need to install zlib if cmake says it's missing (use your package manager to find the zlib dev package)

Make sure the libgit2 shared lib path is in your ld conf file, on Linux Mint libgit2 installs to /usr/local/lib, so either edit /etc/ld.so.conf or run:

$ LD_LIBRARY_PATH=/usr/local/lib
$ export LD_LIBRARY_PATH


Building and running samples

Samples

diff sample:

$ rdmd build.d samples/diff/diff.d
$ bin\diff.exe .git 2504016ab220b5b 1e8ffc04be048c0

  • This will diff the first two commits in dlibgit.
  • You could pass an absolute path, e.g. C:/some/git/repo/.git

showindex sample:

$ rdmd build.d samples/showindex/showindex.d
$ bin\showindex.exe .git

git client sample:

$ rdmd build.d samples/network/git.d
$ bin\git.exe ls-remote git://github.com/AndrejMitrovic/dlibgit.git
$ bin\git.exe index-pack path\to\.git\objects\pack\abcd1234.pack
$ bin\git.exe clone git://github.com/AndrejMitrovic/dlibgit.git ../../dlibgit2_clone

  • clone is not the same as git's clone command, it does not deflate git object files.
  • fetch doesn't currently work due to some bugs in network\fetch.d.
  • Replace path\to with a valid path for index-pack.

On win32 some libgit functions work with either form of slashes, but you should prefer using forward slashes.

Usage tips

As a convenience you can import git2.all or git2._ to import all modules at once.

Documentation

The D bindings aren't documented, but they're 1-to-1 equivalents of the C libgit2 library.

You can use the libgit2 [Guide] and its [API] docs. The [general] example is a good read too.

Note

  • The shared lib is built from commit acd1700630ea1159a55dc5e8cee12e4a725afe18 in the [development] branch. Inline functions were re-created in D because they're not exported. Do not try to use a shared lib built from other commits without doing a diff and verifying that the inline functions are still the same in the D version as in C. The libgit2 master branch is out of date and might not compile.

  • x64 support will be added later. It might already work but some int types are hardcoded due to how gccxml exports typeinfo. size_t and friends will have to be fixed to guarantee safe behavior.

These bindings were autogenerated by dgen, with minor edits required due to missing inlined functions. dgen is a work in progress, and is not yet released.

See also

The libgit2 [homepage] and [github] repository.

License

See libgit's [COPYING] file, included in this repo. Also see the licensing remarks on the [libgit2] github page. I am not a lawyer.

Disclaimer

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Authors:
  • Andrej Mitrovic
  • Sönke Ludwig
Dependencies:
none
Versions:
0.50.6 2016-Jul-04
0.50.5 2014-Nov-28
0.50.4 2014-Apr-02
0.50.3 2014-Mar-01
0.50.2 2014-Feb-28
Show all 15 versions
Download Stats:
  • 0 downloads today

  • 5 downloads this week

  • 5 downloads this month

  • 934 downloads total

Score:
2.4
Short URL:
dlibgit.dub.pm