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); }
private unsafe Tree(git_tree *nativeTree, ObjectId id) : base((git_object *)nativeTree, id) { count = new LazyNative <int>(() => { UIntPtr count = Ensure.NativeCall <UIntPtr>(() => libgit2.git_tree_entrycount(NativeTree), this); return(Ensure.CastToInt(count, "count")); }, this); }
internal unsafe Reference(git_reference *nativeReference) { Ensure.ArgumentNotNull(nativeReference, "reference"); NativeReference = nativeReference; name = new LazyNative <string>(() => { return(Ensure.NativeObjectNotNull(libgit2.git_reference_name(NativeReference))); }, this); }
private unsafe Repository(git_repository *nativeRepository) { Ensure.NativePointerNotNull(nativeRepository); this.nativeRepository = nativeRepository; path = new LazyNative <string>(() => libgit2.git_repository_path(this.nativeRepository), this); workdir = new LazyNative <string>(() => libgit2.git_repository_workdir(this.nativeRepository), this); isBare = new LazyNative <bool>(() => libgit2.git_repository_is_bare(this.nativeRepository) == 0 ? false : true, this); objects = new Lazy <ObjectCollection>(() => new ObjectCollection(this)); references = new Lazy <ReferenceCollection>(() => new ReferenceCollection(this)); }
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); }
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); }
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); }
private unsafe SymbolicReference(git_reference *nativeReference) : base(nativeReference) { target = new LazyNative <string>(() => { return(Ensure.NativeObjectNotNull(libgit2.git_reference_symbolic_target(NativeReference))); }, this); }
private unsafe Blob(git_blob *nativeBlob, ObjectId id) : base((git_object *)nativeBlob, id) { rawSize = new LazyNative <long>(() => libgit2.git_blob_rawsize(nativeBlob), this); isBinary = new LazyNative <bool>(() => libgit2.git_blob_is_binary(nativeBlob) == 0 ? false : true, this); }