Fix LockFileTest on Windows
LockFileTest was failing on Windows because we couldn't delete the lock file of the index. The reason was that a LockFile instance still had an open handle to the lock file preventing us to delete the file (in contrast to the behavior on other platforms). Change-Id: I1d50442b7eb8a27f98f69ad77c5e24a9698a7b66 Signed-off-by: Christian Halstrick <christian.halstrick@sap.com> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
This commit is contained in:
parent
fe1f1b8f8a
commit
c745c93e40
|
@ -70,13 +70,14 @@ public void lockFailedExceptionRecovery() throws Exception {
|
||||||
git.add().addFilepattern("file.txt").call();
|
git.add().addFilepattern("file.txt").call();
|
||||||
assertNotNull(git.commit().setMessage("edit file").call());
|
assertNotNull(git.commit().setMessage("edit file").call());
|
||||||
|
|
||||||
assertTrue(new LockFile(db.getIndexFile(), db.getFS()).lock());
|
LockFile lf = new LockFile(db.getIndexFile(), db.getFS());
|
||||||
|
assertTrue(lf.lock());
|
||||||
try {
|
try {
|
||||||
git.checkout().setName(commit1.name()).call();
|
git.checkout().setName(commit1.name()).call();
|
||||||
fail("JGitInternalException not thrown");
|
fail("JGitInternalException not thrown");
|
||||||
} catch (JGitInternalException e) {
|
} catch (JGitInternalException e) {
|
||||||
assertTrue(e.getCause() instanceof LockFailedException);
|
assertTrue(e.getCause() instanceof LockFailedException);
|
||||||
LockFile.unlock(((LockFailedException) e.getCause()).getFile());
|
lf.unlock();
|
||||||
git.checkout().setName(commit1.name()).call();
|
git.checkout().setName(commit1.name()).call();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue