Skip to content

git2go: Implement support for object quarantine directories

Patrick Steinhardt requested to merge pks-git2go-object-quarantine into master

When executing Git commands, Git will look for a bunch of environment variables which influence how the repository will be opened. Next to environment variables like GIT_CEILING_DIRECTORIES and GIT_DISCOVER_ACROSS_FILESYSTEM, which both influence the lookup itself, it'll also consider variables which modify locations of the Git directory via GIT_DIR or of object directories via GIT_OBJECT_DIRECTORY and GIT_ALTERNATE_OBJECT_DIRECTORIES. In Gitaly, we use the latter in object quarantine directories such that we can locate objects which are not part of main object directory.

While Git uses these environment variables by default, libgit2 and thus Git2Go do not. As a result, our gitaly-git2go binary will not correctly honor quarantine directories but only use the "normal" repository structures. While this hasn't yet been a problem given that the binary never runs in any context where we do have an object quarantine, we'll eventually want to use manual quarantine directories in this context such that we can stage, check and migrate new objects with Git2Go, too.

To support this, we need to instruct libgit2 to honor above environment variables: if they're unset, then it'll behave the same as before. If set, then libgit2 will not do default discovery of the repository but instead use values as set in the environment.

Given that there shouldn't be any RPCs using gitaly-git2go which make use of object quarantine directories, this change shouldn't have any user-visible effect yet. Users of this new capability will land at a later point in time when we start to make use of muanal quarantine directories in Git2Go-based RPCs.

As a proof of concept, this MR implements support for these object quarantine directories in ResolveConflicts.

Merge request reports

Loading