]> source.dussan.org Git - jgit.git/commitdiff
DirCacheCheckout: unlock DirCache in case of failure 99/3799/1
authorJens Baumgart <jens.baumgart@sap.com>
Wed, 29 Jun 2011 12:18:00 +0000 (14:18 +0200)
committerJens Baumgart <jens.baumgart@sap.com>
Wed, 29 Jun 2011 12:18:00 +0000 (14:18 +0200)
DirCacheCheckout did not unlock the index if e.g. an IOException occured
during checkout.

Bug: 350677
Change-Id: Ie9fa09f7a404080da7cdccafb9be3a8c845e4869
Signed-off-by: Jens Baumgart <jens.baumgart@sap.com>
org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheCheckout.java

index 9a99408981c79c474c5f53d5450b14444f5ae0ae..6a1669b4f214cb776b732e66e0a4931bad246f5a 100644 (file)
@@ -375,6 +375,16 @@ public class DirCacheCheckout {
         * @throws IOException
         */
        public boolean checkout() throws IOException {
+               try {
+                       return doCheckout();
+               } finally {
+                       dc.unlock();
+               }
+       }
+
+       private boolean doCheckout() throws CorruptObjectException, IOException,
+                       MissingObjectException, IncorrectObjectTypeException,
+                       CheckoutConflictException, IndexWriteException {
                toBeDeleted.clear();
                if (headCommitTree != null)
                        preScanTwoTrees();