import java.io.ByteArrayInputStream;
import java.io.IOException;
+import org.eclipse.jgit.errors.PackProtocolException;
import org.eclipse.jgit.lib.Constants;
import org.eclipse.jgit.lib.MutableObjectId;
import org.eclipse.jgit.lib.ObjectId;
}
}
+ @Test
+ public void testReadACK_ERR() throws IOException {
+ init("001aERR want is not valid\n");
+ try {
+ in.readACK(new MutableObjectId());
+ fail("incorrectly accepted ERR");
+ } catch (PackProtocolException e) {
+ assertEquals("want is not valid", e.getMessage());
+ }
+ }
+
// test support
private void init(final String msg) {
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));
}