From 8f8bc703e9e19493b7f85cdae88b6c88a5bbd9a0 Mon Sep 17 00:00:00 2001 From: Kaushik Lingarkar Date: Thu, 13 Apr 2023 14:41:37 -0700 Subject: [PATCH] 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 --- .../jgit/internal/storage/file/PackedBatchRefUpdate.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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 560b80756..a9e05c92a 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();