Files
git-mirror/t/perf/p1401-ref-store-tombstones.sh
Patrick Steinhardt 9e7865bd14 builtin/init: rename "--ref-format=" to "--ref-storage-format="
Back when we gained support for reftables we of course introduced the
ability to control the reference storage format that is used by newly
created repositories. This infrastructure has grown over time, and
unfortunately without consistency:

  - The command line parameter to specify the ref storage format is
    called "--ref-format=", while the corresponding repository extension
    is called "refStorage".

  - In most cases we refer to the "ref storage format" in our docs, so
    calling it "--ref-format=" is being inconsistent with them.

  - It is possible to override the ref storage format via an environment
    variable that is called "GIT_REFERENCE_BACKEND", which is not even
    remotely consistent with anything else.

  - There is also an "object format", but that format does not control
    how we store objects but rather whether we use SHA1 or SHA256.

So in summary, it's a huge mess.

This problem is about to become even worse though, as we're soon going
to introduce an object storage extension. This extension is the
equivalent to the ref storage extension, and of course we also want
users to be able to control which object storage format new repositories
are using. But we cannot properly name that parameter without creating
even more inconsistencies:

  - "--object-format=" would match "--ref-format=", but that parameter
    name is already taken to specify the hash function.

  - "--object-storage=" would be a good fit, but be inconsistent with
    "--ref-format=". Asking the user to execute `git init --ref-format=
    --object-storage=` just feels extremely awkward.

Instead, this and subsequent patches will fix the mess by consistently
referring to the ref storage format as such throughout all options,
environment variables and config settings. This new name much more
closely indicates that it is about how we store data and finally brings
consistency into this area. We will keep the old names working of course
for the sake of backwards compatibility.

Start with git-init(1).

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-09-09 11:04:30 -07:00

47 lines
1.4 KiB
Bash
Executable File

#!/bin/sh
test_description="Tests performance of ref operations with many tombstones"
. ./perf-lib.sh
test_expect_success "setup" '
git init --ref-storage-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 &&
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 <repo/input &&
git -C repo for-each-ref --format="delete %(refname)" |
git -C repo update-ref --stdin
'
test_expect_success "setup asymmetric" '
git init --ref-storage-format=reftable repo2 &&
blob=$(echo foo | git -C repo2 hash-object -w --stdin) &&
for i in $(test_seq 8000)
do
printf "create refs/tags/old-%d %s\n" "$i" "$blob" ||
return 1
done >repo2/input-old &&
sed "s/old-/new-/" <repo2/input-old >repo2/input-new &&
git -C repo2 update-ref --stdin <repo2/input-old &&
git -C repo2 for-each-ref --format="delete %(refname)" |
git -C repo2 update-ref --stdin
'
test_perf "create new refs after deleting differently-named refs" '
git -C repo2 update-ref --stdin <repo2/input-new &&
git -C repo2 for-each-ref --format="delete %(refname)" refs/tags/ |
git -C repo2 update-ref --stdin
'
test_done