Radish alpha
h
rad:z3gqcJUoA1n9HaHKufZs5FCSGazv5
Radicle Heartwood Protocol & Stack
Radicle
Git
Use git core.abbrev
Open fintohaps opened 2 years ago crate=radicle-cli type=feature

We hard code SHA1 abbreviations to 7 characters. This is fine for small repositories, but if larger repositories begin to use Radicle, then we will run into the birthday problem (see [0]).

To allow this to be configurable, we should respect the locally set core.abbrev Git configuration, if any, and default to 7 if it’s missing.

z6Mktnv1...8DHL commented 2 years ago

From the git-config docs (or [0]):

core.abbrev

Set the length object names are abbreviated to. If unspecified or set to “auto”, an appropriate value is computed based on the approximate number of packed objects in your repository, which hopefully is enough for abbreviated object names to stay unique for some time. If set to “no”, no abbreviation is made and the object names are shown in their full length. The minimum length is 4.

What I’m interested in are the cases where core.abbrev can be legally set to “auto” or “no”. I’m assuming that if we want to respect core.abbrev, should we also respect these special cases and their behaviors?