aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.test/tst
diff options
context:
space:
mode:
authorJonathan Nieder <jrn@google.com>2018-08-31 20:02:51 -0400
committerGerrit Code Review @ Eclipse.org <gerrit@eclipse.org>2018-08-31 20:02:51 -0400
commitce38391e09464f8b7bf93f196a8be71ff8c106f3 (patch)
tree8d0db4565a25c59a639f3d589bac3ca81ec56ae4 /org.eclipse.jgit.test/tst
parenta8c38bc767778f718b24cca4a97b624c16278fb8 (diff)
parentc398fb2b6b5be13251a74ba36b5fd5a9ef360a1a (diff)
downloadjgit-ce38391e09464f8b7bf93f196a8be71ff8c106f3.tar.gz
jgit-ce38391e09464f8b7bf93f196a8be71ff8c106f3.zip
Merge "Replace useminimalnegotation flag with maxhaves flag"
Diffstat (limited to 'org.eclipse.jgit.test/tst')
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/TestProtocolTest.java22
1 files changed, 4 insertions, 18 deletions
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/TestProtocolTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/TestProtocolTest.java
index 86c92bb528..953c9fc30a 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/TestProtocolTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/TestProtocolTest.java
@@ -77,6 +77,7 @@ public class TestProtocolTest {
"+refs/heads/master:refs/heads/master");
private static final int HAVES_PER_ROUND = 32;
+ private static final int MAX_HAVES = 256;
private static class User {
private final String name;
@@ -187,7 +188,7 @@ public class TestProtocolTest {
}
@Test
- public void testMinimalNegotiation() throws Exception {
+ public void testMaxHaves() throws Exception {
TestProtocol<User> proto = registerDefault();
URIish uri = proto.register(new User("user"), remote.getRepository());
@@ -200,28 +201,13 @@ public class TestProtocolTest {
RevCommit master = remote.branch("master").commit()
.add("readme.txt", "unique commit").create();
- TestProtocol.setFetchConfig(new FetchConfig(true, true));
+ TestProtocol.setFetchConfig(new FetchConfig(true, MAX_HAVES));
try (Git git = new Git(local.getRepository())) {
assertNull(local.getRepository().exactRef("refs/heads/master"));
git.fetch().setRemote(uri.toString()).setRefSpecs(MASTER).call();
assertEquals(master, local.getRepository()
.exactRef("refs/heads/master").getObjectId());
- assertTrue(havesCount <= 2 * HAVES_PER_ROUND);
-
- // Update the remote master and add local branches for 5 more rounds
- // of negotiation, where the local branch commits have newer
- // timestamps. Negotiation should send 5 rounds for those newer
- // branches before getting to the round that sends its stale version
- // of master.
- master = remote.branch("master").commit().parent(master).create();
- local.tick(2 * HAVES_PER_ROUND);
- for (int i = 0; i < 5 * HAVES_PER_ROUND; i++) {
- local.branch("local-" + i).commit().create();
- }
- git.fetch().setRemote(uri.toString()).setRefSpecs(MASTER).call();
- assertEquals(master, local.getRepository()
- .exactRef("refs/heads/master").getObjectId());
- assertEquals(6 * HAVES_PER_ROUND, havesCount);
+ assertTrue(havesCount <= MAX_HAVES);
}
}