aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2024-03-07 15:59:42 -0800
committerJunio C Hamano <gitster@pobox.com>2024-03-07 15:59:42 -0800
commit963a277a521adfa33f6e710e71c7d2a9f4d87a9c (patch)
tree54fb9d9f13326336e5881c81d626193fae39800f
parentMerge branch 'ps/remote-helper-repo-initialization-fix' (diff)
parentt0610: remove unused variable assignment (diff)
downloadgit-963a277a521adfa33f6e710e71c7d2a9f4d87a9c.tar.gz
git-963a277a521adfa33f6e710e71c7d2a9f4d87a9c.zip
Merge branch 'ps/reftable-repo-init-fix'
Clear the fallout from a fix for 2.44 regression. * ps/reftable-repo-init-fix: t0610: remove unused variable assignment refs/reftable: don't fail empty transactions in repo without HEAD
-rw-r--r--refs/reftable-backend.c1
-rwxr-xr-xt/t0610-reftable-basics.sh12
2 files changed, 13 insertions, 0 deletions
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 &&