Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Sohn2017-06-08 09:30:45 -0400
committerMatthias Sohn2017-06-08 16:16:44 -0400
commit3fff4b2f8ca7454e4da724a9f32ccc52396be4e8 (patch)
tree501386b2c5f2be30a5635ada61368097bb086557 /org.eclipse.egit.core.test/src
parent5e646d20c078cdc2988c0bf5956bb03ce773c71a (diff)
parentcce1221c60cb12fadeb045b544706fc1311d7a17 (diff)
downloadegit-3fff4b2f8ca7454e4da724a9f32ccc52396be4e8.tar.gz
egit-3fff4b2f8ca7454e4da724a9f32ccc52396be4e8.tar.xz
egit-3fff4b2f8ca7454e4da724a9f32ccc52396be4e8.zip
Merge branch 'stable-4.7' into stable-4.8
* stable-4.7: Prepare 4.7.2-SNAPSHOT builds EGit v4.7.1.201706071930-r Disable running autoGC in the background for EGit tests Change-Id: Ia2fea92792b262083a7bd4ff9e608f80ec310748 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Diffstat (limited to 'org.eclipse.egit.core.test/src')
-rw-r--r--org.eclipse.egit.core.test/src/org/eclipse/egit/core/test/GitTestCase.java22
1 files changed, 21 insertions, 1 deletions
diff --git a/org.eclipse.egit.core.test/src/org/eclipse/egit/core/test/GitTestCase.java b/org.eclipse.egit.core.test/src/org/eclipse/egit/core/test/GitTestCase.java
index a48bd2f55..b14ed3604 100644
--- a/org.eclipse.egit.core.test/src/org/eclipse/egit/core/test/GitTestCase.java
+++ b/org.eclipse.egit.core.test/src/org/eclipse/egit/core/test/GitTestCase.java
@@ -21,10 +21,14 @@ import org.eclipse.core.runtime.preferences.InstanceScope;
import org.eclipse.egit.core.Activator;
import org.eclipse.egit.core.GitCorePreferences;
import org.eclipse.jgit.junit.MockSystemReader;
+import org.eclipse.jgit.lib.Config;
+import org.eclipse.jgit.lib.ConfigConstants;
import org.eclipse.jgit.lib.Constants;
import org.eclipse.jgit.lib.ObjectId;
import org.eclipse.jgit.lib.ObjectInserter;
import org.eclipse.jgit.lib.Repository;
+import org.eclipse.jgit.storage.file.FileBasedConfig;
+import org.eclipse.jgit.util.FS;
import org.eclipse.jgit.util.FileUtils;
import org.eclipse.jgit.util.IO;
import org.eclipse.jgit.util.SystemReader;
@@ -54,11 +58,27 @@ public abstract class GitTestCase {
// ensure there are no shared Repository instances left
// when starting a new test
Activator.getDefault().getRepositoryCache().clear();
- MockSystemReader mockSystemReader = new MockSystemReader();
+ File configFile = File.createTempFile("gitconfigtest", "config");
+ MockSystemReader mockSystemReader = new MockSystemReader() {
+ @Override
+ public FileBasedConfig openUserConfig(Config parent, FS fs) {
+ return new FileBasedConfig(parent, configFile, fs);
+ }
+ };
+ configFile.deleteOnExit();
SystemReader.setInstance(mockSystemReader);
mockSystemReader.setProperty(Constants.GIT_CEILING_DIRECTORIES_KEY,
ResourcesPlugin.getWorkspace().getRoot().getLocation().toFile()
.getParentFile().getAbsoluteFile().toString());
+ FileBasedConfig userConfig = mockSystemReader.openUserConfig(null,
+ 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.
+ userConfig.setBoolean(ConfigConstants.CONFIG_GC_SECTION, null,
+ ConfigConstants.CONFIG_KEY_AUTODETACH, false);
+ userConfig.save();
project = new TestProject(true);
gitDir = new File(project.getProject().getWorkspace().getRoot()
.getRawLocation().toFile(), Constants.DOT_GIT);

Back to the top