aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.test
diff options
context:
space:
mode:
authorShawn O. Pearce <spearce@spearce.org>2009-11-03 18:00:50 -0800
committerShawn O. Pearce <spearce@spearce.org>2010-01-12 11:56:55 -0800
commita22b8f5fac9dd9b99333d709e6ef8f09ca6cd0d7 (patch)
tree283eaba6af1a47cfe59b36f40212771531a3ee1d /org.eclipse.jgit.test
parentf945c424d0cc7688cd160fd5ed9636cd2479e378 (diff)
downloadjgit-a22b8f5fac9dd9b99333d709e6ef8f09ca6cd0d7.tar.gz
jgit-a22b8f5fac9dd9b99333d709e6ef8f09ca6cd0d7.zip
Implement multi_ack_detailed protocol extension
The multi_ack_detailed extension breaks out the "ACK %s continue" status code into "ACK %s common" and "ACK %s ready" states, making it easier to discover which objects are truely common, and which objects are simply on a chain the server doesn't care learning about. Change-Id: Ie8e907424cfbbba84996ca205d49eacf339f9d04 Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Diffstat (limited to 'org.eclipse.jgit.test')
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/PacketLineInTest.java33
1 files changed, 33 insertions, 0 deletions
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/PacketLineInTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/PacketLineInTest.java
index 1bcac9e37b..851dcc07bd 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/PacketLineInTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/PacketLineInTest.java
@@ -225,6 +225,28 @@ public class PacketLineInTest extends TestCase {
assertEOF();
}
+ public void testReadACK_ACKcommon1() throws IOException {
+ final ObjectId expid = ObjectId
+ .fromString("fcfcfb1fd94829c1a1704f894fc111d14770d34e");
+ final MutableObjectId actid = new MutableObjectId();
+
+ init("0038ACK fcfcfb1fd94829c1a1704f894fc111d14770d34e common\n");
+ assertSame(PacketLineIn.AckNackResult.ACK_COMMON, in.readACK(actid));
+ assertTrue(actid.equals(expid));
+ assertEOF();
+ }
+
+ public void testReadACK_ACKready1() throws IOException {
+ final ObjectId expid = ObjectId
+ .fromString("fcfcfb1fd94829c1a1704f894fc111d14770d34e");
+ final MutableObjectId actid = new MutableObjectId();
+
+ init("0037ACK fcfcfb1fd94829c1a1704f894fc111d14770d34e ready\n");
+ assertSame(PacketLineIn.AckNackResult.ACK_READY, in.readACK(actid));
+ assertTrue(actid.equals(expid));
+ assertEOF();
+ }
+
public void testReadACK_Invalid1() {
init("HELO");
try {
@@ -246,6 +268,17 @@ public class PacketLineInTest extends TestCase {
}
public void testReadACK_Invalid3() {
+ String s = "ACK fcfcfb1fd94829c1a1704f894fc111d14770d34e neverhappen";
+ init("003d" + s + "\n");
+ try {
+ in.readACK(new MutableObjectId());
+ fail("incorrectly accepted unsupported ACK status");
+ } catch (IOException e) {
+ assertEquals("Expected ACK/NAK, got: " + s, e.getMessage());
+ }
+ }
+
+ public void testReadACK_Invalid4() {
init("0000");
try {
in.readACK(new MutableObjectId());