From 064691e90c4cbf1c550cb65b41b91e6fa07c7c81 Mon Sep 17 00:00:00 2001 From: Kaushik Lingarkar Date: Tue, 4 Apr 2023 18:05:53 -0700 Subject: [PATCH 1/8] UploadPack: Fix NPE when traversing a tag chain Always parse RevTags including their body before getting their object to ensure that non-cached objects are handled correctly when traversing a tag chain. An NPE in UploadPack#addTagChain will occur on a depth=1 fetch of a branch containing a tag chain and the ref to one of the middle tags in the chain is deleted. Change-Id: Ifd8fe868869070b365df926fec5dcd8e64d4f521 Signed-off-by: Kaushik Lingarkar --- .../jgit/transport/UploadPackTest.java | 69 +++++++++++++++++++ .../eclipse/jgit/transport/UploadPack.java | 27 ++++---- 2 files changed, 83 insertions(+), 13 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 713190585..2b05decb4 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 @@ -2538,6 +2538,75 @@ public void onSendPack(UploadPack up, } } + @Test + public void testSingleBranchShallowCloneTagChainWithReflessTag() throws Exception { + RevCommit one = remote.commit().message("1").create(); + remote.update("master", one); + RevTag tag1 = remote.tag("t1", one); + remote.lightweightTag("t1", tag1); + RevTag tag2 = remote.tag("t2", tag1); + RevTag tag3 = remote.tag("t3", tag2); + remote.lightweightTag("t3", tag3); + + UploadPack uploadPack = new UploadPack(remote.getRepository()); + + ByteArrayOutputStream cli = new ByteArrayOutputStream(); + PacketLineOut clientWant = new PacketLineOut(cli); + clientWant.writeString("want " + one.name() + " include-tag"); + clientWant.writeString("deepen 1\n"); + clientWant.end(); + clientWant.writeString("done\n"); + + try (ByteArrayOutputStream serverResponse = new ByteArrayOutputStream()) { + + uploadPack.setPreUploadHook(new PreUploadHook() { + @Override + public void onBeginNegotiateRound(UploadPack up, + Collection wants, int cntOffered) + throws ServiceMayNotContinueException { + // Do nothing. + } + + @Override + public void onEndNegotiateRound(UploadPack up, + Collection wants, int cntCommon, + int cntNotFound, boolean ready) + throws ServiceMayNotContinueException { + // Do nothing. + } + + @Override + public void onSendPack(UploadPack up, + Collection wants, + Collection haves) + throws ServiceMayNotContinueException { + // collect pack data + serverResponse.reset(); + } + }); + uploadPack.upload(new ByteArrayInputStream(cli.toByteArray()), + serverResponse, System.err); + ByteArrayInputStream packReceived = new ByteArrayInputStream( + serverResponse.toByteArray()); + PackLock lock = null; + try (ObjectInserter ins = client.newObjectInserter()) { + PackParser parser = ins.newPackParser(packReceived); + parser.setAllowThin(true); + parser.setLockMessage("receive-tag-chain"); + ProgressMonitor mlc = NullProgressMonitor.INSTANCE; + lock = parser.parse(mlc, mlc); + ins.flush(); + } finally { + if (lock != null) { + lock.unlock(); + } + } + InMemoryRepository.MemObjDatabase objDb = client + .getObjectDatabase(); + assertTrue(objDb.has(one.toObjectId())); + } + } + @Test public void testSafeToClearRefsInFetchV0() throws Exception { server = 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 6cb8fe43c..0c23c8cad 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java @@ -2405,11 +2405,11 @@ else if (ref.getName().startsWith(Constants.R_HEADS)) if (peeledId == null || objectId == null) continue; - objectId = ref.getObjectId(); - if (pw.willInclude(peeledId) && !pw.willInclude(objectId)) { - RevObject o = rw.parseAny(objectId); - addTagChain(o, pw); - pw.addObject(o); + if (pw.willInclude(peeledId)) { + // We don't need to handle parseTag throwing an + // IncorrectObjectTypeException as we only reach + // here when ref is an annotated tag + addTagChain(rw.parseTag(objectId), pw); } } } @@ -2459,15 +2459,16 @@ private static void findSymrefs( } private void addTagChain( - RevObject o, PackWriter pw) throws IOException { - while (Constants.OBJ_TAG == o.getType()) { - RevTag t = (RevTag) o; - o = t.getObject(); - if (o.getType() == Constants.OBJ_TAG && !pw.willInclude(o.getId())) { - walk.parseBody(o); - pw.addObject(o); + RevTag tag, PackWriter pw) throws IOException { + RevObject o = tag; + do { + tag = (RevTag) o; + walk.parseBody(tag); + if (!pw.willInclude(tag.getId())) { + pw.addObject(tag); } - } + o = tag.getObject(); + } while (Constants.OBJ_TAG == o.getType()); } private static class ResponseBufferedOutputStream extends OutputStream { From 032eef5b12a25e0da48004eea589966ae0652433 Mon Sep 17 00:00:00 2001 From: Matthias Sohn Date: Fri, 21 Apr 2023 08:51:08 +0200 Subject: [PATCH 2/8] Parse pull.rebase=preserve as alias for pull.rebase=merges This ensures backwards compatibility to the old config value which was removed in git 2.34 which JGit followed in Ic07ff954e2. Change-Id: I2b4e27fd71898b6e0e227e406c40682bd9786cd4 --- .../org/eclipse/jgit/api/PullCommandTest.java | 15 +++++++ .../eclipse/jgit/lib/BranchConfigTest.java | 45 ++++++++++++++++++- .../org/eclipse/jgit/lib/BranchConfig.java | 7 ++- 3 files changed, 65 insertions(+), 2 deletions(-) diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/PullCommandTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/PullCommandTest.java index 7a0ffdbec..12300b339 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/PullCommandTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/PullCommandTest.java @@ -393,6 +393,21 @@ public void testPullWithRebaseMerges1Config() throws Exception { doTestPullWithRebase(setup, TestPullMode.REBASE_MERGES); } + @Test + /** + * global rebase config using old "preserve" value which was renamed to + * "merges" should be respected to ensure backwards compatibility + */ + public void testPullWithRebaseMerges1ConfigAlias() throws Exception { + Callable setup = () -> { + StoredConfig config = dbTarget.getConfig(); + config.setString("pull", null, "rebase", "preserve"); + config.save(); + return target.pull().call(); + }; + doTestPullWithRebase(setup, TestPullMode.REBASE_MERGES); + } + @Test /** the branch-local config should win over the global config */ public void testPullWithRebaseMergesConfig2() throws Exception { diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/BranchConfigTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/BranchConfigTest.java index 1374ea261..2c9097f37 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/BranchConfigTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/BranchConfigTest.java @@ -14,9 +14,11 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertThrows; import static org.junit.Assert.assertTrue; import org.eclipse.jgit.errors.ConfigInvalidException; +import org.eclipse.jgit.lib.BranchConfig.BranchRebaseMode; import org.junit.Test; public class BranchConfigTest { @@ -113,6 +115,38 @@ public void getTrackingBranchShouldHandleNormalCaseForRemoteTrackingBranch() { branchConfig.getTrackingBranch()); } + @Test + public void testRebaseMode() { + Config c = parse("" // + + "[branch \"undefined\"]\n" + + "[branch \"false\"]\n" + + " rebase = false\n" + + "[branch \"true\"]\n" + + " rebase = true\n" + + "[branch \"interactive\"]\n" + + " rebase = interactive\n" + + "[branch \"merges\"]\n" + + " rebase = merges\n" + + "[branch \"preserve\"]\n" + + " rebase = preserve\n" + + "[branch \"illegal\"]\n" + + " rebase = illegal\n"); + assertEquals(BranchRebaseMode.NONE, + new BranchConfig(c, " undefined").getRebaseMode()); + assertEquals(BranchRebaseMode.NONE, + new BranchConfig(c, "false").getRebaseMode()); + assertEquals(BranchRebaseMode.REBASE, + new BranchConfig(c, "true").getRebaseMode()); + assertEquals(BranchRebaseMode.INTERACTIVE, + new BranchConfig(c, "interactive").getRebaseMode()); + assertEquals(BranchRebaseMode.MERGES, + new BranchConfig(c, "merges").getRebaseMode()); + assertEquals(BranchRebaseMode.MERGES, + new BranchConfig(c, "preserve").getRebaseMode()); + assertThrows(IllegalArgumentException.class, + () -> new BranchConfig(c, "illegal").getRebaseMode()); + } + @Test public void isRebase() { Config c = parse("" // @@ -120,11 +154,20 @@ public void isRebase() { + "[branch \"false\"]\n" + " rebase = false\n" + "[branch \"true\"]\n" - + " rebase = true\n"); + + " rebase = true\n" + + "[branch \"interactive\"]\n" + + " rebase = interactive\n" + + "[branch \"merges\"]\n" + + " rebase = merges\n" + + "[branch \"preserve\"]\n" + + " rebase = preserve\n"); assertFalse(new BranchConfig(c, "undefined").isRebase()); assertFalse(new BranchConfig(c, "false").isRebase()); assertTrue(new BranchConfig(c, "true").isRebase()); + assertTrue(new BranchConfig(c, "interactive").isRebase()); + assertTrue(new BranchConfig(c, "merges").isRebase()); + assertTrue(new BranchConfig(c, "preserve").isRebase()); } private static Config parse(String content) { diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/BranchConfig.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/BranchConfig.java index 19495dff1..e15c7af93 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/BranchConfig.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/BranchConfig.java @@ -35,7 +35,12 @@ public enum BranchRebaseMode implements Config.ConfigEnum { * * @since 6.5 used instead of deprecated "preserve" option */ - MERGES("merges"), //$NON-NLS-1$ + MERGES("merges"){ //$NON-NLS-1$ + @Override + public boolean matchConfigValue(String s) { + return super.matchConfigValue(s) || "preserve".equals(s); //$NON-NLS-1$ + } + }, /** Value for rebasing interactively */ INTERACTIVE("interactive"), //$NON-NLS-1$ /** Value for not rebasing at all but merging */ From f3a3a2e8772222d89e4fbcf1dab43aa08935ea97 Mon Sep 17 00:00:00 2001 From: David Ostrovsky Date: Wed, 26 Apr 2023 10:08:25 +0200 Subject: [PATCH 3/8] Demote severity of some error prone bug patterns to warnings The code is not violation free, so demote the severity of these bug patterns to warning: o DefaultCharset o FutureReturnValueIgnored o UnusedException Change-Id: Ie886a4a247770a74953385f018498ac2515ed209 --- tools/BUILD | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/BUILD b/tools/BUILD index 2b208744b..eeac3e072 100644 --- a/tools/BUILD +++ b/tools/BUILD @@ -34,7 +34,7 @@ java_package_configuration( "-Xep:CannotMockFinalClass:ERROR", "-Xep:ClassCanBeStatic:ERROR", "-Xep:ClassNewInstance:ERROR", - "-Xep:DefaultCharset:ERROR", + "-Xep:DefaultCharset:WARN", "-Xep:DoubleCheckedLocking:ERROR", "-Xep:ElementsCountedInLoop:ERROR", "-Xep:EqualsHashCode:ERROR", @@ -44,7 +44,7 @@ java_package_configuration( "-Xep:FragmentInjection:ERROR", "-Xep:FragmentNotInstantiable:ERROR", "-Xep:FunctionalInterfaceClash:ERROR", - "-Xep:FutureReturnValueIgnored:ERROR", + "-Xep:FutureReturnValueIgnored:WARN", "-Xep:GetClassOnEnum:ERROR", "-Xep:ImmutableAnnotationChecker:ERROR", "-Xep:ImmutableEnumChecker:ERROR", @@ -78,7 +78,7 @@ java_package_configuration( "-Xep:TypeParameterShadowing:ERROR", "-Xep:TypeParameterUnusedInFormals:WARN", "-Xep:URLEqualsHashCode:ERROR", - "-Xep:UnusedException:ERROR", + "-Xep:UnusedException:WARN", "-Xep:UnsynchronizedOverridesSynchronized:ERROR", "-Xep:WaitNotInLoop:ERROR", ], From 61d4e31349719778bce67fc9ec707cbb0a98def6 Mon Sep 17 00:00:00 2001 From: Matthias Sohn Date: Wed, 12 Jan 2022 23:45:34 +0100 Subject: [PATCH 4/8] [bazel] Skip ConfigTest#testCommitTemplatePathInHomeDirecory Move this test to another class and skip it when running tests with bazel since the bazel test runner does not allow to create files in the home directory. FS#userHome retrieves the home directory on the first call and caches it for subsequent calls to avoid overhead in case path translation is required (currently on cygwin). This prevents that the test can mock the home directory using MockSystemReader like SshTestHarness does. Change-Id: I6a22f37f4a19eb4b4935509eae508a23e56db7aa --- org.eclipse.jgit.test/BUILD | 1 + .../jgit/lib/CommitTemplateConfigTest.java | 60 +++++++++++++++++++ .../tst/org/eclipse/jgit/lib/ConfigTest.java | 25 +------- 3 files changed, 62 insertions(+), 24 deletions(-) create mode 100644 org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/CommitTemplateConfigTest.java diff --git a/org.eclipse.jgit.test/BUILD b/org.eclipse.jgit.test/BUILD index c9b5d3726..9e787fee7 100644 --- a/org.eclipse.jgit.test/BUILD +++ b/org.eclipse.jgit.test/BUILD @@ -42,6 +42,7 @@ DATA = [ EXCLUDED = [ PKG + "api/SecurityManagerTest.java", PKG + "api/SecurityManagerMissingPermissionsTest.java", + PKG + "lib/CommitTemplateConfigTest.java", ] tests(tests = glob( diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/CommitTemplateConfigTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/CommitTemplateConfigTest.java new file mode 100644 index 000000000..6dbe30af2 --- /dev/null +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/CommitTemplateConfigTest.java @@ -0,0 +1,60 @@ +/* + * Copyright (C) 2021 SAP SE and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Distribution License v. 1.0 which is available at + * https://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +package org.eclipse.jgit.lib; + +import static org.junit.Assert.assertEquals; + +import java.io.File; +import java.io.IOException; + +import org.eclipse.jgit.errors.ConfigInvalidException; +import org.eclipse.jgit.junit.JGitTestUtil; +import org.eclipse.jgit.storage.file.FileRepositoryBuilder; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TemporaryFolder; + +/* + * This test was moved from ConfigTest to allow skipping it when running the + * test using bazel which doesn't allow tests to create files in the home + * directory + */ +public class CommitTemplateConfigTest { + + @Rule + public TemporaryFolder tmp = new TemporaryFolder(); + + @Test + public void testCommitTemplatePathInHomeDirecory() + throws ConfigInvalidException, IOException { + Config config = new Config(null); + File tempFile = tmp.newFile("testCommitTemplate-"); + File workTree = tmp.newFolder("dummy-worktree"); + Repository repo = FileRepositoryBuilder.create(workTree); + String templateContent = "content of the template"; + JGitTestUtil.write(tempFile, templateContent); + // proper evaluation of the ~/ directory + String homeDir = System.getProperty("user.home"); + File tempFileInHomeDirectory = File.createTempFile("fileInHomeFolder", + ".tmp", new File(homeDir)); + tempFileInHomeDirectory.deleteOnExit(); + JGitTestUtil.write(tempFileInHomeDirectory, templateContent); + String expectedTemplatePath = tempFileInHomeDirectory.getPath() + .replace(homeDir, "~"); + config = ConfigTest + .parse("[commit]\n\ttemplate = " + expectedTemplatePath + "\n"); + String templatePath = config.get(CommitConfig.KEY) + .getCommitTemplatePath(); + assertEquals(expectedTemplatePath, templatePath); + assertEquals(templateContent, + config.get(CommitConfig.KEY).getCommitTemplateContent(repo)); + } +} diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ConfigTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ConfigTest.java index fe3c1db50..1b03fb76c 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ConfigTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ConfigTest.java @@ -1176,7 +1176,7 @@ private static void assertReadLong(long exp, String act) assertEquals(exp, c.getLong("s", null, "a", 0L)); } - private static Config parse(String content) + static Config parse(String content) throws ConfigInvalidException { return parse(content, null); } @@ -1515,29 +1515,6 @@ public void testCommitTemplateEncoding() "utf-8", commitEncoding); } - @Test - public void testCommitTemplatePathInHomeDirecory() - throws ConfigInvalidException, IOException { - Config config = new Config(null); - File tempFile = tmp.newFile("testCommitTemplate-"); - String templateContent = "content of the template"; - JGitTestUtil.write(tempFile, templateContent); - // proper evaluation of the ~/ directory - String homeDir = System.getProperty("user.home"); - File tempFileInHomeDirectory = File.createTempFile("fileInHomeFolder", - ".tmp", new File(homeDir)); - tempFileInHomeDirectory.deleteOnExit(); - JGitTestUtil.write(tempFileInHomeDirectory, templateContent); - String expectedTemplatePath = tempFileInHomeDirectory.getPath() - .replace(homeDir, "~"); - config = parse("[commit]\n\ttemplate = " + expectedTemplatePath + "\n"); - String templatePath = config.get(CommitConfig.KEY) - .getCommitTemplatePath(); - assertEquals(expectedTemplatePath, templatePath); - assertEquals(templateContent, - config.get(CommitConfig.KEY).getCommitTemplateContent()); - } - @Test(expected = ConfigInvalidException.class) public void testCommitTemplateWithInvalidEncoding() throws ConfigInvalidException, IOException { From 70bc5aad30dca46e086f99f81c80f878d3f54bc6 Mon Sep 17 00:00:00 2001 From: Prudhvi Akhil Alahari Date: Mon, 24 Apr 2023 14:45:17 +0530 Subject: [PATCH 5/8] Fix after_open config and Snapshotting RefDir tests to work with bazel The changes I1db6fcf414b and I634b92877f added tests which were failing with errors [1] and [2] with "bazel test //...". This was not caught because we don't have CI running with bazel. Fix bazel build file so that these errors are no longer thrown when run with bazel. [1] error: cannot find symbol FileRepositoryBuilderTest [2] error: cannot find symbol RefDirectoryTest Bug: 581816 Signed-off-by: Prudhvi Akhil Alahari Change-Id: I1e57111662825f5f14f373bc4f8d24cce1fec0b8 --- org.eclipse.jgit.test/BUILD | 17 +++++++++++++++++ org.eclipse.jgit.test/tests.bzl | 6 ++++++ 2 files changed, 23 insertions(+) diff --git a/org.eclipse.jgit.test/BUILD b/org.eclipse.jgit.test/BUILD index 6f6c88ce8..e63c02c03 100644 --- a/org.eclipse.jgit.test/BUILD +++ b/org.eclipse.jgit.test/BUILD @@ -51,6 +51,23 @@ tests(tests = glob( exclude = HELPERS + DATA + EXCLUDED, )) +# Non abstract base classes used for tests by other test classes +BASE = [ + PKG + "internal/storage/file/FileRepositoryBuilderTest.java", + PKG + "internal/storage/file/RefDirectoryTest.java", +] + +java_library( + name = "base", + testonly = 1, + srcs = BASE, + deps = [ + "//lib:junit", + "//org.eclipse.jgit:jgit", + "//org.eclipse.jgit.junit:junit", + ], +) + java_library( name = "helpers", testonly = 1, diff --git a/org.eclipse.jgit.test/tests.bzl b/org.eclipse.jgit.test/tests.bzl index e201bdbcb..170bf0c46 100644 --- a/org.eclipse.jgit.test/tests.bzl +++ b/org.eclipse.jgit.test/tests.bzl @@ -52,6 +52,12 @@ def tests(tests): "//lib:xz", "//org.eclipse.jgit.archive:jgit-archive", ] + if src.endswith("FileRepositoryBuilderAfterOpenConfigTest.java") or \ + src.endswith("RefDirectoryAfterOpenConfigTest.java") or \ + src.endswith("SnapshottingRefDirectoryTest.java"): + additional_deps = [ + ":base", + ] heap_size = "-Xmx256m" if src.endswith("HugeCommitMessageTest.java"): heap_size = "-Xmx512m" From 2aaa5611366edb9f48ebaa15860dce03bcfe4c93 Mon Sep 17 00:00:00 2001 From: Matthias Sohn Date: Thu, 27 Apr 2023 01:00:44 +0200 Subject: [PATCH 6/8] Fix CommitTemplateConfigTest The cherry-picked 61d4e313 doesn't match 5.13 APIs which changed in newer versions. Change-Id: I61ed0242472ed822028d86d3038f956f6bd5735c --- .../tst/org/eclipse/jgit/lib/CommitTemplateConfigTest.java | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/CommitTemplateConfigTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/CommitTemplateConfigTest.java index 6dbe30af2..eaebd57e4 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/CommitTemplateConfigTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/CommitTemplateConfigTest.java @@ -17,7 +17,6 @@ import org.eclipse.jgit.errors.ConfigInvalidException; import org.eclipse.jgit.junit.JGitTestUtil; -import org.eclipse.jgit.storage.file.FileRepositoryBuilder; import org.junit.Rule; import org.junit.Test; import org.junit.rules.TemporaryFolder; @@ -37,8 +36,6 @@ public void testCommitTemplatePathInHomeDirecory() throws ConfigInvalidException, IOException { Config config = new Config(null); File tempFile = tmp.newFile("testCommitTemplate-"); - File workTree = tmp.newFolder("dummy-worktree"); - Repository repo = FileRepositoryBuilder.create(workTree); String templateContent = "content of the template"; JGitTestUtil.write(tempFile, templateContent); // proper evaluation of the ~/ directory @@ -55,6 +52,6 @@ public void testCommitTemplatePathInHomeDirecory() .getCommitTemplatePath(); assertEquals(expectedTemplatePath, templatePath); assertEquals(templateContent, - config.get(CommitConfig.KEY).getCommitTemplateContent(repo)); + config.get(CommitConfig.KEY).getCommitTemplateContent()); } } From 2fd050c5674a08f1a5ccbe6b6cfc922ce6144c4a Mon Sep 17 00:00:00 2001 From: Jonathan Tan Date: Wed, 5 Apr 2023 13:44:59 -0700 Subject: [PATCH 7/8] GcConcurrentTest: @Ignore flaky testInterruptGc During my development of Id7721cc5b7ea650e77c2db47042715487983cae6, I have found this test to be flaky when run by CI. As a speculative fix, mark this test as @Ignore so it won't be run. Signed-off-by: Jonathan Tan Change-Id: Idfe04d7f1fb72a772d4c8d249ca86a9c2eec0b1a --- .../eclipse/jgit/internal/storage/file/GcConcurrentTest.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/GcConcurrentTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/GcConcurrentTest.java index d53d5eb4b..da9c0df08 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/GcConcurrentTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/GcConcurrentTest.java @@ -43,6 +43,7 @@ import org.eclipse.jgit.revwalk.RevCommit; import org.eclipse.jgit.storage.file.FileBasedConfig; import org.eclipse.jgit.test.resources.SampleDataRepositoryTestCase; +import org.junit.Ignore; import org.junit.Test; public class GcConcurrentTest extends GcTestCase { @@ -197,6 +198,7 @@ public void repackAndCheckBitmapUsage() throws Exception { assertNotNull(getSinglePack(repository).getBitmapIndex()); } + @Ignore @Test public void testInterruptGc() throws Exception { FileBasedConfig c = repo.getConfig(); From 9932f9b4156349252d3516a06298e3db708f4d5a Mon Sep 17 00:00:00 2001 From: Matthias Sohn Date: Mon, 24 Apr 2023 18:50:10 +0200 Subject: [PATCH 8/8] [bazel] Move ToolTestCase to src folder (6.2) Bazel barks at the abstract ToolTestCase not containing any test. Move it from the tst/ source folder to the src/ source folder so that bazel knows this is a helper class which doesn't contain tests. Change-Id: Ie353c27526644ea9b47437b9bd9cd730a432ab29 --- .../{tst => src}/org/eclipse/jgit/pgm/ToolTestCase.java | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename org.eclipse.jgit.pgm.test/{tst => src}/org/eclipse/jgit/pgm/ToolTestCase.java (100%) diff --git a/org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/ToolTestCase.java b/org.eclipse.jgit.pgm.test/src/org/eclipse/jgit/pgm/ToolTestCase.java similarity index 100% rename from org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/ToolTestCase.java rename to org.eclipse.jgit.pgm.test/src/org/eclipse/jgit/pgm/ToolTestCase.java