Browse Source

Call unlockPack in finally

The lock is obtained in receivePackAndCheckConnectivity. It seems to me
the structure that requres the caller to unlock the lock is wrong, but
at least by calling in finally ensures it is called even if an exception
is thrown.

Change-Id: I123841b017baf5acffe0064d1004ef11a0a5e6c2
Signed-off-by: Masaya Suzuki <masayasuzuki@google.com>
stable-5.2
Masaya Suzuki 6 years ago
parent
commit
ad379793c7
  1. 28
      org.eclipse.jgit/src/org/eclipse/jgit/transport/ReceivePack.java

28
org.eclipse.jgit/src/org/eclipse/jgit/transport/ReceivePack.java

@ -269,20 +269,26 @@ public class ReceivePack extends BaseReceivePack {
} }
} }
if (unpackError == null) { try {
boolean atomic = isCapabilityEnabled(CAPABILITY_ATOMIC); if (unpackError == null) {
setAtomic(atomic); boolean atomic = isCapabilityEnabled(CAPABILITY_ATOMIC);
setAtomic(atomic);
validateCommands(); validateCommands();
if (atomic && anyRejects()) if (atomic && anyRejects()) {
failPendingCommands(); failPendingCommands();
}
preReceive.onPreReceive(this, filterCommands(Result.NOT_ATTEMPTED)); preReceive.onPreReceive(
if (atomic && anyRejects()) this, filterCommands(Result.NOT_ATTEMPTED));
failPendingCommands(); if (atomic && anyRejects()) {
executeCommands(); failPendingCommands();
}
executeCommands();
}
} finally {
unlockPack();
} }
unlockPack();
if (reportStatus) { if (reportStatus) {
if (echoCommandFailures && msgOut != null) { if (echoCommandFailures && msgOut != null) {

Loading…
Cancel
Save