GitHandler: Don't lock on read operations.

Read operations of a Git repository can be performed during a write operation on the same repository. Only write operations can't be executed simultaneously.
This commit is contained in:
Kirill Likhodedov
2012-03-25 17:06:44 +04:00
parent b15613eaf0
commit 45852a26ad
@@ -621,10 +621,8 @@ public abstract class GitHandler {
boolean suspendable = false;
switch (myCommand.lockingPolicy()) {
case META:
// do nothing no locks are taken for metadata
break;
case READ:
vcs.getCommandLock().readLock().lock();
// need to lock only write operations: reads can be performed even when a write operation is going on
break;
case WRITE_SUSPENDABLE:
suspendable = true;
@@ -716,10 +714,7 @@ public abstract class GitHandler {
finally {
switch (myCommand.lockingPolicy()) {
case META:
// do nothing no locks are taken for metadata
break;
case READ:
vcs.getCommandLock().readLock().unlock();
break;
case WRITE_SUSPENDABLE:
case WRITE: