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(); }