diff --git a/refs/reftable-backend.c b/refs/reftable-backend.c index eaa82967ee..2c88bbd448 100644 --- a/refs/reftable-backend.c +++ b/refs/reftable-backend.c @@ -781,6 +781,7 @@ static int reftable_be_transaction_prepare(struct ref_store *ref_store, &head_referent, &head_type); if (ret < 0) goto done; + ret = 0; for (i = 0; i < transaction->nr; i++) { struct ref_update *u = transaction->updates[i]; diff --git a/t/t0610-reftable-basics.sh b/t/t0610-reftable-basics.sh index 6a131e40b8..686781192e 100755 --- a/t/t0610-reftable-basics.sh +++ b/t/t0610-reftable-basics.sh @@ -328,6 +328,18 @@ test_expect_success 'ref transaction: writes are synced' ' EOF ' +test_expect_success 'ref transaction: empty transaction in empty repo' ' + test_when_finished "rm -rf repo" && + git init repo && + test_commit -C repo --no-tag A && + git -C repo update-ref -d refs/heads/main && + test-tool -C repo ref-store main delete-refs REF_NO_DEREF msg HEAD && + git -C repo update-ref --stdin <<-EOF + prepare + commit + EOF +' + test_expect_success 'pack-refs: compacts tables' ' test_when_finished "rm -rf repo" && git init repo &&