summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.test
diff options
context:
space:
mode:
authorJonathan Nieder <jrn@google.com>2018-12-26 13:26:23 -0800
committerJonathan Nieder <jrn@google.com>2018-12-26 13:26:23 -0800
commitf909de5c44900cb89a92ebcb1923789ee4e8e100 (patch)
tree43638c8f95b11b35013e6357693289511a01e88c /org.eclipse.jgit.test
parent3cb80a433df9d4d0a5eb8ac3d86f39dc9c8fc9d1 (diff)
parent53ab1188d50149a22b2589e6017aba259f77b10b (diff)
downloadjgit-f909de5c44900cb89a92ebcb1923789ee4e8e100.tar.gz
jgit-f909de5c44900cb89a92ebcb1923789ee4e8e100.zip
Merge branch 'stable-5.1' into stable-5.2
* stable-5.1: UploadPack: Avoid calling AdvertiseRefsHook twice Prepare 5.1.5-SNAPSHOT builds JGit v5.1.4.201812251853-r UploadPack: Filter refs used for want-ref resolution UploadPack: Defer want-ref resolution to after parsing Call AdvertiseRefsHook for protocol v2 Prepare 4.11.7-SNAPSHOT builds JGit v4.11.6.201812241910-r Prepare 4.9.9-SNAPSHOT builds JGit v4.9.8.201812241815-r UploadPack: Test filtering by AdvertiseRefsHook in stateless transports Prepare 4.7.8-SNAPSHOT builds JGit v4.7.7.201812240805-r Fix feature versions imported by feature org.eclipse.jgit.pgm Prepare 4.5.6-SNAPSHOT builds JGit v4.5.5.201812240535-r Call AdvertiseRefsHook before validating wants Change-Id: I5879df9b723a0dbf6a1eff89a34bbb269f3b773d Signed-off-by: Jonathan Nieder <jrn@google.com>
Diffstat (limited to 'org.eclipse.jgit.test')
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/ProtocolV2ParserTest.java43
1 files changed, 15 insertions, 28 deletions
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/ProtocolV2ParserTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/ProtocolV2ParserTest.java
index 6b1cbdd54d..dafa81ecd0 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/ProtocolV2ParserTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/ProtocolV2ParserTest.java
@@ -42,7 +42,6 @@
*/
package org.eclipse.jgit.transport;
-import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.hasItems;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
@@ -152,8 +151,7 @@ public class ProtocolV2ParserTest {
PacketLineIn.END);
ProtocolV2Parser parser = new ProtocolV2Parser(
ConfigBuilder.getDefault());
- FetchV2Request request = parser.parseFetchRequest(pckIn,
- testRepo.getRepository().getRefDatabase());
+ FetchV2Request request = parser.parseFetchRequest(pckIn);
assertTrue(request.getClientCapabilities()
.contains(GitProtocolConstants.OPTION_THIN_PACK));
assertTrue(request.getClientCapabilities()
@@ -183,8 +181,7 @@ public class ProtocolV2ParserTest {
PacketLineIn.END);
ProtocolV2Parser parser = new ProtocolV2Parser(
ConfigBuilder.getDefault());
- FetchV2Request request = parser.parseFetchRequest(pckIn,
- testRepo.getRepository().getRefDatabase());
+ FetchV2Request request = parser.parseFetchRequest(pckIn);
assertThat(request.getClientShallowCommits(),
hasOnlyObjectIds("28274d02c489f4c7e68153056e9061a46f62d7a0",
"145e683b229dcab9d0e2ccb01b386f9ecc17d29d"));
@@ -203,8 +200,7 @@ public class ProtocolV2ParserTest {
PacketLineIn.END);
ProtocolV2Parser parser = new ProtocolV2Parser(
ConfigBuilder.getDefault());
- FetchV2Request request = parser.parseFetchRequest(pckIn,
- testRepo.getRepository().getRefDatabase());
+ FetchV2Request request = parser.parseFetchRequest(pckIn);
assertThat(request.getClientShallowCommits(),
hasOnlyObjectIds("28274d02c489f4c7e68153056e9061a46f62d7a0",
"145e683b229dcab9d0e2ccb01b386f9ecc17d29d"));
@@ -221,8 +217,7 @@ public class ProtocolV2ParserTest {
PacketLineIn.END);
ProtocolV2Parser parser = new ProtocolV2Parser(
ConfigBuilder.getDefault());
- FetchV2Request request = parser.parseFetchRequest(pckIn,
- testRepo.getRepository().getRefDatabase());
+ FetchV2Request request = parser.parseFetchRequest(pckIn);
assertThat(request.getClientShallowCommits(),
hasOnlyObjectIds("28274d02c489f4c7e68153056e9061a46f62d7a0",
"145e683b229dcab9d0e2ccb01b386f9ecc17d29d"));
@@ -236,8 +231,7 @@ public class ProtocolV2ParserTest {
PacketLineIn.END);
ProtocolV2Parser parser = new ProtocolV2Parser(
ConfigBuilder.start().allowFilter().done());
- FetchV2Request request = parser.parseFetchRequest(pckIn,
- testRepo.getRepository().getRefDatabase());
+ FetchV2Request request = parser.parseFetchRequest(pckIn);
assertEquals(0, request.getFilterBlobLimit());
}
@@ -248,8 +242,7 @@ public class ProtocolV2ParserTest {
PacketLineIn.END);
ProtocolV2Parser parser = new ProtocolV2Parser(
ConfigBuilder.start().allowFilter().done());
- FetchV2Request request = parser.parseFetchRequest(pckIn,
- testRepo.getRepository().getRefDatabase());
+ FetchV2Request request = parser.parseFetchRequest(pckIn);
assertEquals(15, request.getFilterBlobLimit());
}
@@ -263,8 +256,7 @@ public class ProtocolV2ParserTest {
ConfigBuilder.start().allowFilter().done());
thrown.expect(PackProtocolException.class);
- parser.parseFetchRequest(pckIn,
- testRepo.getRepository().getRefDatabase());
+ parser.parseFetchRequest(pckIn);
}
@Test
@@ -275,8 +267,7 @@ public class ProtocolV2ParserTest {
ConfigBuilder.getDefault());
thrown.expect(PackProtocolException.class);
- parser.parseFetchRequest(pckIn,
- testRepo.getRepository().getRefDatabase());
+ parser.parseFetchRequest(pckIn);
}
@Test
@@ -293,16 +284,13 @@ public class ProtocolV2ParserTest {
ProtocolV2Parser parser = new ProtocolV2Parser(
ConfigBuilder.start().allowRefInWant().done());
-
- FetchV2Request request = parser.parseFetchRequest(pckIn,
- testRepo.getRepository().getRefDatabase());
+ FetchV2Request request = parser.parseFetchRequest(pckIn);
assertEquals(1, request.getWantedRefs().size());
- assertThat(request.getWantedRefs().keySet(),
+ assertThat(request.getWantedRefs(),
hasItems("refs/heads/branchA"));
- assertEquals(2, request.getWantIds().size());
+ assertEquals(1, request.getWantIds().size());
assertThat(request.getWantIds(), hasOnlyObjectIds(
- "e4980cdc48cfa1301493ca94eb70523f6788b819",
- one.getName()));
+ "e4980cdc48cfa1301493ca94eb70523f6788b819"));
}
@Test
@@ -319,10 +307,9 @@ public class ProtocolV2ParserTest {
testRepo.update("branchA", one);
testRepo.update("branchB", two);
- thrown.expect(PackProtocolException.class);
- thrown.expectMessage(containsString("refs/heads/branchC"));
- parser.parseFetchRequest(pckIn,
- testRepo.getRepository().getRefDatabase());
+ FetchV2Request request = parser.parseFetchRequest(pckIn);
+ assertEquals(1, request.getWantedRefs().size());
+ assertThat(request.getWantedRefs(), hasItems("refs/heads/branchC"));
}
@Test