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

public final Class Constants

extends Object
Class Inheritance
Annotations
@SuppressWarnings:nls
Static Imports
java.nio.charset.StandardCharsets.US_ASCII, .StandardCharsets.UTF_8

Misc. constants and helpers used throughout JGit.

Field Summary

Modifier and TypeField and Description
public static final String
ATTR_BUILTIN_BINARY_MERGER

Binary value for custom merger.

public static final String
ATTR_BUILTIN_UNION_MERGE_DRIVER

Union built-in merge driver

public static final String
ATTR_DIFF

Diff attribute.

public static final String
ATTR_FILTER

Key for filters in .gitattributes

public static final String
ATTR_FILTER_TYPE_CLEAN

clean command name, used to call filter driver

public static final String
ATTR_FILTER_TYPE_SMUDGE

smudge command name, used to call filter driver

public static final String
ATTR_MERGE

Merge attribute.

public static final String
BUILTIN_FILTER_PREFIX

Builtin filter commands start with this prefix

public static final String
CHERRY_PICK_HEAD

name of the file containing the ID of a cherry pick commit in case of conflicts

public static final String
CMS_SIGNATURE_PREFIX

Prefix of a CMS signature (X.509, S/MIME).

public static final String
COMMIT_EDITMSG

Name of the file in which git commands and hooks store and read the message prepared for the upcoming commit.

public static final int
COMMIT_GENERATION_NOT_COMPUTED

If a commit-graph file was written by a version of Git that did not compute generation numbers, then those commits will have generation number represented by ().

public static final int
COMMIT_GENERATION_UNKNOWN

We use () as generation number for commits not in the commit-graph file.

public static final String
COMMONDIR_FILE

Name of the file (inside gitDir) that has reference to $GIT_COMMON_DIR.

public static final String
CONFIG

Default name for the Git repository configuration

public static final String
DEFAULT_REMOTE_NAME

Default remote name used by clone, push and fetch operations

public static final String
DOT_BUNDLE_EXT

The default extension for local bundle files

public static final String
DOT_GIT

Default name for the Git repository directory

public static final String
DOT_GIT_ATTRIBUTES

Name of the attributes file

public static final String
DOT_GIT_EXT

A bare repository typically ends with this string

public static final String
DOT_GIT_IGNORE

Name of the ignore file

public static final String
DOT_GIT_MODULES

Name of the submodules file

public static final ObjectId
EMPTY_BLOB_ID

Well-known object ID for the empty blob.

public static final ObjectId
EMPTY_TREE_ID

Well-known object ID for the empty tree.

private static final byte[]
private static final byte[]
private static final byte[]
private static final byte[]
public static final String
FETCH_HEAD

Special name for the "FETCH_HEAD" symbolic-ref.

public static final String
GIT_ALTERNATE_OBJECT_DIRECTORIES_KEY

The environment variable that tells us where to look for objects, besides the default objects directory.

public static final String
GIT_AUTHOR_EMAIL_KEY

The environment variable that contains the author's email

public static final String
GIT_AUTHOR_NAME_KEY

The environment variable that contains the author's name

public static final String
GIT_CEILING_DIRECTORIES_KEY

The environment variable that limits how close to the root of the file systems JGit will traverse when looking for a repository root.

public static final String
GIT_COMMITTER_EMAIL_KEY

The environment variable that contains the commiter's email

public static final String
GIT_COMMITTER_NAME_KEY

The environment variable that contains the commiter's name

public static final String
GIT_COMMON_DIR_KEY

The environment variable that tells us which directory is the common ".git" directory.

public static final String
GIT_CONFIG_NOSYSTEM_KEY

The environment variable that blocks use of the system config file

public static final String
GIT_DIR_KEY

The environment variable that tells us which directory is the ".git" directory

public static final String
GIT_INDEX_FILE_KEY

The environment variable that tells us which file holds the Git index.

public static final String
GIT_OBJECT_DIRECTORY_KEY

The environment variable that tells us where objects are stored

public static final String
GIT_WORK_TREE_KEY

The environment variable that tells us which directory is the working directory.

public static final String
GITDIR

Prefix of the first line in a ".git" file

