コード例 #1
0
 private void ResolveChildDeltaChain(int type, byte[] data, UnresolvedDelta a)
 {
     while (a != null)
     {
         ResolveDeltas(a.HeaderOffset, a.Crc32, type, data, null);
         a = a.Next;
     }
 }
コード例 #2
0
 private void ResolveChildDeltaChain(int type, byte[] data, UnresolvedDelta a)
 {
     while (a != null)
     {
         ResolveDeltas(a.Position, a.Crc, type, data, null);
         a = a.Next;
     }
 }
コード例 #3
0
            public UnresolvedDelta Remove()
            {
                UnresolvedDelta r = Head;

                if (r != null)
                {
                    Head = null;
                }

                return(r);
            }
コード例 #4
0
        private static UnresolvedDelta Reverse(UnresolvedDelta c)
        {
            UnresolvedDelta tail = null;

            while (c != null)
            {
                UnresolvedDelta n = c.Next;
                c.Next = tail;
                tail   = c;
                c      = n;
            }
            return(tail);
        }
コード例 #5
0
        private void ResolveChildDeltas(long pos, int type, byte[] data, AnyObjectId objectId)
        {
            UnresolvedDelta a = Reverse(RemoveBaseById(objectId));
            UnresolvedDelta b = Reverse(_baseByPos.remove(pos));

            while (a != null && b != null)
            {
                if (a.Position < b.Position)
                {
                    ResolveDeltas(a.Position, a.Crc, type, data, null);
                    a = a.Next;
                }
                else
                {
                    ResolveDeltas(b.Position, b.Crc, type, data, null);
                    b = b.Next;
                }
            }

            ResolveChildDeltaChain(type, data, a);
            ResolveChildDeltaChain(type, data, b);
        }
コード例 #6
0
ファイル: IndexPack.cs プロジェクト: georgeck/GitSharp
 private void ResolveChildDeltaChain(int type, byte[] data, UnresolvedDelta a)
 {
     while (a != null)
     {
         ResolveDeltas(a.HeaderOffset, a.Crc32, type, data, null);
         a = a.Next;
     }
 }
コード例 #7
0
ファイル: IndexPack.cs プロジェクト: georgeck/GitSharp
        private void IndexOneObject()
        {
            long pos = Position();
            _crc.Reset();
            int c = ReadFromInput();
            int typeCode = (c >> 4) & 7;
            long sz = c & 15;
            int shift = 4;
            while ((c & 0x80) != 0)
            {
                c = ReadFromInput();
                sz += (c & 0x7f) << shift;
                shift += 7;
            }

            switch (typeCode)
            {
                case Constants.OBJ_COMMIT:
                case Constants.OBJ_TREE:
                case Constants.OBJ_BLOB:
                case Constants.OBJ_TAG:
                    Whole(typeCode, pos, sz);
                    break;

                case Constants.OBJ_OFS_DELTA:
                    c = ReadFromInput();
                    long ofs = c & 127;
                    while ((c & 128) != 0)
                    {
                        ofs += 1;
                        c = ReadFromInput();
                        ofs <<= 7;
                        ofs += (c & 127);
                    }
                    long pbase = pos - ofs;
                    SkipInflateFromInput(sz);
                    var n = new UnresolvedDelta(pos, (int)_crc.Value);
                    n.Next = _baseByPos.put(pbase, n);
                    _deltaCount++;
                    break;

                case Constants.OBJ_REF_DELTA:
                    c = FillFromInput(20);
                    _crc.Update(_buffer, c, 20);
                    ObjectId baseId = ObjectId.FromRaw(_buffer, c);
                    Use(20);
                    DeltaChain r = _baseById.Get(baseId);
                    if (r == null)
                    {
                        r = new DeltaChain(baseId);
                        _baseById.Add(r);
                    }
                    SkipInflateFromInput(sz);
                    r.Add(new UnresolvedDelta(pos, (int)_crc.Value));
                    _deltaCount++;
                    break;

                default:
                    throw new IOException("Unknown object type " + typeCode + ".");
            }
        }
コード例 #8
0
ファイル: IndexPack.cs プロジェクト: georgeck/GitSharp
 private static UnresolvedDelta Reverse(UnresolvedDelta c)
 {
     UnresolvedDelta tail = null;
     while (c != null)
     {
         UnresolvedDelta n = c.Next;
         c.Next = tail;
         tail = c;
         c = n;
     }
     return tail;
 }
コード例 #9
0
ファイル: IndexPack.cs プロジェクト: georgeck/GitSharp
            public UnresolvedDelta Remove()
            {
                UnresolvedDelta r = Head;
                if (r != null)
                {
                    Head = null;
                }

                return r;
            }
コード例 #10
0
ファイル: IndexPack.cs プロジェクト: georgeck/GitSharp
 public void Add(UnresolvedDelta d)
 {
     d.Next = Head;
     Head = d;
 }
コード例 #11
0
        /// <summary>
        /// Read one entire object or delta from the input.
        /// </summary>
        private void IndexOneObject()
        {
            long pos = Position();

            _crc.Reset();
            int  c        = ReadFromInput();
            int  typeCode = (c >> 4) & 7;
            long sz       = c & 15;
            int  shift    = 4;

            while ((c & 0x80) != 0)
            {
                c      = ReadFromInput();
                sz    += (c & 0x7f) << shift;
                shift += 7;
            }

            switch (typeCode)
            {
            case Constants.OBJ_COMMIT:
            case Constants.OBJ_TREE:
            case Constants.OBJ_BLOB:
            case Constants.OBJ_TAG:
                Whole(typeCode, pos, sz);
                break;

            case Constants.OBJ_OFS_DELTA:
                c = ReadFromInput();
                long ofs = c & 127;
                while ((c & 128) != 0)
                {
                    ofs  += 1;
                    c     = ReadFromInput();
                    ofs <<= 7;
                    ofs  += (c & 127);
                }
                long pbase = pos - ofs;
                SkipInflateFromInput(sz);
                var n = new UnresolvedDelta(pos, (int)_crc.Value);
                n.Next = _baseByPos.put(pbase, n);
                _deltaCount++;
                break;

            case Constants.OBJ_REF_DELTA:
                c = FillFromInput(20);
                _crc.Update(_buffer, c, 20);
                ObjectId baseId = ObjectId.FromRaw(_buffer, c);
                Use(20);
                DeltaChain r = _baseById.Get(baseId);
                if (r == null)
                {
                    r = new DeltaChain(baseId);
                    _baseById.Add(r);
                }
                SkipInflateFromInput(sz);
                r.Add(new UnresolvedDelta(pos, (int)_crc.Value));
                _deltaCount++;
                break;

            default:
                throw new IOException("Unknown object type " + typeCode + ".");
            }
        }
コード例 #12
0
 public void Add(UnresolvedDelta d)
 {
     d.Next = Head;
     Head   = d;
 }
コード例 #13
0
ファイル: IndexPack.cs プロジェクト: spraints/GitSharp
 private void ResolveChildDeltaChain(int type, byte[] data, UnresolvedDelta a)
 {
     while (a != null)
     {
         ResolveDeltas(a.Position, a.Crc, type, data, null);
         a = a.Next;
     }
 }