PackedBatchRefUpdate: Handle the case where loose refs fail to pack

If packing loose refs fails due to a lock failure, reject update with
a LOCK_FAILURE.

Change-Id: I100e81efd528d963231a1b87bacd9d68f9245a1b
Signed-off-by: Kaushik Lingarkar <quic_kaushikl@quicinc.com>
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackedBatchRefUpdate.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackedBatchRefUpdate.java
index 560b807..a9e05c9 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackedBatchRefUpdate.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackedBatchRefUpdate.java
@@ -168,7 +168,12 @@ public void execute(RevWalk walk, ProgressMonitor monitor,
 				if (locks == null) {
 					return;
 				}
-				refdb.pack(locks);
+				try {
+					refdb.pack(locks);
+				} catch (LockFailedException e) {
+					lockFailure(pending.get(0), pending);
+					return;
+				}
 			}
 
 			LockFile packedRefsLock = refdb.lockPackedRefs();