From: Kristofer Karlsson via GitGitGadget Date: Mon, 06 Jul 2026 13:35:55 GMT Subject: [PATCH 1/2] t: add tests for ref tombstone scenarios Message-ID: In-Reply-To: From: Kristofer Karlsson Add a performance test and a correctness test for update-ref when many tombstones are present in a reftable. The performance test (p1401) exercises two scenarios: - All refs are deleted (creating tombstones) and then re-created with the same names, which currently exhibits quadratic behavior. - An asymmetric variant where refs are deleted and then new, differently-named refs are created. When the tombstones sort after the new refs, every create scans all tombstones, making this case even worse than re-creating the same refs. The correctness test (t0610) verifies that refs deleted and then re-created with the same names are visible afterwards. Helped-by: Jeff King Signed-off-by: Kristofer Karlsson --- t/perf/p1401-ref-store-tombstones.sh | 44 ++++++++++++++++++++++++++++ t/t0610-reftable-basics.sh | 22 ++++++++++++++ 2 files changed, 66 insertions(+) create mode 100755 t/perf/p1401-ref-store-tombstones.sh 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 repo/input-old && + sed "s/old-/new-/" repo/input-new && + git -C repo update-ref --stdin input <<-EOF && + create refs/tags/a $A + create refs/tags/b $A + create refs/tags/c $A + EOF + git -C repo update-ref --stdin actual && + test_line_count = 3 actual +' + test_done -- gitgitgadget