diff options
author | Shawn O. Pearce <spearce@spearce.org> | 2010-12-13 14:18:05 -0800 |
---|---|---|
committer | Shawn O. Pearce <spearce@spearce.org> | 2010-12-15 15:14:05 -0800 |
commit | 013cb8de3824c304645a9c5db87c2e80286872d1 (patch) | |
tree | d620e6700503a34b6da2359d238cbd2fda914ce9 /org.eclipse.jgit.http.test | |
parent | 86847ee3224ac93da478bc5cdb8a79140ee6edac (diff) | |
download | jgit-013cb8de3824c304645a9c5db87c2e80286872d1.tar.gz jgit-013cb8de3824c304645a9c5db87c2e80286872d1.zip |
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 <spearce@spearce.org>
Diffstat (limited to 'org.eclipse.jgit.http.test')
-rw-r--r-- | org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/SmartClientSmartServerTest.java | 7 |
1 files changed, 4 insertions, 3 deletions
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 { |