builtin/rev-parse: rename "--show-ref-format" to "--show-ref-storage-format"

With the same reasoning as for git-init(1), rename "--show-ref-format"
to "--show-ref-storage-format" and keep the old name as an alias.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
main
Patrick Steinhardt 2026-09-09 13:12:52 +02:00 committed by Junio C Hamano
parent da01f4939f
commit 4ebec19711
10 changed files with 42 additions and 39 deletions

View File

@ -331,9 +331,12 @@ The following options are unaffected by `--path-format`:
requested and no compatibility algorithm is enabled, prints an empty line. If
not specified, the default is "storage".

--show-ref-format::
--show-ref-storage-format::
Show the reference storage format used for the repository.

--show-ref-format::
Deprecated alias of `--show-ref-storage-format`.


Other Options
~~~~~~~~~~~~~

View File

@ -1134,7 +1134,7 @@ int cmd_rev_parse(int argc,
}
continue;
}
if (!strcmp(arg, "--show-ref-format")) {
if (!strcmp(arg, "--show-ref-format") || !strcmp(arg, "--show-ref-storage-format")) {
puts(ref_storage_format_to_name(the_repository->ref_storage_format));
continue;
}

View File

@ -466,7 +466,7 @@ __git_ps1 ()

local repo_info rev_parse_exit_code
repo_info="$(git rev-parse --git-dir --is-inside-git-dir \
--is-bare-repository --is-inside-work-tree --show-ref-format \
--is-bare-repository --is-inside-work-tree --show-ref-storage-format \
--short HEAD 2>/dev/null)"
rev_parse_exit_code="$?"


View File

@ -135,7 +135,7 @@ test_perf_create_repo_from () {
source_git="$("$MODERN_GIT" -C "$source" rev-parse --git-dir)"
objects_dir="$("$MODERN_GIT" -C "$source" rev-parse --git-path objects)"
common_dir="$("$MODERN_GIT" -C "$source" rev-parse --git-common-dir)"
refformat="$("$MODERN_GIT" -C "$source" rev-parse --show-ref-format)"
ref_storage_format="$("$MODERN_GIT" -C "$source" rev-parse --show-ref-storage-format)"
objectformat="$("$MODERN_GIT" -C "$source" rev-parse --show-object-format)"
mkdir -p "$repo/.git"
(
@ -153,7 +153,7 @@ test_perf_create_repo_from () {
) &&
(
cd "$repo" &&
"$MODERN_GIT" init -q --ref-storage-format="$refformat" --object-format="$objectformat" &&
"$MODERN_GIT" init -q --ref-storage-format="$ref_storage_format" --object-format="$objectformat" &&
test_perf_do_repo_symlink_config_ &&
mv .git/hooks .git/hooks-disabled 2>/dev/null &&
if test -f .git/index.lock

View File

@ -657,7 +657,7 @@ test_expect_success 'init warns about invalid init.defaultRefFormat' '
git init repo 2>err &&
test_cmp expect err &&

git -C repo rev-parse --show-ref-format >actual &&
git -C repo rev-parse --show-ref-storage-format >actual &&
echo $GIT_DEFAULT_REF_FORMAT >expected &&
test_cmp expected actual
'
@ -669,7 +669,7 @@ test_expect_success 'default ref format' '
git init refformat
) &&
git version --build-options | sed -ne "s/^default-ref-format: //p" >expect &&
git -C refformat rev-parse --show-ref-format >actual &&
git -C refformat rev-parse --show-ref-storage-format >actual &&
test_cmp expect actual
'

@ -692,7 +692,7 @@ do
test_cmp expect actual &&

echo $format >expect &&
git -C refformat rev-parse --show-ref-format >actual &&
git -C refformat rev-parse --show-ref-storage-format >actual &&
test_cmp expect actual
'

@ -700,7 +700,7 @@ do
test_when_finished "rm -rf refformat" &&
git init --ref-storage-format=$format refformat &&
echo $format >expect &&
git -C refformat rev-parse --show-ref-format >actual &&
git -C refformat rev-parse --show-ref-storage-format >actual &&
test_cmp expect actual
'

@ -713,7 +713,7 @@ do
) &&

echo $format >expect &&
git -C refformat rev-parse --show-ref-format >actual &&
git -C refformat rev-parse --show-ref-storage-format >actual &&
test_cmp expect actual
'

@ -721,16 +721,16 @@ do
test_when_finished "rm -rf refformat" &&
GIT_DEFAULT_REF_FORMAT=garbage git init --ref-storage-format=$format refformat &&
echo $format >expect &&
git -C refformat rev-parse --show-ref-format >actual &&
git -C refformat rev-parse --show-ref-storage-format >actual &&
test_cmp expect actual
'

test_expect_success "reinit repository with GIT_DEFAULT_REF_FORMAT=$format does not change format" '
test_when_finished "rm -rf refformat" &&
git init refformat &&
git -C refformat rev-parse --show-ref-format >expect &&
git -C refformat rev-parse --show-ref-storage-format >expect &&
GIT_DEFAULT_REF_FORMAT=$format git init refformat &&
git -C refformat rev-parse --show-ref-format >actual &&
git -C refformat rev-parse --show-ref-storage-format >actual &&
test_cmp expect actual
'
done
@ -739,7 +739,7 @@ test_expect_success "--ref-storage-format= overrides GIT_DEFAULT_REF_FORMAT" '
test_when_finished "rm -rf refformat" &&
GIT_DEFAULT_REF_FORMAT=files git init --ref-storage-format=reftable refformat &&
echo reftable >expect &&
git -C refformat rev-parse --show-ref-format >actual &&
git -C refformat rev-parse --show-ref-storage-format >actual &&
test_cmp expect actual
'

@ -749,7 +749,7 @@ test_expect_success "GIT_DEFAULT_REF_FORMAT= overrides init.defaultRefFormat" '

GIT_DEFAULT_REF_FORMAT=reftable git init refformat &&
echo reftable >expect &&
git -C refformat rev-parse --show-ref-format >actual &&
git -C refformat rev-parse --show-ref-storage-format >actual &&
test_cmp expect actual
'

@ -761,7 +761,7 @@ test_expect_success "init with feature.experimental=true" '
git init refformat
) &&
echo reftable >expect &&
git -C refformat rev-parse --show-ref-format >actual &&
git -C refformat rev-parse --show-ref-storage-format >actual &&
test_cmp expect actual
'

@ -774,7 +774,7 @@ test_expect_success "init.defaultRefFormat overrides feature.experimental=true"
git init refformat
) &&
echo files >expect &&
git -C refformat rev-parse --show-ref-format >actual &&
git -C refformat rev-parse --show-ref-storage-format >actual &&
test_cmp expect actual
'

