From 013cb8de3824c304645a9c5db87c2e80286872d1 Mon Sep 17 00:00:00 2001 From: "Shawn O. Pearce" Date: Mon, 13 Dec 2010 14:18:05 -0800 Subject: Reduce calls to Repository.getConfig Each time getConfig() is called on FileRepository, it checks the last modified time of both ~/.gitconfig and $GIT_DIR?config. If $GIT_DIR/config appears to have been modified, it is read back in from disk and the current config is wiped out. When mutating a configuration file, this may cause in-memory edits to disappear. To avoid that callers need to avoid calling getConfig until after the configuration has been saved to disk. Unfortunately the API is still horribly broken. Configuration should be modified only while a lock is held on the configuration file, very similar to the way a ref is updated via its locking protocol. But our existing API is really broken for that so we'll have to defer cleaning up the edit path for a future change. Change-Id: I5888dd97bac20ddf60456c81ffc1eb8df04ef410 Signed-off-by: Shawn O. Pearce --- .../tst/org/eclipse/jgit/http/test/SmartClientSmartServerTest.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'org.eclipse.jgit.http.test') diff --git a/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/SmartClientSmartServerTest.java b/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/SmartClientSmartServerTest.java index 491094ca6d..f73f54ffba 100644 --- a/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/SmartClientSmartServerTest.java +++ b/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/SmartClientSmartServerTest.java @@ -500,9 +500,10 @@ public class SmartClientSmartServerTest extends HttpTestCase { enableReceivePack(); - db.getConfig().setInt("core", null, "compression", 0); - db.getConfig().setInt("http", null, "postbuffer", 8 * 1024); - db.getConfig().save(); + final FileBasedConfig cfg = db.getConfig(); + cfg.setInt("core", null, "compression", 0); + cfg.setInt("http", null, "postbuffer", 8 * 1024); + cfg.save(); t = Transport.open(db, remoteURI); try { -- cgit v1.2.3