public static final String
GITDIR_FILE

Name of the file (inside gitDir) that references the worktree's .git file (opposite link).

public static final String
GITIGNORE_FILENAME

A gitignore file name

public static final String
GPG_SIGNATURE_PREFIX

Prefix of a GPG signature.

private static final String
HASH_FUNCTION

Hash function used natively by Git for all objects.

public static final String
HEAD

Special name for the "HEAD" symbolic-ref.

public static final String
HEADS

Name of heads folder or file in refs.

public static final String
HOOKS

Name of the folder (inside gitDir) where the hooks are stored.

public static final int
INFINITE_DEPTH

Depth used to unshallow a repository

public static final String
INFO_ALTERNATES

Info alternates file (goes under OBJECTS)

public static final String
INFO_ATTRIBUTES

Attributes-override-file

public static final String
INFO_COMMIT_GRAPH

info commit-graph file (goes under OBJECTS)

public static final String
INFO_EXCLUDE

Excludes-file

public static final String
INFO_HTTP_ALTERNATES

HTTP alternates file (goes under OBJECTS)

public static final String
INFO_REFS

Info refs folder

public static final String
L_LOGS

Prefix for any log.

public static final String
LOCK_SUFFIX

Suffix of lock file name

public static final String
LOGS

Logs folder name

public static final String
MASTER

Default main branch name

public static final String
MERGE_HEAD

name of the file containing the IDs of the parents of a merge commit

public static final String
MERGE_MSG

name of the file containing the commit msg for a merge commit

public static final String
MODULES

Name of the folder (inside gitDir) where submodules are stored

public static final int
OBJ_BAD

An unknown or invalid object type code.

public static final int
OBJ_BLOB

In-pack object type: blob.

public static final int
OBJ_COMMIT

In-pack object type: commit.

public static final int
OBJ_EXT

In-pack object type: extended types.

public static final int
OBJ_OFS_DELTA

In-pack object type: offset delta

Objects stored with this type actually have a different type which must be obtained from their delta base object.

public static final int
OBJ_REF_DELTA

In-pack object type: reference delta

Objects stored with this type actually have a different type which must be obtained from their delta base object.

public static final int
OBJ_TAG

In-pack object type: annotated tag.

public static final int
OBJ_TREE

In-pack object type: tree.

public static final int
OBJ_TYPE_5

In-pack object type: reserved for future use.

public static final int
OBJECT_ID_ABBREV_STRING_LENGTH

The historic length of an abbreviated Git object hash string.

public static final int
OBJECT_ID_LENGTH

A Git object hash is 160 bits, i.e. 20 bytes.

public static final int
OBJECT_ID_STRING_LENGTH

A Git object can be expressed as a 40 character string of hexadecimal digits.

public static final String
OBJECTS

Objects folder name

public static final String
ORIG_HEAD

name of the ref ORIG_HEAD used by certain commands to store the original value of HEAD

public static final String
OS_USER_DIR

The system property that contains the system user name

public static final String
OS_USER_NAME_KEY

The system property that contains the system user name

public static final byte[]
PACK_SIGNATURE

Pack file signature that occurs at file header - identifies file as Git packfile formatted.

public static final String
PACKED_REFS

Packed refs file

public static final String
R_HEADS

Prefix for branch refs

public static final String
R_NOTES

Prefix for notes refs

public static final String
R_NOTES_COMMITS

Standard notes ref

public static final String
R_REFS

Prefix for any ref

public static final String
R_REMOTES

Prefix for remotes refs

public static final String
R_STASH

Standard stash ref

public static final String
R_TAGS

Prefix for tag refs

public static final String
REFTABLE

Reftable folder name

public static final String
REVERT_HEAD

name of the file containing the ID of a revert commit in case of conflicts

public static final String
SHALLOW

Name of the .git/shallow file

public static final String
SIGNED_OFF_BY_TAG

Beginning of the common "Signed-off-by: " commit message line

public static final String
SQUASH_MSG

name of the file containing the commit msg for a squash commit

public static final String
SSH_SIGNATURE_PREFIX

Prefix of an SSH signature.

public static final String
STASH

Default stash branch name

public static final String
TABLES_LIST

