Thread (18 messages) flat view 18 messages, 3 authors, 2016-06-15
STALE3730d

[JGIT PATCH 05/13] Create the new WindowCache before clearing the old one

From: Shawn O. Pearce <hidden>
Date: 2016-06-15 22:46:40
Subsystem: the rest · Maintainer: Linus Torvalds

This way if the cache configuration is invalid the old cache is left
unmodified, permitting the caller to recover with no penalty.

Signed-off-by: Shawn O. Pearce <redacted>
---
 .../src/org/spearce/jgit/lib/WindowCache.java      |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/org.spearce.jgit/src/org/spearce/jgit/lib/WindowCache.java b/org.spearce.jgit/src/org/spearce/jgit/lib/WindowCache.java
index e4c88d2..aaad033 100644
--- a/org.spearce.jgit/src/org/spearce/jgit/lib/WindowCache.java
+++ b/org.spearce.jgit/src/org/spearce/jgit/lib/WindowCache.java
@@ -112,10 +112,11 @@ public static void reconfigure(final int packedGitLimit,
 	 *             settings, usually too low of a limit.
 	 */
 	public static void reconfigure(final WindowCacheConfig cfg) {
-		final WindowCache c = cache;
-		if (c != null)
-			c.removeAll();
-		cache = new WindowCache(cfg);
+		final WindowCache nc = new WindowCache(cfg);
+		final WindowCache oc = cache;
+		if (oc != null)
+			oc.removeAll();
+		cache = nc;
 		UnpackedObjectCache.reconfigure(cfg);
 	}
 
-- 
1.6.3.rc1.205.g37f8
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help