示例#1
0
        private void ReplaceIndexEntryWith(TreeEntryChanges treeEntryChanges)
        {
            var indexEntry = new GitIndexEntry
            {
                Mode = (uint)treeEntryChanges.OldMode,
                Id   = treeEntryChanges.OldOid.Oid,
                Path = StrictFilePathMarshaler.FromManaged(treeEntryChanges.OldPath),
            };

            Proxy.git_index_add(handle, indexEntry);
            EncodingMarshaler.Cleanup(indexEntry.Path);
        }
示例#2
0
        private void AddEntryToTheIndex(string path, ObjectId id, Mode mode)
        {
            var indexEntry = new GitIndexEntry
            {
                Mode = (uint)mode,
                Id   = id.Oid,
                Path = StrictFilePathMarshaler.FromManaged(path),
            };

            Proxy.git_index_add(handle, indexEntry);
            EncodingMarshaler.Cleanup(indexEntry.Path);
        }
示例#3
0
        private unsafe void AddEntryToTheIndex(string path, ObjectId id, Mode mode)
        {
            IntPtr pathPtr    = StrictFilePathMarshaler.FromManaged(path);
            var    indexEntry = new git_index_entry
            {
                mode = (uint)mode,
                path = (char *)pathPtr,
            };

            Marshal.Copy(id.RawId, 0, new IntPtr(indexEntry.id.Id), GitOid.Size);

            Proxy.git_index_add(handle, &indexEntry);
            EncodingMarshaler.Cleanup(pathPtr);
        }
示例#4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Filter"/> class.
        /// And allocates the filter natively.
        /// <param name="name">The unique name with which this filtered is registered with</param>
        /// <param name="attributes">A list of attributes which this filter applies to</param>
        /// </summary>
        protected Filter(string name, IEnumerable <FilterAttributeEntry> attributes)
        {
            Ensure.ArgumentNotNullOrEmptyString(name, "name");
            Ensure.ArgumentNotNull(attributes, "attributes");

            this.name       = name;
            this.attributes = attributes;
            var attributesAsString = string.Join(",", this.attributes.Select(attr => attr.FilterDefinition));

            gitFilter = new GitFilter
            {
                attributes = EncodingMarshaler.FromManaged(Encoding.UTF8, attributesAsString),
                init       = InitializeCallback,
                stream     = StreamCreateCallback,
            };
        }