C# (CSharp) GitSharp.Core.DirectoryCache Namespace

Classes

Name Description
DirCache Support for the Git dircache (aka index file). The index file keeps track of which objects are currently checked out in the working directory, and the last modified time of those working files. Changes in the working directory can be detected by comparing the modification times to the cached modification time within the index file. Index files are also used during merges, where the merge happens within the index file first, and the working directory is updated as a post-merge step. Conflicts are stored in the index file to allow tool (and human) based resolutions to be easily performed.
DirCacheBuildIterator Iterate and update a DirCache as part of a TreeWalk. Like DirCacheIterator this iterator allows a DirCache to be used in parallel with other sorts of iterators in a TreeWalk. However any entry which appears in the source DirCache and which is skipped by the TreeFilter is automatically copied into DirCacheBuilder, thus retaining it in the newly updated index. This iterator is suitable for update processes, or even a simple delete algorithm. For example deleting a path: DirCache dirc = DirCache.lock(db); DirCacheBuilder edit = dirc.builder(); TreeWalk walk = new TreeWalk(db); walk.reset(); walk.setRecursive(true); walk.setFilter(PathFilter.Create("name/to/remove")); walk.addTree(new DirCacheBuildIterator(edit)); while (walk.next()) ; // do nothing on a match as we want to remove matches edit.commit();
DirCacheBuilder Updates a DirCache by adding individual DirCacheEntrys. A builder always starts from a clean slate and appends in every single DirCacheEntry which the final updated index must have to reflect its new content. For maximum performance applications should add entries in path name order. Adding entries out of order is permitted, however a final sorting pass will be implicitly performed during finish() to correct any out-of-order entries. Duplicate detection is also delayed until the sorting is complete.
DirCacheEditor Updates a DirCache by supplying discrete edit commands. An editor updates a DirCache by taking a list of PathEdit commands and executing them against the entries of the destination cache to produce a new cache. This edit style allows applications to insert a few commands and then have the editor compute the proper entry indexes necessary to perform an efficient in-order update of the index records. This can be easier to use than DirCacheBuilder.
DirCacheEditor.DeletePath Deletes a single file entry from the index. This deletion command removes only a single file at the given location, but removes multiple stages (if present) for that path. To remove a complete subtree use DeleteTree instead.
DirCacheEditor.DeleteTree Recursively deletes all paths under a subtree. This deletion command is more generic than DeletePath as it can remove all records which appear recursively under the same subtree. Multiple stages are removed (if present) for any deleted entry. This command will not remove a single file entry. To remove a single file use DeletePath.
DirCacheEditor.PathEdit Any index record update. Applications should subclass and provide their own implementation for the Apply method. The editor will invoke apply once for each record in the index which matches the path name. If there are multiple records (for example in stages 1, 2 and 3), the edit instance will be called multiple times, once for each stage.
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.
DirCacheIterator Iterate a DirCache as part of a TreeWalk. This is an iterator to adapt a loaded DirCache instance (such as Read from an existing .git/index file) to the tree structure used by a TreeWalk, making it possible for applications to walk over any combination of tree objects already in the object database, index files, or working directories.
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.