コード例 #1
0
ファイル: Reference.cs プロジェクト: mjcheetham/dogged
 private unsafe DirectReference(git_reference *nativeReference) : base(nativeReference)
 {
     target = new LazyNative <ObjectId>(() => {
         git_oid *oid = libgit2.git_reference_target(NativeReference);
         Ensure.NativePointerNotNull(oid);
         return(ObjectId.FromNative(*oid));
     }, this);
 }
コード例 #2
0
ファイル: Commit.cs プロジェクト: mjcheetham/dogged
 private unsafe Commit(git_commit *nativeCommit, ObjectId id) :
     base((git_object *)nativeCommit, id)
 {
     author = new LazyNative <Signature>(() => {
         git_signature *author = libgit2.git_commit_author(NativeCommit);
         return(Signature.FromNative(author));
     }, this);
     committer = new LazyNative <Signature>(() => {
         git_signature *signature = libgit2.git_commit_committer(NativeCommit);
         return(Signature.FromNative(signature));
     }, this);
     treeId = new LazyNative <ObjectId>(() => {
         git_oid *oid = libgit2.git_commit_tree_id(NativeCommit);
         Ensure.NativePointerNotNull(oid);
         return(ObjectId.FromNative(*oid));
     }, this);
 }
コード例 #3
0
ファイル: TreeEntry.cs プロジェクト: mjcheetham/dogged
        private unsafe TreeEntry(Tree parent, git_tree_entry *nativeEntry)
        {
            Ensure.ArgumentNotNull(parent, "parent");
            Ensure.ArgumentNotNull(nativeEntry, "nativeEntry");

            this.parent      = parent;
            this.nativeEntry = nativeEntry;

            mode = new LazyNative <FileMode>(() => (FileMode)libgit2.git_tree_entry_filemode(nativeEntry), parent);

            id = new LazyNative <ObjectId>(() => {
                git_oid *oid = libgit2.git_tree_entry_id(nativeEntry);
                Ensure.NativePointerNotNull(oid);
                return(ObjectId.FromNative(*oid));
            }, parent);
            name = new LazyNative <string>(() => libgit2.git_tree_entry_name(nativeEntry), parent);
        }
コード例 #4
0
        private unsafe ObjectDatabaseObject(git_odb_object *nativeObject)
        {
            Ensure.NativePointerNotNull(nativeObject);

            this.nativeObject = nativeObject;

            id = new LazyNative <ObjectId>(() => {
                git_oid *oid = libgit2.git_odb_object_id(nativeObject);
                Ensure.NativePointerNotNull(oid);
                return(ObjectId.FromNative(*oid));
            }, this);
            type = new LazyNative <ObjectType>(() => {
                git_object_t type = libgit2.git_odb_object_type(nativeObject);
                Ensure.EnumDefined(typeof(ObjectType), (int)type, "object type");
                return((ObjectType)type);
            }, this);
            size = new LazyNative <long>(() => {
                UIntPtr size = libgit2.git_odb_object_size(nativeObject);
                return(Ensure.CastToLong(size, "size"));
            }, this);
        }
コード例 #5
0
 internal static unsafe ObjectId BuildFromPtr(git_oid *id)
 {
     return(id == null ? null : new ObjectId(id->Id));
 }
コード例 #6
0
ファイル: ObjectId.cs プロジェクト: mjcheetham/dogged
 internal unsafe static ObjectId FromNative(git_oid *nativeOid)
 {
     Ensure.ArgumentNotNull(nativeOid, "nativeOid");
     return(new ObjectId(nativeOid->id));
 }