summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit
diff options
context:
space:
mode:
authorJens Baumgart <jens.baumgart@sap.com>2011-06-29 14:18:00 +0200
committerJens Baumgart <jens.baumgart@sap.com>2011-06-29 14:18:00 +0200
commiteb46d7ffdc6dee1f8570d4be3b6c33cee8fa91c7 (patch)
treee8f09e8b57e95f06d00924e3cf177a12da0ba91b /org.eclipse.jgit
parent553920088dcf93f27e6fd2042658c23ef6ea7cba (diff)
downloadjgit-eb46d7ffdc6dee1f8570d4be3b6c33cee8fa91c7.tar.gz
jgit-eb46d7ffdc6dee1f8570d4be3b6c33cee8fa91c7.zip
DirCacheCheckout: unlock DirCache in case of failure
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>
Diffstat (limited to 'org.eclipse.jgit')
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheCheckout.java10
1 files changed, 10 insertions, 0 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 9a99408981..6a1669b4f2 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheCheckout.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheCheckout.java
@@ -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();