A Coherent Index for Dichotomy in Version-Controlled Repositories
摘要
Version Control Systems such as Git and Mercurial model their repositories as collections of Merkle directed acyclic graphs. New versions of the code base are added as sources in local graphs and then shared with other agents in the lifetime of the project. In the largest graphs, which can grow to several millions of revisions, sub-linear algorithms become necessary for recurring tasks. A common solution is to use a precomputed index that can grow dynamically along with the graphs. In this paper, we propose a versatile and compact index (a few bytes per node in practice) for dichotomy operations on Merkle DAGs. Furthermore, our index is coherent, in the sense that all agents participating in a repository have the same information for each node they know about. In order to define our index, we introduce the notion of range, a small-sized representation of a set of nodes which can easily be partitioned into smaller ranges. We show how it can be used for the problems of reachability and label discovery, and compare its performance with existing indices for reachability. An implementation of our algorithms is available at https://doi.org/10.5281/zenodo.10715742 .