Пример #1
0
 public override void VisitGitlink(GitLinkTreeEntry s)
 {
     if (s.IsModified)
     {
         throw new GitlinksNotSupportedException(s.FullName);
     }
 }
Пример #2
0
        private void ReadTree(byte[] raw)
        {
            int rawSize   = raw.Length;
            int rawPtr    = 0;
            int nextIndex = 0;

            while (rawPtr < rawSize)
            {
                while (rawPtr < rawSize && raw[rawPtr] != 0)
                {
                    rawPtr++;
                }

                rawPtr++;
                rawPtr += Constants.OBJECT_ID_LENGTH;
                nextIndex++;
            }

            var temp = new TreeEntry[nextIndex];

            rawPtr    = 0;
            nextIndex = 0;

            while (rawPtr < rawSize)
            {
                int c = raw[rawPtr++];
                if (c < '0' || c > '7')
                {
                    throw new CorruptObjectException(Id, "invalid entry mode");
                }

                int mode = c - '0';

                while (true)
                {
                    c = raw[rawPtr++];
                    if (' ' == c)
                    {
                        break;
                    }

                    if (c < '0' || c > '7')
                    {
                        throw new CorruptObjectException(Id, "invalid mode");
                    }

                    mode <<= 3;
                    mode  += c - '0';
                }

                int nameLen = 0;
                while (raw[rawPtr + nameLen] != 0)
                {
                    nameLen++;
                }

                var name = new byte[nameLen];
                Array.Copy(raw, rawPtr, name, 0, nameLen);
                rawPtr += nameLen + 1;

                ObjectId id = ObjectId.FromRaw(raw, rawPtr);
                rawPtr += Constants.OBJECT_ID_LENGTH;

                TreeEntry ent;
                if (FileMode.RegularFile.Equals(mode))
                {
                    ent = new FileTreeEntry(this, id, name, false);
                }
                else if (FileMode.ExecutableFile.Equals(mode))
                {
                    ent = new FileTreeEntry(this, id, name, true);
                }
                else if (FileMode.Tree.Equals(mode))
                {
                    ent = new Tree(this, id, name);
                }
                else if (FileMode.Symlink.Equals(mode))
                {
                    ent = new SymlinkTreeEntry(this, id, name);
                }
                else if (FileMode.GitLink.Equals(mode))
                {
                    ent = new GitLinkTreeEntry(this, id, name);
                }
                else
                {
                    throw new CorruptObjectException(Id, "Invalid mode: " + Convert.ToString(mode, 8));
                }

                temp[nextIndex++] = ent;
            }

            _contents = temp;
        }
Пример #3
0
		private void ReadTree(byte[] raw)
		{
			int rawSize = raw.Length;
			int rawPtr = 0;
			int nextIndex = 0;

			while (rawPtr < rawSize)
			{
				while (rawPtr < rawSize && raw[rawPtr] != 0)
				{
					rawPtr++;
				}

				rawPtr++;
				rawPtr += Constants.OBJECT_ID_LENGTH;
				nextIndex++;
			}

			var temp = new TreeEntry[nextIndex];
			rawPtr = 0;
			nextIndex = 0;

			while (rawPtr < rawSize)
			{
				int c = raw[rawPtr++];
				if (c < '0' || c > '7')
				{
					throw new CorruptObjectException(Id, "invalid entry mode");
				}

				int mode = c - '0';

				while (true)
				{
					c = raw[rawPtr++];
					if (' ' == c) break;

					if (c < '0' || c > '7')
					{
						throw new CorruptObjectException(Id, "invalid mode");
					}

					mode <<= 3;
					mode += c - '0';
				}

				int nameLen = 0;
				while (raw[rawPtr + nameLen] != 0)
				{
					nameLen++;
				}

				var name = new byte[nameLen];
				Array.Copy(raw, rawPtr, name, 0, nameLen);
				rawPtr += nameLen + 1;

				ObjectId id = ObjectId.FromRaw(raw, rawPtr);
				rawPtr += Constants.OBJECT_ID_LENGTH;

				TreeEntry ent;
				if (FileMode.RegularFile.Equals(mode))
				{
					ent = new FileTreeEntry(this, id, name, false);
				}
				else if (FileMode.ExecutableFile.Equals(mode))
				{
					ent = new FileTreeEntry(this, id, name, true);
				}
				else if (FileMode.Tree.Equals(mode))
				{
					ent = new Tree(this, id, name);
				}
                else if (FileMode.Symlink.Equals(mode))
                {
                    ent = new SymlinkTreeEntry(this, id, name);
                }
                else if (FileMode.GitLink.Equals(mode))
                {
                    ent = new GitLinkTreeEntry(this, id, name);
                }
				else
				{
					throw new CorruptObjectException(Id, "Invalid mode: " + Convert.ToString(mode, 8));
				}

				temp[nextIndex++] = ent;
			}

			_contents = temp;
		}
 public abstract void VisitGitlink(GitLinkTreeEntry e);
Пример #5
0
 public override void VisitGitlink(GitLinkTreeEntry e)
 {
     if (e.IsModified)
     {
         throw new GitlinksNotSupportedException(e.FullName);
     }
 }
Пример #6
0
 public abstract void VisitGitlink(GitLinkTreeEntry e);