summaryrefslogtreecommitdiffstats
path: root/t/t0610-reftable-basics.sh
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2024-03-25 11:02:50 +0100
committerJunio C Hamano <gitster@pobox.com>2024-03-25 17:54:07 +0100
commita2f711ade0c4816a59155d72559cbc4759cd4699 (patch)
tree5c3a8c6423e640d428a4ef88875269bae32a0ef4 /t/t0610-reftable-basics.sh
parentreftable/stack: use error codes when locking fails during compaction (diff)
downloadgit-a2f711ade0c4816a59155d72559cbc4759cd4699.tar.xz
git-a2f711ade0c4816a59155d72559cbc4759cd4699.zip
reftable/stack: gracefully handle failed auto-compaction due to locks
Whenever we commit a new table to the reftable stack we will end up invoking auto-compaction of the stack to keep the total number of tables at bay. This auto-compaction may fail though in case at least one of the tables which we are about to compact is locked. This is indicated by the compaction function returning `REFTABLE_LOCK_ERROR`. We do not handle this case though, and thus bubble that return value up the calling chain, which will ultimately cause a failure. Fix this bug by ignoring `REFTABLE_LOCK_ERROR`. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t0610-reftable-basics.sh')
-rwxr-xr-xt/t0610-reftable-basics.sh20
1 files changed, 20 insertions, 0 deletions
diff --git a/t/t0610-reftable-basics.sh b/t/t0610-reftable-basics.sh
index 686781192e..5f2f9baa9b 100755
--- a/t/t0610-reftable-basics.sh
+++ b/t/t0610-reftable-basics.sh
@@ -340,6 +340,26 @@ test_expect_success 'ref transaction: empty transaction in empty repo' '
EOF
'
+test_expect_success 'ref transaction: fails gracefully when auto compaction fails' '
+ test_when_finished "rm -rf repo" &&
+ git init repo &&
+ (
+ cd repo &&
+
+ test_commit A &&
+ for i in $(test_seq 10)
+ do
+ git branch branch-$i &&
+ for table in .git/reftable/*.ref
+ do
+ touch "$table.lock" || exit 1
+ done ||
+ exit 1
+ done &&
+ test_line_count = 13 .git/reftable/tables.list
+ )
+'
+
test_expect_success 'pack-refs: compacts tables' '
test_when_finished "rm -rf repo" &&
git init repo &&