Merge branch 'stable-6.0'
* stable-6.0: FS: debug logging only if system config file cannot be found FS: debug logging only if system config file cannot be found Update .factorypath used by annotation processor for benchmarks Use maven-compiler-plugin's release tag instead of source and target Don't use deprecated Repository#getAllRefs in Repository Don't use deprecated Repository#getAllRefs in FileRepository RevListTest: fix warning that method parameter hides field 'git' Implement RecordingLogger based on org.slf4j.Logger Let ObjectDatabase implement AutoClosable Change-Id: Ie6b3cfa66b319033d4448dcf20362b753c0e9d7c
This commit is contained in:
commit
3cb02ccfdf
|
@ -1,38 +1,29 @@
|
|||
<factorypath>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/codehaus/plexus/plexus-compiler-javac/2.8.5/plexus-compiler-javac-2.8.5.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/codehaus/plexus/plexus-utils/3.0.22/plexus-utils-3.0.22.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/codehaus/plexus/plexus-compiler-api/2.8.5/plexus-compiler-api-2.8.5.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/codehaus/plexus/plexus-compiler-javac-errorprone/2.8.5/plexus-compiler-javac-errorprone-2.8.5.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/com/google/errorprone/error_prone_core/2.3.4/error_prone_core-2.3.4.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/com/google/errorprone/error_prone_annotation/2.3.4/error_prone_annotation-2.3.4.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/com/google/errorprone/error_prone_type_annotations/2.3.4/error_prone_type_annotations-2.3.4.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/com/google/errorprone/error_prone_check_api/2.3.4/error_prone_check_api-2.3.4.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/com/googlecode/java-diff-utils/diffutils/1.3.0/diffutils-1.3.0.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/com/github/kevinstern/software-and-algorithms/1.0/software-and-algorithms-1.0.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/com/github/ben-manes/caffeine/caffeine/2.7.0/caffeine-2.7.0.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/pcollections/pcollections/2.1.2/pcollections-2.1.2.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/com/google/guava/guava/27.0.1-jre/guava-27.0.1-jre.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/com/google/guava/failureaccess/1.0.1/failureaccess-1.0.1.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/com/google/guava/listenablefuture/9999.0-empty-to-avoid-conflict-with-guava/listenablefuture-9999.0-empty-to-avoid-conflict-with-guava.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/checkerframework/checker-qual/2.5.2/checker-qual-2.5.2.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/com/google/j2objc/j2objc-annotations/1.1/j2objc-annotations-1.1.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/codehaus/mojo/animal-sniffer-annotations/1.17/animal-sniffer-annotations-1.17.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/com/google/auto/auto-common/0.10/auto-common-0.10.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/com/google/code/findbugs/jFormatString/3.0.0/jFormatString-3.0.0.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/com/google/code/findbugs/jsr305/3.0.0/jsr305-3.0.0.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/checkerframework/dataflow/3.0.0/dataflow-3.0.0.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/checkerframework/javacutil/3.0.0/javacutil-3.0.0.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/plumelib/plume-util/1.0.6/plume-util-1.0.6.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/plumelib/reflection-util/0.0.2/reflection-util-0.0.2.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/plumelib/require-javadoc/0.1.0/require-javadoc-0.1.0.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/com/google/errorprone/javac/9+181-r4173-1/javac-9+181-r4173-1.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/com/google/errorprone/error_prone_annotations/2.3.4/error_prone_annotations-2.3.4.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/com/google/protobuf/protobuf-java/3.4.0/protobuf-java-3.4.0.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/openjdk/jmh/jmh-core/1.21/jmh-core-1.21.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/openjdk/jmh/jmh-generator-annprocess/1.32/jmh-generator-annprocess-1.32.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/openjdk/jmh/jmh-core/1.32/jmh-core-1.32.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/net/sf/jopt-simple/jopt-simple/4.6/jopt-simple-4.6.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/apache/commons/commons-math3/3.2/commons-math3-3.2.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/openjdk/jmh/jmh-generator-annprocess/1.21/jmh-generator-annprocess-1.21.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/eclipse/jgit/org.eclipse.jgit/5.9.1-SNAPSHOT/org.eclipse.jgit-5.9.1-SNAPSHOT.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/com/googlecode/javaewah/JavaEWAH/1.1.7/JavaEWAH-1.1.7.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/slf4j/slf4j-api/1.7.2/slf4j-api-1.7.2.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/com/google/errorprone/error_prone_core/2.9.0/error_prone_core-2.9.0.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/com/google/errorprone/error_prone_annotation/2.9.0/error_prone_annotation-2.9.0.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/com/google/errorprone/error_prone_type_annotations/2.9.0/error_prone_type_annotations-2.9.0.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/com/google/errorprone/error_prone_check_api/2.9.0/error_prone_check_api-2.9.0.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/io/github/java-diff-utils/java-diff-utils/4.0/java-diff-utils-4.0.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/eclipse/jgit/org.eclipse.jgit/4.4.1.201607150455-r/org.eclipse.jgit-4.4.1.201607150455-r.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/com/github/kevinstern/software-and-algorithms/1.0/software-and-algorithms-1.0.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/com/github/ben-manes/caffeine/caffeine/2.8.8/caffeine-2.8.8.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/pcollections/pcollections/2.1.2/pcollections-2.1.2.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/com/google/guava/guava/30.1-jre/guava-30.1-jre.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/com/google/guava/failureaccess/1.0.1/failureaccess-1.0.1.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/com/google/guava/listenablefuture/9999.0-empty-to-avoid-conflict-with-guava/listenablefuture-9999.0-empty-to-avoid-conflict-with-guava.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/checkerframework/checker-qual/3.5.0/checker-qual-3.5.0.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/com/google/j2objc/j2objc-annotations/1.3/j2objc-annotations-1.3.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/com/google/auto/auto-common/1.1.2/auto-common-1.1.2.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/com/google/code/findbugs/jFormatString/3.0.0/jFormatString-3.0.0.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/com/google/code/findbugs/jsr305/3.0.0/jsr305-3.0.0.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/checkerframework/dataflow-errorprone/3.15.0/dataflow-errorprone-3.15.0.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/com/google/errorprone/javac/9+181-r4173-1/javac-9+181-r4173-1.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/com/google/auto/value/auto-value-annotations/1.7/auto-value-annotations-1.7.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/com/google/errorprone/error_prone_annotations/2.9.0/error_prone_annotations-2.9.0.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/com/google/protobuf/protobuf-java/3.4.0/protobuf-java-3.4.0.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/com/google/auto/service/auto-service-annotations/1.0-rc6/auto-service-annotations-1.0-rc6.jar" enabled="true" runInBatchMode="false"/>
|
||||
</factorypath>
|
||||
|
|
|
@ -22,8 +22,6 @@
|
|||
|
||||
<properties>
|
||||
<java.version>11</java.version>
|
||||
<maven.compiler.source>${java.version}</maven.compiler.source>
|
||||
<maven.compiler.target>${java.version}</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<jmh.version>1.32</jmh.version>
|
||||
<uberjar.name>benchmarks</uberjar.name>
|
||||
|
@ -77,8 +75,7 @@
|
|||
<version>3.8.1</version>
|
||||
<configuration>
|
||||
<encoding>UTF-8</encoding>
|
||||
<source>${java.version}</source>
|
||||
<target>${java.version}</target>
|
||||
<release>${java.version}</release>
|
||||
<fork>true</fork>
|
||||
<compilerArgs>
|
||||
<arg>-XDcompilePolicy=simple</arg>
|
||||
|
|
|
@ -29,7 +29,8 @@ Import-Package: javax.servlet;version="[2.5.0,5.0.0)",
|
|||
org.eclipse.jgit.revwalk;version="[6.1.0,6.2.0)",
|
||||
org.eclipse.jgit.transport;version="[6.1.0,6.2.0)",
|
||||
org.eclipse.jgit.transport.resolver;version="[6.1.0,6.2.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.1.0";
|
||||
uses:="org.eclipse.jgit.transport,
|
||||
org.eclipse.jgit.junit,
|
||||
|
|
|
@ -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<Warning> warnings = new ArrayList<>();
|
||||
|
||||
/**
|
||||
|
@ -60,8 +59,6 @@ public Warning(Throwable thrown) {
|
|||
}
|
||||
}
|
||||
|
||||
private final String name;
|
||||
|
||||
/**
|
||||
* Constructor for <code>RecordingLogger</code>.
|
||||
*/
|
||||
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -55,21 +55,21 @@ public void testWithoutParentsFlag() throws Exception {
|
|||
assertEquals(expect, result);
|
||||
}
|
||||
|
||||
private List<RevCommit> createCommitsForParentsFlag(Git git)
|
||||
private List<RevCommit> createCommitsForParentsFlag(Git repo)
|
||||
throws Exception {
|
||||
List<RevCommit> 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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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<ObjectId> getAdditionalHaves() {
|
||||
public Set<ObjectId> getAdditionalHaves() throws IOException {
|
||||
return getAdditionalHaves(null);
|
||||
}
|
||||
|
||||
|
@ -438,8 +440,11 @@ public Set<ObjectId> 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<ObjectId> getAdditionalHaves(Set<AlternateHandle.Id> skips) {
|
||||
private Set<ObjectId> getAdditionalHaves(Set<AlternateHandle.Id> skips)
|
||||
throws IOException {
|
||||
HashSet<ObjectId> r = new HashSet<>();
|
||||
skips = objectDatabase.addMe(skips);
|
||||
for (AlternateHandle d : objectDatabase.myAlternates()) {
|
||||
|
@ -447,7 +452,7 @@ private Set<ObjectId> getAdditionalHaves(Set<AlternateHandle.Id> 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)
|
||||
|
|
|
@ -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();
|
||||
|
||||
/**
|
||||
|
|
|
@ -1051,13 +1051,14 @@ public String getBranch() throws IOException {
|
|||
* <p>
|
||||
* 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<ObjectId> getAdditionalHaves() {
|
||||
public Set<ObjectId> getAdditionalHaves() throws IOException {
|
||||
return Collections.emptySet();
|
||||
}
|
||||
|
||||
|
@ -1160,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<AnyObjectId, Set<Ref>> getAllRefsByPeeledObjectId() {
|
||||
Map<String, Ref> allRefs = getAllRefs();
|
||||
public Map<AnyObjectId, Set<Ref>> getAllRefsByPeeledObjectId()
|
||||
throws IOException {
|
||||
List<Ref> allRefs = getRefDatabase().getRefs();
|
||||
Map<AnyObjectId, Set<Ref>> ret = new HashMap<>(allRefs.size());
|
||||
for (Ref ref : allRefs.values()) {
|
||||
for (Ref ref : allRefs) {
|
||||
ref = peel(ref);
|
||||
AnyObjectId target = ref.getPeeledObjectId();
|
||||
if (target == null)
|
||||
|
|
|
@ -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<AnyObjectId, Set<Ref>> entry : additionalRefMap
|
||||
|
|
|
@ -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<String, Ref> refs = getAdvertisedRefs(receivePack.getRepository(),
|
||||
receivePack.getRevWalk());
|
||||
Set<ObjectId> haves = getAdvertisedHaves(receivePack.getRepository(),
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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<? extends AdvertiseRefsHook> hooks
|
|||
}
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void advertiseRefs(ReceivePack rp)
|
||||
throws ServiceMayNotContinueException {
|
||||
throws IOException {
|
||||
for (int i = 0; i < count; i++)
|
||||
hooks[i].advertiseRefs(rp);
|
||||
}
|
||||
|
|
|
@ -440,9 +440,10 @@ public Map<String, Ref> 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<String, Ref> allRefs,
|
||||
Set<ObjectId> additionalHaves) {
|
||||
Set<ObjectId> 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<String, Ref> getAdvertisedOrDefaultRefs() {
|
||||
private Map<String, Ref> getAdvertisedOrDefaultRefs() throws IOException {
|
||||
if (refs == null)
|
||||
setAdvertisedRefs(null, null);
|
||||
return refs;
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue