Пример #1
0
 public override void VisitSymlink(SymlinkTreeEntry s)
 {
     if (s.IsModified)
     {
         throw new SymlinksNotSupportedException("Symlink \""
                 + s.FullName
                 + "\" cannot be written as the link target"
                 + " cannot be read from within Java.");
     }
 }
 public abstract void VisitSymlink(SymlinkTreeEntry s);
Пример #3
0
        private void ReadTree(byte[] raw)
        {
            int rawSize = raw.Length;
            int rawPtr = 0;
            TreeEntry[] temp;
            int nextIndex = 0;

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

            temp = new TreeEntry[nextIndex];
            rawPtr = 0;
            nextIndex = 0;
            while (rawPtr < rawSize)
            {
                int c = raw[rawPtr++];
                if (c < '0' || c > '7')
                    throw new CorruptObjectException(this.Id, "invalid entry mode");
                int mode = c - '0';
                for (; ; )
                {
                    c = raw[rawPtr++];
                    if (' ' == c)
                        break;
                    else if (c < '0' || c > '7')
                        throw new CorruptObjectException(this.Id, "invalid mode");
                    mode <<= 3;
                    mode += c - '0';
                }

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

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

                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
                    throw new CorruptObjectException(this.Id, "Invalid mode: "
                            + Convert.ToString(mode, 8));
                temp[nextIndex++] = ent;
            }

            _contents = temp;
        }
Пример #4
0
 public void VisitSymlink(SymlinkTreeEntry s)
 {
     // TODO: handle symlinks. Only problem is that JGit is independent of
     // Eclipse
     // and Pure Java does not know what to do about symbolic links.
 }