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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 <spearce@xxxxxxxxxxx>
---
 .../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

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]