}
AckNackResult readACK(final MutableObjectId returnedId) throws IOException {
final String line = readString();
if (line.length() == 0)
throw new PackProtocolException(JGitText.get().expectedACKNAKFoundEOF);
if ("NAK".equals(line))
return AckNackResult.NAK;
if (line.startsWith("ACK ")) {
returnedId.fromString(line.substring(4, 44));
if (line.length() == 44)
return AckNackResult.ACK;
final String arg = line.substring(44);
if (arg.equals(" continue"))
return AckNackResult.ACK_CONTINUE;
else if (arg.equals(" common"))
return AckNackResult.ACK_COMMON;
else if (arg.equals(" ready"))
return AckNackResult.ACK_READY;
}
if (line.startsWith("ERR "))
throw new PackProtocolException(line.substring(4));
throw new PackProtocolException(MessageFormat.format(JGitText.get().expectedACKNAKGot, line));
}