]> git.ipfire.org Git - thirdparty/git.git/commitdiff
Merge branch 'ps/reftable-repo-init-fix'
authorJunio C Hamano <gitster@pobox.com>
Thu, 7 Mar 2024 23:59:42 +0000 (15:59 -0800)
committerJunio C Hamano <gitster@pobox.com>
Thu, 7 Mar 2024 23:59:42 +0000 (15:59 -0800)
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

refs/reftable-backend.c
t/t0610-reftable-basics.sh

index eaa82967ee9ae347af9e0de590d09e7b424fe60d..2c88bbd448b18785200a83b7a9e4e794cc364d60 100644 (file)
@@ -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];
index 6a131e40b8157dc3fefea53704ad2377b7ce5c3a..686781192eb7c2d820e28393b6d0352db3f4822e 100755 (executable)
@@ -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 &&