summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit
diff options
context:
space:
mode:
authorMatthias Sohn <matthias.sohn@sap.com>2020-03-10 00:52:52 +0100
committerMatthias Sohn <matthias.sohn@sap.com>2020-03-10 00:52:52 +0100
commitcfc4f0114928803030e2655ff85aafa8ea1ac98d (patch)
tree163911765f44693c219e43bb2e2a52150de1b93b /org.eclipse.jgit
parentfb28427499584759a8d662e0c9e30a0e86338d70 (diff)
parent75ed8510f09f3f92373e49432a322400aa9c3e76 (diff)
downloadjgit-cfc4f0114928803030e2655ff85aafa8ea1ac98d.tar.gz
jgit-cfc4f0114928803030e2655ff85aafa8ea1ac98d.zip
Merge branch 'master' into next
* master: Prepare 5.7.1-SNAPSHOT builds Prepare 5.8.0-SNAPSHOT builds JGit v5.7.0.202003090808-r Silence API errors introduced by 093fbbd1 Bump Bazel version to 2.2.0 Add validation to hex decoder Expose FileStoreAttributes.setBackground() Update reftable storage repo layout Add 4.14 and 4.15-staging target platforms Update Orbit to R20200224183213 for final 2020-03 Update Orbit to S20200224183213 for 2020-03 RC1 Cygwin expects forward slashes for commands to be run via sh.exe [releng] Update year in copyright notices for features Using for-each loop in jdt Make Logger instances final Move array designators from the variable to the type ObjectWalk: Add null check before skip tree. Revert "RevWalk: stop mixing lines of history in topo sort" Do not fail if known hosts file does not contain valid host key Prepare 5.7.0-SNAPSHOT builds JGit v5.7.0.202002241735-m3 Update Orbit to S20200219023850 for 2012-03 M3 Change-Id: I6a219888699ebf6d768f2b8fe33a6d2ca9d4c392 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Diffstat (limited to 'org.eclipse.jgit')
-rw-r--r--org.eclipse.jgit/.settings/.api_filters28
-rw-r--r--org.eclipse.jgit/resources/org/eclipse/jgit/internal/JGitText.properties1
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/api/RebaseCommand.java3
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/diff/RawText.java2
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheCheckout.java3
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/fnmatch/FileNameMatcher.java4
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/internal/JGitText.java1
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/FileReftableDatabase.java25
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/FileReftableStack.java4
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/FileRepository.java116
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/DeltaIndex.java4
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java4
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/lib/ConfigConstants.java13
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/lib/Constants.java6
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/merge/ResolveMerger.java2
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/revwalk/ObjectWalk.java4
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevObject.java2
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevWalk.java8
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/revwalk/TopoSortGenerator.java44
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/revwalk/filter/PatternMatchRevFilter.java4
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/transport/HttpAuthMethod.java3
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/transport/JschConfigSessionFactory.java8
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/transport/URIish.java4
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java4
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/util/FS.java15
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/util/FS_Win32_Cygwin.java2
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/util/Hex.java21
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/util/LfsFactory.java2
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/util/Monitoring.java2
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/util/QuotedString.java4
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/util/RawParseUtils.java4
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/util/sha1/SHA1.java2
32 files changed, 229 insertions, 120 deletions
diff --git a/org.eclipse.jgit/.settings/.api_filters b/org.eclipse.jgit/.settings/.api_filters
index 92b736337e..9df953becb 100644
--- a/org.eclipse.jgit/.settings/.api_filters
+++ b/org.eclipse.jgit/.settings/.api_filters
@@ -37,6 +37,26 @@
<message_argument value="CONFIG_KEY_PACKED_GIT_WINDOWSIZE"/>
</message_arguments>
</filter>
+ <filter id="1142947843">
+ <message_arguments>
+ <message_argument value="5.6.2"/>
+ <message_argument value="CONFIG_EXTENSIONS_SECTION"/>
+ </message_arguments>
+ </filter>
+ <filter id="1142947843">
+ <message_arguments>
+ <message_argument value="5.6.2"/>
+ <message_argument value="CONFIG_KEY_REF_STORAGE"/>
+ </message_arguments>
+ </filter>
+ </resource>
+ <resource path="src/org/eclipse/jgit/lib/Constants.java" type="org.eclipse.jgit.lib.Constants">
+ <filter id="1142947843">
+ <message_arguments>
+ <message_argument value="5.6.2"/>
+ <message_argument value="TABLES_LIST"/>
+ </message_arguments>
+ </filter>
</resource>
<resource path="src/org/eclipse/jgit/storage/file/WindowCacheConfig.java" type="org.eclipse.jgit.storage.file.WindowCacheConfig">
<filter id="1142947843">
@@ -69,6 +89,14 @@
</message_arguments>
</filter>
</resource>
+ <resource path="src/org/eclipse/jgit/util/FS.java" type="org.eclipse.jgit.util.FS$FileStoreAttributes">
+ <filter id="1226833923">
+ <message_arguments>
+ <message_argument value="5.6.2"/>
+ <message_argument value="setBackground(boolean)"/>
+ </message_arguments>
+ </filter>
+ </resource>
<resource path="src/org/eclipse/jgit/util/Monitoring.java" type="org.eclipse.jgit.util.Monitoring">
<filter id="1109393411">
<message_arguments>
diff --git a/org.eclipse.jgit/resources/org/eclipse/jgit/internal/JGitText.properties b/org.eclipse.jgit/resources/org/eclipse/jgit/internal/JGitText.properties
index 153399ca34..1218ee612d 100644
--- a/org.eclipse.jgit/resources/org/eclipse/jgit/internal/JGitText.properties
+++ b/org.eclipse.jgit/resources/org/eclipse/jgit/internal/JGitText.properties
@@ -354,6 +354,7 @@ invalidFilter=Invalid filter: {0}
invalidGitdirRef = Invalid .git reference in file ''{0}''
invalidGitModules=Invalid .gitmodules file
invalidGitType=invalid git type: {0}
+invalidHexString=Invalid hex string: {0}
invalidHooksPath=Invalid git config core.hooksPath = {0}
invalidId=Invalid id: {0}
invalidId0=Invalid id
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 b722fbe9d1..6678af163a 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/api/RebaseCommand.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/RebaseCommand.java
@@ -338,8 +338,7 @@ public class RebaseCommand extends GitCommand<RebaseResult> {
steps, false);
}
checkSteps(steps);
- for (int i = 0; i < steps.size(); i++) {
- RebaseTodoLine step = steps.get(i);
+ for (RebaseTodoLine step : steps) {
popSteps(1);
RebaseResult result = processStep(step, true);
if (result != null) {
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/diff/RawText.java b/org.eclipse.jgit/src/org/eclipse/jgit/diff/RawText.java
index 6abefc02d7..9f4b1fa493 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/diff/RawText.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/diff/RawText.java
@@ -415,7 +415,7 @@ public class RawText extends Sequence {
}
}
- byte data[];
+ byte[] data;
try {
data = new byte[(int)sz];
} catch (OutOfMemoryError e) {
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheCheckout.java b/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheCheckout.java
index fdc89cd54d..e8e1984306 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheCheckout.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheCheckout.java
@@ -79,7 +79,8 @@ import org.slf4j.LoggerFactory;
* This class handles checking out one or two trees merging with the index.
*/
public class DirCacheCheckout {
- private static Logger LOG = LoggerFactory.getLogger(DirCacheCheckout.class);
+ private static final Logger LOG = LoggerFactory
+ .getLogger(DirCacheCheckout.class);
private static final int MAX_EXCEPTION_TEXT_SIZE = 10 * 1024;
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/fnmatch/FileNameMatcher.java b/org.eclipse.jgit/src/org/eclipse/jgit/fnmatch/FileNameMatcher.java
index 3a6c413a02..57b90e9668 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/fnmatch/FileNameMatcher.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/fnmatch/FileNameMatcher.java
@@ -380,8 +380,8 @@ public class FileNameMatcher {
* @return a boolean.
*/
public boolean canAppendMatch() {
- for (int i = 0; i < heads.size(); i++) {
- if (heads.get(i) != LastHead.INSTANCE) {
+ for (Head head : heads) {
+ if (head != LastHead.INSTANCE) {
return true;
}
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/JGitText.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/JGitText.java
index ef4c855949..6235dd83d9 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/JGitText.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/JGitText.java
@@ -382,6 +382,7 @@ public class JGitText extends TranslationBundle {
/***/ public String invalidGitdirRef;
/***/ public String invalidGitModules;
/***/ public String invalidGitType;
+ /***/ public String invalidHexString;
/***/ public String invalidHooksPath;
/***/ public String invalidId;
/***/ public String invalidId0;
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/FileReftableDatabase.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/FileReftableDatabase.java
index aea14de756..e613a58062 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/FileReftableDatabase.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/FileReftableDatabase.java
@@ -64,6 +64,11 @@ public class FileReftableDatabase extends RefDatabase {
private final FileReftableStack reftableStack;
+ FileReftableDatabase(FileRepository repo) throws IOException {
+ this(repo, new File(new File(repo.getDirectory(), Constants.REFTABLE),
+ Constants.TABLES_LIST));
+ }
+
FileReftableDatabase(FileRepository repo, File refstackName) throws IOException {
this.fileRepository = repo;
this.reftableStack = new FileReftableStack(refstackName,
@@ -88,8 +93,7 @@ public class FileReftableDatabase extends RefDatabase {
* @return whether the given repo uses reftable for refdb storage.
*/
public static boolean isReftable(File repoDir) {
- return new File(repoDir, "refs").isFile() //$NON-NLS-1$
- && new File(repoDir, Constants.REFTABLE).isDirectory();
+ return new File(repoDir, Constants.REFTABLE).isDirectory();
}
/** {@inheritDoc} */
@@ -593,8 +597,6 @@ public class FileReftableDatabase extends RefDatabase {
/**
* @param repo
* the repository
- * @param refstackName
- * the filename for the stack
* @param writeLogs
* whether to write reflogs
* @return a reftable based RefDB from an existing repository.
@@ -602,22 +604,25 @@ public class FileReftableDatabase extends RefDatabase {
* on IO error
*/
public static FileReftableDatabase convertFrom(FileRepository repo,
- File refstackName, boolean writeLogs) throws IOException {
+ boolean writeLogs) throws IOException {
FileReftableDatabase newDb = null;
+ File reftableList = null;
try {
- File reftableDir = new File(repo.getDirectory(), Constants.REFTABLE);
+ File reftableDir = new File(repo.getDirectory(),
+ Constants.REFTABLE);
+ reftableList = new File(reftableDir, Constants.TABLES_LIST);
if (!reftableDir.isDirectory()) {
reftableDir.mkdir();
}
- try (FileReftableStack stack = new FileReftableStack(refstackName,
+ try (FileReftableStack stack = new FileReftableStack(reftableList,
reftableDir, null, () -> repo.getConfig())) {
stack.addReftable(rw -> writeConvertTable(repo, rw, writeLogs));
}
- refstackName = null;
+ reftableList = null;
} finally {
- if (refstackName != null) {
- refstackName.delete();
+ if (reftableList != null) {
+ reftableList.delete();
}
}
return newDb;
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 cded6700ad..bc2039c56b 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
@@ -649,7 +649,7 @@ public class FileReftableStack implements AutoCloseable {
}
}
- static List<Segment> segmentSizes(long sizes[]) {
+ static List<Segment> segmentSizes(long[] sizes) {
List<Segment> segments = new ArrayList<>();
Segment cur = new Segment();
for (int i = 0; i < sizes.length; i++) {
@@ -669,7 +669,7 @@ public class FileReftableStack implements AutoCloseable {
return segments;
}
- private static Optional<Segment> autoCompactCandidate(long sizes[]) {
+ private static Optional<Segment> autoCompactCandidate(long[] sizes) {
if (sizes.length == 0) {
return Optional.empty();
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/FileRepository.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/FileRepository.java
index fb84a090d3..fd052cec28 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/FileRepository.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/FileRepository.java
@@ -18,10 +18,13 @@ import static java.util.stream.Collectors.toList;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
import java.io.IOException;
+import java.io.OutputStream;
import java.text.MessageFormat;
import java.text.ParseException;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Locale;
@@ -50,6 +53,7 @@ import org.eclipse.jgit.lib.ProgressMonitor;
import org.eclipse.jgit.lib.Ref;
import org.eclipse.jgit.lib.RefDatabase;
import org.eclipse.jgit.lib.RefUpdate;
+import org.eclipse.jgit.lib.ReflogEntry;
import org.eclipse.jgit.lib.ReflogReader;
import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.lib.StoredConfig;
@@ -173,20 +177,17 @@ public class FileRepository extends Repository {
String reftype = repoConfig.getString(
ConfigConstants.CONFIG_EXTENSIONS_SECTION, null,
- ConfigConstants.CONFIG_KEY_REFSTORAGE);
+ ConfigConstants.CONFIG_KEY_REF_STORAGE);
if (repositoryFormatVersion >= 1 && reftype != null) {
if (StringUtils.equalsIgnoreCase(reftype,
- ConfigConstants.CONFIG_REFSTORAGE_REFTABLE)) {
- refs = new FileReftableDatabase(this,
- new File(getDirectory(), "refs")); //$NON-NLS-1$
+ ConfigConstants.CONFIG_REF_STORAGE_REFTABLE)) {
+ refs = new FileReftableDatabase(this);
} else if (StringUtils.equalsIgnoreCase(reftype,
ConfigConstants.CONFIG_REFSTORAGE_REFTREE)) {
refs = new RefTreeDatabase(this, new RefDirectory(this));
} else {
throw new IOException(JGitText.get().unknownRepositoryFormat);
}
- } else if (FileReftableDatabase.isReftable(getDirectory())) {
- refs = new FileReftableDatabase(this, new File(getDirectory(), "refs")); //$NON-NLS-1$
} else {
refs = new RefDirectory(this);
}
@@ -610,15 +611,18 @@ public class FileRepository extends Repository {
* Converts the RefDatabase from reftable to RefDirectory. This operation is
* not atomic.
*
+ * @param writeLogs
+ * whether to write reflogs
* @param backup
* whether to rename or delete the old storage files. If set to
- * true, the reftable list is left in "refs.old", and the
- * reftable/ dir is left alone. If set to false, the reftable/
- * dir is removed, and "refs" file is removed.
+ * {@code true}, the reftable list is left in {@code refs.old},
+ * and the {@code reftable/} dir is left alone. If set to
+ * {@code false}, the {@code reftable/} dir is removed, and
+ * {@code refs} file is removed.
* @throws IOException
* on IO problem
*/
- void convertToPackedRefs(boolean backup) throws IOException {
+ void convertToPackedRefs(boolean writeLogs, boolean backup) throws IOException {
List<Ref> all = refs.getRefs();
File packedRefs = new File(getDirectory(), Constants.PACKED_REFS);
if (packedRefs.exists()) {
@@ -627,26 +631,26 @@ public class FileRepository extends Repository {
}
File refsFile = new File(getDirectory(), "refs"); //$NON-NLS-1$
-
- refs.close();
-
- if (backup) {
- File refsOld = new File(getDirectory(), "refs.old"); //$NON-NLS-1$
- if (refsOld.exists()) {
- throw new IOException(MessageFormat.format(
- JGitText.get().fileAlreadyExists,
- "refs.old")); //$NON-NLS-1$
- }
- FileUtils.rename(refsFile, refsOld);
- } else {
- refsFile.delete();
- }
+ File refsHeadsFile = new File(refsFile, "heads");//$NON-NLS-1$
+ File headFile = new File(getDirectory(), Constants.HEAD);
+ FileReftableDatabase oldDb = (FileReftableDatabase) refs;
+
+ // Remove the dummy files that ensure compatibility with older git
+ // versions (see convertToReftable). First make room for refs/heads/
+ refsHeadsFile.delete();
+ // RefDirectory wants to create the refs/ directory from scratch, so
+ // remove that too.
+ refsFile.delete();
+ // remove HEAD so its previous invalid value doesn't cause issues.
+ headFile.delete();
// This is not atomic, but there is no way to instantiate a RefDirectory
// that is disconnected from the current repo.
- refs = new RefDirectory(this);
+ RefDirectory refDir = new RefDirectory(this);
+ refs = refDir;
refs.create();
+ ReflogWriter logWriter = refDir.newLogWriter(true);
List<Ref> symrefs = new ArrayList<>();
BatchRefUpdate bru = refs.newBatchUpdate();
for (Ref r : all) {
@@ -656,6 +660,15 @@ public class FileRepository extends Repository {
bru.addCommand(new ReceiveCommand(ObjectId.zeroId(),
r.getObjectId(), r.getName()));
}
+
+ if (writeLogs) {
+ List<ReflogEntry> logs = oldDb.getReflogReader(r.getName())
+ .getReverseEntries();
+ Collections.reverse(logs);
+ for (ReflogEntry e : logs) {
+ logWriter.log(r.getName(), e);
+ }
+ }
}
try (RevWalk rw = new RevWalk(this)) {
@@ -691,24 +704,39 @@ public class FileRepository extends Repository {
FileUtils.delete(reftableDir,
FileUtils.RECURSIVE | FileUtils.IGNORE_ERRORS);
}
-
repoConfig.unset(ConfigConstants.CONFIG_EXTENSIONS_SECTION, null,
- ConfigConstants.CONFIG_KEY_REFSTORAGE);
+ ConfigConstants.CONFIG_KEY_REF_STORAGE);
repoConfig.save();
}
+ /**
+ * Converts the RefDatabase from RefDirectory to reftable. This operation is
+ * not atomic.
+ *
+ * @param writeLogs
+ * whether to write reflogs
+ * @param backup
+ * whether to rename or delete the old storage files. If set to
+ * {@code true}, the loose refs are left in {@code refs.old}, the
+ * packed-refs in {@code packed-refs.old} and reflogs in
+ * {@code refs.old/}. HEAD is left in {@code HEAD.old} and also
+ * {@code .log} is appended to additional refs. If set to
+ * {@code false}, the {@code refs/} and {@code logs/} directories
+ * and {@code HEAD} and additional symbolic refs are removed.
+ * @throws IOException
+ * on IO problem
+ */
@SuppressWarnings("nls")
void convertToReftable(boolean writeLogs, boolean backup)
throws IOException {
- File newRefs = new File(getDirectory(), "refs.new");
File reftableDir = new File(getDirectory(), Constants.REFTABLE);
-
+ File headFile = new File(getDirectory(), Constants.HEAD);
if (reftableDir.exists() && reftableDir.listFiles().length > 0) {
throw new IOException(JGitText.get().reftableDirExists);
}
// Ignore return value, as it is tied to temporary newRefs file.
- FileReftableDatabase.convertFrom(this, newRefs, writeLogs);
+ FileReftableDatabase.convertFrom(this, writeLogs);
File refsFile = new File(getDirectory(), "refs");
@@ -716,7 +744,6 @@ public class FileRepository extends Repository {
File packedRefs = new File(getDirectory(), Constants.PACKED_REFS);
File logsDir = new File(getDirectory(), Constants.LOGS);
-
List<String> additional = getRefDatabase().getAdditionalRefs().stream()
.map(Ref::getName).collect(toList());
additional.add(Constants.HEAD);
@@ -735,7 +762,8 @@ public class FileRepository extends Repository {
new File(getDirectory(), r + ".old"));
}
} else {
- packedRefs.delete(); // ignore return value.
+ FileUtils.delete(packedRefs, FileUtils.SKIP_MISSING);
+ FileUtils.delete(headFile);
FileUtils.delete(logsDir, FileUtils.RECURSIVE);
FileUtils.delete(refsFile, FileUtils.RECURSIVE);
for (String r : additional) {
@@ -743,16 +771,26 @@ public class FileRepository extends Repository {
}
}
- // Put new data.
- FileUtils.rename(newRefs, refsFile);
+ FileUtils.mkdir(refsFile, true);
- refs.close();
- refs = new FileReftableDatabase(this, refsFile);
+ // By putting in a dummy HEAD, old versions of Git still detect a repo
+ // (that they can't read)
+ try (OutputStream os = new FileOutputStream(headFile)) {
+ os.write(Constants.encodeASCII("ref: refs/heads/.invalid"));
+ }
+
+ // Some tools might write directly into .git/refs/heads/BRANCH. By
+ // putting a file here, this fails spectacularly.
+ FileUtils.createNewFile(new File(refsFile, "heads"));
repoConfig.setString(ConfigConstants.CONFIG_EXTENSIONS_SECTION, null,
- ConfigConstants.CONFIG_KEY_REFSTORAGE,
- ConfigConstants.CONFIG_REFSTORAGE_REFTABLE);
+ ConfigConstants.CONFIG_KEY_REF_STORAGE,
+ ConfigConstants.CONFIG_REF_STORAGE_REFTABLE);
+ repoConfig.setLong(ConfigConstants.CONFIG_CORE_SECTION, null,
+ ConfigConstants.CONFIG_KEY_REPO_FORMAT_VERSION, 1);
repoConfig.save();
+ refs.close();
+ refs = new FileReftableDatabase(this);
}
/**
@@ -775,7 +813,7 @@ public class FileRepository extends Repository {
}
} else if (format.equals("refdir")) {//$NON-NLS-1$
if (refs instanceof FileReftableDatabase) {
- convertToPackedRefs(backup);
+ convertToPackedRefs(writeLogs, backup);
}
} else {
throw new IOException(MessageFormat
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/DeltaIndex.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/DeltaIndex.java
index 79eaea093a..7ed5defbe4 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/DeltaIndex.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/DeltaIndex.java
@@ -122,8 +122,8 @@ public class DeltaIndex {
// logic linear in the size of the input rather than quadratic.
//
int cnt = 0;
- for (int i = 0; i < table.length; i++) {
- int h = table[i];
+ for (int element : table) {
+ int h = element;
if (h == 0)
continue;
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 057970ecac..75dd345f46 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
@@ -191,7 +191,7 @@ public class PackWriter implements AutoCloseable {
}
@SuppressWarnings("unchecked")
- BlockList<ObjectToPack> objectsLists[] = new BlockList[OBJ_TAG + 1];
+ BlockList<ObjectToPack>[] objectsLists = new BlockList[OBJ_TAG + 1];
{
objectsLists[OBJ_COMMIT] = new BlockList<>();
objectsLists[OBJ_TREE] = new BlockList<>();
@@ -236,7 +236,7 @@ public class PackWriter implements AutoCloseable {
private List<ObjectToPack> sortedByName;
- private byte packcsum[];
+ private byte[] packcsum;
private boolean deltaBaseAsOffset;
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/ConfigConstants.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/ConfigConstants.java
index 5b7afe3b37..e607edc2ea 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/ConfigConstants.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/ConfigConstants.java
@@ -504,9 +504,18 @@ public final class ConfigConstants {
*/
public static final String CONFIG_KEY_MIN_RACY_THRESHOLD = "minRacyThreshold";
+
+ /**
+ * The "refStorage" key
+ *
+ * @since 5.6.2
+ */
+ public static final String CONFIG_KEY_REF_STORAGE = "refStorage";
+
/**
* The "extensions" section
- * @since 5.7
+ *
+ * @since 5.6.2
*/
public static final String CONFIG_EXTENSIONS_SECTION = "extensions";
@@ -520,7 +529,7 @@ public final class ConfigConstants {
* The "reftable" refStorage format
* @since 5.7
*/
- public static final String CONFIG_REFSTORAGE_REFTABLE = "reftable";
+ public static final String CONFIG_REF_STORAGE_REFTABLE = "reftable";
/**
* The "reftree" refStorage format
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/Constants.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/Constants.java
index ffc742d473..459ca2f7ff 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/Constants.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/Constants.java
@@ -254,6 +254,12 @@ public final class Constants {
*/
public static final String REFTABLE = "reftable";
+ /**
+ * Reftable table list name.
+ * @since 5.6.2
+ */
+ public static final String TABLES_LIST = "tables.list";
+
/** Info refs folder */
public static final String INFO_REFS = "info/refs";
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/merge/ResolveMerger.java b/org.eclipse.jgit/src/org/eclipse/jgit/merge/ResolveMerger.java
index 4b301c41f4..575e7bd285 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/merge/ResolveMerger.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/merge/ResolveMerger.java
@@ -110,7 +110,7 @@ public class ResolveMerger extends ThreeWayMerger {
*
* @since 3.0
*/
- protected String commitNames[];
+ protected String[] commitNames;
/**
* Index of the base tree within the {@link #tw tree walk}.
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/ObjectWalk.java b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/ObjectWalk.java
index 21ce78e7e9..04a4b4c631 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/ObjectWalk.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/ObjectWalk.java
@@ -364,7 +364,9 @@ public class ObjectWalk extends RevWalk {
* @since 5.4
*/
public void skipTree() {
- currVisit.ptr = currVisit.buf.length;
+ if (currVisit != null) {
+ currVisit.ptr = currVisit.buf.length;
+ }
}
/**
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevObject.java b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevObject.java
index 1abcf6962f..5ce4bc33b5 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevObject.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevObject.java
@@ -151,7 +151,7 @@ public abstract class RevObject extends ObjectIdOwnerMap.Entry {
* buffer to append a debug description of core RevFlags onto.
*/
protected void appendCoreFlags(StringBuilder s) {
- s.append((flags & RevWalk.TOPO_QUEUED) != 0 ? 'o' : '-');
+ s.append((flags & RevWalk.TOPO_DELAY) != 0 ? 'o' : '-');
s.append((flags & RevWalk.TEMP_MARK) != 0 ? 't' : '-');
s.append((flags & RevWalk.REWRITE) != 0 ? 'r' : '-');
s.append((flags & RevWalk.UNINTERESTING) != 0 ? 'u' : '-');
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevWalk.java b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevWalk.java
index 383428c858..f425e87618 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevWalk.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevWalk.java
@@ -125,11 +125,11 @@ public class RevWalk implements Iterable<RevCommit>, AutoCloseable {
/**
* Temporary mark for use within {@link TopoSortGenerator}.
* <p>
- * This mark indicates the commit has been queued for emission in
- * {@link TopoSortGenerator} and can be produced. This mark is removed when
- * the commit has been produced.
+ * This mark indicates the commit could not produce when it wanted to, as at
+ * least one child was behind it. Commits with this flag are delayed until
+ * all children have been output first.
*/
- static final int TOPO_QUEUED = 1 << 5;
+ static final int TOPO_DELAY = 1 << 5;
/** Number of flag bits we keep internal for our own use. See above flags. */
static final int RESERVED_FLAGS = 6;
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/TopoSortGenerator.java b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/TopoSortGenerator.java
index 3c553b06cf..7a5db43a7a 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/TopoSortGenerator.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/TopoSortGenerator.java
@@ -17,7 +17,7 @@ import org.eclipse.jgit.errors.MissingObjectException;
/** Sorts commits in topological order. */
class TopoSortGenerator extends Generator {
- private static final int TOPO_QUEUED = RevWalk.TOPO_QUEUED;
+ private static final int TOPO_DELAY = RevWalk.TOPO_DELAY;
private final FIFORevQueue pending;
@@ -47,16 +47,12 @@ class TopoSortGenerator extends Generator {
if (c == null) {
break;
}
- if ((c.flags & TOPO_QUEUED) == 0) {
- for (RevCommit p : c.parents) {
- p.inDegree++;
-
- if (firstParent) {
- break;
- }
+ for (RevCommit p : c.parents) {
+ p.inDegree++;
+ if (firstParent) {
+ break;
}
}
- c.flags |= TOPO_QUEUED;
pending.add(c);
}
}
@@ -75,42 +71,34 @@ class TopoSortGenerator extends Generator {
RevCommit next() throws MissingObjectException,
IncorrectObjectTypeException, IOException {
for (;;) {
- RevCommit c = pending.next();
- if (c == null) {
+ final RevCommit c = pending.next();
+ if (c == null)
return null;
- }
if (c.inDegree > 0) {
// At least one of our children is missing. We delay
// production until all of our children are output.
//
+ c.flags |= TOPO_DELAY;
continue;
}
- if ((c.flags & TOPO_QUEUED) == 0) {
- // c is a parent that already produced or a parent that
- // was never in the priority queue and should never produce.
- //
- continue;
- }
-
+ // All of our children have already produced,
+ // so it is OK for us to produce now as well.
+ //
for (RevCommit p : c.parents) {
- if (--p.inDegree == 0 && (p.flags & TOPO_QUEUED) != 0) {
- // The parent has no unproduced interesting children. unpop
- // the parent so it goes right behind this child. This means
- // that this parent commit may appear in "pending" more than
- // once, but this is safe since upon the second and
- // subsequent iterations with this commit, it will no longer
- // have TOPO_QUEUED set, and thus will be skipped.
+ if (--p.inDegree == 0 && (p.flags & TOPO_DELAY) != 0) {
+ // This parent tried to come before us, but we are
+ // his last child. unpop the parent so it goes right
+ // behind this child.
//
+ p.flags &= ~TOPO_DELAY;
pending.unpop(p);
}
if (firstParent) {
break;
}
}
-
- c.flags &= ~TOPO_QUEUED;
return c;
}
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/filter/PatternMatchRevFilter.java b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/filter/PatternMatchRevFilter.java
index 0d782e0a37..efb5ee5e4d 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/filter/PatternMatchRevFilter.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/filter/PatternMatchRevFilter.java
@@ -42,8 +42,8 @@ public abstract class PatternMatchRevFilter extends RevFilter {
protected static final String forceToRaw(String patternText) {
final byte[] b = Constants.encode(patternText);
final StringBuilder needle = new StringBuilder(b.length);
- for (int i = 0; i < b.length; i++)
- needle.append((char) (b[i] & 0xff));
+ for (byte element : b)
+ needle.append((char) (element & 0xff));
return needle.toString();
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/HttpAuthMethod.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/HttpAuthMethod.java
index adc85a18e0..aec5b89c7e 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/HttpAuthMethod.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/HttpAuthMethod.java
@@ -423,8 +423,7 @@ abstract class HttpAuthMethod {
private static String LHEX(byte[] bin) {
StringBuilder r = new StringBuilder(bin.length * 2);
- for (int i = 0; i < bin.length; i++) {
- byte b = bin[i];
+ for (byte b : bin) {
r.append(LHEX[(b >>> 4) & 0x0f]);
r.append(LHEX[b & 0x0f]);
}
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 faa917a50e..718c8f6115 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 @@ public abstract class JschConfigSessionFactory extends SshSessionFactory {
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/URIish.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/URIish.java
index 858d1f7b6a..06520ec4ca 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/URIish.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/URIish.java
@@ -303,8 +303,8 @@ public class URIish implements Serializable {
return null;
ByteArrayOutputStream os = new ByteArrayOutputStream(s.length());
byte[] bytes = s.getBytes(UTF_8);
- for (int i = 0; i < bytes.length; ++i) {
- int b = bytes[i] & 0xFF;
+ for (byte c : bytes) {
+ int b = c & 0xFF;
if (b <= 32 || (encodeNonAscii && b > 127) || b == '%'
|| (escapeReservedChars && reservedChars.get(b))) {
os.write('%');
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 09ca7ca60f..35196c6e34 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java
@@ -2378,12 +2378,12 @@ public class UploadPack {
}
@Override
- public void write(byte b[]) throws IOException {
+ public void write(byte[] b) throws IOException {
out.write(b);
}
@Override
- public void write(byte b[], int off, int len) throws IOException {
+ public void write(byte[] b, int off, int len) throws IOException {
out.write(b, off, len);
}
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 f747d1a157..216bf2c336 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/util/FS.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/FS.java
@@ -245,7 +245,16 @@ public abstract class FS {
return t;
});
- private static void setBackground(boolean async) {
+ /**
+ * Whether FileStore attributes should be determined asynchronously
+ *
+ * @param async
+ * whether FileStore attributes should be determined
+ * asynchronously. If false access to cached attributes may block
+ * for some seconds for the first call per FileStore
+ * @since 5.6.2
+ */
+ public static void setBackground(boolean async) {
background.set(async);
}
@@ -709,7 +718,9 @@ public abstract class FS {
* asynchronously. If false access to cached attributes may block
* for some seconds for the first call per FileStore
* @since 5.1.9
+ * @deprecated Use {@link FileStoreAttributes#setBackground} instead
*/
+ @Deprecated
public static void setAsyncFileStoreAttributes(boolean asynch) {
FileStoreAttributes.setBackground(asynch);
}
@@ -2270,7 +2281,7 @@ public abstract class FS {
void copy() throws IOException {
boolean writeFailure = false;
- byte buffer[] = new byte[4096];
+ byte[] buffer = new byte[4096];
int readBytes;
while ((readBytes = in.read(buffer)) != -1) {
// Do not try to write again after a failure, but keep
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 dd39416bb0..82b2818a40 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
@@ -117,7 +117,7 @@ public class FS_Win32_Cygwin extends FS_Win32 {
argv.add("sh.exe"); //$NON-NLS-1$
argv.add("-c"); //$NON-NLS-1$
argv.add("$0 \"$@\""); //$NON-NLS-1$
- argv.add(cmd);
+ argv.add(cmd.replace(File.separatorChar, '/'));
argv.addAll(Arrays.asList(args));
ProcessBuilder proc = new ProcessBuilder();
proc.command(argv);
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/Hex.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/Hex.java
index 9359036524..925159830e 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/util/Hex.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/Hex.java
@@ -10,6 +10,10 @@
package org.eclipse.jgit.util;
+import java.text.MessageFormat;
+
+import org.eclipse.jgit.internal.JGitText;
+
/**
* Encodes and decodes to and from hexadecimal notation.
*
@@ -27,9 +31,11 @@ public final class Hex {
/**
* Decode a hexadecimal string to a byte array.
*
- * Note this method performs no validation on input content.
+ * Note this method validates that characters in the given string are valid
+ * as digits in a hex string.
*
- * @param s hexadecimal string
+ * @param s
+ * hexadecimal string
* @return decoded array
*/
public static byte[] decode(String s) {
@@ -37,7 +43,16 @@ public final class Hex {
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));
+ int left = Character.digit(s.charAt(i), 16);
+ int right = Character.digit(s.charAt(i + 1), 16);
+
+ if (left == -1 || right == -1) {
+ throw new IllegalArgumentException(MessageFormat.format(
+ JGitText.get().invalidHexString,
+ s));
+ }
+
+ b[i / 2] = (byte) (left << 4 | right);
}
return b;
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/LfsFactory.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/LfsFactory.java
index 230d89008a..7456c71f5f 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/util/LfsFactory.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/LfsFactory.java
@@ -280,7 +280,7 @@ public class LfsFactory {
}
@Override
- public int read(byte b[], int off, int len) throws IOException {
+ public int read(byte[] b, int off, int len) throws IOException {
return stream.read(b, off, len);
}
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 cd2a8e672d..500c236730 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/util/Monitoring.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/Monitoring.java
@@ -49,7 +49,7 @@ public class Monitoring {
String metricName) {
boolean register = false;
try {
- Class<?> interfaces[] = mbean.getClass().getInterfaces();
+ Class<?>[] interfaces = mbean.getClass().getInterfaces();
for (Class<?> i : interfaces) {
register = SystemReader.getInstance().getUserConfig()
.getBoolean(
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/QuotedString.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/QuotedString.java
index c45f0095d9..493ca312d1 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/util/QuotedString.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/QuotedString.java
@@ -243,8 +243,8 @@ public abstract class QuotedString {
final byte[] out = new byte[4 * in.length + 2];
int o = 0;
out[o++] = '"';
- for (int i = 0; i < in.length; i++) {
- final int c = in[i] & 0xff;
+ for (byte element : in) {
+ final int c = element & 0xff;
if (c < quote.length) {
final byte style = quote[c];
if (style == 0) {
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/RawParseUtils.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/RawParseUtils.java
index 669f738427..df9c6c78fe 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/util/RawParseUtils.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/RawParseUtils.java
@@ -559,8 +559,8 @@ public final class RawParseUtils {
}
while (ptr < b.length - (headerName.length + 1)) {
boolean found = true;
- for (int i = 0; i < headerName.length; i++) {
- if (headerName[i] != b[ptr++]) {
+ for (byte element : headerName) {
+ if (element != b[ptr++]) {
found = false;
break;
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/sha1/SHA1.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/sha1/SHA1.java
index c896daf7e3..1420add662 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/util/sha1/SHA1.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/sha1/SHA1.java
@@ -45,7 +45,7 @@ import org.slf4j.LoggerFactory;
* @since 4.7
*/
public class SHA1 {
- private static Logger LOG = LoggerFactory.getLogger(SHA1.class);
+ private static final Logger LOG = LoggerFactory.getLogger(SHA1.class);
private static final boolean DETECT_COLLISIONS;
static {