Top Description Fields Constructors Methods
org.eclipse.jgit.lib

public final Class AbbrevConfig

extends Object
Class Inheritance
Static Imports
org.eclipse.jgit.lib.Constants.OBJECT_ID_ABBREV_STRING_LENGTH, .TypedConfigGetter.UNSET_INT

Git configuration option core.abbrev
Since
6.1

Field Summary

Modifier and TypeField and Description
private int
abbrev

All other possible abbreviation lengths.

public static final int
MIN_ABBREV

The minimum value of abbrev

public static final AbbrevConfig
NO

No abbreviation

private static final String
private static final String

Constructor Summary

AccessConstructor and Description
private
AbbrevConfig(int
abbreviation length
abbrev
)

Create an AbbrevConfig

Method Summary

Modifier and TypeMethod and Description
private static AbbrevConfig

Returns:

appropriate value computed based on the approximate number of packed objects in a repository
auto
(Repository
the repository the AbbrevConfig shall be computed for
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.

public static int

Returns:

core.abbrev capped to range between minimum of 4 and number of hex-digits of a full object id
capAbbrev
(int
configured number of hex-digits to abbreviate object ids to
len
)

Cap configured core.abbrev to range between minimum of 4 and number of hex-digits of a full object id.

public int

Returns:

the configured abbreviation length for object ids
get
()

Get the configured abbreviation length for object ids.

public static AbbrevConfig

Returns:

the parsed AbbrevConfig
parseFromConfig
(Repository
repository
repo
)

Parse string value of core.abbrev git option for a given repository

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

abbrevback to summary
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).

MIN_ABBREVback to summary
public static final int MIN_ABBREV

The minimum value of abbrev

NOback to summary
public static final AbbrevConfig NO

No abbreviation

VALUE_AUTOback to summary
private static final String VALUE_AUTO
VALUE_NOback to summary
private static final String VALUE_NO

Constructor Detail

AbbrevConfigback to summary
private AbbrevConfig(int abbrev)

Create an AbbrevConfig

Parameters
abbrev:int

abbreviation length

Method Detail

autoback to summary
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:Repository

the repository the AbbrevConfig shall be computed for

Returns:AbbrevConfig

appropriate value computed based on the approximate number of packed objects in a repository

capAbbrevback to summary
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:int

configured number of hex-digits to abbreviate object ids to

Returns:int

core.abbrev capped to range between minimum of 4 and number of hex-digits of a full object id

getback to summary
public int get()

Get the configured abbreviation length for object ids.

Returns:int

the configured abbreviation length for object ids

parseFromConfigback to summary
public static AbbrevConfig parseFromConfig(Repository repo) throws InvalidConfigurationException

Parse string value of core.abbrev git option for a given repository

Parameters
repo:Repository

repository

Returns:AbbrevConfig

the parsed AbbrevConfig

Exceptions
InvalidConfigurationException:
if value of core.abbrev is invalid
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Returns:String

a string representation of the object

Annotations
@Override