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."); } }
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; }
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 VisitSymlink(SymlinkTreeEntry s);