Merge "Revert "RevWalk: stop mixing lines of history in topo sort""
diff --git a/.bazelversion b/.bazelversion
index 227cea2..7ec1d6d 100644
--- a/.bazelversion
+++ b/.bazelversion
@@ -1 +1 @@
-2.0.0
+2.1.0
diff --git a/Documentation/technical/reftable.md b/Documentation/technical/reftable.md
index 1236a79..ebef68f 100644
--- a/Documentation/technical/reftable.md
+++ b/Documentation/technical/reftable.md
@@ -773,9 +773,6 @@
 
 ### Layout
 
-The `$GIT_DIR/refs` path is a file when reftable is configured, not a
-directory.  This prevents loose references from being stored.
-
 A collection of reftable files are stored in the `$GIT_DIR/reftable/`
 directory:
 
@@ -789,28 +786,38 @@
 Log-only files use the `.log` extension, while ref-only and mixed ref
 and log files use `.ref`.  extension.
 
-The stack ordering file is `$GIT_DIR/refs` and lists the current
-files, one per line, in order, from oldest (base) to newest (most
-recent):
 
-    $ cat .git/refs
+The stack ordering file is `$GIT_DIR/reftable/tables.list` and lists the current
+files, one per line, in order, from oldest (base) to newest (most recent):
+
+    $ cat .git/reftable/tables.list
     00000001-00000001.log
     00000002-00000002.ref
     00000003-00000003.ref
 
-Readers must read `$GIT_DIR/refs` to determine which files are
-relevant right now, and search through the stack in reverse order
-(last reftable is examined first).
+Readers must read `$GIT_DIR/reftable/tables.list` to determine which files are
+relevant right now, and search through the stack in reverse order (last reftable
+is examined first).
 
-Reftable files not listed in `refs` may be new (and about to be added
+Reftable files not listed in `tables.list` may be new (and about to be added
 to the stack by the active writer), or ancient and ready to be pruned.
 
+### Backward compatibility
+
+Older clients should continue to recognize the directory as a git repository so
+they don't look for an enclosing repository in parent directories. To this end,
+a reftable-enabled repository must contain the following dummy files
+
+*   `.git/HEAD`, a regular file containing `ref: refs/heads/.invalid`.
+*   `.git/refs/`, a directory
+*   `.git/refs/heads`, a regular file
+
 ### Readers
 
 Readers can obtain a consistent snapshot of the reference space by
 following:
 
-1.  Open and read the `refs` file.
+1.  Open and read the `tables.list` file.
 2.  Open each of the reftable files that it mentions.
 3.  If any of the files is missing, goto 1.
 4.  Read from the now-open files as long as necessary.
@@ -820,13 +827,13 @@
 Although reftables are immutable, mutations are supported by writing a
 new reftable and atomically appending it to the stack:
 
-1. Acquire `refs.lock`.
-2. Read `refs` to determine current reftables.
+1. Acquire `tables.list.lock`.
+2. Read `tables.list` to determine current reftables.
 3. Select `update_index` to be most recent file's `max_update_index + 1`.
 4. Prepare temp reftable `tmp_XXXXXX`, including log entries.
 5. Rename `tmp_XXXXXX` to `${update_index}-${update_index}.ref`.
-6. Copy `refs` to `refs.lock`, appending file from (5).
-7. Rename `refs.lock` to `refs`.
+6. Copy `tables.list` to `tables.list.lock`, appending file from (5).
+7. Rename `tables.list.lock` to `tables.list`.
 
 During step 4 the new file's `min_update_index` and `max_update_index`
 are both set to the `update_index` selected by step 3.  All log
@@ -834,9 +841,9 @@
 This enables later correlation of which references were updated by the
 same transaction.
 
-Because a single `refs.lock` file is used to manage locking, the
+Because a single `tables.list.lock` file is used to manage locking, the
 repository is single-threaded for writers.  Writers may have to
-busy-spin (with backoff) around creating `refs.lock`, for up to an
+busy-spin (with backoff) around creating `tables.list.lock`, for up to an
 acceptable wait period, aborting if the repository is too busy to
 mutate.  Application servers wrapped around repositories (e.g.  Gerrit
 Code Review) can layer their own lock/wait queue to improve fairness
@@ -864,21 +871,21 @@
 reftable files (from oldest to newest): A, B, C, and D. The compactor
 is going to compact B and C, leaving A and D alone.
 
-1.  Obtain lock `refs.lock` and read the `refs` file.
+1.  Obtain lock `tables.list.lock` and read the `tables.list` file.
 2.  Obtain locks `B.lock` and `C.lock`.
     Ownership of these locks prevents other processes from trying
     to compact these files.
-3.  Release `refs.lock`.
+3.  Release `tables.list.lock`.
 4.  Compact `B` and `C` into a temp file `${min_update_index}-${max_update_index}_XXXXXX`.
-5.  Reacquire lock `refs.lock`.
+5.  Reacquire lock `tables.list.lock`.
 6.  Verify that `B` and `C` are still in the stack, in that order. This
     should always be the case, assuming that other processes are adhering
     to the locking protocol.
 7.  Rename `${min_update_index}-${max_update_index}_XXXXXX` to
     `${min_update_index}-${max_update_index}.ref`.
-8.  Write the new stack to `refs.lock`, replacing `B` and `C` with the
+8.  Write the new stack to `tables.list.lock`, replacing `B` and `C` with the
     file from (4).
-9.  Rename `refs.lock` to `refs`.
+9.  Rename `tables.list.lock` to `tables.list`.
 10. Delete `B` and `C`, perhaps after a short sleep to avoid forcing
     readers to backtrack.
 
diff --git a/WORKSPACE b/WORKSPACE
index f456e4c..5fa28f9 100644
--- a/WORKSPACE
+++ b/WORKSPACE
@@ -20,7 +20,7 @@
 
 load("//tools:bazlets.bzl", "load_bazlets")
 
-load_bazlets(commit = "f53f51fb660552d0581aa0ba52c3836ed63d56a3")
+load_bazlets(commit = "f30a992da9fc855dce819875afb59f9dd6f860cd")
 
 load(
     "@com_googlesource_gerrit_bazlets//tools:maven_jar.bzl",
diff --git a/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/ObjectFileServlet.java b/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/ObjectFileServlet.java
index ed9b9ae..625ab3e 100644
--- a/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/ObjectFileServlet.java
+++ b/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/ObjectFileServlet.java
@@ -50,7 +50,7 @@
 		}
 	}
 
