Package org.eclipse.jgit.lib
Class AbbrevConfig
- java.lang.Object
-
- org.eclipse.jgit.lib.AbbrevConfig
-
public final class AbbrevConfig extends java.lang.ObjectGit configuration option core.abbrev- Since:
- 6.1
-
-
Field Summary
Fields Modifier and Type Field Description private intabbrevAll other possible abbreviation lengths.static intMIN_ABBREVThe minimum value of abbrevstatic AbbrevConfigNONo abbreviationprivate static java.lang.StringVALUE_AUTOprivate static java.lang.StringVALUE_NO
-
Constructor Summary
Constructors Modifier Constructor Description privateAbbrevConfig(int abbrev)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private 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 repositoryjava.lang.StringtoString()
-
-
-
Field Detail
-
VALUE_NO
private static final java.lang.String VALUE_NO
- See Also:
- Constant Field Values
-
VALUE_AUTO
private static final java.lang.String VALUE_AUTO
- See Also:
- Constant Field Values
-
MIN_ABBREV
public static final int MIN_ABBREV
The minimum value of abbrev- See Also:
- Constant Field Values
-
NO
public static final AbbrevConfig NO
No abbreviation
-
abbrev
private int abbrev
All 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).
-
-
Method Detail
-
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
public static AbbrevConfig parseFromConfig(Repository repo) throws InvalidConfigurationException
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
private static AbbrevConfig auto(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.- 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
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-