C# Class GitSharp.Core.DirectoryCache.DirCacheEntry

A single file (or stage of a file) in a 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.
Afficher le fichier Open project: stschake/GitSharp Class Usage Examples

Méthodes publiques

Méthode Description
DirCacheEntry ( byte newPath ) : System

Create an empty entry at stage 0.

DirCacheEntry ( byte newPath, int stage ) : System

Create an empty entry at the specified stage.

DirCacheEntry ( byte sharedInfo, int infoAt, Stream @in, MessageDigest md ) : System
DirCacheEntry ( string newPath ) : System

Create an empty entry at stage 0.

DirCacheEntry ( string newPath, int stage ) : System

Create an empty entry at the specified stage.

copyMetaData ( DirCacheEntry src ) : void

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.

getFileMode ( ) : FileMode

Obtain the FileMode for this entry.

getLastModified ( ) : long

Get the cached last modification date of this file, in milliseconds. 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 ( ) : int

Get the cached size (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.

getObjectId ( ) : ObjectId

Obtain the ObjectId for the entry. Using this method to compare ObjectId values between entries is inefficient as it causes memory allocation.

getPathString ( ) : string

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 ( ) : int

Obtain the raw FileMode bits for this entry.

getStage ( ) : int

Get the stage of this entry. Entries have one of 4 possible stages: 0-3.

idBuffer ( ) : byte[]
idOffset ( ) : int
isAssumeValid ( ) : bool

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.

mightBeRacilyClean ( int smudge_s, int smudge_ns ) : bool

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.

setAssumeValid ( bool assume ) : void

Set the assume valid flag for this entry,

setFileMode ( FileMode mode ) : void

Set the file mode for this entry.

setLastModified ( long when ) : void

Set the cached last modification date of this file, using milliseconds.

setLength ( int sz ) : void

Set the cached size (in bytes) of this file.

setObjectId ( AnyObjectId id ) : void

Set the ObjectId for the entry.

setObjectIdFromRaw ( byte bs, int p ) : void

Set the ObjectId for the entry from the raw binary representation.

smudgeRacilyClean ( ) : void

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.

write ( Stream os ) : void

Private Methods

Méthode Description
DecodeTimestamp ( int pIdx ) : long
EncodeTimestamp ( int pIdx, long when ) : void

Method Details

DirCacheEntry() public méthode

Create an empty entry at stage 0.
public DirCacheEntry ( byte newPath ) : System
newPath byte /// name of the cache entry, in the standard encoding. ///
Résultat System

DirCacheEntry() public méthode

Create an empty entry at the specified stage.
public DirCacheEntry ( byte newPath, int stage ) : System
newPath byte /// Name of the cache entry, in the standard encoding. ///
stage int The stage index of the new entry.
Résultat System

DirCacheEntry() public méthode

public DirCacheEntry ( byte sharedInfo, int infoAt, Stream @in, MessageDigest md ) : System
sharedInfo byte
infoAt int
@in Stream
md GitSharp.Core.Util.MessageDigest
Résultat System

DirCacheEntry() public méthode

Create an empty entry at stage 0.
public DirCacheEntry ( string newPath ) : System
newPath string Name of the cache entry.
Résultat System

DirCacheEntry() public méthode

Create an empty entry at the specified stage.
public DirCacheEntry ( string newPath, int stage ) : System
newPath string name of the cache entry.
stage int the stage index of the new entry.
Résultat System

copyMetaData() public méthode

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.
public copyMetaData ( DirCacheEntry src ) : void
src DirCacheEntry /// The entry to copy ObjectId and meta fields from. ///
Résultat void

getFileMode() public méthode

Obtain the FileMode for this entry.
public getFileMode ( ) : FileMode
Résultat FileMode

getLastModified() public méthode

Get the cached last modification date of this file, in milliseconds. 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.
public getLastModified ( ) : long
Résultat long

getLength() public méthode

Get the cached size (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.
public getLength ( ) : int
Résultat int

getObjectId() public méthode

Obtain the ObjectId for the entry. Using this method to compare ObjectId values between entries is inefficient as it causes memory allocation.
public getObjectId ( ) : ObjectId
Résultat ObjectId

getPathString() public méthode

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.
public getPathString ( ) : string
Résultat string

getRawMode() public méthode

Obtain the raw FileMode bits for this entry.
public getRawMode ( ) : int
Résultat int

getStage() public méthode

Get the stage of this entry. Entries have one of 4 possible stages: 0-3.
public getStage ( ) : int
Résultat int

idBuffer() public méthode

public idBuffer ( ) : byte[]
Résultat byte[]

idOffset() public méthode

public idOffset ( ) : int
Résultat int

isAssumeValid() public méthode

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.
public isAssumeValid ( ) : bool
Résultat bool

mightBeRacilyClean() public méthode

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.
public mightBeRacilyClean ( int smudge_s, int smudge_ns ) : bool
smudge_s int /// Seconds component of the index's last modified time. ///
smudge_ns int /// Nanoseconds component of the index's last modified time. ///
Résultat bool

setAssumeValid() public méthode

Set the assume valid flag for this entry,
public setAssumeValid ( bool assume ) : void
assume bool /// True to ignore apparent modifications; false to look at last /// modified to detect file modifications. ///
Résultat void

setFileMode() public méthode

Set the file mode for this entry.
public setFileMode ( FileMode mode ) : void
mode FileMode The new mode constant.
Résultat void

setLastModified() public méthode

Set the cached last modification date of this file, using milliseconds.
public setLastModified ( long when ) : void
when long /// new cached modification date of the file, in milliseconds. ///
Résultat void

setLength() public méthode

Set the cached size (in bytes) of this file.
public setLength ( int sz ) : void
sz int new cached size of the file, as bytes.
Résultat void

setObjectId() public méthode

Set the ObjectId for the entry.
public setObjectId ( AnyObjectId id ) : void
id AnyObjectId /// New object identifier for the entry. May be /// to remove the current identifier. ///
Résultat void

setObjectIdFromRaw() public méthode

Set the ObjectId for the entry from the raw binary representation.
public setObjectIdFromRaw ( byte bs, int p ) : void
bs byte /// The raw byte buffer to read from. At least 20 bytes after /// must be available within this byte array. ///
p int position to read the first byte of data from.
Résultat void

smudgeRacilyClean() public méthode

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.
public smudgeRacilyClean ( ) : void
Résultat void

write() public méthode

public write ( Stream os ) : void
os Stream
Résultat void