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.
显示文件 Open project: stschake/GitSharp Class Usage Examples

Public Methods

Method 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

Method Description
DecodeTimestamp ( int pIdx ) : long
EncodeTimestamp ( int pIdx, long when ) : void

Method Details

DirCacheEntry() public method

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

DirCacheEntry() public method

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.
return System

DirCacheEntry() public method

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

DirCacheEntry() public method

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

DirCacheEntry() public method

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.
return System

copyMetaData() public method

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. ///
return void

getFileMode() public method

Obtain the FileMode for this entry.
public getFileMode ( ) : FileMode
return FileMode

getLastModified() public method

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
return long

getLength() public method

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
return int

getObjectId() public method

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
return ObjectId

getPathString() public method

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
return string

getRawMode() public method

Obtain the raw FileMode bits for this entry.
public getRawMode ( ) : int
return int

getStage() public method

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

idBuffer() public method

public idBuffer ( ) : byte[]
return byte[]

idOffset() public method

public idOffset ( ) : int
return int

isAssumeValid() public method

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
return bool

mightBeRacilyClean() public method

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. ///
return bool

setAssumeValid() public method

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. ///
return void

setFileMode() public method

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

setLastModified() public method

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. ///
return void

setLength() public method

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

setObjectId() public method

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. ///
return void

setObjectIdFromRaw() public method

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.
return void

smudgeRacilyClean() public method

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
return void

write() public method

public write ( Stream os ) : void
os Stream
return void