Browse Source

PacketLineIn: Deprecate DELIM constant

Deprecate DELIM with the intention of making it private in a future
release.

Callers that want to test if a packet line string is the delimiter
should use the isDelimiter(String) method.

The only other references to DELIM in the JGit code are in tests. For
those, introduce a package visible delimiter() method.

Change-Id: I21e8bbac0ffb9ef710c9753e23435416b09a4891
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
stable-5.5
David Pursehouse 6 years ago
parent
commit
e99aaa5f79
  1. 30
      org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/ProtocolV2ParserTest.java
  2. 104
      org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/UploadPackTest.java
  3. 14
      org.eclipse.jgit/src/org/eclipse/jgit/transport/PacketLineIn.java

30
org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/ProtocolV2ParserTest.java

@ -142,7 +142,7 @@ public class ProtocolV2ParserTest {
public void testFetchBasicArguments()
throws PackProtocolException, IOException {
PacketLineIn pckIn = formatAsPacketLine(
PacketLineIn.DELIM,
PacketLineIn.delimiter(),
"thin-pack", "no-progress", "include-tag", "ofs-delta",
"want 4624442d68ee402a94364191085b77137618633e",
"want f900c8326a43303685c46b279b9f70411bff1a4b",
@ -173,7 +173,7 @@ public class ProtocolV2ParserTest {
@Test
public void testFetchWithShallow_deepen() throws IOException {
PacketLineIn pckIn = formatAsPacketLine(
PacketLineIn.DELIM,
PacketLineIn.delimiter(),
"deepen 15",
"deepen-relative",
"shallow 28274d02c489f4c7e68153056e9061a46f62d7a0",
@ -193,7 +193,7 @@ public class ProtocolV2ParserTest {
@Test
public void testFetchWithShallow_deepenNot() throws IOException {
PacketLineIn pckIn = formatAsPacketLine(PacketLineIn.DELIM,
PacketLineIn pckIn = formatAsPacketLine(PacketLineIn.delimiter(),
"shallow 28274d02c489f4c7e68153056e9061a46f62d7a0",
"shallow 145e683b229dcab9d0e2ccb01b386f9ecc17d29d",
"deepen-not a08595f76159b09d57553e37a5123f1091bb13e7",
@ -210,7 +210,7 @@ public class ProtocolV2ParserTest {
@Test
public void testFetchWithShallow_deepenSince() throws IOException {
PacketLineIn pckIn = formatAsPacketLine(PacketLineIn.DELIM,
PacketLineIn pckIn = formatAsPacketLine(PacketLineIn.delimiter(),
"shallow 28274d02c489f4c7e68153056e9061a46f62d7a0",
"shallow 145e683b229dcab9d0e2ccb01b386f9ecc17d29d",
"deepen-since 123123123",
@ -226,7 +226,7 @@ public class ProtocolV2ParserTest {
@Test
public void testFetchWithNoneFilter() throws IOException {
PacketLineIn pckIn = formatAsPacketLine(PacketLineIn.DELIM,
PacketLineIn pckIn = formatAsPacketLine(PacketLineIn.delimiter(),
"filter blob:none",
PacketLineIn.END);
ProtocolV2Parser parser = new ProtocolV2Parser(
@ -238,7 +238,7 @@ public class ProtocolV2ParserTest {
@Test
public void testFetchWithBlobSizeFilter() throws IOException {
PacketLineIn pckIn = formatAsPacketLine(PacketLineIn.DELIM,
PacketLineIn pckIn = formatAsPacketLine(PacketLineIn.delimiter(),
"filter blob:limit=15",
PacketLineIn.END);
ProtocolV2Parser parser = new ProtocolV2Parser(
@ -250,7 +250,7 @@ public class ProtocolV2ParserTest {
@Test
public void testFetchWithTreeDepthFilter() throws IOException {
PacketLineIn pckIn = formatAsPacketLine(PacketLineIn.DELIM,
PacketLineIn pckIn = formatAsPacketLine(PacketLineIn.delimiter(),
"filter tree:3",
PacketLineIn.END);
ProtocolV2Parser parser = new ProtocolV2Parser(
@ -262,7 +262,7 @@ public class ProtocolV2ParserTest {
@Test
public void testFetchMustNotHaveMultipleFilters() throws IOException {
PacketLineIn pckIn = formatAsPacketLine(PacketLineIn.DELIM,
PacketLineIn pckIn = formatAsPacketLine(PacketLineIn.delimiter(),
"filter blob:none",
"filter blob:limit=12",
PacketLineIn.END);
@ -275,7 +275,7 @@ public class ProtocolV2ParserTest {
@Test
public void testFetchFilterWithoutAllowFilter() throws IOException {
PacketLineIn pckIn = formatAsPacketLine(PacketLineIn.DELIM,
PacketLineIn pckIn = formatAsPacketLine(PacketLineIn.delimiter(),
"filter blob:limit=12", PacketLineIn.END);
ProtocolV2Parser parser = new ProtocolV2Parser(
ConfigBuilder.getDefault());
@ -291,7 +291,7 @@ public class ProtocolV2ParserTest {
testRepo.update("branchA", one);
testRepo.update("branchB", two);
PacketLineIn pckIn = formatAsPacketLine(PacketLineIn.DELIM,
PacketLineIn pckIn = formatAsPacketLine(PacketLineIn.delimiter(),
"want e4980cdc48cfa1301493ca94eb70523f6788b819",
"want-ref refs/heads/branchA",
PacketLineIn.END);
@ -309,7 +309,7 @@ public class ProtocolV2ParserTest {
@Test
public void testFetchWithRefInWantUnknownRef() throws Exception {
PacketLineIn pckIn = formatAsPacketLine(PacketLineIn.DELIM,
PacketLineIn pckIn = formatAsPacketLine(PacketLineIn.delimiter(),
"want e4980cdc48cfa1301493ca94eb70523f6788b819",
"want-ref refs/heads/branchC",
PacketLineIn.END);
@ -328,7 +328,7 @@ public class ProtocolV2ParserTest {
@Test
public void testLsRefsMinimalReq() throws IOException {
PacketLineIn pckIn = formatAsPacketLine(PacketLineIn.DELIM,
PacketLineIn pckIn = formatAsPacketLine(PacketLineIn.delimiter(),
PacketLineIn.END);
ProtocolV2Parser parser = new ProtocolV2Parser(
@ -341,7 +341,7 @@ public class ProtocolV2ParserTest {
@Test
public void testLsRefsSymrefs() throws IOException {
PacketLineIn pckIn = formatAsPacketLine(PacketLineIn.DELIM, "symrefs",
PacketLineIn pckIn = formatAsPacketLine(PacketLineIn.delimiter(), "symrefs",
PacketLineIn.END);
ProtocolV2Parser parser = new ProtocolV2Parser(
@ -356,7 +356,7 @@ public class ProtocolV2ParserTest {
@Test
public void testLsRefsPeel() throws IOException {
PacketLineIn pckIn = formatAsPacketLine(
PacketLineIn.DELIM,
PacketLineIn.delimiter(),
"peel",
PacketLineIn.END);
@ -370,7 +370,7 @@ public class ProtocolV2ParserTest {
@Test
public void testLsRefsRefPrefixes() throws IOException {
PacketLineIn pckIn = formatAsPacketLine(PacketLineIn.DELIM,
PacketLineIn pckIn = formatAsPacketLine(PacketLineIn.delimiter(),
"ref-prefix refs/for", "ref-prefix refs/heads",
PacketLineIn.END);

104
org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/UploadPackTest.java

@ -608,7 +608,7 @@ public class UploadPackTest {
RevTag tag = remote.tag("tag", tip);
remote.update("refs/tags/tag", tag);
ByteArrayInputStream recvStream = uploadPackV2("command=ls-refs\n", PacketLineIn.DELIM, "symrefs", PacketLineIn.END);
ByteArrayInputStream recvStream = uploadPackV2("command=ls-refs\n", PacketLineIn.delimiter(), "symrefs", PacketLineIn.END);
PacketLineIn pckIn = new PacketLineIn(recvStream);
assertThat(pckIn.readString(), is(tip.toObjectId().getName() + " HEAD symref-target:refs/heads/master"));
@ -625,7 +625,7 @@ public class UploadPackTest {
RevTag tag = remote.tag("tag", tip);
remote.update("refs/tags/tag", tag);
ByteArrayInputStream recvStream = uploadPackV2("command=ls-refs\n", PacketLineIn.DELIM, "peel", PacketLineIn.END);
ByteArrayInputStream recvStream = uploadPackV2("command=ls-refs\n", PacketLineIn.delimiter(), "peel", PacketLineIn.END);
PacketLineIn pckIn = new PacketLineIn(recvStream);
assertThat(pckIn.readString(), is(tip.toObjectId().getName() + " HEAD"));
@ -646,8 +646,8 @@ public class UploadPackTest {
remote.update("refs/tags/tag", tag);
ByteArrayInputStream recvStream = uploadPackV2(
"command=ls-refs\n", PacketLineIn.DELIM, "symrefs", "peel", PacketLineIn.END,
"command=ls-refs\n", PacketLineIn.DELIM, PacketLineIn.END);
"command=ls-refs\n", PacketLineIn.delimiter(), "symrefs", "peel", PacketLineIn.END,
"command=ls-refs\n", PacketLineIn.delimiter(), PacketLineIn.END);
PacketLineIn pckIn = new PacketLineIn(recvStream);
assertThat(pckIn.readString(), is(tip.toObjectId().getName() + " HEAD symref-target:refs/heads/master"));
@ -672,7 +672,7 @@ public class UploadPackTest {
ByteArrayInputStream recvStream = uploadPackV2(
"command=ls-refs\n",
PacketLineIn.DELIM,
PacketLineIn.delimiter(),
"ref-prefix refs/heads/maste",
"ref-prefix refs/heads/other",
PacketLineIn.END);
@ -691,7 +691,7 @@ public class UploadPackTest {
ByteArrayInputStream recvStream = uploadPackV2(
"command=ls-refs\n",
PacketLineIn.DELIM,
PacketLineIn.delimiter(),
"ref-prefix refs/heads/maste",
"ref-prefix r",
PacketLineIn.END);
@ -708,7 +708,7 @@ public class UploadPackTest {
thrown.expectMessage("unexpected invalid-argument");
uploadPackV2(
"command=ls-refs\n",
PacketLineIn.DELIM,
PacketLineIn.delimiter(),
"invalid-argument\n",
PacketLineIn.END);
}
@ -717,7 +717,7 @@ public class UploadPackTest {
public void testV2LsRefsServerOptions() throws Exception {
String[] lines = { "command=ls-refs\n",
"server-option=one\n", "server-option=two\n",
PacketLineIn.DELIM,
PacketLineIn.delimiter(),
PacketLineIn.END };
TestV2Hook testHook = new TestV2Hook();
@ -762,7 +762,7 @@ public class UploadPackTest {
null,
null,
"command=fetch\n",
PacketLineIn.DELIM,
PacketLineIn.delimiter(),
"want " + advertized.name() + "\n",
PacketLineIn.END);
@ -775,7 +775,7 @@ public class UploadPackTest {
null,
null,
"command=fetch\n",
PacketLineIn.DELIM,
PacketLineIn.delimiter(),
"want " + unadvertized.name() + "\n",
PacketLineIn.END);
}
@ -793,7 +793,7 @@ public class UploadPackTest {
null,
null,
"command=fetch\n",
PacketLineIn.DELIM,
PacketLineIn.delimiter(),
"want " + reachable.name() + "\n",
PacketLineIn.END);
@ -806,7 +806,7 @@ public class UploadPackTest {
null,
null,
"command=fetch\n",
PacketLineIn.DELIM,
PacketLineIn.delimiter(),
"want " + unreachable.name() + "\n",
PacketLineIn.END);
}
@ -823,7 +823,7 @@ public class UploadPackTest {
new RejectAllRefFilter(),
null,
"command=fetch\n",
PacketLineIn.DELIM,
PacketLineIn.delimiter(),
"want " + tip.name() + "\n",
PacketLineIn.END);
@ -836,7 +836,7 @@ public class UploadPackTest {
new RejectAllRefFilter(),
null,
"command=fetch\n",
PacketLineIn.DELIM,
PacketLineIn.delimiter(),
"want " + parentOfTip.name() + "\n",
PacketLineIn.END);
}
@ -854,7 +854,7 @@ public class UploadPackTest {
new RejectAllRefFilter(),
null,
"command=fetch\n",
PacketLineIn.DELIM,
PacketLineIn.delimiter(),
"want " + parentOfTip.name() + "\n",
PacketLineIn.END);
@ -867,7 +867,7 @@ public class UploadPackTest {
new RejectAllRefFilter(),
null,
"command=fetch\n",
PacketLineIn.DELIM,
PacketLineIn.delimiter(),
"want " + unreachable.name() + "\n",
PacketLineIn.END);
}
@ -882,7 +882,7 @@ public class UploadPackTest {
null,
null,
"command=fetch\n",
PacketLineIn.DELIM,
PacketLineIn.delimiter(),
"want " + unreachable.name() + "\n",
PacketLineIn.END);
}
@ -898,7 +898,7 @@ public class UploadPackTest {
ByteArrayInputStream recvStream = uploadPackV2(
"command=fetch\n",
PacketLineIn.DELIM,
PacketLineIn.delimiter(),
"want " + fooChild.toObjectId().getName() + "\n",
"want " + barChild.toObjectId().getName() + "\n",
"have " + fooParent.toObjectId().getName() + "\n",
@ -921,7 +921,7 @@ public class UploadPackTest {
ByteArrayInputStream recvStream = uploadPackV2(
"command=fetch\n",
PacketLineIn.DELIM,
PacketLineIn.delimiter(),
"want " + fooChild.toObjectId().getName() + "\n",
"want " + barChild.toObjectId().getName() + "\n",
"have " + fooParent.toObjectId().getName() + "\n",
@ -956,7 +956,7 @@ public class UploadPackTest {
ByteArrayInputStream recvStream = uploadPackV2(
"command=fetch\n",
PacketLineIn.DELIM,
PacketLineIn.delimiter(),
"want " + fooChild.toObjectId().getName() + "\n",
"want " + barChild.toObjectId().getName() + "\n",
"have " + fooParent.toObjectId().getName() + "\n",
@ -985,7 +985,7 @@ public class UploadPackTest {
// Pretend that we have parent to get a thin pack based on it.
ByteArrayInputStream recvStream = uploadPackV2(
"command=fetch\n",
PacketLineIn.DELIM,
PacketLineIn.delimiter(),
"want " + child.toObjectId().getName() + "\n",
"have " + parent.toObjectId().getName() + "\n",
"thin-pack\n",
@ -1011,7 +1011,7 @@ public class UploadPackTest {
StringWriter sw = new StringWriter();
ByteArrayInputStream recvStream = uploadPackV2(
"command=fetch\n",
PacketLineIn.DELIM,
PacketLineIn.delimiter(),
"want " + commit.toObjectId().getName() + "\n",
"done\n",
PacketLineIn.END);
@ -1024,7 +1024,7 @@ public class UploadPackTest {
sw = new StringWriter();
recvStream = uploadPackV2(
"command=fetch\n",
PacketLineIn.DELIM,
PacketLineIn.delimiter(),
"want " + commit.toObjectId().getName() + "\n",
"no-progress\n",
"done\n",
@ -1045,7 +1045,7 @@ public class UploadPackTest {
// Without include-tag.
ByteArrayInputStream recvStream = uploadPackV2(
"command=fetch\n",
PacketLineIn.DELIM,
PacketLineIn.delimiter(),
"want " + commit.toObjectId().getName() + "\n",
"done\n",
PacketLineIn.END);
@ -1057,7 +1057,7 @@ public class UploadPackTest {
// With tag.
recvStream = uploadPackV2(
"command=fetch\n",
PacketLineIn.DELIM,
PacketLineIn.delimiter(),
"want " + commit.toObjectId().getName() + "\n",
"include-tag\n",
"done\n",
@ -1081,7 +1081,7 @@ public class UploadPackTest {
// Without ofs-delta.
ByteArrayInputStream recvStream = uploadPackV2(
"command=fetch\n",
PacketLineIn.DELIM,
PacketLineIn.delimiter(),
"want " + child.toObjectId().getName() + "\n",
"done\n",
PacketLineIn.END);
@ -1093,7 +1093,7 @@ public class UploadPackTest {
// With ofs-delta.
recvStream = uploadPackV2(
"command=fetch\n",
PacketLineIn.DELIM,
PacketLineIn.delimiter(),
"want " + child.toObjectId().getName() + "\n",
"ofs-delta\n",
"done\n",
@ -1115,7 +1115,7 @@ public class UploadPackTest {
// commonParent, so it doesn't send it.
ByteArrayInputStream recvStream = uploadPackV2(
"command=fetch\n",
PacketLineIn.DELIM,
PacketLineIn.delimiter(),
"want " + barChild.toObjectId().getName() + "\n",
"have " + fooChild.toObjectId().getName() + "\n",
"done\n",
@ -1130,7 +1130,7 @@ public class UploadPackTest {
// commonParent, so it sends it.
recvStream = uploadPackV2(
"command=fetch\n",
PacketLineIn.DELIM,
PacketLineIn.delimiter(),
"want " + barChild.toObjectId().getName() + "\n",
"have " + fooChild.toObjectId().getName() + "\n",
"shallow " + fooChild.toObjectId().getName() + "\n",
@ -1151,7 +1151,7 @@ public class UploadPackTest {
// "deepen 1" sends only the child.
ByteArrayInputStream recvStream = uploadPackV2(
"command=fetch\n",
PacketLineIn.DELIM,
PacketLineIn.delimiter(),
"want " + child.toObjectId().getName() + "\n",
"deepen 1\n",
"done\n",
@ -1168,7 +1168,7 @@ public class UploadPackTest {
// Without that, the parent is sent too.
recvStream = uploadPackV2(
"command=fetch\n",
PacketLineIn.DELIM,
PacketLineIn.delimiter(),
"want " + child.toObjectId().getName() + "\n",
"done\n",
PacketLineIn.END);
@ -1186,7 +1186,7 @@ public class UploadPackTest {
ByteArrayInputStream recvStream = uploadPackV2(
"command=fetch\n",
PacketLineIn.DELIM,
PacketLineIn.delimiter(),
"want " + child.toObjectId().getName() + "\n",
"deepen 1\n",
PacketLineIn.END);
@ -1218,7 +1218,7 @@ public class UploadPackTest {
// Report that we only have "boundary" as a shallow boundary.
ByteArrayInputStream recvStream = uploadPackV2(
"command=fetch\n",
PacketLineIn.DELIM,
PacketLineIn.delimiter(),
"shallow " + boundary.toObjectId().getName() + "\n",
"deepen-since 1510000\n",
"want " + merge.toObjectId().getName() + "\n",
@ -1269,7 +1269,7 @@ public class UploadPackTest {
ByteArrayInputStream recvStream = uploadPackV2(
"command=fetch\n",
PacketLineIn.DELIM,
PacketLineIn.delimiter(),
"deepen-since 1510000\n",
"want " + child1.toObjectId().getName() + "\n",
"want " + child2.toObjectId().getName() + "\n",
@ -1308,7 +1308,7 @@ public class UploadPackTest {
thrown.expectMessage("No commits selected for shallow request");
uploadPackV2(
"command=fetch\n",
PacketLineIn.DELIM,
PacketLineIn.delimiter(),
"deepen-since 1510000\n",
"want " + tooOld.toObjectId().getName() + "\n",
"done\n",
@ -1331,7 +1331,7 @@ public class UploadPackTest {
// wants "merge" while excluding "side".
ByteArrayInputStream recvStream = uploadPackV2(
"command=fetch\n",
PacketLineIn.DELIM,
PacketLineIn.delimiter(),
"shallow " + three.toObjectId().getName() + "\n",
"deepen-not side\n",
"want " + merge.toObjectId().getName() + "\n",
@ -1384,7 +1384,7 @@ public class UploadPackTest {
thrown.expectMessage("No commits selected for shallow request");
uploadPackV2(
"command=fetch\n",
PacketLineIn.DELIM,
PacketLineIn.delimiter(),
"deepen-not four\n",
"want " + two.toObjectId().getName() + "\n",
"done\n",
@ -1404,7 +1404,7 @@ public class UploadPackTest {
ByteArrayInputStream recvStream = uploadPackV2(
"command=fetch\n",
PacketLineIn.DELIM,
PacketLineIn.delimiter(),
"deepen-not twotag\n",
"want " + four.toObjectId().getName() + "\n",
"done\n",
@ -1438,7 +1438,7 @@ public class UploadPackTest {
ByteArrayInputStream recvStream = uploadPackV2(
"command=fetch\n",
PacketLineIn.DELIM,
PacketLineIn.delimiter(),
"deepen-not base\n",
"want " + child1.toObjectId().getName() + "\n",
"want " + child2.toObjectId().getName() + "\n",
@ -1470,7 +1470,7 @@ public class UploadPackTest {
thrown.expectMessage("unexpected invalid-argument");
uploadPackV2(
"command=fetch\n",
PacketLineIn.DELIM,
PacketLineIn.delimiter(),
"invalid-argument\n",
PacketLineIn.END);
}
@ -1478,7 +1478,7 @@ public class UploadPackTest {
@Test
public void testV2FetchServerOptions() throws Exception {
String[] lines = { "command=fetch\n", "server-option=one\n",
"server-option=two\n", PacketLineIn.DELIM,
"server-option=two\n", PacketLineIn.delimiter(),
PacketLineIn.END };
TestV2Hook testHook = new TestV2Hook();
@ -1503,7 +1503,7 @@ public class UploadPackTest {
ByteArrayInputStream recvStream = uploadPackV2(
"command=fetch\n",
PacketLineIn.DELIM,
PacketLineIn.delimiter(),
"want " + commit.toObjectId().getName() + "\n",
"filter blob:limit=5\n",
"done\n",
@ -1558,7 +1558,7 @@ public class UploadPackTest {
List<String> input = new ArrayList<>();
input.add("command=fetch\n");
input.add(PacketLineIn.DELIM);
input.add(PacketLineIn.delimiter());
for (ObjectId want : wants) {
input.add("want " + want.getName() + "\n");
}
@ -1845,7 +1845,7 @@ public class UploadPackTest {
thrown.expectMessage("unexpected filter blob:limit=5");
uploadPackV2(
"command=fetch\n",
PacketLineIn.DELIM,
PacketLineIn.delimiter(),
"want " + commit.toObjectId().getName() + "\n",
"filter blob:limit=5\n",
"done\n",
@ -1860,7 +1860,7 @@ public class UploadPackTest {
try {
uploadPackV2(
"command=fetch\n",
PacketLineIn.DELIM,
PacketLineIn.delimiter(),
"want-ref refs/heads/one\n",
"done\n",
PacketLineIn.END);
@ -1886,7 +1886,7 @@ public class UploadPackTest {
ByteArrayInputStream recvStream = uploadPackV2(
"command=fetch\n",
PacketLineIn.DELIM,
PacketLineIn.delimiter(),
"want-ref refs/heads/one\n",
"want-ref refs/heads/two\n",
"done\n",
@ -1917,7 +1917,7 @@ public class UploadPackTest {
try {
uploadPackV2(
"command=fetch\n",
PacketLineIn.DELIM,
PacketLineIn.delimiter(),
"want-ref refs/heads/one\n",
"want-ref refs/heads/nonExistentRef\n",
"done\n",
@ -1944,7 +1944,7 @@ public class UploadPackTest {
ByteArrayInputStream recvStream = uploadPackV2(
"command=fetch\n",
PacketLineIn.DELIM,
PacketLineIn.delimiter(),
"want-ref refs/heads/one\n",
"want " + two.toObjectId().getName() + "\n",
"done\n",
@ -1972,7 +1972,7 @@ public class UploadPackTest {
ByteArrayInputStream recvStream = uploadPackV2(
"command=fetch\n",
PacketLineIn.DELIM,
PacketLineIn.delimiter(),
"want-ref refs/heads/one\n",
"have " + one.toObjectId().getName(),
"done\n",
@ -2004,7 +2004,7 @@ public class UploadPackTest {
ByteArrayInputStream recvStream = uploadPackV2(
"command=fetch\n",
PacketLineIn.DELIM,
PacketLineIn.delimiter(),
"want-ref refs/heads/branch1\n",
"deepen 1\n",
"done\n",
@ -2035,7 +2035,7 @@ public class UploadPackTest {
true);
ByteArrayInputStream recvStream = uploadPackV2("command=fetch\n",
PacketLineIn.DELIM,
PacketLineIn.delimiter(),
"want-ref refs/heads/three\n",
"deepen 3",
"shallow 0123012301230123012301230123012301230123",
@ -2091,7 +2091,7 @@ public class UploadPackTest {
ByteArrayInputStream send = linesAsInputStream(
"command=fetch\n", "agent=JGit-test/1.2.4\n",
PacketLineIn.DELIM, "want " + one.getName() + "\n",
PacketLineIn.delimiter(), "want " + one.getName() + "\n",
"have 11cedf1b796d44207da702f7d420684022fc0f09\n", "done\n",
PacketLineIn.END);

14
org.eclipse.jgit/src/org/eclipse/jgit/transport/PacketLineIn.java

@ -79,7 +79,10 @@ public class PacketLineIn {
* Magic return from {@link #readString()} when a delim packet is found.
*
* @since 5.0
* @deprecated Callers should use {@link #isDelimiter(String)} to check if a
* string is the delimiter.
*/
@Deprecated
public static final String DELIM = new StringBuilder(0).toString(); /* must not string pool */
static enum AckNackResult {
@ -236,6 +239,17 @@ public class PacketLineIn {
return s == DELIM;
}
/**
* Get the delimiter marker.
* <p>
* Intended for use only in tests.
*
* @return The delimiter marker.
*/
static String delimiter() {
return DELIM;
}
/**
* Check if a string is the packet end marker.
*

Loading…
Cancel
Save