From e29834a77da41625bd48ebf0538ee016a5319b7b Mon Sep 17 00:00:00 2001 From: Matthias Sohn Date: Tue, 29 Aug 2023 21:26:34 +0200 Subject: [PATCH] Fix some tests in ConfigTest Some of the ConfigTest tests created a FileRepositoryBuilder but didn't use it to actually create a FileRepository. Change-Id: I1a4b27891daee1b235a71e7bbf2a7588b9d11a53 --- .../tst/org/eclipse/jgit/lib/ConfigTest.java | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) 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 8f9d10531..36cf77bb0 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 @@ -1482,7 +1482,9 @@ public void testCommitTemplateConfig() File workTree = tmp.newFolder("dummy-worktree"); File tempFile = tmp.newFile("testCommitTemplate-"); - Repository repo = FileRepositoryBuilder.create(workTree); + Repository repo = FileRepositoryBuilder + .create(new File(workTree, ".git")); + repo.create(); String templateContent = "content of the template"; JGitTestUtil.write(tempFile, templateContent); String expectedTemplatePath = tempFile.getPath(); @@ -1532,7 +1534,9 @@ public void testCommitTemplateEncoding() throws ConfigInvalidException, IOException { Config config = new Config(null); File workTree = tmp.newFolder("dummy-worktree"); - Repository repo = FileRepositoryBuilder.create(workTree); + Repository repo = FileRepositoryBuilder + .create(new File(workTree, ".git")); + repo.create(); File tempFile = tmp.newFile("testCommitTemplate-"); String templateContent = "content of the template"; JGitTestUtil.write(tempFile, templateContent); @@ -1554,7 +1558,9 @@ public void testCommitTemplateWithInvalidEncoding() Config config = new Config(null); File workTree = tmp.newFolder("dummy-worktree"); File tempFile = tmp.newFile("testCommitTemplate-"); - Repository repo = FileRepositoryBuilder.create(workTree); + Repository repo = FileRepositoryBuilder + .create(new File(workTree, ".git")); + repo.create(); String templateContent = "content of the template"; JGitTestUtil.write(tempFile, templateContent); config = parse("[i18n]\n\tcommitEncoding = invalidEcoding\n" @@ -1569,7 +1575,9 @@ public void testCommitTemplateWithInvalidPath() Config config = new Config(null); File workTree = tmp.newFolder("dummy-worktree"); File tempFile = tmp.newFile("testCommitTemplate-"); - Repository repo = FileRepositoryBuilder.create(workTree); + Repository repo = FileRepositoryBuilder + .create(new File(workTree, ".git")); + repo.create(); String templateContent = "content of the template"; JGitTestUtil.write(tempFile, templateContent); // commit message encoding