Пример #1
0
			internal virtual void Add(IndexPack.UnresolvedDelta d)
			{
				d.next = head;
				head = d;
			}
Пример #2
0
		// Read one entire object or delta from the input.
		/// <exception cref="System.IO.IOException"></exception>
		private void IndexOneObject()
		{
			long pos = Position();
			crc.Reset();
			int c = ReadFrom(IndexPack.Source.INPUT);
			int typeCode = (c >> 4) & 7;
			long sz = c & 15;
			int shift = 4;
			while ((c & unchecked((int)(0x80))) != 0)
			{
				c = ReadFrom(IndexPack.Source.INPUT);
				sz += (c & unchecked((int)(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 = ReadFrom(IndexPack.Source.INPUT);
					long ofs = c & 127;
					while ((c & 128) != 0)
					{
						ofs += 1;
						c = ReadFrom(IndexPack.Source.INPUT);
						ofs <<= 7;
						ofs += (c & 127);
					}
					long @base = pos - ofs;
					IndexPack.UnresolvedDelta n;
					InflateAndSkip(IndexPack.Source.INPUT, sz);
					n = new IndexPack.UnresolvedDelta(pos, (int)crc.GetValue());
					n.next = baseByPos.Put(@base, n);
					deltaCount++;
					break;
				}

				case Constants.OBJ_REF_DELTA:
				{
					c = Fill(IndexPack.Source.INPUT, 20);
					crc.Update(buf, c, 20);
					ObjectId @base = ObjectId.FromRaw(buf, c);
					Use(20);
					IndexPack.DeltaChain r = baseById.Get(@base);
					if (r == null)
					{
						r = new IndexPack.DeltaChain(@base);
						baseById.Add(r);
					}
					InflateAndSkip(IndexPack.Source.INPUT, sz);
					r.Add(new IndexPack.UnresolvedDelta(pos, (int)crc.GetValue()));
					deltaCount++;
					break;
				}

				default:
				{
					throw new IOException(MessageFormat.Format(JGitText.Get().unknownObjectType, typeCode
						));
				}
			}
		}
Пример #3
0
			internal virtual IndexPack.UnresolvedDelta Remove()
			{
				IndexPack.UnresolvedDelta r = head;
				if (r != null)
				{
					head = null;
				}
				return r;
			}