diff options
author | Matthias Sohn <matthias.sohn@sap.com> | 2019-11-11 11:07:01 -0800 |
---|---|---|
committer | Matthias Sohn <matthias.sohn@sap.com> | 2019-11-11 11:07:17 -0800 |
commit | 826317942f79f550bae811927106b658dce80472 (patch) | |
tree | bc40928caa4a1f43b9bf398e1d9fbd79a9454245 /org.eclipse.jgit.junit/src | |
parent | a7412b544bea81ea0bc53979e384e9ba1ed05d9e (diff) | |
parent | ca800b55c8ff1f97afd2f7fe707d54b84f6df9c3 (diff) | |
download | jgit-826317942f79f550bae811927106b658dce80472.tar.gz jgit-826317942f79f550bae811927106b658dce80472.zip |
Merge branch 'stable-5.5'
* stable-5.5:
BaseReceivePack: Fix the format
Prepend hostname to subsection used to store file timestamp resolution
Store filesystem timestamp resolution in extra jgit config
SystemReader: extract updating config and its parents if outdated
Change-Id: Iecfddce8081303af29badcdcd3d72a0da50c964f
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Diffstat (limited to 'org.eclipse.jgit.junit/src')
-rw-r--r-- | org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/LocalDiskRepositoryTestCase.java | 12 | ||||
-rw-r--r-- | org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/MockSystemReader.java | 23 |
2 files changed, 33 insertions, 2 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 5c2cd6ac65..eca8179ece 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 @@ -125,8 +125,9 @@ public abstract class LocalDiskRepositoryTestCase { public void setUp() throws Exception { tmp = File.createTempFile("jgit_test_", "_tmp"); CleanupThread.deleteOnShutdown(tmp); - if (!tmp.delete() || !tmp.mkdir()) + if (!tmp.delete() || !tmp.mkdir()) { throw new IOException("Cannot create " + tmp); + } mockSystemReader = new MockSystemReader(); SystemReader.setInstance(mockSystemReader); @@ -137,7 +138,11 @@ public abstract class LocalDiskRepositoryTestCase { // the same one here FS.getFileStoreAttributes(tmp.toPath().getParent()); - FileBasedConfig userConfig = new FileBasedConfig( + FileBasedConfig jgitConfig = new FileBasedConfig( + new File(tmp, "jgitconfig"), FS.DETECTED); + FileBasedConfig systemConfig = new FileBasedConfig(jgitConfig, + new File(tmp, "systemgitconfig"), FS.DETECTED); + FileBasedConfig userConfig = new FileBasedConfig(systemConfig, 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 @@ -145,7 +150,10 @@ public abstract class LocalDiskRepositoryTestCase { userConfig.setBoolean(ConfigConstants.CONFIG_GC_SECTION, null, ConfigConstants.CONFIG_KEY_AUTODETACH, false); userConfig.save(); + mockSystemReader.setJGitConfig(jgitConfig); + mockSystemReader.setSystemGitConfig(systemConfig); mockSystemReader.setUserGitConfig(userConfig); + ceilTestDirectories(getCeilings()); author = new PersonIdent("J. Author", "jauthor@example.com"); 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 13c2932282..630c8a4799 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 @@ -103,6 +103,8 @@ public class MockSystemReader extends SystemReader { private FileBasedConfig userGitConfig; + private FileBasedConfig jgitConfig; + FileBasedConfig systemGitConfig; /** @@ -119,6 +121,16 @@ public class MockSystemReader extends SystemReader { } /** + * Set the jgit config stored at $XDG_CONFIG_HOME/jgit/config + * + * @param jgitConfig + * set the jgit configuration + */ + public void setJGitConfig(FileBasedConfig jgitConfig) { + this.jgitConfig = jgitConfig; + } + + /** * Set the system-level git config * * @param systemGitConfig @@ -142,6 +154,7 @@ public class MockSystemReader extends SystemReader { init(Constants.GIT_COMMITTER_EMAIL_KEY); setProperty(Constants.OS_USER_DIR, "."); userGitConfig = new MockConfig(null, null); + jgitConfig = new MockConfig(null, null); systemGitConfig = new MockConfig(null, null); setCurrentPlatform(); } @@ -200,6 +213,11 @@ public class MockSystemReader extends SystemReader { } @Override + public FileBasedConfig getJGitConfig() { + return jgitConfig; + } + + @Override public StoredConfig getSystemConfig() throws IOException, ConfigInvalidException { return systemGitConfig; @@ -333,4 +351,9 @@ public class MockSystemReader extends SystemReader { return "MockSystemReader"; } + @Override + public FileBasedConfig openJGitConfig(Config parent, FS fs) { + return jgitConfig; + } + } |