From 5b1c40fe90b3349df985b66efc18cbe353183c66 Mon Sep 17 00:00:00 2001 From: David Pursehouse Date: Mon, 19 Mar 2018 16:58:05 +0900 Subject: [PATCH 1/2] Suppress non-localized string warnings introduced by If72b4b422 Change-Id: I2e4544d715b4284f544a26f504d01159c5843160 Signed-off-by: David Pursehouse --- .../eclipse/jgit/transport/BasePackFetchConnection.java | 4 ++-- .../src/org/eclipse/jgit/transport/UploadPack.java | 7 ++++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackFetchConnection.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackFetchConnection.java index 0de9dfd7e..c49013a8a 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackFetchConnection.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackFetchConnection.java @@ -536,9 +536,9 @@ public abstract class BasePackFetchConnection extends BasePackConnection return false; } if (filterBlobLimit == 0) { - p.writeString(OPTION_FILTER + " blob:none"); + p.writeString(OPTION_FILTER + " blob:none"); //$NON-NLS-1$ } else if (filterBlobLimit > 0) { - p.writeString(OPTION_FILTER + " blob:limit=" + filterBlobLimit); + p.writeString(OPTION_FILTER + " blob:limit=" + filterBlobLimit); //$NON-NLS-1$ } p.end(); outNeedsEnd = false; diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java index 7f36ab98d..6ae7b96d4 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java @@ -1026,11 +1026,12 @@ public class UploadPack { } filterReceived = true; - if (arg.equals("blob:none")) { + if (arg.equals("blob:none")) { //$NON-NLS-1$ filterBlobLimit = 0; - } else if (arg.startsWith("blob:limit=")) { + } else if (arg.startsWith("blob:limit=")) { //$NON-NLS-1$ try { - filterBlobLimit = Long.parseLong(arg.substring("blob:limit=".length())); + filterBlobLimit = Long.parseLong( + arg.substring("blob:limit=".length())); //$NON-NLS-1$ } catch (NumberFormatException e) { throw new PackProtocolException( MessageFormat.format(JGitText.get().invalidFilter, From 83a4d2e698183d62b90ce3fcc64c78e6a192e462 Mon Sep 17 00:00:00 2001 From: David Pursehouse Date: Mon, 19 Mar 2018 17:02:16 +0900 Subject: [PATCH 2/2] UploadPackTest: Fix name hiding introduced by If72b4b422 The local variable 'remote' hides the class scope variable of the same name. Change-Id: I7410c33678677ce2a14691772466d91e8139e3fa Signed-off-by: David Pursehouse --- .../jgit/transport/UploadPackTest.java | 52 +++++++++---------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/UploadPackTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/UploadPackTest.java index 17f21d685..5246b56bd 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/UploadPackTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/UploadPackTest.java @@ -175,14 +175,14 @@ public class UploadPackTest { @Test public void testFetchWithBlobNoneFilter() throws Exception { InMemoryRepository server2 = newRepo("server2"); - TestRepository remote = + TestRepository remote2 = new TestRepository<>(server2); - RevBlob blob1 = remote.blob("foobar"); - RevBlob blob2 = remote.blob("fooba"); - RevTree tree = remote.tree( - remote.file("1", blob1), remote.file("2", blob2)); - RevCommit commit = remote.commit(tree); - remote.update("master", commit); + RevBlob blob1 = remote2.blob("foobar"); + RevBlob blob2 = remote2.blob("fooba"); + RevTree tree = remote2.tree(remote2.file("1", blob1), + remote2.file("2", blob2)); + RevCommit commit = remote2.commit(tree); + remote2.update("master", commit); server2.getConfig().setBoolean("uploadpack", null, "allowfilter", true); @@ -211,14 +211,14 @@ public class UploadPackTest { @Test public void testFetchWithBlobLimitFilter() throws Exception { InMemoryRepository server2 = newRepo("server2"); - TestRepository remote = + TestRepository remote2 = new TestRepository<>(server2); - RevBlob longBlob = remote.blob("foobar"); - RevBlob shortBlob = remote.blob("fooba"); - RevTree tree = remote.tree( - remote.file("1", longBlob), remote.file("2", shortBlob)); - RevCommit commit = remote.commit(tree); - remote.update("master", commit); + RevBlob longBlob = remote2.blob("foobar"); + RevBlob shortBlob = remote2.blob("fooba"); + RevTree tree = remote2.tree(remote2.file("1", longBlob), + remote2.file("2", shortBlob)); + RevCommit commit = remote2.commit(tree); + remote2.update("master", commit); server2.getConfig().setBoolean("uploadpack", null, "allowfilter", true); @@ -246,14 +246,14 @@ public class UploadPackTest { @Test public void testFetchWithBlobLimitFilterAndBitmaps() throws Exception { InMemoryRepository server2 = newRepo("server2"); - TestRepository remote = + TestRepository remote2 = new TestRepository<>(server2); - RevBlob longBlob = remote.blob("foobar"); - RevBlob shortBlob = remote.blob("fooba"); - RevTree tree = remote.tree( - remote.file("1", longBlob), remote.file("2", shortBlob)); - RevCommit commit = remote.commit(tree); - remote.update("master", commit); + RevBlob longBlob = remote2.blob("foobar"); + RevBlob shortBlob = remote2.blob("fooba"); + RevTree tree = remote2.tree(remote2.file("1", longBlob), + remote2.file("2", shortBlob)); + RevCommit commit = remote2.commit(tree); + remote2.update("master", commit); server2.getConfig().setBoolean("uploadpack", null, "allowfilter", true); @@ -285,12 +285,12 @@ public class UploadPackTest { @Test public void testFetchWithNonSupportingServer() throws Exception { InMemoryRepository server2 = newRepo("server2"); - TestRepository remote = + TestRepository remote2 = new TestRepository<>(server2); - RevBlob blob = remote.blob("foo"); - RevTree tree = remote.tree(remote.file("1", blob)); - RevCommit commit = remote.commit(tree); - remote.update("master", commit); + RevBlob blob = remote2.blob("foo"); + RevTree tree = remote2.tree(remote2.file("1", blob)); + RevCommit commit = remote2.commit(tree); + remote2.update("master", commit); server2.getConfig().setBoolean("uploadpack", null, "allowfilter", false);