Package org.eclipse.jgit.lib
Class AbbrevConfig
java.lang.Object
org.eclipse.jgit.lib.AbbrevConfig
Git configuration option <a
href=https://git-scm.com/docs/git-config#Documentation/git-config.txt-coreabbrev">
core.abbrev
- Since:
- 6.1
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate intAll other possible abbreviation lengths.static final intThe minimum value of abbrevstatic final AbbrevConfigNo abbreviationprivate static final Stringprivate static final String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static AbbrevConfigauto(Repository repo) An appropriate value is computed based on the approximate number of packed objects in a repository, which hopefully is enough for abbreviated object names to stay unique for some time.static intcapAbbrev(int len) Cap configured core.abbrev to range between minimum of 4 and number of hex-digits of a full object id.intget()Get the configured abbreviation length for object ids.static AbbrevConfigparseFromConfig(Repository repo) Parse string value of core.abbrev git option for a given repositorytoString()
-
Field Details
-
VALUE_NO
- See Also:
-
VALUE_AUTO
- See Also:
-
MIN_ABBREV
public static final int MIN_ABBREVThe minimum value of abbrev- See Also:
-
NO
No abbreviation -
abbrev
private int abbrevAll other possible abbreviation lengths. Valid range 4 to number of hex-digits of an unabbreviated object id (40 for SHA1 object ids, jgit doesn't support SHA256 yet).
-
-
Constructor Details
-
AbbrevConfig
private AbbrevConfig(int abbrev) - Parameters:
abbrev-
-
-
Method Details
-
capAbbrev
public static int capAbbrev(int len) Cap configured core.abbrev to range between minimum of 4 and number of hex-digits of a full object id.- Parameters:
len- configured number of hex-digits to abbreviate object ids to- Returns:
- core.abbrev capped to range between minimum of 4 and number of hex-digits of a full object id
-
parseFromConfig
Parse string value of core.abbrev git option for a given repository- Parameters:
repo- repository- Returns:
- the parsed AbbrevConfig
- Throws:
InvalidConfigurationException- if value of core.abbrev is invalid
-
auto
An appropriate value is computed based on the approximate number of packed objects in a repository, which hopefully is enough for abbreviated object names to stay unique for some time.- Parameters:
repo-- Returns:
- appropriate value computed based on the approximate number of packed objects in a repository
-
get
public int get()Get the configured abbreviation length for object ids.- Returns:
- the configured abbreviation length for object ids
-
toString
-