private void recvCommands() { for (;;) { string line; try { line = pckIn.ReadStringNoLF(); } catch (EndOfStreamException eof) { if (commands.isEmpty()) { return; } throw eof; } if (commands.isEmpty()) { int nul = line.IndexOf('\0'); if (nul >= 0) { foreach (string c in line.Substring(nul + 1).Split(' ')) { enabledCapabilities.Add(c); } line = line.Slice(0, nul); } } if (line.Length == 0) break; if (line.Length < 83) { string m = "error: invalid protocol: wanted 'old new ref'"; sendError(m); throw new PackProtocolException(m); } ObjectId oldId = ObjectId.FromString(line.Slice(0, 40)); ObjectId newId = ObjectId.FromString(line.Slice(41, 81)); string name = line.Substring(82); ReceiveCommand cmd = new ReceiveCommand(oldId, newId, name); cmd.setRef(refs[cmd.getRefName()]); commands.Add(cmd); } }