D bindings for libgit2
To use this package, run the following command in your project's root directory:
Put the following dependency into your project's dependences section:
dlibgit - libgit2 D bindings
These are the D bindings to the libgit2 library.
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.
You're already set.
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
/etc/ld.so.conf or run:
$ LD_LIBRARY_PATH=/usr/local/lib $ export LD_LIBRARY_PATH
Building and running samples
$ 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.
$ 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
cloneis not the same as git's
clonecommand, it does not deflate git object files.
fetchdoesn't currently work due to some bugs in network\fetch.d.
path\towith a valid path for index-pack.
On win32 some libgit functions work with either form of slashes, but you should prefer using forward slashes.
As a convenience you can import
git2._ to import all modules at once.
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.
The shared lib is built from commit
acd1700630ea1159a55dc5e8cee12e4a725afe18in 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.
The libgit2 [homepage] and [github] repository.
See libgit's [COPYING] file, included in this repo. Also see the licensing remarks on the [libgit2] github page. I am not a lawyer.
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.
- Registered by Sönke Ludwig
- ~development released 8 years ago