git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[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
Previous: Patrick SteinhardtNext: Karthik Nayak
Message 7 of 13 in “Improvements for storage format handling”
  1. 0/5 Improvements for storage format handlingPatrick Steinhardt, Nov 5, 2026
  2. 1/5 refs: create leading directoriesPatrick Steinhardt, Nov 5, 2026
  3. Karthik NayakNov 6, 2026
  4. Patrick SteinhardtNov 6, 2026
  5. 2/5 odb/files: create leading directoriesPatrick Steinhardt, Nov 5, 2026
  6. 3/5 setup: allow speciyfing payloads with default storage formatsPatrick Steinhardt, Nov 5, 2026
  7. 4/5 builtin/rev-parse: print payload for the ref storage formatPatrick Steinhardt, Nov 5, 2026
  8. Karthik NayakNov 6, 2026
  9. 5/5 t: allow testing with a non-default object storage foramtPatrick Steinhardt, Nov 5, 2026
  10. Junio C HamanoNov 6, 2026
  11. Patrick SteinhardtNov 9, 2026
  12. Karthik NayakNov 6, 2026
  13. Patrick SteinhardtNov 6, 2026

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.