C# Class GitSharp.Core.Tree

A representation of a Git tree entry. A Tree is a directory in Git.
Inheritance: TreeEntry, Treeish
Datei anzeigen Open project: stschake/GitSharp Class Usage Examples

Public Methods

Method Description
Accept ( TreeVisitor tv, int flags ) : void
AddEntry ( TreeEntry e ) : void

Add the specified tree entry to this tree.

AddFile ( byte s, int offset ) : FileTreeEntry

Adds a new or existing file with the specified name to this tree. Trees are added if necessary as the name may contain '/':s.

AddFile ( string name ) : FileTreeEntry

Adds a new or existing file with the specified name to this tree. Trees are added if necessary as the name may contain '/':s.

AddTree ( byte s, int offset ) : Tree

Adds a new or existing Tree with the specified name to this tree. Trees are added if necessary as the name may contain '/':s.

AddTree ( string name ) : Tree

Adds a new or existing Tree with the specified name to this tree. Trees are added if necessary as the name may contain '/':s.

CompareNames ( byte a, byte b, int lastA, int lastB ) : int

Compare two names represented as bytes. Since git treats names of trees and blobs differently we have one parameter that represents a '/' for trees. For other objects the value should be NUL. The names are compare by their positive byte value (0..255). A blob and a tree with the same name will not compare equal.

ExistsBlob ( string path ) : bool
ExistsTree ( string path ) : bool
FindBlobMember ( string blobName ) : TreeEntry
ToString ( ) : string
Tree ( Repository repo ) : System

Constructor for a new Tree

Tree ( Repository repo, ObjectId id, byte raw ) : System

Construct a Tree object with known content and hash value

Tree ( Tree parent, ObjectId id, byte nameUTF8 ) : System

Construct a Tree with a known SHA-1 under another tree. Data is not yet specified and will have to be loaded on demand.

Tree ( Tree parent, byte nameUTF8 ) : System

Construct a new Tree under another Tree

Unload ( ) : void

Forget the in-memory data for this tree.

findTreeMember ( string treeName ) : TreeEntry

Private Methods

Method Description
BinarySearch ( TreeEntry entries, byte nameUTF8, int nameUTF8Last, int nameStart, int nameEnd ) : int
CompareNames ( byte a, byte nameUTF8, int nameStart, int nameEnd, int lastA, int lastB ) : int

Compare two names represented as bytes. Since git treats names of trees and blobs differently we have one parameter that represents a '/' for trees. For other objects the value should be NUL. The names are compare by their positive byte value (0..255). A blob and a tree with the same name will not compare equal.

EnsureLoaded ( ) : void
Exists ( string s, byte slast ) : bool
FindMember ( byte s, byte slast, int offset ) : TreeEntry
FindMember ( string s, byte slast ) : TreeEntry
InsertEntry ( int p, TreeEntry e ) : void
ReadTree ( byte raw ) : void
RemoveEntry ( TreeEntry e ) : void
SubString ( byte s, int nameStart, int nameEnd ) : byte[]

Method Details

Accept() public method

public Accept ( TreeVisitor tv, int flags ) : void
tv TreeVisitor
flags int
return void

AddEntry() public method

Add the specified tree entry to this tree.
public AddEntry ( TreeEntry e ) : void
e TreeEntry
return void

AddFile() public method

Adds a new or existing file with the specified name to this tree. Trees are added if necessary as the name may contain '/':s.
public AddFile ( byte s, int offset ) : FileTreeEntry
s byte an array containing the name
offset int when the name starts in the tree. ///
return FileTreeEntry

AddFile() public method

Adds a new or existing file with the specified name to this tree. Trees are added if necessary as the name may contain '/':s.
public AddFile ( string name ) : FileTreeEntry
name string Name
return FileTreeEntry

AddTree() public method

Adds a new or existing Tree with the specified name to this tree. Trees are added if necessary as the name may contain '/':s.
public AddTree ( byte s, int offset ) : Tree
s byte an array containing the name
offset int when the name starts in the tree.
return Tree

AddTree() public method

Adds a new or existing Tree with the specified name to this tree. Trees are added if necessary as the name may contain '/':s.
public AddTree ( string name ) : Tree
name string
return Tree

CompareNames() public static method

Compare two names represented as bytes. Since git treats names of trees and blobs differently we have one parameter that represents a '/' for trees. For other objects the value should be NUL. The names are compare by their positive byte value (0..255). A blob and a tree with the same name will not compare equal.
public static CompareNames ( byte a, byte b, int lastA, int lastB ) : int
a byte name
b byte name
lastA int '/' if a is a tree, else NULL.
lastB int '/' if b is a tree, else NULL.
return int

ExistsBlob() public method

public ExistsBlob ( string path ) : bool
path string
return bool

ExistsTree() public method

public ExistsTree ( string path ) : bool
path string Path to the tree.
return bool

FindBlobMember() public method

public FindBlobMember ( string blobName ) : TreeEntry
blobName string
return TreeEntry

ToString() public method

public ToString ( ) : string
return string

Tree() public method

Constructor for a new Tree
public Tree ( Repository repo ) : System
repo Repository The repository that owns the Tree.
return System

Tree() public method

Construct a Tree object with known content and hash value
public Tree ( Repository repo, ObjectId id, byte raw ) : System
repo Repository
id ObjectId
raw byte
return System

Tree() public method

Construct a Tree with a known SHA-1 under another tree. Data is not yet specified and will have to be loaded on demand.
public Tree ( Tree parent, ObjectId id, byte nameUTF8 ) : System
parent Tree
id ObjectId
nameUTF8 byte
return System

Tree() public method

Construct a new Tree under another Tree
public Tree ( Tree parent, byte nameUTF8 ) : System
parent Tree
nameUTF8 byte
return System

Unload() public method

Forget the in-memory data for this tree.
public Unload ( ) : void
return void

findTreeMember() public method

public findTreeMember ( string treeName ) : TreeEntry
treeName string Tree name
return TreeEntry