@ -783,7 +783,7 @@ test_expect_success "GIT_DEFAULT_REF_FORMAT= overrides feature.experimental=true
test_config_global feature.experimental true &&
GIT_DEFAULT_REF_FORMAT=files git init refformat &&
echo files >expect &&
git -C refformat rev-parse --show-ref-format >actual &&
git -C refformat rev-parse --show-ref-storage-format >actual &&
test_cmp expect actual
'

@ -794,7 +794,7 @@ do
git init --ref-storage-format=$from_format refformat &&
git init --ref-storage-format=$from_format refformat &&
echo $from_format >expect &&
git -C refformat rev-parse --show-ref-format >actual &&
git -C refformat rev-parse --show-ref-storage-format >actual &&
test_cmp expect actual
'

@ -814,7 +814,7 @@ do
test_must_fail git init --ref-storage-format=$to_format refformat 2>err &&
test_cmp expect err &&
echo $from_format >expect &&
git -C refformat rev-parse --show-ref-format >actual &&
git -C refformat rev-parse --show-ref-storage-format >actual &&
test_cmp expect actual
'
done
@ -933,7 +933,7 @@ test_expect_success 'init with includeIf.onbranch condition' '
test_when_finished "rm -rf repo" &&
git -c includeIf.onbranch:main.path=nonexistent init repo &&
echo $GIT_DEFAULT_REF_FORMAT >expect &&
git -C repo rev-parse --show-ref-format >actual &&
git -C repo rev-parse --show-ref-storage-format >actual &&
test_cmp expect actual
'

@ -942,7 +942,7 @@ test_expect_success 'init with includeIf.onbranch condition with existing direct
mkdir repo &&
git -c includeIf.onbranch:nonexistent.path=/does/not/exist init repo &&
echo $GIT_DEFAULT_REF_FORMAT >expect &&
git -C repo rev-parse --show-ref-format >actual &&
git -C repo rev-parse --show-ref-storage-format >actual &&
test_cmp expect actual
'

@ -951,7 +951,7 @@ test_expect_success 're-init with includeIf.onbranch condition' '
git init repo &&
git -c includeIf.onbranch:nonexistent.path=/does/not/exist init repo &&
echo $GIT_DEFAULT_REF_FORMAT >expect &&
git -C repo rev-parse --show-ref-format >actual &&
git -C repo rev-parse --show-ref-storage-format >actual &&
test_cmp expect actual
'


View File

