Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/libgit2sharp.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornulltoken <emeric.fermas@gmail.com>2011-06-20 17:36:55 +0400
committernulltoken <emeric.fermas@gmail.com>2011-06-20 22:52:47 +0400
commitb8d95590464df72564141e911432fd9682d7d2d7 (patch)
treec33b50915c7818ee8939998fdc5b9e8565c75d6d /LibGit2Sharp/TreeEntry.cs
parent62208a321d774e0d15e901a3251acdd64cfcdb8d (diff)
Add TreeEntry.Type
Slightly enhanced the filtering of tree entries.
Diffstat (limited to 'LibGit2Sharp/TreeEntry.cs')
-rwxr-xr-xLibGit2Sharp/TreeEntry.cs26
1 files changed, 23 insertions, 3 deletions
diff --git a/LibGit2Sharp/TreeEntry.cs b/LibGit2Sharp/TreeEntry.cs
index 20eea0d6..aa057a96 100755
--- a/LibGit2Sharp/TreeEntry.cs
+++ b/LibGit2Sharp/TreeEntry.cs
@@ -4,6 +4,9 @@ using LibGit2Sharp.Core;
namespace LibGit2Sharp
{
+ /// <summary>
+ /// Representation of an entry in a <see cref="Tree"/>.
+ /// </summary>
public class TreeEntry : IEquatable<TreeEntry>
{
private readonly ObjectId parentTreeId;
@@ -14,29 +17,46 @@ namespace LibGit2Sharp
private static readonly LambdaEqualityHelper<TreeEntry> equalityHelper =
new LambdaEqualityHelper<TreeEntry>(new Func<TreeEntry, object>[] { x => x.Name, x => x.parentTreeId });
- public TreeEntry(IntPtr obj, ObjectId parentTreeId, Repository repo)
+ internal TreeEntry(IntPtr obj, ObjectId parentTreeId, Repository repo)
{
this.parentTreeId = parentTreeId;
this.repo = repo;
IntPtr gitTreeEntryId = NativeMethods.git_tree_entry_id(obj);
targetOid = new ObjectId((GitOid)Marshal.PtrToStructure(gitTreeEntryId, typeof(GitOid)));
+ Type = NativeMethods.git_tree_entry_type(obj);
Attributes = NativeMethods.git_tree_entry_attributes(obj);
Name = NativeMethods.git_tree_entry_name(obj).MarshallAsString();
}
+ /// <summary>
+ /// Gets the UNIX file attributes.
+ /// </summary>
public int Attributes { get; private set; }
-
+
+ /// <summary>
+ /// Gets the filename.
+ /// <para>The filename is expressed in a relative form. Path segments are separated with a forward slash."/></para>
+ /// </summary>
public string Name { get; private set; }
+ /// <summary>
+ /// Gets the <see cref="GitObject"/> being pointed at.
+ /// </summary>
public GitObject Target { get { return target ?? (target = RetreiveTreeEntryTarget()); } }
+ /// <summary>
+ /// Gets the <see cref="GitObjectType"/> of the <see cref="Target"/> being pointed at.
+ /// </summary>
+ public GitObjectType Type { get; private set; }
+
private GitObject RetreiveTreeEntryTarget()
{
GitObject treeEntryTarget = repo.Lookup(targetOid);
+ //TODO: Warning submodules will appear as targets of type Commit
Ensure.ArgumentConformsTo(treeEntryTarget.GetType(), t => typeof(Blob).IsAssignableFrom(t) || typeof(Tree).IsAssignableFrom(t), "treeEntryTarget");
-
+
return treeEntryTarget;
}