C# Class GitSharp.Core.DirectoryCache.DirCacheTree

Single tree record from the 'TREE' DirCache extension. A valid cache tree record contains the object id of a tree object and the total number of DirCacheEntry instances (counted recursively) from the DirCache contained within the tree. This information facilitates faster traversal of the index and quicker generation of tree objects prior to creating a new commit. An invalid cache tree record indicates a known subtree whose file entries have changed in ways that cause the tree to no longer have a known object id. Invalid cache tree records must be revalidated prior to use.
ファイルを表示 Open project: stschake/GitSharp Class Usage Examples

Public Methods

Method Description
DirCacheTree ( ) : System
DirCacheTree ( byte @in, MutableInteger off, DirCacheTree myParent ) : System
contains ( byte a, int aOff, int aLen ) : bool
getChild ( int i ) : DirCacheTree

Get the i-th child cache tree.

getChildCount ( ) : int

Get the number of cached subtrees contained within this tree.

getEntrySpan ( ) : int

Get the number of entries this tree spans within the DirCache. If this tree is not valid (see isValid()) this method's return value is always strictly negative (less than 0) but is otherwise an undefined result.

getNameString ( ) : string

Get the tree's name within its parent. 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.

getObjectId ( ) : ObjectId
getPathString ( ) : string

Get the tree's path within the repository. 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.

isValid ( ) : bool

Determine if this cache is currently valid. A valid cache tree knows how many DirCacheEntry instances from the parent DirCache reside within this tree (recursively enumerated). It also knows the object id of the tree, as the tree should be readily available from the repository's object database.

nameLength ( ) : int
validate ( DirCacheEntry cache, int cCnt, int cIdx, int pathOff ) : void

Update (if necessary) this tree's entrySpan.

write ( byte tmp, TemporaryBuffer os ) : void
writeTree ( DirCacheEntry cacheEntry, int cIdx, int pathOffset, ObjectWriter ow ) : ObjectId

Write (if necessary) this tree to the object store.

Private Methods

Method Description
AppendName ( StringBuilder sb ) : void
ComputeSize ( DirCacheEntry cache, int cIdx, int pathOffset, ObjectWriter ow ) : int
DirCacheTree ( DirCacheTree myParent, byte path, int pathOff, int pathLen ) : System
InsertChild ( int stIdx, DirCacheTree st ) : void
NameComparison ( byte a, int aPos, DirCacheTree ct ) : int
RemoveChild ( int stIdx ) : void
Slash ( byte a, int aPos ) : int
peq ( byte a, byte b, int aLen ) : bool

Method Details

DirCacheTree() public method

public DirCacheTree ( ) : System
return System

DirCacheTree() public method

public DirCacheTree ( byte @in, MutableInteger off, DirCacheTree myParent ) : System
@in byte
off GitSharp.Core.Util.MutableInteger
myParent DirCacheTree
return System

contains() public method

public contains ( byte a, int aOff, int aLen ) : bool
a byte
aOff int
aLen int
return bool

getChild() public method

Get the i-th child cache tree.
public getChild ( int i ) : DirCacheTree
i int Index of the child to obtain.
return DirCacheTree

getChildCount() public method

Get the number of cached subtrees contained within this tree.
public getChildCount ( ) : int
return int

getEntrySpan() public method

Get the number of entries this tree spans within the DirCache. If this tree is not valid (see isValid()) this method's return value is always strictly negative (less than 0) but is otherwise an undefined result.
public getEntrySpan ( ) : int
return int

getNameString() public method

Get the tree's name within its parent. 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 getNameString ( ) : string
return string

getObjectId() public method

public getObjectId ( ) : ObjectId
return ObjectId

getPathString() public method

Get the tree's path within the repository. 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

isValid() public method

Determine if this cache is currently valid. A valid cache tree knows how many DirCacheEntry instances from the parent DirCache reside within this tree (recursively enumerated). It also knows the object id of the tree, as the tree should be readily available from the repository's object database.
public isValid ( ) : bool
return bool

nameLength() public method

public nameLength ( ) : int
return int

validate() public method

Update (if necessary) this tree's entrySpan.
public validate ( DirCacheEntry cache, int cCnt, int cIdx, int pathOff ) : void
cache DirCacheEntry the complete cache from DirCache.
cCnt int /// Number of entries in cache that are valid for /// iteration. ///
cIdx int /// First position of cache that is a member of this /// tree. The path of cache[cacheIdx].path for the /// range [0,pathOff-1) matches the complete path of /// this tree, from the root of the repository. ///
pathOff int /// number of bytes of cache[cacheIdx].path that /// matches this tree's path. The value at array position /// cache[cacheIdx].path[pathOff-1] is always '/' if /// pathOff is > 0. ///
return void

write() public method

public write ( byte tmp, TemporaryBuffer os ) : void
tmp byte
os GitSharp.Core.Util.TemporaryBuffer
return void

writeTree() public method

Write (if necessary) this tree to the object store.
/// one or more paths contain higher-order stages (stage > 0), /// which cannot be stored in a tree object. /// /// an unexpected error occurred writing to the object store. ///
public writeTree ( DirCacheEntry cacheEntry, int cIdx, int pathOffset, ObjectWriter ow ) : ObjectId
cacheEntry DirCacheEntry the complete cache from DirCache.
cIdx int /// first position of cache that is a member of this /// tree. The path of cache[cacheIdx].path for the /// range [0,pathOff-1) matches the complete path of /// this tree, from the root of the repository.
pathOffset int /// number of bytes of cache[cacheIdx].path that /// matches this tree's path. The value at array position /// cache[cacheIdx].path[pathOff-1] is always '/' if /// pathOff is > 0. ///
ow ObjectWriter /// the writer to use when serializing to the store. ///
return ObjectId