From c05d711bb757b0e2705bb22b9710b6be6eb37d99 Mon Sep 17 00:00:00 2001 From: Matthias Sohn Date: Wed, 24 Nov 2021 22:20:50 +0100 Subject: [PATCH 1/9] Let ObjectDatabase implement AutoClosable Bug: 549777 Change-Id: I09846a0e063aafa77de7e76dbc16c6a67d13b5e5 --- org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectDatabase.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectDatabase.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectDatabase.java index 293efe46e..04262c07a 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectDatabase.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectDatabase.java @@ -21,7 +21,7 @@ * An object database stores one or more Git objects, indexed by their unique * {@link org.eclipse.jgit.lib.ObjectId}. */ -public abstract class ObjectDatabase { +public abstract class ObjectDatabase implements AutoCloseable { /** * Initialize a new database instance for access. */ @@ -74,6 +74,7 @@ public void create() throws IOException { /** * Close any resources held by this database. */ + @Override public abstract void close(); /** From 75c716f5d7cdb0f4978c42a4dcae6c6ee4dcb42d Mon Sep 17 00:00:00 2001 From: Matthias Sohn Date: Wed, 24 Nov 2021 23:11:36 +0100 Subject: [PATCH 2/9] Implement RecordingLogger based on org.slf4j.Logger Jetty 10 uses slf4j for logging and deprecated its own Logger interface org.eclipse.jetty.util.log.Logger. Change-Id: I1b0c3a23e43190a50987175973725c3ad6e32f5f --- .../META-INF/MANIFEST.MF | 3 +- .../jgit/junit/http/RecordingLogger.java | 262 +++++++++--------- 2 files changed, 129 insertions(+), 136 deletions(-) diff --git a/org.eclipse.jgit.junit.http/META-INF/MANIFEST.MF b/org.eclipse.jgit.junit.http/META-INF/MANIFEST.MF index 6be5cdd09..4e4a54957 100644 --- a/org.eclipse.jgit.junit.http/META-INF/MANIFEST.MF +++ b/org.eclipse.jgit.junit.http/META-INF/MANIFEST.MF @@ -29,7 +29,8 @@ Import-Package: javax.servlet;version="[2.5.0,5.0.0)", org.eclipse.jgit.revwalk;version="[6.0.0,6.1.0)", org.eclipse.jgit.transport;version="[6.0.0,6.1.0)", org.eclipse.jgit.transport.resolver;version="[6.0.0,6.1.0)", - org.junit;version="[4.13,5.0.0)" + org.junit;version="[4.13,5.0.0)", + org.slf4j.helpers;version="[1.7.0,2.0.0)" Export-Package: org.eclipse.jgit.junit.http;version="6.0.0"; uses:="org.eclipse.jgit.transport, org.eclipse.jgit.junit, diff --git a/org.eclipse.jgit.junit.http/src/org/eclipse/jgit/junit/http/RecordingLogger.java b/org.eclipse.jgit.junit.http/src/org/eclipse/jgit/junit/http/RecordingLogger.java index d2ef733d7..9c3c980ad 100644 --- a/org.eclipse.jgit.junit.http/src/org/eclipse/jgit/junit/http/RecordingLogger.java +++ b/org.eclipse.jgit.junit.http/src/org/eclipse/jgit/junit/http/RecordingLogger.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2010, Google Inc. and others + * Copyright (C) 2010, 2021 Google Inc. 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 @@ -7,7 +7,6 @@ * * SPDX-License-Identifier: BSD-3-Clause */ - package org.eclipse.jgit.junit.http; import java.text.MessageFormat; @@ -15,12 +14,12 @@ import java.util.Collections; import java.util.List; -import org.eclipse.jetty.util.log.Logger; +import org.slf4j.helpers.MarkerIgnoringBase; + +public class RecordingLogger extends MarkerIgnoringBase { + + private static final long serialVersionUID = 1L; -/** - * Log warnings into an array for later inspection. - */ -public class RecordingLogger implements Logger { private static List warnings = new ArrayList<>(); /** @@ -60,8 +59,6 @@ public Warning(Throwable thrown) { } } - private final String name; - /** * Constructor for RecordingLogger. */ @@ -78,171 +75,166 @@ public RecordingLogger(String name) { this.name = name; } - /** {@inheritDoc} */ @Override - public Logger getLogger(@SuppressWarnings("hiding") String name) { - return new RecordingLogger(name); + public boolean isTraceEnabled() { + // Ignore (not relevant to test failures) + return false; } - /** {@inheritDoc} */ @Override - public String getName() { - return name; + public void trace(String msg) { + // Ignore (not relevant to test failures) } - /** - * Warning - * - * @param msg - * @param arg0 - * @param arg1 - */ - public void warn(String msg, Object arg0, Object arg1) { - synchronized (warnings) { - warnings.add(new Warning(MessageFormat.format(msg, arg0, arg1))); - } - } - - /** {@inheritDoc} */ @Override - public void warn(String msg, Throwable th) { - synchronized (warnings) { - warnings.add(new Warning(msg, th)); - } + public void trace(String format, Object arg) { + // Ignore (not relevant to test failures) } - /** - * Warning - * - * @param msg - * warning message - */ + @Override + public void trace(String format, Object arg1, Object arg2) { + // Ignore (not relevant to test failures) + } + + @Override + public void trace(String format, Object... arguments) { + // Ignore (not relevant to test failures) + } + + @Override + public void trace(String msg, Throwable t) { + // Ignore (not relevant to test failures) + } + + @Override + public boolean isDebugEnabled() { + return false; + } + + @Override + public void debug(String msg) { + // Ignore (not relevant to test failures) + } + + @Override + public void debug(String format, Object arg) { + // Ignore (not relevant to test failures) + } + + @Override + public void debug(String format, Object arg1, Object arg2) { + // Ignore (not relevant to test failures) + } + + @Override + public void debug(String format, Object... arguments) { + // Ignore (not relevant to test failures) + } + + @Override + public void debug(String msg, Throwable t) { + // Ignore (not relevant to test failures) + } + + @Override + public boolean isInfoEnabled() { + return false; + } + + @Override + public void info(String msg) { + // Ignore (not relevant to test failures) + } + + @Override + public void info(String format, Object arg) { + // Ignore (not relevant to test failures) + } + + @Override + public void info(String format, Object arg1, Object arg2) { + // Ignore (not relevant to test failures) + } + + @Override + public void info(String format, Object... arguments) { + // Ignore (not relevant to test failures) + } + + @Override + public void info(String msg, Throwable t) { + // Ignore (not relevant to test failures) + } + + @Override + public boolean isWarnEnabled() { + return true; + } + + @Override public void warn(String msg) { synchronized (warnings) { warnings.add(new Warning(msg)); } } - /** - * Debug log - * - * @param msg - * @param arg0 - * @param arg1 - */ - public void debug(String msg, Object arg0, Object arg1) { - // Ignore (not relevant to test failures) - } - - /** {@inheritDoc} */ @Override - public void debug(String msg, Throwable th) { - // Ignore (not relevant to test failures) + public void warn(String format, Object arg) { + warn(format, Collections.singleton(arg)); } - /** - * Debug log - * - * @param msg - * debug message - */ - public void debug(String msg) { - // Ignore (not relevant to test failures) - } - - /** - * Info - * - * @param msg - * @param arg0 - * @param arg1 - */ - public void info(String msg, Object arg0, Object arg1) { - // Ignore (not relevant to test failures) - } - - /** - * Info - * - * @param msg - */ - public void info(String msg) { - // Ignore (not relevant to test failures) - } - - /** {@inheritDoc} */ @Override - public boolean isDebugEnabled() { + public void warn(String format, Object... arguments) { + synchronized (warnings) { + int i = 0; + int index = format.indexOf("{}"); + while (index >= 0) { + format = format.replaceFirst("\\{\\}", "{" + i++ + "}"); + index = format.indexOf("{}"); + } + warnings.add(new Warning(MessageFormat.format(format, arguments))); + } + } + + @Override + public void warn(String format, Object arg1, Object arg2) { + warn(format, new Object[] { arg1, arg2 }); + } + + @Override + public void warn(String msg, Throwable t) { + synchronized (warnings) { + warnings.add(new Warning(msg, t)); + } + } + + @Override + public boolean isErrorEnabled() { return false; } - /** {@inheritDoc} */ @Override - public void setDebugEnabled(boolean enabled) { + public void error(String msg) { // Ignore (not relevant to test failures) } - /** {@inheritDoc} */ @Override - public void warn(String msg, Object... args) { - synchronized (warnings) { - int i = 0; - int index = msg.indexOf("{}"); - while (index >= 0) { - msg = msg.replaceFirst("\\{\\}", "{" + i++ + "}"); - index = msg.indexOf("{}"); - } - warnings.add(new Warning(MessageFormat.format(msg, args))); - } - } - - /** {@inheritDoc} */ - @Override - public void warn(Throwable thrown) { - synchronized (warnings) { - warnings.add(new Warning(thrown)); - } - } - - /** {@inheritDoc} */ - @Override - public void info(String msg, Object... args) { + public void error(String format, Object arg) { // Ignore (not relevant to test failures) } - /** {@inheritDoc} */ @Override - public void info(Throwable thrown) { + public void error(String format, Object arg1, Object arg2) { // Ignore (not relevant to test failures) } - /** {@inheritDoc} */ @Override - public void info(String msg, Throwable thrown) { + public void error(String format, Object... arguments) { // Ignore (not relevant to test failures) } - /** {@inheritDoc} */ @Override - public void debug(String msg, Object... args) { - // Ignore (not relevant to test failures) - } - - /** {@inheritDoc} */ - @Override - public void debug(Throwable thrown) { - // Ignore (not relevant to test failures) - } - - /** {@inheritDoc} */ - @Override - public void ignore(Throwable arg0) { - // Ignore (not relevant to test failures) - } - - /** {@inheritDoc} */ - @Override - public void debug(String msg, long value) { + public void error(String msg, Throwable t) { // Ignore (not relevant to test failures) } } From c20dd8206e2c6619c4851a202fa0217255d070dd Mon Sep 17 00:00:00 2001 From: Matthias Sohn Date: Wed, 24 Nov 2021 23:21:25 +0100 Subject: [PATCH 3/9] RevListTest: fix warning that method parameter hides field 'git' Change-Id: I12bd44e8bf75010ada2dff60f519fea61c7459de --- .../tst/org/eclipse/jgit/pgm/RevListTest.java | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/RevListTest.java b/org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/RevListTest.java index 06fddc29d..7c6cf4290 100644 --- a/org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/RevListTest.java +++ b/org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/RevListTest.java @@ -55,21 +55,21 @@ public void testWithoutParentsFlag() throws Exception { assertEquals(expect, result); } - private List createCommitsForParentsFlag(Git git) + private List createCommitsForParentsFlag(Git repo) throws Exception { List commits = new ArrayList<>(); writeTrashFile("Test1.txt", "Hello world"); - git.add().addFilepattern("Test1.txt").call(); - commits.add(git.commit().setMessage("commit#0").call()); + repo.add().addFilepattern("Test1.txt").call(); + commits.add(repo.commit().setMessage("commit#0").call()); writeTrashFile("Test.txt", "Hello world!"); - git.add().addFilepattern("Test.txt").call(); - commits.add(git.commit().setMessage("commit#1").call()); + repo.add().addFilepattern("Test.txt").call(); + commits.add(repo.commit().setMessage("commit#1").call()); writeTrashFile("Test1.txt", "Hello world!!"); - git.add().addFilepattern("Test1.txt").call(); - commits.add(git.commit().setMessage("commit#2").call()); + repo.add().addFilepattern("Test1.txt").call(); + commits.add(repo.commit().setMessage("commit#2").call()); writeTrashFile("Test.txt", "Hello world!!!"); - git.add().addFilepattern("Test.txt").call(); - commits.add(git.commit().setMessage("commit#3").call()); + repo.add().addFilepattern("Test.txt").call(); + commits.add(repo.commit().setMessage("commit#3").call()); return commits; } } From 403338e11640b61837165d90965de44da0e26379 Mon Sep 17 00:00:00 2001 From: Matthias Sohn Date: Wed, 23 Jun 2021 09:41:04 +0200 Subject: [PATCH 4/9] Don't use deprecated Repository#getAllRefs in FileRepository Also expose the potentially IOException thrown by RefDatabase#getRefs. Hence the following methods now potentially throw IOException: - AdvertiseRefsHook#advertiseRefs - ReceivePack#setAdvertisedRefs - Repository#getAdditionalHaves Bug: 534731 Change-Id: I85bc6ce5815d40be5f80042c53f4663072d96be5 --- .../transport/ReceivePackAdvertiseRefsHookTest.java | 2 +- .../jgit/internal/storage/file/FileRepository.java | 11 ++++++++--- .../src/org/eclipse/jgit/lib/Repository.java | 7 ++++--- .../jgit/transport/AbstractAdvertiseRefsHook.java | 7 +++++-- .../org/eclipse/jgit/transport/AdvertiseRefsHook.java | 5 ++++- .../jgit/transport/AdvertiseRefsHookChain.java | 7 +++++-- .../src/org/eclipse/jgit/transport/ReceivePack.java | 6 ++++-- 7 files changed, 31 insertions(+), 14 deletions(-) diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/ReceivePackAdvertiseRefsHookTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/ReceivePackAdvertiseRefsHookTest.java index ffea980f1..d1e544682 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/ReceivePackAdvertiseRefsHookTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/ReceivePackAdvertiseRefsHookTest.java @@ -142,7 +142,7 @@ ReceivePack createReceivePack(Repository db) { rp.setAdvertiseRefsHook(new AdvertiseRefsHook() { @Override public void advertiseRefs(ReceivePack rp2) - throws ServiceMayNotContinueException { + throws IOException { rp.setAdvertisedRefs(rp.getRepository().getAllRefs(), null); new HidePrivateHook().advertiseRefs(rp); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/FileRepository.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/FileRepository.java index fecced1ae..9cdea597f 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/FileRepository.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/FileRepository.java @@ -420,9 +420,11 @@ private File descriptionFile() { * advertise that it safely has that other repository's references, without * exposing any other details about the other repository. This may help a * client trying to push changes avoid pushing more than it needs to. + * + * @throws IOException */ @Override - public Set getAdditionalHaves() { + public Set getAdditionalHaves() throws IOException { return getAdditionalHaves(null); } @@ -438,8 +440,11 @@ public Set getAdditionalHaves() { * Set of AlternateHandle Ids already seen * * @return unmodifiable collection of other known objects. + * @throws IOException + * if getting refs hits an IO error */ - private Set getAdditionalHaves(Set skips) { + private Set getAdditionalHaves(Set skips) + throws IOException { HashSet r = new HashSet<>(); skips = objectDatabase.addMe(skips); for (AlternateHandle d : objectDatabase.myAlternates()) { @@ -447,7 +452,7 @@ private Set getAdditionalHaves(Set skips) { FileRepository repo; repo = ((AlternateRepository) d).repository; - for (Ref ref : repo.getAllRefs().values()) { + for (Ref ref : repo.getRefDatabase().getRefs()) { if (ref.getObjectId() != null) r.add(ref.getObjectId()); if (ref.getPeeledObjectId() != null) diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java index 1e8a6c917..2d1aca8de 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java @@ -1051,13 +1051,14 @@ public String getBranch() throws IOException { *

* When a repository borrows objects from another repository, it can * advertise that it safely has that other repository's references, without - * exposing any other details about the other repository. This may help - * a client trying to push changes avoid pushing more than it needs to. + * exposing any other details about the other repository. This may help a + * client trying to push changes avoid pushing more than it needs to. * * @return unmodifiable collection of other known objects. + * @throws IOException */ @NonNull - public Set getAdditionalHaves() { + public Set getAdditionalHaves() throws IOException { return Collections.emptySet(); } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/AbstractAdvertiseRefsHook.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/AbstractAdvertiseRefsHook.java index ed900121b..fb9c14576 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/AbstractAdvertiseRefsHook.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/AbstractAdvertiseRefsHook.java @@ -42,6 +42,7 @@ package org.eclipse.jgit.transport; +import java.io.IOException; import java.util.Map; import java.util.Set; @@ -65,10 +66,12 @@ public void advertiseRefs(UploadPack uploadPack) uploadPack.getRepository(), uploadPack.getRevWalk())); } - /** {@inheritDoc} */ + /** + * {@inheritDoc} + */ @Override public void advertiseRefs(ReceivePack receivePack) - throws ServiceMayNotContinueException { + throws IOException { Map refs = getAdvertisedRefs(receivePack.getRepository(), receivePack.getRevWalk()); Set haves = getAdvertisedHaves(receivePack.getRepository(), diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/AdvertiseRefsHook.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/AdvertiseRefsHook.java index eb1aef9ad..84c36915a 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/AdvertiseRefsHook.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/AdvertiseRefsHook.java @@ -42,6 +42,8 @@ package org.eclipse.jgit.transport; +import java.io.IOException; + /** * Hook to allow callers to take over advertising refs to the client. * @@ -89,8 +91,9 @@ void advertiseRefs(UploadPack uploadPack) * if necessary. * @throws org.eclipse.jgit.transport.ServiceMayNotContinueException * abort; the message will be sent to the user. + * @throws IOException * @since 5.6 */ void advertiseRefs(ReceivePack receivePack) - throws ServiceMayNotContinueException; + throws ServiceMayNotContinueException, IOException; } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/AdvertiseRefsHookChain.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/AdvertiseRefsHookChain.java index 91bdf58e7..eb9c673ef 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/AdvertiseRefsHookChain.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/AdvertiseRefsHookChain.java @@ -10,6 +10,7 @@ package org.eclipse.jgit.transport; +import java.io.IOException; import java.util.List; /** @@ -49,10 +50,12 @@ public static AdvertiseRefsHook newChain(List hooks } } - /** {@inheritDoc} */ + /** + * {@inheritDoc} + */ @Override public void advertiseRefs(ReceivePack rp) - throws ServiceMayNotContinueException { + throws IOException { for (int i = 0; i < count; i++) hooks[i].advertiseRefs(rp); } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/ReceivePack.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/ReceivePack.java index 871ba50a6..2542105c0 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/ReceivePack.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/ReceivePack.java @@ -440,9 +440,10 @@ public Map getAdvertisedRefs() { * explicit set of additional haves to claim as advertised. If * null, assumes the default set of additional haves from the * repository. + * @throws IOException */ public void setAdvertisedRefs(Map allRefs, - Set additionalHaves) { + Set additionalHaves) throws IOException { refs = allRefs != null ? allRefs : getAllRefs(); refs = refFilter.filter(refs); advertisedHaves.clear(); @@ -1187,8 +1188,9 @@ protected void init(final InputStream input, final OutputStream output, * Get advertised refs, or the default if not explicitly advertised. * * @return advertised refs, or the default if not explicitly advertised. + * @throws IOException */ - private Map getAdvertisedOrDefaultRefs() { + private Map getAdvertisedOrDefaultRefs() throws IOException { if (refs == null) setAdvertisedRefs(null, null); return refs; From 0a3aaac33ef77ec4664b35b4f4e1d590e8208182 Mon Sep 17 00:00:00 2001 From: Matthias Sohn Date: Wed, 23 Jun 2021 10:29:21 +0200 Subject: [PATCH 5/9] Don't use deprecated Repository#getAllRefs in Repository Also expose the potentially IOException thrown by RefDatabase#getRefs. Hence the following methods now potentially throw IOException: - Repository#getAllRefsByPeeledObjectId Bug: 534731 Change-Id: Id6956ff112560e6314d4335238494708346f2338 --- org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java | 8 +++++--- .../src/org/eclipse/jgit/revplot/PlotWalk.java | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java index 2d1aca8de..e594e528b 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java @@ -1161,12 +1161,14 @@ public Ref peel(Ref ref) { * Get a map with all objects referenced by a peeled ref. * * @return a map with all objects referenced by a peeled ref. + * @throws IOException */ @NonNull - public Map> getAllRefsByPeeledObjectId() { - Map allRefs = getAllRefs(); + public Map> getAllRefsByPeeledObjectId() + throws IOException { + List allRefs = getRefDatabase().getRefs(); Map> ret = new HashMap<>(allRefs.size()); - for (Ref ref : allRefs.values()) { + for (Ref ref : allRefs) { ref = peel(ref); AnyObjectId target = ref.getPeeledObjectId(); if (target == null) diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/revplot/PlotWalk.java b/org.eclipse.jgit/src/org/eclipse/jgit/revplot/PlotWalk.java index b4ccfe0ae..058233865 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/revplot/PlotWalk.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/revplot/PlotWalk.java @@ -121,7 +121,7 @@ public RevCommit next() throws MissingObjectException, return pc; } - private Ref[] getRefs(AnyObjectId commitId) { + private Ref[] getRefs(AnyObjectId commitId) throws IOException { if (reverseRefMap == null) { reverseRefMap = repository.getAllRefsByPeeledObjectId(); for (Map.Entry> entry : additionalRefMap From 81482008c1064016b215794be50b316f58cec162 Mon Sep 17 00:00:00 2001 From: Matthias Sohn Date: Fri, 26 Nov 2021 10:19:23 +0100 Subject: [PATCH 6/9] Use maven-compiler-plugin's release tag instead of source and target Change-Id: I090c8d074ae391a0721036bdc44e43c292a80963 --- org.eclipse.jgit.benchmarks/pom.xml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/org.eclipse.jgit.benchmarks/pom.xml b/org.eclipse.jgit.benchmarks/pom.xml index cd911ca6f..ababfc877 100644 --- a/org.eclipse.jgit.benchmarks/pom.xml +++ b/org.eclipse.jgit.benchmarks/pom.xml @@ -22,8 +22,6 @@ 11 - ${java.version} - ${java.version} UTF-8 1.32 benchmarks @@ -77,8 +75,7 @@ 3.8.1 UTF-8 - ${java.version} - ${java.version} + ${java.version} true -XDcompilePolicy=simple From a26618f861ac148f17a18d00c28f5f79929598e9 Mon Sep 17 00:00:00 2001 From: Matthias Sohn Date: Fri, 26 Nov 2021 22:17:01 +0100 Subject: [PATCH 7/9] Update .factorypath used by annotation processor for benchmarks Change-Id: Idd2c4760d81aa61643ef15292f1736a649be30b5 --- org.eclipse.jgit.benchmarks/.factorypath | 59 ++++++++++-------------- 1 file changed, 25 insertions(+), 34 deletions(-) diff --git a/org.eclipse.jgit.benchmarks/.factorypath b/org.eclipse.jgit.benchmarks/.factorypath index a6ef65bec..c631d4ac8 100644 --- a/org.eclipse.jgit.benchmarks/.factorypath +++ b/org.eclipse.jgit.benchmarks/.factorypath @@ -1,38 +1,29 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - - + + + + + + + + + + + + + + + + + + + + + + + From cce547d6d10f25d66e17e1265a9bd5cbe7aacc1e Mon Sep 17 00:00:00 2001 From: Thomas Wolf Date: Sun, 28 Nov 2021 11:42:20 +0100 Subject: [PATCH 8/9] FS: debug logging only if system config file cannot be found The command 'git config --system --show-origin --list -z' fails if the system config doesn't exist. Use debug logging instead of a warning for failures of that command. Typically the user cannot do anything about it anyway, and JGit will just work without system config. Bug: 577492 Change-Id: If628ab376182183aea57a385c169e144d371bbb2 Signed-off-by: Thomas Wolf --- org.eclipse.jgit/src/org/eclipse/jgit/util/FS.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/FS.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/FS.java index d0007ec21..9237c0a9b 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/util/FS.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/FS.java @@ -1530,6 +1530,7 @@ protected File discoverGitSystemConfig() { String w; try { + // This command prints the path even if it doesn't exist w = readPipe(gitExe.getParentFile(), new String[] { gitExe.getPath(), "config", "--system", //$NON-NLS-1$ //$NON-NLS-2$ "--edit" }, //$NON-NLS-1$ @@ -1552,7 +1553,10 @@ protected File discoverGitSystemConfig() { "--show-origin", "--list", "-z" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ SystemReader.getInstance().getDefaultCharset().name()); } catch (CommandFailedException e) { - LOG.warn(e.getMessage()); + // This command fails if the system config doesn't exist + if (LOG.isDebugEnabled()) { + LOG.debug(e.getMessage()); + } return null; } if (w == null) { From 122237439daee43956fe9f4255365afd40823e21 Mon Sep 17 00:00:00 2001 From: Thomas Wolf Date: Sun, 28 Nov 2021 11:42:20 +0100 Subject: [PATCH 9/9] FS: debug logging only if system config file cannot be found The command 'git config --system --show-origin --list -z' fails if the system config doesn't exist. Use debug logging instead of a warning for failures of that command. Typically the user cannot do anything about it anyway, and JGit will just work without system config. Bug: 577492 Change-Id: If628ab376182183aea57a385c169e144d371bbb2 Signed-off-by: Thomas Wolf --- org.eclipse.jgit/src/org/eclipse/jgit/util/FS.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/FS.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/FS.java index 507bd2bc9..4482beb0f 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/util/FS.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/FS.java @@ -1522,6 +1522,7 @@ protected File discoverGitSystemConfig() { String w; try { + // This command prints the path even if it doesn't exist w = readPipe(gitExe.getParentFile(), new String[] { gitExe.getPath(), "config", "--system", //$NON-NLS-1$ //$NON-NLS-2$ "--edit" }, //$NON-NLS-1$ @@ -1544,7 +1545,10 @@ protected File discoverGitSystemConfig() { "--show-origin", "--list", "-z" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ Charset.defaultCharset().name()); } catch (CommandFailedException e) { - LOG.warn(e.getMessage()); + // This command fails if the system config doesn't exist + if (LOG.isDebugEnabled()) { + LOG.debug(e.getMessage()); + } return null; } if (w == null) {