From c28b57b0eb041618e33da3889003b0fdc80cba90 Mon Sep 17 00:00:00 2001 From: Praveen Innamuri Date: Tue, 15 Apr 2014 16:44:12 -0700 Subject: [PATCH] Resolving a deadlock with git test cases. --- .../src/com/aptana/git/core/model/GitTestCase.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tests/com.aptana.git.core.tests/src/com/aptana/git/core/model/GitTestCase.java b/tests/com.aptana.git.core.tests/src/com/aptana/git/core/model/GitTestCase.java index 832b6e5e63..142e4e4f9a 100644 --- a/tests/com.aptana.git.core.tests/src/com/aptana/git/core/model/GitTestCase.java +++ b/tests/com.aptana.git.core.tests/src/com/aptana/git/core/model/GitTestCase.java @@ -101,7 +101,11 @@ protected void assertCommit(GitIndex index, String commitMessage) throws Excepti GitRepository repo = getRepo(); try { - repo.waitForWrite(); + // Aquiring the write lock before commit might cause deadlock with a git refresh job that is already + // triggered (due to resource changes). After the commit is done, it refreshes and that requires the write + // lock. + + // repo.waitForWrite(); IStatus status = index.commit(commitMessage); assertTrue("Failed to commit: " + status.getMessage(), status.isOK()); assertTrue("After a commit, the repository changed file listing should be empty but is not", index @@ -109,7 +113,7 @@ protected void assertCommit(GitIndex index, String commitMessage) throws Excepti } finally { - repo.exitWriteProcess(); + // repo.exitWriteProcess(); } }