@ -27,7 +27,7 @@ test_expect_success 'init: creates basic reftable structures' '
test_path_is_dir repo/.git/reftable &&
test_path_is_file repo/.git/reftable/tables.list &&
echo reftable >expect &&
git -C repo rev-parse --show-ref-format >actual &&
git -C repo rev-parse --show-ref-storage-format >actual &&
test_cmp expect actual
'

@ -38,7 +38,7 @@ test_expect_success 'init: sha256 object format via environment variable' '
sha256
reftable
EOF
git -C repo rev-parse --show-object-format --show-ref-format >actual &&
git -C repo rev-parse --show-object-format --show-ref-storage-format >actual &&
test_cmp expect actual
'

@ -49,7 +49,7 @@ test_expect_success 'init: sha256 object format via option' '
sha256
reftable
EOF
git -C repo rev-parse --show-object-format --show-ref-format >actual &&
git -C repo rev-parse --show-object-format --show-ref-storage-format >actual &&
test_cmp expect actual
'

@ -156,7 +156,7 @@ test_expect_success 'clone: can clone reftable repository' '

git clone repo cloned &&
echo reftable >expect &&
git -C cloned rev-parse --show-ref-format >actual &&
git -C cloned rev-parse --show-ref-storage-format >actual &&
test_cmp expect actual &&
test_path_is_file cloned/file1
'
@ -171,11 +171,11 @@ test_expect_success 'clone: can clone reffiles into reftable repository' '
git -C reftable rev-parse HEAD >actual &&
test_cmp expect actual &&

git -C reftable rev-parse --show-ref-format >actual &&
git -C reftable rev-parse --show-ref-storage-format >actual &&
echo reftable >expect &&
test_cmp expect actual &&

git -C reffiles rev-parse --show-ref-format >actual &&
git -C reffiles rev-parse --show-ref-storage-format >actual &&
echo files >expect &&
test_cmp expect actual
'
@ -190,11 +190,11 @@ test_expect_success 'clone: can clone reftable into reffiles repository' '
git -C reffiles rev-parse HEAD >actual &&
test_cmp expect actual &&

git -C reftable rev-parse --show-ref-format >actual &&
git -C reftable rev-parse --show-ref-storage-format >actual &&
echo reftable >expect &&
test_cmp expect actual &&

git -C reffiles rev-parse --show-ref-format >actual &&
git -C reffiles rev-parse --show-ref-storage-format >actual &&
echo files >expect &&
test_cmp expect actual
'

View File

@ -53,7 +53,7 @@ test_migration () {
test_cmp expect_logs actual_logs
fi &&

git -C "$repo" rev-parse --show-ref-format >actual &&
git -C "$repo" rev-parse --show-ref-storage-format >actual &&
echo "$format" >expect &&
test_cmp expect actual
}
@ -215,7 +215,7 @@ do
test_grep "Finished dry-run migration of refs" output &&
test_path_is_dir repo/.git/ref_migration.* &&
echo $from_format >expect &&
git -C repo rev-parse --show-ref-format >actual &&
git -C repo rev-parse --show-ref-storage-format >actual &&
test_cmp expect actual
'


View File

@ -241,19 +241,19 @@ test_expect_success RUST 'rev-parse --show-object-format in repo with compat mod
)
'

test_expect_success 'rev-parse --show-ref-format' '
test_expect_success 'rev-parse --show-ref-storage-format' '
test_detect_ref_format >expect &&
git rev-parse --show-ref-format >actual &&
git rev-parse --show-ref-storage-format >actual &&
test_cmp expect actual
'

test_expect_success 'rev-parse --show-ref-format with invalid storage' '
test_expect_success 'rev-parse --show-ref-storage-format with invalid storage' '
test_when_finished "rm -rf repo" &&
git init repo &&
(
cd repo &&
git config extensions.refstorage broken &&
test_must_fail git rev-parse --show-ref-format 2>err &&
test_must_fail git rev-parse --show-ref-storage-format 2>err &&
test_grep "error: invalid value for ${SQ}extensions.refstorage${SQ}: ${SQ}broken${SQ}" err
)
'

View File

@ -168,7 +168,7 @@ test_expect_success 'clone with files ref format' '
test_when_finished "rm -rf ref-storage" &&
git clone --ref-storage-format=files --mirror src ref-storage &&
echo files >expect &&
git -C ref-storage rev-parse --show-ref-format >actual &&
git -C ref-storage rev-parse --show-ref-storage-format >actual &&
test_cmp expect actual
'


View File

@ -6,7 +6,7 @@ test_description='submodules handle mixed ref storage formats'

test_ref_format () {
echo "$2" >expect &&
git -C "$1" rev-parse --show-ref-format >actual &&
git -C "$1" rev-parse --show-ref-storage-format >actual &&
test_cmp expect actual
}