aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/LocalDiskRepositoryTestCase.java
diff options
context:
space:
mode:
authorMatthias Sohn <matthias.sohn@sap.com>2019-08-20 00:10:01 +0200
committerMatthias Sohn <matthias.sohn@sap.com>2019-08-20 00:10:15 +0200
commit35d99477b81043f24314c4c84da8f29e601bec19 (patch)
treee8eaf8fe156e45459c769c4635dd8f041bbecf30 /org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/LocalDiskRepositoryTestCase.java
parent380d7446c9c7ff523f682974b45d83549b66fa9f (diff)
parent18fb58ae05aafb9d7c831e5c4c3c0d375e7492e8 (diff)
downloadjgit-35d99477b81043f24314c4c84da8f29e601bec19.tar.gz
jgit-35d99477b81043f24314c4c84da8f29e601bec19.zip
Merge branch 'stable-5.3' into stable-5.4
* stable-5.3: Fix NPE in RebaseTodoFile#parseComments Fix NPE in ObjectIdOwnerMap#get Fix NPE in CommitOnlyTest#getHead FileUtils#lastModifiedInstant should not log error if path doesn't exist Cache user global and system-wide git configurations Avoid setup and saving FileStoreAttributes compete for ~/.gitconfig lock Add missing dependencies for running FS_POSIXTest in Eclipse Fix javadoc for SystemReader#getInstance Improve retry handling when saving FileStoreAttributes fails Ensure FSTest uses MockSystemReader Make supportsAtomicCreateNewFile return true as default Update orbit to R20190602212107-2019-06 to enable backports from master Handle InvalidPathException in FS_POSIX#createNewFileAtomic Ensure root cause of lock creation failures is logged Implement toString in MockSystemReader and MockConfig LocalDiskRefTreeDatabaseTest shall use MockSystemReader Ensure LocalDiskRepositoryTestCase#setup fully uses MockSystemReader Ensure we use MockSystemReader in tests Override FileBasedConfig's save method in MockConfig Remove FileBasedConfig.load(boolean) introduced in d45219ba Disable debug log for FS in org.eclipse.jgit.test Bazel: enable logging for tests in org.eclipse.jgit.test LockFile: log exception if creation of lock file failed Stop using deprecated Constants.CHARACTER_ENCODING Change-Id: I43c2ab8b44c3e87d48e4072907ad169c81e3ffe0 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Diffstat (limited to 'org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/LocalDiskRepositoryTestCase.java')
-rw-r--r--org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/LocalDiskRepositoryTestCase.java20
1 files changed, 12 insertions, 8 deletions
diff --git a/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/LocalDiskRepositoryTestCase.java b/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/LocalDiskRepositoryTestCase.java
index 98e1f8240a..5c2cd6ac65 100644
--- a/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/LocalDiskRepositoryTestCase.java
+++ b/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/LocalDiskRepositoryTestCase.java
@@ -128,21 +128,25 @@ public abstract class LocalDiskRepositoryTestCase {
if (!tmp.delete() || !tmp.mkdir())
throw new IOException("Cannot create " + tmp);
- // measure timer resolution before the test to avoid time critical tests
- // are affected by time needed for measurement
+ mockSystemReader = new MockSystemReader();
+ SystemReader.setInstance(mockSystemReader);
+
+ // Measure timer resolution before the test to avoid time critical tests
+ // are affected by time needed for measurement.
+ // The MockSystemReader must be configured first since we need to use
+ // the same one here
FS.getFileStoreAttributes(tmp.toPath().getParent());
- mockSystemReader = new MockSystemReader();
- mockSystemReader.userGitConfig = new FileBasedConfig(new File(tmp,
- "usergitconfig"), FS.DETECTED);
+ FileBasedConfig userConfig = new FileBasedConfig(
+ new File(tmp, "usergitconfig"), FS.DETECTED);
// We have to set autoDetach to false for tests, because tests expect to be able
// to clean up by recursively removing the repository, and background GC might be
// in the middle of writing or deleting files, which would disrupt this.
- mockSystemReader.userGitConfig.setBoolean(ConfigConstants.CONFIG_GC_SECTION,
+ userConfig.setBoolean(ConfigConstants.CONFIG_GC_SECTION,
null, ConfigConstants.CONFIG_KEY_AUTODETACH, false);
- mockSystemReader.userGitConfig.save();
+ userConfig.save();
+ mockSystemReader.setUserGitConfig(userConfig);
ceilTestDirectories(getCeilings());
- SystemReader.setInstance(mockSystemReader);
author = new PersonIdent("J. Author", "jauthor@example.com");
committer = new PersonIdent("J. Committer", "jcommitter@example.com");