From: Kristofer Karlsson Date: Tue, 07 Jul 2026 16:12:31 GMT Subject: Re: [PATCH 1/2] t: add tests for ref tombstone scenarios Message-ID: In-Reply-To: On Tue, 7 Jul 2026 at 17:24, Patrick Steinhardt wrote: > > On Mon, Jul 06, 2026 at 01:35:55PM +0000, Kristofer Karlsson via GitGitGadget wrote: > > diff --git a/t/perf/p1401-ref-store-tombstones.sh b/t/perf/p1401-ref-store-tombstones.sh > > new file mode 100755 > > index 0000000000..e40a6dcbf4 > > --- /dev/null > > +++ b/t/perf/p1401-ref-store-tombstones.sh > > @@ -0,0 +1,44 @@ > > +#!/bin/sh > > + > > +test_description="Tests performance of ref operations with many tombstones" > > + > > +. ./perf-lib.sh > > + > > +test_expect_success "setup" ' > > + git init --ref-format=reftable repo && > > + blob=$(echo foo | git -C repo hash-object -w --stdin) && > > + for i in $(test_seq 8000) > > + do > > + printf "create refs/tags/tag-%d %s\n" "$i" "$blob" || > > + return 1 > > + done >repo/input && > > + git -C repo update-ref --stdin > + git -C repo for-each-ref --format="delete %(refname)" | > > + git -C repo update-ref --stdin > > +' > > + > > +test_perf "recreate refs after mass delete" ' > > + git -C repo update-ref --stdin > + git -C repo for-each-ref --format="delete %(refname)" | > > + git -C repo update-ref --stdin > > +' > > You're not only benchmarking the reference recreation, but also their > deletion. If I'm not misreading things, then you can queue cleanups via > `test_when_finished`, and these calls will not be measured. I don't think measuring the full create+delete cycle is wrong per se, but you are right that if we can benchmark something more isolated is even more useful. I will try to split this up better. > > +test_expect_success "setup asymmetric" ' > > + for i in $(test_seq 8000) > > + do > > + printf "create refs/tags/old-%d %s\n" "$i" "$blob" || > > + return 1 > > + done >repo/input-old && > > + sed "s/old-/new-/" repo/input-new && > > + git -C repo update-ref --stdin > + git -C repo for-each-ref --format="delete %(refname)" | > > + git -C repo update-ref --stdin > > +' > > Would it make sense to use separate repositories? Otherwise, state from > the preceding benchmark(s) will impact subsequent ones. Agreed, I can use a fresh repo for each scenario. > > > diff --git a/t/t0610-reftable-basics.sh b/t/t0610-reftable-basics.sh > > +test_expect_success 'delete and re-create refs with tombstones' ' > > I wonder whether this test really adds any value. We probably have lots > of tests already that test creation/deletion of references. I could not find an existing test that covers the delete-then-recreate flow (where tombstones are present when the new refs are created). The existing tests cover creation and deletion separately but not the interaction with tombstones. (But perhaps such a test exists and I just can't find it.) Thanks, Kristofer