Files
gerrit/java
Dave Borowitz 9919b3eb99 Add utility methods and constants for abbreviating ObjectIds
There are a variety of ways to abbreviate ObjectId hex strings: with an
arbitrary default length or an explicit length, with or without an
ObjectReader for final disambiguation. Cut down on the amount of
hard-coding and save a few characters by introducing a consistent set of
abbreviateName static methods.

This class is also a convenient place to put a constant for the default
abbreviation length (7), which doesn't exist in JGit (e.g. it's
hard-coded in ObjectReader.java). Since we have that constant, also add
another constant that copies Constants.OBJECT_ID_STRING_LENGTH. In
general we avoid duplicating JGit constants in Gerrit, but in this case
the upstream constant is quite verbose, and also it's cleaner at call
sites in Gerrit to be using two constants from ObjectIds with a
consistent naming pattern.

This change preserves existing abbreviation behavior in all cases.

Change-Id: I2b6a30c1ee122c6d0e149cd19b5e23a4ac4294da
2019-04-29 07:42:11 -07:00
..
2019-04-29 07:42:11 -07:00
2018-11-13 15:06:26 -08:00
2018-08-14 08:07:59 +02:00