Reftable table list name.

public static final String
TYPE_BLOB

Text string that identifies an object as a blob.

public static final String
TYPE_COMMIT

Text string that identifies an object as a commit.

public static final String
TYPE_TAG

Text string that identifies an object as an annotated tag.

public static final String
TYPE_TREE

Text string that identifies an object as a tree.

public static final String
UNKNOWN_USER_DEFAULT

Default value for the user name if no other information is available

public static final String
XDG_CONFIG_HOME

The key of the XDG_CONFIG_HOME directory defined in the XDG Base Directory specification.

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static int

Returns:

a type code constant (one of OBJ_BLOB, OBJ_COMMIT, OBJ_TAG, OBJ_TREE.
decodeTypeString
(final AnyObjectId
object id this type string came from; may be null if that is not known at the time the parse is occurring.
id
,
final byte[]
string version of the type code.
typeString
,
final byte
character immediately following the type string. Usually ' ' (space) or '\n' (line feed).
endMark
,
final MutableInteger
position within typeString where the parse should start. Updated with the new position (just past endMark when the parse is successful.
offset
)

Parse an encoded type string into a type constant.

public static byte[]

Returns:

a byte array representing the requested string, encoded using the default character encoding (UTF-8).
encode
(String
the string to convert. May contain any Unicode characters.
str
)

Convert a string to a byte array in the standard character encoding UTF8.

public static byte[]

Returns:

a decimal representation of the input integer. The returned array is the smallest array that will hold the value.
encodeASCII
(long
the integer to convert.
s
)

Convert an integer into its decimal representation.

public static byte[]

Returns:

a byte array of the same length as the input string, holding the same characters, in the same order.
encodeASCII
(String
the string to convert. Must not contain any characters over 127 (outside of 7-bit ASCII).
s
)

Convert a string to US-ASCII encoding.

public static byte[]

Returns:

the canonical ASCII encoded name of this type.
encodedTypeString
(int
the type code, from a pack representation.
typeCode
)

Convert an OBJ_* type constant to an ASCII encoded string constant.

public static MessageDigest

Returns:

a new digest object.
newMessageDigest
()

Create a new digest function for objects.

public static String

Returns:

the canonical string name of this type.
typeString
(int
the type code, from a pack representation.
typeCode
)

Convert an OBJ_* type constant to a TYPE_* type constant.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

ATTR_BUILTIN_BINARY_MERGERback to summary
public static final String ATTR_BUILTIN_BINARY_MERGER

Binary value for custom merger.

Since
4.9
ATTR_BUILTIN_UNION_MERGE_DRIVERback to summary
public static final String ATTR_BUILTIN_UNION_MERGE_DRIVER

Union built-in merge driver

Since
6.10.1
ATTR_DIFFback to summary
public static final String ATTR_DIFF

Diff attribute.

Since
4.11
ATTR_FILTERback to summary
public static final String ATTR_FILTER

Key for filters in .gitattributes

Since
4.2
ATTR_FILTER_TYPE_CLEANback to summary
public static final String ATTR_FILTER_TYPE_CLEAN

clean command name, used to call filter driver

Since
4.2
ATTR_FILTER_TYPE_SMUDGEback to summary
public static final String ATTR_FILTER_TYPE_SMUDGE

smudge command name, used to call filter driver

Since
4.2
ATTR_MERGEback to summary
public static final String ATTR_MERGE

Merge attribute.

Since
4.9
BUILTIN_FILTER_PREFIXback to summary
public static final String BUILTIN_FILTER_PREFIX

Builtin filter commands start with this prefix

Since
4.6
CHERRY_PICK_HEADback to summary
public static final String CHERRY_PICK_HEAD

name of the file containing the ID of a cherry pick commit in case of conflicts

CMS_SIGNATURE_PREFIXback to summary
public static final String CMS_SIGNATURE_PREFIX

Prefix of a CMS signature (X.509, S/MIME).

Since
7.0
COMMIT_EDITMSGback to summary
public static final String COMMIT_EDITMSG

Name of the file in which git commands and hooks store and read the message prepared for the upcoming commit.

Since
4.0
COMMIT_GENERATION_NOT_COMPUTEDback to summary
public static final int COMMIT_GENERATION_NOT_COMPUTED

If a commit-graph file was written by a version of Git that did not compute generation numbers, then those commits will have generation number represented by ().

Since
6.5
COMMIT_GENERATION_UNKNOWNback to summary
public static final int COMMIT_GENERATION_UNKNOWN

We use () as generation number for commits not in the commit-graph file.

Since
6.5
COMMONDIR_FILEback to summary
public static final String COMMONDIR_FILE

Name of the file (inside gitDir) that has reference to $GIT_COMMON_DIR. .git/worktrees/<worktree-name>/commondir If this file exists, $GIT_COMMON_DIR will be set to the path specified in this file unless it is explicitly set. If the specified path is relative, it is relative to $GIT_DIR. The repository with commondir is incomplete without the repository pointed by "commondir".

Since
7.0
CONFIGback to summary
public static final String CONFIG

Default name for the Git repository configuration

DEFAULT_REMOTE_NAMEback to summary
public static final String DEFAULT_REMOTE_NAME

Default remote name used by clone, push and fetch operations

DOT_BUNDLE_EXTback to summary
public static final String DOT_BUNDLE_EXT

The default extension for local bundle files

Since
5.8
DOT_GITback to summary
public static final String DOT_GIT

Default name for the Git repository directory

DOT_GIT_ATTRIBUTESback to summary
public static final String DOT_GIT_ATTRIBUTES

Name of the attributes file

Since
3.7
DOT_GIT_EXTback to summary
public static final String DOT_GIT_EXT

A bare repository typically ends with this string

DOT_GIT_IGNOREback to summary
public static final String DOT_GIT_IGNORE

Name of the ignore file

DOT_GIT_MODULESback to summary
public static final String DOT_GIT_MODULES

Name of the submodules file

EMPTY_BLOB_IDback to summary
public static final ObjectId EMPTY_BLOB_ID

Well-known object ID for the empty blob.

Since
0.9.1
EMPTY_TREE_IDback to summary
public static final ObjectId EMPTY_TREE_ID

Well-known object ID for the empty tree.

Since
5.1
ENCODED_TYPE_BLOBback to summary
private static final byte[] ENCODED_TYPE_BLOB
ENCODED_TYPE_COMMITback to summary
private static final byte[] ENCODED_TYPE_COMMIT
ENCODED_TYPE_TAGback to summary
private static final byte[] ENCODED_TYPE_TAG
ENCODED_TYPE_TREEback to summary
private static final byte[] ENCODED_TYPE_TREE
FETCH_HEADback to summary
public static final String FETCH_HEAD

Special name for the "FETCH_HEAD" symbolic-ref.

GIT_ALTERNATE_OBJECT_DIRECTORIES_KEYback to summary
public static final String GIT_ALTERNATE_OBJECT_DIRECTORIES_KEY

The environment variable that tells us where to look for objects, besides the default objects directory.

GIT_AUTHOR_EMAIL_KEYback to summary
public static final String GIT_AUTHOR_EMAIL_KEY

The environment variable that contains the author's email

GIT_AUTHOR_NAME_KEYback to summary
public static final String GIT_AUTHOR_NAME_KEY

The environment variable that contains the author's name

GIT_CEILING_DIRECTORIES_KEYback to summary
public static final String GIT_CEILING_DIRECTORIES_KEY

The environment variable that limits how close to the root of the file systems JGit will traverse when looking for a repository root.

GIT_COMMITTER_EMAIL_KEYback to summary
public static final String GIT_COMMITTER_EMAIL_KEY

The environment variable that contains the commiter's email

GIT_COMMITTER_NAME_KEYback to summary
public static final String GIT_COMMITTER_NAME_KEY

The environment variable that contains the commiter's name

GIT_COMMON_DIR_KEYback to summary
public static final String GIT_COMMON_DIR_KEY

The environment variable that tells us which directory is the common ".git" directory.

Since
7.0
GIT_CONFIG_NOSYSTEM_KEYback to summary
public static final String GIT_CONFIG_NOSYSTEM_KEY

The environment variable that blocks use of the system config file

Since
3.3
GIT_DIR_KEYback to summary
public static final String GIT_DIR_KEY

The environment variable that tells us which directory is the ".git" directory

GIT_INDEX_FILE_KEYback to summary
public static final String GIT_INDEX_FILE_KEY

The environment variable that tells us which file holds the Git index.

GIT_OBJECT_DIRECTORY_KEYback to summary
public static final String GIT_OBJECT_DIRECTORY_KEY

The environment variable that tells us where objects are stored

GIT_WORK_TREE_KEYback to summary
public static final String GIT_WORK_TREE_KEY

The environment variable that tells us which directory is the working directory.

GITDIRback to summary
public static final String GITDIR

Prefix of the first line in a ".git" file

Since
3.6
GITDIR_FILEback to summary
public static final String GITDIR_FILE

Name of the file (inside gitDir) that references the worktree's .git file (opposite link). .git/worktrees/<worktree-name>/gitdir A text file containing the absolute path back to the .git file that points here. This file is used to verify if the linked repository has been manually removed in which case this directory is no longer needed. The modification time (mtime) of this file should be updated each time the linked repository is accessed.

Since
7.0
GITIGNORE_FILENAMEback to summary
public static final String GITIGNORE_FILENAME

A gitignore file name

GPG_SIGNATURE_PREFIXback to summary
public static final String GPG_SIGNATURE_PREFIX

Prefix of a GPG signature.

Since
7.0
HASH_FUNCTIONback to summary
private static final String HASH_FUNCTION

Hash function used natively by Git for all objects.

HEADSback to summary
public static final String HEADS

Name of heads folder or file in refs.

Since
7.0
HOOKSback to summary
public static final String HOOKS

Name of the folder (inside gitDir) where the hooks are stored.

Since
3.7
INFINITE_DEPTHback to summary
public static final int INFINITE_DEPTH

Depth used to unshallow a repository

Since
6.3
INFO_ALTERNATESback to summary
public static final String INFO_ALTERNATES

Info alternates file (goes under OBJECTS)

Since
5.5
INFO_ATTRIBUTESback to summary
public static final String INFO_ATTRIBUTES

Attributes-override-file

Since
4.2
INFO_COMMIT_GRAPHback to summary
public static final String INFO_COMMIT_GRAPH

info commit-graph file (goes under OBJECTS)

Since
6.5
INFO_EXCLUDEback to summary
public static final String INFO_EXCLUDE

Excludes-file

Since
3.0
INFO_HTTP_ALTERNATESback to summary
public static final String INFO_HTTP_ALTERNATES

HTTP alternates file (goes under OBJECTS)

Since
5.5
INFO_REFSback to summary
public static final String INFO_REFS

Info refs folder

L_LOGSback to summary
public static final String L_LOGS

Prefix for any log.

Since
7.0
LOCK_SUFFIXback to summary
public static final String LOCK_SUFFIX

Suffix of lock file name

Since
4.7
LOGSback to summary
public static final String LOGS

Logs folder name

MASTERback to summary
public static final String MASTER

Default main branch name

MERGE_HEADback to summary
public static final String MERGE_HEAD

name of the file containing the IDs of the parents of a merge commit

MERGE_MSGback to summary
public static final String MERGE_MSG

name of the file containing the commit msg for a merge commit

MODULESback to summary
public static final String MODULES

Name of the folder (inside gitDir) where submodules are stored

Since
3.6
OBJ_BADback to summary
public static final int OBJ_BAD

An unknown or invalid object type code.

OBJ_BLOBback to summary
public static final int OBJ_BLOB

In-pack object type: blob.

Indicates the associated object is a blob.

This constant is fixed and is defined by the Git packfile format.

See Also
TYPE_BLOB
OBJ_COMMITback to summary
public static final int OBJ_COMMIT

In-pack object type: commit.

Indicates the associated object is a commit.

This constant is fixed and is defined by the Git packfile format.

See Also
TYPE_COMMIT
OBJ_EXTback to summary
public static final int OBJ_EXT

In-pack object type: extended types.

This header code is reserved for future expansion. It is currently undefined/unsupported.

OBJ_OFS_DELTAback to summary
public static final int OBJ_OFS_DELTA

In-pack object type: offset delta

Objects stored with this type actually have a different type which must be obtained from their delta base object. Delta objects store only the changes needed to apply to the base object in order to recover the original object.

An offset delta uses a negative offset from the start of this object to refer to its delta base. The base object must exist in this packfile (even in the case of a thin pack).

This constant is fixed and is defined by the Git packfile format.

OBJ_REF_DELTAback to summary
public static final int OBJ_REF_DELTA

In-pack object type: reference delta

Objects stored with this type actually have a different type which must be obtained from their delta base object. Delta objects store only the changes needed to apply to the base object in order to recover the original object.

A reference delta uses a full object id (hash) to reference the delta base. The base object is allowed to be omitted from the packfile, but only in the case of a thin pack being transferred over the network.

This constant is fixed and is defined by the Git packfile format.

OBJ_TAGback to summary
public static final int OBJ_TAG

In-pack object type: annotated tag.

Indicates the associated object is an annotated tag.

This constant is fixed and is defined by the Git packfile format.

See Also
TYPE_TAG
OBJ_TREEback to summary
public static final int OBJ_TREE

In-pack object type: tree.

Indicates the associated object is a tree.

This constant is fixed and is defined by the Git packfile format.

See Also
TYPE_BLOB
OBJ_TYPE_5back to summary
public static final int OBJ_TYPE_5

In-pack object type: reserved for future use.

OBJECT_ID_ABBREV_STRING_LENGTHback to summary
public static final int OBJECT_ID_ABBREV_STRING_LENGTH

The historic length of an abbreviated Git object hash string. Git 2.11 changed this static number to a dynamically calculated one that scales as the repository grows.

Since
6.1
OBJECT_ID_LENGTHback to summary
public static final int OBJECT_ID_LENGTH

A Git object hash is 160 bits, i.e. 20 bytes.

Changing this assumption is not going to be as easy as changing this declaration.

OBJECT_ID_STRING_LENGTHback to summary
public static final int OBJECT_ID_STRING_LENGTH

A Git object can be expressed as a 40 character string of hexadecimal digits.

See Also
OBJECT_ID_LENGTH
OBJECTSback to summary
public static final String OBJECTS

Objects folder name

Since
5.5
ORIG_HEADback to summary
public static final String ORIG_HEAD

name of the ref ORIG_HEAD used by certain commands to store the original value of HEAD

OS_USER_DIRback to summary
public static final String OS_USER_DIR

The system property that contains the system user name

Since
3.6
OS_USER_NAME_KEYback to summary
public static final String OS_USER_NAME_KEY

The system property that contains the system user name

PACK_SIGNATUREback to summary
public static final byte[] PACK_SIGNATURE

Pack file signature that occurs at file header - identifies file as Git packfile formatted.

This constant is fixed and is defined by the Git packfile format.

PACKED_REFSback to summary
public static final String PACKED_REFS

Packed refs file

R_HEADSback to summary
public static final String R_HEADS

Prefix for branch refs

R_NOTESback to summary
public static final String R_NOTES

Prefix for notes refs

R_NOTES_COMMITSback to summary
public static final String R_NOTES_COMMITS

Standard notes ref

R_REFSback to summary
public static final String R_REFS

Prefix for any ref

R_REMOTESback to summary
public static final String R_REMOTES

Prefix for remotes refs

R_STASHback to summary
public static final String R_STASH

Standard stash ref

R_TAGSback to summary
public static final String R_TAGS

Prefix for tag refs

REFTABLEback to summary
public static final String REFTABLE

Reftable folder name

Since
5.6
REVERT_HEADback to summary
public static final String REVERT_HEAD

name of the file containing the ID of a revert commit in case of conflicts

SHALLOWback to summary
public static final String SHALLOW

Name of the .git/shallow file

SIGNED_OFF_BY_TAGback to summary
public static final String SIGNED_OFF_BY_TAG

Beginning of the common "Signed-off-by: " commit message line

SQUASH_MSGback to summary
public static final String SQUASH_MSG

name of the file containing the commit msg for a squash commit

SSH_SIGNATURE_PREFIXback to summary
public static final String SSH_SIGNATURE_PREFIX

Prefix of an SSH signature.

Since
7.0
STASHback to summary
public static final String STASH

Default stash branch name

TABLES_LISTback to summary
public static final String TABLES_LIST

Reftable table list name.

Since
5.6.2
TYPE_BLOBback to summary
public static final String TYPE_BLOB

Text string that identifies an object as a blob.

Blobs store whole file revisions. They are used for any user file, as well as for symlinks. Blobs form the bulk of any project's storage space.

TYPE_COMMITback to summary
public static final String TYPE_COMMIT

Text string that identifies an object as a commit.

Commits connect trees into a string of project histories, where each commit is an assertion that the best way to continue is to use this other tree (set of files).

TYPE_TAGback to summary
public static final String TYPE_TAG

Text string that identifies an object as an annotated tag.

Annotated tags store a pointer to any other object, and an additional message. It is most commonly used to record a stable release of the project.

TYPE_TREEback to summary
public static final String TYPE_TREE

Text string that identifies an object as a tree.

Trees attach object ids (hashes) to names and file modes. The normal use for a tree is to store a version of a directory and its contents.

UNKNOWN_USER_DEFAULTback to summary
public static final String UNKNOWN_USER_DEFAULT

Default value for the user name if no other information is available

XDG_CONFIG_HOMEback to summary
public static final String XDG_CONFIG_HOME

The key of the XDG_CONFIG_HOME directory defined in the XDG Base Directory specification.

Since
5.5.2

Constructor Detail

Constantsback to summary
private Constants()

Method Detail

decodeTypeStringback to summary
public static int decodeTypeString(final AnyObjectId id, final byte[] typeString, final byte endMark, final MutableInteger offset) throws CorruptObjectException

Parse an encoded type string into a type constant.

Parameters
id:AnyObjectId

object id this type string came from; may be null if that is not known at the time the parse is occurring.

typeString:byte[]

string version of the type code.

endMark:byte

character immediately following the type string. Usually ' ' (space) or '\n' (line feed).

offset:MutableInteger

position within typeString where the parse should start. Updated with the new position (just past endMark when the parse is successful.

Returns:int

a type code constant (one of OBJ_BLOB, OBJ_COMMIT, OBJ_TAG, OBJ_TREE.

Exceptions
CorruptObjectException:
there is no valid type identified by typeString.
encodeback to summary
public static byte[] encode(String str)

Convert a string to a byte array in the standard character encoding UTF8.

Parameters
str:String

the string to convert. May contain any Unicode characters.

Returns:byte[]

a byte array representing the requested string, encoded using the default character encoding (UTF-8).

encodeASCIIback to summary
public static byte[] encodeASCII(long s)

Convert an integer into its decimal representation.

Parameters
s:long

the integer to convert.

Returns:byte[]

a decimal representation of the input integer. The returned array is the smallest array that will hold the value.

encodeASCIIback to summary
public static byte[] encodeASCII(String s)

Convert a string to US-ASCII encoding.

Parameters
s:String

the string to convert. Must not contain any characters over 127 (outside of 7-bit ASCII).

Returns:byte[]

a byte array of the same length as the input string, holding the same characters, in the same order.

Exceptions
IllegalArgumentException:
the input string contains one or more characters outside of the 7-bit ASCII character space.
encodedTypeStringback to summary
public static byte[] encodedTypeString(int typeCode)

Convert an OBJ_* type constant to an ASCII encoded string constant.

The ASCII encoded string is often the canonical representation of the type within a loose object header, or within a tag header.

Parameters
typeCode:int

the type code, from a pack representation.

Returns:byte[]

the canonical ASCII encoded name of this type.

newMessageDigestback to summary
public static MessageDigest newMessageDigest()

Create a new digest function for objects.

Returns:MessageDigest

a new digest object.

Exceptions
RuntimeException:
this Java virtual machine does not support the required hash function. Very unlikely given that JGit uses a hash function that is in the Java reference specification.
typeStringback to summary
public static String typeString(int typeCode)

Convert an OBJ_* type constant to a TYPE_* type constant.

Parameters
typeCode:int

the type code, from a pack representation.

Returns:String

the canonical string name of this type.