Skip to content

Add build target for Git2Go

Patrick Steinhardt requested to merge pks-git2go into master

This adds a build target for libgit2 as a prerequisite dependency for Git2Go. The build is configured as a static archive with minimal dependencies such that the only required shared library is the system's libc.

Instead of building libgit2 manually, we could've also gone the way of fetching the Git2Go repository and using its scripts. This has multiple problems though. First, the build scripts aren't flexible and will default to auto-detection of system-provided libraries. As a result, the generated archive will usually have more dependencies than only libc. Second, we'd have to use a "replace" statement for our go.mod file. While that's not a problem by itself, it will cause several targets like e.g. linting, verification and others to depend on the presence of this Git2Go repository.

The approach of building libgit2 manually is thus preferable, as it gives us both more flexibility and less dependencies on libgit2 in our build process.

This MR also adds a new gitaly-git2go command that is currently intended as a proof-of-concept for our Git2Go build framework. It thus doesn't do much except demonstrating it's possible to link against Git2Go and its bundled lbigit2 static archive and use its functionality. At a later point, this is going to be the entrypoint for any Git functionality that we want to implement via Git2Go.

Prerequisite for #2897 (closed)

Edited by Patrick Steinhardt

Merge request reports