org.eclipse.jgit.dircache.DirCache .
An entry represents exactly one stage of a file. If a file path is unmerged then multiple DirCacheEntry instances may appear for the same path name.
| Modifier and Type | Field and Description |
|---|---|
| private static final int | |
| private static final int | |
| private static final int | |
| private byte | inCoreFlags
Flags which are never stored to disk. |
| private final byte[] | info
(Possibly shared) header information storage. |
| private static final int | |
| private static final int | |
| private final int | infoOffset
First location within |
| private static final int | |
| private static final int | |
| private static final byte[] | |
| private static final int | |
| private static final int | |
| private static final int | |
| private static final int | |
| private static final int | |
| private static final int | |
| private static final int | |
| pack-priv final byte[] | path
Our encoded path name, from the root of the repository. |
| private static final int | |
| public static final int | STAGE_0
The standard (fully merged) stage for an entry. |
| public static final int | STAGE_1
The base tree revision for an entry. |
| public static final int | STAGE_2
The first tree revision (usually called "ours"). |
| public static final int | STAGE_3
The second tree revision (usually called "theirs"). |
| private static final int | UPDATE_NEEDED
In-core flag signaling that the entry should be considered as modified. |
| Access | Constructor and Description |
|---|---|
| pack-priv | DirCacheEntry(byte[] sharedInfo, MutableInteger infoAt, InputStream in, MessageDigest md, Instant smudge, DirCache.
|
| public | |
| public | DirCacheEntry(String
name of the cache entry. newPath, int the stage index of the new entry. stage)Create an empty entry at the specified stage. |
| public | DirCacheEntry(byte[]
name of the cache entry, in the standard encoding. newPath)Create an empty entry at stage 0. |
| public | DirCacheEntry(byte[]
name of the cache entry, in the standard encoding. path, int the stage index of the new entry. stage)Create an empty entry at the specified stage. |
| public | DirCacheEntry(DirCacheEntry
entry to clone. src)Duplicate DirCacheEntry with same path and copied info. |
| Modifier and Type | Method and Description |
|---|---|
| private static void | |
| public void | copyMetaData(DirCacheEntry
the entry to copy ObjectId and meta fields from. src)Copy the ObjectId and other meta fields from an existing entry. |
| pack-priv void | copyMetaData(DirCacheEntry
the entry to copy ObjectId and meta fields from. src, boolean if true, the stage attribute will not be copied keepStage)Copy the ObjectId and other meta fields from an existing entry. |
| private long | |
| private Instant | |
| private void | |
| private void | |
| public long | Returns: cached creation time of this file, in milliseconds since the Java epoch (midnight Jan 1, 1970 UTC).Get the cached creation time of this file, in milliseconds. |
| private int | |
| public FileMode | Returns: the file mode singleton for this entry.Obtain the |
| public Instant | Returns: last modification time of this file.Get the cached last modification date of this file. |
| public int | Returns: cached size of the working directory file, in bytes.Get the cached size (mod 4 GB) (in bytes) of this file. |
| pack-priv static int | |
| public ObjectId | |
| public String | Returns: complete path of the entry, from the root of the repository. If the entry is in a subtree there will be at least one '/' in the returned string.Get the entry's complete path. |
| public int | Returns: mode bits for the entry.Obtain the raw |
| public byte[] | |
| public int | |
| pack-priv final byte[] | |
| pack-priv final int | |
| public boolean | Returns: true if we must assume the entry is unmodified.Is this entry always thought to be unmodified? |
| pack-priv boolean | Returns: true if the entry contains extended flags.Whether the entry contains extended flags |
| public boolean | Returns: true if this entry is intent to add.Returns whether this entry is intent to be added to the Index. |
| public boolean | Returns: true if this entry is mergedReturns whether this entry is in the fully-merged stage (0). |
| public boolean | Returns: true if this entry should be skipepd.Returns whether this entry should be skipped from the working tree. |
| public final boolean | Returns: true if the entry is smudged, false
otherwiseCheck whether this entry has been smudged or not
If a blob has length 0 we know its id, see
|
| public boolean | Returns: true if this entry should be checked for changesWhether this entry should be checked for changes |
| public final boolean | Returns: true if extra careful checks should be used.index's last modified time. smudge)Is it possible for this entry to be accidentally assumed clean? |
| private int | |
| public void | setAssumeValid(boolean
true to ignore apparent modifications; false to look at last
modified to detect file modifications. assume)Set the assume valid flag for this entry, |
| public void | setCreationTime(long
new cached creation time of the file, in milliseconds. when)Set the cached creation time of this file, using milliseconds. |
| public void | |
| pack-priv void | |
| public void | setLastModified(Instant
new cached modification date of the file. when)Set the cached last modification date of this file. |
| public void | setLength(int
new cached size of the file, as bytes. If the file is larger
than 2G, cast it to (int) before calling this method. sz)Set the cached size (in bytes) of this file. |
| public void | setLength(long
new cached size of the file, as bytes. sz)Set the cached size (in bytes) of this file. |
| public void | setObjectId(AnyObjectId
new object identifier for the entry. May be
id)org. to remove the
current identifier.Set the ObjectId for the entry. |
| public void | setObjectIdFromRaw(byte[]
the raw byte buffer to read from. At least 20 bytes after p
must be available within this byte array. bs, int position to read the first byte of data from. p)Set the ObjectId for the entry from the raw binary representation. |
| public void | |
| public void | setUpdateNeeded(boolean
whether this entry must be checked for changes updateNeeded)Set whether this entry must be checked for changes |
| public final void | |
| public String | |
| pack-priv static String | |
| pack-priv void |
| ASSUME_VALID | back to summary |
|---|---|
| private static final int ASSUME_VALID | |
| EXTENDED | back to summary |
|---|---|
| private static final int EXTENDED | |
| EXTENDED_FLAGS | back to summary |
|---|---|
| private static final int EXTENDED_FLAGS | |
| inCoreFlags | back to summary |
|---|---|
| private byte inCoreFlags Flags which are never stored to disk. | |
| info | back to summary |
|---|---|
| private final byte[] info (Possibly shared) header information storage. | |
| INFO_LEN | back to summary |
|---|---|
| private static final int INFO_LEN | |
| INFO_LEN_EXTENDED | back to summary |
|---|---|
| private static final int INFO_LEN_EXTENDED | |
| infoOffset | back to summary |
|---|---|
| private final int infoOffset First location within | |
| INTENT_TO_ADD | back to summary |
|---|---|
| private static final int INTENT_TO_ADD | |
| NAME_MASK | back to summary |
|---|---|
| private static final int NAME_MASK Mask applied to data in | |
| nullpad | back to summary |
|---|---|
| private static final byte[] nullpad | |
| P_CTIME | back to summary |
|---|---|
| private static final int P_CTIME | |
| P_FLAGS | back to summary |
|---|---|
| private static final int P_FLAGS | |
| P_FLAGS2 | back to summary |
|---|---|
| private static final int P_FLAGS2 | |
| P_MODE | back to summary |
|---|---|
| private static final int P_MODE | |
| P_MTIME | back to summary |
|---|---|
| private static final int P_MTIME | |
| P_OBJECTID | back to summary |
|---|---|
| private static final int P_OBJECTID | |
| P_SIZE | back to summary |
|---|---|
| private static final int P_SIZE | |
| path | back to summary |
|---|---|
| pack-priv final byte[] path Our encoded path name, from the root of the repository. | |
| SKIP_WORKTREE | back to summary |
|---|---|
| private static final int SKIP_WORKTREE | |
| STAGE_0 | back to summary |
|---|---|
| public static final int STAGE_0 The standard (fully merged) stage for an entry. | |
| STAGE_1 | back to summary |
|---|---|
| public static final int STAGE_1 The base tree revision for an entry. | |
| STAGE_2 | back to summary |
|---|---|
| public static final int STAGE_2 The first tree revision (usually called "ours"). | |
| STAGE_3 | back to summary |
|---|---|
| public static final int STAGE_3 The second tree revision (usually called "theirs"). | |
| UPDATE_NEEDED | back to summary |
|---|---|
| private static final int UPDATE_NEEDED In-core flag signaling that the entry should be considered as modified. | |
| DirCacheEntry | back to summary |
|---|---|
| pack-priv DirCacheEntry(byte[] sharedInfo, MutableInteger infoAt, InputStream in, MessageDigest md, Instant smudge, DirCache. | |
| DirCacheEntry | back to summary |
|---|---|
| public DirCacheEntry(String newPath) Create an empty entry at stage 0.
| |
| DirCacheEntry | back to summary |
|---|---|
| public DirCacheEntry(String newPath, int stage) Create an empty entry at the specified stage.
| |
| DirCacheEntry | back to summary |
|---|---|
| public DirCacheEntry(byte[] newPath) Create an empty entry at stage 0.
| |
| DirCacheEntry | back to summary |
|---|---|
| public DirCacheEntry(byte[] path, int stage) Create an empty entry at the specified stage.
| |
| DirCacheEntry | back to summary |
|---|---|
| public DirCacheEntry(DirCacheEntry src) Duplicate DirCacheEntry with same path and copied info. The same path buffer is reused (avoiding copying), however a new info buffer is created and its contents are copied.
| |
| checkPath | back to summary |
|---|---|
| private static void checkPath(byte[] path) | |
| copyMetaData | back to summary |
|---|---|
| public void copyMetaData(DirCacheEntry src) Copy the ObjectId and other meta fields from an existing entry. This method copies everything except the path from one entry to another, supporting renaming.
| |
| copyMetaData | back to summary |
|---|---|
| pack-priv void copyMetaData(DirCacheEntry src, boolean keepStage) Copy the ObjectId and other meta fields from an existing entry. This method copies everything except the path and possibly stage from one entry to another, supporting renaming.
| |
| decodeTS | back to summary |
|---|---|
| private long decodeTS(int pIdx) | |
| decodeTSInstant | back to summary |
|---|---|
| private Instant decodeTSInstant(int pIdx) | |
| encodeTS | back to summary |
|---|---|
| private void encodeTS(int pIdx, long when) | |
| encodeTS | back to summary |
|---|---|
| private void encodeTS(int pIdx, Instant when) | |
| getCreationTime | back to summary |
|---|---|
| public long getCreationTime() Get the cached creation time of this file, in milliseconds.
| |
| getExtendedFlags | back to summary |
|---|---|
| private int getExtendedFlags() | |
| getFileMode | back to summary |
|---|---|
| public FileMode getFileMode() Obtain the
| |
| getLastModifiedInstant | back to summary |
|---|---|
| public Instant getLastModifiedInstant() Get the cached last modification date of this file. One of the indicators that the file has been modified by an application changing the working tree is if the last modification time for the file differs from the time stored in this entry.
| |
| getLength | back to summary |
|---|---|
| public int getLength() Get the cached size (mod 4 GB) (in bytes) of this file. One of the indicators that the file has been modified by an application changing the working tree is if the size of the file (in bytes) differs from the size stored in this entry. Note that this is the length of the file in the working directory, which may differ from the size of the decompressed blob if work tree filters are being used, such as LF<->CRLF conversion. Note also that for very large files, this is the size of the on-disk file truncated to 32 bits, i.e. modulo 4294967296. If that value is larger than 2GB, it will appear negative.
| |
| getMaximumInfoLength | back to summary |
|---|---|
| pack-priv static int getMaximumInfoLength(boolean extended) | |
| getObjectId | back to summary |
|---|---|
| public ObjectId getObjectId() Obtain the ObjectId for the entry. Using this method to compare ObjectId values between entries is inefficient as it causes memory allocation.
| |
| getPathString | back to summary |
|---|---|
| public String getPathString() Get the entry's complete path. This method is not very efficient and is primarily meant for debugging and final output generation. Applications should try to avoid calling it, and if invoked do so only once per interesting entry, where the name is absolutely required for correct function.
| |
| getRawMode | back to summary |
|---|---|
| public int getRawMode() Obtain the raw
| |
| getRawPath | back to summary |
|---|---|
| public byte[] getRawPath() Get a copy of the entry's raw path bytes.
| |
| getStage | back to summary |
|---|---|
| public int getStage() Get the stage of this entry. Entries have one of 4 possible stages: 0-3.
| |
| idBuffer | back to summary |
|---|---|
| pack-priv final byte[] idBuffer() | |
| idOffset | back to summary |
|---|---|
| pack-priv final int idOffset() | |
| isAssumeValid | back to summary |
|---|---|
| public boolean isAssumeValid() Is this entry always thought to be unmodified? Most entries in the index do not have this flag set. Users may however set them on if the file system stat() costs are too high on this working directory, such as on NFS or SMB volumes.
| |
| isExtended | back to summary |
|---|---|
| pack-priv boolean isExtended() Whether the entry contains extended flags
| |
| isIntentToAdd | back to summary |
|---|---|
| public boolean isIntentToAdd() Returns whether this entry is intent to be added to the Index.
| |
| isMerged | back to summary |
|---|---|
| public boolean isMerged() Returns whether this entry is in the fully-merged stage (0).
| |
| isSkipWorkTree | back to summary |
|---|---|
| public boolean isSkipWorkTree() Returns whether this entry should be skipped from the working tree.
| |
| isSmudged | back to summary |
|---|---|
| public final boolean isSmudged() Check whether this entry has been smudged or not
If a blob has length 0 we know its id, see
| |
| isUpdateNeeded | back to summary |
|---|---|
| public boolean isUpdateNeeded() Whether this entry should be checked for changes
| |
| mightBeRacilyClean | back to summary |
|---|---|
| public final boolean mightBeRacilyClean(Instant smudge) Is it possible for this entry to be accidentally assumed clean? The "racy git" problem happens when a work file can be updated faster than the filesystem records file modification timestamps. It is possible for an application to edit a work file, update the index, then edit it again before the filesystem will give the work file a new modification timestamp. This method tests to see if file was written out at the same time as the index.
| |
| readNulTerminatedString | back to summary |
|---|---|
| private int readNulTerminatedString(InputStream in, OutputStream out) throws IOException | |
| setAssumeValid | back to summary |
|---|---|
| public void setAssumeValid(boolean assume) Set the assume valid flag for this entry,
| |
| setCreationTime | back to summary |
|---|---|
| public void setCreationTime(long when) Set the cached creation time of this file, using milliseconds.
| |
| setFileMode | back to summary |
|---|---|
| public void setFileMode(FileMode mode) Set the file mode for this entry.
| |
| setFileMode | back to summary |
|---|---|
| pack-priv void setFileMode(int mode) | |
| setLastModified | back to summary |
|---|---|
| public void setLastModified(Instant when) Set the cached last modification date of this file.
| |
| setLength | back to summary |
|---|---|
| public void setLength(int sz) Set the cached size (in bytes) of this file.
| |
| setLength | back to summary |
|---|---|
| public void setLength(long sz) Set the cached size (in bytes) of this file.
| |
| setObjectId | back to summary |
|---|---|
| public void setObjectId(AnyObjectId id) Set the ObjectId for the entry.
| |
| setObjectIdFromRaw | back to summary |
|---|---|
| public void setObjectIdFromRaw(byte[] bs, int p) Set the ObjectId for the entry from the raw binary representation.
| |
| setStage | back to summary |
|---|---|
| public void setStage(int stage) Sets the stage of an entry.
| |
| setUpdateNeeded | back to summary |
|---|---|
| public void setUpdateNeeded(boolean updateNeeded) Set whether this entry must be checked for changes
| |
| smudgeRacilyClean | back to summary |
|---|---|
| public final void smudgeRacilyClean() Force this entry to no longer match its working tree file. This avoids the "racy git" problem by making this index entry no longer match the file in the working directory. Later git will be forced to compare the file content to ensure the file matches the working tree. | |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Doc from java. Returns a string representation of the object.
Satisfying this method's contract implies a non- Use for debugging only !
| |
| toString | back to summary |
|---|---|
| pack-priv static String toString(byte[] path) | |
| write | back to summary |
|---|---|
| pack-priv void write(OutputStream os, DirCache. | |