Categories
Software development

libqgit2: use git from your Qt code

Some time ago I started contributing to a new open source project. It’s called libqgit2.

I’m working on an exciting project where we are currently creating a tool for multiple people to work on some content and share their changes with others effectively. Behind the scenes the application uses git but the user of the application should be completely unaware of this fact. That means that the application is controlling how git is actually used.

The application uses libgit2 and libqgit2 (which is a Qt wrapper for libgit2). The libgit2 is a C library that realizes the git protocol. It’s still very young and the API can’t be considered stable but it does have a pretty wide range of features it supports from the git world and it’s advancing with a nice pace. As far as I understand it’s also the only option if one wants to have a shared library for git.

The libqgit2 project doesn’t have the pulse of libgit2 as there are only a handful of contributors that have ever shipped code there and currently there isn’t too much activity going on. Since it seemed that libqgit2 was missing some pretty fundamental parts we decided that we should enhance it.

There are already some pretty good features that I have added to libqgit2, like SSH transport and support for pushes (which was missing, weirdly enough). More features will be added as our application matures and we’ll know what functionality we need from libqgit2.

5 replies on “libqgit2: use git from your Qt code”

Hi,

Did you know any open source project using it ?

Is that compatible with qt5 ? I ve tryed quickly to open .pro and compile, got error : no rule to make target ‘qgitblob.cpp’, needed by ‘qgitblob.o’. Stop.

I don’t know any projects using libqgit2. I haven’t seen any interest around it – I haven’t been really looking either, though.

It’s compatible (as in it compiles) with both qt4 and qt5.

I hadn’t even realized there’s a .pro file…don’t use it 🙂 In other words CMake should be used for building, that’s the uptodate build system.

There aren’t really any examples as you’ve noticed. You can maybe learn something by checking the tests (under the tests directory in the source). The code (.h files) also has some code comments containing documentation. Libqgit2 however is mostly just a thin wrapper around libgit2, so what applies to libgit2, often applies to liqgit2 as well. And in order to use either library you need to know Git itself quite thoroughly.

Leave a Reply

Your email address will not be published.