summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Sohn <matthias.sohn@sap.com>2021-12-04 21:21:52 +0100
committerMatthias Sohn <matthias.sohn@sap.com>2021-12-04 21:21:52 +0100
commitcaea5a26f08c6cf969607a178bc54896120d0940 (patch)
treea817f6d30f098bad297c24862031e47ad1a01fad
parent256442943d02bcda567a364d067e789ab9eefb40 (diff)
parent284d2b5b9c909199956440d144db591ac89c8a7b (diff)
downloadjgit-caea5a26f08c6cf969607a178bc54896120d0940.tar.gz
jgit-caea5a26f08c6cf969607a178bc54896120d0940.zip
Merge branch 'stable-6.0'
* stable-6.0: Add missing @since tags Add missing @since tag Add missing @since tags Remove unused import in ApacheSshTest Update maven plugins Ignore missing javadoc in test bundles storage: file: De-duplicate File.exists()+File.isFile() RefDirectory.scanRef: Re-use file existence check done in snapshot creation FileSnapshot: Lazy load file store attributes cache Update eclipse-jarsigner-plugin to 1.3.2 Fix p2 repository URLs Change-Id: I694c011f322f9a19479ef67b9fc725371da7418f
-rw-r--r--org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/GitFilter.java2
-rw-r--r--org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/ReceivePackErrorHandler.java2
-rw-r--r--org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/MockSystemReader.java3
-rw-r--r--org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/RepeatRule.java1
-rw-r--r--org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/RepositoryTestCase.java1
-rw-r--r--org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/SeparateClassloaderTestRunner.java2
-rw-r--r--org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/TestRepository.java2
-rw-r--r--org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/time/TimeUtil.java2
-rw-r--r--org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.17.target2
-rw-r--r--org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.18.target2
-rw-r--r--org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.19.target2
-rw-r--r--org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.20.target2
-rw-r--r--org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.21.target2
-rw-r--r--org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.22.target2
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/FileSnapshot.java36
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/ObjectDirectoryPackParser.java2
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/RefDirectory.java6
17 files changed, 55 insertions, 16 deletions
diff --git a/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/GitFilter.java b/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/GitFilter.java
index 1769832fba..0957cc80fa 100644
--- a/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/GitFilter.java
+++ b/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/GitFilter.java
@@ -125,6 +125,7 @@ public class GitFilter extends MetaFilter {
*
* @param h
* A custom error handler for git-upload-pack.
+ * @since 5.6
*/
public void setUploadPackErrorHandler(UploadPackErrorHandler h) {
assertNotInitialized();
@@ -163,6 +164,7 @@ public class GitFilter extends MetaFilter {
*
* @param h
* A custom error handler for git-receive-pack.
+ * @since 5.7
*/
public void setReceivePackErrorHandler(ReceivePackErrorHandler h) {
assertNotInitialized();
diff --git a/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/ReceivePackErrorHandler.java b/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/ReceivePackErrorHandler.java
index ee66cb102f..a7ca4d0931 100644
--- a/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/ReceivePackErrorHandler.java
+++ b/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/ReceivePackErrorHandler.java
@@ -31,7 +31,7 @@ import org.eclipse.jgit.transport.ServiceMayNotContinueException;
* If a custom handler is not specified, JGit will use the default error
* handler.
*
- * @since 5.6
+ * @since 5.7
*/
public interface ReceivePackErrorHandler {
/**
diff --git a/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/MockSystemReader.java b/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/MockSystemReader.java
index 664615e456..6bfe70659b 100644
--- a/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/MockSystemReader.java
+++ b/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/MockSystemReader.java
@@ -80,6 +80,7 @@ public class MockSystemReader extends SystemReader {
* @param userGitConfig
* set another user-level git config
* @return the old user-level git config
+ * @since 5.1.9
*/
public FileBasedConfig setUserGitConfig(FileBasedConfig userGitConfig) {
FileBasedConfig old = this.userGitConfig;
@@ -92,6 +93,7 @@ public class MockSystemReader extends SystemReader {
*
* @param jgitConfig
* set the jgit configuration
+ * @since 5.5
*/
public void setJGitConfig(FileBasedConfig jgitConfig) {
this.jgitConfig = jgitConfig;
@@ -103,6 +105,7 @@ public class MockSystemReader extends SystemReader {
* @param systemGitConfig
* the new system-level git config
* @return the old system-level config
+ * @since 5.1.9
*/
public FileBasedConfig setSystemGitConfig(FileBasedConfig systemGitConfig) {
FileBasedConfig old = this.systemGitConfig;
diff --git a/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/RepeatRule.java b/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/RepeatRule.java
index 3db3ba90c2..adcc10cad8 100644
--- a/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/RepeatRule.java
+++ b/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/RepeatRule.java
@@ -60,6 +60,7 @@ public class RepeatRule implements TestRule {
*
* @param message
* the error message
+ * @since 5.1.9
*/
public RepeatedTestException(String message) {
super(message);
diff --git a/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/RepositoryTestCase.java b/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/RepositoryTestCase.java
index 5622108dcd..04988f6289 100644
--- a/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/RepositoryTestCase.java
+++ b/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/RepositoryTestCase.java
@@ -340,6 +340,7 @@ public abstract class RepositoryTestCase extends LocalDiskRepositoryTestCase {
* greater than then the lastmodification time of lastfile.
* @throws InterruptedException
* @throws IOException
+ * @since 5.1.9
*/
public static Instant fsTick(File lastFile)
throws InterruptedException,
diff --git a/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/SeparateClassloaderTestRunner.java b/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/SeparateClassloaderTestRunner.java
index 4a4dc92c43..c8c56b21b8 100644
--- a/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/SeparateClassloaderTestRunner.java
+++ b/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/SeparateClassloaderTestRunner.java
@@ -21,6 +21,8 @@ import org.junit.runners.model.InitializationError;
* This class is used when it's required to load jgit classes in separate
* classloader for each test class. It can be needed to isolate static field
* initialization between separate tests.
+ *
+ * @since 5.5
*/
public class SeparateClassloaderTestRunner extends BlockJUnit4ClassRunner {
diff --git a/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/TestRepository.java b/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/TestRepository.java
index 0232156a49..54e4a09ee5 100644
--- a/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/TestRepository.java
+++ b/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/TestRepository.java
@@ -339,6 +339,7 @@ public class TestRepository<R extends Repository> implements AutoCloseable {
* zero or more IDs of the commit's parents.
* @return the ID of the new commit.
* @throws Exception
+ * @since 5.5
*/
public ObjectId unparsedCommit(ObjectId... parents) throws Exception {
return unparsedCommit(1, tree(), parents);
@@ -431,6 +432,7 @@ public class TestRepository<R extends Repository> implements AutoCloseable {
* zero or more IDs of the commit's parents.
* @return the ID of the new commit.
* @throws Exception
+ * @since 5.5
*/
public ObjectId unparsedCommit(final int secDelta, final RevTree tree,
final ObjectId... parents) throws Exception {
diff --git a/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/time/TimeUtil.java b/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/time/TimeUtil.java
index 2ebb8e27db..f93ac57f13 100644
--- a/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/time/TimeUtil.java
+++ b/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/time/TimeUtil.java
@@ -20,6 +20,8 @@ import org.eclipse.jgit.util.FS;
/**
* Utility methods for handling timestamps
+ *
+ * @since 5.1.9
*/
public class TimeUtil {
/**
diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.17.target b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.17.target
index 737cadaf90..6d960335dc 100644
--- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.17.target
+++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.17.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.17" sequenceNumber="1637746569">
+<target name="jgit-4.17" sequenceNumber="1638648728">
<locations>
<location includeMode="slicer" includeAllPlatforms="false" includeSource="true" includeConfigurePhase="true" type="InstallableUnit">
<unit id="jakarta.servlet-api" version="4.0.0"/>
diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.18.target b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.18.target
index 55cadffa88..cbe26bbf16 100644
--- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.18.target
+++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.18.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.18" sequenceNumber="1637746569">
+<target name="jgit-4.18" sequenceNumber="1638648728">
<locations>
<location includeMode="slicer" includeAllPlatforms="false" includeSource="true" includeConfigurePhase="true" type="InstallableUnit">
<unit id="jakarta.servlet-api" version="4.0.0"/>
diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.19.target b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.19.target
index 43fe4c8417..ceff3052c3 100644
--- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.19.target
+++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.19.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.19-staging" sequenceNumber="1637746569">
+<target name="jgit-4.19-staging" sequenceNumber="1638648728">
<locations>
<location includeMode="slicer" includeAllPlatforms="false" includeSource="true" includeConfigurePhase="true" type="InstallableUnit">
<unit id="jakarta.servlet-api" version="4.0.0"/>
diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.20.target b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.20.target
index aefa34122b..e2fed0675a 100644
--- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.20.target
+++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.20.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.20" sequenceNumber="1637746569">
+<target name="jgit-4.20" sequenceNumber="1638648728">
<locations>
<location includeMode="slicer" includeAllPlatforms="false" includeSource="true" includeConfigurePhase="true" type="InstallableUnit">
<unit id="jakarta.servlet-api" version="4.0.0"/>
diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.21.target b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.21.target
index 1b6cf26a5e..4bd55466ec 100644
--- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.21.target
+++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.21.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.21" sequenceNumber="1637746569">
+<target name="jgit-4.21" sequenceNumber="1638648728">
<locations>
<location includeMode="slicer" includeAllPlatforms="false" includeSource="true" includeConfigurePhase="true" type="InstallableUnit">
<unit id="jakarta.servlet-api" version="4.0.0"/>
diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.22.target b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.22.target
index 7fd003277a..98f44a8dc2 100644
--- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.22.target
+++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.22.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.22" sequenceNumber="1637746993">
+<target name="jgit-4.22" sequenceNumber="1638648736">
<locations>
<location includeMode="slicer" includeAllPlatforms="false" includeSource="true" includeConfigurePhase="true" type="InstallableUnit">
<unit id="jakarta.servlet-api" version="4.0.0"/>
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/FileSnapshot.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/FileSnapshot.java
index 8c48cd94b0..5ab973f533 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/FileSnapshot.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/FileSnapshot.java
@@ -187,6 +187,12 @@ public class FileSnapshot {
private FileStoreAttributes fileStoreAttributeCache;
/**
+ * if {@code true} read filesystem time resolution from configuration file
+ * otherwise use fallback resolution
+ */
+ private boolean useConfig;
+
+ /**
* Object that uniquely identifies the given file, or {@code
* null} if a file key is not available
*/
@@ -222,9 +228,7 @@ public class FileSnapshot {
protected FileSnapshot(File file, boolean useConfig) {
this.file = file;
this.lastRead = Instant.now();
- this.fileStoreAttributeCache = useConfig
- ? FS.getFileStoreAttributes(file.toPath())
- : FALLBACK_FILESTORE_ATTRIBUTES;
+ this.useConfig = useConfig;
BasicFileAttributes fileAttributes = null;
try {
fileAttributes = FS.DETECTED.fileAttributes(file);
@@ -379,7 +383,7 @@ public class FileSnapshot {
* if sleep was interrupted
*/
public void waitUntilNotRacy() throws InterruptedException {
- long timestampResolution = fileStoreAttributeCache
+ long timestampResolution = fileStoreAttributeCache()
.getFsTimestampResolution().toNanos();
while (isRacyClean(Instant.now())) {
TimeUnit.NANOSECONDS.sleep(timestampResolution);
@@ -416,6 +420,15 @@ public class FileSnapshot {
return equals(other);
}
+ /**
+ * Check if the file exists
+ *
+ * @return true if the file exists
+ */
+ public boolean fileExists() {
+ return !MISSING_FILEKEY.equals(this.fileKey);
+ }
+
/** {@inheritDoc} */
@Override
public int hashCode() {
@@ -500,10 +513,10 @@ public class FileSnapshot {
}
private long getEffectiveRacyThreshold() {
- long timestampResolution = fileStoreAttributeCache
+ long timestampResolution = fileStoreAttributeCache()
.getFsTimestampResolution().toNanos();
- long minRacyInterval = fileStoreAttributeCache.getMinimalRacyInterval()
- .toNanos();
+ long minRacyInterval = fileStoreAttributeCache()
+ .getMinimalRacyInterval().toNanos();
long max = Math.max(timestampResolution, minRacyInterval);
// safety margin: factor 2.5 below 100ms otherwise 1.25
return max < 100_000_000L ? max * 5 / 2 : max * 5 / 4;
@@ -563,4 +576,13 @@ public class FileSnapshot {
}
return changed;
}
+
+ private FileStoreAttributes fileStoreAttributeCache() {
+ if (fileStoreAttributeCache == null) {
+ fileStoreAttributeCache = useConfig
+ ? FS.getFileStoreAttributes(file.toPath().getParent())
+ : FALLBACK_FILESTORE_ATTRIBUTES;
+ }
+ return fileStoreAttributeCache;
+ }
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/ObjectDirectoryPackParser.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/ObjectDirectoryPackParser.java
index 1c23ff20c7..55b2646c46 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/ObjectDirectoryPackParser.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/ObjectDirectoryPackParser.java
@@ -153,7 +153,7 @@ public class ObjectDirectoryPackParser extends PackParser {
String p = pack.getAbsolutePath();
String i = p.substring(0, p.length() - ".pack".length()) + ".idx"; //$NON-NLS-1$ //$NON-NLS-2$
File idx = new File(i);
- if (idx.exists() && idx.isFile())
+ if (idx.isFile())
size += idx.length();
return size;
}
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 17a910008c..2167262dd5 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
@@ -1092,10 +1092,14 @@ public class RefDirectory extends RefDatabase {
final int limit = 4096;
final byte[] buf;
FileSnapshot otherSnapshot = FileSnapshot.save(path);
+ if (!otherSnapshot.fileExists()) {
+ return null;
+ }
+
try {
buf = IO.readSome(path, limit);
} catch (FileNotFoundException noFile) {
- if (path.exists() && path.isFile()) {
+ if (path.isFile()) {
throw noFile;
}
return null; // doesn't exist or no file; not a reference.