-	private static abstract class PackData extends ObjectFileServlet {
+	private abstract static class PackData extends ObjectFileServlet {
 		private static final long serialVersionUID = 1L;
 
 		PackData(String contentType) {
diff --git a/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/CleanFilter.java b/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/CleanFilter.java
index 6576ede..f0526ff 100644
--- a/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/CleanFilter.java
+++ b/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/CleanFilter.java
@@ -45,7 +45,7 @@
 	 * The factory is responsible for creating instances of
 	 * {@link org.eclipse.jgit.lfs.CleanFilter}
 	 */
-	public final static FilterCommandFactory FACTORY = CleanFilter::new;
+	public static final FilterCommandFactory FACTORY = CleanFilter::new;
 
 	/**
 	 * Registers this filter by calling
diff --git a/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/SmudgeFilter.java b/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/SmudgeFilter.java
index 64f7425..23ece3e 100644
--- a/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/SmudgeFilter.java
+++ b/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/SmudgeFilter.java
@@ -59,7 +59,7 @@
 	 * The factory is responsible for creating instances of
 	 * {@link org.eclipse.jgit.lfs.SmudgeFilter}
 	 */
-	public final static FilterCommandFactory FACTORY = SmudgeFilter::new;
+	public static final FilterCommandFactory FACTORY = SmudgeFilter::new;
 
 	/**
 	 * Register this filter in JGit
diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.10.target b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.10.target
index f49adf9..1c6c95c 100644
--- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.10.target
+++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.10.target
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
 <?pde?>
 <!-- generated with https://github.com/eclipse-cbi/targetplatform-dsl -->
-<target name="jgit-4.10" sequenceNumber="1580289401">
+<target name="jgit-4.10" sequenceNumber="1582498070">
   <locations>
     <location includeMode="slicer" includeAllPlatforms="false" includeSource="true" includeConfigurePhase="true" type="InstallableUnit">
       <unit id="org.eclipse.jetty.client" version="9.4.25.v20191220"/>
@@ -70,8 +70,8 @@
       <unit id="org.hamcrest.core.source" version="1.3.0.v20180420-1519"/>
       <unit id="org.hamcrest.library" version="1.3.0.v20180524-2246"/>
       <unit id="org.hamcrest.library.source" version="1.3.0.v20180524-2246"/>
-      <unit id="org.junit" version="4.13.0.v20200128-1312"/>
-      <unit id="org.junit.source" version="4.13.0.v20200128-1312"/>
+      <unit id="org.junit" version="4.13.0.v20200204-1500"/>
+      <unit id="org.junit.source" version="4.13.0.v20200204-1500"/>
       <unit id="org.kohsuke.args4j" version="2.33.0.v20160323-2218"/>
       <unit id="org.kohsuke.args4j.source" version="2.33.0.v20160323-2218"/>
       <unit id="org.mockito" version="2.23.0.v20190527-1420"/>
@@ -84,7 +84,7 @@
       <unit id="org.slf4j.impl.log4j12.source" version="1.7.2.v20131105-2200"/>
       <unit id="org.tukaani.xz" version="1.8.0.v20180207-1613"/>
       <unit id="org.tukaani.xz.source" version="1.8.0.v20180207-1613"/>
-      <repository location="https://download.eclipse.org/tools/orbit/downloads/drops/S20200128200239/repository"/>
+      <repository location="https://download.eclipse.org/tools/orbit/downloads/drops/S20200219023850/repository"/>
     </location>
     <location includeMode="slicer" includeAllPlatforms="false" includeSource="true" includeConfigurePhase="true" type="InstallableUnit">
       <unit id="org.eclipse.osgi" version="0.0.0"/>
diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.11.target b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.11.target
index e68ab63..e97b255 100644
--- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.11.target
+++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.11.target
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
 <?pde?>
 <!-- generated with https://github.com/eclipse-cbi/targetplatform-dsl -->
-<target name="jgit-4.11" sequenceNumber="1580289407">
+<target name="jgit-4.11" sequenceNumber="1582498158">
   <locations>
     <location includeMode="slicer" includeAllPlatforms="false" includeSource="true" includeConfigurePhase="true" type="InstallableUnit">
       <unit id="org.eclipse.jetty.client" version="9.4.25.v20191220"/>
@@ -70,8 +70,8 @@
       <unit id="org.hamcrest.core.source" version="1.3.0.v20180420-1519"/>
       <unit id="org.hamcrest.library" version="1.3.0.v20180524-2246"/>
       <unit id="org.hamcrest.library.source" version="1.3.0.v20180524-2246"/>
-      <unit id="org.junit" version="4.13.0.v20200128-1312"/>
-      <unit id="org.junit.source" version="4.13.0.v20200128-1312"/>
+      <unit id="org.junit" version="4.13.0.v20200204-1500"/>
+      <unit id="org.junit.source" version="4.13.0.v20200204-1500"/>
       <unit id="org.kohsuke.args4j" version="2.33.0.v20160323-2218"/>
       <unit id="org.kohsuke.args4j.source" version="2.33.0.v20160323-2218"/>
       <unit id="org.mockito" version="2.23.0.v20190527-1420"/>
@@ -84,7 +84,7 @@
       <unit id="org.slf4j.impl.log4j12.source" version="1.7.2.v20131105-2200"/>
       <unit id="org.tukaani.xz" version="1.8.0.v20180207-1613"/>
       <unit id="org.tukaani.xz.source" version="1.8.0.v20180207-1613"/>
-      <repository location="https://download.eclipse.org/tools/orbit/downloads/drops/S20200128200239/repository"/>
+      <repository location="https://download.eclipse.org/tools/orbit/downloads/drops/S20200219023850/repository"/>
     </location>
     <location includeMode="slicer" includeAllPlatforms="false" includeSource="true" includeConfigurePhase="true" type="InstallableUnit">
       <unit id="org.eclipse.osgi" version="0.0.0"/>
diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.12.target b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.12.target
index e83924c..4dff43f 100644
--- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.12.target
+++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.12.target
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
 <?pde?>
 <!-- generated with https://github.com/eclipse-cbi/targetplatform-dsl -->
-<target name="jgit-4.12" sequenceNumber="1580289407">
+<target name="jgit-4.12" sequenceNumber="1582498158">
   <locations>
     <location includeMode="slicer" includeAllPlatforms="false" includeSource="true" includeConfigurePhase="true" type="InstallableUnit">
       <unit id="org.eclipse.jetty.client" version="9.4.25.v20191220"/>
@@ -70,8 +70,8 @@
       <unit id="org.hamcrest.core.source" version="1.3.0.v20180420-1519"/>
       <unit id="org.hamcrest.library" version="1.3.0.v20180524-2246"/>
       <unit id="org.hamcrest.library.source" version="1.3.0.v20180524-2246"/>
-      <unit id="org.junit" version="4.13.0.v20200128-1312"/>
-      <unit id="org.junit.source" version="4.13.0.v20200128-1312"/>
+      <unit id="org.junit" version="4.13.0.v20200204-1500"/>
+      <unit id="org.junit.source" version="4.13.0.v20200204-1500"/>
       <unit id="org.kohsuke.args4j" version="2.33.0.v20160323-2218"/>
       <unit id="org.kohsuke.args4j.source" version="2.33.0.v20160323-2218"/>
       <unit id="org.mockito" version="2.23.0.v20190527-1420"/>
@@ -84,7 +84,7 @@
       <unit id="org.slf4j.impl.log4j12.source" version="1.7.2.v20131105-2200"/>
       <unit id="org.tukaani.xz" version="1.8.0.v20180207-1613"/>
       <unit id="org.tukaani.xz.source" version="1.8.0.v20180207-1613"/>
-      <repository location="https://download.eclipse.org/tools/orbit/downloads/drops/S20200128200239/repository"/>
+      <repository location="https://download.eclipse.org/tools/orbit/downloads/drops/S20200219023850/repository"/>
     </location>
     <location includeMode="slicer" includeAllPlatforms="false" includeSource="true" includeConfigurePhase="true" type="InstallableUnit">
       <unit id="org.eclipse.osgi" version="0.0.0"/>
diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.13.target b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.13.target
index c79f206..a03d04c 100644
--- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.13.target
+++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.13.target
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
 <?pde?>
 <!-- generated with https://github.com/eclipse-cbi/targetplatform-dsl -->
-<target name="jgit-4.13" sequenceNumber="1580289407">
+<target name="jgit-4.13" sequenceNumber="1582498157">
   <locations>
     <location includeMode="slicer" includeAllPlatforms="false" includeSource="true" includeConfigurePhase="true" type="InstallableUnit">
       <unit id="org.eclipse.jetty.client" version="9.4.25.v20191220"/>
@@ -70,8 +70,8 @@
       <unit id="org.hamcrest.core.source" version="1.3.0.v20180420-1519"/>
       <unit id="org.hamcrest.library" version="1.3.0.v20180524-2246"/>
       <unit id="org.hamcrest.library.source" version="1.3.0.v20180524-2246"/>
-      <unit id="org.junit" version="4.13.0.v20200128-1312"/>
-      <unit id="org.junit.source" version="4.13.0.v20200128-1312"/>
+      <unit id="org.junit" version="4.13.0.v20200204-1500"/>
+      <unit id="org.junit.source" version="4.13.0.v20200204-1500"/>
       <unit id="org.kohsuke.args4j" version="2.33.0.v20160323-2218"/>
       <unit id="org.kohsuke.args4j.source" version="2.33.0.v20160323-2218"/>
       <unit id="org.mockito" version="2.23.0.v20190527-1420"/>
@@ -84,7 +84,7 @@
       <unit id="org.slf4j.impl.log4j12.source" version="1.7.2.v20131105-2200"/>
       <unit id="org.tukaani.xz" version="1.8.0.v20180207-1613"/>
       <unit id="org.tukaani.xz.source" version="1.8.0.v20180207-1613"/>
-      <repository location="https://download.eclipse.org/tools/orbit/downloads/drops/S20200128200239/repository"/>
+      <repository location="https://download.eclipse.org/tools/orbit/downloads/drops/S20200219023850/repository"/>
     </location>
     <location includeMode="slicer" includeAllPlatforms="false" includeSource="true" includeConfigurePhase="true" type="InstallableUnit">
       <unit id="org.eclipse.osgi" version="0.0.0"/>
diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.14-staging.target b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.14-staging.target
index 39f52ac..ca47ea9 100644
--- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.14-staging.target
+++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.14-staging.target
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
 <?pde?>
 <!-- generated with https://github.com/eclipse-cbi/targetplatform-dsl -->
-<target name="jgit-4.14-staging" sequenceNumber="1580289404">
+<target name="jgit-4.14-staging" sequenceNumber="1582498156">
   <locations>
     <location includeMode="slicer" includeAllPlatforms="false" includeSource="true" includeConfigurePhase="true" type="InstallableUnit">
       <unit id="org.eclipse.jetty.client" version="9.4.25.v20191220"/>
@@ -70,8 +70,8 @@
       <unit id="org.hamcrest.core.source" version="1.3.0.v20180420-1519"/>
       <unit id="org.hamcrest.library" version="1.3.0.v20180524-2246"/>
       <unit id="org.hamcrest.library.source" version="1.3.0.v20180524-2246"/>
-      <unit id="org.junit" version="4.13.0.v20200128-1312"/>
-      <unit id="org.junit.source" version="4.13.0.v20200128-1312"/>
+      <unit id="org.junit" version="4.13.0.v20200204-1500"/>
+      <unit id="org.junit.source" version="4.13.0.v20200204-1500"/>
       <unit id="org.kohsuke.args4j" version="2.33.0.v20160323-2218"/>
       <unit id="org.kohsuke.args4j.source" version="2.33.0.v20160323-2218"/>
       <unit id="org.mockito" version="2.23.0.v20190527-1420"/>
@@ -84,7 +84,7 @@
       <unit id="org.slf4j.impl.log4j12.source" version="1.7.2.v20131105-2200"/>
       <unit id="org.tukaani.xz" version="1.8.0.v20180207-1613"/>
       <unit id="org.tukaani.xz.source" version="1.8.0.v20180207-1613"/>
-      <repository location="https://download.eclipse.org/tools/orbit/downloads/drops/S20200128200239/repository"/>
+      <repository location="https://download.eclipse.org/tools/orbit/downloads/drops/S20200219023850/repository"/>
     </location>
     <location includeMode="slicer" includeAllPlatforms="false" includeSource="true" includeConfigurePhase="true" type="InstallableUnit">
       <unit id="org.eclipse.osgi" version="0.0.0"/>
diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.6.target b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.6.target
index 4d862e2..4747817 100644
--- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.6.target
+++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.6.target
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
 <?pde?>
 <!-- generated with https://github.com/eclipse-cbi/targetplatform-dsl -->
-<target name="jgit-4.6" sequenceNumber="1580289424">
+<target name="jgit-4.6" sequenceNumber="1582498170">
   <locations>
     <location includeMode="slicer" includeAllPlatforms="false" includeSource="true" includeConfigurePhase="true" type="InstallableUnit">
       <unit id="org.eclipse.jetty.client" version="9.4.25.v20191220"/>
@@ -70,8 +70,8 @@
       <unit id="org.hamcrest.core.source" version="1.3.0.v20180420-1519"/>
       <unit id="org.hamcrest.library" version="1.3.0.v20180524-2246"/>
       <unit id="org.hamcrest.library.source" version="1.3.0.v20180524-2246"/>
-      <unit id="org.junit" version="4.13.0.v20200128-1312"/>
-      <unit id="org.junit.source" version="4.13.0.v20200128-1312"/>
+      <unit id="org.junit" version="4.13.0.v20200204-1500"/>
+      <unit id="org.junit.source" version="4.13.0.v20200204-1500"/>
       <unit id="org.kohsuke.args4j" version="2.33.0.v20160323-2218"/>
       <unit id="org.kohsuke.args4j.source" version="2.33.0.v20160323-2218"/>
       <unit id="org.mockito" version="2.23.0.v20190527-1420"/>
@@ -84,7 +84,7 @@
       <unit id="org.slf4j.impl.log4j12.source" version="1.7.2.v20131105-2200"/>
       <unit id="org.tukaani.xz" version="1.8.0.v20180207-1613"/>
       <unit id="org.tukaani.xz.source" version="1.8.0.v20180207-1613"/>
-      <repository location="https://download.eclipse.org/tools/orbit/downloads/drops/S20200128200239/repository"/>
+      <repository location="https://download.eclipse.org/tools/orbit/downloads/drops/S20200219023850/repository"/>
     </location>
     <location includeMode="slicer" includeAllPlatforms="false" includeSource="true" includeConfigurePhase="true" type="InstallableUnit">
       <unit id="org.eclipse.osgi" version="0.0.0"/>
diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.7.target b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.7.target
index 780b668a..46fead6 100644
--- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.7.target
+++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.7.target
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
 <?pde?>
 <!-- generated with https://github.com/eclipse-cbi/targetplatform-dsl -->
-<target name="jgit-4.7" sequenceNumber="1580289413">
+<target name="jgit-4.7" sequenceNumber="1582498162">
   <locations>
     <location includeMode="slicer" includeAllPlatforms="false" includeSource="true" includeConfigurePhase="true" type="InstallableUnit">
       <unit id="org.eclipse.jetty.client" version="9.4.25.v20191220"/>
@@ -70,8 +70,8 @@
       <unit id="org.hamcrest.core.source" version="1.3.0.v20180420-1519"/>
       <unit id="org.hamcrest.library" version="1.3.0.v20180524-2246"/>
       <unit id="org.hamcrest.library.source" version="1.3.0.v20180524-2246"/>
-      <unit id="org.junit" version="4.13.0.v20200128-1312"/>
-      <unit id="org.junit.source" version="4.13.0.v20200128-1312"/>
+      <unit id="org.junit" version="4.13.0.v20200204-1500"/>
+      <unit id="org.junit.source" version="4.13.0.v20200204-1500"/>
       <unit id="org.kohsuke.args4j" version="2.33.0.v20160323-2218"/>
       <unit id="org.kohsuke.args4j.source" version="2.33.0.v20160323-2218"/>
       <unit id="org.mockito" version="2.23.0.v20190527-1420"/>
@@ -84,7 +84,7 @@
       <unit id="org.slf4j.impl.log4j12.source" version="1.7.2.v20131105-2200"/>
       <unit id="org.tukaani.xz" version="1.8.0.v20180207-1613"/>
       <unit id="org.tukaani.xz.source" version="1.8.0.v20180207-1613"/>
-      <repository location="https://download.eclipse.org/tools/orbit/downloads/drops/S20200128200239/repository"/>
+      <repository location="https://download.eclipse.org/tools/orbit/downloads/drops/S20200219023850/repository"/>
     </location>
     <location includeMode="slicer" includeAllPlatforms="false" includeSource="true" includeConfigurePhase="true" type="InstallableUnit">
       <unit id="org.eclipse.osgi" version="0.0.0"/>
diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.8.target b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.8.target
index 596cd69..d400753 100644
--- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.8.target
+++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.8.target
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
 <?pde?>
 <!-- generated with https://github.com/eclipse-cbi/targetplatform-dsl -->
-<target name="jgit-4.8" sequenceNumber="1580289407">
+<target name="jgit-4.8" sequenceNumber="1582498158">
   <locations>
     <location includeMode="slicer" includeAllPlatforms="false" includeSource="true" includeConfigurePhase="true" type="InstallableUnit">
       <unit id="org.eclipse.jetty.client" version="9.4.25.v20191220"/>
@@ -70,8 +70,8 @@
       <unit id="org.hamcrest.core.source" version="1.3.0.v20180420-1519"/>
       <unit id="org.hamcrest.library" version="1.3.0.v20180524-2246"/>
       <unit id="org.hamcrest.library.source" version="1.3.0.v20180524-2246"/>
-      <unit id="org.junit" version="4.13.0.v20200128-1312"/>
-      <unit id="org.junit.source" version="4.13.0.v20200128-1312"/>
+      <unit id="org.junit" version="4.13.0.v20200204-1500"/>
+      <unit id="org.junit.source" version="4.13.0.v20200204-1500"/>
       <unit id="org.kohsuke.args4j" version="2.33.0.v20160323-2218"/>
       <unit id="org.kohsuke.args4j.source" version="2.33.0.v20160323-2218"/>
       <unit id="org.mockito" version="2.23.0.v20190527-1420"/>
@@ -84,7 +84,7 @@
       <unit id="org.slf4j.impl.log4j12.source" version="1.7.2.v20131105-2200"/>
       <unit id="org.tukaani.xz" version="1.8.0.v20180207-1613"/>
       <unit id="org.tukaani.xz.source" version="1.8.0.v20180207-1613"/>
-      <repository location="https://download.eclipse.org/tools/orbit/downloads/drops/S20200128200239/repository"/>
+      <repository location="https://download.eclipse.org/tools/orbit/downloads/drops/S20200219023850/repository"/>
     </location>
     <location includeMode="slicer" includeAllPlatforms="false" includeSource="true" includeConfigurePhase="true" type="InstallableUnit">
       <unit id="org.eclipse.osgi" version="0.0.0"/>
diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.9.target b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.9.target
index 7da901f..8c5e9ce 100644
--- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.9.target
+++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.9.target
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
 <?pde?>
 <!-- generated with https://github.com/eclipse-cbi/targetplatform-dsl -->
-<target name="jgit-4.9" sequenceNumber="1580289407">
+<target name="jgit-4.9" sequenceNumber="1582498159">
   <locations>
     <location includeMode="slicer" includeAllPlatforms="false" includeSource="true" includeConfigurePhase="true" type="InstallableUnit">
       <unit id="org.eclipse.jetty.client" version="9.4.25.v20191220"/>
@@ -70,8 +70,8 @@
       <unit id="org.hamcrest.core.source" version="1.3.0.v20180420-1519"/>
       <unit id="org.hamcrest.library" version="1.3.0.v20180524-2246"/>
       <unit id="org.hamcrest.library.source" version="1.3.0.v20180524-2246"/>
-      <unit id="org.junit" version="4.13.0.v20200128-1312"/>
-      <unit id="org.junit.source" version="4.13.0.v20200128-1312"/>
+      <unit id="org.junit" version="4.13.0.v20200204-1500"/>
+      <unit id="org.junit.source" version="4.13.0.v20200204-1500"/>
       <unit id="org.kohsuke.args4j" version="2.33.0.v20160323-2218"/>
       <unit id="org.kohsuke.args4j.source" version="2.33.0.v20160323-2218"/>
       <unit id="org.mockito" version="2.23.0.v20190527-1420"/>
@@ -84,7 +84,7 @@
       <unit id="org.slf4j.impl.log4j12.source" version="1.7.2.v20131105-2200"/>
       <unit id="org.tukaani.xz" version="1.8.0.v20180207-1613"/>
       <unit id="org.tukaani.xz.source" version="1.8.0.v20180207-1613"/>
-      <repository location="https://download.eclipse.org/tools/orbit/downloads/drops/S20200128200239/repository"/>
+      <repository location="https://download.eclipse.org/tools/orbit/downloads/drops/S20200219023850/repository"/>
     </location>
     <location includeMode="slicer" includeAllPlatforms="false" includeSource="true" includeConfigurePhase="true" type="InstallableUnit">
       <unit id="org.eclipse.osgi" version="0.0.0"/>
diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/orbit/staging-2020-03.tpd b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/orbit/staging-2020-03.tpd
index 9269a64..d010e5f 100644
--- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/orbit/staging-2020-03.tpd
+++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/orbit/staging-2020-03.tpd
@@ -1,7 +1,7 @@
 target "staging-2020-03" with source configurePhase
 // see http://download.eclipse.org/tools/orbit/downloads/
 
-location "https://download.eclipse.org/tools/orbit/downloads/drops/S20200128200239/repository" {
+location "https://download.eclipse.org/tools/orbit/downloads/drops/S20200219023850/repository" {
 	com.google.gson [2.8.2.v20180104-1110,2.8.2.v20180104-1110]
 	com.google.gson.source [2.8.2.v20180104-1110,2.8.2.v20180104-1110]
 	com.jcraft.jsch [0.1.55.v20190404-1902,0.1.55.v20190404-1902]
@@ -49,8 +49,8 @@
 	org.hamcrest.core.source [1.3.0.v20180420-1519,1.3.0.v20180420-1519]
 	org.hamcrest.library [1.3.0.v20180524-2246,1.3.0.v20180524-2246]
 	org.hamcrest.library.source [1.3.0.v20180524-2246,1.3.0.v20180524-2246]
-	org.junit [4.13.0.v20200128-1312,4.13.0.v20200128-1312]
-	org.junit.source [4.13.0.v20200128-1312,4.13.0.v20200128-1312]
+	org.junit [4.13.0.v20200204-1500,4.13.0.v20200204-1500]
+	org.junit.source [4.13.0.v20200204-1500,4.13.0.v20200204-1500]
 	org.kohsuke.args4j [2.33.0.v20160323-2218,2.33.0.v20160323-2218]
 	org.kohsuke.args4j.source [2.33.0.v20160323-2218,2.33.0.v20160323-2218]
 	org.mockito [2.23.0.v20190527-1420,2.23.0.v20190527-1420]
@@ -64,4 +64,3 @@
 	org.tukaani.xz [1.8.0.v20180207-1613,1.8.0.v20180207-1613]
 	org.tukaani.xz.source [1.8.0.v20180207-1613,1.8.0.v20180207-1613]
 }
-
diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/DiffAlgorithms.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/DiffAlgorithms.java
index 430ed2e..cd5d8f1 100644
--- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/DiffAlgorithms.java
+++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/DiffAlgorithms.java
@@ -317,7 +317,7 @@
 		return false;
 	}
 
-	private static abstract class Algorithm {
+	private abstract static class Algorithm {
 		String name;
 
 		abstract DiffAlgorithm create();
diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/LfsStore.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/LfsStore.java
index 6c87bc9..9c0ced5 100644
--- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/LfsStore.java
+++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/LfsStore.java
@@ -128,11 +128,11 @@
 		}
 	}
 
-	private static enum StoreType {
+	private enum StoreType {
 		FS, S3;
 	}
 
-	private static enum StorageClass {
+	private enum StorageClass {
 		REDUCED_REDUNDANCY, STANDARD
 	}
 
diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/ShowCommands.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/ShowCommands.java
index 36d1d23..9e61357 100644
--- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/ShowCommands.java
+++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/ShowCommands.java
@@ -50,7 +50,7 @@
 		errw.println();
 	}
 
-	static enum Format {
+	enum Format {
 		/** */
 		USAGE {
 			@Override
diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/TextHashFunctions.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/TextHashFunctions.java
index e42d51b..f777f27 100644
--- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/TextHashFunctions.java
+++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/TextHashFunctions.java
@@ -410,7 +410,7 @@
 	}
 
 	/** Base class for any hashCode function to be tested. */
-	private static abstract class Hash extends RawTextComparator {
+	private abstract static class Hash extends RawTextComparator {
 		String name;
 
 		@Override
@@ -420,7 +420,7 @@
 	}
 
 	/** Base class for any hashCode folding function to be tested. */
-	private static abstract class Fold {
+	private abstract static class Fold {
 		String name;
 
 		/**
diff --git a/org.eclipse.jgit.test/META-INF/MANIFEST.MF b/org.eclipse.jgit.test/META-INF/MANIFEST.MF
index 18f16d9..cfd1a04 100644
--- a/org.eclipse.jgit.test/META-INF/MANIFEST.MF
+++ b/org.eclipse.jgit.test/META-INF/MANIFEST.MF
@@ -18,7 +18,6 @@
  org.apache.commons.compress.compressors.gzip;version="[1.15.0,2.0)",
  org.apache.commons.compress.compressors.xz;version="[1.15.0,2.0)",
  org.assertj.core.api;version="[3.14.0,4.0.0)",
- org.bouncycastle.util.encoders;version="[1.61.0,2.0.0)",
  org.eclipse.jgit.annotations;version="[5.7.0,5.8.0)",
  org.eclipse.jgit.api;version="[5.7.0,5.8.0)",
  org.eclipse.jgit.api.errors;version="[5.7.0,5.8.0)",
diff --git a/org.eclipse.jgit.test/exttst/org/eclipse/jgit/patch/EGitPatchHistoryTest.java b/org.eclipse.jgit.test/exttst/org/eclipse/jgit/patch/EGitPatchHistoryTest.java
index c7fd253..b01d9b4 100644
--- a/org.eclipse.jgit.test/exttst/org/eclipse/jgit/patch/EGitPatchHistoryTest.java
+++ b/org.eclipse.jgit.test/exttst/org/eclipse/jgit/patch/EGitPatchHistoryTest.java
@@ -152,7 +152,7 @@
 		}
 	}
 
-	static abstract class CommitReader {
+	abstract static class CommitReader {
 		private Process proc;
 
 		CommitReader(String[] args) throws IOException {
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/dfs/DfsGarbageCollectorTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/dfs/DfsGarbageCollectorTest.java
index 6e0762f..f235b2e 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/dfs/DfsGarbageCollectorTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/dfs/DfsGarbageCollectorTest.java
@@ -19,7 +19,6 @@
 import java.util.concurrent.TimeUnit;
 
 import org.eclipse.jgit.internal.storage.dfs.DfsObjDatabase.PackSource;
-import org.eclipse.jgit.internal.storage.dfs.DfsRefDatabase;
 import org.eclipse.jgit.internal.storage.reftable.RefCursor;
 import org.eclipse.jgit.internal.storage.reftable.ReftableConfig;
 import org.eclipse.jgit.internal.storage.reftable.ReftableReader;
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/GcOrphanFilesTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/GcOrphanFilesTest.java
index 24df8dd..84d364b 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/GcOrphanFilesTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/GcOrphanFilesTest.java
@@ -20,17 +20,17 @@
 import org.junit.Test;
 
 public class GcOrphanFilesTest extends GcTestCase {
-	private final static String PACK = "pack";
+	private static final String PACK = "pack";
 
-	private final static String BITMAP_File_1 = PACK + "-1.bitmap";
+	private static final String BITMAP_File_1 = PACK + "-1.bitmap";
 
-	private final static String IDX_File_2 = PACK + "-2.idx";
+	private static final String IDX_File_2 = PACK + "-2.idx";
 
-	private final static String IDX_File_malformed = PACK + "-1234idx";
+	private static final String IDX_File_malformed = PACK + "-1234idx";
 
-	private final static String PACK_File_2 = PACK + "-2.pack";
+	private static final String PACK_File_2 = PACK + "-2.pack";
 
-	private final static String PACK_File_3 = PACK + "-3.pack";
+	private static final String PACK_File_3 = PACK + "-3.pack";
 
 	private File packDir;
 
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/reftable/ReftableCompactorTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/reftable/ReftableCompactorTest.java
index 874bab7..6fc7f25 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/reftable/ReftableCompactorTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/reftable/ReftableCompactorTest.java
@@ -19,7 +19,9 @@
 
 import java.io.ByteArrayOutputStream;
 import java.io.IOException;
+import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.List;
 
 import org.eclipse.jgit.internal.storage.io.BlockSource;
 import org.eclipse.jgit.internal.storage.reftable.ReftableWriter.Stats;
@@ -63,7 +65,9 @@
 		ReftableCompactor compactor;
 		try (ByteArrayOutputStream outBuf = new ByteArrayOutputStream()) {
 			compactor = new ReftableCompactor(outBuf);
-			compactor.tryAddFirst(read(inTab));
+			List<ReftableReader> readers = new ArrayList<>();
+			readers.add(read(inTab));
+			compactor.addAll(readers);
 			compactor.compact();
 			outTab = outBuf.toByteArray();
 		}
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 9b56917..327b554 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
@@ -305,7 +305,7 @@
 		assertFalse(c.getBoolean("s", "b", true));
 	}
 
-	static enum TestEnum {
+	enum TestEnum {
 		ONE_TWO;
 	}
 
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/GitDateParserBadlyFormattedTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/GitDateParserBadlyFormattedTest.java
index cd2cdce..547def1 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/GitDateParserBadlyFormattedTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/GitDateParserBadlyFormattedTest.java
@@ -46,7 +46,7 @@
 	}
 
 	@DataPoints
-	static public String[] getDataPoints() {
+	public static String[] getDataPoints() {
 		return new String[] { "", "1970", "3000.3000.3000", "3 yesterday ago",
 				"now yesterday ago", "yesterdays", "3.day. 2.week.ago",
 				"day ago", "Gra Feb 21 15:35:00 2007 +0100",
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/HexTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/HexTest.java
new file mode 100644
index 0000000..32af07f
--- /dev/null
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/HexTest.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2010, Google Inc.
+ * Copyright (C) 2020 Michael Dardis 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.util;
+
+import static org.eclipse.jgit.util.Hex.decode;
+import static org.eclipse.jgit.util.Hex.toHexString;
+import static org.junit.Assert.assertEquals;
+
+import org.eclipse.jgit.junit.JGitTestUtil;
+import org.eclipse.jgit.lib.Constants;
+import org.junit.Test;
+
+public class HexTest {
+	@Test
+	public void testEncode() {
+		assertEquals("68690a", toHexString(b("hi\n")));
+		assertEquals("0001020d0a0971", toHexString(b("\0\1\2\r\n\tq")));
+	}
+
+	@Test
+	public void testDecode() {
+		JGitTestUtil.assertEquals(b("hi\n"), decode("68690a"));
+		JGitTestUtil.assertEquals(b("\0\1\2\r\n\tq"), decode("0001020d0a0971"));
+		JGitTestUtil.assertEquals(b("\u000EB"), decode("0E42"));
+	}
+
+	@Test
+	public void testEncodeMatchesDecode() {
+		String[] testStrings = { "", "cow", "a", "a secret string",
+				"\0\1\2\r\n\t" };
+		for (String e : testStrings) {
+			JGitTestUtil.assertEquals(b(e), decode(toHexString(b(e))));
+		}
+	}
+
+	private static byte[] b(String str) {
+		return Constants.encode(str);
+	}
+
+}
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/StatsTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/StatsTest.java
index e492737..6c4b4a4 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/StatsTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/StatsTest.java
@@ -12,7 +12,6 @@
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
 
-import org.eclipse.jgit.util.Stats;
 import org.junit.Test;
 
 public class StatsTest {
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/io/TeeOutputStreamTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/io/TeeOutputStreamTest.java
new file mode 100644
index 0000000..bb1c974
--- /dev/null
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/io/TeeOutputStreamTest.java
@@ -0,0 +1,81 @@
+/*
+ * Copyright (C) 2020, Michael Dardis. 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.util.io;
+
+import static org.junit.Assert.assertArrayEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+
+import org.eclipse.jgit.lib.Constants;
+import org.junit.Test;
+
+public class TeeOutputStreamTest {
+
+	@Test
+	public void test() throws IOException {
+		byte[] data = Constants.encode("Hello World");
+
+		TestOutput first = new TestOutput();
+		TestOutput second = new TestOutput();
+		try (TeeOutputStream tee = new TeeOutputStream(first, second)) {
+			tee.write(data);
+			assertArrayEquals("Stream output must match", first.toByteArray(),
+					second.toByteArray());
+
+			tee.write(1);
+			assertArrayEquals("Stream output must match", first.toByteArray(),
+					second.toByteArray());
+
+			tee.write(data, 1, 4); // Test partial write methods
+			assertArrayEquals("Stream output must match", first.toByteArray(),
+					second.toByteArray());
+		}
+		assertTrue("First stream should be closed", first.closed);
+		assertTrue("Second stream should be closed", second.closed);
+	}
+
+	@Test
+	public void testCloseException() {
+		TestOutput first = new TestOutput() {
+			@Override
+			public void close() throws IOException {
+				throw new IOException();
+			}
+
+		};
+		TestOutput second = new TestOutput();
+
+		@SuppressWarnings("resource")
+		TeeOutputStream tee = new TeeOutputStream(first, second);
+		try {
+			tee.close();
+		} catch (IOException ex) {
+			// Expected from first closed
+		}
+		assertFalse("First stream should not be closed", first.closed);
+		assertTrue("Second stream should still be closed if first close failed",
+				second.closed);
+	}
+
+	private static class TestOutput extends ByteArrayOutputStream {
+
+		private boolean closed;
+
+		@Override
+		public void close() throws IOException {
+			closed = true;
+			super.close();
+		}
+	}
+
+}
diff --git a/org.eclipse.jgit/META-INF/MANIFEST.MF b/org.eclipse.jgit/META-INF/MANIFEST.MF
index 1fd2578..dbf122e 100644
--- a/org.eclipse.jgit/META-INF/MANIFEST.MF
+++ b/org.eclipse.jgit/META-INF/MANIFEST.MF
@@ -172,7 +172,6 @@
  org.bouncycastle.openpgp.operator;version="[1.61.0,2.0.0)",
  org.bouncycastle.openpgp.operator.jcajce;version="[1.61.0,2.0.0)",
  org.bouncycastle.util.encoders;version="[1.61.0,2.0.0)",
- org.bouncycastle.util.io;version="[1.61.0,2.0.0)",
  org.slf4j;version="[1.7.0,2.0.0)",
  org.xml.sax,
  org.xml.sax.helpers
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/CheckoutCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/CheckoutCommand.java
index fbd59dd..0dc5d5e 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/api/CheckoutCommand.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/CheckoutCommand.java
@@ -104,7 +104,7 @@
 	/**
 	 * Stage to check out, see {@link CheckoutCommand#setStage(Stage)}.
 	 */
-	public static enum Stage {
+	public enum Stage {
 		/**
 		 * Base stage (#1)
 		 */
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/CommitCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/CommitCommand.java
index 5322d5c..4e18b59 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/api/CommitCommand.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/CommitCommand.java
@@ -491,7 +491,7 @@
 			int position = Collections.binarySearch(only, p);
 			if (position >= 0)
 				return position;
-			int l = p.lastIndexOf("/"); //$NON-NLS-1$
+			int l = p.lastIndexOf('/');
 			if (l < 1)
 				break;
 			p = p.substring(0, l);
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/PullCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/PullCommand.java
index 16207c9..4492508 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/api/PullCommand.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/PullCommand.java
@@ -57,7 +57,7 @@
  */
 public class PullCommand extends TransportCommand<PullCommand, PullResult> {
 
-	private final static String DOT = "."; //$NON-NLS-1$
+	private static final String DOT = "."; //$NON-NLS-1$
 
 	private ProgressMonitor monitor = NullProgressMonitor.INSTANCE;
 
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/RebaseCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/RebaseCommand.java
index 705993e..b722fbe 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/api/RebaseCommand.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/RebaseCommand.java
@@ -800,7 +800,8 @@
 		sb.append("# This is a combination of ").append(count)
 				.append(" commits.\n");
 		// Add the previous message without header (i.e first line)
-		sb.append(currSquashMessage.substring(currSquashMessage.indexOf("\n") + 1));
+		sb.append(currSquashMessage
+				.substring(currSquashMessage.indexOf('\n') + 1));
 		sb.append("\n");
 		if (isSquash) {
 			sb.append("# This is the ").append(count).append(ordinal)
@@ -838,7 +839,7 @@
 	static int parseSquashFixupSequenceCount(String currSquashMessage) {
 		String regex = "This is a combination of (.*) commits"; //$NON-NLS-1$
 		String firstLine = currSquashMessage.substring(0,
-				currSquashMessage.indexOf("\n")); //$NON-NLS-1$
+				currSquashMessage.indexOf('\n'));
 		Pattern pattern = Pattern.compile(regex);
 		Matcher matcher = pattern.matcher(firstLine);
 		if (!matcher.find())
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/attributes/Attribute.java b/org.eclipse.jgit/src/org/eclipse/jgit/attributes/Attribute.java
index e409082..470a92e 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/attributes/Attribute.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/attributes/Attribute.java
@@ -34,7 +34,7 @@
 	 * The attribute value state
 	 * see also https://www.kernel.org/pub/software/scm/git/docs/gitattributes.html
 	 */
-	public static enum State {
+	public enum State {
 		/** the attribute is set */
 		SET,
 
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/attributes/AttributesRule.java b/org.eclipse.jgit/src/org/eclipse/jgit/attributes/AttributesRule.java
index 5381244..73fd587 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/attributes/AttributesRule.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/attributes/AttributesRule.java
@@ -9,7 +9,7 @@
  */
 package org.eclipse.jgit.attributes;
 
-import static org.eclipse.jgit.ignore.internal.IMatcher.NO_MATCH;
+import static org.eclipse.jgit.ignore.IMatcher.NO_MATCH;
 
 import java.util.ArrayList;
 import java.util.Collections;
@@ -18,7 +18,7 @@
 import org.eclipse.jgit.attributes.Attribute.State;
 import org.eclipse.jgit.errors.InvalidPatternException;
 import org.eclipse.jgit.ignore.FastIgnoreRule;
-import org.eclipse.jgit.ignore.internal.IMatcher;
+import org.eclipse.jgit.ignore.IMatcher;
 import org.eclipse.jgit.ignore.internal.PathMatcher;
 
 /**
@@ -58,7 +58,7 @@
 				continue;
 			}
 
-			final int equalsIndex = attribute.indexOf("="); //$NON-NLS-1$
+			final int equalsIndex = attribute.indexOf('=');
 			if (equalsIndex == -1)
 				result.add(new Attribute(attribute, State.SET));
 			else {
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/diff/DiffConfig.java b/org.eclipse.jgit/src/org/eclipse/jgit/diff/DiffConfig.java
index 4ccde4f..b062ee7 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/diff/DiffConfig.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/diff/DiffConfig.java
@@ -26,7 +26,7 @@
 	public static final Config.SectionParser<DiffConfig> KEY = DiffConfig::new;
 
 	/** Permissible values for {@code diff.renames}. */
-	public static enum RenameDetectionType {
+	public enum RenameDetectionType {
 		/** Rename detection is disabled. */
 		FALSE,
 
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/diff/DiffEntry.java b/org.eclipse.jgit/src/org/eclipse/jgit/diff/DiffEntry.java
index 1041682..f0ce121 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/diff/DiffEntry.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/diff/DiffEntry.java
@@ -39,7 +39,7 @@
 	public static final String DEV_NULL = "/dev/null"; //$NON-NLS-1$
 
 	/** General type of change a single file-level patch describes. */
-	public static enum ChangeType {
+	public enum ChangeType {
 		/** Add a new file to the project */
 		ADD,
 
@@ -57,7 +57,7 @@
 	}
 
 	/** Specify the old or new side for more generalized access. */
-	public static enum Side {
+	public enum Side {
 		/** The old side of a DiffEntry. */
 		OLD,
 
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/diff/Edit.java b/org.eclipse.jgit/src/org/eclipse/jgit/diff/Edit.java
index f05c457..219a187 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/diff/Edit.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/diff/Edit.java
@@ -31,7 +31,7 @@
  */
 public class Edit {
 	/** Type of edit */
-	public static enum Type {
+	public enum Type {
 		/** Sequence B has inserted the region. */
 		INSERT,
 
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/diff/SimilarityRenameDetector.java b/org.eclipse.jgit/src/org/eclipse/jgit/diff/SimilarityRenameDetector.java
index 6173f7d..74a11a0 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/diff/SimilarityRenameDetector.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/diff/SimilarityRenameDetector.java
@@ -302,14 +302,14 @@
 	}
 
 	static int nameScore(String a, String b) {
-	    int aDirLen = a.lastIndexOf("/") + 1; //$NON-NLS-1$
-	    int bDirLen = b.lastIndexOf("/") + 1; //$NON-NLS-1$
+		int aDirLen = a.lastIndexOf('/') + 1;
+		int bDirLen = b.lastIndexOf('/') + 1;
 
-	    int dirMin = Math.min(aDirLen, bDirLen);
-	    int dirMax = Math.max(aDirLen, bDirLen);
+		int dirMin = Math.min(aDirLen, bDirLen);
+		int dirMax = Math.max(aDirLen, bDirLen);
 
-	    final int dirScoreLtr;
-	    final int dirScoreRtl;
+		final int dirScoreLtr;
+		final int dirScoreRtl;
 
 		if (dirMax == 0) {
 			dirScoreLtr = 100;
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/errors/NoMergeBaseException.java b/org.eclipse.jgit/src/org/eclipse/jgit/errors/NoMergeBaseException.java
index 9c83294..889ee5b 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/errors/NoMergeBaseException.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/errors/NoMergeBaseException.java
@@ -30,7 +30,7 @@
 	 * An enum listing the different reason why no merge base could be
 	 * determined.
 	 */
-	public static enum MergeBaseFailureReason {
+	public enum MergeBaseFailureReason {
 		/**
 		 * Multiple merge bases have been found (e.g. the commits to be merged
 		 * have multiple common predecessors) but the merge strategy doesn't
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/errors/TranslationBundleException.java b/org.eclipse.jgit/src/org/eclipse/jgit/errors/TranslationBundleException.java
index 28b48ca..1c9243c 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/errors/TranslationBundleException.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/errors/TranslationBundleException.java
@@ -45,7 +45,7 @@
 	 *
 	 * @return bundle class for which the exception occurred
 	 */
-	final public Class getBundleClass() {
+	public final Class getBundleClass() {
 		return bundleClass;
 	}
 
@@ -54,7 +54,7 @@
 	 *
 	 * @return locale for which the exception occurred
 	 */
-	final public Locale getLocale() {
+	public final Locale getLocale() {
 		return locale;
 	}
 }
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/hooks/GitHook.java b/org.eclipse.jgit/src/org/eclipse/jgit/hooks/GitHook.java
index ed9c38a..4059b16 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/hooks/GitHook.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/hooks/GitHook.java
@@ -17,11 +17,11 @@
 import java.io.UnsupportedEncodingException;
 import java.util.concurrent.Callable;
 
-import org.bouncycastle.util.io.TeeOutputStream;
 import org.eclipse.jgit.api.errors.AbortedByHookException;
 import org.eclipse.jgit.lib.Repository;
 import org.eclipse.jgit.util.FS;
 import org.eclipse.jgit.util.ProcessResult;
+import org.eclipse.jgit.util.io.TeeOutputStream;
 
 /**
  * Git can fire off custom scripts when certain important actions occur. These
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/ignore/FastIgnoreRule.java b/org.eclipse.jgit/src/org/eclipse/jgit/ignore/FastIgnoreRule.java
index a1866c8..d7e4f79 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/ignore/FastIgnoreRule.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/ignore/FastIgnoreRule.java
@@ -9,13 +9,12 @@
  */
 package org.eclipse.jgit.ignore;
 
-import static org.eclipse.jgit.ignore.internal.IMatcher.NO_MATCH;
+import static org.eclipse.jgit.ignore.IMatcher.NO_MATCH;
 import static org.eclipse.jgit.ignore.internal.Strings.isDirectoryPattern;
 import static org.eclipse.jgit.ignore.internal.Strings.stripTrailing;
 import static org.eclipse.jgit.ignore.internal.Strings.stripTrailingWhitespace;
 
 import org.eclipse.jgit.errors.InvalidPatternException;
-import org.eclipse.jgit.ignore.internal.IMatcher;
 import org.eclipse.jgit.ignore.internal.PathMatcher;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -29,7 +28,7 @@
  * @since 3.6
  */
 public class FastIgnoreRule {
-	private final static Logger LOG = LoggerFactory
+	private static final Logger LOG = LoggerFactory
 			.getLogger(FastIgnoreRule.class);
 
 	/**
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/ignore/internal/IMatcher.java b/org.eclipse.jgit/src/org/eclipse/jgit/ignore/IMatcher.java
similarity index 60%
rename from org.eclipse.jgit/src/org/eclipse/jgit/ignore/internal/IMatcher.java
rename to org.eclipse.jgit/src/org/eclipse/jgit/ignore/IMatcher.java
index d93cc9a..3cbb069 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/ignore/internal/IMatcher.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/ignore/IMatcher.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2014, 2017 Andrey Loskutov <loskutov@gmx.de> and others
+ * Copyright (C) 2014, 2020 Andrey Loskutov <loskutov@gmx.de> 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,10 +7,16 @@
  *
  * SPDX-License-Identifier: BSD-3-Clause
  */
-package org.eclipse.jgit.ignore.internal;
+package org.eclipse.jgit.ignore;
+
+import org.eclipse.jgit.annotations.NonNull;
+import org.eclipse.jgit.errors.InvalidPatternException;
+import org.eclipse.jgit.ignore.internal.PathMatcher;
 
 /**
- * Generic string matcher
+ * Generic path matcher.
+ *
+ * @since 5.7
  */
 public interface IMatcher {
 
@@ -18,6 +24,7 @@
 	 * Matcher that does not match any pattern.
 	 */
 	public static final IMatcher NO_MATCH = new IMatcher() {
+
 		@Override
 		public boolean matches(String path, boolean assumeDirectory,
 				boolean pathMatch) {
@@ -31,6 +38,25 @@
 	};
 
 	/**
+	 * Creates a path matcher for the given pattern. A pattern may contain the
+	 * wildcards "?", "*", and "**". The directory separator is '/'.
+	 *
+	 * @param pattern
+	 *            to match
+	 * @param dirOnly
+	 *            whether to match only directories
+	 * @return a matcher for the given pattern
+	 * @throws InvalidPatternException
+	 *             if the pattern is invalid
+	 */
+	@NonNull
+	public static IMatcher createPathMatcher(@NonNull String pattern,
+			boolean dirOnly) throws InvalidPatternException {
+		return PathMatcher.createPathMatcher(pattern,
+				Character.valueOf(FastIgnoreRule.PATH_SEPARATOR), dirOnly);
+	}
+
+	/**
 	 * Matches entire given string
 	 *
 	 * @param path
@@ -40,10 +66,7 @@
 	 *            with a slash)
 	 * @param pathMatch
 	 *            {@code true} if the match is for the full path: prefix-only
-	 *            matches are not allowed, and
-	 *            {@link org.eclipse.jgit.ignore.internal.NameMatcher}s must
-	 *            match only the last component (if they can -- they may not, if
-	 *            they are anchored at the beginning)
+	 *            matches are not allowed
 	 * @return true if this matcher pattern matches given string
 	 */
 	boolean matches(String path, boolean assumeDirectory, boolean pathMatch);
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/ignore/IgnoreNode.java b/org.eclipse.jgit/src/org/eclipse/jgit/ignore/IgnoreNode.java
index 4564e24..0bc6124 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/ignore/IgnoreNode.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/ignore/IgnoreNode.java
@@ -26,7 +26,7 @@
  */
 public class IgnoreNode {
 	/** Result from {@link IgnoreNode#isIgnored(String, boolean)}. */
-	public static enum MatchResult {
+	public enum MatchResult {
 		/** The file is not ignored, due to a rule saying its not ignored. */
 		NOT_IGNORED,
 
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/ignore/internal/AbstractMatcher.java b/org.eclipse.jgit/src/org/eclipse/jgit/ignore/internal/AbstractMatcher.java
index a77061f..0737ed8 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/ignore/internal/AbstractMatcher.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/ignore/internal/AbstractMatcher.java
@@ -9,6 +9,8 @@
  */
 package org.eclipse.jgit.ignore.internal;
 
+import org.eclipse.jgit.ignore.IMatcher;
+
 /**
  * Base class for default methods as {@link #toString()} and such.
  * <p>
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/ignore/internal/PathMatcher.java b/org.eclipse.jgit/src/org/eclipse/jgit/ignore/internal/PathMatcher.java
index 8226a52..ba77b3d 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/ignore/internal/PathMatcher.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/ignore/internal/PathMatcher.java
@@ -19,6 +19,7 @@
 import java.util.List;
 
 import org.eclipse.jgit.errors.InvalidPatternException;
+import org.eclipse.jgit.ignore.IMatcher;
 import org.eclipse.jgit.ignore.internal.Strings.PatternState;
 
 /**
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/ignore/internal/Strings.java b/org.eclipse.jgit/src/org/eclipse/jgit/ignore/internal/Strings.java
index 107a0dd..fbce08a 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/ignore/internal/Strings.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/ignore/internal/Strings.java
@@ -196,11 +196,11 @@
 		return PatternState.COMPLEX;
 	}
 
-	static enum PatternState {
+	enum PatternState {
 		LEADING_ASTERISK_ONLY, TRAILING_ASTERISK_ONLY, COMPLEX, NONE
 	}
 
-	final static List<String> POSIX_CHAR_CLASSES = Arrays.asList(
+	static final List<String> POSIX_CHAR_CLASSES = Arrays.asList(
 			"alnum", "alpha", "blank", "cntrl", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
 			// [:alnum:] [:alpha:] [:blank:] [:cntrl:]
 			"digit", "graph", "lower", "print", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
@@ -215,7 +215,7 @@
 
 	private static final String DL = "\\p{javaDigit}\\p{javaLetter}"; //$NON-NLS-1$
 
-	final static List<String> JAVA_CHAR_CLASSES = Arrays
+	static final List<String> JAVA_CHAR_CLASSES = Arrays
 			.asList("\\p{Alnum}", "\\p{javaLetter}", "\\p{Blank}", "\\p{Cntrl}", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
 					// [:alnum:] [:alpha:] [:blank:] [:cntrl:]
 					"\\p{javaDigit}", "[\\p{Graph}" + DL + "]", "\\p{Ll}", "[\\p{Print}" + DL + "]", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
@@ -228,7 +228,7 @@
 
 	// Collating symbols [[.a.]] or equivalence class expressions [[=a=]] are
 	// not supported by CLI git (at least not by 1.9.1)
-	final static Pattern UNSUPPORTED = Pattern
+	static final Pattern UNSUPPORTED = Pattern
 			.compile("\\[\\[[.=]\\w+[.=]\\]\\]"); //$NON-NLS-1$
 
 	/**
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/ketch/KetchLeader.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/ketch/KetchLeader.java
index a587bbc..743d193 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/ketch/KetchLeader.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/ketch/KetchLeader.java
@@ -93,7 +93,7 @@
 	private static final Logger log = LoggerFactory.getLogger(KetchLeader.class);
 
 	/** Current state of the leader instance. */
-	public static enum State {
+	public enum State {
 		/** Newly created instance trying to elect itself leader. */
 		CANDIDATE,
 
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsObjDatabase.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsObjDatabase.java
index b357da5..4dab3b2 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsObjDatabase.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsObjDatabase.java
@@ -64,7 +64,7 @@
 	 * comparator based on {@link Enum#compareTo}. Prefer {@link
 	 * #DEFAULT_COMPARATOR} or your own {@link ComparatorBuilder}.
 	 */
-	public static enum PackSource {
+	public enum PackSource {
 		/** The pack is created by ObjectInserter due to local activity. */
 		INSERT,
 
@@ -672,7 +672,7 @@
 	}
 
 	/** Snapshot of packs scanned in a single pass. */
-	public static abstract class PackList {
+	public abstract static class PackList {
 		/** All known packs, sorted. */
 		public final DfsPackFile[] packs;
 
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/FileObjectDatabase.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/FileObjectDatabase.java
index 448c8bb..11ed10c 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/FileObjectDatabase.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/FileObjectDatabase.java
@@ -27,7 +27,7 @@
 import org.eclipse.jgit.util.FS;
 
 abstract class FileObjectDatabase extends ObjectDatabase {
-	static enum InsertLooseObjectResult {
+	enum InsertLooseObjectResult {
 		INSERTED, EXISTS_PACKED, EXISTS_LOOSE, FAILURE;
 	}
 
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/FileReftableStack.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/FileReftableStack.java
index 4cb0bd3..cded670 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/FileReftableStack.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/FileReftableStack.java
@@ -452,10 +452,6 @@
 		try (FileOutputStream fos = new FileOutputStream(tmpTable)) {
 			ReftableCompactor c = new ReftableCompactor(fos)
 					.setConfig(reftableConfig())
-					.setMinUpdateIndex(
-							stack.get(first).reftableReader.minUpdateIndex())
-					.setMaxUpdateIndex(
-							stack.get(last).reftableReader.maxUpdateIndex())
 					.setIncludeDeletes(first > 0);
 
 			List<ReftableReader> compactMe = new ArrayList<>();
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/GC.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/GC.java
index 915f310..0899578 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/GC.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/GC.java
@@ -98,7 +98,7 @@
  * adapted to FileRepositories.
  */
 public class GC {
-	private final static Logger LOG = LoggerFactory
+	private static final Logger LOG = LoggerFactory
 			.getLogger(GC.class);
 
 	private static final String PRUNE_EXPIRE_DEFAULT = "2.weeks.ago"; //$NON-NLS-1$
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/LockFile.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/LockFile.java
index f2b6557..2e0a6da 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/LockFile.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/LockFile.java
@@ -50,7 +50,7 @@
  * name.
  */
 public class LockFile {
-	private final static Logger LOG = LoggerFactory.getLogger(LockFile.class);
+	private static final Logger LOG = LoggerFactory.getLogger(LockFile.class);
 
 	/**
 	 * Unlock the given file.
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/ObjectDirectory.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/ObjectDirectory.java
index 1695870..6a822d5 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/ObjectDirectory.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/ObjectDirectory.java
@@ -76,7 +76,7 @@
  * considered.
  */
 public class ObjectDirectory extends FileObjectDatabase {
-	private final static Logger LOG = LoggerFactory
+	private static final Logger LOG = LoggerFactory
 			.getLogger(ObjectDirectory.class);
 
 	private static final PackList NO_PACKS = new PackList(
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackFile.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackFile.java
index b997338..254c020 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackFile.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackFile.java
@@ -70,7 +70,7 @@
  * objects are similar.
  */
 public class PackFile implements Iterable<PackIndex.MutableEntry> {
-	private final static Logger LOG = LoggerFactory.getLogger(PackFile.class);
+	private static final Logger LOG = LoggerFactory.getLogger(PackFile.class);
 
 	/**
 	 * Sorts PackFiles to be most recently created to least recently created.
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/RefDirectory.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/RefDirectory.java
index fddd430..7d108fe 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/RefDirectory.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/RefDirectory.java
@@ -97,7 +97,7 @@
  * overall size of a Git repository on disk.
  */
 public class RefDirectory extends RefDatabase {
-	private final static Logger LOG = LoggerFactory
+	private static final Logger LOG = LoggerFactory
 			.getLogger(RefDirectory.class);
 
 	/** Magic string denoting the start of a symbolic reference file. */
@@ -1376,7 +1376,7 @@
 		LooseRef peel(ObjectIdRef newLeaf);
 	}
 
-	private final static class LoosePeeledTag extends ObjectIdRef.PeeledTag
+	private static final class LoosePeeledTag extends ObjectIdRef.PeeledTag
 			implements LooseRef {
 		private final FileSnapshot snapShot;
 
@@ -1397,7 +1397,7 @@
 		}
 	}
 
-	private final static class LooseNonTag extends ObjectIdRef.PeeledNonTag
+	private static final class LooseNonTag extends ObjectIdRef.PeeledNonTag
 			implements LooseRef {
 		private final FileSnapshot snapShot;
 
@@ -1418,7 +1418,7 @@
 		}
 	}
 
-	private final static class LooseUnpeeled extends ObjectIdRef.Unpeeled
+	private static final class LooseUnpeeled extends ObjectIdRef.Unpeeled
 			implements LooseRef {
 		private FileSnapshot snapShot;
 
@@ -1453,7 +1453,7 @@
 		}
 	}
 
-	private final static class LooseSymbolicRef extends SymbolicRef implements
+	private static final class LooseSymbolicRef extends SymbolicRef implements
 			LooseRef {
 		private final FileSnapshot snapShot;
 
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackExt.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackExt.java
index eaca758..bedc693 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackExt.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackExt.java
@@ -48,7 +48,7 @@
 	 *            the file extension.
 	 * @return the PackExt for the ext
 	 */
-	public synchronized static PackExt newPackExt(String ext) {
+	public static synchronized PackExt newPackExt(String ext) {
 		PackExt[] dst = new PackExt[VALUES.length + 1];
 		for (int i = 0; i < VALUES.length; i++) {
 			PackExt packExt = VALUES[i];
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java
index e8f0e1f..057970e 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java
@@ -2399,7 +2399,7 @@
 	}
 
 	/** Possible states that a PackWriter can be in. */
-	public static enum PackingPhase {
+	public enum PackingPhase {
 		/** Counting objects phase. */
 		COUNTING,
 
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/reftable/BlockWriter.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/reftable/BlockWriter.java
index 0f11e05..e3c0fc9 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/reftable/BlockWriter.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/reftable/BlockWriter.java
@@ -253,7 +253,7 @@
 		return aLen - bLen;
 	}
 
-	static abstract class Entry {
+	abstract static class Entry {
 		static int compare(Entry ea, Entry eb) {
 			byte[] a = ea.key;
 			byte[] b = eb.key;
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/reftable/MergedReftable.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/reftable/MergedReftable.java
index 63f0635..18c013f 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/reftable/MergedReftable.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/reftable/MergedReftable.java
@@ -65,6 +65,15 @@
 				: 0;
 	}
 
+	/**
+	 * {@inheritDoc}
+	 */
+	@Override
+	public long minUpdateIndex() throws IOException {
+		return tables.length > 0 ? tables[0].minUpdateIndex()
+			: 0;
+	}
+
 	/** {@inheritDoc} */
 	@Override
 	public boolean hasObjectMap() throws IOException {
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/reftable/Reftable.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/reftable/Reftable.java
index dd185f9..63786dc 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/reftable/Reftable.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/reftable/Reftable.java
@@ -65,20 +65,29 @@
 		includeDeletes = deletes;
 	}
 
-
 	/**
-	 * Get the maximum update index for log entries that appear in this
+	 * Get the maximum update index for ref entries that appear in this
 	 * reftable.
 	 *
-	 * @return the maximum update index for log entries that appear in this
-	 *         reftable. This should be 1 higher than the prior reftable's
-	 *         {@code maxUpdateIndex} if this table is used in a stack.
+	 * @return the maximum update index for ref entries that appear in this
+	 *         reftable.
 	 * @throws java.io.IOException
 	 *             file cannot be read.
 	 */
 	public abstract long maxUpdateIndex() throws IOException;
 
 	/**
+	 * Get the minimum update index for ref entries that appear in this
+	 * reftable.
+	 *
+	 * @return the minimum update index for ref entries that appear in this
+	 *         reftable.
+	 * @throws java.io.IOException
+	 *             file cannot be read.
+	 */
+	public abstract long minUpdateIndex() throws IOException;
+
+	/**
 	 * Seek to the first reference, to iterate in order.
 	 *
 	 * @return cursor to iterate.
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/reftable/ReftableCompactor.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/reftable/ReftableCompactor.java
index 6bc6021..3c4bc75 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/reftable/ReftableCompactor.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/reftable/ReftableCompactor.java
@@ -28,22 +28,20 @@
  * to shadow any lower reftable that may have the reference present.
  * <p>
  * By default all log entries within the range defined by
- * {@link #setMinUpdateIndex(long)} and {@link #setMaxUpdateIndex(long)} are
+ * {@link #setReflogExpireMinUpdateIndex(long)} and {@link #setReflogExpireMaxUpdateIndex(long)} are
  * copied, even if no references in the output file match the log records.
  * Callers may truncate the log to a more recent time horizon with
- * {@link #setOldestReflogTimeMillis(long)}, or disable the log altogether with
+ * {@link #setReflogExpireOldestReflogTimeMillis(long)}, or disable the log altogether with
  * {@code setOldestReflogTimeMillis(Long.MAX_VALUE)}.
  */
 public class ReftableCompactor {
 	private final ReftableWriter writer;
 	private final ArrayDeque<ReftableReader> tables = new ArrayDeque<>();
 
-	private long compactBytesLimit;
-	private long bytesToCompact;
 	private boolean includeDeletes;
-	private long minUpdateIndex = -1;
-	private long maxUpdateIndex;
-	private long oldestReflogTimeMillis;
+	private long reflogExpireMinUpdateIndex = 0;
+	private long reflogExpireMaxUpdateIndex = Long.MAX_VALUE;
+	private long reflogExpireOldestReflogTimeMillis;
 	private Stats stats;
 
 	/**
@@ -70,18 +68,6 @@
 	}
 
 	/**
-	 * Set limit on number of bytes from source tables to compact.
-	 *
-	 * @param bytes
-	 *            limit on number of bytes from source tables to compact.
-	 * @return {@code this}
-	 */
-	public ReftableCompactor setCompactBytesLimit(long bytes) {
-		compactBytesLimit = bytes;
-		return this;
-	}
-
-	/**
 	 * Whether to include deletions in the output, which may be necessary for
 	 * partial compaction.
 	 *
@@ -106,8 +92,8 @@
 	 *            in a stack.
 	 * @return {@code this}
 	 */
-	public ReftableCompactor setMinUpdateIndex(long min) {
-		minUpdateIndex = min;
+	public ReftableCompactor setReflogExpireMinUpdateIndex(long min) {
+		reflogExpireMinUpdateIndex = min;
 		return this;
 	}
 
@@ -122,8 +108,8 @@
 	 *            used in a stack.
 	 * @return {@code this}
 	 */
-	public ReftableCompactor setMaxUpdateIndex(long max) {
-		maxUpdateIndex = max;
+	public ReftableCompactor setReflogExpireMaxUpdateIndex(long max) {
+		reflogExpireMaxUpdateIndex = max;
 		return this;
 	}
 
@@ -137,16 +123,13 @@
 	 *            Specified in Java standard milliseconds since the epoch.
 	 * @return {@code this}
 	 */
-	public ReftableCompactor setOldestReflogTimeMillis(long timeMillis) {
-		oldestReflogTimeMillis = timeMillis;
+	public ReftableCompactor setReflogExpireOldestReflogTimeMillis(long timeMillis) {
+		reflogExpireOldestReflogTimeMillis = timeMillis;
 		return this;
 	}
 
 	/**
 	 * Add all of the tables, in the specified order.
-	 * <p>
-	 * Unconditionally adds all tables, ignoring the
-	 * {@link #setCompactBytesLimit(long)}.
 	 *
 	 * @param readers
 	 *            tables to compact. Tables should be ordered oldest first/most
@@ -158,47 +141,10 @@
 	public void addAll(List<ReftableReader> readers) throws IOException {
 		for (ReftableReader r : readers) {
 			tables.add(r);
-			adjustUpdateIndexes(r);
 		}
 	}
 
 	/**
-	 * Try to add this reader at the bottom of the stack.
-	 * <p>
-	 * A reader may be rejected by returning {@code false} if the compactor is
-	 * already rewriting its {@link #setCompactBytesLimit(long)}. When this
-	 * happens the caller should stop trying to add tables, and execute the
-	 * compaction.
-	 *
-	 * @param reader
-	 *            the reader to insert at the bottom of the stack. Caller is
-	 *            responsible for closing the reader.
-	 * @return {@code true} if the compactor accepted this table; {@code false}
-	 *         if the compactor has reached its limit.
-	 * @throws java.io.IOException
-	 *             if size of {@code reader}, or its update indexes cannot be read.
-	 */
-	public boolean tryAddFirst(ReftableReader reader) throws IOException {
-		long sz = reader.size();
-		if (compactBytesLimit > 0 && bytesToCompact + sz > compactBytesLimit) {
-			return false;
-		}
-		bytesToCompact += sz;
-		adjustUpdateIndexes(reader);
-		tables.addFirst(reader);
-		return true;
-	}
-
-	private void adjustUpdateIndexes(ReftableReader reader) throws IOException {
-		if (minUpdateIndex == -1) {
-			minUpdateIndex = reader.minUpdateIndex();
-		} else {
-			minUpdateIndex = Math.min(minUpdateIndex, reader.minUpdateIndex());
-		}
-		maxUpdateIndex = Math.max(maxUpdateIndex, reader.maxUpdateIndex());
-	}
-
-	/**
 	 * Write a compaction to {@code out}.
 	 *
 	 * @throws java.io.IOException
@@ -208,8 +154,9 @@
 		MergedReftable mr = new MergedReftable(new ArrayList<>(tables));
 		mr.setIncludeDeletes(includeDeletes);
 
-		writer.setMinUpdateIndex(Math.max(minUpdateIndex, 0));
-		writer.setMaxUpdateIndex(maxUpdateIndex);
+		writer.setMaxUpdateIndex(mr.maxUpdateIndex());
+		writer.setMinUpdateIndex(mr.minUpdateIndex());
+
 		writer.begin();
 		mergeRefs(mr);
 		mergeLogs(mr);
@@ -235,16 +182,14 @@
 	}
 
 	private void mergeLogs(MergedReftable mr) throws IOException {
-		if (oldestReflogTimeMillis == Long.MAX_VALUE) {
+		if (reflogExpireOldestReflogTimeMillis == Long.MAX_VALUE) {
 			return;
 		}
 
 		try (LogCursor lc = mr.allLogs()) {
 			while (lc.next()) {
 				long updateIndex = lc.getUpdateIndex();
-				if (updateIndex < minUpdateIndex
-						|| updateIndex > maxUpdateIndex) {
-					// Cannot merge log records outside the header's range.
+				if (updateIndex > reflogExpireMaxUpdateIndex || updateIndex < reflogExpireMinUpdateIndex) {
 					continue;
 				}
 
@@ -258,7 +203,7 @@
 				}
 
 				PersonIdent who = log.getWho();
-				if (who.getWhen().getTime() >= oldestReflogTimeMillis) {
+				if (who.getWhen().getTime() >= reflogExpireOldestReflogTimeMillis) {
 					writer.writeLog(
 							refName,
 							updateIndex,
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/reftable/ReftableDatabase.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/reftable/ReftableDatabase.java
index e8a61d2..4de6c28 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/reftable/ReftableDatabase.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/reftable/ReftableDatabase.java
@@ -47,7 +47,7 @@
 	 * @throws IOException
 	 *             on I/O problems.
 	 */
-	abstract protected MergedReftable openMergedReftable() throws IOException;
+	protected abstract MergedReftable openMergedReftable() throws IOException;
 
 	/**
 	 * @return the next available logical timestamp for an additional reftable
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/reftable/ReftableReader.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/reftable/ReftableReader.java
index c19a6d3..095276f 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/reftable/ReftableReader.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/reftable/ReftableReader.java
@@ -106,15 +106,9 @@
 	}
 
 	/**
-	 * Get the minimum update index for log entries that appear in this
-	 * reftable.
-	 *
-	 * @return the minimum update index for log entries that appear in this
-	 *         reftable. This should be 1 higher than the prior reftable's
-	 *         {@code maxUpdateIndex} if this table is used in a stack.
-	 * @throws java.io.IOException
-	 *             file cannot be read.
+	 * {@inheritDoc}
 	 */
+	@Override
 	public long minUpdateIndex() throws IOException {
 		if (blockSize == -1) {
 			readFileHeader();
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/CoreConfig.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/CoreConfig.java
index 8220a91..f23c6e0 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/CoreConfig.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/CoreConfig.java
@@ -27,7 +27,7 @@
 	public static final Config.SectionParser<CoreConfig> KEY = CoreConfig::new;
 
 	/** Permissible values for {@code core.autocrlf}. */
-	public static enum AutoCRLF {
+	public enum AutoCRLF {
 		/** Automatic CRLF-&gt;LF conversion is disabled. */
 		FALSE,
 
@@ -45,7 +45,7 @@
 	 *
 	 * @since 4.3
 	 */
-	public static enum EOL {
+	public enum EOL {
 		/** Check in with LF, check out with CRLF. */
 		CRLF,
 
@@ -61,7 +61,7 @@
 	 *
 	 * @since 4.3
 	 */
-	public static enum EolStreamType {
+	public enum EolStreamType {
 		/** Convert to CRLF without binary detection. */
 		TEXT_CRLF,
 
@@ -83,7 +83,7 @@
 	 *
 	 * @since 3.0
 	 */
-	public static enum CheckStat {
+	public enum CheckStat {
 		/**
 		 * Only check the size and whole second part of time stamp when
 		 * comparing the stat info in the dircache with actual file stat info.
@@ -102,7 +102,7 @@
 	 *
 	 * @since 5.6
 	 */
-	public static enum LogRefUpdates {
+	public enum LogRefUpdates {
 		/** Don't create ref logs; default for bare repositories. */
 		FALSE,
 
@@ -131,7 +131,7 @@
 	 *
 	 * @since 3.3
 	 */
-	public static enum SymLinks {
+	public enum SymLinks {
 		/** Check out symbolic links as plain files . */
 		FALSE,
 
@@ -144,7 +144,7 @@
 	 *
 	 * @since 3.5
 	 */
-	public static enum HideDotFiles {
+	public enum HideDotFiles {
 		/** Do not hide .files. */
 		FALSE,
 
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/GitmoduleEntry.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/GitmoduleEntry.java
index d93a096..aa0a9dd 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/GitmoduleEntry.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/GitmoduleEntry.java
@@ -9,8 +9,6 @@
  */
 package org.eclipse.jgit.lib;
 
-import org.eclipse.jgit.lib.AnyObjectId;
-
 /**
  * A .gitmodules file found in the pack. Store the blob of the file itself (e.g.
  * to access its contents) and the tree where it was found (e.g. to check if it
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/IndexDiff.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/IndexDiff.java
index 293b723..28ea927 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/IndexDiff.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/IndexDiff.java
@@ -75,7 +75,7 @@
 	 * @see IndexDiff#getConflictingStageStates()
 	 * @since 3.0
 	 */
-	public static enum StageState {
+	public enum StageState {
 		/**
 		 * Exists in base, but neither in ours nor in theirs.
 		 */
@@ -210,11 +210,11 @@
 		}
 	}
 
-	private final static int TREE = 0;
+	private static final int TREE = 0;
 
-	private final static int INDEX = 1;
+	private static final int INDEX = 1;
 
-	private final static int WORKDIR = 2;
+	private static final int WORKDIR = 2;
 
 	private final Repository repository;
 
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/InflaterCache.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/InflaterCache.java
index f242d31..239b4f8 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/InflaterCache.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/InflaterCache.java
@@ -40,7 +40,7 @@
 		return r != null ? r : new Inflater(false);
 	}
 
-	private synchronized static Inflater getImpl() {
+	private static synchronized Inflater getImpl() {
 		if (openInflaterCount > 0) {
 			final Inflater r = inflaterCache[--openInflaterCount];
 			inflaterCache[openInflaterCount] = null;
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectIdOwnerMap.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectIdOwnerMap.java
index 1e93235..ad52955 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectIdOwnerMap.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectIdOwnerMap.java
@@ -322,7 +322,7 @@
 	}
 
 	/** Type of entry stored in the {@link ObjectIdOwnerMap}. */
-	public static abstract class Entry extends ObjectId {
+	public abstract static class Entry extends ObjectId {
 		transient Entry next;
 
 		/**
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectInserter.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectInserter.java
index 1c3c918..000899d 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectInserter.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectInserter.java
@@ -65,7 +65,7 @@
 	}
 
 	/** Wraps a delegate ObjectInserter. */
-	public static abstract class Filter extends ObjectInserter {
+	public abstract static class Filter extends ObjectInserter {
 		/** @return delegate ObjectInserter to handle all processing. */
 		protected abstract ObjectInserter delegate();
 
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectLoader.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectLoader.java
index ad5314f..67b8a2c 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectLoader.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectLoader.java
@@ -300,7 +300,7 @@
 	 *
 	 * @since 4.10
 	 */
-	public static abstract class Filter extends ObjectLoader {
+	public abstract static class Filter extends ObjectLoader {
 		/**
 		 * @return delegate ObjectLoader to handle all processing.
 		 * @since 4.10
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectReader.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectReader.java
index c0ac9e7..6bb6ae5 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectReader.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectReader.java
@@ -462,7 +462,7 @@
 	 *
 	 * @since 4.4
 	 */
-	public static abstract class Filter extends ObjectReader {
+	public abstract static class Filter extends ObjectReader {
 		/**
 		 * @return delegate ObjectReader to handle all processing.
 		 * @since 4.4
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/RebaseTodoLine.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/RebaseTodoLine.java
index 02022e9..8b77849 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/RebaseTodoLine.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/RebaseTodoLine.java
@@ -25,7 +25,7 @@
 	 * Describes rebase actions
 	 */
 	@SuppressWarnings("nls")
-	public static enum Action {
+	public enum Action {
 		/** Use commit */
 		PICK("pick", "p"),
 
@@ -72,7 +72,7 @@
 		 * @param token
 		 * @return the Action
 		 */
-		static public Action parse(String token) {
+		public static Action parse(String token) {
 			for (Action action : Action.values()) {
 				if (action.token.equals(token)
 						|| action.shortToken.equals(token))
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/RefUpdate.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/RefUpdate.java
index 40e0a32..d1be63b 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/RefUpdate.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/RefUpdate.java
@@ -33,7 +33,7 @@
 	 * unknown values are failures, and may generally treat them the same as
 	 * {@link #REJECTED_OTHER_REASON}.
 	 */
-	public static enum Result {
+	public enum Result {
 		/** The ref update/delete has not been attempted by the caller. */
 		NOT_ATTEMPTED,
 
@@ -794,7 +794,7 @@
 	 * Handle the abstraction of storing a ref update. This is because both
 	 * updating and deleting of a ref have merge testing in common.
 	 */
-	private static abstract class Store {
+	private abstract static class Store {
 		abstract Result execute(Result status) throws IOException;
 	}
 }
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/RepositoryCache.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/RepositoryCache.java
index 4af25de..d36ccd5 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/RepositoryCache.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/RepositoryCache.java
@@ -33,7 +33,7 @@
  * Cache of active {@link org.eclipse.jgit.lib.Repository} instances.
  */
 public class RepositoryCache {
-	private final static Logger LOG = LoggerFactory
+	private static final Logger LOG = LoggerFactory
 			.getLogger(RepositoryCache.class);
 
 	private static final RepositoryCache cache = new RepositoryCache();
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/merge/MergeAlgorithm.java b/org.eclipse.jgit/src/org/eclipse/jgit/merge/MergeAlgorithm.java
index 39e7840..27141c1 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/merge/MergeAlgorithm.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/merge/MergeAlgorithm.java
@@ -50,7 +50,7 @@
 
 	// An special edit which acts as a sentinel value by marking the end the
 	// list of edits
-	private final static Edit END_EDIT = new Edit(Integer.MAX_VALUE,
+	private static final Edit END_EDIT = new Edit(Integer.MAX_VALUE,
 			Integer.MAX_VALUE);
 
 	@SuppressWarnings("ReferenceEquality")
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/nls/NLS.java b/org.eclipse.jgit/src/org/eclipse/jgit/nls/NLS.java
index 2cb1a53..daa039d 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/nls/NLS.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/nls/NLS.java
@@ -100,8 +100,8 @@
 		return b.get(type);
 	}
 
-	final private Locale locale;
-	final private ConcurrentHashMap<Class, TranslationBundle> map = new ConcurrentHashMap<>();
+	private final Locale locale;
+	private final ConcurrentHashMap<Class, TranslationBundle> map = new ConcurrentHashMap<>();
 
 	private NLS(Locale locale) {
 		this.locale = locale;
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/patch/BinaryHunk.java b/org.eclipse.jgit/src/org/eclipse/jgit/patch/BinaryHunk.java
index 2c7d696..20fcf8c 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/patch/BinaryHunk.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/patch/BinaryHunk.java
@@ -25,7 +25,7 @@
 	private static final byte[] DELTA = encodeASCII("delta "); //$NON-NLS-1$
 
 	/** Type of information stored in a binary hunk. */
-	public static enum Type {
+	public enum Type {
 		/** The full content is stored, deflated. */
 		LITERAL_DEFLATED,
 
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/patch/CombinedHunkHeader.java b/org.eclipse.jgit/src/org/eclipse/jgit/patch/CombinedHunkHeader.java
index edf278c..263b1b9 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/patch/CombinedHunkHeader.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/patch/CombinedHunkHeader.java
@@ -25,7 +25,7 @@
  * Hunk header for a hunk appearing in a "diff --cc" style patch.
  */
 public class CombinedHunkHeader extends HunkHeader {
-	private static abstract class CombinedOldImage extends OldImage {
+	private abstract static class CombinedOldImage extends OldImage {
 		int nContext;
 	}
 
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/patch/FileHeader.java b/org.eclipse.jgit/src/org/eclipse/jgit/patch/FileHeader.java
index 617b667..1e6fb78 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/patch/FileHeader.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/patch/FileHeader.java
@@ -71,7 +71,7 @@
 	static final byte[] NEW_NAME = encodeASCII("+++ "); //$NON-NLS-1$
 
 	/** Type of patch used by this file. */
-	public static enum PatchType {
+	public enum PatchType {
 		/** A traditional unified diff style patch of a text file. */
 		UNIFIED,
 
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/patch/FormatError.java b/org.eclipse.jgit/src/org/eclipse/jgit/patch/FormatError.java
index 69ed60a..5618a71 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/patch/FormatError.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/patch/FormatError.java
@@ -21,7 +21,7 @@
  */
 public class FormatError {
 	/** Classification of an error. */
-	public static enum Severity {
+	public enum Severity {
 		/** The error is unexpected, but can be worked around. */
 		WARNING,
 
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/FileBasedConfig.java b/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/FileBasedConfig.java
index 92f0892..0b9b981 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/FileBasedConfig.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/FileBasedConfig.java
@@ -44,7 +44,7 @@
  * The configuration file that is stored in the file of the file system.
  */
 public class FileBasedConfig extends StoredConfig {
-	private final static Logger LOG = LoggerFactory
+	private static final Logger LOG = LoggerFactory
 			.getLogger(FileBasedConfig.class);
 
 	private final File configFile;
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackPushConnection.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackPushConnection.java
index 168dae5..eb1d2ac 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackPushConnection.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackPushConnection.java
@@ -358,7 +358,7 @@
 				refNameEnd = refLine.length();
 			} else if (refLine.startsWith("ng ")) { //$NON-NLS-1$
 				ok = false;
-				refNameEnd = refLine.indexOf(" ", 3); //$NON-NLS-1$
+				refNameEnd = refLine.indexOf(' ', 3);
 			}
 			if (refNameEnd == -1)
 				throw new PackProtocolException(MessageFormat.format(JGitText.get().unexpectedReportLine2
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/GitProtocolConstants.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/GitProtocolConstants.java
index 54bdc3d..35e2978 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/GitProtocolConstants.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/GitProtocolConstants.java
@@ -247,7 +247,7 @@
 	 */
 	public static final String COMMAND_FETCH = "fetch"; //$NON-NLS-1$
 
-	static enum MultiAck {
+	enum MultiAck {
 		OFF, CONTINUE, DETAILED;
 	}
 
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/JschConfigSessionFactory.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/JschConfigSessionFactory.java
index faa917a..718c8f6 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/JschConfigSessionFactory.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/JschConfigSessionFactory.java
@@ -219,7 +219,13 @@
 
 	private static void setPreferredKeyTypesOrder(Session session) {
 		HostKeyRepository hkr = session.getHostKeyRepository();
-		List<String> known = Stream.of(hkr.getHostKey(hostName(session), null))
+		HostKey[] hostKeys = hkr.getHostKey(hostName(session), null);
+
+		if (hostKeys == null) {
+			return;
+		}
+
+		List<String> known = Stream.of(hostKeys)
 				.map(HostKey::getType)
 				.collect(toList());
 
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/PackParser.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/PackParser.java
index 8998180..0801b8a 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/PackParser.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/PackParser.java
@@ -70,7 +70,7 @@
 	private static final int BUFFER_SIZE = 8192;
 
 	/** Location data is being obtained from. */
-	public static enum Source {
+	public enum Source {
 		/** Data is read from the incoming stream. */
 		INPUT,
 
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/PacketLineIn.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/PacketLineIn.java
index c992bb1..52a5576 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/PacketLineIn.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/PacketLineIn.java
@@ -62,7 +62,7 @@
 	@Deprecated
 	public static final String DELIM = new StringBuilder(0).toString(); 	/* must not string pool */
 
-	static enum AckNackResult {
+	enum AckNackResult {
 		/** NAK */
 		NAK,
 		/** ACK */
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/ReceiveCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/ReceiveCommand.java
index 6146eaa..ab41160 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/ReceiveCommand.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/ReceiveCommand.java
@@ -39,7 +39,7 @@
  */
 public class ReceiveCommand {
 	/** Type of operation requested. */
-	public static enum Type {
+	public enum Type {
 		/** Create a new ref; the ref must not already exist. */
 		CREATE,
 
@@ -65,7 +65,7 @@
 	}
 
 	/** Result of the update command. */
-	public static enum Result {
+	public enum Result {
 		/** The command has not yet been attempted by the server. */
 		NOT_ATTEMPTED,
 
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 e505e17..ec2b769 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/ReceivePack.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/ReceivePack.java
@@ -1937,7 +1937,7 @@
 	}
 
 	/** Interface for reporting status messages. */
-	static abstract class Reporter {
+	abstract static class Reporter {
 		abstract void sendString(String s) throws IOException;
 	}
 
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/RemoteRefUpdate.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/RemoteRefUpdate.java
index f7d318c..43eaac7 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/RemoteRefUpdate.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/RemoteRefUpdate.java
@@ -39,7 +39,7 @@
 	/**
 	 * Represent current status of a remote ref update.
 	 */
-	public static enum Status {
+	public enum Status {
 		/**
 		 * Push process hasn't yet attempted to update this ref. This is the
 		 * default status, prior to push process execution.
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportProtocol.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportProtocol.java
index 4767e1b..912a90a 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportProtocol.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportProtocol.java
@@ -57,7 +57,7 @@
  */
 public abstract class TransportProtocol {
 	/** Fields within a {@link URIish} that a transport uses. */
-	public static enum URIishField {
+	public enum URIishField {
 		/** the user field */
 		USER,
 		/** the pass (aka password) field */
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 8e8b781..09ca7ca 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java
@@ -104,7 +104,7 @@
  */
 public class UploadPack {
 	/** Policy the server uses to validate client requests */
-	public static enum RequestPolicy {
+	public enum RequestPolicy {
 		/** Client may only ask for objects the server advertised a reference for. */
 		ADVERTISED,
 
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/WalkEncryption.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/WalkEncryption.java
index df9f11e..c8cdb5a 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/WalkEncryption.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/WalkEncryption.java
@@ -34,9 +34,9 @@
 import javax.crypto.spec.PBEParameterSpec;
 import javax.crypto.spec.SecretKeySpec;
 
-import org.bouncycastle.util.encoders.Hex;
 import org.eclipse.jgit.internal.JGitText;
 import org.eclipse.jgit.util.Base64;
+import org.eclipse.jgit.util.Hex;
 
 abstract class WalkEncryption {
 	static final WalkEncryption NONE = new NoEncryption();
@@ -294,7 +294,7 @@
 	 * Base implementation of JGit symmetric encryption. Supports V2 properties
 	 * format.
 	 */
-	static abstract class SymmetricEncryption extends WalkEncryption
+	abstract static class SymmetricEncryption extends WalkEncryption
 			implements Keys, Vals {
 
 		/** Encryption profile, root name of group of related properties. */
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/FileTreeIterator.java b/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/FileTreeIterator.java
index f4be9e6..60b92d7 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/FileTreeIterator.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/FileTreeIterator.java
@@ -242,7 +242,7 @@
 		/**
 		 * a singleton instance of the default FileModeStrategy
 		 */
-		public final static DefaultFileModeStrategy INSTANCE =
+		public static final DefaultFileModeStrategy INSTANCE =
 				new DefaultFileModeStrategy();
 
 		@Override
@@ -275,7 +275,7 @@
 		/**
 		 * a singleton instance of the default FileModeStrategy
 		 */
-		public final static NoGitlinksStrategy INSTANCE = new NoGitlinksStrategy();
+		public static final NoGitlinksStrategy INSTANCE = new NoGitlinksStrategy();
 
 		@Override
 		public FileMode getMode(File f, FS.Attributes attributes) {
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/TreeWalk.java b/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/TreeWalk.java
index bc7c502..1f614e3 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/TreeWalk.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/TreeWalk.java
@@ -78,7 +78,7 @@
 	/**
 	 * @since 4.2
 	 */
-	public static enum OperationType {
+	public enum OperationType {
 		/**
 		 * Represents a checkout operation (for example a checkout or reset
 		 * operation).
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/WorkingTreeIterator.java b/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/WorkingTreeIterator.java
index 2c3f3e2..2d406bd 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/WorkingTreeIterator.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/WorkingTreeIterator.java
@@ -1147,7 +1147,7 @@
 	 *
 	 * @since 5.0
 	 */
-	public static abstract class Entry {
+	public abstract static class Entry {
 		byte[] encodedName;
 
 		int encodedNameLen;
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/Base64.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/Base64.java
index 69f8547..119c96e 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/util/Base64.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/Base64.java
@@ -28,26 +28,26 @@
  */
 public class Base64 {
 	/** The equals sign (=) as a byte. */
-	private final static byte EQUALS_SIGN = (byte) '=';
+	private static final byte EQUALS_SIGN = (byte) '=';
 
 	/** Indicates equals sign in encoding. */
-	private final static byte EQUALS_SIGN_DEC = -1;
+	private static final byte EQUALS_SIGN_DEC = -1;
 
 	/** Indicates white space in encoding. */
-	private final static byte WHITE_SPACE_DEC = -2;
+	private static final byte WHITE_SPACE_DEC = -2;
 
 	/** Indicates an invalid byte during decoding. */
-	private final static byte INVALID_DEC = -3;
+	private static final byte INVALID_DEC = -3;
 
 	/** The 64 valid Base64 values. */
-	private final static byte[] ENC;
+	private static final byte[] ENC;
 
 	/**
 	 * Translates a Base64 value to either its 6-bit reconstruction value or a
 	 * negative number indicating some other meaning. The table is only 7 bits
 	 * wide, as the 8th bit is discarded during decoding.
 	 */
-	private final static byte[] DEC;
+	private static final byte[] DEC;
 
 	static {
 		ENC = ("ABCDEFGHIJKLMNOPQRSTUVWXYZ" // //$NON-NLS-1$
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/ChangeIdUtil.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/ChangeIdUtil.java
index 59327f7..12af374 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/util/ChangeIdUtil.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/ChangeIdUtil.java
@@ -148,7 +148,7 @@
 			ret.append(CHANGE_ID);
 			ret.append(" I"); //$NON-NLS-1$
 			ret.append(ObjectId.toString(changeId));
-			int indexOfNextLineBreak = message.indexOf("\n", //$NON-NLS-1$
+			int indexOfNextLineBreak = message.indexOf('\n',
 					indexOfChangeId);
 			if (indexOfNextLineBreak > 0)
 				ret.append(message.substring(indexOfNextLineBreak));
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 4156318..f747d1a 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/util/FS.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/FS.java
@@ -184,7 +184,7 @@
 	 *
 	 * @since 5.1.9
 	 */
-	public final static class FileStoreAttributes {
+	public static final class FileStoreAttributes {
 
 		private static final Duration UNDEFINED_DURATION = Duration
 				.ofNanos(Long.MAX_VALUE);
@@ -204,9 +204,8 @@
 		public static final FileStoreAttributes FALLBACK_FILESTORE_ATTRIBUTES = new FileStoreAttributes(
 				FALLBACK_TIMESTAMP_RESOLUTION);
 
-		private static final String JAVA_VERSION_PREFIX = SystemReader
-				.getInstance().getHostname() + '|'
-				+ System.getProperty("java.vendor") + '|' //$NON-NLS-1$
+		private static final String JAVA_VERSION_PREFIX = System
+				.getProperty("java.vendor") + '|' //$NON-NLS-1$
 				+ System.getProperty("java.version") + '|'; //$NON-NLS-1$
 
 		private static final Duration FALLBACK_MIN_RACY_INTERVAL = Duration
@@ -691,7 +690,7 @@
 	/** The auto-detected implementation selected for this operating system and JRE. */
 	public static final FS DETECTED = detect();
 
-	private volatile static FSFactory factory;
+	private static volatile FSFactory factory;
 
 	/**
 	 * Auto-detect the appropriate file system abstraction.
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/FS_POSIX.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/FS_POSIX.java
index df5784b..a082200 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/util/FS_POSIX.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/FS_POSIX.java
@@ -52,7 +52,7 @@
  * @since 3.0
  */
 public class FS_POSIX extends FS {
-	private final static Logger LOG = LoggerFactory.getLogger(FS_POSIX.class);
+	private static final Logger LOG = LoggerFactory.getLogger(FS_POSIX.class);
 
 	private static final int DEFAULT_UMASK = 0022;
 	private volatile int umask = -1;
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/FS_Win32.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/FS_Win32.java
index c201586..d44dc32 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/util/FS_Win32.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/FS_Win32.java
@@ -39,7 +39,7 @@
  * @since 3.0
  */
 public class FS_Win32 extends FS {
-	private final static Logger LOG = LoggerFactory.getLogger(FS_Win32.class);
+	private static final Logger LOG = LoggerFactory.getLogger(FS_Win32.class);
 
 	/**
 	 * Constructor
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/FS_Win32_Cygwin.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/FS_Win32_Cygwin.java
index 30e2c0c..dd39416 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/util/FS_Win32_Cygwin.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/FS_Win32_Cygwin.java
@@ -32,7 +32,7 @@
  * @since 3.0
  */
 public class FS_Win32_Cygwin extends FS_Win32 {
-	private final static Logger LOG = LoggerFactory
+	private static final Logger LOG = LoggerFactory
 			.getLogger(FS_Win32_Cygwin.class);
 
 	private static String cygpath;
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/GitDateFormatter.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/GitDateFormatter.java
index 1c00925..e6bf497 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/util/GitDateFormatter.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/GitDateFormatter.java
@@ -35,7 +35,7 @@
 	/**
 	 * Git and JGit formats
 	 */
-	static public enum Format {
+	public enum Format {
 
 		/**
 		 * Git format: Time and original time zone
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/Hex.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/Hex.java
new file mode 100644
index 0000000..9359036
--- /dev/null
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/Hex.java
@@ -0,0 +1,63 @@
+/*
+ * Copyright (C) 2020, Michael Dardis. 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.util;
+
+/**
+ * Encodes and decodes to and from hexadecimal notation.
+ *
+ * @since 5.7
+ */
+public final class Hex {
+
+	private static final char[] HEX = "0123456789abcdef".toCharArray(); //$NON-NLS-1$
+
+	/** Defeats instantiation. */
+	private Hex() {
+		// empty
+	}
+
+	/**
+	 * Decode a hexadecimal string to a byte array.
+	 *
+	 * Note this method performs no validation on input content.
+	 *
+	 * @param s hexadecimal string
+	 * @return decoded array
+	 */
+	public static byte[] decode(String s) {
+		int len = s.length();
+		byte[] b = new byte[len / 2];
+
+		for (int i = 0; i < len; i += 2) {
+			b[i / 2] = (byte) ((Character.digit(s.charAt(i), 16) << 4) | Character.digit(s.charAt(i + 1), 16));
+		}
+		return b;
+	}
+
+	/**
+	 * Encode a byte array to a hexadecimal string.
+	 *
+	 * @param b byte array
+	 * @return hexadecimal string
+	 */
+	public static String toHexString(byte[] b) {
+		char[] c = new char[b.length * 2];
+
+		for (int i = 0; i < b.length; i++) {
+			int v = b[i] & 0xFF;
+
+			c[i * 2] = HEX[v >>> 4];
+			c[i * 2 + 1] = HEX[v & 0x0F];
+		}
+
+		return new String(c);
+	}
+}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/Monitoring.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/Monitoring.java
index 83bf695..cd2a8e6 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/util/Monitoring.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/Monitoring.java
@@ -33,7 +33,7 @@
  * @since 5.1.13
  */
 public class Monitoring {
-	private final static Logger LOG = LoggerFactory.getLogger(Monitoring.class);
+	private static final Logger LOG = LoggerFactory.getLogger(Monitoring.class);
 
 	/**
 	 * Register a MBean with the platform MBean server
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/ProcessResult.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/ProcessResult.java
index 6594b3f..d2b4a0d 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/util/ProcessResult.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/ProcessResult.java
@@ -18,7 +18,7 @@
 	/**
 	 * Status of a process' execution.
 	 */
-	public static enum Status {
+	public enum Status {
 		/**
 		 * The script was found and launched properly. It may still have exited
 		 * with a non-zero {@link #exitCode}.
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/RelativeDateFormatter.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/RelativeDateFormatter.java
index bf70a14..5611b1e 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/util/RelativeDateFormatter.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/RelativeDateFormatter.java
@@ -19,19 +19,19 @@
  * in the format defined by {@code git log --relative-date}.
  */
 public class RelativeDateFormatter {
-	final static long SECOND_IN_MILLIS = 1000;
+	static final long SECOND_IN_MILLIS = 1000;
 
-	final static long MINUTE_IN_MILLIS = 60 * SECOND_IN_MILLIS;
+	static final long MINUTE_IN_MILLIS = 60 * SECOND_IN_MILLIS;
 
-	final static long HOUR_IN_MILLIS = 60 * MINUTE_IN_MILLIS;
+	static final long HOUR_IN_MILLIS = 60 * MINUTE_IN_MILLIS;
 
-	final static long DAY_IN_MILLIS = 24 * HOUR_IN_MILLIS;
+	static final long DAY_IN_MILLIS = 24 * HOUR_IN_MILLIS;
 
-	final static long WEEK_IN_MILLIS = 7 * DAY_IN_MILLIS;
+	static final long WEEK_IN_MILLIS = 7 * DAY_IN_MILLIS;
 
-	final static long MONTH_IN_MILLIS = 30 * DAY_IN_MILLIS;
+	static final long MONTH_IN_MILLIS = 30 * DAY_IN_MILLIS;
 
-	final static long YEAR_IN_MILLIS = 365 * DAY_IN_MILLIS;
+	static final long YEAR_IN_MILLIS = 365 * DAY_IN_MILLIS;
 
 	/**
 	 * Get age of given {@link java.util.Date} compared to now formatted in the
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/SystemReader.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/SystemReader.java
index ff7f54c..bcb8380 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/util/SystemReader.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/SystemReader.java
@@ -52,7 +52,7 @@
  */
 public abstract class SystemReader {
 
-	private final static Logger LOG = LoggerFactory
+	private static final Logger LOG = LoggerFactory
 			.getLogger(SystemReader.class);
 
 	private static final SystemReader DEFAULT;
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/io/TeeOutputStream.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/io/TeeOutputStream.java
new file mode 100644
index 0000000..e6fdd70
--- /dev/null
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/io/TeeOutputStream.java
@@ -0,0 +1,74 @@
+/*
+ * Copyright (C) 2020, Michael Dardis. 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.util.io;
+
+import java.io.IOException;
+import java.io.OutputStream;
+
+/**
+ * An output stream that writes all data to two streams.
+ *
+ * @since 5.7
+ */
+public class TeeOutputStream extends OutputStream {
+
+	private final OutputStream stream1;
+	private final OutputStream stream2;
+
+	/**
+	 * Initialize a tee output stream.
+	 *
+	 * @param stream1 first output stream
+	 * @param stream2 second output stream
+	 */
+	public TeeOutputStream(OutputStream stream1, OutputStream stream2) {
+		this.stream1 = stream1;
+		this.stream2 = stream2;
+	}
+
+	/** {@inheritDoc} */
+	@Override
+	public void write(byte[] buf) throws IOException {
+		this.stream1.write(buf);
+		this.stream2.write(buf);
+	}
+
+	/** {@inheritDoc} */
+	@Override
+	public void write(byte[] buf, int off, int len) throws IOException {
+		this.stream1.write(buf, off, len);
+		this.stream2.write(buf, off, len);
+	}
+
+	/** {@inheritDoc} */
+	@Override
+	public void write(int b) throws IOException {
+		this.stream1.write(b);
+		this.stream2.write(b);
+	}
+
+	/** {@inheritDoc} */
+	@Override
+	public void flush() throws IOException {
+		this.stream1.flush();
+		this.stream2.flush();
+	}
+
+	/** {@inheritDoc} */
+	@Override
+	public void close() throws IOException {
+		try {
+			this.stream1.close();
+		} finally {
+			this.stream2.close();
+		}
+	}
+}
diff --git a/pom.xml b/pom.xml
index d0a5c83..3d9acd4 100644
--- a/pom.xml
+++ b/pom.xml
@@ -234,7 +234,7 @@
         <plugin>
           <groupId>org.apache.maven.plugins</groupId>
           <artifactId>maven-shade-plugin</artifactId>
-          <version>3.2.1</version>
+          <version>3.2.2</version>
         </plugin>
 
         <plugin>
@@ -846,12 +846,12 @@
               <dependency>
                 <groupId>org.codehaus.plexus</groupId>
                 <artifactId>plexus-compiler-javac</artifactId>
-                <version>2.8.5</version>
+                <version>2.8.6</version>
               </dependency>
               <dependency>
                 <groupId>org.codehaus.plexus</groupId>
                 <artifactId>plexus-compiler-javac-errorprone</artifactId>
-                <version>2.8.5</version>
+                <version>2.8.6</version>
               </dependency>
               <!-- override plexus-compiler-javac-errorprone's dependency on
                   Error Prone with the latest version -->
@@ -890,7 +890,7 @@
               <dependency>
                 <groupId>org.codehaus.plexus</groupId>
                 <artifactId>plexus-compiler-eclipse</artifactId>
-                <version>2.8.5</version>
+                <version>2.8.6</version>
               </dependency>
               <dependency>
                 <groupId>org.eclipse.jdt</groupId>