]> source.dussan.org Git - jgit.git/commitdiff
Remove duplicate calls to DirCache.unlock on checkout 40/4240/1
authorKevin Sawicki <kevin@github.com>
Tue, 13 Sep 2011 22:29:55 +0000 (15:29 -0700)
committerKevin Sawicki <kevin@github.com>
Tue, 13 Sep 2011 22:29:55 +0000 (15:29 -0700)
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 <kevin@github.com>
org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheCheckout.java

index ee162dd50699de327218a2002a6050156f26fe1c..04f0077d86ed28e321e7194effea8a8af38bbae1 100644 (file)
@@ -396,10 +396,9 @@ public class DirCacheCheckout {
                                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 @@ public class DirCacheCheckout {
                        }
 
                        // commit the index builder - a new index is persisted
-                       if (!builder.commit()) {
-                               dc.unlock();
+                       if (!builder.commit())
                                throw new IndexWriteException();
-                       }
                } finally {
                        objectReader.release();
                }