[PATCH 4/5] builtin/rev-parse: print payload for the ref storage format
- From
Patrick Steinhardt <ps@pks.im>
- Date
- Nov 5, 2026, 15:02 UTC
- Message-ID
- <20261105-pks-storage-format-improvements-v1-4-870bb4212518@pks.im>
- In-Reply-To
- <20261105-pks-storage-format-improvements-v1-0-870bb4212518@pks.im>
While we print both the object storage format and its payload for the "--show-object-storage-format" switch, we only print the ref storage format with "--show-ref-storage-format". Adapt the latter to also show the payload.
Signed-off-by: Patrick Steinhardt <ps@pks.im> --- builtin/rev-parse.c | 6 +++++- t/t1500-rev-parse.sh | 9 +++++++++ 2 files changed, 14 insertions(+), 1 deletion(-)
diff --git a/builtin/rev-parse.c b/builtin/rev-parse.c index d2154eac8d2..fbc5ef87276 100644 --- a/builtin/rev-parse.c +++ b/builtin/rev-parse.c @@ -1136,7 +1136,11 @@ int cmd_rev_parse(int argc, continue; } if (!strcmp(arg, "--show-ref-format") || !strcmp(arg, "--show-ref-storage-format")) { - puts(ref_storage_format_to_name(the_repository->ref_storage_format)); + const char *format = ref_storage_format_to_name(the_repository->ref_storage_format); + if (the_repository->ref_storage_payload) + printf("%s://%s\n", format, the_repository->ref_storage_payload); + else + puts(format); continue; } if (!strcmp(arg, "--show-object-storage-format")) { diff --git a/t/t1500-rev-parse.sh b/t/t1500-rev-parse.sh index 30bf8a4d0a0..c4e6bc1dd89 100755 --- a/t/t1500-rev-parse.sh +++ b/t/t1500-rev-parse.sh @@ -209,6 +209,7 @@ test_expect_success 'rev-parse --show-object-format in repo' ' test_expect_success RUST 'rev-parse --show-object-format in repo with compat mode' ' + test_when_finished "rm -rf repo" && mkdir repo && ( sane_unset GIT_DEFAULT_HASH && @@ -247,6 +248,14 @@ test_expect_success 'rev-parse --show-ref-storage-format' ' test_cmp expect actual ' +test_expect_success 'rev-parse --show-ref-storage-format with payload' ' + test_when_finished "rm -rf repo" && + git init repo --ref-storage-format="files://$(pwd)/refdir" && + git -C repo rev-parse --show-ref-storage-format >actual && + echo "files://$(pwd)/refdir" >expect && + test_cmp expect actual +' + test_expect_success 'rev-parse --show-ref-storage-format with invalid storage' ' test_when_finished "rm -rf repo" && git init repo &&
-- 2.56.0.500.g5d06dc02cd.dirty