From 4005f3c6934de556f3937b96d98f6eeb28c353bd Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 13 Sep 2011 15:29:55 -0700 Subject: [PATCH] Remove duplicate calls to DirCache.unlock on checkout Calls to unlock the DirCache before throwing an exception were not needed since checkout calls doCheckout wrapped in a try block that calls DirCache.unlock in a finally block. Change-Id: I2b249a784f9e363430e288aad67fcefb7fac0a6e Signed-off-by: Kevin Sawicki --- .../src/org/eclipse/jgit/dircache/DirCacheCheckout.java | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheCheckout.java b/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheCheckout.java index ee162dd50..04f0077d8 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheCheckout.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheCheckout.java @@ -396,10 +396,9 @@ private boolean doCheckout() throws CorruptObjectException, IOException, prescanOneTree(); if (!conflicts.isEmpty()) { - if (failOnConflict) { - dc.unlock(); + if (failOnConflict) throw new CheckoutConflictException(conflicts.toArray(new String[conflicts.size()])); - } else + else cleanUpConflicts(); } @@ -448,10 +447,8 @@ private boolean doCheckout() throws CorruptObjectException, IOException, } // commit the index builder - a new index is persisted - if (!builder.commit()) { - dc.unlock(); + if (!builder.commit()) throw new IndexWriteException(); - } } finally { objectReader.release(); }