All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/11] Fix inconsistent ref storage format terminology
@ 2026-09-04 10:36 Patrick Steinhardt
  2026-09-04 10:36 ` [PATCH 01/11] builtin/init: rename "--ref-format=" to "--ref-storage=" Patrick Steinhardt
                   ` (14 more replies)
  0 siblings, 15 replies; 61+ messages in thread
From: Patrick Steinhardt @ 2026-09-04 10:36 UTC (permalink / raw)
  To: git; +Cc: Karthik Nayak

Hi,

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 a lot of 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 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=reftable --object-format=sha256 --object-storage=foo`
    just feels extremely awkward.

So this patch series aims to clean up this huge mess that we (well, to a
large extent I) have created, by bringing consistency to our command
line switches, environment variables and config options to all use "ref
storage" instead. And that also paves the way for the eventual "object
storage" switches.

As a cherry on top, this patch series also extends the "--ref-storage="
switch to allow URIs in the form of "files://foo/bar" to bring it in
line with all the other ways to specify the ref storage format that
already allow for URIs.

Thanks!

Patrick

---
Patrick Steinhardt (11):
      builtin/init: rename "--ref-format=" to "--ref-storage="
      builtin/clone: rename "--ref-format=" to "--ref-storage="
      builtin/refs: rename "--ref-format=" to "--ref-storage="
      builtin/submodule: rename "--ref-format=" to "--ref-storage="
      builtin/rev-parse: rename "--show-ref-format" to "--show-ref-storage"
      help: rename "default-ref-format" to "default-ref-storage"
      refs: expose function to parse reference URIs
      setup: refactor how we configure the ref storage format
      setup: rename ref storage format environment variables
      setup: rename "init.defaultRefFormat" to "init.defaultRefStorage"
      setup: allow "git init --ref-storage=" to specify a payload

 Documentation/BreakingChanges.adoc     |   2 +-
 Documentation/config/feature.adoc      |   2 +-
 Documentation/config/init.adoc         |   6 +-
 Documentation/git-clone.adoc           |   2 +-
 Documentation/git-init.adoc            |   9 +-
 Documentation/git-refs.adoc            |   6 +-
 Documentation/git-rev-parse.adoc       |   2 +-
 Documentation/git-submodule.adoc       |   8 +-
 Documentation/git.adoc                 |   8 +-
 Documentation/ref-storage-format.adoc  |   8 +-
 builtin/clone.c                        |  18 ++--
 builtin/fetch.c                        |   2 +-
 builtin/init-db.c                      |  19 ++--
 builtin/refs.c                         |  11 ++-
 builtin/rev-parse.c                    |   2 +-
 builtin/submodule--helper.c            |  24 +++--
 contrib/completion/git-prompt.sh       |   2 +-
 environment.h                          |   1 +
 git-submodule.sh                       |  20 ++--
 help.c                                 |   2 +-
 refs.c                                 |  23 +++++
 refs.h                                 |   4 +
 setup.c                                | 162 ++++++++++++++++++---------------
 setup.h                                |   2 +-
 t/perf/p1401-ref-store-tombstones.sh   |   4 +-
 t/perf/perf-lib.sh                     |   4 +-
 t/t0001-init.sh                        | 126 +++++++++++++------------
 t/t0610-reftable-basics.sh             |  34 +++----
 t/t0611-reftable-httpd.sh              |   2 +-
 t/t1400-update-ref.sh                  |   2 +-
 t/t1419-exclude-refs.sh                |  16 ++--
 t/t1423-ref-backend.sh                 |  62 +++++++++----
 t/t1460-refs-migrate.sh                |  54 +++++------
 t/t1500-rev-parse.sh                   |   8 +-
 t/t1900-repo-info.sh                   |   6 +-
 t/t5510-fetch.sh                       |  14 +--
 t/t5601-clone.sh                       |   6 +-
 t/t7424-submodule-mixed-ref-formats.sh |  30 +++---
 t/test-lib.sh                          |   8 +-
 39 files changed, 407 insertions(+), 314 deletions(-)


---
base-commit: 3cb9185f65410273787f74333cc027d2ea5daada
change-id: 20260904-b4-pks-unify-ref-storage-format-0c81fb038671


^ permalink raw reply	[flat|nested] 61+ messages in thread

* [PATCH 01/11] builtin/init: rename "--ref-format=" to "--ref-storage="
  2026-09-04 10:36 [PATCH 00/11] Fix inconsistent ref storage format terminology Patrick Steinhardt
@ 2026-09-04 10:36 ` Patrick Steinhardt
  2026-09-04 13:05   ` Karthik Nayak
  2026-09-04 10:36 ` [PATCH 02/11] builtin/clone: " Patrick Steinhardt
                   ` (13 subsequent siblings)
  14 siblings, 1 reply; 61+ messages in thread
From: Patrick Steinhardt @ 2026-09-04 10:36 UTC (permalink / raw)
  To: git; +Cc: Karthik Nayak

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 "ref storage" 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>
---
 Documentation/config/init.adoc         |  2 +-
 Documentation/git-init.adoc            |  4 ++--
 Documentation/git.adoc                 |  2 +-
 builtin/init-db.c                      | 16 ++++++++-------
 t/perf/p1401-ref-store-tombstones.sh   |  4 ++--
 t/perf/perf-lib.sh                     |  2 +-
 t/t0001-init.sh                        | 24 +++++++++++------------
 t/t0610-reftable-basics.sh             | 14 ++++++-------
 t/t0611-reftable-httpd.sh              |  2 +-
 t/t1400-update-ref.sh                  |  2 +-
 t/t1423-ref-backend.sh                 |  6 +++---
 t/t1460-refs-migrate.sh                | 36 +++++++++++++++++-----------------
 t/t1900-repo-info.sh                   |  6 +++---
 t/t5510-fetch.sh                       |  8 ++++----
 t/t7424-submodule-mixed-ref-formats.sh |  2 +-
 15 files changed, 66 insertions(+), 64 deletions(-)

diff --git a/Documentation/config/init.adoc b/Documentation/config/init.adoc
index 7b4abdaf8b..9c78440192 100644
--- a/Documentation/config/init.adoc
+++ b/Documentation/config/init.adoc
@@ -15,7 +15,7 @@ endif::[]
 	this config.
 `init.defaultRefFormat`::
 	Allows overriding the default ref storage format for new repositories.
-	See `--ref-format=` in linkgit:git-init[1]. Both the command line
+	See `--ref-storage=` in linkgit:git-init[1]. Both the command line
 	option and the `GIT_DEFAULT_REF_FORMAT` environment variable take
 	precedence over this config.
 
diff --git a/Documentation/git-init.adoc b/Documentation/git-init.adoc
index bab99b9b47..54cff89dfe 100644
--- a/Documentation/git-init.adoc
+++ b/Documentation/git-init.adoc
@@ -11,7 +11,7 @@ SYNOPSIS
 [synopsis]
 git init [-q | --quiet] [--bare] [--template=<template-directory>]
 	 [--separate-git-dir <git-dir>] [--object-format=<format>]
-	 [--ref-format=<format>]
+	 [--ref-storage=<format>]
 	 [-b <branch-name> | --initial-branch=<branch-name>]
 	 [--shared[=<permissions>]] [<directory>]
 
@@ -57,7 +57,7 @@ values are `sha1` and (if enabled) `sha256`.  `sha1` is the default.
 +
 include::object-format-disclaimer.adoc[]
 
-`--ref-format=<format>`::
+`--ref-storage=<format>`::
 Specify the given ref storage _<format>_ for the repository. The valid values are:
 +
 include::ref-storage-format.adoc[]
diff --git a/Documentation/git.adoc b/Documentation/git.adoc
index 8a5cdd3b3d..e3260fde68 100644
--- a/Documentation/git.adoc
+++ b/Documentation/git.adoc
@@ -593,7 +593,7 @@ double-quotes and respecting backslash escapes. E.g., the value
 `GIT_DEFAULT_REF_FORMAT`::
 	If this variable is set, the default reference backend format for new
 	repositories will be set to this value. The default is "files".
-	See `--ref-format` in linkgit:git-init[1].
+	See `--ref-storage` in linkgit:git-init[1].
 
 `GIT_REFERENCE_BACKEND`::
     Specify which reference backend to be used along with its URI.
diff --git a/builtin/init-db.c b/builtin/init-db.c
index e96b1283b7..763ee47d21 100644
--- a/builtin/init-db.c
+++ b/builtin/init-db.c
@@ -57,7 +57,7 @@ static int shared_callback(const struct option *opt, const char *arg, int unset)
 static const char *const init_db_usage[] = {
 	N_("git init [-q | --quiet] [--bare] [--template=<template-directory>]\n"
 	   "         [--separate-git-dir <git-dir>] [--object-format=<format>]\n"
-	   "         [--ref-format=<format>]\n"
+	   "         [--ref-storage=<format>]\n"
 	   "         [-b <branch-name> | --initial-branch=<branch-name>]\n"
 	   "         [--shared[=<permissions>]] [<directory>]"),
 	NULL
@@ -83,7 +83,7 @@ int cmd_init_db(int argc,
 	unsigned int flags = 0;
 	int bare = startup_info->force_bare_repository ? 1 : -1;
 	const char *object_format = NULL;
-	const char *ref_format = NULL;
+	const char *ref_storage = NULL;
 	const char *initial_branch = NULL;
 	int hash_algo = GIT_HASH_UNKNOWN;
 	enum ref_storage_format ref_storage_format = REF_STORAGE_FORMAT_UNKNOWN;
@@ -109,8 +109,10 @@ int cmd_init_db(int argc,
 			   N_("override the name of the initial branch")),
 		OPT_STRING(0, "object-format", &object_format, N_("hash"),
 			   N_("specify the hash algorithm to use")),
-		OPT_STRING(0, "ref-format", &ref_format, N_("format"),
-			   N_("specify the reference format to use")),
+		OPT_STRING(0, "ref-storage", &ref_storage, N_("format"),
+			   N_("specify the reference storage format to use")),
+		OPT_STRING_F(0, "ref-format", &ref_storage, N_("format"),
+			   N_("specify the reference storage format to use"), PARSE_OPT_HIDDEN),
 		OPT_END()
 	};
 	int ret;
@@ -173,10 +175,10 @@ int cmd_init_db(int argc,
 			die(_("unknown hash algorithm '%s'"), object_format);
 	}
 
-	if (ref_format) {
-		ref_storage_format = ref_storage_format_by_name(ref_format);
+	if (ref_storage) {
+		ref_storage_format = ref_storage_format_by_name(ref_storage);
 		if (ref_storage_format == REF_STORAGE_FORMAT_UNKNOWN)
-			die(_("unknown ref storage format '%s'"), ref_format);
+			die(_("unknown ref storage format '%s'"), ref_storage);
 	}
 
 	if (init_shared_repository != -1)
diff --git a/t/perf/p1401-ref-store-tombstones.sh b/t/perf/p1401-ref-store-tombstones.sh
index 9e3d8031aa..72db3c80fc 100755
--- a/t/perf/p1401-ref-store-tombstones.sh
+++ b/t/perf/p1401-ref-store-tombstones.sh
@@ -5,7 +5,7 @@ test_description="Tests performance of ref operations with many tombstones"
 . ./perf-lib.sh
 
 test_expect_success "setup" '
-	git init --ref-format=reftable repo &&
+	git init --ref-storage=reftable repo &&
 	blob=$(echo foo | git -C repo hash-object -w --stdin) &&
 	for i in $(test_seq 8000)
 	do
@@ -24,7 +24,7 @@ test_perf "recreate refs after mass delete" '
 '
 
 test_expect_success "setup asymmetric" '
-	git init --ref-format=reftable repo2 &&
+	git init --ref-storage=reftable repo2 &&
 	blob=$(echo foo | git -C repo2 hash-object -w --stdin) &&
 	for i in $(test_seq 8000)
 	do
diff --git a/t/perf/perf-lib.sh b/t/perf/perf-lib.sh
index 2ac007888e..50a35545a1 100644
--- a/t/perf/perf-lib.sh
+++ b/t/perf/perf-lib.sh
@@ -153,7 +153,7 @@ test_perf_create_repo_from () {
 	) &&
 	(
 		cd "$repo" &&
-		"$MODERN_GIT" init -q --ref-format="$refformat" --object-format="$objectformat" &&
+		"$MODERN_GIT" init -q --ref-storage="$refformat" --object-format="$objectformat" &&
 		test_perf_do_repo_symlink_config_ &&
 		mv .git/hooks .git/hooks-disabled 2>/dev/null &&
 		if test -f .git/index.lock
diff --git a/t/t0001-init.sh b/t/t0001-init.sh
index 5cf2e5a35a..bb3ec31097 100755
--- a/t/t0001-init.sh
+++ b/t/t0001-init.sh
@@ -696,9 +696,9 @@ do
 		test_cmp expect actual
 	'
 
-	test_expect_success "init with --ref-format=$format" '
+	test_expect_success "init with --ref-storage=$format" '
 		test_when_finished "rm -rf refformat" &&
-		git init --ref-format=$format refformat &&
+		git init --ref-storage=$format refformat &&
 		echo $format >expect &&
 		git -C refformat rev-parse --show-ref-format >actual &&
 		test_cmp expect actual
@@ -717,9 +717,9 @@ do
 		test_cmp expect actual
 	'
 
-	test_expect_success "--ref-format=$format overrides GIT_DEFAULT_REF_FORMAT" '
+	test_expect_success "--ref-storage=$format overrides GIT_DEFAULT_REF_FORMAT" '
 		test_when_finished "rm -rf refformat" &&
-		GIT_DEFAULT_REF_FORMAT=garbage git init --ref-format=$format refformat &&
+		GIT_DEFAULT_REF_FORMAT=garbage git init --ref-storage=$format refformat &&
 		echo $format >expect &&
 		git -C refformat rev-parse --show-ref-format >actual &&
 		test_cmp expect actual
@@ -735,9 +735,9 @@ do
 	'
 done
 
-test_expect_success "--ref-format= overrides GIT_DEFAULT_REF_FORMAT" '
+test_expect_success "--ref-storage= overrides GIT_DEFAULT_REF_FORMAT" '
 	test_when_finished "rm -rf refformat" &&
-	GIT_DEFAULT_REF_FORMAT=files git init --ref-format=reftable refformat &&
+	GIT_DEFAULT_REF_FORMAT=files git init --ref-storage=reftable refformat &&
 	echo reftable >expect &&
 	git -C refformat rev-parse --show-ref-format >actual &&
 	test_cmp expect actual
@@ -791,8 +791,8 @@ for from_format in $backends
 do
 	test_expect_success "re-init with same format ($from_format)" '
 		test_when_finished "rm -rf refformat" &&
-		git init --ref-format=$from_format refformat &&
-		git init --ref-format=$from_format refformat &&
+		git init --ref-storage=$from_format refformat &&
+		git init --ref-storage=$from_format refformat &&
 		echo $from_format >expect &&
 		git -C refformat rev-parse --show-ref-format >actual &&
 		test_cmp expect actual
@@ -807,11 +807,11 @@ do
 
 		test_expect_success "re-init with different format fails ($from_format -> $to_format)" '
 			test_when_finished "rm -rf refformat" &&
-			git init --ref-format=$from_format refformat &&
+			git init --ref-storage=$from_format refformat &&
 			cat >expect <<-EOF &&
 			fatal: attempt to reinitialize repository with different reference storage format
 			EOF
-			test_must_fail git init --ref-format=$to_format refformat 2>err &&
+			test_must_fail git init --ref-storage=$to_format refformat 2>err &&
 			test_cmp expect err &&
 			echo $from_format >expect &&
 			git -C refformat rev-parse --show-ref-format >actual &&
@@ -820,12 +820,12 @@ do
 	done
 done
 
-test_expect_success 'init with --ref-format=garbage' '
+test_expect_success 'init with --ref-storage=garbage' '
 	test_when_finished "rm -rf refformat" &&
 	cat >expect <<-EOF &&
 	fatal: unknown ref storage format ${SQ}garbage${SQ}
 	EOF
-	test_must_fail git init --ref-format=garbage refformat 2>err &&
+	test_must_fail git init --ref-storage=garbage refformat 2>err &&
 	test_cmp expect err
 '
 
diff --git a/t/t0610-reftable-basics.sh b/t/t0610-reftable-basics.sh
index 35e98b43db..4a83e1ce56 100755
--- a/t/t0610-reftable-basics.sh
+++ b/t/t0610-reftable-basics.sh
@@ -59,28 +59,28 @@ test_expect_success 'init: reinitializing reftable backend succeeds' '
 	test_commit -C repo A &&
 
 	git -C repo for-each-ref >expect &&
-	git init --ref-format=reftable repo &&
+	git init --ref-storage=reftable repo &&
 	git -C repo for-each-ref >actual &&
 	test_cmp expect actual
 '
 
 test_expect_success 'init: reinitializing files with reftable backend fails' '
 	test_when_finished "rm -rf repo" &&
-	git init --ref-format=files repo &&
+	git init --ref-storage=files repo &&
 	test_commit -C repo file &&
 
 	cp repo/.git/HEAD expect &&
-	test_must_fail git init --ref-format=reftable repo &&
+	test_must_fail git init --ref-storage=reftable repo &&
 	test_cmp expect repo/.git/HEAD
 '
 
 test_expect_success 'init: reinitializing reftable with files backend fails' '
 	test_when_finished "rm -rf repo" &&
-	git init --ref-format=reftable repo &&
+	git init --ref-storage=reftable repo &&
 	test_commit -C repo file &&
 
 	cp repo/.git/HEAD expect &&
-	test_must_fail git init --ref-format=files repo &&
+	test_must_fail git init --ref-storage=files repo &&
 	test_cmp expect repo/.git/HEAD
 '
 
@@ -163,7 +163,7 @@ test_expect_success 'clone: can clone reftable repository' '
 
 test_expect_success 'clone: can clone reffiles into reftable repository' '
 	test_when_finished "rm -rf reffiles reftable" &&
-	git init --ref-format=files reffiles &&
+	git init --ref-storage=files reffiles &&
 	test_commit -C reffiles A &&
 	git clone --ref-format=reftable ./reffiles reftable &&
 
@@ -182,7 +182,7 @@ test_expect_success 'clone: can clone reffiles into reftable repository' '
 
 test_expect_success 'clone: can clone reftable into reffiles repository' '
 	test_when_finished "rm -rf reffiles reftable" &&
-	git init --ref-format=reftable reftable &&
+	git init --ref-storage=reftable reftable &&
 	test_commit -C reftable A &&
 	git clone --ref-format=files ./reftable reffiles &&
 
diff --git a/t/t0611-reftable-httpd.sh b/t/t0611-reftable-httpd.sh
index 5e05b9c1f2..3f0c4acf56 100755
--- a/t/t0611-reftable-httpd.sh
+++ b/t/t0611-reftable-httpd.sh
@@ -10,7 +10,7 @@ start_httpd
 REPO="$HTTPD_DOCUMENT_ROOT_PATH/repo"
 
 test_expect_success 'serving ls-remote' '
-	git init --ref-format=reftable -b main "$REPO" &&
+	git init --ref-storage=reftable -b main "$REPO" &&
 	cd "$REPO" &&
 	test_commit m1 &&
 	>.git/git-daemon-export-ok &&
diff --git a/t/t1400-update-ref.sh b/t/t1400-update-ref.sh
index 269fdaa3ed..7cc6f2e3e8 100755
--- a/t/t1400-update-ref.sh
+++ b/t/t1400-update-ref.sh
@@ -2361,7 +2361,7 @@ do
 	'
 
 	test_expect_success CASE_INSENSITIVE_FS "stdin $type batch-updates existing reference" '
-		git init --ref-format=reftable repo &&
+		git init --ref-storage=reftable repo &&
 		test_when_finished "rm -fr repo" &&
 		(
 			cd repo &&
diff --git a/t/t1423-ref-backend.sh b/t/t1423-ref-backend.sh
index fd47d77e8e..26a3655058 100755
--- a/t/t1423-ref-backend.sh
+++ b/t/t1423-ref-backend.sh
@@ -137,7 +137,7 @@ do
 
 		test_expect_success "$method: read from $to_format backend, $dir dir" '
 			test_when_finished "rm -rf repo" &&
-			git init --ref-format=$from_format repo &&
+			git init --ref-storage=$from_format repo &&
 			(
 				cd repo &&
 				test_commit 1 &&
@@ -152,7 +152,7 @@ do
 
 		test_expect_success "$method: write to $to_format backend, $dir dir" '
 			test_when_finished "rm -rf repo" &&
-			git init --ref-format=$from_format repo &&
+			git init --ref-storage=$from_format repo &&
 			(
 				cd repo &&
 				test_commit 1 &&
@@ -179,7 +179,7 @@ do
 
 		test_expect_success "$method: with worktree and $to_format backend, $dir dir" '
 			test_when_finished "rm -rf repo wt" &&
-			git init --ref-format=$from_format repo &&
+			git init --ref-storage=$from_format repo &&
 			(
 				cd repo &&
 				test_commit 1 &&
diff --git a/t/t1460-refs-migrate.sh b/t/t1460-refs-migrate.sh
index 8f42697143..fc04bb7c70 100755
--- a/t/t1460-refs-migrate.sh
+++ b/t/t1460-refs-migrate.sh
@@ -105,7 +105,7 @@ do
 
 		test_expect_success "$from_format: migration to same format fails" '
 			test_when_finished "rm -rf repo" &&
-			git init --ref-format=$from_format repo &&
+			git init --ref-storage=$from_format repo &&
 			test_must_fail git -C repo refs migrate \
 				--ref-format=$from_format 2>err &&
 			cat >expect <<-EOF &&
@@ -116,7 +116,7 @@ do
 
 		test_expect_success "$from_format -> $to_format: migration with worktree fails" '
 			test_when_finished "rm -rf repo" &&
-			git init --ref-format=$from_format repo &&
+			git init --ref-storage=$from_format repo &&
 			git -C repo worktree add wt &&
 			test_must_fail git -C repo refs migrate \
 				--ref-format=$to_format 2>err &&
@@ -128,20 +128,20 @@ do
 
 		test_expect_success "$from_format -> $to_format: unborn HEAD" '
 			test_when_finished "rm -rf repo" &&
-			git init --ref-format=$from_format repo &&
+			git init --ref-storage=$from_format repo &&
 			test_migration repo "$to_format"
 		'
 
 		test_expect_success "$from_format -> $to_format: single ref" '
 			test_when_finished "rm -rf repo" &&
-			git init --ref-format=$from_format repo &&
+			git init --ref-storage=$from_format repo &&
 			test_commit -C repo initial &&
 			test_migration repo "$to_format"
 		'
 
 		test_expect_success "$from_format -> $to_format: bare repository" '
 			test_when_finished "rm -rf repo repo.git" &&
-			git init --ref-format=$from_format repo &&
+			git init --ref-storage=$from_format repo &&
 			test_commit -C repo initial &&
 			git clone --ref-format=$from_format --mirror repo repo.git &&
 			test_migration repo.git "$to_format"
@@ -149,7 +149,7 @@ do
 
 		test_expect_success "$from_format -> $to_format: dangling symref" '
 			test_when_finished "rm -rf repo" &&
-			git init --ref-format=$from_format repo &&
+			git init --ref-storage=$from_format repo &&
 			test_commit -C repo initial &&
 			git -C repo symbolic-ref BROKEN_HEAD refs/heads/nonexistent &&
 			test_migration repo "$to_format" &&
@@ -160,7 +160,7 @@ do
 
 		test_expect_success "$from_format -> $to_format: broken ref" '
 			test_when_finished "rm -rf repo" &&
-			git init --ref-format=$from_format repo &&
+			git init --ref-storage=$from_format repo &&
 			test_commit -C repo initial &&
 			test-tool -C repo ref-store main update-ref "" refs/heads/broken \
 				"$(test_oid 001)" "$ZERO_OID" REF_SKIP_CREATE_REFLOG,REF_SKIP_OID_VERIFICATION &&
@@ -172,7 +172,7 @@ do
 
 		test_expect_success "$from_format -> $to_format: pseudo-refs" '
 			test_when_finished "rm -rf repo" &&
-			git init --ref-format=$from_format repo &&
+			git init --ref-storage=$from_format repo &&
 			test_commit -C repo initial &&
 			git -C repo update-ref FOO_HEAD HEAD &&
 			test_migration repo "$to_format"
@@ -180,7 +180,7 @@ do
 
 		test_expect_success "$from_format -> $to_format: special refs are left alone" '
 			test_when_finished "rm -rf repo" &&
-			git init --ref-format=$from_format repo &&
+			git init --ref-storage=$from_format repo &&
 			test_commit -C repo initial &&
 			git -C repo rev-parse HEAD >repo/.git/MERGE_HEAD &&
 			git -C repo rev-parse MERGE_HEAD &&
@@ -190,7 +190,7 @@ do
 
 		test_expect_success "$from_format -> $to_format: a bunch of refs" '
 			test_when_finished "rm -rf repo" &&
-			git init --ref-format=$from_format repo &&
+			git init --ref-storage=$from_format repo &&
 
 			test_commit -C repo initial &&
 			cat >input <<-EOF &&
@@ -208,7 +208,7 @@ do
 
 		test_expect_success "$from_format -> $to_format: dry-run migration does not modify repository" '
 			test_when_finished "rm -rf repo" &&
-			git init --ref-format=$from_format repo &&
+			git init --ref-storage=$from_format repo &&
 			test_commit -C repo initial &&
 			git -C repo refs migrate --dry-run \
 				--ref-format=$to_format >output &&
@@ -221,7 +221,7 @@ do
 
 		test_expect_success "$from_format -> $to_format: reflogs of symrefs with target deleted" '
 			test_when_finished "rm -rf repo" &&
-			git init --ref-format=$from_format repo &&
+			git init --ref-storage=$from_format repo &&
 			test_commit -C repo initial &&
 			git -C repo branch branch-1 HEAD &&
 			git -C repo symbolic-ref refs/heads/symref refs/heads/branch-1 &&
@@ -234,7 +234,7 @@ do
 
 		test_expect_success "$from_format -> $to_format: reflogs order is retained" '
 			test_when_finished "rm -rf repo" &&
-			git init --ref-format=$from_format repo &&
+			git init --ref-storage=$from_format repo &&
 			test_commit --date "100005000 +0700" --no-tag -C repo initial &&
 			test_commit --date "100003000 +0700" --no-tag -C repo second &&
 			test_migration repo "$to_format"
@@ -242,7 +242,7 @@ do
 
 		test_expect_success "$from_format -> $to_format: stash is retained" '
 			test_when_finished "rm -rf repo" &&
-			git init --ref-format=$from_format repo &&
+			git init --ref-storage=$from_format repo &&
 			(
 				cd repo &&
 				test_commit initial A &&
@@ -259,7 +259,7 @@ do
 
 		test_expect_success "$from_format -> $to_format: skip reflog with --skip-reflog" '
 			test_when_finished "rm -rf repo" &&
-			git init --ref-format=$from_format repo &&
+			git init --ref-storage=$from_format repo &&
 			test_commit -C repo initial &&
 			# we see that the repository contains reflogs.
 			git -C repo reflog --all >reflogs &&
@@ -274,7 +274,7 @@ done
 
 test_expect_success 'multiple reftable blocks with multiple entries' '
 	test_when_finished "rm -rf repo" &&
-	git init --ref-format=files repo &&
+	git init --ref-storage=files repo &&
 	test_commit -C repo first &&
 	test_seq -f "create refs/heads/ref-%d HEAD" 5000 |
 	git -C repo update-ref --stdin &&
@@ -286,7 +286,7 @@ test_expect_success 'multiple reftable blocks with multiple entries' '
 
 test_expect_success 'migrating from files format deletes backend files' '
 	test_when_finished "rm -rf repo" &&
-	git init --ref-format=files repo &&
+	git init --ref-storage=files repo &&
 	test_commit -C repo first &&
 	git -C repo pack-refs --all &&
 	test_commit -C repo second &&
@@ -313,7 +313,7 @@ test_expect_success 'migrating from files format deletes backend files' '
 
 test_expect_success 'migrating from reftable format deletes backend files' '
 	test_when_finished "rm -rf repo" &&
-	git init --ref-format=reftable repo &&
+	git init --ref-storage=reftable repo &&
 	test_commit -C repo first &&
 
 	test_path_is_dir repo/.git/reftable &&
diff --git a/t/t1900-repo-info.sh b/t/t1900-repo-info.sh
index c85d390f43..db5ed71818 100755
--- a/t/t1900-repo-info.sh
+++ b/t/t1900-repo-info.sh
@@ -39,10 +39,10 @@ test_repo_info () {
 }
 
 test_repo_info 'ref format files is retrieved correctly' \
-	'git init --ref-format=files' 'format-files' 'references.format' 'files'
+	'git init --ref-storage=files' 'format-files' 'references.format' 'files'
 
 test_repo_info 'ref format reftable is retrieved correctly' \
-	'git init --ref-format=reftable' 'format-reftable' 'references.format' 'reftable'
+	'git init --ref-storage=reftable' 'format-reftable' 'references.format' 'reftable'
 
 test_repo_info 'bare repository = false is retrieved correctly' \
 	'git init' 'nonbare' 'layout.bare' 'false'
@@ -75,7 +75,7 @@ test_expect_success 'values returned in order requested' '
 	references.format=files
 	layout.bare=false
 	EOF
-	git init --ref-format=files ordered &&
+	git init --ref-storage=files ordered &&
 	git -C ordered repo info layout.bare references.format layout.bare >actual &&
 	test_cmp expect actual
 '
diff --git a/t/t5510-fetch.sh b/t/t5510-fetch.sh
index a8d38d9176..1b239f4f22 100755
--- a/t/t5510-fetch.sh
+++ b/t/t5510-fetch.sh
@@ -1803,7 +1803,7 @@ test_expect_success CASE_INSENSITIVE_FS,REFFILES 'existing references in a case
 test_expect_success REFFILES 'existing reference lock in repo' '
 	test_when_finished rm -rf base repo &&
 	(
-		git init --ref-format=reftable base &&
+		git init --ref-storage=reftable base &&
 		cd base &&
 		echo >file update &&
 		git add . &&
@@ -1814,7 +1814,7 @@ test_expect_success REFFILES 'existing reference lock in repo' '
 		git update-ref refs/heads/branch @ &&
 		cd .. &&
 
-		git init --ref-format=files --bare repo &&
+		git init --ref-storage=files --bare repo &&
 		cd repo &&
 		git remote add origin ../base &&
 		touch refs/heads/foo.lock &&
@@ -1857,7 +1857,7 @@ test_expect_success CASE_INSENSITIVE_FS,REFFILES 'D/F conflict on case insensiti
 test_expect_success REFFILES 'D/F conflict on case sensitive filesystem with lock' '
 	test_when_finished rm -rf base repo &&
 	(
-		git init --ref-format=reftable base &&
+		git init --ref-storage=reftable base &&
 		cd base &&
 		echo >file update &&
 		git add . &&
@@ -1868,7 +1868,7 @@ test_expect_success REFFILES 'D/F conflict on case sensitive filesystem with loc
 		git update-ref refs/heads/branch @ &&
 		cd .. &&
 
-		git init --ref-format=files --bare repo &&
+		git init --ref-storage=files --bare repo &&
 		cd repo &&
 		git remote add origin ../base &&
 		mkdir refs/heads/foo &&
diff --git a/t/t7424-submodule-mixed-ref-formats.sh b/t/t7424-submodule-mixed-ref-formats.sh
index 559713b607..d6ea84bb90 100755
--- a/t/t7424-submodule-mixed-ref-formats.sh
+++ b/t/t7424-submodule-mixed-ref-formats.sh
@@ -31,7 +31,7 @@ test_expect_success 'add existing repository with different ref storage format'
 	(
 		cd parent &&
 		test_commit parent &&
-		git init --ref-format=$OTHER_FORMAT submodule &&
+		git init --ref-storage=$OTHER_FORMAT submodule &&
 		test_commit -C submodule submodule &&
 		git submodule add ./submodule
 	)

-- 
2.55.0.1007.g17ff1f9808.dirty


^ permalink raw reply related	[flat|nested] 61+ messages in thread

* [PATCH 02/11] builtin/clone: rename "--ref-format=" to "--ref-storage="
  2026-09-04 10:36 [PATCH 00/11] Fix inconsistent ref storage format terminology Patrick Steinhardt
  2026-09-04 10:36 ` [PATCH 01/11] builtin/init: rename "--ref-format=" to "--ref-storage=" Patrick Steinhardt
@ 2026-09-04 10:36 ` Patrick Steinhardt
  2026-09-04 10:36 ` [PATCH 03/11] builtin/refs: " Patrick Steinhardt
                   ` (12 subsequent siblings)
  14 siblings, 0 replies; 61+ messages in thread
From: Patrick Steinhardt @ 2026-09-04 10:36 UTC (permalink / raw)
  To: git; +Cc: Karthik Nayak

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

Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
 Documentation/git-clone.adoc           |  2 +-
 builtin/clone.c                        | 14 ++++++++------
 t/t0610-reftable-basics.sh             |  4 ++--
 t/t1460-refs-migrate.sh                |  2 +-
 t/t5510-fetch.sh                       |  6 +++---
 t/t5601-clone.sh                       |  4 ++--
 t/t7424-submodule-mixed-ref-formats.sh |  4 ++--
 7 files changed, 19 insertions(+), 17 deletions(-)

diff --git a/Documentation/git-clone.adoc b/Documentation/git-clone.adoc
index b6e1f8ada2..57e2bda044 100644
--- a/Documentation/git-clone.adoc
+++ b/Documentation/git-clone.adoc
@@ -348,7 +348,7 @@ or `--mirror` is given)
 	The result is Git repository can be separated from working
 	tree.
 
-`--ref-format=<ref-format>`::
+`--ref-storage=<ref-format>`::
 
 Specify the given ref storage format for the repository. The valid values are:
 +
diff --git a/builtin/clone.c b/builtin/clone.c
index 5b25cca510..63bd7b795d 100644
--- a/builtin/clone.c
+++ b/builtin/clone.c
@@ -901,7 +901,7 @@ int cmd_clone(int argc,
 	char *option_origin = NULL;
 	struct string_list option_not = STRING_LIST_INIT_NODUP;
 	const char *real_git_dir = NULL;
-	const char *ref_format = NULL;
+	const char *ref_storage = NULL;
 	const char *option_upload_pack = "git-upload-pack";
 	int option_progress = -1;
 	int option_sparse_checkout = 0;
@@ -981,8 +981,10 @@ int cmd_clone(int argc,
 			 N_("any cloned submodules will be shallow")),
 		OPT_STRING(0, "separate-git-dir", &real_git_dir, N_("gitdir"),
 			   N_("separate git dir from working tree")),
-		OPT_STRING(0, "ref-format", &ref_format, N_("format"),
-			   N_("specify the reference format to use")),
+		OPT_STRING(0, "ref-storage", &ref_storage, N_("format"),
+			   N_("specify the reference storage format to use")),
+		OPT_STRING_F(0, "ref-format", &ref_storage, N_("format"),
+			   N_("specify the reference storage format to use"), PARSE_OPT_HIDDEN),
 		OPT_STRING_LIST('c', "config", &option_config, N_("key=value"),
 				N_("set config inside the new repository")),
 		OPT_STRING_LIST(0, "server-option", &server_options,
@@ -1027,10 +1029,10 @@ int cmd_clone(int argc,
 	if (option_single_branch == -1)
 		option_single_branch = deepen ? 1 : 0;
 
-	if (ref_format) {
-		ref_storage_format = ref_storage_format_by_name(ref_format);
+	if (ref_storage) {
+		ref_storage_format = ref_storage_format_by_name(ref_storage);
 		if (ref_storage_format == REF_STORAGE_FORMAT_UNKNOWN)
-			die(_("unknown ref storage format '%s'"), ref_format);
+			die(_("unknown ref storage format '%s'"), ref_storage);
 	}
 
 	if (option_mirror) {
diff --git a/t/t0610-reftable-basics.sh b/t/t0610-reftable-basics.sh
index 4a83e1ce56..d367b4b787 100755
--- a/t/t0610-reftable-basics.sh
+++ b/t/t0610-reftable-basics.sh
@@ -165,7 +165,7 @@ test_expect_success 'clone: can clone reffiles into reftable repository' '
 	test_when_finished "rm -rf reffiles reftable" &&
 	git init --ref-storage=files reffiles &&
 	test_commit -C reffiles A &&
-	git clone --ref-format=reftable ./reffiles reftable &&
+	git clone --ref-storage=reftable ./reffiles reftable &&
 
 	git -C reffiles rev-parse HEAD >expect &&
 	git -C reftable rev-parse HEAD >actual &&
@@ -184,7 +184,7 @@ test_expect_success 'clone: can clone reftable into reffiles repository' '
 	test_when_finished "rm -rf reffiles reftable" &&
 	git init --ref-storage=reftable reftable &&
 	test_commit -C reftable A &&
-	git clone --ref-format=files ./reftable reffiles &&
+	git clone --ref-storage=files ./reftable reffiles &&
 
 	git -C reftable rev-parse HEAD >expect &&
 	git -C reffiles rev-parse HEAD >actual &&
diff --git a/t/t1460-refs-migrate.sh b/t/t1460-refs-migrate.sh
index fc04bb7c70..44ad24f16e 100755
--- a/t/t1460-refs-migrate.sh
+++ b/t/t1460-refs-migrate.sh
@@ -143,7 +143,7 @@ do
 			test_when_finished "rm -rf repo repo.git" &&
 			git init --ref-storage=$from_format repo &&
 			test_commit -C repo initial &&
-			git clone --ref-format=$from_format --mirror repo repo.git &&
+			git clone --ref-storage=$from_format --mirror repo repo.git &&
 			test_migration repo.git "$to_format"
 		'
 
diff --git a/t/t5510-fetch.sh b/t/t5510-fetch.sh
index 1b239f4f22..720157e6c5 100755
--- a/t/t5510-fetch.sh
+++ b/t/t5510-fetch.sh
@@ -46,19 +46,19 @@ test_expect_success "clone and setup child repos" '
 	) &&
 	git clone . bundle &&
 	git clone . seven &&
-	git clone --ref-format=reftable . case_sensitive &&
+	git clone --ref-storage=reftable . case_sensitive &&
 	(
 		cd case_sensitive &&
 		git branch branch1 &&
 		git branch bRanch1
 	) &&
-	git clone --ref-format=reftable . case_sensitive_fd &&
+	git clone --ref-storage=reftable . case_sensitive_fd &&
 	(
 		cd case_sensitive_fd &&
 		git branch foo/bar &&
 		git branch Foo
 	) &&
-	git clone --ref-format=reftable . case_sensitive_df &&
+	git clone --ref-storage=reftable . case_sensitive_df &&
 	(
 		cd case_sensitive_df &&
 		git branch Foo/bar &&
diff --git a/t/t5601-clone.sh b/t/t5601-clone.sh
index b6167582a1..88f359914f 100755
--- a/t/t5601-clone.sh
+++ b/t/t5601-clone.sh
@@ -166,7 +166,7 @@ test_expect_success 'clone --mirror does not repeat tags' '
 
 test_expect_success 'clone with files ref format' '
 	test_when_finished "rm -rf ref-storage" &&
-	git clone --ref-format=files --mirror src ref-storage &&
+	git clone --ref-storage=files --mirror src ref-storage &&
 	echo files >expect &&
 	git -C ref-storage rev-parse --show-ref-format >actual &&
 	test_cmp expect actual
@@ -176,7 +176,7 @@ test_expect_success 'clone with garbage ref format' '
 	cat >expect <<-EOF &&
 	fatal: unknown ref storage format ${SQ}garbage${SQ}
 	EOF
-	test_must_fail git clone --ref-format=garbage --mirror src ref-storage 2>err &&
+	test_must_fail git clone --ref-storage=garbage --mirror src ref-storage 2>err &&
 	test_cmp expect err &&
 	test_path_is_missing ref-storage
 '
diff --git a/t/t7424-submodule-mixed-ref-formats.sh b/t/t7424-submodule-mixed-ref-formats.sh
index d6ea84bb90..1adac7baed 100755
--- a/t/t7424-submodule-mixed-ref-formats.sh
+++ b/t/t7424-submodule-mixed-ref-formats.sh
@@ -63,9 +63,9 @@ test_expect_success 'recursive clone propagates ref storage format' '
 	test_ref_format upstream/submodule "$GIT_DEFAULT_REF_FORMAT" &&
 
 	# The cloned repositories should use the other ref format that we have
-	# specified via `--ref-format`. The option should propagate to cloned
+	# specified via `--ref-storage`. The option should propagate to cloned
 	# submodules.
-	git clone --ref-format=$OTHER_FORMAT --recurse-submodules \
+	git clone --ref-storage=$OTHER_FORMAT --recurse-submodules \
 		upstream downstream &&
 	test_ref_format downstream "$OTHER_FORMAT" &&
 	test_ref_format downstream/submodule "$OTHER_FORMAT"

-- 
2.55.0.1007.g17ff1f9808.dirty


^ permalink raw reply related	[flat|nested] 61+ messages in thread

* [PATCH 03/11] builtin/refs: rename "--ref-format=" to "--ref-storage="
  2026-09-04 10:36 [PATCH 00/11] Fix inconsistent ref storage format terminology Patrick Steinhardt
  2026-09-04 10:36 ` [PATCH 01/11] builtin/init: rename "--ref-format=" to "--ref-storage=" Patrick Steinhardt
  2026-09-04 10:36 ` [PATCH 02/11] builtin/clone: " Patrick Steinhardt
@ 2026-09-04 10:36 ` Patrick Steinhardt
  2026-09-04 10:36 ` [PATCH 04/11] builtin/submodule: " Patrick Steinhardt
                   ` (11 subsequent siblings)
  14 siblings, 0 replies; 61+ messages in thread
From: Patrick Steinhardt @ 2026-09-04 10:36 UTC (permalink / raw)
  To: git; +Cc: Karthik Nayak

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

Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
 Documentation/git-refs.adoc            |  6 +++---
 builtin/fetch.c                        |  2 +-
 builtin/refs.c                         | 11 +++++++----
 t/t1423-ref-backend.sh                 |  8 ++++----
 t/t1460-refs-migrate.sh                | 12 ++++++------
 t/t7424-submodule-mixed-ref-formats.sh |  2 +-
 6 files changed, 22 insertions(+), 19 deletions(-)

diff --git a/Documentation/git-refs.adoc b/Documentation/git-refs.adoc
index 9063892651..823dbd72c0 100644
--- a/Documentation/git-refs.adoc
+++ b/Documentation/git-refs.adoc
@@ -9,7 +9,7 @@ git-refs - Low-level access to refs
 SYNOPSIS
 --------
 [synopsis]
-git refs migrate --ref-format=<format> [--no-reflog] [--dry-run]
+git refs migrate --ref-storage=<format> [--no-reflog] [--dry-run]
 git refs verify [--strict] [--verbose]
 git refs list [--count=<count>] [--shell|--perl|--python|--tcl]
 		   [(--sort=<key>)...] [--format=<format>]
@@ -97,8 +97,8 @@ OPTIONS
 
 The following options are specific to `git refs migrate`:
 
-`--ref-format=<format>`::
-	The ref format to migrate the ref store to. Can be one of:
+`--ref-storage=<format>`::
+	The ref storage format to migrate the ref store to. Can be one of:
 +
 include::ref-storage-format.adoc[]
 
diff --git a/builtin/fetch.c b/builtin/fetch.c
index ab7db2be06..b7faee5125 100644
--- a/builtin/fetch.c
+++ b/builtin/fetch.c
@@ -1848,7 +1848,7 @@ static void ref_transaction_rejection_handler(const char *refname,
 			"can either accept this as-is, in which case you won't be able to\n"
 			"store all remote references on disk. Or you can alternatively\n"
 			"migrate your repository to use the 'reftable' backend with the\n"
-			"following command:\n\n    git refs migrate --ref-format=reftable\n\n"
+			"following command:\n\n    git refs migrate --ref-storage=reftable\n\n"
 			"Please keep in mind that not all implementations of Git support this\n"
 			"new format yet. So if you use tools other than Git to access this\n"
 			"repository it may not be an option to migrate to reftables.\n"));
diff --git a/builtin/refs.c b/builtin/refs.c
index 5cd21c25fe..deb9387375 100644
--- a/builtin/refs.c
+++ b/builtin/refs.c
@@ -10,7 +10,7 @@
 #include "refs/refs-internal.h"
 
 #define REFS_MIGRATE_USAGE \
-	N_("git refs migrate --ref-format=<format> [--no-reflog] [--dry-run]")
+	N_("git refs migrate --ref-storage=<format> [--no-reflog] [--dry-run]")
 
 #define REFS_VERIFY_USAGE \
 	N_("git refs verify [--strict] [--verbose]")
@@ -44,9 +44,12 @@ static int cmd_refs_migrate(int argc, const char **argv, const char *prefix,
 	enum ref_storage_format format;
 	unsigned int flags = 0;
 	struct option options[] = {
-		OPT_STRING_F(0, "ref-format", &format_str, N_("format"),
-			N_("specify the reference format to convert to"),
+		OPT_STRING_F(0, "ref-storage", &format_str, N_("format"),
+			N_("specify the reference storage format to convert to"),
 			PARSE_OPT_NONEG),
+		OPT_STRING_F(0, "ref-format", &format_str, N_("format"),
+			N_("specify the reference storage format to convert to"),
+			PARSE_OPT_NONEG | PARSE_OPT_HIDDEN),
 		OPT_BIT(0, "dry-run", &flags,
 			N_("perform a non-destructive dry-run"),
 			REPO_MIGRATE_REF_STORAGE_FORMAT_DRYRUN),
@@ -62,7 +65,7 @@ static int cmd_refs_migrate(int argc, const char **argv, const char *prefix,
 	if (argc)
 		usage(_("too many arguments"));
 	if (!format_str)
-		usage(_("missing --ref-format=<format>"));
+		usage(_("missing --ref-storage=<format>"));
 
 	format = ref_storage_format_by_name(format_str);
 	if (format == REF_STORAGE_FORMAT_UNKNOWN) {
diff --git a/t/t1423-ref-backend.sh b/t/t1423-ref-backend.sh
index 26a3655058..20545d9db8 100755
--- a/t/t1423-ref-backend.sh
+++ b/t/t1423-ref-backend.sh
@@ -144,7 +144,7 @@ do
 				test_commit 2 &&
 				test_commit 3 &&
 
-				git refs migrate --dry-run --ref-format=$to_format >out &&
+				git refs migrate --dry-run --ref-storage=$to_format >out &&
 				BACKEND_PATH="$dir/$(sed "s/.* ${SQ}.git\/\(.*\)${SQ}/\1/" out)" &&
 				test_refs_backend . $from_format "$to_format://$BACKEND_PATH" "$method"
 			)
@@ -159,7 +159,7 @@ do
 				test_commit 2 &&
 				test_commit 3 &&
 
-				git refs migrate --dry-run --ref-format=$to_format >out &&
+				git refs migrate --dry-run --ref-storage=$to_format >out &&
 				BACKEND_PATH="$dir/$(sed "s/.* ${SQ}.git\/\(.*\)${SQ}/\1/" out)" &&
 
 				test_refs_backend . $from_format "$to_format://$BACKEND_PATH" "$method" &&
@@ -186,7 +186,7 @@ do
 				test_commit 2 &&
 				test_commit 3 &&
 
-				git refs migrate --dry-run --ref-format=$to_format >out &&
+				git refs migrate --dry-run --ref-storage=$to_format >out &&
 				BACKEND_PATH="$dir/$(sed "s/.* ${SQ}.git\/\(.*\)${SQ}/\1/" out)" &&
 
 				run_with_uri . "$from_format" "$to_format://$BACKEND_PATH" \
@@ -218,7 +218,7 @@ do
 			test_commit 2 &&
 			test_commit 3 &&
 
-			git refs migrate --ref-format=$to_format &&
+			git refs migrate --ref-storage=$to_format &&
 			git refs list >out &&
 			test_grep "refs/tags/1"	out &&
 			test_grep "refs/tags/2"	out &&
diff --git a/t/t1460-refs-migrate.sh b/t/t1460-refs-migrate.sh
index 44ad24f16e..4f2ff725ce 100755
--- a/t/t1460-refs-migrate.sh
+++ b/t/t1460-refs-migrate.sh
@@ -42,7 +42,7 @@ test_migration () {
 		print_all_reflog_entries "$repo" >expect_logs
 	fi &&
 
-	git -C "$repo" refs migrate --ref-format="$format" "$@" &&
+	git -C "$repo" refs migrate --ref-storage="$format" "$@" &&
 
 	git -C "$repo" for-each-ref --include-root-refs \
 		--format='%(refname) %(objectname) %(symref)' >actual &&
@@ -77,7 +77,7 @@ test_expect_success "missing ref storage format" '
 	git init repo &&
 	test_must_fail git -C repo refs migrate 2>err &&
 	cat >expect <<-EOF &&
-	usage: missing --ref-format=<format>
+	usage: missing --ref-storage=<format>
 	EOF
 	test_cmp expect err
 '
@@ -86,7 +86,7 @@ test_expect_success "unknown ref storage format" '
 	test_when_finished "rm -rf repo" &&
 	git init repo &&
 	test_must_fail git -C repo refs migrate \
-		--ref-format=unknown 2>err &&
+		--ref-storage=unknown 2>err &&
 	cat >expect <<-EOF &&
 	error: unknown ref storage format ${SQ}unknown${SQ}
 	EOF
@@ -107,7 +107,7 @@ do
 			test_when_finished "rm -rf repo" &&
 			git init --ref-storage=$from_format repo &&
 			test_must_fail git -C repo refs migrate \
-				--ref-format=$from_format 2>err &&
+				--ref-storage=$from_format 2>err &&
 			cat >expect <<-EOF &&
 			error: repository already uses ${SQ}$from_format${SQ} format
 			EOF
@@ -119,7 +119,7 @@ do
 			git init --ref-storage=$from_format repo &&
 			git -C repo worktree add wt &&
 			test_must_fail git -C repo refs migrate \
-				--ref-format=$to_format 2>err &&
+				--ref-storage=$to_format 2>err &&
 			cat >expect <<-EOF &&
 			error: migrating repositories with worktrees is not supported yet
 			EOF
@@ -211,7 +211,7 @@ do
 			git init --ref-storage=$from_format repo &&
 			test_commit -C repo initial &&
 			git -C repo refs migrate --dry-run \
-				--ref-format=$to_format >output &&
+				--ref-storage=$to_format >output &&
 			test_grep "Finished dry-run migration of refs" output &&
 			test_path_is_dir repo/.git/ref_migration.* &&
 			echo $from_format >expect &&
diff --git a/t/t7424-submodule-mixed-ref-formats.sh b/t/t7424-submodule-mixed-ref-formats.sh
index 1adac7baed..5c26fc18be 100755
--- a/t/t7424-submodule-mixed-ref-formats.sh
+++ b/t/t7424-submodule-mixed-ref-formats.sh
@@ -94,7 +94,7 @@ test_expect_success 'status with mixed submodule ref storages' '
 	git init main &&
 	git -C main submodule add "file://$(pwd)/submodule" &&
 	git -C main commit -m "add submodule" &&
-	git -C main/submodule refs migrate --ref-format=$OTHER_FORMAT &&
+	git -C main/submodule refs migrate --ref-storage=$OTHER_FORMAT &&
 
 	# The main repository should use the default ref format now, whereas
 	# the submodule should use the other format.

-- 
2.55.0.1007.g17ff1f9808.dirty


^ permalink raw reply related	[flat|nested] 61+ messages in thread

* [PATCH 04/11] builtin/submodule: rename "--ref-format=" to "--ref-storage="
  2026-09-04 10:36 [PATCH 00/11] Fix inconsistent ref storage format terminology Patrick Steinhardt
                   ` (2 preceding siblings ...)
  2026-09-04 10:36 ` [PATCH 03/11] builtin/refs: " Patrick Steinhardt
@ 2026-09-04 10:36 ` Patrick Steinhardt
  2026-09-04 10:36 ` [PATCH 05/11] builtin/rev-parse: rename "--show-ref-format" to "--show-ref-storage" Patrick Steinhardt
                   ` (10 subsequent siblings)
  14 siblings, 0 replies; 61+ messages in thread
From: Patrick Steinhardt @ 2026-09-04 10:36 UTC (permalink / raw)
  To: git; +Cc: Karthik Nayak

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

Note that this commit is a bit more complex compared to the others as we
also need to adapt the submodule helper for consistency. But overall,
the changes are straight-forward and in the same spirit.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
 Documentation/git-submodule.adoc       |  8 ++++----
 builtin/clone.c                        |  2 +-
 builtin/submodule--helper.c            | 24 +++++++++++++++---------
 git-submodule.sh                       | 20 ++++++++++----------
 t/t7424-submodule-mixed-ref-formats.sh |  6 +++---
 5 files changed, 33 insertions(+), 27 deletions(-)

diff --git a/Documentation/git-submodule.adoc b/Documentation/git-submodule.adoc
index 722d827908..a3713709b1 100644
--- a/Documentation/git-submodule.adoc
+++ b/Documentation/git-submodule.adoc
@@ -34,7 +34,7 @@ COMMANDS
 With no arguments, shows the status of existing submodules.  Several
 subcommands are available to perform operations on the submodules.
 
-`add [-b <branch>] [-f | --force] [--name <name>] [--reference <repository>] [--ref-format <format>] [--depth <depth>] [--] <repository> [<path>]`::
+`add [-b <branch>] [-f | --force] [--name <name>] [--reference <repository>] [--ref-storage <format>] [--depth <depth>] [--] <repository> [<path>]`::
 	Add the given repository as a submodule at the given path
 	to the changeset to be committed next to the current
 	project: the current project is termed the "superproject".
@@ -72,7 +72,7 @@ location, and only the superproject's URL needs to be provided.
 git-submodule will correctly locate the submodule using the relative
 URL in `.gitmodules`.
 +
-If `--ref-format <format>`  is specified, the ref storage format of newly
+If `--ref-storage <format>`  is specified, the ref storage format of newly
 cloned submodules will be set accordingly.
 
 `status [--cached] [--recursive] [--] [<path>...]`::
@@ -139,7 +139,7 @@ If you really want to remove a submodule from the repository and commit
 that use linkgit:git-rm[1] instead. See linkgit:gitsubmodules[7] for removal
 options.
 
-`update [--init] [--remote] [-N | --no-fetch] [--[no-]recommend-shallow] [-f | --force] [--checkout | --rebase | --merge] [--reference=<repository>] [--ref-format=<format>] [--depth=<depth>] [--recursive] [--jobs <n>] [--[no-]single-branch] [--filter=<filter-spec>] [--] [<path>...]`::
+`update [--init] [--remote] [-N | --no-fetch] [--[no-]recommend-shallow] [-f | --force] [--checkout | --rebase | --merge] [--reference=<repository>] [--ref-storage=<format>] [--depth=<depth>] [--recursive] [--jobs <n>] [--[no-]single-branch] [--filter=<filter-spec>] [--] [<path>...]`::
 +
 --
 Update the registered submodules to match what the superproject
@@ -188,7 +188,7 @@ submodule with the `--init` option.
 If `--recursive` is specified, this command will recurse into the
 registered submodules, and update any nested submodules within.
 
-If `--ref-format <format>`  is specified, the ref storage format of newly
+If `--ref-storage <format>`  is specified, the ref storage format of newly
 cloned submodules will be set accordingly.
 
 If `--filter <filter-spec>` is specified, the given partial clone filter will be
diff --git a/builtin/clone.c b/builtin/clone.c
index 63bd7b795d..c4f9dc7472 100644
--- a/builtin/clone.c
+++ b/builtin/clone.c
@@ -725,7 +725,7 @@ static int checkout(int submodule_progress,
 		}
 
 		if (ref_storage_format != REF_STORAGE_FORMAT_UNKNOWN)
-			strvec_pushf(&cmd.args, "--ref-format=%s",
+			strvec_pushf(&cmd.args, "--ref-storage=%s",
 				     ref_storage_format_to_name(ref_storage_format));
 
 		if (filter_submodules && filter_options->choice)
diff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c
index e7cd3225fa..50bc4aeb4d 100644
--- a/builtin/submodule--helper.c
+++ b/builtin/submodule--helper.c
@@ -1941,7 +1941,7 @@ static int clone_submodule(const struct module_clone_data *clone_data,
 					     item->string, NULL);
 		}
 		if (clone_data->ref_storage_format != REF_STORAGE_FORMAT_UNKNOWN)
-			strvec_pushf(&cp.args, "--ref-format=%s",
+			strvec_pushf(&cp.args, "--ref-storage=%s",
 				     ref_storage_format_to_name(clone_data->ref_storage_format));
 		if (clone_data->dissociate)
 			strvec_push(&cp.args, "--dissociate");
@@ -2057,8 +2057,10 @@ static int module_clone(int argc, const char **argv, const char *prefix,
 		OPT_STRING_LIST(0, "reference", &reference,
 			   N_("repo"),
 			   N_("reference repository")),
-		OPT_STRING(0, "ref-format", &ref_storage_format, N_("format"),
-			   N_("specify the reference format to use")),
+		OPT_STRING(0, "ref-storage", &ref_storage_format, N_("format"),
+			   N_("specify the reference storage format to use")),
+		OPT_STRING_F(0, "ref-format", &ref_storage_format, N_("format"),
+			     N_("specify the reference storage format to use"), PARSE_OPT_HIDDEN),
 		OPT_BOOL(0, "dissociate", &dissociate,
 			   N_("use --reference only while cloning")),
 		OPT_INTEGER(0, "depth", &clone_data.depth,
@@ -2357,7 +2359,7 @@ static int prepare_to_clone_next_submodule(const struct cache_entry *ce,
 	if (suc->update_data->require_init)
 		strvec_push(&child->args, "--require-init");
 	if (suc->update_data->ref_storage_format != REF_STORAGE_FORMAT_UNKNOWN)
-		strvec_pushf(&child->args, "--ref-format=%s",
+		strvec_pushf(&child->args, "--ref-storage=%s",
 			     ref_storage_format_to_name(suc->update_data->ref_storage_format));
 	strvec_pushl(&child->args, "--path", sub->path, NULL);
 	strvec_pushl(&child->args, "--name", sub->name, NULL);
@@ -2801,7 +2803,7 @@ static void update_data_to_args(const struct update_data *update_data,
 			strvec_pushl(args, "--reference", item->string, NULL);
 	}
 	if (update_data->ref_storage_format != REF_STORAGE_FORMAT_UNKNOWN)
-		strvec_pushf(args, "--ref-format=%s",
+		strvec_pushf(args, "--ref-storage=%s",
 			     ref_storage_format_to_name(update_data->ref_storage_format));
 	if (update_data->filter_options && update_data->filter_options->choice)
 		strvec_pushf(args, "--filter=%s",
@@ -3010,8 +3012,10 @@ static int module_update(int argc, const char **argv, const char *prefix,
 			SM_UPDATE_REBASE),
 		OPT_STRING_LIST(0, "reference", &opt.references, N_("repo"),
 			   N_("reference repository")),
-		OPT_STRING(0, "ref-format", &ref_storage_format, N_("format"),
-			   N_("specify the reference format to use")),
+		OPT_STRING(0, "ref-storage", &ref_storage_format, N_("format"),
+			   N_("specify the reference storage format to use")),
+		OPT_STRING_F(0, "ref-format", &ref_storage_format, N_("format"),
+			     N_("specify the reference storage format to use"), PARSE_OPT_HIDDEN),
 		OPT_BOOL(0, "dissociate", &opt.dissociate,
 			   N_("use --reference only while cloning")),
 		OPT_INTEGER(0, "depth", &opt.depth,
@@ -3659,8 +3663,10 @@ static int module_add(int argc, const char **argv, const char *prefix,
 		OPT_BOOL(0, "progress", &progress, N_("force cloning progress")),
 		OPT_STRING(0, "reference", &add_data.reference_path, N_("repository"),
 			   N_("reference repository")),
-		OPT_STRING(0, "ref-format", &ref_storage_format, N_("format"),
-			   N_("specify the reference format to use")),
+		OPT_STRING(0, "ref-storage", &ref_storage_format, N_("format"),
+			   N_("specify the reference storage format to use")),
+		OPT_STRING_F(0, "ref-format", &ref_storage_format, N_("format"),
+			     N_("specify the reference storage format to use"), PARSE_OPT_HIDDEN),
 		OPT_BOOL(0, "dissociate", &dissociate, N_("borrow the objects from reference repositories")),
 		OPT_STRING(0, "name", &add_data.sm_name, N_("name"),
 			   N_("sets the submodule's name to the given string "
diff --git a/git-submodule.sh b/git-submodule.sh
index 2999b31fad..3d16f28ad6 100755
--- a/git-submodule.sh
+++ b/git-submodule.sh
@@ -95,13 +95,13 @@ cmd_add()
 		--reference=*)
 			reference="$1"
 			;;
-		--ref-format)
+		--ref-format|--ref-storage)
 			case "$2" in '') usage ;; esac
-			ref_format="--ref-format=$2"
+			ref_storage="--ref-storage=$2"
 			shift
 			;;
-		--ref-format=*)
-			ref_format="$1"
+		--ref-format=*|--ref-storage=*)
+			ref_storage="$1"
 			;;
 		--dissociate)
 			dissociate=$1
@@ -147,7 +147,7 @@ cmd_add()
 		$progress \
 		${branch:+"$branch"} \
 		${reference:+"$reference"} \
-		${ref_format:+"$ref_format"} \
+		${ref_storage:+"$ref_storage"} \
 		$dissociate \
 		${name:+"$name"} \
 		${depth:+"$depth"} \
@@ -302,13 +302,13 @@ cmd_update()
 		-r|--rebase)
 			rebase=$1
 			;;
-		--ref-format)
+		--ref-format|--ref-storage)
 			case "$2" in '') usage ;; esac
-			ref_format="--ref-format=$2"
+			ref_storage="--ref-storage=$2"
 			shift
 			;;
-		--ref-format=*)
-			ref_format="$1"
+		--ref-format=*|--ref-storage=*)
+			ref_storage="$1"
 			;;
 		--reference)
 			case "$2" in '') usage ;; esac
@@ -385,7 +385,7 @@ cmd_update()
 		$rebase \
 		$merge \
 		$checkout \
-		${ref_format:+"$ref_format"} \
+		${ref_storage:+"$ref_storage"} \
 		${reference:+"$reference"} \
 		$dissociate \
 		${depth:+"$depth"} \
diff --git a/t/t7424-submodule-mixed-ref-formats.sh b/t/t7424-submodule-mixed-ref-formats.sh
index 5c26fc18be..c20d981ef2 100755
--- a/t/t7424-submodule-mixed-ref-formats.sh
+++ b/t/t7424-submodule-mixed-ref-formats.sh
@@ -44,7 +44,7 @@ test_expect_success 'add submodules with different ref storage format' '
 	test_commit -C submodule submodule-initial &&
 	git init upstream &&
 	test_ref_format upstream "$GIT_DEFAULT_REF_FORMAT" &&
-	git -C upstream submodule add --ref-format="$OTHER_FORMAT" "file://$(pwd)/submodule" &&
+	git -C upstream submodule add --ref-storage="$OTHER_FORMAT" "file://$(pwd)/submodule" &&
 	test_ref_format upstream/submodule "$OTHER_FORMAT"
 '
 
@@ -82,7 +82,7 @@ test_expect_success 'clone submodules with different ref storage format' '
 
 	git clone --no-recurse-submodules "file://$(pwd)/upstream" downstream &&
 	test_ref_format downstream "$GIT_DEFAULT_REF_FORMAT" &&
-	git -C downstream submodule update --init --ref-format=$OTHER_FORMAT &&
+	git -C downstream submodule update --init --ref-storage=$OTHER_FORMAT &&
 	test_ref_format downstream/submodule "$OTHER_FORMAT"
 '
 
@@ -122,7 +122,7 @@ test_expect_success 'recursive pull with mixed formats' '
 	# Clone the upstream repository such that the main repo and its
 	# submodules have different formats.
 	git clone --no-recurse-submodules "file://$(pwd)/upstream" downstream &&
-	git -C downstream submodule update --init --ref-format=$OTHER_FORMAT &&
+	git -C downstream submodule update --init --ref-storage=$OTHER_FORMAT &&
 	test_ref_format downstream "$GIT_DEFAULT_REF_FORMAT" &&
 	test_ref_format downstream/submodule "$OTHER_FORMAT" &&
 

-- 
2.55.0.1007.g17ff1f9808.dirty


^ permalink raw reply related	[flat|nested] 61+ messages in thread

* [PATCH 05/11] builtin/rev-parse: rename "--show-ref-format" to "--show-ref-storage"
  2026-09-04 10:36 [PATCH 00/11] Fix inconsistent ref storage format terminology Patrick Steinhardt
                   ` (3 preceding siblings ...)
  2026-09-04 10:36 ` [PATCH 04/11] builtin/submodule: " Patrick Steinhardt
@ 2026-09-04 10:36 ` Patrick Steinhardt
  2026-09-04 10:36 ` [PATCH 06/11] help: rename "default-ref-format" to "default-ref-storage" Patrick Steinhardt
                   ` (9 subsequent siblings)
  14 siblings, 0 replies; 61+ messages in thread
From: Patrick Steinhardt @ 2026-09-04 10:36 UTC (permalink / raw)
  To: git; +Cc: Karthik Nayak

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

Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
 Documentation/git-rev-parse.adoc       |  2 +-
 builtin/rev-parse.c                    |  2 +-
 contrib/completion/git-prompt.sh       |  2 +-
 t/perf/perf-lib.sh                     |  4 ++--
 t/t0001-init.sh                        | 36 +++++++++++++++++-----------------
 t/t0610-reftable-basics.sh             | 16 +++++++--------
 t/t1460-refs-migrate.sh                |  4 ++--
 t/t1500-rev-parse.sh                   |  8 ++++----
 t/t5601-clone.sh                       |  2 +-
 t/t7424-submodule-mixed-ref-formats.sh |  2 +-
 10 files changed, 39 insertions(+), 39 deletions(-)

diff --git a/Documentation/git-rev-parse.adoc b/Documentation/git-rev-parse.adoc
index 5398691f3f..4c9dcc5652 100644
--- a/Documentation/git-rev-parse.adoc
+++ b/Documentation/git-rev-parse.adoc
@@ -331,7 +331,7 @@ 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::
 	Show the reference storage format used for the repository.
 
 
diff --git a/builtin/rev-parse.c b/builtin/rev-parse.c
index 43693454d5..9822037884 100644
--- a/builtin/rev-parse.c
+++ b/builtin/rev-parse.c
@@ -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")) {
 				puts(ref_storage_format_to_name(the_repository->ref_storage_format));
 				continue;
 			}
diff --git a/contrib/completion/git-prompt.sh b/contrib/completion/git-prompt.sh
index 6186c474ba..e8107e8325 100644
--- a/contrib/completion/git-prompt.sh
+++ b/contrib/completion/git-prompt.sh
@@ -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 \
 		--short HEAD 2>/dev/null)"
 	rev_parse_exit_code="$?"
 
diff --git a/t/perf/perf-lib.sh b/t/perf/perf-lib.sh
index 50a35545a1..b2826bc696 100644
--- a/t/perf/perf-lib.sh
+++ b/t/perf/perf-lib.sh
@@ -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)"
+	refstorage="$("$MODERN_GIT" -C "$source" rev-parse --show-ref-storage)"
 	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="$refformat" --object-format="$objectformat" &&
+		"$MODERN_GIT" init -q --ref-storage="$refstorage" --object-format="$objectformat" &&
 		test_perf_do_repo_symlink_config_ &&
 		mv .git/hooks .git/hooks-disabled 2>/dev/null &&
 		if test -f .git/index.lock
diff --git a/t/t0001-init.sh b/t/t0001-init.sh
index bb3ec31097..26bd8c6822 100755
--- a/t/t0001-init.sh
+++ b/t/t0001-init.sh
@@ -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 >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 >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 >actual &&
 		test_cmp expect actual
 	'
 
@@ -700,7 +700,7 @@ do
 		test_when_finished "rm -rf refformat" &&
 		git init --ref-storage=$format refformat &&
 		echo $format >expect &&
-		git -C refformat rev-parse --show-ref-format >actual &&
+		git -C refformat rev-parse --show-ref-storage >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 >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 refformat &&
 		echo $format >expect &&
-		git -C refformat rev-parse --show-ref-format >actual &&
+		git -C refformat rev-parse --show-ref-storage >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 >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 >actual &&
 		test_cmp expect actual
 	'
 done
@@ -739,7 +739,7 @@ test_expect_success "--ref-storage= overrides GIT_DEFAULT_REF_FORMAT" '
 	test_when_finished "rm -rf refformat" &&
 	GIT_DEFAULT_REF_FORMAT=files git init --ref-storage=reftable refformat &&
 	echo reftable >expect &&
-	git -C refformat rev-parse --show-ref-format >actual &&
+	git -C refformat rev-parse --show-ref-storage >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 >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 >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 >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 >actual &&
 	test_cmp expect actual
 '
 
@@ -794,7 +794,7 @@ do
 		git init --ref-storage=$from_format refformat &&
 		git init --ref-storage=$from_format refformat &&
 		echo $from_format >expect &&
-		git -C refformat rev-parse --show-ref-format >actual &&
+		git -C refformat rev-parse --show-ref-storage >actual &&
 		test_cmp expect actual
 	'
 
@@ -814,7 +814,7 @@ do
 			test_must_fail git init --ref-storage=$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 >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 >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 >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 >actual &&
 	test_cmp expect actual
 '
 
diff --git a/t/t0610-reftable-basics.sh b/t/t0610-reftable-basics.sh
index d367b4b787..8588904c3f 100755
--- a/t/t0610-reftable-basics.sh
+++ b/t/t0610-reftable-basics.sh
@@ -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 >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 >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 >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 >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 >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 >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 >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 >actual &&
 	echo files >expect &&
 	test_cmp expect actual
 '
diff --git a/t/t1460-refs-migrate.sh b/t/t1460-refs-migrate.sh
index 4f2ff725ce..2d73537de6 100755
--- a/t/t1460-refs-migrate.sh
+++ b/t/t1460-refs-migrate.sh
@@ -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 >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 >actual &&
 			test_cmp expect actual
 		'
 
diff --git a/t/t1500-rev-parse.sh b/t/t1500-rev-parse.sh
index 4174ca40c3..72fe262484 100755
--- a/t/t1500-rev-parse.sh
+++ b/t/t1500-rev-parse.sh
@@ -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' '
 	test_detect_ref_format >expect &&
-	git rev-parse --show-ref-format >actual &&
+	git rev-parse --show-ref-storage >actual &&
 	test_cmp expect actual
 '
 
-test_expect_success 'rev-parse --show-ref-format with invalid storage' '
+test_expect_success 'rev-parse --show-ref-storage 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 2>err &&
 		test_grep "error: invalid value for ${SQ}extensions.refstorage${SQ}: ${SQ}broken${SQ}" err
 	)
 '
diff --git a/t/t5601-clone.sh b/t/t5601-clone.sh
index 88f359914f..c0c17cf75a 100755
--- a/t/t5601-clone.sh
+++ b/t/t5601-clone.sh
@@ -168,7 +168,7 @@ test_expect_success 'clone with files ref format' '
 	test_when_finished "rm -rf ref-storage" &&
 	git clone --ref-storage=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 >actual &&
 	test_cmp expect actual
 '
 
diff --git a/t/t7424-submodule-mixed-ref-formats.sh b/t/t7424-submodule-mixed-ref-formats.sh
index c20d981ef2..4d03b71243 100755
--- a/t/t7424-submodule-mixed-ref-formats.sh
+++ b/t/t7424-submodule-mixed-ref-formats.sh
@@ -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 >actual &&
 	test_cmp expect actual
 }
 

-- 
2.55.0.1007.g17ff1f9808.dirty


^ permalink raw reply related	[flat|nested] 61+ messages in thread

* [PATCH 06/11] help: rename "default-ref-format" to "default-ref-storage"
  2026-09-04 10:36 [PATCH 00/11] Fix inconsistent ref storage format terminology Patrick Steinhardt
                   ` (4 preceding siblings ...)
  2026-09-04 10:36 ` [PATCH 05/11] builtin/rev-parse: rename "--show-ref-format" to "--show-ref-storage" Patrick Steinhardt
@ 2026-09-04 10:36 ` Patrick Steinhardt
  2026-09-04 10:36 ` [PATCH 07/11] refs: expose function to parse reference URIs Patrick Steinhardt
                   ` (8 subsequent siblings)
  14 siblings, 0 replies; 61+ messages in thread
From: Patrick Steinhardt @ 2026-09-04 10:36 UTC (permalink / raw)
  To: git; +Cc: Karthik Nayak

When printing information about how specifically Git was built and what
defaults it has we also print the default ref storage format used when
initializing new repositories. This is to prepare for Git 3.0, where the
default storage format will change from the "files" backend to the
"reftable" backend.

In preceding commits we have adapted "ref-format" parameters to be
called "ref-storage" instead to resolve some conceptual mismatches. The
build information is now the only place where we still refer to it as
"default-ref-format".

Rename the field to "default-ref-storage" instead.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
 help.c          | 2 +-
 t/t0001-init.sh | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/help.c b/help.c
index 46241492ce..61ffadcdc4 100644
--- a/help.c
+++ b/help.c
@@ -824,7 +824,7 @@ void get_version_info(struct strbuf *buf, int show_build_options)
 			    SHA1_UNSAFE_BACKEND);
 #endif
 		strbuf_addf(buf, "SHA-256: %s\n", SHA256_BACKEND);
-		strbuf_addf(buf, "default-ref-format: %s\n",
+		strbuf_addf(buf, "default-ref-storage: %s\n",
 			    ref_storage_format_to_name(REF_STORAGE_FORMAT_DEFAULT));
 		strbuf_addf(buf, "default-hash: %s\n", hash_algos[GIT_HASH_DEFAULT].name);
 	}
diff --git a/t/t0001-init.sh b/t/t0001-init.sh
index 26bd8c6822..24590ce908 100755
--- a/t/t0001-init.sh
+++ b/t/t0001-init.sh
@@ -668,7 +668,7 @@ test_expect_success 'default ref format' '
 		sane_unset GIT_DEFAULT_REF_FORMAT &&
 		git init refformat
 	) &&
-	git version --build-options | sed -ne "s/^default-ref-format: //p" >expect &&
+	git version --build-options | sed -ne "s/^default-ref-storage: //p" >expect &&
 	git -C refformat rev-parse --show-ref-storage >actual &&
 	test_cmp expect actual
 '

-- 
2.55.0.1007.g17ff1f9808.dirty


^ permalink raw reply related	[flat|nested] 61+ messages in thread

* [PATCH 07/11] refs: expose function to parse reference URIs
  2026-09-04 10:36 [PATCH 00/11] Fix inconsistent ref storage format terminology Patrick Steinhardt
                   ` (5 preceding siblings ...)
  2026-09-04 10:36 ` [PATCH 06/11] help: rename "default-ref-format" to "default-ref-storage" Patrick Steinhardt
@ 2026-09-04 10:36 ` Patrick Steinhardt
  2026-09-04 13:12   ` Karthik Nayak
  2026-09-04 10:36 ` [PATCH 08/11] setup: refactor how we configure the ref storage format Patrick Steinhardt
                   ` (7 subsequent siblings)
  14 siblings, 1 reply; 61+ messages in thread
From: Patrick Steinhardt @ 2026-09-04 10:36 UTC (permalink / raw)
  To: git; +Cc: Karthik Nayak

In the next commit we're about to add more sites that want to parse a
reference backends URI into a format and payload. Expose a new function
`ref_storage_format_by_uri()` that enables this.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
 refs.c  | 23 +++++++++++++++++++++++
 refs.h  |  4 ++++
 setup.c | 48 ++++++++++++------------------------------------
 3 files changed, 39 insertions(+), 36 deletions(-)

diff --git a/refs.c b/refs.c
index 92d5df5b71..951db56113 100644
--- a/refs.c
+++ b/refs.c
@@ -54,6 +54,29 @@ enum ref_storage_format ref_storage_format_by_name(const char *name)
 	return REF_STORAGE_FORMAT_UNKNOWN;
 }
 
+enum ref_storage_format ref_storage_format_by_uri(const char *uri,
+						  char **payload)
+{
+	enum ref_storage_format format;
+	const char *schema_end;
+	char *name;
+
+	schema_end = strstr(uri, "://");
+	if (!schema_end) {
+		name = xstrdup(uri);
+		if (payload)
+			*payload = NULL;
+	} else {
+		name = xstrndup(uri, schema_end - uri);
+		if (payload)
+			*payload = xstrdup(schema_end + 3);
+	}
+
+	format = ref_storage_format_by_name(name);
+	free(name);
+	return format;
+}
+
 const char *ref_storage_format_to_name(enum ref_storage_format ref_storage_format)
 {
 	const struct ref_storage_be *be = find_ref_storage_backend(ref_storage_format);
diff --git a/refs.h b/refs.h
index 9979446d15..ee3b8a62ef 100644
--- a/refs.h
+++ b/refs.h
@@ -17,6 +17,10 @@ struct worktree;
 enum ref_storage_format ref_storage_format_by_name(const char *name);
 const char *ref_storage_format_to_name(enum ref_storage_format ref_storage_format);
 
+/* Parse a reference storage URI in the format "<format>[://<payload>]". */
+enum ref_storage_format ref_storage_format_by_uri(const char *uri,
+						  char **payload);
+
 enum ref_transaction_error {
 	/* Default error code */
 	REF_TRANSACTION_ERROR_GENERIC = -1,
diff --git a/setup.c b/setup.c
index dfe05d9a03..3be7dac452 100644
--- a/setup.c
+++ b/setup.c
@@ -632,21 +632,6 @@ static enum extension_result handle_extension_v0(const char *var,
 		return EXTENSION_UNKNOWN;
 }
 
-static void parse_reference_uri(const char *value, char **format,
-				char **payload)
-{
-	const char *schema_end;
-
-	schema_end = strstr(value, "://");
-	if (!schema_end) {
-		*format = xstrdup(value);
-		*payload = NULL;
-	} else {
-		*format = xstrndup(value, schema_end - value);
-		*payload = xstrdup_or_null(schema_end + 3);
-	}
-}
-
 /*
  * Record any new extensions in this function.
  */
@@ -689,16 +674,13 @@ static enum extension_result handle_extension(const char *var,
 		return EXTENSION_OK;
 	} else if (!strcmp(ext, "refstorage")) {
 		unsigned int format;
-		char *format_str;
 
 		if (!value)
 			return config_error_nonbool(var);
 
-		parse_reference_uri(value, &format_str,
-				    &data->ref_storage_payload);
-
-		format = ref_storage_format_by_name(format_str);
-		free(format_str);
+		FREE_AND_NULL(data->ref_storage_payload);
+		format = ref_storage_format_by_uri(value,
+						   &data->ref_storage_payload);
 
 		if (format == REF_STORAGE_FORMAT_UNKNOWN)
 			return error(_("invalid value for '%s': '%s'"),
@@ -2069,16 +2051,12 @@ const char *setup_git_directory_gently(struct repository *repo, int *nongit_ok)
 			 */
 			ref_backend_uri = getenv(GIT_REFERENCE_BACKEND_ENVIRONMENT);
 			if (ref_backend_uri) {
-				char *format;
-
-				free(discovery.format.ref_storage_payload);
-
-				parse_reference_uri(ref_backend_uri, &format, &discovery.format.ref_storage_payload);
-				discovery.format.ref_storage_format = ref_storage_format_by_name(format);
+				FREE_AND_NULL(discovery.format.ref_storage_payload);
+				discovery.format.ref_storage_format =
+					ref_storage_format_by_uri(ref_backend_uri,
+								  &discovery.format.ref_storage_payload);
 				if (discovery.format.ref_storage_format == REF_STORAGE_FORMAT_UNKNOWN)
-					die(_("unknown ref storage format: '%s'"), format);
-
-				free(format);
+					die(_("unknown ref storage format: '%s'"), ref_backend_uri);
 			}
 
 			if (apply_repository_format(repo, &discovery.format,
@@ -2806,18 +2784,16 @@ static void repository_format_configure(struct repository_format *repo_fmt,
 
 	ref_backend_uri = getenv(GIT_REFERENCE_BACKEND_ENVIRONMENT);
 	if (ref_backend_uri) {
-		char *backend, *payload;
 		enum ref_storage_format format;
+		char *payload;
 
-		parse_reference_uri(ref_backend_uri, &backend, &payload);
-		format = ref_storage_format_by_name(backend);
+		format = ref_storage_format_by_uri(ref_backend_uri, &payload);
 		if (format == REF_STORAGE_FORMAT_UNKNOWN)
-			die(_("unknown ref storage format: '%s'"), backend);
+			die(_("unknown ref storage format: '%s'"), ref_backend_uri);
 
 		repo_fmt->ref_storage_format = format;
+		free(repo_fmt->ref_storage_payload);
 		repo_fmt->ref_storage_payload = payload;
-
-		free(backend);
 	}
 }
 

-- 
2.55.0.1007.g17ff1f9808.dirty


^ permalink raw reply related	[flat|nested] 61+ messages in thread

* [PATCH 08/11] setup: refactor how we configure the ref storage format
  2026-09-04 10:36 [PATCH 00/11] Fix inconsistent ref storage format terminology Patrick Steinhardt
                   ` (6 preceding siblings ...)
  2026-09-04 10:36 ` [PATCH 07/11] refs: expose function to parse reference URIs Patrick Steinhardt
@ 2026-09-04 10:36 ` Patrick Steinhardt
  2026-09-04 10:36 ` [PATCH 09/11] setup: rename ref storage format environment variables Patrick Steinhardt
                   ` (6 subsequent siblings)
  14 siblings, 0 replies; 61+ messages in thread
From: Patrick Steinhardt @ 2026-09-04 10:36 UTC (permalink / raw)
  To: git; +Cc: Karthik Nayak

When (re)initializing a repository we need to figure out the ref storage
format that the repository ought to use. This logic is surprisingly
complex, as we have grown a lot of different mechanisms over time to
configure the format. Unfortunately, as a result of this organic growth,
the logic that configures the storage format has grown very complex.

The biggest culprit here is that we're mixing the logic that determines
the desired storage format with the logic that validates whether the end
result is sane. This leads to some repetitive code, and makes it very
easy to forget validation for some of the branches.

In fact, the way we handle GIT_REFERENCE_BACKEND shows exactly one such
edge case where we don't properly validate. When initializing a
repository with one storage format and then reinitializing it with the
environment variable set to a different format then we'd corrupt the
repository because we silently change the format:

    $ git init repo
    $ git -C repo commit --allow-empty -m message
    $ GIT_REFERENCE_BACKEND=reftable git -C repo init
    fatal: could not open '.../refs/heads' for writing: Is a directory
    $ git -C repo log
    fatal: your current branch appears to be broken

Refactor the code so that we clearly distinguish between these two
different concerns. This lets us clearly spell out the precedence order
and makes the whole logic significantly easier to extend going forward.

Note that the new logic intentionally changes the precedence order so
that "GIT_REFERENCE_BACKEND" is now overridden by the "--ref-storage="
command line option. This matches our usual precedence order, where
explicit command line arguments override environment variables.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
 setup.c         | 103 +++++++++++++++++++++++++++++++++++---------------------
 t/t0001-init.sh |  12 ++++++-
 2 files changed, 75 insertions(+), 40 deletions(-)

diff --git a/setup.c b/setup.c
index 3be7dac452..d6e28dd675 100644
--- a/setup.c
+++ b/setup.c
@@ -2674,7 +2674,7 @@ static void separate_git_dir(struct repository *repo,
 
 struct default_format_config {
 	int hash;
-	enum ref_storage_format ref_format;
+	enum ref_storage_format ref_storage_format;
 };
 
 static int read_default_format_config(const char *key, const char *value,
@@ -2699,8 +2699,8 @@ static int read_default_format_config(const char *key, const char *value,
 		ret = git_config_string(&str, key, value);
 		if (ret)
 			goto out;
-		cfg->ref_format = ref_storage_format_by_name(str);
-		if (cfg->ref_format == REF_STORAGE_FORMAT_UNKNOWN)
+		cfg->ref_storage_format = ref_storage_format_by_name(str);
+		if (cfg->ref_storage_format == REF_STORAGE_FORMAT_UNKNOWN)
 			warning(_("unknown ref storage format '%s'"), str);
 		goto out;
 	}
@@ -2710,9 +2710,9 @@ static int read_default_format_config(const char *key, const char *value,
 	 * "init.defaultRefFormat" takes precedence over this setting.
 	 */
 	if (!strcmp(key, "feature.experimental") &&
-	    cfg->ref_format == REF_STORAGE_FORMAT_UNKNOWN &&
+	    cfg->ref_storage_format == REF_STORAGE_FORMAT_UNKNOWN &&
 	    git_config_bool(key, value)) {
-		cfg->ref_format = REF_STORAGE_FORMAT_REFTABLE;
+		cfg->ref_storage_format = REF_STORAGE_FORMAT_REFTABLE;
 		ret = 0;
 		goto out;
 	}
@@ -2724,18 +2724,18 @@ static int read_default_format_config(const char *key, const char *value,
 }
 
 static void repository_format_configure(struct repository_format *repo_fmt,
-					int hash, enum ref_storage_format ref_format)
+					int hash, enum ref_storage_format ref_storage_format)
 {
 	struct default_format_config cfg = {
 		.hash = GIT_HASH_UNKNOWN,
-		.ref_format = REF_STORAGE_FORMAT_UNKNOWN,
+		.ref_storage_format = REF_STORAGE_FORMAT_UNKNOWN,
 	};
 	struct config_options opts = {
 		.respect_includes = 1,
 		.ignore_repo = 1,
 		.ignore_worktree = 1,
 	};
-	const char *ref_backend_uri;
+	char *ref_storage_payload = NULL;
 	const char *env;
 
 	config_with_options(read_default_format_config, &cfg, NULL, NULL, &opts);
@@ -2761,40 +2761,65 @@ static void repository_format_configure(struct repository_format *repo_fmt,
 		repo_fmt->hash_algo = cfg.hash;
 	}
 
-	env = getenv("GIT_DEFAULT_REF_FORMAT");
-	if (repo_fmt->version >= 0 &&
-	    ref_format != REF_STORAGE_FORMAT_UNKNOWN &&
-	    ref_format != repo_fmt->ref_storage_format) {
-		die(_("attempt to reinitialize repository with different reference storage format"));
-	} else if (ref_format != REF_STORAGE_FORMAT_UNKNOWN) {
-		repo_fmt->ref_storage_format = ref_format;
-	} else if (env) {
-		ref_format = ref_storage_format_by_name(env);
-		if (ref_format == REF_STORAGE_FORMAT_UNKNOWN)
-			die(_("unknown ref storage format '%s'"), env);
-		if (repo_fmt->version < 0 ||
-		    repo_fmt->ref_storage_format == REF_STORAGE_FORMAT_UNKNOWN)
-			repo_fmt->ref_storage_format = ref_format;
-	} else if (cfg.ref_format != REF_STORAGE_FORMAT_UNKNOWN) {
-		repo_fmt->ref_storage_format = cfg.ref_format;
+	/*
+	 * We have the following order of preference when configuring the ref
+	 * storage format:
+	 *
+	 *   1. Explicit override via the command line, like in `git init
+	 *      --ref-storage=`.
+	 *
+	 *   2. Explicit override via the environment with
+	 *      GIT_REFERENCE_BACKEND.
+	 *
+	 *   3. Existing repository format. All the subsequent sources only
+	 *      kick in when there is no repository yet.
+	 *
+	 *   4. The default ref storage format for new repositories as
+	 *      configured via "GIT_DEFAULT_REF_FORMAT".
+	 *
+	 *   5. The default ref storage format for new repositories as
+	 *      configured via "init.defaultRefFormat"
+	 *
+	 *   6. Otherwise, we fall back to the default ref storage format
+	 *      compiled into Git.
+	 */
+	if (ref_storage_format != REF_STORAGE_FORMAT_UNKNOWN) {
+		/* nothing to do */
+	} else if ((env = getenv(GIT_REFERENCE_BACKEND_ENVIRONMENT))) {
+		ref_storage_format = ref_storage_format_by_uri(env, &ref_storage_payload);
+		if (ref_storage_format == REF_STORAGE_FORMAT_UNKNOWN)
+			die(_("unknown reference storage format specified via %s: '%s'"),
+			    GIT_REFERENCE_BACKEND_ENVIRONMENT, env);
+	} else if (repo_fmt->version >= 0) {
+		ref_storage_format = repo_fmt->ref_storage_format;
+		ref_storage_payload = xstrdup_or_null(repo_fmt->ref_storage_payload);
+	} else if ((env = getenv("GIT_DEFAULT_REF_FORMAT"))) {
+		ref_storage_format = ref_storage_format_by_name(env);
+		if (ref_storage_format == REF_STORAGE_FORMAT_UNKNOWN)
+			die(_("unknown reference storage format specified via %s: '%s'"),
+			    "GIT_DEFAULT_REF_FORMAT", env);
+	} else if (cfg.ref_storage_format != REF_STORAGE_FORMAT_UNKNOWN) {
+		ref_storage_format = cfg.ref_storage_format;
 	} else {
-		repo_fmt->ref_storage_format = REF_STORAGE_FORMAT_DEFAULT;
+		ref_storage_format = REF_STORAGE_FORMAT_DEFAULT;
 	}
 
-
-	ref_backend_uri = getenv(GIT_REFERENCE_BACKEND_ENVIRONMENT);
-	if (ref_backend_uri) {
-		enum ref_storage_format format;
-		char *payload;
-
-		format = ref_storage_format_by_uri(ref_backend_uri, &payload);
-		if (format == REF_STORAGE_FORMAT_UNKNOWN)
-			die(_("unknown ref storage format: '%s'"), ref_backend_uri);
-
-		repo_fmt->ref_storage_format = format;
-		free(repo_fmt->ref_storage_payload);
-		repo_fmt->ref_storage_payload = payload;
-	}
+	/*
+	 * If we have a preexisting repository we need to verify that its
+	 * current ref storage format does not change.
+	 */
+	if (repo_fmt->version >= 0) {
+		if (ref_storage_format != repo_fmt->ref_storage_format)
+			die(_("attempt to reinitialize repository with different reference storage format"));
+		if ((ref_storage_payload || repo_fmt->ref_storage_payload) &&
+		    strcmp(ref_storage_payload ? ref_storage_payload : "",
+			   repo_fmt->ref_storage_payload ? repo_fmt->ref_storage_payload : ""))
+			die(_("attempt to reinitialize repository with different reference storage payload"));
+	}
+
+	free(repo_fmt->ref_storage_payload);
+	repo_fmt->ref_storage_format = ref_storage_format;
+	repo_fmt->ref_storage_payload = ref_storage_payload;
 }
 
 int init_db(struct repository *repo,
diff --git a/t/t0001-init.sh b/t/t0001-init.sh
index 24590ce908..d7e592d8a5 100755
--- a/t/t0001-init.sh
+++ b/t/t0001-init.sh
@@ -643,12 +643,22 @@ test_expect_success DEFAULT_REPO_FORMAT 'extensions.refStorage with unknown back
 test_expect_success 'init with GIT_DEFAULT_REF_FORMAT=garbage' '
 	test_when_finished "rm -rf refformat" &&
 	cat >expect <<-EOF &&
-	fatal: unknown ref storage format ${SQ}garbage${SQ}
+	fatal: unknown reference storage format specified via GIT_DEFAULT_REF_FORMAT: ${SQ}garbage${SQ}
 	EOF
 	test_must_fail env GIT_DEFAULT_REF_FORMAT=garbage git init refformat 2>err &&
 	test_cmp expect err
 '
 
+test_expect_success 'GIT_REFERENCE_BACKEND refuses to reinitialize with different storage format' '
+	test_when_finished "rm -rf refbackend" &&
+	git init --ref-storage=files refbackend &&
+	cat >expect <<-EOF &&
+	fatal: attempt to reinitialize repository with different reference storage format
+	EOF
+	test_must_fail env GIT_REFERENCE_BACKEND=reftable git init refbackend 2>err &&
+	test_cmp expect err
+'
+
 test_expect_success 'init warns about invalid init.defaultRefFormat' '
 	test_when_finished "rm -rf repo" &&
 	test_config_global init.defaultRefFormat garbage &&

-- 
2.55.0.1007.g17ff1f9808.dirty


^ permalink raw reply related	[flat|nested] 61+ messages in thread

* [PATCH 09/11] setup: rename ref storage format environment variables
  2026-09-04 10:36 [PATCH 00/11] Fix inconsistent ref storage format terminology Patrick Steinhardt
                   ` (7 preceding siblings ...)
  2026-09-04 10:36 ` [PATCH 08/11] setup: refactor how we configure the ref storage format Patrick Steinhardt
@ 2026-09-04 10:36 ` Patrick Steinhardt
  2026-09-04 13:20   ` Karthik Nayak
  2026-09-04 10:36 ` [PATCH 10/11] setup: rename "init.defaultRefFormat" to "init.defaultRefStorage" Patrick Steinhardt
                   ` (5 subsequent siblings)
  14 siblings, 1 reply; 61+ messages in thread
From: Patrick Steinhardt @ 2026-09-04 10:36 UTC (permalink / raw)
  To: git; +Cc: Karthik Nayak

With the same reasoning as for git-init(1), rename the environment
variables GIT_REFERENCE_BACKEND and GIT_DEFAULT_REF_FORMAT to
GIT_REF_STORAGE and GIT_DEFAULT_REF_STORAGE, respectively. The old names
are kept as an alias to retain compatibility.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
 Documentation/config/init.adoc         |  2 +-
 Documentation/git.adoc                 |  6 ++--
 environment.h                          |  1 +
 setup.c                                | 21 ++++++++------
 t/t0001-init.sh                        | 50 +++++++++++++++++-----------------
 t/t1419-exclude-refs.sh                | 16 +++++------
 t/t1423-ref-backend.sh                 | 18 ++++++------
 t/t7424-submodule-mixed-ref-formats.sh | 14 +++++-----
 t/test-lib.sh                          |  8 +++---
 9 files changed, 71 insertions(+), 65 deletions(-)

diff --git a/Documentation/config/init.adoc b/Documentation/config/init.adoc
index 9c78440192..3098e033ac 100644
--- a/Documentation/config/init.adoc
+++ b/Documentation/config/init.adoc
@@ -16,7 +16,7 @@ endif::[]
 `init.defaultRefFormat`::
 	Allows overriding the default ref storage format for new repositories.
 	See `--ref-storage=` in linkgit:git-init[1]. Both the command line
-	option and the `GIT_DEFAULT_REF_FORMAT` environment variable take
+	option and the `GIT_DEFAULT_REF_STORAGE` environment variable take
 	precedence over this config.
 
 init.defaultSubmodulePathConfig::
diff --git a/Documentation/git.adoc b/Documentation/git.adoc
index e3260fde68..e34c74d995 100644
--- a/Documentation/git.adoc
+++ b/Documentation/git.adoc
@@ -590,13 +590,13 @@ double-quotes and respecting backslash escapes. E.g., the value
 	is always used. The default is "sha1".
 	See `--object-format` in linkgit:git-init[1].
 
-`GIT_DEFAULT_REF_FORMAT`::
+`GIT_DEFAULT_REF_STORAGE`::
 	If this variable is set, the default reference backend format for new
 	repositories will be set to this value. The default is "files".
 	See `--ref-storage` in linkgit:git-init[1].
 
-`GIT_REFERENCE_BACKEND`::
-    Specify which reference backend to be used along with its URI.
+`GIT_REF_STORAGE`::
+    Specify which ref storage to be used along with its URI.
     See `extensions.refStorage` option in linkgit:git-config[1] for more
     details. Overrides the config variable when used.
 
diff --git a/environment.h b/environment.h
index e7ec5b0437..e6b933f8db 100644
--- a/environment.h
+++ b/environment.h
@@ -44,6 +44,7 @@
 #define GIT_TEXT_DOMAIN_DIR_ENVIRONMENT "GIT_TEXTDOMAINDIR"
 #define GIT_ATTR_SOURCE_ENVIRONMENT "GIT_ATTR_SOURCE"
 #define GIT_REFERENCE_BACKEND_ENVIRONMENT "GIT_REFERENCE_BACKEND"
+#define GIT_REF_STORAGE_ENVIRONMENT "GIT_REF_STORAGE"
 
 /*
  * Environment variable used to propagate the --no-advice global option to the
diff --git a/setup.c b/setup.c
index d6e28dd675..5de2aa0d2f 100644
--- a/setup.c
+++ b/setup.c
@@ -2049,7 +2049,9 @@ const char *setup_git_directory_gently(struct repository *repo, int *nongit_ok)
 			 * The env variable should override the repository config
 			 * for 'extensions.refStorage'.
 			 */
-			ref_backend_uri = getenv(GIT_REFERENCE_BACKEND_ENVIRONMENT);
+			ref_backend_uri = getenv(GIT_REF_STORAGE_ENVIRONMENT);
+			if (!ref_backend_uri)
+				ref_backend_uri = getenv(GIT_REFERENCE_BACKEND_ENVIRONMENT);
 			if (ref_backend_uri) {
 				FREE_AND_NULL(discovery.format.ref_storage_payload);
 				discovery.format.ref_storage_format =
@@ -2768,14 +2770,15 @@ static void repository_format_configure(struct repository_format *repo_fmt,
 	 *   1. Explicit override via the command line, like in `git init
 	 *      --ref-storage=`.
 	 *
-	 *   2. Explicit override via the environment with
-	 *      GIT_REFERENCE_BACKEND.
+	 *   2. Explicit override via the environment with "GIT_REF_STORAGE" or
+	 *      its deprecated equivalent "GIT_REFERENCE_BACKEND".
 	 *
 	 *   3. Existing repository format. All the subsequent sources only
 	 *      kick in when there is no repository yet.
 	 *
 	 *   4. The default ref storage format for new repositories as
-	 *      configured via "GIT_DEFAULT_REF_FORMAT".
+	 *      configured via "GIT_DEFAULT_REF_STORAGE" or its deprecated
+	 *      equivalent "GIT_DEFAULT_REF_FORMAT".
 	 *
 	 *   5. The default ref storage format for new repositories as
 	 *      configured via "init.defaultRefFormat"
@@ -2785,19 +2788,21 @@ static void repository_format_configure(struct repository_format *repo_fmt,
 	 */
 	if (ref_storage_format != REF_STORAGE_FORMAT_UNKNOWN) {
 		/* nothing to do */
-	} else if ((env = getenv(GIT_REFERENCE_BACKEND_ENVIRONMENT))) {
+	} else if (((env = getenv(GIT_REF_STORAGE_ENVIRONMENT)) ||
+		    (env = getenv(GIT_REFERENCE_BACKEND_ENVIRONMENT)))) {
 		ref_storage_format = ref_storage_format_by_uri(env, &ref_storage_payload);
 		if (ref_storage_format == REF_STORAGE_FORMAT_UNKNOWN)
 			die(_("unknown reference storage format specified via %s: '%s'"),
-			    GIT_REFERENCE_BACKEND_ENVIRONMENT, env);
+			    GIT_REF_STORAGE_ENVIRONMENT, env);
 	} else if (repo_fmt->version >= 0) {
 		ref_storage_format = repo_fmt->ref_storage_format;
 		ref_storage_payload = xstrdup_or_null(repo_fmt->ref_storage_payload);
-	} else if ((env = getenv("GIT_DEFAULT_REF_FORMAT"))) {
+	} else if (((env = getenv("GIT_DEFAULT_REF_STORAGE")) ||
+		    (env = getenv("GIT_DEFAULT_REF_FORMAT")))) {
 		ref_storage_format = ref_storage_format_by_name(env);
 		if (ref_storage_format == REF_STORAGE_FORMAT_UNKNOWN)
 			die(_("unknown reference storage format specified via %s: '%s'"),
-			    "GIT_DEFAULT_REF_FORMAT", env);
+			    "GIT_DEFAULT_REF_STORAGE", env);
 	} else if (cfg.ref_storage_format != REF_STORAGE_FORMAT_UNKNOWN) {
 		ref_storage_format = cfg.ref_storage_format;
 	} else {
diff --git a/t/t0001-init.sh b/t/t0001-init.sh
index d7e592d8a5..e4b9fae8bd 100755
--- a/t/t0001-init.sh
+++ b/t/t0001-init.sh
@@ -640,22 +640,22 @@ test_expect_success DEFAULT_REPO_FORMAT 'extensions.refStorage with unknown back
 	test_grep "invalid value for ${SQ}extensions.refstorage${SQ}: ${SQ}garbage${SQ}" err
 '
 
-test_expect_success 'init with GIT_DEFAULT_REF_FORMAT=garbage' '
+test_expect_success 'init with GIT_DEFAULT_REF_STORAGE=garbage' '
 	test_when_finished "rm -rf refformat" &&
 	cat >expect <<-EOF &&
-	fatal: unknown reference storage format specified via GIT_DEFAULT_REF_FORMAT: ${SQ}garbage${SQ}
+	fatal: unknown reference storage format specified via GIT_DEFAULT_REF_STORAGE: ${SQ}garbage${SQ}
 	EOF
-	test_must_fail env GIT_DEFAULT_REF_FORMAT=garbage git init refformat 2>err &&
+	test_must_fail env GIT_DEFAULT_REF_STORAGE=garbage git init refformat 2>err &&
 	test_cmp expect err
 '
 
-test_expect_success 'GIT_REFERENCE_BACKEND refuses to reinitialize with different storage format' '
+test_expect_success 'GIT_REF_STORAGE refuses to reinitialize with different storage format' '
 	test_when_finished "rm -rf refbackend" &&
 	git init --ref-storage=files refbackend &&
 	cat >expect <<-EOF &&
 	fatal: attempt to reinitialize repository with different reference storage format
 	EOF
-	test_must_fail env GIT_REFERENCE_BACKEND=reftable git init refbackend 2>err &&
+	test_must_fail env GIT_REF_STORAGE=reftable git init refbackend 2>err &&
 	test_cmp expect err
 '
 
@@ -668,14 +668,14 @@ test_expect_success 'init warns about invalid init.defaultRefFormat' '
 	test_cmp expect err &&
 
 	git -C repo rev-parse --show-ref-storage >actual &&
-	echo $GIT_DEFAULT_REF_FORMAT >expected &&
+	echo $GIT_DEFAULT_REF_STORAGE >expected &&
 	test_cmp expected actual
 '
 
 test_expect_success 'default ref format' '
 	test_when_finished "rm -rf refformat" &&
 	(
-		sane_unset GIT_DEFAULT_REF_FORMAT &&
+		sane_unset GIT_DEFAULT_REF_STORAGE &&
 		git init refformat
 	) &&
 	git version --build-options | sed -ne "s/^default-ref-storage: //p" >expect &&
@@ -686,9 +686,9 @@ test_expect_success 'default ref format' '
 backends="files reftable"
 for format in $backends
 do
-	test_expect_success DEFAULT_REPO_FORMAT "init with GIT_DEFAULT_REF_FORMAT=$format" '
+	test_expect_success DEFAULT_REPO_FORMAT "init with GIT_DEFAULT_REF_STORAGE=$format" '
 		test_when_finished "rm -rf refformat" &&
-		GIT_DEFAULT_REF_FORMAT=$format git init refformat &&
+		GIT_DEFAULT_REF_STORAGE=$format git init refformat &&
 
 		if test $format = files
 		then
@@ -718,7 +718,7 @@ do
 		test_when_finished "rm -rf refformat" &&
 		test_config_global init.defaultRefFormat $format &&
 		(
-			sane_unset GIT_DEFAULT_REF_FORMAT &&
+			sane_unset GIT_DEFAULT_REF_STORAGE &&
 			git init refformat
 		) &&
 
@@ -727,37 +727,37 @@ do
 		test_cmp expect actual
 	'
 
-	test_expect_success "--ref-storage=$format overrides GIT_DEFAULT_REF_FORMAT" '
+	test_expect_success "--ref-storage=$format overrides GIT_DEFAULT_REF_STORAGE" '
 		test_when_finished "rm -rf refformat" &&
-		GIT_DEFAULT_REF_FORMAT=garbage git init --ref-storage=$format refformat &&
+		GIT_DEFAULT_REF_STORAGE=garbage git init --ref-storage=$format refformat &&
 		echo $format >expect &&
 		git -C refformat rev-parse --show-ref-storage >actual &&
 		test_cmp expect actual
 	'
 
-	test_expect_success "reinit repository with GIT_DEFAULT_REF_FORMAT=$format does not change format" '
+	test_expect_success "reinit repository with GIT_DEFAULT_REF_STORAGE=$format does not change format" '
 		test_when_finished "rm -rf refformat" &&
 		git init refformat &&
 		git -C refformat rev-parse --show-ref-storage >expect &&
-		GIT_DEFAULT_REF_FORMAT=$format git init refformat &&
+		GIT_DEFAULT_REF_STORAGE=$format git init refformat &&
 		git -C refformat rev-parse --show-ref-storage >actual &&
 		test_cmp expect actual
 	'
 done
 
-test_expect_success "--ref-storage= overrides GIT_DEFAULT_REF_FORMAT" '
+test_expect_success "--ref-storage= overrides GIT_DEFAULT_REF_STORAGE" '
 	test_when_finished "rm -rf refformat" &&
-	GIT_DEFAULT_REF_FORMAT=files git init --ref-storage=reftable refformat &&
+	GIT_DEFAULT_REF_STORAGE=files git init --ref-storage=reftable refformat &&
 	echo reftable >expect &&
 	git -C refformat rev-parse --show-ref-storage >actual &&
 	test_cmp expect actual
 '
 
-test_expect_success "GIT_DEFAULT_REF_FORMAT= overrides init.defaultRefFormat" '
+test_expect_success "GIT_DEFAULT_REF_STORAGE= overrides init.defaultRefFormat" '
 	test_when_finished "rm -rf refformat" &&
 	test_config_global init.defaultRefFormat files &&
 
-	GIT_DEFAULT_REF_FORMAT=reftable git init refformat &&
+	GIT_DEFAULT_REF_STORAGE=reftable git init refformat &&
 	echo reftable >expect &&
 	git -C refformat rev-parse --show-ref-storage >actual &&
 	test_cmp expect actual
@@ -767,7 +767,7 @@ test_expect_success "init with feature.experimental=true" '
 	test_when_finished "rm -rf refformat" &&
 	test_config_global feature.experimental true &&
 	(
-		sane_unset GIT_DEFAULT_REF_FORMAT &&
+		sane_unset GIT_DEFAULT_REF_STORAGE &&
 		git init refformat
 	) &&
 	echo reftable >expect &&
@@ -780,7 +780,7 @@ test_expect_success "init.defaultRefFormat overrides feature.experimental=true"
 	test_config_global feature.experimental true &&
 	test_config_global init.defaultRefFormat files &&
 	(
-		sane_unset GIT_DEFAULT_REF_FORMAT &&
+		sane_unset GIT_DEFAULT_REF_STORAGE &&
 		git init refformat
 	) &&
 	echo files >expect &&
@@ -788,10 +788,10 @@ test_expect_success "init.defaultRefFormat overrides feature.experimental=true"
 	test_cmp expect actual
 '
 
-test_expect_success "GIT_DEFAULT_REF_FORMAT= overrides feature.experimental=true" '
+test_expect_success "GIT_DEFAULT_REF_STORAGE= overrides feature.experimental=true" '
 	test_when_finished "rm -rf refformat" &&
 	test_config_global feature.experimental true &&
-	GIT_DEFAULT_REF_FORMAT=files git init refformat &&
+	GIT_DEFAULT_REF_STORAGE=files git init refformat &&
 	echo files >expect &&
 	git -C refformat rev-parse --show-ref-storage >actual &&
 	test_cmp expect actual
@@ -942,7 +942,7 @@ test_expect_success 'branch -m with the initial branch' '
 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 &&
+	echo $GIT_DEFAULT_REF_STORAGE >expect &&
 	git -C repo rev-parse --show-ref-storage >actual &&
 	test_cmp expect actual
 '
@@ -951,7 +951,7 @@ test_expect_success 'init with includeIf.onbranch condition with existing direct
 	test_when_finished "rm -rf repo" &&
 	mkdir repo &&
 	git -c includeIf.onbranch:nonexistent.path=/does/not/exist init repo &&
-	echo $GIT_DEFAULT_REF_FORMAT >expect &&
+	echo $GIT_DEFAULT_REF_STORAGE >expect &&
 	git -C repo rev-parse --show-ref-storage >actual &&
 	test_cmp expect actual
 '
@@ -960,7 +960,7 @@ test_expect_success 're-init with includeIf.onbranch condition' '
 	test_when_finished "rm -rf repo" &&
 	git init repo &&
 	git -c includeIf.onbranch:nonexistent.path=/does/not/exist init repo &&
-	echo $GIT_DEFAULT_REF_FORMAT >expect &&
+	echo $GIT_DEFAULT_REF_STORAGE >expect &&
 	git -C repo rev-parse --show-ref-storage >actual &&
 	test_cmp expect actual
 '
diff --git a/t/t1419-exclude-refs.sh b/t/t1419-exclude-refs.sh
index 04797aee59..8f54bb9e27 100755
--- a/t/t1419-exclude-refs.sh
+++ b/t/t1419-exclude-refs.sh
@@ -21,13 +21,13 @@ assert_jumps () {
 	local nr="$1"
 	local trace="$2"
 
-	case "$GIT_DEFAULT_REF_FORMAT" in
+	case "$GIT_DEFAULT_REF_STORAGE" in
 	files)
 		grep -q "name:jumps_made value:$nr$" $trace;;
 	reftable)
 		grep -q "name:reseeks_made value:$nr$" $trace;;
 	*)
-		BUG "unhandled ref format $GIT_DEFAULT_REF_FORMAT";;
+		BUG "unhandled ref format $GIT_DEFAULT_REF_STORAGE";;
 	esac
 }
 
@@ -93,13 +93,13 @@ test_expect_success 'adjacent, non-overlapping excluded regions' '
 	for_each_ref refs/heads/foo refs/heads/quux >expect &&
 
 	test_cmp expect actual &&
-	case "$GIT_DEFAULT_REF_FORMAT" in
+	case "$GIT_DEFAULT_REF_STORAGE" in
 	files)
 		assert_jumps 1 perf;;
 	reftable)
 		assert_jumps 2 perf;;
 	*)
-		BUG "unhandled ref format $GIT_DEFAULT_REF_FORMAT";;
+		BUG "unhandled ref format $GIT_DEFAULT_REF_STORAGE";;
 	esac
 '
 
@@ -125,13 +125,13 @@ test_expect_success 'several overlapping excluded regions' '
 	for_each_ref refs/heads/quux >expect &&
 
 	test_cmp expect actual &&
-	case "$GIT_DEFAULT_REF_FORMAT" in
+	case "$GIT_DEFAULT_REF_STORAGE" in
 	files)
 		assert_jumps 1 perf;;
 	reftable)
 		assert_jumps 3 perf;;
 	*)
-		BUG "unhandled ref format $GIT_DEFAULT_REF_FORMAT";;
+		BUG "unhandled ref format $GIT_DEFAULT_REF_STORAGE";;
 	esac
 '
 
@@ -141,13 +141,13 @@ test_expect_success 'unordered excludes' '
 	for_each_ref refs/heads/bar refs/heads/quux >expect &&
 
 	test_cmp expect actual &&
-	case "$GIT_DEFAULT_REF_FORMAT" in
+	case "$GIT_DEFAULT_REF_STORAGE" in
 	files)
 		assert_jumps 1 perf;;
 	reftable)
 		assert_jumps 2 perf;;
 	*)
-		BUG "unhandled ref format $GIT_DEFAULT_REF_FORMAT";;
+		BUG "unhandled ref format $GIT_DEFAULT_REF_STORAGE";;
 	esac
 '
 
diff --git a/t/t1423-ref-backend.sh b/t/t1423-ref-backend.sh
index 20545d9db8..e8285548ca 100755
--- a/t/t1423-ref-backend.sh
+++ b/t/t1423-ref-backend.sh
@@ -12,7 +12,7 @@ test_description='Test reference backend URIs'
 #   <uri> is the new URI to be set for the ref storage.
 #   <cmd> is the git subcommand to be run in the repository.
 #   <via> if 'config', set the backend via the 'extensions.refStorage' config.
-#         if 'env', set the backend via the 'GIT_REFERENCE_BACKEND' env.
+#         if 'env', set the backend via the 'GIT_REF_STORAGE' env.
 run_with_uri () {
 	repo=$1 &&
 	backend=$2 &&
@@ -23,7 +23,7 @@ run_with_uri () {
 	git -C "$repo" config set core.repositoryformatversion 1 &&
 	if test "$via" = "env"
 	then
-		test_env GIT_REFERENCE_BACKEND="$uri" git -C "$repo" $cmd
+		test_env GIT_REF_STORAGE="$uri" git -C "$repo" $cmd
 	elif test "$via" = "config"
 	then
 		git -C "$repo" config set extensions.refStorage "$uri" &&
@@ -40,7 +40,7 @@ run_with_uri () {
 #   <backend> is the original ref storage of the repo.
 #   <uri> is the new URI to be set for the ref storage.
 #   <via> if 'config', set the backend via the 'extensions.refStorage' config.
-#         if 'env', set the backend via the 'GIT_REFERENCE_BACKEND' env.
+#         if 'env', set the backend via the 'GIT_REF_STORAGE' env.
 #   <err_msg> (optional) if set, check if 'git-refs(1)' failed with the provided msg.
 test_refs_backend () {
 	repo=$1 &&
@@ -54,7 +54,7 @@ test_refs_backend () {
 	then
 		if test "$via" = "env"
 		then
-			test_env GIT_REFERENCE_BACKEND="$uri" test_must_fail git -C "$repo" refs list 2>err
+			test_env GIT_REF_STORAGE="$uri" test_must_fail git -C "$repo" refs list 2>err
 		elif test "$via" = "config"
 		then
 			git -C "$repo" config set extensions.refStorage "$uri" &&
@@ -83,7 +83,7 @@ verify_files_exist () {
 	test_cmp expect $gitdir/HEAD
 
 	# verify that backend specific files exist.
-	case "$GIT_DEFAULT_REF_FORMAT" in
+	case "$GIT_DEFAULT_REF_STORAGE" in
 	files)
 		test_path_is_dir $refdir/refs/heads &&
 		test_path_is_file $refdir/HEAD;;
@@ -91,7 +91,7 @@ verify_files_exist () {
 		test_path_is_dir $refdir/reftable &&
 		test_path_is_file $refdir/reftable/tables.list;;
 	*)
-		BUG "unhandled ref format $GIT_DEFAULT_REF_FORMAT";;
+		BUG "unhandled ref format $GIT_DEFAULT_REF_STORAGE";;
 	esac
 }
 
@@ -210,7 +210,7 @@ do
 	test_expect_success "migrating repository to $to_format with alternate refs directory" '
 		test_when_finished "rm -rf repo refdir" &&
 		mkdir refdir &&
-		GIT_REFERENCE_BACKEND="${from_format}://$(pwd)/refdir" git init repo &&
+		GIT_REF_STORAGE="${from_format}://$(pwd)/refdir" git init repo &&
 		(
 			cd repo &&
 
@@ -235,7 +235,7 @@ test_expect_success 'initializing repository with alt ref directory' '
 	test_when_finished "rm -rf repo refdir" &&
 	mkdir refdir &&
 	BACKEND="$(test_detect_ref_format)://$(pwd)/refdir" &&
-	GIT_REFERENCE_BACKEND=$BACKEND git init repo &&
+	GIT_REF_STORAGE=$BACKEND git init repo &&
 	verify_files_exist repo/.git refdir &&
 	(
 		cd repo &&
@@ -264,7 +264,7 @@ test_expect_success 'cloning repository with alt ref directory' '
 	test_commit -C source 3 &&
 
 	BACKEND="$(test_detect_ref_format)://$(pwd)/refdir" &&
-	GIT_REFERENCE_BACKEND=$BACKEND git clone source repo &&
+	GIT_REF_STORAGE=$BACKEND git clone source repo &&
 
 	git -C repo config get extensions.refstorage >actual &&
 	echo $BACKEND >expect &&
diff --git a/t/t7424-submodule-mixed-ref-formats.sh b/t/t7424-submodule-mixed-ref-formats.sh
index 4d03b71243..50bcde2544 100755
--- a/t/t7424-submodule-mixed-ref-formats.sh
+++ b/t/t7424-submodule-mixed-ref-formats.sh
@@ -12,7 +12,7 @@ test_ref_format () {
 
 for OTHER_FORMAT in files reftable
 do
-	if test "$OTHER_FORMAT" = "$GIT_DEFAULT_REF_FORMAT"
+	if test "$OTHER_FORMAT" = "$GIT_DEFAULT_REF_STORAGE"
 	then
 		continue
 	fi
@@ -43,7 +43,7 @@ test_expect_success 'add submodules with different ref storage format' '
 	git init submodule &&
 	test_commit -C submodule submodule-initial &&
 	git init upstream &&
-	test_ref_format upstream "$GIT_DEFAULT_REF_FORMAT" &&
+	test_ref_format upstream "$GIT_DEFAULT_REF_STORAGE" &&
 	git -C upstream submodule add --ref-storage="$OTHER_FORMAT" "file://$(pwd)/submodule" &&
 	test_ref_format upstream/submodule "$OTHER_FORMAT"
 '
@@ -59,8 +59,8 @@ test_expect_success 'recursive clone propagates ref storage format' '
 
 	# The upstream repository and its submodule should be using the default
 	# ref format.
-	test_ref_format upstream "$GIT_DEFAULT_REF_FORMAT" &&
-	test_ref_format upstream/submodule "$GIT_DEFAULT_REF_FORMAT" &&
+	test_ref_format upstream "$GIT_DEFAULT_REF_STORAGE" &&
+	test_ref_format upstream/submodule "$GIT_DEFAULT_REF_STORAGE" &&
 
 	# The cloned repositories should use the other ref format that we have
 	# specified via `--ref-storage`. The option should propagate to cloned
@@ -81,7 +81,7 @@ test_expect_success 'clone submodules with different ref storage format' '
 	git -C upstream commit -m "upstream submodule" &&
 
 	git clone --no-recurse-submodules "file://$(pwd)/upstream" downstream &&
-	test_ref_format downstream "$GIT_DEFAULT_REF_FORMAT" &&
+	test_ref_format downstream "$GIT_DEFAULT_REF_STORAGE" &&
 	git -C downstream submodule update --init --ref-storage=$OTHER_FORMAT &&
 	test_ref_format downstream/submodule "$OTHER_FORMAT"
 '
@@ -98,7 +98,7 @@ test_expect_success 'status with mixed submodule ref storages' '
 
 	# The main repository should use the default ref format now, whereas
 	# the submodule should use the other format.
-	test_ref_format main "$GIT_DEFAULT_REF_FORMAT" &&
+	test_ref_format main "$GIT_DEFAULT_REF_STORAGE" &&
 	test_ref_format main/submodule "$OTHER_FORMAT" &&
 
 	cat >expect <<-EOF &&
@@ -123,7 +123,7 @@ test_expect_success 'recursive pull with mixed formats' '
 	# submodules have different formats.
 	git clone --no-recurse-submodules "file://$(pwd)/upstream" downstream &&
 	git -C downstream submodule update --init --ref-storage=$OTHER_FORMAT &&
-	test_ref_format downstream "$GIT_DEFAULT_REF_FORMAT" &&
+	test_ref_format downstream "$GIT_DEFAULT_REF_STORAGE" &&
 	test_ref_format downstream/submodule "$OTHER_FORMAT" &&
 
 	# Update the upstream submodule as well as the owning repository such
diff --git a/t/test-lib.sh b/t/test-lib.sh
index 1f0505e412..3a8b5ef167 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -575,8 +575,8 @@ export EDITOR
 GIT_TEST_BUILTIN_HASH=$("$GIT_BINARY" version --build-options | sed -ne 's/^default-hash: //p')
 GIT_DEFAULT_HASH="${GIT_TEST_DEFAULT_HASH:-$GIT_TEST_BUILTIN_HASH}"
 export GIT_DEFAULT_HASH
-GIT_DEFAULT_REF_FORMAT="${GIT_TEST_DEFAULT_REF_FORMAT:-files}"
-export GIT_DEFAULT_REF_FORMAT
+GIT_DEFAULT_REF_STORAGE="${GIT_TEST_DEFAULT_REF_FORMAT:-files}"
+export GIT_DEFAULT_REF_STORAGE
 
 # Tests using GIT_TRACE typically don't want <timestamp> <file>:<line> output
 GIT_TRACE_BARE=1
@@ -1752,13 +1752,13 @@ parisc* | hppa*)
 	;;
 esac
 
-case "$GIT_DEFAULT_REF_FORMAT" in
+case "$GIT_DEFAULT_REF_STORAGE" in
 files)
 	test_set_prereq REFFILES;;
 reftable)
 	test_set_prereq REFTABLE;;
 *)
-	echo 2>&1 "error: unknown ref format $GIT_DEFAULT_REF_FORMAT"
+	echo 2>&1 "error: unknown ref format $GIT_DEFAULT_REF_STORAGE"
 	exit 1
 	;;
 esac

-- 
2.55.0.1007.g17ff1f9808.dirty


^ permalink raw reply related	[flat|nested] 61+ messages in thread

* [PATCH 10/11] setup: rename "init.defaultRefFormat" to "init.defaultRefStorage"
  2026-09-04 10:36 [PATCH 00/11] Fix inconsistent ref storage format terminology Patrick Steinhardt
                   ` (8 preceding siblings ...)
  2026-09-04 10:36 ` [PATCH 09/11] setup: rename ref storage format environment variables Patrick Steinhardt
@ 2026-09-04 10:36 ` Patrick Steinhardt
  2026-09-04 10:36 ` [PATCH 11/11] setup: allow "git init --ref-storage=" to specify a payload Patrick Steinhardt
                   ` (4 subsequent siblings)
  14 siblings, 0 replies; 61+ messages in thread
From: Patrick Steinhardt @ 2026-09-04 10:36 UTC (permalink / raw)
  To: git; +Cc: Karthik Nayak

With the same reasoning as for git-init(1), rename the
"init.defaultRefFormat" config option to "init.defaultRefStorage" and
keep the old name as an alias.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
 Documentation/BreakingChanges.adoc |  2 +-
 Documentation/config/feature.adoc  |  2 +-
 Documentation/config/init.adoc     |  2 +-
 setup.c                            |  8 +++++---
 t/t0001-init.sh                    | 16 ++++++++--------
 5 files changed, 16 insertions(+), 14 deletions(-)

diff --git a/Documentation/BreakingChanges.adoc b/Documentation/BreakingChanges.adoc
index 73bb939359..af69f5c1e2 100644
--- a/Documentation/BreakingChanges.adoc
+++ b/Documentation/BreakingChanges.adoc
@@ -156,7 +156,7 @@ Cf. <2f5de416-04ba-c23d-1e0b-83bb655829a7@zombino.com>,
      "packed-refs" file.
 +
 Users that get immediate benefit from the "reftable" backend could continue to
-opt-in to the "reftable" format manually by setting the "init.defaultRefFormat"
+opt-in to the "reftable" format manually by setting the "init.defaultRefStorage"
 config. But defaults matter, and we think that overall users will have a better
 experience with less platform-specific quirks when they use the new backend by
 default.
diff --git a/Documentation/config/feature.adoc b/Documentation/config/feature.adoc
index 924f5ff4e3..7687e1a89a 100644
--- a/Documentation/config/feature.adoc
+++ b/Documentation/config/feature.adoc
@@ -25,7 +25,7 @@ reusing objects from multiple packs instead of just one.
 significantly smaller in the presence of certain filename collisions with Git's
 default name-hash.
 +
-* `init.defaultRefFormat=reftable` causes newly initialized repositories to use
+* `init.defaultRefStorage=reftable` causes newly initialized repositories to use
 the reftable format for storing references. This new format solves issues with
 case-insensitive filesystems, compresses better and performs significantly
 better with many use cases. Refer to Documentation/technical/reftable.adoc for
diff --git a/Documentation/config/init.adoc b/Documentation/config/init.adoc
index 3098e033ac..297c09cf43 100644
--- a/Documentation/config/init.adoc
+++ b/Documentation/config/init.adoc
@@ -13,7 +13,7 @@ endif::[]
 	`--object-format=` in linkgit:git-init[1]. Both the command line option
 	and the `GIT_DEFAULT_HASH` environment variable take precedence over
 	this config.
-`init.defaultRefFormat`::
+`init.defaultRefStorage`::
 	Allows overriding the default ref storage format for new repositories.
 	See `--ref-storage=` in linkgit:git-init[1]. Both the command line
 	option and the `GIT_DEFAULT_REF_STORAGE` environment variable take
diff --git a/setup.c b/setup.c
index 5de2aa0d2f..b81d4f134a 100644
--- a/setup.c
+++ b/setup.c
@@ -2697,7 +2697,8 @@ static int read_default_format_config(const char *key, const char *value,
 		goto out;
 	}
 
-	if (!strcmp(key, "init.defaultrefformat")) {
+	if (!strcmp(key, "init.defaultrefstorage") ||
+	    !strcmp(key, "init.defaultrefformat")) {
 		ret = git_config_string(&str, key, value);
 		if (ret)
 			goto out;
@@ -2709,7 +2710,7 @@ static int read_default_format_config(const char *key, const char *value,
 
 	/*
 	 * Enable the reftable format when "features.experimental" is enabled.
-	 * "init.defaultRefFormat" takes precedence over this setting.
+	 * "init.defaultRefStorage" takes precedence over this setting.
 	 */
 	if (!strcmp(key, "feature.experimental") &&
 	    cfg->ref_storage_format == REF_STORAGE_FORMAT_UNKNOWN &&
@@ -2781,7 +2782,8 @@ static void repository_format_configure(struct repository_format *repo_fmt,
 	 *      equivalent "GIT_DEFAULT_REF_FORMAT".
 	 *
 	 *   5. The default ref storage format for new repositories as
-	 *      configured via "init.defaultRefFormat"
+	 *      configured via "init.defaultRefStorage" or its deprecated
+	 *      equivalent "init.defaultRefFormat".
 	 *
 	 *   6. Otherwise, we fall back to the default ref storage format
 	 *      compiled into Git.
diff --git a/t/t0001-init.sh b/t/t0001-init.sh
index e4b9fae8bd..b481d763ff 100755
--- a/t/t0001-init.sh
+++ b/t/t0001-init.sh
@@ -659,9 +659,9 @@ test_expect_success 'GIT_REF_STORAGE refuses to reinitialize with different stor
 	test_cmp expect err
 '
 
-test_expect_success 'init warns about invalid init.defaultRefFormat' '
+test_expect_success 'init warns about invalid init.defaultRefStorage' '
 	test_when_finished "rm -rf repo" &&
-	test_config_global init.defaultRefFormat garbage &&
+	test_config_global init.defaultRefStorage garbage &&
 
 	echo "warning: unknown ref storage format ${SQ}garbage${SQ}" >expect &&
 	git init repo 2>err &&
@@ -714,9 +714,9 @@ do
 		test_cmp expect actual
 	'
 
-	test_expect_success "init with init.defaultRefFormat=$format" '
+	test_expect_success "init with init.defaultRefStorage=$format" '
 		test_when_finished "rm -rf refformat" &&
-		test_config_global init.defaultRefFormat $format &&
+		test_config_global init.defaultRefStorage $format &&
 		(
 			sane_unset GIT_DEFAULT_REF_STORAGE &&
 			git init refformat
@@ -753,9 +753,9 @@ test_expect_success "--ref-storage= overrides GIT_DEFAULT_REF_STORAGE" '
 	test_cmp expect actual
 '
 
-test_expect_success "GIT_DEFAULT_REF_STORAGE= overrides init.defaultRefFormat" '
+test_expect_success "GIT_DEFAULT_REF_STORAGE= overrides init.defaultRefStorage" '
 	test_when_finished "rm -rf refformat" &&
-	test_config_global init.defaultRefFormat files &&
+	test_config_global init.defaultRefStorage files &&
 
 	GIT_DEFAULT_REF_STORAGE=reftable git init refformat &&
 	echo reftable >expect &&
@@ -775,10 +775,10 @@ test_expect_success "init with feature.experimental=true" '
 	test_cmp expect actual
 '
 
-test_expect_success "init.defaultRefFormat overrides feature.experimental=true" '
+test_expect_success "init.defaultRefStorage overrides feature.experimental=true" '
 	test_when_finished "rm -rf refformat" &&
 	test_config_global feature.experimental true &&
-	test_config_global init.defaultRefFormat files &&
+	test_config_global init.defaultRefStorage files &&
 	(
 		sane_unset GIT_DEFAULT_REF_STORAGE &&
 		git init refformat

-- 
2.55.0.1007.g17ff1f9808.dirty


^ permalink raw reply related	[flat|nested] 61+ messages in thread

* [PATCH 11/11] setup: allow "git init --ref-storage=" to specify a payload
  2026-09-04 10:36 [PATCH 00/11] Fix inconsistent ref storage format terminology Patrick Steinhardt
                   ` (9 preceding siblings ...)
  2026-09-04 10:36 ` [PATCH 10/11] setup: rename "init.defaultRefFormat" to "init.defaultRefStorage" Patrick Steinhardt
@ 2026-09-04 10:36 ` Patrick Steinhardt
  2026-09-04 13:23 ` [PATCH 00/11] Fix inconsistent ref storage format terminology Karthik Nayak
                   ` (3 subsequent siblings)
  14 siblings, 0 replies; 61+ messages in thread
From: Patrick Steinhardt @ 2026-09-04 10:36 UTC (permalink / raw)
  To: git; +Cc: Karthik Nayak

Reference storage backends can be configured with a payload via the
"extensions.refStorage" config key and the "GIT_REF_STORAGE" environment
variable, both of which accept a URI in the format
"<format>://<payload>". The payload may contain backend-specific
information, for example an alternate refs directory or which database
references should be stored in.

The `--ref-storage=` option of git-init(1) and git-clone(1) does not
know about payloads though: its value is parsed as a plain format name,
so backends that require a payload cannot be conveniently set up at
initialization time via the command line.

Teach the option to accept the same URI syntax. Also, document the
optional payloads for both the "files" and "reftable" backends.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
 Documentation/git-init.adoc           |  5 ++++-
 Documentation/ref-storage-format.adoc |  8 ++++++--
 builtin/clone.c                       |  4 ++--
 builtin/init-db.c                     |  9 +--------
 setup.c                               | 14 +++++++++-----
 setup.h                               |  2 +-
 t/t0001-init.sh                       |  2 +-
 t/t1423-ref-backend.sh                | 30 ++++++++++++++++++++++++++++++
 8 files changed, 54 insertions(+), 20 deletions(-)

diff --git a/Documentation/git-init.adoc b/Documentation/git-init.adoc
index 54cff89dfe..182fc7c203 100644
--- a/Documentation/git-init.adoc
+++ b/Documentation/git-init.adoc
@@ -58,7 +58,10 @@ values are `sha1` and (if enabled) `sha256`.  `sha1` is the default.
 include::object-format-disclaimer.adoc[]
 
 `--ref-storage=<format>`::
-Specify the given ref storage _<format>_ for the repository. The valid values are:
+Specify the given ref storage _<format>_ for the repository. Backends that
+require additional configuration accept a payload in the form
+`<format>://<payload>`, for example a connection string identifying the
+database that shall store the references. The valid values are:
 +
 include::ref-storage-format.adoc[]
 
diff --git a/Documentation/ref-storage-format.adoc b/Documentation/ref-storage-format.adoc
index c5e29ec831..21d62557b7 100644
--- a/Documentation/ref-storage-format.adoc
+++ b/Documentation/ref-storage-format.adoc
@@ -1,8 +1,12 @@
-`files`;; for loose files with packed-refs.
+`files[://<path>]`;; for loose files with packed-refs. The optional payload can
+be specified to change the root directory where references are created. A
+relative path will be resolved relative to the repository's common directory.
 ifndef::with-breaking-changes[]
 	This is the default.
 endif::with-breaking-changes[]
-`reftable`;; for the reftable format.
+`reftable[://<path>]`;; for the reftable format. The optional payload can
+be specified to change the root directory where references are created. A
+relative path will be resolved relative to the repository's common directory.
 ifdef::with-breaking-changes[]
 	This is the default.
 endif::with-breaking-changes[]
diff --git a/builtin/clone.c b/builtin/clone.c
index c4f9dc7472..ce54088c51 100644
--- a/builtin/clone.c
+++ b/builtin/clone.c
@@ -1030,7 +1030,7 @@ int cmd_clone(int argc,
 		option_single_branch = deepen ? 1 : 0;
 
 	if (ref_storage) {
-		ref_storage_format = ref_storage_format_by_name(ref_storage);
+		ref_storage_format = ref_storage_format_by_uri(ref_storage, NULL);
 		if (ref_storage_format == REF_STORAGE_FORMAT_UNKNOWN)
 			die(_("unknown ref storage format '%s'"), ref_storage);
 	}
@@ -1188,7 +1188,7 @@ int cmd_clone(int argc,
 	 * their on-disk data structures.
 	 */
 	init_db(the_repository, git_dir, real_git_dir, work_tree, option_template,
-		GIT_HASH_UNKNOWN, ref_storage_format, NULL,
+		GIT_HASH_UNKNOWN, ref_storage, NULL,
 		do_not_override_repo_unix_permissions,
 		INIT_DB_QUIET | INIT_DB_SKIP_REFDB);
 
diff --git a/builtin/init-db.c b/builtin/init-db.c
index 763ee47d21..e30da2936a 100644
--- a/builtin/init-db.c
+++ b/builtin/init-db.c
@@ -86,7 +86,6 @@ int cmd_init_db(int argc,
 	const char *ref_storage = NULL;
 	const char *initial_branch = NULL;
 	int hash_algo = GIT_HASH_UNKNOWN;
-	enum ref_storage_format ref_storage_format = REF_STORAGE_FORMAT_UNKNOWN;
 	int init_shared_repository = -1;
 	const struct option init_db_options[] = {
 		OPT_STRING(0, "template", &template_dir, N_("template-directory"),
@@ -175,12 +174,6 @@ int cmd_init_db(int argc,
 			die(_("unknown hash algorithm '%s'"), object_format);
 	}
 
-	if (ref_storage) {
-		ref_storage_format = ref_storage_format_by_name(ref_storage);
-		if (ref_storage_format == REF_STORAGE_FORMAT_UNKNOWN)
-			die(_("unknown ref storage format '%s'"), ref_storage);
-	}
-
 	if (init_shared_repository != -1)
 		repo_settings_set_shared_repository(the_repository, init_shared_repository);
 
@@ -251,7 +244,7 @@ int cmd_init_db(int argc,
 
 	flags |= INIT_DB_EXIST_OK;
 	ret = init_db(the_repository, git_dir, real_git_dir, work_tree,
-		      template_dir, hash_algo, ref_storage_format, initial_branch,
+		      template_dir, hash_algo, ref_storage, initial_branch,
 		      init_shared_repository, flags);
 
 	free(template_dir_to_free);
diff --git a/setup.c b/setup.c
index b81d4f134a..20a2fbb292 100644
--- a/setup.c
+++ b/setup.c
@@ -2727,7 +2727,7 @@ static int read_default_format_config(const char *key, const char *value,
 }
 
 static void repository_format_configure(struct repository_format *repo_fmt,
-					int hash, enum ref_storage_format ref_storage_format)
+					int hash, const char *ref_storage_uri)
 {
 	struct default_format_config cfg = {
 		.hash = GIT_HASH_UNKNOWN,
@@ -2738,6 +2738,7 @@ static void repository_format_configure(struct repository_format *repo_fmt,
 		.ignore_repo = 1,
 		.ignore_worktree = 1,
 	};
+	enum ref_storage_format ref_storage_format;
 	char *ref_storage_payload = NULL;
 	const char *env;
 
@@ -2788,8 +2789,11 @@ static void repository_format_configure(struct repository_format *repo_fmt,
 	 *   6. Otherwise, we fall back to the default ref storage format
 	 *      compiled into Git.
 	 */
-	if (ref_storage_format != REF_STORAGE_FORMAT_UNKNOWN) {
-		/* nothing to do */
+	if (ref_storage_uri) {
+		ref_storage_format = ref_storage_format_by_uri(ref_storage_uri, &ref_storage_payload);
+		if (ref_storage_format == REF_STORAGE_FORMAT_UNKNOWN)
+			die(_("unknown reference storage format specified via command line: '%s'"),
+			    ref_storage_uri);
 	} else if (((env = getenv(GIT_REF_STORAGE_ENVIRONMENT)) ||
 		    (env = getenv(GIT_REFERENCE_BACKEND_ENVIRONMENT)))) {
 		ref_storage_format = ref_storage_format_by_uri(env, &ref_storage_payload);
@@ -2834,7 +2838,7 @@ int init_db(struct repository *repo,
 	    const char *real_git_dir,
 	    const char *worktree,
 	    const char *template_dir, int hash,
-	    enum ref_storage_format ref_storage_format,
+	    const char *ref_storage_uri,
 	    const char *initial_branch,
 	    int init_shared_repository, unsigned int flags)
 {
@@ -2871,7 +2875,7 @@ int init_db(struct repository *repo,
 	 * is an attempt to reinitialize new repository with an old tool.
 	 */
 	read_and_verify_repository_format(&repo_fmt, repo_get_git_dir(repo), NULL);
-	repository_format_configure(&repo_fmt, hash, ref_storage_format);
+	repository_format_configure(&repo_fmt, hash, ref_storage_uri);
 	if (apply_repository_format(repo, &repo_fmt, APPLY_REPOSITORY_FORMAT_HONOR_ENV, &err) < 0)
 		die("%s", err.buf);
 
diff --git a/setup.h b/setup.h
index 763fd384e8..79e0640743 100644
--- a/setup.h
+++ b/setup.h
@@ -265,7 +265,7 @@ int init_db(struct repository *repo,
 	    const char *real_git_dir,
 	    const char *worktree,
 	    const char *template_dir, int hash_algo,
-	    enum ref_storage_format ref_storage_format,
+	    const char *ref_storage_uri,
 	    const char *initial_branch, int init_shared_repository,
 	    unsigned int flags);
 void initialize_repository_version(struct repository *repo,
diff --git a/t/t0001-init.sh b/t/t0001-init.sh
index b481d763ff..7cdebc8ff3 100755
--- a/t/t0001-init.sh
+++ b/t/t0001-init.sh
@@ -833,7 +833,7 @@ done
 test_expect_success 'init with --ref-storage=garbage' '
 	test_when_finished "rm -rf refformat" &&
 	cat >expect <<-EOF &&
-	fatal: unknown ref storage format ${SQ}garbage${SQ}
+	fatal: unknown reference storage format specified via command line: ${SQ}garbage${SQ}
 	EOF
 	test_must_fail git init --ref-storage=garbage refformat 2>err &&
 	test_cmp expect err
diff --git a/t/t1423-ref-backend.sh b/t/t1423-ref-backend.sh
index e8285548ca..dc43e1c438 100755
--- a/t/t1423-ref-backend.sh
+++ b/t/t1423-ref-backend.sh
@@ -254,6 +254,36 @@ test_expect_success 'initializing repository with alt ref directory' '
 	)
 '
 
+test_expect_success 'initializing repository with --ref-storage and payload' '
+	test_when_finished "rm -rf repo refdir" &&
+	mkdir refdir &&
+	BACKEND="$(test_detect_ref_format)://$(pwd)/refdir" &&
+	git init --ref-storage="$BACKEND" repo &&
+	verify_files_exist repo/.git refdir &&
+
+	git -C repo config get extensions.refstorage >actual &&
+	echo $BACKEND >expect &&
+	test_cmp expect actual &&
+
+	test_commit -C repo 1 &&
+	git -C repo refs list >out &&
+	test_grep "refs/tags/1" out &&
+
+	# Reinitializing the repository is fine when not specifying any format.
+	git -C repo init &&
+	# Reinitializing with the same backend is fine, too.
+	git -C repo init --ref-storage="$BACKEND" &&
+	# Reinitializing without a payload should fail.
+	test_must_fail git -C repo init --ref-storage="$(test_detect_ref_format)" 2>err &&
+	test_grep "attempt to reinitialize repository with different reference storage payload" err &&
+	# Reinitializing with a different payload should fail, too.
+	test_must_fail git -C repo init --ref-storage="$(test_detect_ref_format)://$(pwd)/other" 2>err &&
+	test_grep "attempt to reinitialize repository with different reference storage payload" err &&
+
+	git -C repo config get extensions.refstorage >actual &&
+	test_cmp expect actual
+'
+
 test_expect_success 'cloning repository with alt ref directory' '
 	test_when_finished "rm -rf source repo refdir" &&
 	mkdir refdir &&

-- 
2.55.0.1007.g17ff1f9808.dirty


^ permalink raw reply related	[flat|nested] 61+ messages in thread

* Re: [PATCH 01/11] builtin/init: rename "--ref-format=" to "--ref-storage="
  2026-09-04 10:36 ` [PATCH 01/11] builtin/init: rename "--ref-format=" to "--ref-storage=" Patrick Steinhardt
@ 2026-09-04 13:05   ` Karthik Nayak
  2026-09-07 10:00     ` Patrick Steinhardt
  0 siblings, 1 reply; 61+ messages in thread
From: Karthik Nayak @ 2026-09-04 13:05 UTC (permalink / raw)
  To: Patrick Steinhardt, git

[-- Attachment #1: Type: text/plain, Size: 5495 bytes --]

Patrick Steinhardt <ps@pks.im> writes:

> 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 "ref storage" 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>
> ---
>  Documentation/config/init.adoc         |  2 +-
>  Documentation/git-init.adoc            |  4 ++--
>  Documentation/git.adoc                 |  2 +-
>  builtin/init-db.c                      | 16 ++++++++-------
>  t/perf/p1401-ref-store-tombstones.sh   |  4 ++--
>  t/perf/perf-lib.sh                     |  2 +-
>  t/t0001-init.sh                        | 24 +++++++++++------------
>  t/t0610-reftable-basics.sh             | 14 ++++++-------
>  t/t0611-reftable-httpd.sh              |  2 +-
>  t/t1400-update-ref.sh                  |  2 +-
>  t/t1423-ref-backend.sh                 |  6 +++---
>  t/t1460-refs-migrate.sh                | 36 +++++++++++++++++-----------------
>  t/t1900-repo-info.sh                   |  6 +++---
>  t/t5510-fetch.sh                       |  8 ++++----
>  t/t7424-submodule-mixed-ref-formats.sh |  2 +-
>  15 files changed, 66 insertions(+), 64 deletions(-)
>
> diff --git a/Documentation/config/init.adoc b/Documentation/config/init.adoc
> index 7b4abdaf8b..9c78440192 100644
> --- a/Documentation/config/init.adoc
> +++ b/Documentation/config/init.adoc
> @@ -15,7 +15,7 @@ endif::[]
>  	this config.
>  `init.defaultRefFormat`::
>  	Allows overriding the default ref storage format for new repositories.
> -	See `--ref-format=` in linkgit:git-init[1]. Both the command line
> +	See `--ref-storage=` in linkgit:git-init[1]. Both the command line
>  	option and the `GIT_DEFAULT_REF_FORMAT` environment variable take
>  	precedence over this config.

[snip]

> @@ -83,7 +83,7 @@ int cmd_init_db(int argc,
>  	unsigned int flags = 0;
>  	int bare = startup_info->force_bare_repository ? 1 : -1;
>  	const char *object_format = NULL;
> -	const char *ref_format = NULL;
> +	const char *ref_storage = NULL;
>  	const char *initial_branch = NULL;
>  	int hash_algo = GIT_HASH_UNKNOWN;
>  	enum ref_storage_format ref_storage_format = REF_STORAGE_FORMAT_UNKNOWN;
> @@ -109,8 +109,10 @@ int cmd_init_db(int argc,
>  			   N_("override the name of the initial branch")),
>  		OPT_STRING(0, "object-format", &object_format, N_("hash"),
>  			   N_("specify the hash algorithm to use")),
> -		OPT_STRING(0, "ref-format", &ref_format, N_("format"),
> -			   N_("specify the reference format to use")),
> +		OPT_STRING(0, "ref-storage", &ref_storage, N_("format"),
> +			   N_("specify the reference storage format to use")),

shouldn't we use 'ref-storage' for the argh value too?

> +		OPT_STRING_F(0, "ref-format", &ref_storage, N_("format"),
> +			   N_("specify the reference storage format to use"), PARSE_OPT_HIDDEN),
>  		OPT_END()
>  	};
>

So we stay backwards compatible by leaving the old 'ref-format' as is.
Makes sense.

>  	int ret;
> @@ -173,10 +175,10 @@ int cmd_init_db(int argc,
>  			die(_("unknown hash algorithm '%s'"), object_format);
>  	}
>
> -	if (ref_format) {
> -		ref_storage_format = ref_storage_format_by_name(ref_format);
> +	if (ref_storage) {
> +		ref_storage_format = ref_storage_format_by_name(ref_storage);
>  		if (ref_storage_format == REF_STORAGE_FORMAT_UNKNOWN)
> -			die(_("unknown ref storage format '%s'"), ref_format);
> +			die(_("unknown ref storage format '%s'"), ref_storage);

Funny that we error'd out with 'ref storage' while the name was
ref_format.

>  	}
>
>  	if (init_shared_repository != -1)
[snip]

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 690 bytes --]

^ permalink raw reply	[flat|nested] 61+ messages in thread

* Re: [PATCH 07/11] refs: expose function to parse reference URIs
  2026-09-04 10:36 ` [PATCH 07/11] refs: expose function to parse reference URIs Patrick Steinhardt
@ 2026-09-04 13:12   ` Karthik Nayak
  0 siblings, 0 replies; 61+ messages in thread
From: Karthik Nayak @ 2026-09-04 13:12 UTC (permalink / raw)
  To: Patrick Steinhardt, git

[-- Attachment #1: Type: text/plain, Size: 5309 bytes --]

Patrick Steinhardt <ps@pks.im> writes:

> In the next commit we're about to add more sites that want to parse a
> reference backends URI into a format and payload. Expose a new function
> `ref_storage_format_by_uri()` that enables this.
>
> Signed-off-by: Patrick Steinhardt <ps@pks.im>
> ---
>  refs.c  | 23 +++++++++++++++++++++++
>  refs.h  |  4 ++++
>  setup.c | 48 ++++++++++++------------------------------------
>  3 files changed, 39 insertions(+), 36 deletions(-)
>
> diff --git a/refs.c b/refs.c
> index 92d5df5b71..951db56113 100644
> --- a/refs.c
> +++ b/refs.c
> @@ -54,6 +54,29 @@ enum ref_storage_format ref_storage_format_by_name(const char *name)
>  	return REF_STORAGE_FORMAT_UNKNOWN;
>  }
>
> +enum ref_storage_format ref_storage_format_by_uri(const char *uri,
> +						  char **payload)
> +{
> +	enum ref_storage_format format;
> +	const char *schema_end;
> +	char *name;
> +
> +	schema_end = strstr(uri, "://");
> +	if (!schema_end) {
> +		name = xstrdup(uri);
> +		if (payload)
> +			*payload = NULL;
> +	} else {
> +		name = xstrndup(uri, schema_end - uri);
> +		if (payload)
> +			*payload = xstrdup(schema_end + 3);
> +	}
> +
> +	format = ref_storage_format_by_name(name);
> +	free(name);
> +	return format;
> +}
> +

Okay, we move the existing code in setup.c to the refs.c and clean it
up.

>  const char *ref_storage_format_to_name(enum ref_storage_format ref_storage_format)
>  {
>  	const struct ref_storage_be *be = find_ref_storage_backend(ref_storage_format);
> diff --git a/refs.h b/refs.h
> index 9979446d15..ee3b8a62ef 100644
> --- a/refs.h
> +++ b/refs.h
> @@ -17,6 +17,10 @@ struct worktree;
>  enum ref_storage_format ref_storage_format_by_name(const char *name);
>  const char *ref_storage_format_to_name(enum ref_storage_format ref_storage_format);
>
> +/* Parse a reference storage URI in the format "<format>[://<payload>]". */
> +enum ref_storage_format ref_storage_format_by_uri(const char *uri,
> +						  char **payload);
> +
>  enum ref_transaction_error {
>  	/* Default error code */
>  	REF_TRANSACTION_ERROR_GENERIC = -1,
> diff --git a/setup.c b/setup.c
> index dfe05d9a03..3be7dac452 100644
> --- a/setup.c
> +++ b/setup.c
> @@ -632,21 +632,6 @@ static enum extension_result handle_extension_v0(const char *var,
>  		return EXTENSION_UNKNOWN;
>  }
>
> -static void parse_reference_uri(const char *value, char **format,
> -				char **payload)
> -{
> -	const char *schema_end;
> -
> -	schema_end = strstr(value, "://");
> -	if (!schema_end) {
> -		*format = xstrdup(value);
> -		*payload = NULL;
> -	} else {
> -		*format = xstrndup(value, schema_end - value);
> -		*payload = xstrdup_or_null(schema_end + 3);
> -	}
> -}
> -
>  /*
>   * Record any new extensions in this function.
>   */
> @@ -689,16 +674,13 @@ static enum extension_result handle_extension(const char *var,
>  		return EXTENSION_OK;
>  	} else if (!strcmp(ext, "refstorage")) {
>  		unsigned int format;
> -		char *format_str;
>
>  		if (!value)
>  			return config_error_nonbool(var);
>
> -		parse_reference_uri(value, &format_str,
> -				    &data->ref_storage_payload);
> -
> -		format = ref_storage_format_by_name(format_str);
> -		free(format_str);
> +		FREE_AND_NULL(data->ref_storage_payload);
> +		format = ref_storage_format_by_uri(value,
> +						   &data->ref_storage_payload);
>
>  		if (format == REF_STORAGE_FORMAT_UNKNOWN)
>  			return error(_("invalid value for '%s': '%s'"),
> @@ -2069,16 +2051,12 @@ const char *setup_git_directory_gently(struct repository *repo, int *nongit_ok)
>  			 */
>  			ref_backend_uri = getenv(GIT_REFERENCE_BACKEND_ENVIRONMENT);
>  			if (ref_backend_uri) {
> -				char *format;
> -
> -				free(discovery.format.ref_storage_payload);
> -
> -				parse_reference_uri(ref_backend_uri, &format, &discovery.format.ref_storage_payload);
> -				discovery.format.ref_storage_format = ref_storage_format_by_name(format);
> +				FREE_AND_NULL(discovery.format.ref_storage_payload);
> +				discovery.format.ref_storage_format =
> +					ref_storage_format_by_uri(ref_backend_uri,
> +								  &discovery.format.ref_storage_payload);
>  				if (discovery.format.ref_storage_format == REF_STORAGE_FORMAT_UNKNOWN)
> -					die(_("unknown ref storage format: '%s'"), format);
> -
> -				free(format);
> +					die(_("unknown ref storage format: '%s'"), ref_backend_uri);
>  			}
>
>  			if (apply_repository_format(repo, &discovery.format,
> @@ -2806,18 +2784,16 @@ static void repository_format_configure(struct repository_format *repo_fmt,
>
>  	ref_backend_uri = getenv(GIT_REFERENCE_BACKEND_ENVIRONMENT);
>  	if (ref_backend_uri) {
> -		char *backend, *payload;
>  		enum ref_storage_format format;
> +		char *payload;
>
> -		parse_reference_uri(ref_backend_uri, &backend, &payload);
> -		format = ref_storage_format_by_name(backend);
> +		format = ref_storage_format_by_uri(ref_backend_uri, &payload);
>  		if (format == REF_STORAGE_FORMAT_UNKNOWN)
> -			die(_("unknown ref storage format: '%s'"), backend);
> +			die(_("unknown ref storage format: '%s'"), ref_backend_uri);
>
>  		repo_fmt->ref_storage_format = format;
> +		free(repo_fmt->ref_storage_payload);
>  		repo_fmt->ref_storage_payload = payload;
> -
> -		free(backend);
>  	}
>  }
>
>
> --
> 2.55.0.1007.g17ff1f9808.dirty

Then, modify all the call sites to use the new function. Makes sense.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 690 bytes --]

^ permalink raw reply	[flat|nested] 61+ messages in thread

* Re: [PATCH 09/11] setup: rename ref storage format environment variables
  2026-09-04 10:36 ` [PATCH 09/11] setup: rename ref storage format environment variables Patrick Steinhardt
@ 2026-09-04 13:20   ` Karthik Nayak
  2026-09-07 10:00     ` Patrick Steinhardt
  0 siblings, 1 reply; 61+ messages in thread
From: Karthik Nayak @ 2026-09-04 13:20 UTC (permalink / raw)
  To: Patrick Steinhardt, git

[-- Attachment #1: Type: text/plain, Size: 2989 bytes --]

Patrick Steinhardt <ps@pks.im> writes:

> With the same reasoning as for git-init(1), rename the environment
> variables GIT_REFERENCE_BACKEND and GIT_DEFAULT_REF_FORMAT to
> GIT_REF_STORAGE and GIT_DEFAULT_REF_STORAGE, respectively. The old names
> are kept as an alias to retain compatibility.
>
> Signed-off-by: Patrick Steinhardt <ps@pks.im>
> ---
>  Documentation/config/init.adoc         |  2 +-
>  Documentation/git.adoc                 |  6 ++--
>  environment.h                          |  1 +
>  setup.c                                | 21 ++++++++------
>  t/t0001-init.sh                        | 50 +++++++++++++++++-----------------
>  t/t1419-exclude-refs.sh                | 16 +++++------
>  t/t1423-ref-backend.sh                 | 18 ++++++------
>  t/t7424-submodule-mixed-ref-formats.sh | 14 +++++-----
>  t/test-lib.sh                          |  8 +++---
>  9 files changed, 71 insertions(+), 65 deletions(-)
>
> diff --git a/Documentation/config/init.adoc b/Documentation/config/init.adoc
> index 9c78440192..3098e033ac 100644
> --- a/Documentation/config/init.adoc
> +++ b/Documentation/config/init.adoc
> @@ -16,7 +16,7 @@ endif::[]
>  `init.defaultRefFormat`::
>  	Allows overriding the default ref storage format for new repositories.
>  	See `--ref-storage=` in linkgit:git-init[1]. Both the command line
> -	option and the `GIT_DEFAULT_REF_FORMAT` environment variable take
> +	option and the `GIT_DEFAULT_REF_STORAGE` environment variable take
>  	precedence over this config.
>
>  init.defaultSubmodulePathConfig::
> diff --git a/Documentation/git.adoc b/Documentation/git.adoc
> index e3260fde68..e34c74d995 100644
> --- a/Documentation/git.adoc
> +++ b/Documentation/git.adoc
> @@ -590,13 +590,13 @@ double-quotes and respecting backslash escapes. E.g., the value
>  	is always used. The default is "sha1".
>  	See `--object-format` in linkgit:git-init[1].
>
> -`GIT_DEFAULT_REF_FORMAT`::
> +`GIT_DEFAULT_REF_STORAGE`::
>  	If this variable is set, the default reference backend format for new
>  	repositories will be set to this value. The default is "files".
>  	See `--ref-storage` in linkgit:git-init[1].
>
> -`GIT_REFERENCE_BACKEND`::
> -    Specify which reference backend to be used along with its URI.
> +`GIT_REF_STORAGE`::
> +    Specify which ref storage to be used along with its URI.
>      See `extensions.refStorage` option in linkgit:git-config[1] for more
>      details. Overrides the config variable when used.
>
> diff --git a/environment.h b/environment.h
> index e7ec5b0437..e6b933f8db 100644
> --- a/environment.h
> +++ b/environment.h
> @@ -44,6 +44,7 @@
>  #define GIT_TEXT_DOMAIN_DIR_ENVIRONMENT "GIT_TEXTDOMAINDIR"
>  #define GIT_ATTR_SOURCE_ENVIRONMENT "GIT_ATTR_SOURCE"
>  #define GIT_REFERENCE_BACKEND_ENVIRONMENT "GIT_REFERENCE_BACKEND"
> +#define GIT_REF_STORAGE_ENVIRONMENT "GIT_REF_STORAGE"

Shouldn't we also be adding and using
GIT_DEFAULT_REF_STORAGE_ENVIRONMENT? The rest of the changes look to be
in order.

[snip]

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 690 bytes --]

^ permalink raw reply	[flat|nested] 61+ messages in thread

* Re: [PATCH 00/11] Fix inconsistent ref storage format terminology
  2026-09-04 10:36 [PATCH 00/11] Fix inconsistent ref storage format terminology Patrick Steinhardt
                   ` (10 preceding siblings ...)
  2026-09-04 10:36 ` [PATCH 11/11] setup: allow "git init --ref-storage=" to specify a payload Patrick Steinhardt
@ 2026-09-04 13:23 ` Karthik Nayak
  2026-09-04 17:15 ` Junio C Hamano
                   ` (2 subsequent siblings)
  14 siblings, 0 replies; 61+ messages in thread
From: Karthik Nayak @ 2026-09-04 13:23 UTC (permalink / raw)
  To: Patrick Steinhardt, git

[-- Attachment #1: Type: text/plain, Size: 2479 bytes --]

Patrick Steinhardt <ps@pks.im> writes:

> Hi,
>
> 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 a lot of 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 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=reftable --object-format=sha256 --object-storage=foo`
>     just feels extremely awkward.
>
> So this patch series aims to clean up this huge mess that we (well, to a
> large extent I) have created, by bringing consistency to our command
> line switches, environment variables and config options to all use "ref
> storage" instead. And that also paves the way for the eventual "object
> storage" switches.
>
> As a cherry on top, this patch series also extends the "--ref-storage="
> switch to allow URIs in the form of "files://foo/bar" to bring it in
> line with all the other ways to specify the ref storage format that
> already allow for URIs.
>
> Thanks!
>
> Patrick
>

This was relatively quite an easy read compared to the number of
patches. I have a small question and a nit. Looks good otherwise :)

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 690 bytes --]

^ permalink raw reply	[flat|nested] 61+ messages in thread

* Re: [PATCH 00/11] Fix inconsistent ref storage format terminology
  2026-09-04 10:36 [PATCH 00/11] Fix inconsistent ref storage format terminology Patrick Steinhardt
                   ` (11 preceding siblings ...)
  2026-09-04 13:23 ` [PATCH 00/11] Fix inconsistent ref storage format terminology Karthik Nayak
@ 2026-09-04 17:15 ` Junio C Hamano
  2026-09-07 10:00   ` Patrick Steinhardt
  2026-09-07 11:18 ` [PATCH v2 " Patrick Steinhardt
  2026-09-09 11:12 ` [PATCH v3 00/13] Fix inconsistent ref storage format terminology Patrick Steinhardt
  14 siblings, 1 reply; 61+ messages in thread
From: Junio C Hamano @ 2026-09-04 17:15 UTC (permalink / raw)
  To: Patrick Steinhardt; +Cc: git, Karthik Nayak

Patrick Steinhardt <ps@pks.im> writes:

> Hi,
>
> 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 a lot of 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 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.

Unless you are unifying them all into a single ref-storage-format, I
do not see much practical difference between ref-storage and
ref-format.  They are both with insufficient clarity and details.

ref-format fails to convey "format" of what aspect of ref it is
about (among "storage", "name", and others), ref-storage fails to
convey what aspect of ref storage it is talking about (among
"format", "medium", and others).


^ permalink raw reply	[flat|nested] 61+ messages in thread

* Re: [PATCH 00/11] Fix inconsistent ref storage format terminology
  2026-09-04 17:15 ` Junio C Hamano
@ 2026-09-07 10:00   ` Patrick Steinhardt
  0 siblings, 0 replies; 61+ messages in thread
From: Patrick Steinhardt @ 2026-09-07 10:00 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git, Karthik Nayak

On Fri, Sep 04, 2026 at 10:15:10AM -0700, Junio C Hamano wrote:
> Patrick Steinhardt <ps@pks.im> writes:
> 
> > Hi,
> >
> > 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 a lot of 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 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.
> 
> Unless you are unifying them all into a single ref-storage-format, I
> do not see much practical difference between ref-storage and
> ref-format.  They are both with insufficient clarity and details.

Well, the important difference is that we don't have conflicting
concerns of "--ref-format=" and "--object-format=" anymore, where the
former cares about the storage format and the latter cares about how the
objects themselves look.

> ref-format fails to convey "format" of what aspect of ref it is
> about (among "storage", "name", and others), ref-storage fails to
> convey what aspect of ref storage it is talking about (among
> "format", "medium", and others).

In any case, I'm happy to call this "ref-storage-format" instead. I
don't care too much about the naming, I really only want to fix the
scope conflict we have with the above two flags, and be consistent.
Resolving that scope conflict gives us a path forward for introducing
the object storage format extension and its accompanying flags.

So with your suggestion, it would be:

  - "--ref-storage-format=" and "--object-storage-format=" control the
    storage format used by Git.

  - "--object-format=" would continue to control the hash used for
    objects. This is still a tiny bit messy, as it could've been called
    "--object-hash=" if you ask me. But on the other, maybe we at one
    point in the future we will introduce an actual new representation
    for objects? If so, it gives us a bit more flexibility.

Will send a new version along these lines. Thanks!

Patrick

^ permalink raw reply	[flat|nested] 61+ messages in thread

* Re: [PATCH 01/11] builtin/init: rename "--ref-format=" to "--ref-storage="
  2026-09-04 13:05   ` Karthik Nayak
@ 2026-09-07 10:00     ` Patrick Steinhardt
  0 siblings, 0 replies; 61+ messages in thread
From: Patrick Steinhardt @ 2026-09-07 10:00 UTC (permalink / raw)
  To: Karthik Nayak; +Cc: git

On Fri, Sep 04, 2026 at 09:05:20AM -0400, Karthik Nayak wrote:
> Patrick Steinhardt <ps@pks.im> writes:
> > diff --git a/Documentation/config/init.adoc b/Documentation/config/init.adoc
> > index 7b4abdaf8b..9c78440192 100644
> > --- a/Documentation/config/init.adoc
> > +++ b/Documentation/config/init.adoc
> > @@ -109,8 +109,10 @@ int cmd_init_db(int argc,
> >  			   N_("override the name of the initial branch")),
> >  		OPT_STRING(0, "object-format", &object_format, N_("hash"),
> >  			   N_("specify the hash algorithm to use")),
> > -		OPT_STRING(0, "ref-format", &ref_format, N_("format"),
> > -			   N_("specify the reference format to use")),
> > +		OPT_STRING(0, "ref-storage", &ref_storage, N_("format"),
> > +			   N_("specify the reference storage format to use")),
> 
> shouldn't we use 'ref-storage' for the argh value too?

I think having "format" as parameter name makes more sense. In any case,
going by Junio's suggestion I've now renamed everything to ref storage
format, and that makes "format" an even better parameter name, I think.

> > @@ -173,10 +175,10 @@ int cmd_init_db(int argc,
> >  			die(_("unknown hash algorithm '%s'"), object_format);
> >  	}
> >
> > -	if (ref_format) {
> > -		ref_storage_format = ref_storage_format_by_name(ref_format);
> > +	if (ref_storage) {
> > +		ref_storage_format = ref_storage_format_by_name(ref_storage);
> >  		if (ref_storage_format == REF_STORAGE_FORMAT_UNKNOWN)
> > -			die(_("unknown ref storage format '%s'"), ref_format);
> > +			die(_("unknown ref storage format '%s'"), ref_storage);
> 
> Funny that we error'd out with 'ref storage' while the name was
> ref_format.

Well, it's inconsistencies all over the place :)

Patrick

^ permalink raw reply	[flat|nested] 61+ messages in thread

* Re: [PATCH 09/11] setup: rename ref storage format environment variables
  2026-09-04 13:20   ` Karthik Nayak
@ 2026-09-07 10:00     ` Patrick Steinhardt
  0 siblings, 0 replies; 61+ messages in thread
From: Patrick Steinhardt @ 2026-09-07 10:00 UTC (permalink / raw)
  To: Karthik Nayak; +Cc: git

On Fri, Sep 04, 2026 at 09:20:30AM -0400, Karthik Nayak wrote:
> Patrick Steinhardt <ps@pks.im> writes:
> > diff --git a/environment.h b/environment.h
> > index e7ec5b0437..e6b933f8db 100644
> > --- a/environment.h
> > +++ b/environment.h
> > @@ -44,6 +44,7 @@
> >  #define GIT_TEXT_DOMAIN_DIR_ENVIRONMENT "GIT_TEXTDOMAINDIR"
> >  #define GIT_ATTR_SOURCE_ENVIRONMENT "GIT_ATTR_SOURCE"
> >  #define GIT_REFERENCE_BACKEND_ENVIRONMENT "GIT_REFERENCE_BACKEND"
> > +#define GIT_REF_STORAGE_ENVIRONMENT "GIT_REF_STORAGE"
> 
> Shouldn't we also be adding and using
> GIT_DEFAULT_REF_STORAGE_ENVIRONMENT? The rest of the changes look to be
> in order.

I refrained from doing so because the other variable wasn't listed here,
either, so I was mostly aiming for compatibility with the previous code.
Happy to change though if you feel strongly about it.

Patrick

^ permalink raw reply	[flat|nested] 61+ messages in thread

* [PATCH v2 00/11] Fix inconsistent ref storage format terminology
  2026-09-04 10:36 [PATCH 00/11] Fix inconsistent ref storage format terminology Patrick Steinhardt
                   ` (12 preceding siblings ...)
  2026-09-04 17:15 ` Junio C Hamano
@ 2026-09-07 11:18 ` Patrick Steinhardt
  2026-09-07 11:18   ` [PATCH v2 01/11] builtin/init: rename "--ref-format=" to "--ref-storage-format=" Patrick Steinhardt
                     ` (10 more replies)
  2026-09-09 11:12 ` [PATCH v3 00/13] Fix inconsistent ref storage format terminology Patrick Steinhardt
  14 siblings, 11 replies; 61+ messages in thread
From: Patrick Steinhardt @ 2026-09-07 11:18 UTC (permalink / raw)
  To: git; +Cc: Karthik Nayak, Junio C Hamano

Hi,

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 a lot of 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 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=reftable --object-format=sha256 --object-storage=foo`
    just feels extremely awkward.

So this patch series aims to clean up this huge mess that we (well, to a
large extent I) have created, by bringing consistency to our command
line switches, environment variables and config options to all use "ref
storage format" instead. And that also paves the way for the eventual
"object storage format" switches.

As a cherry on top, this patch series also extends the
"--ref-storage-format=" switch to allow URIs in the form of
"files://foo/bar" to bring it in line with all the other ways to specify
the ref storage format that already allow for URIs.

Changes in v2:
  - Based on Junio's feedback I've renamed all of this to instead be
    called "ref storage format".
  - Link to v1: https://patch.msgid.link/20260904-b4-pks-unify-ref-storage-format-v1-0-08144e5004ff@pks.im

Thanks!

Patrick

---
Patrick Steinhardt (11):
      builtin/init: rename "--ref-format=" to "--ref-storage-format="
      builtin/clone: rename "--ref-format=" to "--ref-storage-format="
      builtin/refs: rename "--ref-format=" to "--ref-storage-format="
      builtin/submodule: rename "--ref-format=" to "--ref-storage-format="
      builtin/rev-parse: rename "--show-ref-format" to "--show-ref-storage-format"
      help: rename "default-ref-format" to "default-ref-storage-format"
      refs: expose function to parse reference URIs
      setup: refactor how we configure the ref storage format
      setup: rename ref storage format environment variables
      setup: rename "init.defaultRefFormat" to "init.defaultRefStorageFormat"
      setup: allow "git init --ref-storage-format=" to specify a payload

 Documentation/BreakingChanges.adoc     |   2 +-
 Documentation/config/feature.adoc      |   2 +-
 Documentation/config/init.adoc         |   6 +-
 Documentation/git-clone.adoc           |   2 +-
 Documentation/git-init.adoc            |   9 +-
 Documentation/git-refs.adoc            |   6 +-
 Documentation/git-rev-parse.adoc       |   2 +-
 Documentation/git-submodule.adoc       |   8 +-
 Documentation/git.adoc                 |  14 +--
 Documentation/ref-storage-format.adoc  |   8 +-
 builtin/clone.c                        |  18 ++--
 builtin/fetch.c                        |   2 +-
 builtin/init-db.c                      |  21 ++---
 builtin/refs.c                         |  11 ++-
 builtin/rev-parse.c                    |   2 +-
 builtin/submodule--helper.c            |  24 +++--
 contrib/completion/git-prompt.sh       |   2 +-
 environment.h                          |   1 +
 git-submodule.sh                       |  20 ++--
 help.c                                 |   2 +-
 refs.c                                 |  23 +++++
 refs.h                                 |   4 +
 setup.c                                | 164 ++++++++++++++++++---------------
 setup.h                                |   2 +-
 t/perf/p1401-ref-store-tombstones.sh   |   4 +-
 t/perf/perf-lib.sh                     |   4 +-
 t/t0001-init.sh                        | 126 +++++++++++++------------
 t/t0610-reftable-basics.sh             |  34 +++----
 t/t0611-reftable-httpd.sh              |   2 +-
 t/t1400-update-ref.sh                  |   2 +-
 t/t1419-exclude-refs.sh                |  16 ++--
 t/t1423-ref-backend.sh                 |  62 +++++++++----
 t/t1460-refs-migrate.sh                |  54 +++++------
 t/t1500-rev-parse.sh                   |   8 +-
 t/t1900-repo-info.sh                   |   6 +-
 t/t5510-fetch.sh                       |  14 +--
 t/t5601-clone.sh                       |   6 +-
 t/t7424-submodule-mixed-ref-formats.sh |  30 +++---
 t/test-lib.sh                          |   8 +-
 39 files changed, 413 insertions(+), 318 deletions(-)

Range-diff versus v1:

 1:  0b3491b5ff !  1:  6863d9ef8e builtin/init: rename "--ref-format=" to "--ref-storage="
    @@ Metadata
     Author: Patrick Steinhardt <ps@pks.im>
     
      ## Commit message ##
    -    builtin/init: rename "--ref-format=" to "--ref-storage="
    +    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
    @@ Commit message
             --object-storage=` just feels extremely awkward.
     
         Instead, this and subsequent patches will fix the mess by consistently
    -    referring to the ref storage format as "ref storage" 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.
    +    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).
     
    @@ Documentation/config/init.adoc: endif::[]
      `init.defaultRefFormat`::
      	Allows overriding the default ref storage format for new repositories.
     -	See `--ref-format=` in linkgit:git-init[1]. Both the command line
    -+	See `--ref-storage=` in linkgit:git-init[1]. Both the command line
    ++	See `--ref-storage-format=` in linkgit:git-init[1]. Both the command line
      	option and the `GIT_DEFAULT_REF_FORMAT` environment variable take
      	precedence over this config.
      
    @@ Documentation/git-init.adoc: SYNOPSIS
      git init [-q | --quiet] [--bare] [--template=<template-directory>]
      	 [--separate-git-dir <git-dir>] [--object-format=<format>]
     -	 [--ref-format=<format>]
    -+	 [--ref-storage=<format>]
    ++	 [--ref-storage-format=<format>]
      	 [-b <branch-name> | --initial-branch=<branch-name>]
      	 [--shared[=<permissions>]] [<directory>]
      
    @@ Documentation/git-init.adoc: values are `sha1` and (if enabled) `sha256`.  `sha1
      include::object-format-disclaimer.adoc[]
      
     -`--ref-format=<format>`::
    -+`--ref-storage=<format>`::
    ++`--ref-storage-format=<format>`::
      Specify the given ref storage _<format>_ for the repository. The valid values are:
      +
      include::ref-storage-format.adoc[]
    @@ Documentation/git.adoc: double-quotes and respecting backslash escapes. E.g., th
      	If this variable is set, the default reference backend format for new
      	repositories will be set to this value. The default is "files".
     -	See `--ref-format` in linkgit:git-init[1].
    -+	See `--ref-storage` in linkgit:git-init[1].
    ++	See `--ref-storage-format` in linkgit:git-init[1].
      
      `GIT_REFERENCE_BACKEND`::
          Specify which reference backend to be used along with its URI.
    @@ builtin/init-db.c: static int shared_callback(const struct option *opt, const ch
      	N_("git init [-q | --quiet] [--bare] [--template=<template-directory>]\n"
      	   "         [--separate-git-dir <git-dir>] [--object-format=<format>]\n"
     -	   "         [--ref-format=<format>]\n"
    -+	   "         [--ref-storage=<format>]\n"
    ++	   "         [--ref-storage-format=<format>]\n"
      	   "         [-b <branch-name> | --initial-branch=<branch-name>]\n"
      	   "         [--shared[=<permissions>]] [<directory>]"),
      	NULL
    @@ builtin/init-db.c: int cmd_init_db(int argc,
      	int bare = startup_info->force_bare_repository ? 1 : -1;
      	const char *object_format = NULL;
     -	const char *ref_format = NULL;
    -+	const char *ref_storage = NULL;
    ++	const char *ref_storage_format_str = NULL;
      	const char *initial_branch = NULL;
      	int hash_algo = GIT_HASH_UNKNOWN;
      	enum ref_storage_format ref_storage_format = REF_STORAGE_FORMAT_UNKNOWN;
    @@ builtin/init-db.c: int cmd_init_db(int argc,
      			   N_("specify the hash algorithm to use")),
     -		OPT_STRING(0, "ref-format", &ref_format, N_("format"),
     -			   N_("specify the reference format to use")),
    -+		OPT_STRING(0, "ref-storage", &ref_storage, N_("format"),
    ++		OPT_STRING(0, "ref-storage-format", &ref_storage_format_str, N_("format"),
     +			   N_("specify the reference storage format to use")),
    -+		OPT_STRING_F(0, "ref-format", &ref_storage, N_("format"),
    ++		OPT_STRING_F(0, "ref-format", &ref_storage_format_str, N_("format"),
     +			   N_("specify the reference storage format to use"), PARSE_OPT_HIDDEN),
      		OPT_END()
      	};
    @@ builtin/init-db.c: int cmd_init_db(int argc,
      
     -	if (ref_format) {
     -		ref_storage_format = ref_storage_format_by_name(ref_format);
    -+	if (ref_storage) {
    -+		ref_storage_format = ref_storage_format_by_name(ref_storage);
    ++	if (ref_storage_format_str) {
    ++		ref_storage_format = ref_storage_format_by_name(ref_storage_format_str);
      		if (ref_storage_format == REF_STORAGE_FORMAT_UNKNOWN)
     -			die(_("unknown ref storage format '%s'"), ref_format);
    -+			die(_("unknown ref storage format '%s'"), ref_storage);
    ++			die(_("unknown ref storage format '%s'"), ref_storage_format_str);
      	}
      
      	if (init_shared_repository != -1)
    @@ t/perf/p1401-ref-store-tombstones.sh: test_description="Tests performance of ref
      
      test_expect_success "setup" '
     -	git init --ref-format=reftable repo &&
    -+	git init --ref-storage=reftable repo &&
    ++	git init --ref-storage-format=reftable repo &&
      	blob=$(echo foo | git -C repo hash-object -w --stdin) &&
      	for i in $(test_seq 8000)
      	do
    @@ t/perf/p1401-ref-store-tombstones.sh: test_perf "recreate refs after mass delete
      
      test_expect_success "setup asymmetric" '
     -	git init --ref-format=reftable repo2 &&
    -+	git init --ref-storage=reftable repo2 &&
    ++	git init --ref-storage-format=reftable repo2 &&
      	blob=$(echo foo | git -C repo2 hash-object -w --stdin) &&
      	for i in $(test_seq 8000)
      	do
    @@ t/perf/perf-lib.sh: test_perf_create_repo_from () {
      	(
      		cd "$repo" &&
     -		"$MODERN_GIT" init -q --ref-format="$refformat" --object-format="$objectformat" &&
    -+		"$MODERN_GIT" init -q --ref-storage="$refformat" --object-format="$objectformat" &&
    ++		"$MODERN_GIT" init -q --ref-storage-format="$refformat" --object-format="$objectformat" &&
      		test_perf_do_repo_symlink_config_ &&
      		mv .git/hooks .git/hooks-disabled 2>/dev/null &&
      		if test -f .git/index.lock
    @@ t/t0001-init.sh: do
      	'
      
     -	test_expect_success "init with --ref-format=$format" '
    -+	test_expect_success "init with --ref-storage=$format" '
    ++	test_expect_success "init with --ref-storage-format=$format" '
      		test_when_finished "rm -rf refformat" &&
     -		git init --ref-format=$format refformat &&
    -+		git init --ref-storage=$format refformat &&
    ++		git init --ref-storage-format=$format refformat &&
      		echo $format >expect &&
      		git -C refformat rev-parse --show-ref-format >actual &&
      		test_cmp expect actual
    @@ t/t0001-init.sh: do
      	'
      
     -	test_expect_success "--ref-format=$format overrides GIT_DEFAULT_REF_FORMAT" '
    -+	test_expect_success "--ref-storage=$format overrides GIT_DEFAULT_REF_FORMAT" '
    ++	test_expect_success "--ref-storage-format=$format overrides GIT_DEFAULT_REF_FORMAT" '
      		test_when_finished "rm -rf refformat" &&
     -		GIT_DEFAULT_REF_FORMAT=garbage git init --ref-format=$format refformat &&
    -+		GIT_DEFAULT_REF_FORMAT=garbage git init --ref-storage=$format 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 &&
      		test_cmp expect actual
    @@ t/t0001-init.sh: do
      done
      
     -test_expect_success "--ref-format= overrides GIT_DEFAULT_REF_FORMAT" '
    -+test_expect_success "--ref-storage= overrides GIT_DEFAULT_REF_FORMAT" '
    ++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-format=reftable refformat &&
    -+	GIT_DEFAULT_REF_FORMAT=files git init --ref-storage=reftable 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 &&
      	test_cmp expect actual
    @@ t/t0001-init.sh: for from_format in $backends
      		test_when_finished "rm -rf refformat" &&
     -		git init --ref-format=$from_format refformat &&
     -		git init --ref-format=$from_format refformat &&
    -+		git init --ref-storage=$from_format refformat &&
    -+		git init --ref-storage=$from_format refformat &&
    ++		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 &&
      		test_cmp expect actual
    @@ t/t0001-init.sh: do
      		test_expect_success "re-init with different format fails ($from_format -> $to_format)" '
      			test_when_finished "rm -rf refformat" &&
     -			git init --ref-format=$from_format refformat &&
    -+			git init --ref-storage=$from_format refformat &&
    ++			git init --ref-storage-format=$from_format refformat &&
      			cat >expect <<-EOF &&
      			fatal: attempt to reinitialize repository with different reference storage format
      			EOF
     -			test_must_fail git init --ref-format=$to_format refformat 2>err &&
    -+			test_must_fail git init --ref-storage=$to_format refformat 2>err &&
    ++			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 &&
    @@ t/t0001-init.sh: do
      done
      
     -test_expect_success 'init with --ref-format=garbage' '
    -+test_expect_success 'init with --ref-storage=garbage' '
    ++test_expect_success 'init with --ref-storage-format=garbage' '
      	test_when_finished "rm -rf refformat" &&
      	cat >expect <<-EOF &&
      	fatal: unknown ref storage format ${SQ}garbage${SQ}
      	EOF
     -	test_must_fail git init --ref-format=garbage refformat 2>err &&
    -+	test_must_fail git init --ref-storage=garbage refformat 2>err &&
    ++	test_must_fail git init --ref-storage-format=garbage refformat 2>err &&
      	test_cmp expect err
      '
      
    @@ t/t0610-reftable-basics.sh: test_expect_success 'init: reinitializing reftable b
      
      	git -C repo for-each-ref >expect &&
     -	git init --ref-format=reftable repo &&
    -+	git init --ref-storage=reftable repo &&
    ++	git init --ref-storage-format=reftable repo &&
      	git -C repo for-each-ref >actual &&
      	test_cmp expect actual
      '
    @@ t/t0610-reftable-basics.sh: test_expect_success 'init: reinitializing reftable b
      test_expect_success 'init: reinitializing files with reftable backend fails' '
      	test_when_finished "rm -rf repo" &&
     -	git init --ref-format=files repo &&
    -+	git init --ref-storage=files repo &&
    ++	git init --ref-storage-format=files repo &&
      	test_commit -C repo file &&
      
      	cp repo/.git/HEAD expect &&
     -	test_must_fail git init --ref-format=reftable repo &&
    -+	test_must_fail git init --ref-storage=reftable repo &&
    ++	test_must_fail git init --ref-storage-format=reftable repo &&
      	test_cmp expect repo/.git/HEAD
      '
      
      test_expect_success 'init: reinitializing reftable with files backend fails' '
      	test_when_finished "rm -rf repo" &&
     -	git init --ref-format=reftable repo &&
    -+	git init --ref-storage=reftable repo &&
    ++	git init --ref-storage-format=reftable repo &&
      	test_commit -C repo file &&
      
      	cp repo/.git/HEAD expect &&
     -	test_must_fail git init --ref-format=files repo &&
    -+	test_must_fail git init --ref-storage=files repo &&
    ++	test_must_fail git init --ref-storage-format=files repo &&
      	test_cmp expect repo/.git/HEAD
      '
      
    @@ t/t0610-reftable-basics.sh: test_expect_success 'clone: can clone reftable repos
      test_expect_success 'clone: can clone reffiles into reftable repository' '
      	test_when_finished "rm -rf reffiles reftable" &&
     -	git init --ref-format=files reffiles &&
    -+	git init --ref-storage=files reffiles &&
    ++	git init --ref-storage-format=files reffiles &&
      	test_commit -C reffiles A &&
      	git clone --ref-format=reftable ./reffiles reftable &&
      
    @@ t/t0610-reftable-basics.sh: test_expect_success 'clone: can clone reffiles into
      test_expect_success 'clone: can clone reftable into reffiles repository' '
      	test_when_finished "rm -rf reffiles reftable" &&
     -	git init --ref-format=reftable reftable &&
    -+	git init --ref-storage=reftable reftable &&
    ++	git init --ref-storage-format=reftable reftable &&
      	test_commit -C reftable A &&
      	git clone --ref-format=files ./reftable reffiles &&
      
    @@ t/t0611-reftable-httpd.sh: start_httpd
      
      test_expect_success 'serving ls-remote' '
     -	git init --ref-format=reftable -b main "$REPO" &&
    -+	git init --ref-storage=reftable -b main "$REPO" &&
    ++	git init --ref-storage-format=reftable -b main "$REPO" &&
      	cd "$REPO" &&
      	test_commit m1 &&
      	>.git/git-daemon-export-ok &&
    @@ t/t1400-update-ref.sh: do
      
      	test_expect_success CASE_INSENSITIVE_FS "stdin $type batch-updates existing reference" '
     -		git init --ref-format=reftable repo &&
    -+		git init --ref-storage=reftable repo &&
    ++		git init --ref-storage-format=reftable repo &&
      		test_when_finished "rm -fr repo" &&
      		(
      			cd repo &&
    @@ t/t1423-ref-backend.sh: do
      		test_expect_success "$method: read from $to_format backend, $dir dir" '
      			test_when_finished "rm -rf repo" &&
     -			git init --ref-format=$from_format repo &&
    -+			git init --ref-storage=$from_format repo &&
    ++			git init --ref-storage-format=$from_format repo &&
      			(
      				cd repo &&
      				test_commit 1 &&
    @@ t/t1423-ref-backend.sh: do
      		test_expect_success "$method: write to $to_format backend, $dir dir" '
      			test_when_finished "rm -rf repo" &&
     -			git init --ref-format=$from_format repo &&
    -+			git init --ref-storage=$from_format repo &&
    ++			git init --ref-storage-format=$from_format repo &&
      			(
      				cd repo &&
      				test_commit 1 &&
    @@ t/t1423-ref-backend.sh: do
      		test_expect_success "$method: with worktree and $to_format backend, $dir dir" '
      			test_when_finished "rm -rf repo wt" &&
     -			git init --ref-format=$from_format repo &&
    -+			git init --ref-storage=$from_format repo &&
    ++			git init --ref-storage-format=$from_format repo &&
      			(
      				cd repo &&
      				test_commit 1 &&
    @@ t/t1460-refs-migrate.sh: do
      		test_expect_success "$from_format: migration to same format fails" '
      			test_when_finished "rm -rf repo" &&
     -			git init --ref-format=$from_format repo &&
    -+			git init --ref-storage=$from_format repo &&
    ++			git init --ref-storage-format=$from_format repo &&
      			test_must_fail git -C repo refs migrate \
      				--ref-format=$from_format 2>err &&
      			cat >expect <<-EOF &&
    @@ t/t1460-refs-migrate.sh: do
      		test_expect_success "$from_format -> $to_format: migration with worktree fails" '
      			test_when_finished "rm -rf repo" &&
     -			git init --ref-format=$from_format repo &&
    -+			git init --ref-storage=$from_format repo &&
    ++			git init --ref-storage-format=$from_format repo &&
      			git -C repo worktree add wt &&
      			test_must_fail git -C repo refs migrate \
      				--ref-format=$to_format 2>err &&
    @@ t/t1460-refs-migrate.sh: do
      		test_expect_success "$from_format -> $to_format: unborn HEAD" '
      			test_when_finished "rm -rf repo" &&
     -			git init --ref-format=$from_format repo &&
    -+			git init --ref-storage=$from_format repo &&
    ++			git init --ref-storage-format=$from_format repo &&
      			test_migration repo "$to_format"
      		'
      
      		test_expect_success "$from_format -> $to_format: single ref" '
      			test_when_finished "rm -rf repo" &&
     -			git init --ref-format=$from_format repo &&
    -+			git init --ref-storage=$from_format repo &&
    ++			git init --ref-storage-format=$from_format repo &&
      			test_commit -C repo initial &&
      			test_migration repo "$to_format"
      		'
    @@ t/t1460-refs-migrate.sh: do
      		test_expect_success "$from_format -> $to_format: bare repository" '
      			test_when_finished "rm -rf repo repo.git" &&
     -			git init --ref-format=$from_format repo &&
    -+			git init --ref-storage=$from_format repo &&
    ++			git init --ref-storage-format=$from_format repo &&
      			test_commit -C repo initial &&
      			git clone --ref-format=$from_format --mirror repo repo.git &&
      			test_migration repo.git "$to_format"
    @@ t/t1460-refs-migrate.sh: do
      		test_expect_success "$from_format -> $to_format: dangling symref" '
      			test_when_finished "rm -rf repo" &&
     -			git init --ref-format=$from_format repo &&
    -+			git init --ref-storage=$from_format repo &&
    ++			git init --ref-storage-format=$from_format repo &&
      			test_commit -C repo initial &&
      			git -C repo symbolic-ref BROKEN_HEAD refs/heads/nonexistent &&
      			test_migration repo "$to_format" &&
    @@ t/t1460-refs-migrate.sh: do
      		test_expect_success "$from_format -> $to_format: broken ref" '
      			test_when_finished "rm -rf repo" &&
     -			git init --ref-format=$from_format repo &&
    -+			git init --ref-storage=$from_format repo &&
    ++			git init --ref-storage-format=$from_format repo &&
      			test_commit -C repo initial &&
      			test-tool -C repo ref-store main update-ref "" refs/heads/broken \
      				"$(test_oid 001)" "$ZERO_OID" REF_SKIP_CREATE_REFLOG,REF_SKIP_OID_VERIFICATION &&
    @@ t/t1460-refs-migrate.sh: do
      		test_expect_success "$from_format -> $to_format: pseudo-refs" '
      			test_when_finished "rm -rf repo" &&
     -			git init --ref-format=$from_format repo &&
    -+			git init --ref-storage=$from_format repo &&
    ++			git init --ref-storage-format=$from_format repo &&
      			test_commit -C repo initial &&
      			git -C repo update-ref FOO_HEAD HEAD &&
      			test_migration repo "$to_format"
    @@ t/t1460-refs-migrate.sh: do
      		test_expect_success "$from_format -> $to_format: special refs are left alone" '
      			test_when_finished "rm -rf repo" &&
     -			git init --ref-format=$from_format repo &&
    -+			git init --ref-storage=$from_format repo &&
    ++			git init --ref-storage-format=$from_format repo &&
      			test_commit -C repo initial &&
      			git -C repo rev-parse HEAD >repo/.git/MERGE_HEAD &&
      			git -C repo rev-parse MERGE_HEAD &&
    @@ t/t1460-refs-migrate.sh: do
      		test_expect_success "$from_format -> $to_format: a bunch of refs" '
      			test_when_finished "rm -rf repo" &&
     -			git init --ref-format=$from_format repo &&
    -+			git init --ref-storage=$from_format repo &&
    ++			git init --ref-storage-format=$from_format repo &&
      
      			test_commit -C repo initial &&
      			cat >input <<-EOF &&
    @@ t/t1460-refs-migrate.sh: do
      		test_expect_success "$from_format -> $to_format: dry-run migration does not modify repository" '
      			test_when_finished "rm -rf repo" &&
     -			git init --ref-format=$from_format repo &&
    -+			git init --ref-storage=$from_format repo &&
    ++			git init --ref-storage-format=$from_format repo &&
      			test_commit -C repo initial &&
      			git -C repo refs migrate --dry-run \
      				--ref-format=$to_format >output &&
    @@ t/t1460-refs-migrate.sh: do
      		test_expect_success "$from_format -> $to_format: reflogs of symrefs with target deleted" '
      			test_when_finished "rm -rf repo" &&
     -			git init --ref-format=$from_format repo &&
    -+			git init --ref-storage=$from_format repo &&
    ++			git init --ref-storage-format=$from_format repo &&
      			test_commit -C repo initial &&
      			git -C repo branch branch-1 HEAD &&
      			git -C repo symbolic-ref refs/heads/symref refs/heads/branch-1 &&
    @@ t/t1460-refs-migrate.sh: do
      		test_expect_success "$from_format -> $to_format: reflogs order is retained" '
      			test_when_finished "rm -rf repo" &&
     -			git init --ref-format=$from_format repo &&
    -+			git init --ref-storage=$from_format repo &&
    ++			git init --ref-storage-format=$from_format repo &&
      			test_commit --date "100005000 +0700" --no-tag -C repo initial &&
      			test_commit --date "100003000 +0700" --no-tag -C repo second &&
      			test_migration repo "$to_format"
    @@ t/t1460-refs-migrate.sh: do
      		test_expect_success "$from_format -> $to_format: stash is retained" '
      			test_when_finished "rm -rf repo" &&
     -			git init --ref-format=$from_format repo &&
    -+			git init --ref-storage=$from_format repo &&
    ++			git init --ref-storage-format=$from_format repo &&
      			(
      				cd repo &&
      				test_commit initial A &&
    @@ t/t1460-refs-migrate.sh: do
      		test_expect_success "$from_format -> $to_format: skip reflog with --skip-reflog" '
      			test_when_finished "rm -rf repo" &&
     -			git init --ref-format=$from_format repo &&
    -+			git init --ref-storage=$from_format repo &&
    ++			git init --ref-storage-format=$from_format repo &&
      			test_commit -C repo initial &&
      			# we see that the repository contains reflogs.
      			git -C repo reflog --all >reflogs &&
    @@ t/t1460-refs-migrate.sh: done
      test_expect_success 'multiple reftable blocks with multiple entries' '
      	test_when_finished "rm -rf repo" &&
     -	git init --ref-format=files repo &&
    -+	git init --ref-storage=files repo &&
    ++	git init --ref-storage-format=files repo &&
      	test_commit -C repo first &&
      	test_seq -f "create refs/heads/ref-%d HEAD" 5000 |
      	git -C repo update-ref --stdin &&
    @@ t/t1460-refs-migrate.sh: test_expect_success 'multiple reftable blocks with mult
      test_expect_success 'migrating from files format deletes backend files' '
      	test_when_finished "rm -rf repo" &&
     -	git init --ref-format=files repo &&
    -+	git init --ref-storage=files repo &&
    ++	git init --ref-storage-format=files repo &&
      	test_commit -C repo first &&
      	git -C repo pack-refs --all &&
      	test_commit -C repo second &&
    @@ t/t1460-refs-migrate.sh: test_expect_success 'migrating from files format delete
      test_expect_success 'migrating from reftable format deletes backend files' '
      	test_when_finished "rm -rf repo" &&
     -	git init --ref-format=reftable repo &&
    -+	git init --ref-storage=reftable repo &&
    ++	git init --ref-storage-format=reftable repo &&
      	test_commit -C repo first &&
      
      	test_path_is_dir repo/.git/reftable &&
    @@ t/t1900-repo-info.sh: test_repo_info () {
      
      test_repo_info 'ref format files is retrieved correctly' \
     -	'git init --ref-format=files' 'format-files' 'references.format' 'files'
    -+	'git init --ref-storage=files' 'format-files' 'references.format' 'files'
    ++	'git init --ref-storage-format=files' 'format-files' 'references.format' 'files'
      
      test_repo_info 'ref format reftable is retrieved correctly' \
     -	'git init --ref-format=reftable' 'format-reftable' 'references.format' 'reftable'
    -+	'git init --ref-storage=reftable' 'format-reftable' 'references.format' 'reftable'
    ++	'git init --ref-storage-format=reftable' 'format-reftable' 'references.format' 'reftable'
      
      test_repo_info 'bare repository = false is retrieved correctly' \
      	'git init' 'nonbare' 'layout.bare' 'false'
    @@ t/t1900-repo-info.sh: test_expect_success 'values returned in order requested' '
      	layout.bare=false
      	EOF
     -	git init --ref-format=files ordered &&
    -+	git init --ref-storage=files ordered &&
    ++	git init --ref-storage-format=files ordered &&
      	git -C ordered repo info layout.bare references.format layout.bare >actual &&
      	test_cmp expect actual
      '
    @@ t/t5510-fetch.sh: test_expect_success CASE_INSENSITIVE_FS,REFFILES 'existing ref
      	test_when_finished rm -rf base repo &&
      	(
     -		git init --ref-format=reftable base &&
    -+		git init --ref-storage=reftable base &&
    ++		git init --ref-storage-format=reftable base &&
      		cd base &&
      		echo >file update &&
      		git add . &&
    @@ t/t5510-fetch.sh: test_expect_success REFFILES 'existing reference lock in repo'
      		cd .. &&
      
     -		git init --ref-format=files --bare repo &&
    -+		git init --ref-storage=files --bare repo &&
    ++		git init --ref-storage-format=files --bare repo &&
      		cd repo &&
      		git remote add origin ../base &&
      		touch refs/heads/foo.lock &&
    @@ t/t5510-fetch.sh: test_expect_success CASE_INSENSITIVE_FS,REFFILES 'D/F conflict
      	test_when_finished rm -rf base repo &&
      	(
     -		git init --ref-format=reftable base &&
    -+		git init --ref-storage=reftable base &&
    ++		git init --ref-storage-format=reftable base &&
      		cd base &&
      		echo >file update &&
      		git add . &&
    @@ t/t5510-fetch.sh: test_expect_success REFFILES 'D/F conflict on case sensitive f
      		cd .. &&
      
     -		git init --ref-format=files --bare repo &&
    -+		git init --ref-storage=files --bare repo &&
    ++		git init --ref-storage-format=files --bare repo &&
      		cd repo &&
      		git remote add origin ../base &&
      		mkdir refs/heads/foo &&
    @@ t/t7424-submodule-mixed-ref-formats.sh: test_expect_success 'add existing reposi
      		cd parent &&
      		test_commit parent &&
     -		git init --ref-format=$OTHER_FORMAT submodule &&
    -+		git init --ref-storage=$OTHER_FORMAT submodule &&
    ++		git init --ref-storage-format=$OTHER_FORMAT submodule &&
      		test_commit -C submodule submodule &&
      		git submodule add ./submodule
      	)
 2:  fed94ab4c5 !  2:  d5b7ea9c18 builtin/clone: rename "--ref-format=" to "--ref-storage="
    @@ Metadata
     Author: Patrick Steinhardt <ps@pks.im>
     
      ## Commit message ##
    -    builtin/clone: rename "--ref-format=" to "--ref-storage="
    +    builtin/clone: rename "--ref-format=" to "--ref-storage-format="
     
         With the same reasoning as for git-init(1), rename "--ref-format=" to
    -    "--ref-storage=" and keep the old name as an alias.
    +    "--ref-storage-format=" and keep the old name as an alias.
     
         Signed-off-by: Patrick Steinhardt <ps@pks.im>
     
    @@ Documentation/git-clone.adoc: or `--mirror` is given)
      	tree.
      
     -`--ref-format=<ref-format>`::
    -+`--ref-storage=<ref-format>`::
    ++`--ref-storage-format=<format>`::
      
      Specify the given ref storage format for the repository. The valid values are:
      +
    @@ builtin/clone.c: int cmd_clone(int argc,
      	struct string_list option_not = STRING_LIST_INIT_NODUP;
      	const char *real_git_dir = NULL;
     -	const char *ref_format = NULL;
    -+	const char *ref_storage = NULL;
    ++	const char *ref_storage_format_str = NULL;
      	const char *option_upload_pack = "git-upload-pack";
      	int option_progress = -1;
      	int option_sparse_checkout = 0;
    @@ builtin/clone.c: int cmd_clone(int argc,
      			   N_("separate git dir from working tree")),
     -		OPT_STRING(0, "ref-format", &ref_format, N_("format"),
     -			   N_("specify the reference format to use")),
    -+		OPT_STRING(0, "ref-storage", &ref_storage, N_("format"),
    ++		OPT_STRING(0, "ref-storage-format", &ref_storage_format_str, N_("format"),
     +			   N_("specify the reference storage format to use")),
    -+		OPT_STRING_F(0, "ref-format", &ref_storage, N_("format"),
    ++		OPT_STRING_F(0, "ref-format", &ref_storage_format_str, N_("format"),
     +			   N_("specify the reference storage format to use"), PARSE_OPT_HIDDEN),
      		OPT_STRING_LIST('c', "config", &option_config, N_("key=value"),
      				N_("set config inside the new repository")),
    @@ builtin/clone.c: int cmd_clone(int argc,
      
     -	if (ref_format) {
     -		ref_storage_format = ref_storage_format_by_name(ref_format);
    -+	if (ref_storage) {
    -+		ref_storage_format = ref_storage_format_by_name(ref_storage);
    ++	if (ref_storage_format_str) {
    ++		ref_storage_format = ref_storage_format_by_name(ref_storage_format_str);
      		if (ref_storage_format == REF_STORAGE_FORMAT_UNKNOWN)
     -			die(_("unknown ref storage format '%s'"), ref_format);
    -+			die(_("unknown ref storage format '%s'"), ref_storage);
    ++			die(_("unknown ref storage format '%s'"), ref_storage_format_str);
      	}
      
      	if (option_mirror) {
    @@ builtin/clone.c: int cmd_clone(int argc,
      ## t/t0610-reftable-basics.sh ##
     @@ t/t0610-reftable-basics.sh: test_expect_success 'clone: can clone reffiles into reftable repository' '
      	test_when_finished "rm -rf reffiles reftable" &&
    - 	git init --ref-storage=files reffiles &&
    + 	git init --ref-storage-format=files reffiles &&
      	test_commit -C reffiles A &&
     -	git clone --ref-format=reftable ./reffiles reftable &&
    -+	git clone --ref-storage=reftable ./reffiles reftable &&
    ++	git clone --ref-storage-format=reftable ./reffiles reftable &&
      
      	git -C reffiles rev-parse HEAD >expect &&
      	git -C reftable rev-parse HEAD >actual &&
     @@ t/t0610-reftable-basics.sh: test_expect_success 'clone: can clone reftable into reffiles repository' '
      	test_when_finished "rm -rf reffiles reftable" &&
    - 	git init --ref-storage=reftable reftable &&
    + 	git init --ref-storage-format=reftable reftable &&
      	test_commit -C reftable A &&
     -	git clone --ref-format=files ./reftable reffiles &&
    -+	git clone --ref-storage=files ./reftable reffiles &&
    ++	git clone --ref-storage-format=files ./reftable reffiles &&
      
      	git -C reftable rev-parse HEAD >expect &&
      	git -C reffiles rev-parse HEAD >actual &&
    @@ t/t0610-reftable-basics.sh: test_expect_success 'clone: can clone reftable into
      ## t/t1460-refs-migrate.sh ##
     @@ t/t1460-refs-migrate.sh: do
      			test_when_finished "rm -rf repo repo.git" &&
    - 			git init --ref-storage=$from_format repo &&
    + 			git init --ref-storage-format=$from_format repo &&
      			test_commit -C repo initial &&
     -			git clone --ref-format=$from_format --mirror repo repo.git &&
    -+			git clone --ref-storage=$from_format --mirror repo repo.git &&
    ++			git clone --ref-storage-format=$from_format --mirror repo repo.git &&
      			test_migration repo.git "$to_format"
      		'
      
    @@ t/t5510-fetch.sh: test_expect_success "clone and setup child repos" '
      	git clone . bundle &&
      	git clone . seven &&
     -	git clone --ref-format=reftable . case_sensitive &&
    -+	git clone --ref-storage=reftable . case_sensitive &&
    ++	git clone --ref-storage-format=reftable . case_sensitive &&
      	(
      		cd case_sensitive &&
      		git branch branch1 &&
      		git branch bRanch1
      	) &&
     -	git clone --ref-format=reftable . case_sensitive_fd &&
    -+	git clone --ref-storage=reftable . case_sensitive_fd &&
    ++	git clone --ref-storage-format=reftable . case_sensitive_fd &&
      	(
      		cd case_sensitive_fd &&
      		git branch foo/bar &&
      		git branch Foo
      	) &&
     -	git clone --ref-format=reftable . case_sensitive_df &&
    -+	git clone --ref-storage=reftable . case_sensitive_df &&
    ++	git clone --ref-storage-format=reftable . case_sensitive_df &&
      	(
      		cd case_sensitive_df &&
      		git branch Foo/bar &&
    @@ t/t5601-clone.sh: test_expect_success 'clone --mirror does not repeat tags' '
      test_expect_success 'clone with files ref format' '
      	test_when_finished "rm -rf ref-storage" &&
     -	git clone --ref-format=files --mirror src ref-storage &&
    -+	git clone --ref-storage=files --mirror src 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 &&
      	test_cmp expect actual
    @@ t/t5601-clone.sh: test_expect_success 'clone with garbage ref format' '
      	fatal: unknown ref storage format ${SQ}garbage${SQ}
      	EOF
     -	test_must_fail git clone --ref-format=garbage --mirror src ref-storage 2>err &&
    -+	test_must_fail git clone --ref-storage=garbage --mirror src ref-storage 2>err &&
    ++	test_must_fail git clone --ref-storage-format=garbage --mirror src ref-storage 2>err &&
      	test_cmp expect err &&
      	test_path_is_missing ref-storage
      '
    @@ t/t7424-submodule-mixed-ref-formats.sh: test_expect_success 'recursive clone pro
     +	# specified via `--ref-storage`. The option should propagate to cloned
      	# submodules.
     -	git clone --ref-format=$OTHER_FORMAT --recurse-submodules \
    -+	git clone --ref-storage=$OTHER_FORMAT --recurse-submodules \
    ++	git clone --ref-storage-format=$OTHER_FORMAT --recurse-submodules \
      		upstream downstream &&
      	test_ref_format downstream "$OTHER_FORMAT" &&
      	test_ref_format downstream/submodule "$OTHER_FORMAT"
 3:  ca59e60c85 !  3:  253a0e1360 builtin/refs: rename "--ref-format=" to "--ref-storage="
    @@ Metadata
     Author: Patrick Steinhardt <ps@pks.im>
     
      ## Commit message ##
    -    builtin/refs: rename "--ref-format=" to "--ref-storage="
    +    builtin/refs: rename "--ref-format=" to "--ref-storage-format="
     
         With the same reasoning as for git-init(1), rename "--ref-format=" to
    -    "--ref-storage=" and keep the old name as an alias.
    +    "--ref-storage-format=" and keep the old name as an alias.
     
         Signed-off-by: Patrick Steinhardt <ps@pks.im>
     
    @@ Documentation/git-refs.adoc: git-refs - Low-level access to refs
      --------
      [synopsis]
     -git refs migrate --ref-format=<format> [--no-reflog] [--dry-run]
    -+git refs migrate --ref-storage=<format> [--no-reflog] [--dry-run]
    ++git refs migrate --ref-storage-format=<format> [--no-reflog] [--dry-run]
      git refs verify [--strict] [--verbose]
      git refs list [--count=<count>] [--shell|--perl|--python|--tcl]
      		   [(--sort=<key>)...] [--format=<format>]
    @@ Documentation/git-refs.adoc: OPTIONS
      
     -`--ref-format=<format>`::
     -	The ref format to migrate the ref store to. Can be one of:
    -+`--ref-storage=<format>`::
    ++`--ref-storage-format=<format>`::
     +	The ref storage format to migrate the ref store to. Can be one of:
      +
      include::ref-storage-format.adoc[]
    @@ builtin/fetch.c: static void ref_transaction_rejection_handler(const char *refna
      			"store all remote references on disk. Or you can alternatively\n"
      			"migrate your repository to use the 'reftable' backend with the\n"
     -			"following command:\n\n    git refs migrate --ref-format=reftable\n\n"
    -+			"following command:\n\n    git refs migrate --ref-storage=reftable\n\n"
    ++			"following command:\n\n    git refs migrate --ref-storage-format=reftable\n\n"
      			"Please keep in mind that not all implementations of Git support this\n"
      			"new format yet. So if you use tools other than Git to access this\n"
      			"repository it may not be an option to migrate to reftables.\n"));
    @@ builtin/refs.c
      
      #define REFS_MIGRATE_USAGE \
     -	N_("git refs migrate --ref-format=<format> [--no-reflog] [--dry-run]")
    -+	N_("git refs migrate --ref-storage=<format> [--no-reflog] [--dry-run]")
    ++	N_("git refs migrate --ref-storage-format=<format> [--no-reflog] [--dry-run]")
      
      #define REFS_VERIFY_USAGE \
      	N_("git refs verify [--strict] [--verbose]")
    @@ builtin/refs.c: static int cmd_refs_migrate(int argc, const char **argv, const c
      	struct option options[] = {
     -		OPT_STRING_F(0, "ref-format", &format_str, N_("format"),
     -			N_("specify the reference format to convert to"),
    -+		OPT_STRING_F(0, "ref-storage", &format_str, N_("format"),
    ++		OPT_STRING_F(0, "ref-storage-format", &format_str, N_("format"),
     +			N_("specify the reference storage format to convert to"),
      			PARSE_OPT_NONEG),
     +		OPT_STRING_F(0, "ref-format", &format_str, N_("format"),
    @@ builtin/refs.c: static int cmd_refs_migrate(int argc, const char **argv, const c
      		usage(_("too many arguments"));
      	if (!format_str)
     -		usage(_("missing --ref-format=<format>"));
    -+		usage(_("missing --ref-storage=<format>"));
    ++		usage(_("missing --ref-storage-format=<format>"));
      
      	format = ref_storage_format_by_name(format_str);
      	if (format == REF_STORAGE_FORMAT_UNKNOWN) {
    @@ t/t1423-ref-backend.sh: do
      				test_commit 3 &&
      
     -				git refs migrate --dry-run --ref-format=$to_format >out &&
    -+				git refs migrate --dry-run --ref-storage=$to_format >out &&
    ++				git refs migrate --dry-run --ref-storage-format=$to_format >out &&
      				BACKEND_PATH="$dir/$(sed "s/.* ${SQ}.git\/\(.*\)${SQ}/\1/" out)" &&
      				test_refs_backend . $from_format "$to_format://$BACKEND_PATH" "$method"
      			)
    @@ t/t1423-ref-backend.sh: do
      				test_commit 3 &&
      
     -				git refs migrate --dry-run --ref-format=$to_format >out &&
    -+				git refs migrate --dry-run --ref-storage=$to_format >out &&
    ++				git refs migrate --dry-run --ref-storage-format=$to_format >out &&
      				BACKEND_PATH="$dir/$(sed "s/.* ${SQ}.git\/\(.*\)${SQ}/\1/" out)" &&
      
      				test_refs_backend . $from_format "$to_format://$BACKEND_PATH" "$method" &&
    @@ t/t1423-ref-backend.sh: do
      				test_commit 3 &&
      
     -				git refs migrate --dry-run --ref-format=$to_format >out &&
    -+				git refs migrate --dry-run --ref-storage=$to_format >out &&
    ++				git refs migrate --dry-run --ref-storage-format=$to_format >out &&
      				BACKEND_PATH="$dir/$(sed "s/.* ${SQ}.git\/\(.*\)${SQ}/\1/" out)" &&
      
      				run_with_uri . "$from_format" "$to_format://$BACKEND_PATH" \
    @@ t/t1423-ref-backend.sh: do
      			test_commit 3 &&
      
     -			git refs migrate --ref-format=$to_format &&
    -+			git refs migrate --ref-storage=$to_format &&
    ++			git refs migrate --ref-storage-format=$to_format &&
      			git refs list >out &&
      			test_grep "refs/tags/1"	out &&
      			test_grep "refs/tags/2"	out &&
    @@ t/t1460-refs-migrate.sh: test_migration () {
      	fi &&
      
     -	git -C "$repo" refs migrate --ref-format="$format" "$@" &&
    -+	git -C "$repo" refs migrate --ref-storage="$format" "$@" &&
    ++	git -C "$repo" refs migrate --ref-storage-format="$format" "$@" &&
      
      	git -C "$repo" for-each-ref --include-root-refs \
      		--format='%(refname) %(objectname) %(symref)' >actual &&
    @@ t/t1460-refs-migrate.sh: test_expect_success "missing ref storage format" '
      	test_must_fail git -C repo refs migrate 2>err &&
      	cat >expect <<-EOF &&
     -	usage: missing --ref-format=<format>
    -+	usage: missing --ref-storage=<format>
    ++	usage: missing --ref-storage-format=<format>
      	EOF
      	test_cmp expect err
      '
    @@ t/t1460-refs-migrate.sh: test_expect_success "unknown ref storage format" '
      	git init repo &&
      	test_must_fail git -C repo refs migrate \
     -		--ref-format=unknown 2>err &&
    -+		--ref-storage=unknown 2>err &&
    ++		--ref-storage-format=unknown 2>err &&
      	cat >expect <<-EOF &&
      	error: unknown ref storage format ${SQ}unknown${SQ}
      	EOF
     @@ t/t1460-refs-migrate.sh: do
      			test_when_finished "rm -rf repo" &&
    - 			git init --ref-storage=$from_format repo &&
    + 			git init --ref-storage-format=$from_format repo &&
      			test_must_fail git -C repo refs migrate \
     -				--ref-format=$from_format 2>err &&
    -+				--ref-storage=$from_format 2>err &&
    ++				--ref-storage-format=$from_format 2>err &&
      			cat >expect <<-EOF &&
      			error: repository already uses ${SQ}$from_format${SQ} format
      			EOF
     @@ t/t1460-refs-migrate.sh: do
    - 			git init --ref-storage=$from_format repo &&
    + 			git init --ref-storage-format=$from_format repo &&
      			git -C repo worktree add wt &&
      			test_must_fail git -C repo refs migrate \
     -				--ref-format=$to_format 2>err &&
    -+				--ref-storage=$to_format 2>err &&
    ++				--ref-storage-format=$to_format 2>err &&
      			cat >expect <<-EOF &&
      			error: migrating repositories with worktrees is not supported yet
      			EOF
     @@ t/t1460-refs-migrate.sh: do
    - 			git init --ref-storage=$from_format repo &&
    + 			git init --ref-storage-format=$from_format repo &&
      			test_commit -C repo initial &&
      			git -C repo refs migrate --dry-run \
     -				--ref-format=$to_format >output &&
    -+				--ref-storage=$to_format >output &&
    ++				--ref-storage-format=$to_format >output &&
      			test_grep "Finished dry-run migration of refs" output &&
      			test_path_is_dir repo/.git/ref_migration.* &&
      			echo $from_format >expect &&
    @@ t/t7424-submodule-mixed-ref-formats.sh: test_expect_success 'status with mixed s
      	git -C main submodule add "file://$(pwd)/submodule" &&
      	git -C main commit -m "add submodule" &&
     -	git -C main/submodule refs migrate --ref-format=$OTHER_FORMAT &&
    -+	git -C main/submodule refs migrate --ref-storage=$OTHER_FORMAT &&
    ++	git -C main/submodule refs migrate --ref-storage-format=$OTHER_FORMAT &&
      
      	# The main repository should use the default ref format now, whereas
      	# the submodule should use the other format.
 4:  1fd412e727 !  4:  00a5bf641d builtin/submodule: rename "--ref-format=" to "--ref-storage="
    @@ Metadata
     Author: Patrick Steinhardt <ps@pks.im>
     
      ## Commit message ##
    -    builtin/submodule: rename "--ref-format=" to "--ref-storage="
    +    builtin/submodule: rename "--ref-format=" to "--ref-storage-format="
     
         With the same reasoning as for git-init(1), rename "--ref-format=" to
    -    "--ref-storage=" and keep the old name as an alias.
    +    "--ref-storage-format=" and keep the old name as an alias.
     
         Note that this commit is a bit more complex compared to the others as we
         also need to adapt the submodule helper for consistency. But overall,
    @@ Documentation/git-submodule.adoc: COMMANDS
      subcommands are available to perform operations on the submodules.
      
     -`add [-b <branch>] [-f | --force] [--name <name>] [--reference <repository>] [--ref-format <format>] [--depth <depth>] [--] <repository> [<path>]`::
    -+`add [-b <branch>] [-f | --force] [--name <name>] [--reference <repository>] [--ref-storage <format>] [--depth <depth>] [--] <repository> [<path>]`::
    ++`add [-b <branch>] [-f | --force] [--name <name>] [--reference <repository>] [--ref-storage-format <format>] [--depth <depth>] [--] <repository> [<path>]`::
      	Add the given repository as a submodule at the given path
      	to the changeset to be committed next to the current
      	project: the current project is termed the "superproject".
    @@ Documentation/git-submodule.adoc: location, and only the superproject's URL need
      URL in `.gitmodules`.
      +
     -If `--ref-format <format>`  is specified, the ref storage format of newly
    -+If `--ref-storage <format>`  is specified, the ref storage format of newly
    ++If `--ref-storage-format <format>`  is specified, the ref storage format of newly
      cloned submodules will be set accordingly.
      
      `status [--cached] [--recursive] [--] [<path>...]`::
    @@ Documentation/git-submodule.adoc: If you really want to remove a submodule from
      options.
      
     -`update [--init] [--remote] [-N | --no-fetch] [--[no-]recommend-shallow] [-f | --force] [--checkout | --rebase | --merge] [--reference=<repository>] [--ref-format=<format>] [--depth=<depth>] [--recursive] [--jobs <n>] [--[no-]single-branch] [--filter=<filter-spec>] [--] [<path>...]`::
    -+`update [--init] [--remote] [-N | --no-fetch] [--[no-]recommend-shallow] [-f | --force] [--checkout | --rebase | --merge] [--reference=<repository>] [--ref-storage=<format>] [--depth=<depth>] [--recursive] [--jobs <n>] [--[no-]single-branch] [--filter=<filter-spec>] [--] [<path>...]`::
    ++`update [--init] [--remote] [-N | --no-fetch] [--[no-]recommend-shallow] [-f | --force] [--checkout | --rebase | --merge] [--reference=<repository>] [--ref-storage-format=<format>] [--depth=<depth>] [--recursive] [--jobs <n>] [--[no-]single-branch] [--filter=<filter-spec>] [--] [<path>...]`::
      +
      --
      Update the registered submodules to match what the superproject
    @@ Documentation/git-submodule.adoc: submodule with the `--init` option.
      registered submodules, and update any nested submodules within.
      
     -If `--ref-format <format>`  is specified, the ref storage format of newly
    -+If `--ref-storage <format>`  is specified, the ref storage format of newly
    ++If `--ref-storage-format <format>`  is specified, the ref storage format of newly
      cloned submodules will be set accordingly.
      
      If `--filter <filter-spec>` is specified, the given partial clone filter will be
    @@ builtin/clone.c: static int checkout(int submodule_progress,
      
      		if (ref_storage_format != REF_STORAGE_FORMAT_UNKNOWN)
     -			strvec_pushf(&cmd.args, "--ref-format=%s",
    -+			strvec_pushf(&cmd.args, "--ref-storage=%s",
    ++			strvec_pushf(&cmd.args, "--ref-storage-format=%s",
      				     ref_storage_format_to_name(ref_storage_format));
      
      		if (filter_submodules && filter_options->choice)
    @@ builtin/submodule--helper.c: static int clone_submodule(const struct module_clon
      		}
      		if (clone_data->ref_storage_format != REF_STORAGE_FORMAT_UNKNOWN)
     -			strvec_pushf(&cp.args, "--ref-format=%s",
    -+			strvec_pushf(&cp.args, "--ref-storage=%s",
    ++			strvec_pushf(&cp.args, "--ref-storage-format=%s",
      				     ref_storage_format_to_name(clone_data->ref_storage_format));
      		if (clone_data->dissociate)
      			strvec_push(&cp.args, "--dissociate");
    @@ builtin/submodule--helper.c: static int module_clone(int argc, const char **argv
      			   N_("reference repository")),
     -		OPT_STRING(0, "ref-format", &ref_storage_format, N_("format"),
     -			   N_("specify the reference format to use")),
    -+		OPT_STRING(0, "ref-storage", &ref_storage_format, N_("format"),
    ++		OPT_STRING(0, "ref-storage-format", &ref_storage_format, N_("format"),
     +			   N_("specify the reference storage format to use")),
     +		OPT_STRING_F(0, "ref-format", &ref_storage_format, N_("format"),
     +			     N_("specify the reference storage format to use"), PARSE_OPT_HIDDEN),
    @@ builtin/submodule--helper.c: static int prepare_to_clone_next_submodule(const st
      		strvec_push(&child->args, "--require-init");
      	if (suc->update_data->ref_storage_format != REF_STORAGE_FORMAT_UNKNOWN)
     -		strvec_pushf(&child->args, "--ref-format=%s",
    -+		strvec_pushf(&child->args, "--ref-storage=%s",
    ++		strvec_pushf(&child->args, "--ref-storage-format=%s",
      			     ref_storage_format_to_name(suc->update_data->ref_storage_format));
      	strvec_pushl(&child->args, "--path", sub->path, NULL);
      	strvec_pushl(&child->args, "--name", sub->name, NULL);
    @@ builtin/submodule--helper.c: static void update_data_to_args(const struct update
      	}
      	if (update_data->ref_storage_format != REF_STORAGE_FORMAT_UNKNOWN)
     -		strvec_pushf(args, "--ref-format=%s",
    -+		strvec_pushf(args, "--ref-storage=%s",
    ++		strvec_pushf(args, "--ref-storage-format=%s",
      			     ref_storage_format_to_name(update_data->ref_storage_format));
      	if (update_data->filter_options && update_data->filter_options->choice)
      		strvec_pushf(args, "--filter=%s",
    @@ builtin/submodule--helper.c: static int module_update(int argc, const char **arg
      			   N_("reference repository")),
     -		OPT_STRING(0, "ref-format", &ref_storage_format, N_("format"),
     -			   N_("specify the reference format to use")),
    -+		OPT_STRING(0, "ref-storage", &ref_storage_format, N_("format"),
    ++		OPT_STRING(0, "ref-storage-format", &ref_storage_format, N_("format"),
     +			   N_("specify the reference storage format to use")),
     +		OPT_STRING_F(0, "ref-format", &ref_storage_format, N_("format"),
     +			     N_("specify the reference storage format to use"), PARSE_OPT_HIDDEN),
    @@ builtin/submodule--helper.c: static int module_add(int argc, const char **argv,
      			   N_("reference repository")),
     -		OPT_STRING(0, "ref-format", &ref_storage_format, N_("format"),
     -			   N_("specify the reference format to use")),
    -+		OPT_STRING(0, "ref-storage", &ref_storage_format, N_("format"),
    ++		OPT_STRING(0, "ref-storage-format", &ref_storage_format, N_("format"),
     +			   N_("specify the reference storage format to use")),
     +		OPT_STRING_F(0, "ref-format", &ref_storage_format, N_("format"),
     +			     N_("specify the reference storage format to use"), PARSE_OPT_HIDDEN),
    @@ git-submodule.sh: cmd_add()
      			reference="$1"
      			;;
     -		--ref-format)
    -+		--ref-format|--ref-storage)
    ++		--ref-format|--ref-storage-format)
      			case "$2" in '') usage ;; esac
     -			ref_format="--ref-format=$2"
    -+			ref_storage="--ref-storage=$2"
    ++			ref_storage_format="--ref-storage-format=$2"
      			shift
      			;;
     -		--ref-format=*)
     -			ref_format="$1"
    -+		--ref-format=*|--ref-storage=*)
    -+			ref_storage="$1"
    ++		--ref-format=*|--ref-storage-format=*)
    ++			ref_storage_format="$1"
      			;;
      		--dissociate)
      			dissociate=$1
    @@ git-submodule.sh: cmd_add()
      		${branch:+"$branch"} \
      		${reference:+"$reference"} \
     -		${ref_format:+"$ref_format"} \
    -+		${ref_storage:+"$ref_storage"} \
    ++		${ref_storage_format:+"$ref_storage_format"} \
      		$dissociate \
      		${name:+"$name"} \
      		${depth:+"$depth"} \
    @@ git-submodule.sh: cmd_update()
      			rebase=$1
      			;;
     -		--ref-format)
    -+		--ref-format|--ref-storage)
    ++		--ref-format|--ref-storage-format)
      			case "$2" in '') usage ;; esac
     -			ref_format="--ref-format=$2"
    -+			ref_storage="--ref-storage=$2"
    ++			ref_storage_format="--ref-storage-format=$2"
      			shift
      			;;
     -		--ref-format=*)
     -			ref_format="$1"
    -+		--ref-format=*|--ref-storage=*)
    -+			ref_storage="$1"
    ++		--ref-format=*|--ref-storage-format=*)
    ++			ref_storage_format="$1"
      			;;
      		--reference)
      			case "$2" in '') usage ;; esac
    @@ git-submodule.sh: cmd_update()
      		$merge \
      		$checkout \
     -		${ref_format:+"$ref_format"} \
    -+		${ref_storage:+"$ref_storage"} \
    ++		${ref_storage_format:+"$ref_storage_format"} \
      		${reference:+"$reference"} \
      		$dissociate \
      		${depth:+"$depth"} \
    @@ t/t7424-submodule-mixed-ref-formats.sh: test_expect_success 'add submodules with
      	git init upstream &&
      	test_ref_format upstream "$GIT_DEFAULT_REF_FORMAT" &&
     -	git -C upstream submodule add --ref-format="$OTHER_FORMAT" "file://$(pwd)/submodule" &&
    -+	git -C upstream submodule add --ref-storage="$OTHER_FORMAT" "file://$(pwd)/submodule" &&
    ++	git -C upstream submodule add --ref-storage-format="$OTHER_FORMAT" "file://$(pwd)/submodule" &&
      	test_ref_format upstream/submodule "$OTHER_FORMAT"
      '
      
    +@@ t/t7424-submodule-mixed-ref-formats.sh: test_expect_success 'recursive clone propagates ref storage format' '
    + 	test_ref_format upstream/submodule "$GIT_DEFAULT_REF_FORMAT" &&
    + 
    + 	# The cloned repositories should use the other ref format that we have
    +-	# specified via `--ref-storage`. The option should propagate to cloned
    ++	# specified via `--ref-storage-format`. The option should propagate to cloned
    + 	# submodules.
    + 	git clone --ref-storage-format=$OTHER_FORMAT --recurse-submodules \
    + 		upstream downstream &&
     @@ t/t7424-submodule-mixed-ref-formats.sh: test_expect_success 'clone submodules with different ref storage format' '
      
      	git clone --no-recurse-submodules "file://$(pwd)/upstream" downstream &&
      	test_ref_format downstream "$GIT_DEFAULT_REF_FORMAT" &&
     -	git -C downstream submodule update --init --ref-format=$OTHER_FORMAT &&
    -+	git -C downstream submodule update --init --ref-storage=$OTHER_FORMAT &&
    ++	git -C downstream submodule update --init --ref-storage-format=$OTHER_FORMAT &&
      	test_ref_format downstream/submodule "$OTHER_FORMAT"
      '
      
    @@ t/t7424-submodule-mixed-ref-formats.sh: test_expect_success 'recursive pull with
      	# submodules have different formats.
      	git clone --no-recurse-submodules "file://$(pwd)/upstream" downstream &&
     -	git -C downstream submodule update --init --ref-format=$OTHER_FORMAT &&
    -+	git -C downstream submodule update --init --ref-storage=$OTHER_FORMAT &&
    ++	git -C downstream submodule update --init --ref-storage-format=$OTHER_FORMAT &&
      	test_ref_format downstream "$GIT_DEFAULT_REF_FORMAT" &&
      	test_ref_format downstream/submodule "$OTHER_FORMAT" &&
      
 5:  8abcb5c6df !  5:  25cdb00f8c builtin/rev-parse: rename "--show-ref-format" to "--show-ref-storage"
    @@ Metadata
     Author: Patrick Steinhardt <ps@pks.im>
     
      ## Commit message ##
    -    builtin/rev-parse: rename "--show-ref-format" to "--show-ref-storage"
    +    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" and keep the old name as an alias.
    +    to "--show-ref-storage-format" and keep the old name as an alias.
     
         Signed-off-by: Patrick Steinhardt <ps@pks.im>
     
    @@ Documentation/git-rev-parse.adoc: The following options are unaffected by `--pat
      	not specified, the default is "storage".
      
     ---show-ref-format::
    -+--show-ref-storage::
    ++--show-ref-storage-format::
      	Show the reference storage format used for the repository.
      
      
    @@ builtin/rev-parse.c: int cmd_rev_parse(int argc,
      				continue;
      			}
     -			if (!strcmp(arg, "--show-ref-format")) {
    -+			if (!strcmp(arg, "--show-ref-format") || !strcmp(arg, "--show-ref-storage")) {
    ++			if (!strcmp(arg, "--show-ref-format") || !strcmp(arg, "--show-ref-storage-format")) {
      				puts(ref_storage_format_to_name(the_repository->ref_storage_format));
      				continue;
      			}
    @@ contrib/completion/git-prompt.sh: __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 \
    ++		--is-bare-repository --is-inside-work-tree --show-ref-storage-format \
      		--short HEAD 2>/dev/null)"
      	rev_parse_exit_code="$?"
      
    @@ t/perf/perf-lib.sh: test_perf_create_repo_from () {
      	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)"
    -+	refstorage="$("$MODERN_GIT" -C "$source" rev-parse --show-ref-storage)"
    ++	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"
      	(
    @@ t/perf/perf-lib.sh: test_perf_create_repo_from () {
      	) &&
      	(
      		cd "$repo" &&
    --		"$MODERN_GIT" init -q --ref-storage="$refformat" --object-format="$objectformat" &&
    -+		"$MODERN_GIT" init -q --ref-storage="$refstorage" --object-format="$objectformat" &&
    +-		"$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
    @@ t/t0001-init.sh: test_expect_success 'init warns about invalid init.defaultRefFo
      	test_cmp expect err &&
      
     -	git -C repo rev-parse --show-ref-format >actual &&
    -+	git -C repo rev-parse --show-ref-storage >actual &&
    ++	git -C repo rev-parse --show-ref-storage-format >actual &&
      	echo $GIT_DEFAULT_REF_FORMAT >expected &&
      	test_cmp expected actual
      '
    @@ t/t0001-init.sh: test_expect_success 'default ref format' '
      	) &&
      	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 >actual &&
    ++	git -C refformat rev-parse --show-ref-storage-format >actual &&
      	test_cmp expect actual
      '
      
    @@ t/t0001-init.sh: do
      
      		echo $format >expect &&
     -		git -C refformat rev-parse --show-ref-format >actual &&
    -+		git -C refformat rev-parse --show-ref-storage >actual &&
    ++		git -C refformat rev-parse --show-ref-storage-format >actual &&
      		test_cmp expect actual
      	'
      
     @@ t/t0001-init.sh: do
      		test_when_finished "rm -rf refformat" &&
    - 		git init --ref-storage=$format 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 >actual &&
    ++		git -C refformat rev-parse --show-ref-storage-format >actual &&
      		test_cmp expect actual
      	'
      
    @@ t/t0001-init.sh: do
      
      		echo $format >expect &&
     -		git -C refformat rev-parse --show-ref-format >actual &&
    -+		git -C refformat rev-parse --show-ref-storage >actual &&
    ++		git -C refformat rev-parse --show-ref-storage-format >actual &&
      		test_cmp expect actual
      	'
      
     @@ t/t0001-init.sh: do
      		test_when_finished "rm -rf refformat" &&
    - 		GIT_DEFAULT_REF_FORMAT=garbage git init --ref-storage=$format 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 >actual &&
    ++		git -C refformat rev-parse --show-ref-storage-format >actual &&
      		test_cmp expect actual
      	'
      
    @@ t/t0001-init.sh: do
      		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 >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 >actual &&
    ++		git -C refformat rev-parse --show-ref-storage-format >actual &&
      		test_cmp expect actual
      	'
      done
    -@@ t/t0001-init.sh: test_expect_success "--ref-storage= overrides GIT_DEFAULT_REF_FORMAT" '
    +@@ t/t0001-init.sh: 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=reftable 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 >actual &&
    ++	git -C refformat rev-parse --show-ref-storage-format >actual &&
      	test_cmp expect actual
      '
      
    @@ t/t0001-init.sh: test_expect_success "GIT_DEFAULT_REF_FORMAT= overrides init.def
      	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 >actual &&
    ++	git -C refformat rev-parse --show-ref-storage-format >actual &&
      	test_cmp expect actual
      '
      
    @@ t/t0001-init.sh: test_expect_success "init with feature.experimental=true" '
      	) &&
      	echo reftable >expect &&
     -	git -C refformat rev-parse --show-ref-format >actual &&
    -+	git -C refformat rev-parse --show-ref-storage >actual &&
    ++	git -C refformat rev-parse --show-ref-storage-format >actual &&
      	test_cmp expect actual
      '
      
    @@ t/t0001-init.sh: test_expect_success "init.defaultRefFormat overrides feature.ex
      	) &&
      	echo files >expect &&
     -	git -C refformat rev-parse --show-ref-format >actual &&
    -+	git -C refformat rev-parse --show-ref-storage >actual &&
    ++	git -C refformat rev-parse --show-ref-storage-format >actual &&
      	test_cmp expect actual
      '
      
    @@ t/t0001-init.sh: test_expect_success "GIT_DEFAULT_REF_FORMAT= overrides feature.
      	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 >actual &&
    ++	git -C refformat rev-parse --show-ref-storage-format >actual &&
      	test_cmp expect actual
      '
      
     @@ t/t0001-init.sh: do
    - 		git init --ref-storage=$from_format refformat &&
    - 		git init --ref-storage=$from_format refformat &&
    + 		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 >actual &&
    ++		git -C refformat rev-parse --show-ref-storage-format >actual &&
      		test_cmp expect actual
      	'
      
     @@ t/t0001-init.sh: do
    - 			test_must_fail git init --ref-storage=$to_format refformat 2>err &&
    + 			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 >actual &&
    ++			git -C refformat rev-parse --show-ref-storage-format >actual &&
      			test_cmp expect actual
      		'
      	done
    @@ t/t0001-init.sh: test_expect_success 'init with includeIf.onbranch condition' '
      	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 >actual &&
    ++	git -C repo rev-parse --show-ref-storage-format >actual &&
      	test_cmp expect actual
      '
      
    @@ t/t0001-init.sh: test_expect_success 'init with includeIf.onbranch condition wit
      	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 >actual &&
    ++	git -C repo rev-parse --show-ref-storage-format >actual &&
      	test_cmp expect actual
      '
      
    @@ t/t0001-init.sh: test_expect_success 're-init with includeIf.onbranch condition'
      	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 >actual &&
    ++	git -C repo rev-parse --show-ref-storage-format >actual &&
      	test_cmp expect actual
      '
      
    @@ t/t0610-reftable-basics.sh: test_expect_success 'init: creates basic reftable st
      	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 >actual &&
    ++	git -C repo rev-parse --show-ref-storage-format >actual &&
      	test_cmp expect actual
      '
      
    @@ t/t0610-reftable-basics.sh: test_expect_success 'init: sha256 object format via
      	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 >actual &&
    ++	git -C repo rev-parse --show-object-format --show-ref-storage-format >actual &&
      	test_cmp expect actual
      '
      
    @@ t/t0610-reftable-basics.sh: test_expect_success 'init: sha256 object format via
      	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 >actual &&
    ++	git -C repo rev-parse --show-object-format --show-ref-storage-format >actual &&
      	test_cmp expect actual
      '
      
    @@ t/t0610-reftable-basics.sh: test_expect_success 'clone: can clone reftable repos
      	git clone repo cloned &&
      	echo reftable >expect &&
     -	git -C cloned rev-parse --show-ref-format >actual &&
    -+	git -C cloned rev-parse --show-ref-storage >actual &&
    ++	git -C cloned rev-parse --show-ref-storage-format >actual &&
      	test_cmp expect actual &&
      	test_path_is_file cloned/file1
      '
    @@ t/t0610-reftable-basics.sh: test_expect_success 'clone: can clone reffiles into
      	test_cmp expect actual &&
      
     -	git -C reftable rev-parse --show-ref-format >actual &&
    -+	git -C reftable rev-parse --show-ref-storage >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 >actual &&
    ++	git -C reffiles rev-parse --show-ref-storage-format >actual &&
      	echo files >expect &&
      	test_cmp expect actual
      '
    @@ t/t0610-reftable-basics.sh: test_expect_success 'clone: can clone reftable into
      	test_cmp expect actual &&
      
     -	git -C reftable rev-parse --show-ref-format >actual &&
    -+	git -C reftable rev-parse --show-ref-storage >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 >actual &&
    ++	git -C reffiles rev-parse --show-ref-storage-format >actual &&
      	echo files >expect &&
      	test_cmp expect actual
      '
    @@ t/t1460-refs-migrate.sh: test_migration () {
      	fi &&
      
     -	git -C "$repo" rev-parse --show-ref-format >actual &&
    -+	git -C "$repo" rev-parse --show-ref-storage >actual &&
    ++	git -C "$repo" rev-parse --show-ref-storage-format >actual &&
      	echo "$format" >expect &&
      	test_cmp expect actual
      }
    @@ t/t1460-refs-migrate.sh: do
      			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 >actual &&
    ++			git -C repo rev-parse --show-ref-storage-format >actual &&
      			test_cmp expect actual
      		'
      
    @@ t/t1500-rev-parse.sh: test_expect_success RUST 'rev-parse --show-object-format i
      '
      
     -test_expect_success 'rev-parse --show-ref-format' '
    -+test_expect_success 'rev-parse --show-ref-storage' '
    ++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 >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 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 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
      	)
      '
    @@ t/t1500-rev-parse.sh: test_expect_success RUST 'rev-parse --show-object-format i
      ## t/t5601-clone.sh ##
     @@ t/t5601-clone.sh: test_expect_success 'clone with files ref format' '
      	test_when_finished "rm -rf ref-storage" &&
    - 	git clone --ref-storage=files --mirror src 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 >actual &&
    ++	git -C ref-storage rev-parse --show-ref-storage-format >actual &&
      	test_cmp expect actual
      '
      
    @@ t/t7424-submodule-mixed-ref-formats.sh: test_description='submodules handle mixe
      test_ref_format () {
      	echo "$2" >expect &&
     -	git -C "$1" rev-parse --show-ref-format >actual &&
    -+	git -C "$1" rev-parse --show-ref-storage >actual &&
    ++	git -C "$1" rev-parse --show-ref-storage-format >actual &&
      	test_cmp expect actual
      }
      
 6:  b231264a6c !  6:  08a5f120a7 help: rename "default-ref-format" to "default-ref-storage"
    @@ Metadata
     Author: Patrick Steinhardt <ps@pks.im>
     
      ## Commit message ##
    -    help: rename "default-ref-format" to "default-ref-storage"
    +    help: rename "default-ref-format" to "default-ref-storage-format"
     
         When printing information about how specifically Git was built and what
         defaults it has we also print the default ref storage format used when
    @@ Commit message
         "reftable" backend.
     
         In preceding commits we have adapted "ref-format" parameters to be
    -    called "ref-storage" instead to resolve some conceptual mismatches. The
    -    build information is now the only place where we still refer to it as
    -    "default-ref-format".
    +    called "ref-storage-format" instead to resolve some conceptual
    +    mismatches. The build information is now the only place where we still
    +    refer to it as "default-ref-format".
     
    -    Rename the field to "default-ref-storage" instead.
    +    Rename the field to "default-ref-storage-format" instead.
     
         Signed-off-by: Patrick Steinhardt <ps@pks.im>
     
    @@ help.c: void get_version_info(struct strbuf *buf, int show_build_options)
      #endif
      		strbuf_addf(buf, "SHA-256: %s\n", SHA256_BACKEND);
     -		strbuf_addf(buf, "default-ref-format: %s\n",
    -+		strbuf_addf(buf, "default-ref-storage: %s\n",
    ++		strbuf_addf(buf, "default-ref-storage-format: %s\n",
      			    ref_storage_format_to_name(REF_STORAGE_FORMAT_DEFAULT));
      		strbuf_addf(buf, "default-hash: %s\n", hash_algos[GIT_HASH_DEFAULT].name);
      	}
    @@ t/t0001-init.sh: test_expect_success 'default ref format' '
      		git init refformat
      	) &&
     -	git version --build-options | sed -ne "s/^default-ref-format: //p" >expect &&
    -+	git version --build-options | sed -ne "s/^default-ref-storage: //p" >expect &&
    - 	git -C refformat rev-parse --show-ref-storage >actual &&
    ++	git version --build-options | sed -ne "s/^default-ref-storage-format: //p" >expect &&
    + 	git -C refformat rev-parse --show-ref-storage-format >actual &&
      	test_cmp expect actual
      '
 7:  afb4c5bf04 =  7:  dca79435f2 refs: expose function to parse reference URIs
 8:  bfe1888fd4 !  8:  44c87d6aa1 setup: refactor how we configure the ref storage format
    @@ Commit message
         and makes the whole logic significantly easier to extend going forward.
     
         Note that the new logic intentionally changes the precedence order so
    -    that "GIT_REFERENCE_BACKEND" is now overridden by the "--ref-storage="
    -    command line option. This matches our usual precedence order, where
    -    explicit command line arguments override environment variables.
    +    that "GIT_REFERENCE_BACKEND" is now overridden by the
    +    "--ref-storage-format=" command line option. This matches our usual
    +    precedence order, where explicit command line arguments override
    +    environment variables.
     
         Signed-off-by: Patrick Steinhardt <ps@pks.im>
     
    @@ setup.c: static void repository_format_configure(struct repository_format *repo_
     +	 * storage format:
     +	 *
     +	 *   1. Explicit override via the command line, like in `git init
    -+	 *      --ref-storage=`.
    ++	 *      --ref-storage-format=`.
     +	 *
     +	 *   2. Explicit override via the environment with
     +	 *      GIT_REFERENCE_BACKEND.
    @@ setup.c: static void repository_format_configure(struct repository_format *repo_
     +	} else if ((env = getenv(GIT_REFERENCE_BACKEND_ENVIRONMENT))) {
     +		ref_storage_format = ref_storage_format_by_uri(env, &ref_storage_payload);
     +		if (ref_storage_format == REF_STORAGE_FORMAT_UNKNOWN)
    -+			die(_("unknown reference storage format specified via %s: '%s'"),
    ++			die(_("unknown ref storage format specified via %s: '%s'"),
     +			    GIT_REFERENCE_BACKEND_ENVIRONMENT, env);
     +	} else if (repo_fmt->version >= 0) {
     +		ref_storage_format = repo_fmt->ref_storage_format;
    @@ setup.c: static void repository_format_configure(struct repository_format *repo_
     +	} else if ((env = getenv("GIT_DEFAULT_REF_FORMAT"))) {
     +		ref_storage_format = ref_storage_format_by_name(env);
     +		if (ref_storage_format == REF_STORAGE_FORMAT_UNKNOWN)
    -+			die(_("unknown reference storage format specified via %s: '%s'"),
    ++			die(_("unknown ref storage format specified via %s: '%s'"),
     +			    "GIT_DEFAULT_REF_FORMAT", env);
     +	} else if (cfg.ref_storage_format != REF_STORAGE_FORMAT_UNKNOWN) {
     +		ref_storage_format = cfg.ref_storage_format;
    @@ t/t0001-init.sh: test_expect_success DEFAULT_REPO_FORMAT 'extensions.refStorage
      	test_when_finished "rm -rf refformat" &&
      	cat >expect <<-EOF &&
     -	fatal: unknown ref storage format ${SQ}garbage${SQ}
    -+	fatal: unknown reference storage format specified via GIT_DEFAULT_REF_FORMAT: ${SQ}garbage${SQ}
    ++	fatal: unknown ref storage format specified via GIT_DEFAULT_REF_FORMAT: ${SQ}garbage${SQ}
      	EOF
      	test_must_fail env GIT_DEFAULT_REF_FORMAT=garbage git init refformat 2>err &&
      	test_cmp expect err
    @@ t/t0001-init.sh: test_expect_success DEFAULT_REPO_FORMAT 'extensions.refStorage
      
     +test_expect_success 'GIT_REFERENCE_BACKEND refuses to reinitialize with different storage format' '
     +	test_when_finished "rm -rf refbackend" &&
    -+	git init --ref-storage=files refbackend &&
    ++	git init --ref-storage-format=files refbackend &&
     +	cat >expect <<-EOF &&
     +	fatal: attempt to reinitialize repository with different reference storage format
     +	EOF
 9:  87f271e84d !  9:  63a0e94d20 setup: rename ref storage format environment variables
    @@ Commit message
     
         With the same reasoning as for git-init(1), rename the environment
         variables GIT_REFERENCE_BACKEND and GIT_DEFAULT_REF_FORMAT to
    -    GIT_REF_STORAGE and GIT_DEFAULT_REF_STORAGE, respectively. The old names
    -    are kept as an alias to retain compatibility.
    +    GIT_REF_STORAGE_FORMAT and GIT_DEFAULT_REF_STORAGE_FORMAT, respectively.
    +    The old names are kept as an alias to retain compatibility.
    +
    +    While at it, fix indentation for `GIT_REF_STORAGE_FORMAT` docs to use
    +    tabs instead of spaces.
     
         Signed-off-by: Patrick Steinhardt <ps@pks.im>
     
    @@ Documentation/config/init.adoc
     @@ Documentation/config/init.adoc: endif::[]
      `init.defaultRefFormat`::
      	Allows overriding the default ref storage format for new repositories.
    - 	See `--ref-storage=` in linkgit:git-init[1]. Both the command line
    + 	See `--ref-storage-format=` in linkgit:git-init[1]. Both the command line
     -	option and the `GIT_DEFAULT_REF_FORMAT` environment variable take
    -+	option and the `GIT_DEFAULT_REF_STORAGE` environment variable take
    ++	option and the `GIT_DEFAULT_REF_STORAGE_FORMAT` environment variable take
      	precedence over this config.
      
      init.defaultSubmodulePathConfig::
    @@ Documentation/git.adoc: double-quotes and respecting backslash escapes. E.g., th
      	See `--object-format` in linkgit:git-init[1].
      
     -`GIT_DEFAULT_REF_FORMAT`::
    -+`GIT_DEFAULT_REF_STORAGE`::
    - 	If this variable is set, the default reference backend format for new
    +-	If this variable is set, the default reference backend format for new
    ++`GIT_DEFAULT_REF_STORAGE_FORMAT`::
    ++	If this variable is set, the default ref storage format for new
      	repositories will be set to this value. The default is "files".
    - 	See `--ref-storage` in linkgit:git-init[1].
    + 	See `--ref-storage-format` in linkgit:git-init[1].
      
     -`GIT_REFERENCE_BACKEND`::
     -    Specify which reference backend to be used along with its URI.
    -+`GIT_REF_STORAGE`::
    -+    Specify which ref storage to be used along with its URI.
    -     See `extensions.refStorage` option in linkgit:git-config[1] for more
    -     details. Overrides the config variable when used.
    - 
    +-    See `extensions.refStorage` option in linkgit:git-config[1] for more
    +-    details. Overrides the config variable when used.
    ++`GIT_REF_STORAGE_FORMAT`::
    ++	Specify which ref storage format to use along with its URI.
    ++	See `extensions.refStorage` option in linkgit:git-config[1] for more
    ++	details. Overrides the config variable when used.
    + 
    + Git Commits
    + ~~~~~~~~~~~
     
      ## environment.h ##
     @@
      #define GIT_TEXT_DOMAIN_DIR_ENVIRONMENT "GIT_TEXTDOMAINDIR"
      #define GIT_ATTR_SOURCE_ENVIRONMENT "GIT_ATTR_SOURCE"
      #define GIT_REFERENCE_BACKEND_ENVIRONMENT "GIT_REFERENCE_BACKEND"
    -+#define GIT_REF_STORAGE_ENVIRONMENT "GIT_REF_STORAGE"
    ++#define GIT_REF_STORAGE_FORMAT_ENVIRONMENT "GIT_REF_STORAGE_FORMAT"
      
      /*
       * Environment variable used to propagate the --no-advice global option to the
    @@ setup.c: const char *setup_git_directory_gently(struct repository *repo, int *no
      			 * for 'extensions.refStorage'.
      			 */
     -			ref_backend_uri = getenv(GIT_REFERENCE_BACKEND_ENVIRONMENT);
    -+			ref_backend_uri = getenv(GIT_REF_STORAGE_ENVIRONMENT);
    ++			ref_backend_uri = getenv(GIT_REF_STORAGE_FORMAT_ENVIRONMENT);
     +			if (!ref_backend_uri)
     +				ref_backend_uri = getenv(GIT_REFERENCE_BACKEND_ENVIRONMENT);
      			if (ref_backend_uri) {
    @@ setup.c: const char *setup_git_directory_gently(struct repository *repo, int *no
      				discovery.format.ref_storage_format =
     @@ setup.c: static void repository_format_configure(struct repository_format *repo_fmt,
      	 *   1. Explicit override via the command line, like in `git init
    - 	 *      --ref-storage=`.
    + 	 *      --ref-storage-format=`.
      	 *
     -	 *   2. Explicit override via the environment with
     -	 *      GIT_REFERENCE_BACKEND.
    -+	 *   2. Explicit override via the environment with "GIT_REF_STORAGE" or
    -+	 *      its deprecated equivalent "GIT_REFERENCE_BACKEND".
    ++	 *   2. Explicit override via the environment with "GIT_REF_STORAGE_FORMAT"
    ++	 *      or its deprecated equivalent "GIT_REFERENCE_BACKEND".
      	 *
      	 *   3. Existing repository format. All the subsequent sources only
      	 *      kick in when there is no repository yet.
      	 *
      	 *   4. The default ref storage format for new repositories as
     -	 *      configured via "GIT_DEFAULT_REF_FORMAT".
    -+	 *      configured via "GIT_DEFAULT_REF_STORAGE" or its deprecated
    -+	 *      equivalent "GIT_DEFAULT_REF_FORMAT".
    ++	 *      configured via "GIT_DEFAULT_REF_STORAGE_FORMAT" or its
    ++	 *      deprecated equivalent "GIT_DEFAULT_REF_FORMAT".
      	 *
      	 *   5. The default ref storage format for new repositories as
      	 *      configured via "init.defaultRefFormat"
    @@ setup.c: static void repository_format_configure(struct repository_format *repo_
      	if (ref_storage_format != REF_STORAGE_FORMAT_UNKNOWN) {
      		/* nothing to do */
     -	} else if ((env = getenv(GIT_REFERENCE_BACKEND_ENVIRONMENT))) {
    -+	} else if (((env = getenv(GIT_REF_STORAGE_ENVIRONMENT)) ||
    ++	} else if (((env = getenv(GIT_REF_STORAGE_FORMAT_ENVIRONMENT)) ||
     +		    (env = getenv(GIT_REFERENCE_BACKEND_ENVIRONMENT)))) {
      		ref_storage_format = ref_storage_format_by_uri(env, &ref_storage_payload);
      		if (ref_storage_format == REF_STORAGE_FORMAT_UNKNOWN)
    - 			die(_("unknown reference storage format specified via %s: '%s'"),
    + 			die(_("unknown ref storage format specified via %s: '%s'"),
     -			    GIT_REFERENCE_BACKEND_ENVIRONMENT, env);
    -+			    GIT_REF_STORAGE_ENVIRONMENT, env);
    ++			    GIT_REF_STORAGE_FORMAT_ENVIRONMENT, env);
      	} else if (repo_fmt->version >= 0) {
      		ref_storage_format = repo_fmt->ref_storage_format;
      		ref_storage_payload = xstrdup_or_null(repo_fmt->ref_storage_payload);
     -	} else if ((env = getenv("GIT_DEFAULT_REF_FORMAT"))) {
    -+	} else if (((env = getenv("GIT_DEFAULT_REF_STORAGE")) ||
    ++	} else if (((env = getenv("GIT_DEFAULT_REF_STORAGE_FORMAT")) ||
     +		    (env = getenv("GIT_DEFAULT_REF_FORMAT")))) {
      		ref_storage_format = ref_storage_format_by_name(env);
      		if (ref_storage_format == REF_STORAGE_FORMAT_UNKNOWN)
    - 			die(_("unknown reference storage format specified via %s: '%s'"),
    + 			die(_("unknown ref storage format specified via %s: '%s'"),
     -			    "GIT_DEFAULT_REF_FORMAT", env);
    -+			    "GIT_DEFAULT_REF_STORAGE", env);
    ++			    "GIT_DEFAULT_REF_STORAGE_FORMAT", env);
      	} else if (cfg.ref_storage_format != REF_STORAGE_FORMAT_UNKNOWN) {
      		ref_storage_format = cfg.ref_storage_format;
      	} else {
    @@ t/t0001-init.sh: test_expect_success DEFAULT_REPO_FORMAT 'extensions.refStorage
      '
      
     -test_expect_success 'init with GIT_DEFAULT_REF_FORMAT=garbage' '
    -+test_expect_success 'init with GIT_DEFAULT_REF_STORAGE=garbage' '
    ++test_expect_success 'init with GIT_DEFAULT_REF_STORAGE_FORMAT=garbage' '
      	test_when_finished "rm -rf refformat" &&
      	cat >expect <<-EOF &&
    --	fatal: unknown reference storage format specified via GIT_DEFAULT_REF_FORMAT: ${SQ}garbage${SQ}
    -+	fatal: unknown reference storage format specified via GIT_DEFAULT_REF_STORAGE: ${SQ}garbage${SQ}
    +-	fatal: unknown ref storage format specified via GIT_DEFAULT_REF_FORMAT: ${SQ}garbage${SQ}
    ++	fatal: unknown ref storage format specified via GIT_DEFAULT_REF_STORAGE_FORMAT: ${SQ}garbage${SQ}
      	EOF
     -	test_must_fail env GIT_DEFAULT_REF_FORMAT=garbage git init refformat 2>err &&
    -+	test_must_fail env GIT_DEFAULT_REF_STORAGE=garbage git init refformat 2>err &&
    ++	test_must_fail env GIT_DEFAULT_REF_STORAGE_FORMAT=garbage git init refformat 2>err &&
      	test_cmp expect err
      '
      
     -test_expect_success 'GIT_REFERENCE_BACKEND refuses to reinitialize with different storage format' '
    -+test_expect_success 'GIT_REF_STORAGE refuses to reinitialize with different storage format' '
    ++test_expect_success 'GIT_REF_STORAGE_FORMAT refuses to reinitialize with different storage format' '
      	test_when_finished "rm -rf refbackend" &&
    - 	git init --ref-storage=files refbackend &&
    + 	git init --ref-storage-format=files refbackend &&
      	cat >expect <<-EOF &&
      	fatal: attempt to reinitialize repository with different reference storage format
      	EOF
     -	test_must_fail env GIT_REFERENCE_BACKEND=reftable git init refbackend 2>err &&
    -+	test_must_fail env GIT_REF_STORAGE=reftable git init refbackend 2>err &&
    ++	test_must_fail env GIT_REF_STORAGE_FORMAT=reftable git init refbackend 2>err &&
      	test_cmp expect err
      '
      
     @@ t/t0001-init.sh: test_expect_success 'init warns about invalid init.defaultRefFormat' '
      	test_cmp expect err &&
      
    - 	git -C repo rev-parse --show-ref-storage >actual &&
    + 	git -C repo rev-parse --show-ref-storage-format >actual &&
     -	echo $GIT_DEFAULT_REF_FORMAT >expected &&
    -+	echo $GIT_DEFAULT_REF_STORAGE >expected &&
    ++	echo $GIT_DEFAULT_REF_STORAGE_FORMAT >expected &&
      	test_cmp expected actual
      '
      
    @@ t/t0001-init.sh: test_expect_success 'init warns about invalid init.defaultRefFo
      	test_when_finished "rm -rf refformat" &&
      	(
     -		sane_unset GIT_DEFAULT_REF_FORMAT &&
    -+		sane_unset GIT_DEFAULT_REF_STORAGE &&
    ++		sane_unset GIT_DEFAULT_REF_STORAGE_FORMAT &&
      		git init refformat
      	) &&
    - 	git version --build-options | sed -ne "s/^default-ref-storage: //p" >expect &&
    + 	git version --build-options | sed -ne "s/^default-ref-storage-format: //p" >expect &&
     @@ t/t0001-init.sh: test_expect_success 'default ref format' '
      backends="files reftable"
      for format in $backends
      do
     -	test_expect_success DEFAULT_REPO_FORMAT "init with GIT_DEFAULT_REF_FORMAT=$format" '
    -+	test_expect_success DEFAULT_REPO_FORMAT "init with GIT_DEFAULT_REF_STORAGE=$format" '
    ++	test_expect_success DEFAULT_REPO_FORMAT "init with GIT_DEFAULT_REF_STORAGE_FORMAT=$format" '
      		test_when_finished "rm -rf refformat" &&
     -		GIT_DEFAULT_REF_FORMAT=$format git init refformat &&
    -+		GIT_DEFAULT_REF_STORAGE=$format git init refformat &&
    ++		GIT_DEFAULT_REF_STORAGE_FORMAT=$format git init refformat &&
      
      		if test $format = files
      		then
    @@ t/t0001-init.sh: do
      		test_config_global init.defaultRefFormat $format &&
      		(
     -			sane_unset GIT_DEFAULT_REF_FORMAT &&
    -+			sane_unset GIT_DEFAULT_REF_STORAGE &&
    ++			sane_unset GIT_DEFAULT_REF_STORAGE_FORMAT &&
      			git init refformat
      		) &&
      
    @@ t/t0001-init.sh: do
      		test_cmp expect actual
      	'
      
    --	test_expect_success "--ref-storage=$format overrides GIT_DEFAULT_REF_FORMAT" '
    -+	test_expect_success "--ref-storage=$format overrides GIT_DEFAULT_REF_STORAGE" '
    +-	test_expect_success "--ref-storage-format=$format overrides GIT_DEFAULT_REF_FORMAT" '
    ++	test_expect_success "--ref-storage-format=$format overrides GIT_DEFAULT_REF_STORAGE_FORMAT" '
      		test_when_finished "rm -rf refformat" &&
    --		GIT_DEFAULT_REF_FORMAT=garbage git init --ref-storage=$format refformat &&
    -+		GIT_DEFAULT_REF_STORAGE=garbage git init --ref-storage=$format refformat &&
    +-		GIT_DEFAULT_REF_FORMAT=garbage git init --ref-storage-format=$format refformat &&
    ++		GIT_DEFAULT_REF_STORAGE_FORMAT=garbage git init --ref-storage-format=$format refformat &&
      		echo $format >expect &&
    - 		git -C refformat rev-parse --show-ref-storage >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_expect_success "reinit repository with GIT_DEFAULT_REF_STORAGE=$format does not change format" '
    ++	test_expect_success "reinit repository with GIT_DEFAULT_REF_STORAGE_FORMAT=$format does not change format" '
      		test_when_finished "rm -rf refformat" &&
      		git init refformat &&
    - 		git -C refformat rev-parse --show-ref-storage >expect &&
    + 		git -C refformat rev-parse --show-ref-storage-format >expect &&
     -		GIT_DEFAULT_REF_FORMAT=$format git init refformat &&
    -+		GIT_DEFAULT_REF_STORAGE=$format git init refformat &&
    - 		git -C refformat rev-parse --show-ref-storage >actual &&
    ++		GIT_DEFAULT_REF_STORAGE_FORMAT=$format git init refformat &&
    + 		git -C refformat rev-parse --show-ref-storage-format >actual &&
      		test_cmp expect actual
      	'
      done
      
    --test_expect_success "--ref-storage= overrides GIT_DEFAULT_REF_FORMAT" '
    -+test_expect_success "--ref-storage= overrides GIT_DEFAULT_REF_STORAGE" '
    +-test_expect_success "--ref-storage-format= overrides GIT_DEFAULT_REF_FORMAT" '
    ++test_expect_success "--ref-storage-format= overrides GIT_DEFAULT_REF_STORAGE_FOMAT" '
      	test_when_finished "rm -rf refformat" &&
    --	GIT_DEFAULT_REF_FORMAT=files git init --ref-storage=reftable refformat &&
    -+	GIT_DEFAULT_REF_STORAGE=files git init --ref-storage=reftable refformat &&
    +-	GIT_DEFAULT_REF_FORMAT=files git init --ref-storage-format=reftable refformat &&
    ++	GIT_DEFAULT_REF_STORAGE_FORMAT=files git init --ref-storage-format=reftable refformat &&
      	echo reftable >expect &&
    - 	git -C refformat rev-parse --show-ref-storage >actual &&
    + 	git -C refformat rev-parse --show-ref-storage-format >actual &&
      	test_cmp expect actual
      '
      
     -test_expect_success "GIT_DEFAULT_REF_FORMAT= overrides init.defaultRefFormat" '
    -+test_expect_success "GIT_DEFAULT_REF_STORAGE= overrides init.defaultRefFormat" '
    ++test_expect_success "GIT_DEFAULT_REF_STORAGE_FORMAT= overrides init.defaultRefFormat" '
      	test_when_finished "rm -rf refformat" &&
      	test_config_global init.defaultRefFormat files &&
      
     -	GIT_DEFAULT_REF_FORMAT=reftable git init refformat &&
    -+	GIT_DEFAULT_REF_STORAGE=reftable git init refformat &&
    ++	GIT_DEFAULT_REF_STORAGE_FORMAT=reftable git init refformat &&
      	echo reftable >expect &&
    - 	git -C refformat rev-parse --show-ref-storage >actual &&
    + 	git -C refformat rev-parse --show-ref-storage-format >actual &&
      	test_cmp expect actual
     @@ t/t0001-init.sh: test_expect_success "init with feature.experimental=true" '
      	test_when_finished "rm -rf refformat" &&
      	test_config_global feature.experimental true &&
      	(
     -		sane_unset GIT_DEFAULT_REF_FORMAT &&
    -+		sane_unset GIT_DEFAULT_REF_STORAGE &&
    ++		sane_unset GIT_DEFAULT_REF_STORAGE_FORMAT &&
      		git init refformat
      	) &&
      	echo reftable >expect &&
    @@ t/t0001-init.sh: test_expect_success "init.defaultRefFormat overrides feature.ex
      	test_config_global init.defaultRefFormat files &&
      	(
     -		sane_unset GIT_DEFAULT_REF_FORMAT &&
    -+		sane_unset GIT_DEFAULT_REF_STORAGE &&
    ++		sane_unset GIT_DEFAULT_REF_STORAGE_FORMAT &&
      		git init refformat
      	) &&
      	echo files >expect &&
    @@ t/t0001-init.sh: test_expect_success "init.defaultRefFormat overrides feature.ex
      '
      
     -test_expect_success "GIT_DEFAULT_REF_FORMAT= overrides feature.experimental=true" '
    -+test_expect_success "GIT_DEFAULT_REF_STORAGE= overrides feature.experimental=true" '
    ++test_expect_success "GIT_DEFAULT_REF_STORAGE_FORMAT= overrides feature.experimental=true" '
      	test_when_finished "rm -rf refformat" &&
      	test_config_global feature.experimental true &&
     -	GIT_DEFAULT_REF_FORMAT=files git init refformat &&
    -+	GIT_DEFAULT_REF_STORAGE=files git init refformat &&
    ++	GIT_DEFAULT_REF_STORAGE_FORMAT=files git init refformat &&
      	echo files >expect &&
    - 	git -C refformat rev-parse --show-ref-storage >actual &&
    + 	git -C refformat rev-parse --show-ref-storage-format >actual &&
      	test_cmp expect actual
     @@ t/t0001-init.sh: test_expect_success 'branch -m with the initial branch' '
      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 &&
    -+	echo $GIT_DEFAULT_REF_STORAGE >expect &&
    - 	git -C repo rev-parse --show-ref-storage >actual &&
    ++	echo $GIT_DEFAULT_REF_STORAGE_FORMAT >expect &&
    + 	git -C repo rev-parse --show-ref-storage-format >actual &&
      	test_cmp expect actual
      '
     @@ t/t0001-init.sh: test_expect_success 'init with includeIf.onbranch condition with existing direct
    @@ t/t0001-init.sh: test_expect_success 'init with includeIf.onbranch condition wit
      	mkdir repo &&
      	git -c includeIf.onbranch:nonexistent.path=/does/not/exist init repo &&
     -	echo $GIT_DEFAULT_REF_FORMAT >expect &&
    -+	echo $GIT_DEFAULT_REF_STORAGE >expect &&
    - 	git -C repo rev-parse --show-ref-storage >actual &&
    ++	echo $GIT_DEFAULT_REF_STORAGE_FORMAT >expect &&
    + 	git -C repo rev-parse --show-ref-storage-format >actual &&
      	test_cmp expect actual
      '
     @@ t/t0001-init.sh: test_expect_success 're-init with includeIf.onbranch condition' '
    @@ t/t0001-init.sh: 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 &&
    -+	echo $GIT_DEFAULT_REF_STORAGE >expect &&
    - 	git -C repo rev-parse --show-ref-storage >actual &&
    ++	echo $GIT_DEFAULT_REF_STORAGE_FORMAT >expect &&
    + 	git -C repo rev-parse --show-ref-storage-format >actual &&
      	test_cmp expect actual
      '
     
    @@ t/t1419-exclude-refs.sh: assert_jumps () {
      	local trace="$2"
      
     -	case "$GIT_DEFAULT_REF_FORMAT" in
    -+	case "$GIT_DEFAULT_REF_STORAGE" in
    ++	case "$GIT_DEFAULT_REF_STORAGE_FORMAT" in
      	files)
      		grep -q "name:jumps_made value:$nr$" $trace;;
      	reftable)
      		grep -q "name:reseeks_made value:$nr$" $trace;;
      	*)
     -		BUG "unhandled ref format $GIT_DEFAULT_REF_FORMAT";;
    -+		BUG "unhandled ref format $GIT_DEFAULT_REF_STORAGE";;
    ++		BUG "unhandled ref storage format $GIT_DEFAULT_REF_STORAGE_FORMAT";;
      	esac
      }
      
    @@ t/t1419-exclude-refs.sh: test_expect_success 'adjacent, non-overlapping excluded
      
      	test_cmp expect actual &&
     -	case "$GIT_DEFAULT_REF_FORMAT" in
    -+	case "$GIT_DEFAULT_REF_STORAGE" in
    ++	case "$GIT_DEFAULT_REF_STORAGE_FORMAT" in
      	files)
      		assert_jumps 1 perf;;
      	reftable)
      		assert_jumps 2 perf;;
      	*)
     -		BUG "unhandled ref format $GIT_DEFAULT_REF_FORMAT";;
    -+		BUG "unhandled ref format $GIT_DEFAULT_REF_STORAGE";;
    ++		BUG "unhandled ref storage format $GIT_DEFAULT_REF_STORAGE_FORMAT";;
      	esac
      '
      
    @@ t/t1419-exclude-refs.sh: test_expect_success 'several overlapping excluded regio
      
      	test_cmp expect actual &&
     -	case "$GIT_DEFAULT_REF_FORMAT" in
    -+	case "$GIT_DEFAULT_REF_STORAGE" in
    ++	case "$GIT_DEFAULT_REF_STORAGE_FORMAT" in
      	files)
      		assert_jumps 1 perf;;
      	reftable)
      		assert_jumps 3 perf;;
      	*)
     -		BUG "unhandled ref format $GIT_DEFAULT_REF_FORMAT";;
    -+		BUG "unhandled ref format $GIT_DEFAULT_REF_STORAGE";;
    ++		BUG "unhandled ref storage format $GIT_DEFAULT_REF_STORAGE_FORMAT";;
      	esac
      '
      
    @@ t/t1419-exclude-refs.sh: test_expect_success 'unordered excludes' '
      
      	test_cmp expect actual &&
     -	case "$GIT_DEFAULT_REF_FORMAT" in
    -+	case "$GIT_DEFAULT_REF_STORAGE" in
    ++	case "$GIT_DEFAULT_REF_STORAGE_FORMAT" in
      	files)
      		assert_jumps 1 perf;;
      	reftable)
      		assert_jumps 2 perf;;
      	*)
     -		BUG "unhandled ref format $GIT_DEFAULT_REF_FORMAT";;
    -+		BUG "unhandled ref format $GIT_DEFAULT_REF_STORAGE";;
    ++		BUG "unhandled ref storage format $GIT_DEFAULT_REF_STORAGE_FORMAT";;
      	esac
      '
      
    @@ t/t1423-ref-backend.sh: test_description='Test reference backend URIs'
      #   <cmd> is the git subcommand to be run in the repository.
      #   <via> if 'config', set the backend via the 'extensions.refStorage' config.
     -#         if 'env', set the backend via the 'GIT_REFERENCE_BACKEND' env.
    -+#         if 'env', set the backend via the 'GIT_REF_STORAGE' env.
    ++#         if 'env', set the backend via the 'GIT_REF_STORAGE_FORMAT' env.
      run_with_uri () {
      	repo=$1 &&
      	backend=$2 &&
    @@ t/t1423-ref-backend.sh: run_with_uri () {
      	if test "$via" = "env"
      	then
     -		test_env GIT_REFERENCE_BACKEND="$uri" git -C "$repo" $cmd
    -+		test_env GIT_REF_STORAGE="$uri" git -C "$repo" $cmd
    ++		test_env GIT_REF_STORAGE_FORMAT="$uri" git -C "$repo" $cmd
      	elif test "$via" = "config"
      	then
      		git -C "$repo" config set extensions.refStorage "$uri" &&
    @@ t/t1423-ref-backend.sh: run_with_uri () {
      #   <uri> is the new URI to be set for the ref storage.
      #   <via> if 'config', set the backend via the 'extensions.refStorage' config.
     -#         if 'env', set the backend via the 'GIT_REFERENCE_BACKEND' env.
    -+#         if 'env', set the backend via the 'GIT_REF_STORAGE' env.
    ++#         if 'env', set the backend via the 'GIT_REF_STORAGE_FORMAT' env.
      #   <err_msg> (optional) if set, check if 'git-refs(1)' failed with the provided msg.
      test_refs_backend () {
      	repo=$1 &&
    @@ t/t1423-ref-backend.sh: test_refs_backend () {
      		if test "$via" = "env"
      		then
     -			test_env GIT_REFERENCE_BACKEND="$uri" test_must_fail git -C "$repo" refs list 2>err
    -+			test_env GIT_REF_STORAGE="$uri" test_must_fail git -C "$repo" refs list 2>err
    ++			test_env GIT_REF_STORAGE_FORMAT="$uri" test_must_fail git -C "$repo" refs list 2>err
      		elif test "$via" = "config"
      		then
      			git -C "$repo" config set extensions.refStorage "$uri" &&
    @@ t/t1423-ref-backend.sh: verify_files_exist () {
      
      	# verify that backend specific files exist.
     -	case "$GIT_DEFAULT_REF_FORMAT" in
    -+	case "$GIT_DEFAULT_REF_STORAGE" in
    ++	case "$GIT_DEFAULT_REF_STORAGE_FORMAT" in
      	files)
      		test_path_is_dir $refdir/refs/heads &&
      		test_path_is_file $refdir/HEAD;;
    @@ t/t1423-ref-backend.sh: verify_files_exist () {
      		test_path_is_file $refdir/reftable/tables.list;;
      	*)
     -		BUG "unhandled ref format $GIT_DEFAULT_REF_FORMAT";;
    -+		BUG "unhandled ref format $GIT_DEFAULT_REF_STORAGE";;
    ++		BUG "unhandled ref storage format $GIT_DEFAULT_REF_STORAGE_FORMAT";;
      	esac
      }
      
    @@ t/t1423-ref-backend.sh: do
      		test_when_finished "rm -rf repo refdir" &&
      		mkdir refdir &&
     -		GIT_REFERENCE_BACKEND="${from_format}://$(pwd)/refdir" git init repo &&
    -+		GIT_REF_STORAGE="${from_format}://$(pwd)/refdir" git init repo &&
    ++		GIT_REF_STORAGE_FORMAT="${from_format}://$(pwd)/refdir" git init repo &&
      		(
      			cd repo &&
      
    @@ t/t1423-ref-backend.sh: test_expect_success 'initializing repository with alt re
      	mkdir refdir &&
      	BACKEND="$(test_detect_ref_format)://$(pwd)/refdir" &&
     -	GIT_REFERENCE_BACKEND=$BACKEND git init repo &&
    -+	GIT_REF_STORAGE=$BACKEND git init repo &&
    ++	GIT_REF_STORAGE_FORMAT=$BACKEND git init repo &&
      	verify_files_exist repo/.git refdir &&
      	(
      		cd repo &&
    @@ t/t1423-ref-backend.sh: test_expect_success 'cloning repository with alt ref dir
      
      	BACKEND="$(test_detect_ref_format)://$(pwd)/refdir" &&
     -	GIT_REFERENCE_BACKEND=$BACKEND git clone source repo &&
    -+	GIT_REF_STORAGE=$BACKEND git clone source repo &&
    ++	GIT_REF_STORAGE_FORMAT=$BACKEND git clone source repo &&
      
      	git -C repo config get extensions.refstorage >actual &&
      	echo $BACKEND >expect &&
    @@ t/t7424-submodule-mixed-ref-formats.sh: test_ref_format () {
      for OTHER_FORMAT in files reftable
      do
     -	if test "$OTHER_FORMAT" = "$GIT_DEFAULT_REF_FORMAT"
    -+	if test "$OTHER_FORMAT" = "$GIT_DEFAULT_REF_STORAGE"
    ++	if test "$OTHER_FORMAT" = "$GIT_DEFAULT_REF_STORAGE_FORMAT"
      	then
      		continue
      	fi
    @@ t/t7424-submodule-mixed-ref-formats.sh: test_expect_success 'add submodules with
      	test_commit -C submodule submodule-initial &&
      	git init upstream &&
     -	test_ref_format upstream "$GIT_DEFAULT_REF_FORMAT" &&
    -+	test_ref_format upstream "$GIT_DEFAULT_REF_STORAGE" &&
    - 	git -C upstream submodule add --ref-storage="$OTHER_FORMAT" "file://$(pwd)/submodule" &&
    ++	test_ref_format upstream "$GIT_DEFAULT_REF_STORAGE_FORMAT" &&
    + 	git -C upstream submodule add --ref-storage-format="$OTHER_FORMAT" "file://$(pwd)/submodule" &&
      	test_ref_format upstream/submodule "$OTHER_FORMAT"
      '
     @@ t/t7424-submodule-mixed-ref-formats.sh: test_expect_success 'recursive clone propagates ref storage format' '
    @@ t/t7424-submodule-mixed-ref-formats.sh: test_expect_success 'recursive clone pro
      	# ref format.
     -	test_ref_format upstream "$GIT_DEFAULT_REF_FORMAT" &&
     -	test_ref_format upstream/submodule "$GIT_DEFAULT_REF_FORMAT" &&
    -+	test_ref_format upstream "$GIT_DEFAULT_REF_STORAGE" &&
    -+	test_ref_format upstream/submodule "$GIT_DEFAULT_REF_STORAGE" &&
    ++	test_ref_format upstream "$GIT_DEFAULT_REF_STORAGE_FORMAT" &&
    ++	test_ref_format upstream/submodule "$GIT_DEFAULT_REF_STORAGE_FORMAT" &&
      
      	# The cloned repositories should use the other ref format that we have
    - 	# specified via `--ref-storage`. The option should propagate to cloned
    + 	# specified via `--ref-storage-format`. The option should propagate to cloned
     @@ t/t7424-submodule-mixed-ref-formats.sh: test_expect_success 'clone submodules with different ref storage format' '
      	git -C upstream commit -m "upstream submodule" &&
      
      	git clone --no-recurse-submodules "file://$(pwd)/upstream" downstream &&
     -	test_ref_format downstream "$GIT_DEFAULT_REF_FORMAT" &&
    -+	test_ref_format downstream "$GIT_DEFAULT_REF_STORAGE" &&
    - 	git -C downstream submodule update --init --ref-storage=$OTHER_FORMAT &&
    ++	test_ref_format downstream "$GIT_DEFAULT_REF_STORAGE_FORMAT" &&
    + 	git -C downstream submodule update --init --ref-storage-format=$OTHER_FORMAT &&
      	test_ref_format downstream/submodule "$OTHER_FORMAT"
      '
     @@ t/t7424-submodule-mixed-ref-formats.sh: test_expect_success 'status with mixed submodule ref storages' '
    @@ t/t7424-submodule-mixed-ref-formats.sh: test_expect_success 'status with mixed s
      	# The main repository should use the default ref format now, whereas
      	# the submodule should use the other format.
     -	test_ref_format main "$GIT_DEFAULT_REF_FORMAT" &&
    -+	test_ref_format main "$GIT_DEFAULT_REF_STORAGE" &&
    ++	test_ref_format main "$GIT_DEFAULT_REF_STORAGE_FORMAT" &&
      	test_ref_format main/submodule "$OTHER_FORMAT" &&
      
      	cat >expect <<-EOF &&
     @@ t/t7424-submodule-mixed-ref-formats.sh: test_expect_success 'recursive pull with mixed formats' '
      	# submodules have different formats.
      	git clone --no-recurse-submodules "file://$(pwd)/upstream" downstream &&
    - 	git -C downstream submodule update --init --ref-storage=$OTHER_FORMAT &&
    + 	git -C downstream submodule update --init --ref-storage-format=$OTHER_FORMAT &&
     -	test_ref_format downstream "$GIT_DEFAULT_REF_FORMAT" &&
    -+	test_ref_format downstream "$GIT_DEFAULT_REF_STORAGE" &&
    ++	test_ref_format downstream "$GIT_DEFAULT_REF_STORAGE_FORMAT" &&
      	test_ref_format downstream/submodule "$OTHER_FORMAT" &&
      
      	# Update the upstream submodule as well as the owning repository such
    @@ t/test-lib.sh: export EDITOR
      export GIT_DEFAULT_HASH
     -GIT_DEFAULT_REF_FORMAT="${GIT_TEST_DEFAULT_REF_FORMAT:-files}"
     -export GIT_DEFAULT_REF_FORMAT
    -+GIT_DEFAULT_REF_STORAGE="${GIT_TEST_DEFAULT_REF_FORMAT:-files}"
    -+export GIT_DEFAULT_REF_STORAGE
    ++GIT_DEFAULT_REF_STORAGE_FORMAT="${GIT_TEST_DEFAULT_REF_FORMAT:-files}"
    ++export GIT_DEFAULT_REF_STORAGE_FORMAT
      
      # Tests using GIT_TRACE typically don't want <timestamp> <file>:<line> output
      GIT_TRACE_BARE=1
    @@ t/test-lib.sh: parisc* | hppa*)
      esac
      
     -case "$GIT_DEFAULT_REF_FORMAT" in
    -+case "$GIT_DEFAULT_REF_STORAGE" in
    ++case "$GIT_DEFAULT_REF_STORAGE_FORMAT" in
      files)
      	test_set_prereq REFFILES;;
      reftable)
      	test_set_prereq REFTABLE;;
      *)
     -	echo 2>&1 "error: unknown ref format $GIT_DEFAULT_REF_FORMAT"
    -+	echo 2>&1 "error: unknown ref format $GIT_DEFAULT_REF_STORAGE"
    ++	echo 2>&1 "error: unknown ref storage format $GIT_DEFAULT_REF_STORAGE_FORMAT"
      	exit 1
      	;;
      esac
10:  01ba1710d3 ! 10:  e53d951d57 setup: rename "init.defaultRefFormat" to "init.defaultRefStorage"
    @@ Metadata
     Author: Patrick Steinhardt <ps@pks.im>
     
      ## Commit message ##
    -    setup: rename "init.defaultRefFormat" to "init.defaultRefStorage"
    +    setup: rename "init.defaultRefFormat" to "init.defaultRefStorageFormat"
     
         With the same reasoning as for git-init(1), rename the
    -    "init.defaultRefFormat" config option to "init.defaultRefStorage" and
    -    keep the old name as an alias.
    +    "init.defaultRefFormat" config option to "init.defaultRefStorageFormat"
    +    and keep the old name as an alias.
     
         Signed-off-by: Patrick Steinhardt <ps@pks.im>
     
    @@ Documentation/BreakingChanges.adoc: Cf. <2f5de416-04ba-c23d-1e0b-83bb655829a7@zo
      +
      Users that get immediate benefit from the "reftable" backend could continue to
     -opt-in to the "reftable" format manually by setting the "init.defaultRefFormat"
    -+opt-in to the "reftable" format manually by setting the "init.defaultRefStorage"
    ++opt-in to the "reftable" format manually by setting the "init.defaultRefStorageFormat"
      config. But defaults matter, and we think that overall users will have a better
      experience with less platform-specific quirks when they use the new backend by
      default.
    @@ Documentation/config/feature.adoc: reusing objects from multiple packs instead o
      default name-hash.
      +
     -* `init.defaultRefFormat=reftable` causes newly initialized repositories to use
    -+* `init.defaultRefStorage=reftable` causes newly initialized repositories to use
    ++* `init.defaultRefStorageFormat=reftable` causes newly initialized repositories to use
      the reftable format for storing references. This new format solves issues with
      case-insensitive filesystems, compresses better and performs significantly
      better with many use cases. Refer to Documentation/technical/reftable.adoc for
    @@ Documentation/config/init.adoc: endif::[]
      	and the `GIT_DEFAULT_HASH` environment variable take precedence over
      	this config.
     -`init.defaultRefFormat`::
    -+`init.defaultRefStorage`::
    ++`init.defaultRefStorageFormat`::
      	Allows overriding the default ref storage format for new repositories.
    - 	See `--ref-storage=` in linkgit:git-init[1]. Both the command line
    - 	option and the `GIT_DEFAULT_REF_STORAGE` environment variable take
    + 	See `--ref-storage-format=` in linkgit:git-init[1]. Both the command line
    + 	option and the `GIT_DEFAULT_REF_STORAGE_FORMAT` environment variable take
     
      ## setup.c ##
     @@ setup.c: static int read_default_format_config(const char *key, const char *value,
    @@ setup.c: static int read_default_format_config(const char *key, const char *valu
      	}
      
     -	if (!strcmp(key, "init.defaultrefformat")) {
    -+	if (!strcmp(key, "init.defaultrefstorage") ||
    ++	if (!strcmp(key, "init.defaultrefstorageformat") ||
     +	    !strcmp(key, "init.defaultrefformat")) {
      		ret = git_config_string(&str, key, value);
      		if (ret)
    @@ setup.c: static int read_default_format_config(const char *key, const char *valu
      	/*
      	 * Enable the reftable format when "features.experimental" is enabled.
     -	 * "init.defaultRefFormat" takes precedence over this setting.
    -+	 * "init.defaultRefStorage" takes precedence over this setting.
    ++	 * "init.defaultRefStorageFormat" takes precedence over this setting.
      	 */
      	if (!strcmp(key, "feature.experimental") &&
      	    cfg->ref_storage_format == REF_STORAGE_FORMAT_UNKNOWN &&
     @@ setup.c: static void repository_format_configure(struct repository_format *repo_fmt,
    - 	 *      equivalent "GIT_DEFAULT_REF_FORMAT".
    + 	 *      deprecated equivalent "GIT_DEFAULT_REF_FORMAT".
      	 *
      	 *   5. The default ref storage format for new repositories as
     -	 *      configured via "init.defaultRefFormat"
    -+	 *      configured via "init.defaultRefStorage" or its deprecated
    ++	 *      configured via "init.defaultRefStorageFormat" or its deprecated
     +	 *      equivalent "init.defaultRefFormat".
      	 *
      	 *   6. Otherwise, we fall back to the default ref storage format
      	 *      compiled into Git.
     
      ## t/t0001-init.sh ##
    -@@ t/t0001-init.sh: test_expect_success 'GIT_REF_STORAGE refuses to reinitialize with different stor
    +@@ t/t0001-init.sh: test_expect_success 'GIT_REF_STORAGE_FORMAT refuses to reinitialize with differe
      	test_cmp expect err
      '
      
     -test_expect_success 'init warns about invalid init.defaultRefFormat' '
    -+test_expect_success 'init warns about invalid init.defaultRefStorage' '
    ++test_expect_success 'init warns about invalid init.defaultRefStorageFormat' '
      	test_when_finished "rm -rf repo" &&
     -	test_config_global init.defaultRefFormat garbage &&
    -+	test_config_global init.defaultRefStorage garbage &&
    ++	test_config_global init.defaultRefStorageFormat garbage &&
      
      	echo "warning: unknown ref storage format ${SQ}garbage${SQ}" >expect &&
      	git init repo 2>err &&
    @@ t/t0001-init.sh: do
      	'
      
     -	test_expect_success "init with init.defaultRefFormat=$format" '
    -+	test_expect_success "init with init.defaultRefStorage=$format" '
    ++	test_expect_success "init with init.defaultRefStorageFormat=$format" '
      		test_when_finished "rm -rf refformat" &&
     -		test_config_global init.defaultRefFormat $format &&
    -+		test_config_global init.defaultRefStorage $format &&
    ++		test_config_global init.defaultRefStorageFormat $format &&
      		(
    - 			sane_unset GIT_DEFAULT_REF_STORAGE &&
    + 			sane_unset GIT_DEFAULT_REF_STORAGE_FORMAT &&
      			git init refformat
    -@@ t/t0001-init.sh: test_expect_success "--ref-storage= overrides GIT_DEFAULT_REF_STORAGE" '
    +@@ t/t0001-init.sh: test_expect_success "--ref-storage-format= overrides GIT_DEFAULT_REF_STORAGE_FOM
      	test_cmp expect actual
      '
      
    --test_expect_success "GIT_DEFAULT_REF_STORAGE= overrides init.defaultRefFormat" '
    -+test_expect_success "GIT_DEFAULT_REF_STORAGE= overrides init.defaultRefStorage" '
    +-test_expect_success "GIT_DEFAULT_REF_STORAGE_FORMAT= overrides init.defaultRefFormat" '
    ++test_expect_success "GIT_DEFAULT_REF_STORAGE_FORMAT= overrides init.defaultRefStorageFormat" '
      	test_when_finished "rm -rf refformat" &&
     -	test_config_global init.defaultRefFormat files &&
    -+	test_config_global init.defaultRefStorage files &&
    ++	test_config_global init.defaultRefStorageFormat files &&
      
    - 	GIT_DEFAULT_REF_STORAGE=reftable git init refformat &&
    + 	GIT_DEFAULT_REF_STORAGE_FORMAT=reftable git init refformat &&
      	echo reftable >expect &&
     @@ t/t0001-init.sh: test_expect_success "init with feature.experimental=true" '
      	test_cmp expect actual
      '
      
     -test_expect_success "init.defaultRefFormat overrides feature.experimental=true" '
    -+test_expect_success "init.defaultRefStorage overrides feature.experimental=true" '
    ++test_expect_success "init.defaultRefStorageFormat overrides feature.experimental=true" '
      	test_when_finished "rm -rf refformat" &&
      	test_config_global feature.experimental true &&
     -	test_config_global init.defaultRefFormat files &&
    -+	test_config_global init.defaultRefStorage files &&
    ++	test_config_global init.defaultRefStorageFormat files &&
      	(
    - 		sane_unset GIT_DEFAULT_REF_STORAGE &&
    + 		sane_unset GIT_DEFAULT_REF_STORAGE_FORMAT &&
      		git init refformat
11:  a7911f38dc ! 11:  e9c61c7d06 setup: allow "git init --ref-storage=" to specify a payload
    @@ Metadata
     Author: Patrick Steinhardt <ps@pks.im>
     
      ## Commit message ##
    -    setup: allow "git init --ref-storage=" to specify a payload
    +    setup: allow "git init --ref-storage-format=" to specify a payload
     
         Reference storage backends can be configured with a payload via the
    -    "extensions.refStorage" config key and the "GIT_REF_STORAGE" environment
    -    variable, both of which accept a URI in the format
    +    "extensions.refStorage" config key and the "GIT_REF_STORAGE_FORMAT"
    +    environment variable, both of which accept a URI in the format
         "<format>://<payload>". The payload may contain backend-specific
         information, for example an alternate refs directory or which database
         references should be stored in.
     
    -    The `--ref-storage=` option of git-init(1) and git-clone(1) does not
    -    know about payloads though: its value is parsed as a plain format name,
    -    so backends that require a payload cannot be conveniently set up at
    -    initialization time via the command line.
    +    The `--ref-storage-format=` option of git-init(1) and git-clone(1) does
    +    not know about payloads though: its value is parsed as a plain format
    +    name, so backends that require a payload cannot be conveniently set up
    +    at initialization time via the command line.
     
         Teach the option to accept the same URI syntax. Also, document the
         optional payloads for both the "files" and "reftable" backends.
    @@ Documentation/git-init.adoc
     @@ Documentation/git-init.adoc: values are `sha1` and (if enabled) `sha256`.  `sha1` is the default.
      include::object-format-disclaimer.adoc[]
      
    - `--ref-storage=<format>`::
    + `--ref-storage-format=<format>`::
     -Specify the given ref storage _<format>_ for the repository. The valid values are:
     +Specify the given ref storage _<format>_ for the repository. Backends that
     +require additional configuration accept a payload in the form
    @@ Documentation/ref-storage-format.adoc
     
      ## builtin/clone.c ##
     @@ builtin/clone.c: int cmd_clone(int argc,
    + 	char *option_origin = NULL;
    + 	struct string_list option_not = STRING_LIST_INIT_NODUP;
    + 	const char *real_git_dir = NULL;
    +-	const char *ref_storage_format_str = NULL;
    ++	const char *ref_storage_format_uri = NULL;
    + 	const char *option_upload_pack = "git-upload-pack";
    + 	int option_progress = -1;
    + 	int option_sparse_checkout = 0;
    +@@ builtin/clone.c: int cmd_clone(int argc,
    + 			 N_("any cloned submodules will be shallow")),
    + 		OPT_STRING(0, "separate-git-dir", &real_git_dir, N_("gitdir"),
    + 			   N_("separate git dir from working tree")),
    +-		OPT_STRING(0, "ref-storage-format", &ref_storage_format_str, N_("format"),
    ++		OPT_STRING(0, "ref-storage-format", &ref_storage_format_uri, N_("format"),
    + 			   N_("specify the reference storage format to use")),
    +-		OPT_STRING_F(0, "ref-format", &ref_storage_format_str, N_("format"),
    ++		OPT_STRING_F(0, "ref-format", &ref_storage_format_uri, N_("format"),
    + 			   N_("specify the reference storage format to use"), PARSE_OPT_HIDDEN),
    + 		OPT_STRING_LIST('c', "config", &option_config, N_("key=value"),
    + 				N_("set config inside the new repository")),
    +@@ builtin/clone.c: int cmd_clone(int argc,
    + 	if (option_single_branch == -1)
      		option_single_branch = deepen ? 1 : 0;
      
    - 	if (ref_storage) {
    --		ref_storage_format = ref_storage_format_by_name(ref_storage);
    -+		ref_storage_format = ref_storage_format_by_uri(ref_storage, NULL);
    +-	if (ref_storage_format_str) {
    +-		ref_storage_format = ref_storage_format_by_name(ref_storage_format_str);
    ++	if (ref_storage_format_uri) {
    ++		ref_storage_format = ref_storage_format_by_uri(ref_storage_format_uri, NULL);
      		if (ref_storage_format == REF_STORAGE_FORMAT_UNKNOWN)
    - 			die(_("unknown ref storage format '%s'"), ref_storage);
    +-			die(_("unknown ref storage format '%s'"), ref_storage_format_str);
    ++			die(_("unknown ref storage format '%s'"), ref_storage_format_uri);
      	}
    + 
    + 	if (option_mirror) {
     @@ builtin/clone.c: int cmd_clone(int argc,
      	 * their on-disk data structures.
      	 */
      	init_db(the_repository, git_dir, real_git_dir, work_tree, option_template,
     -		GIT_HASH_UNKNOWN, ref_storage_format, NULL,
    -+		GIT_HASH_UNKNOWN, ref_storage, NULL,
    ++		GIT_HASH_UNKNOWN, ref_storage_format_uri, NULL,
      		do_not_override_repo_unix_permissions,
      		INIT_DB_QUIET | INIT_DB_SKIP_REFDB);
      
     
      ## builtin/init-db.c ##
     @@ builtin/init-db.c: int cmd_init_db(int argc,
    - 	const char *ref_storage = NULL;
    + 	unsigned int flags = 0;
    + 	int bare = startup_info->force_bare_repository ? 1 : -1;
    + 	const char *object_format = NULL;
    +-	const char *ref_storage_format_str = NULL;
    ++	const char *ref_storage_format_uri = NULL;
      	const char *initial_branch = NULL;
      	int hash_algo = GIT_HASH_UNKNOWN;
     -	enum ref_storage_format ref_storage_format = REF_STORAGE_FORMAT_UNKNOWN;
      	int init_shared_repository = -1;
      	const struct option init_db_options[] = {
      		OPT_STRING(0, "template", &template_dir, N_("template-directory"),
    +@@ builtin/init-db.c: int cmd_init_db(int argc,
    + 			   N_("override the name of the initial branch")),
    + 		OPT_STRING(0, "object-format", &object_format, N_("hash"),
    + 			   N_("specify the hash algorithm to use")),
    +-		OPT_STRING(0, "ref-storage-format", &ref_storage_format_str, N_("format"),
    ++		OPT_STRING(0, "ref-storage-format", &ref_storage_format_uri, N_("format"),
    + 			   N_("specify the reference storage format to use")),
    +-		OPT_STRING_F(0, "ref-format", &ref_storage_format_str, N_("format"),
    ++		OPT_STRING_F(0, "ref-format", &ref_storage_format_uri, N_("format"),
    + 			   N_("specify the reference storage format to use"), PARSE_OPT_HIDDEN),
    + 		OPT_END()
    + 	};
     @@ builtin/init-db.c: int cmd_init_db(int argc,
      			die(_("unknown hash algorithm '%s'"), object_format);
      	}
      
    --	if (ref_storage) {
    --		ref_storage_format = ref_storage_format_by_name(ref_storage);
    +-	if (ref_storage_format_str) {
    +-		ref_storage_format = ref_storage_format_by_name(ref_storage_format_str);
     -		if (ref_storage_format == REF_STORAGE_FORMAT_UNKNOWN)
    --			die(_("unknown ref storage format '%s'"), ref_storage);
    +-			die(_("unknown ref storage format '%s'"), ref_storage_format_str);
     -	}
     -
      	if (init_shared_repository != -1)
    @@ builtin/init-db.c: int cmd_init_db(int argc,
      	flags |= INIT_DB_EXIST_OK;
      	ret = init_db(the_repository, git_dir, real_git_dir, work_tree,
     -		      template_dir, hash_algo, ref_storage_format, initial_branch,
    -+		      template_dir, hash_algo, ref_storage, initial_branch,
    - 		      init_shared_repository, flags);
    +-		      init_shared_repository, flags);
    ++		      template_dir, hash_algo, ref_storage_format_uri,
    ++		      initial_branch, init_shared_repository, flags);
      
      	free(template_dir_to_free);
    + 	free(real_git_dir_to_free);
     
      ## setup.c ##
     @@ setup.c: static int read_default_format_config(const char *key, const char *value,
    @@ setup.c: static int read_default_format_config(const char *key, const char *valu
      
      static void repository_format_configure(struct repository_format *repo_fmt,
     -					int hash, enum ref_storage_format ref_storage_format)
    -+					int hash, const char *ref_storage_uri)
    ++					int hash,
    ++					const char *ref_storage_format_uri)
      {
      	struct default_format_config cfg = {
      		.hash = GIT_HASH_UNKNOWN,
    @@ setup.c: static void repository_format_configure(struct repository_format *repo_
      	 */
     -	if (ref_storage_format != REF_STORAGE_FORMAT_UNKNOWN) {
     -		/* nothing to do */
    -+	if (ref_storage_uri) {
    -+		ref_storage_format = ref_storage_format_by_uri(ref_storage_uri, &ref_storage_payload);
    ++	if (ref_storage_format_uri) {
    ++		ref_storage_format = ref_storage_format_by_uri(ref_storage_format_uri,
    ++							       &ref_storage_payload);
     +		if (ref_storage_format == REF_STORAGE_FORMAT_UNKNOWN)
    -+			die(_("unknown reference storage format specified via command line: '%s'"),
    -+			    ref_storage_uri);
    - 	} else if (((env = getenv(GIT_REF_STORAGE_ENVIRONMENT)) ||
    ++			die(_("unknown ref storage format specified via command line: '%s'"),
    ++			    ref_storage_format_uri);
    + 	} else if (((env = getenv(GIT_REF_STORAGE_FORMAT_ENVIRONMENT)) ||
      		    (env = getenv(GIT_REFERENCE_BACKEND_ENVIRONMENT)))) {
      		ref_storage_format = ref_storage_format_by_uri(env, &ref_storage_payload);
     @@ setup.c: int init_db(struct repository *repo,
    @@ setup.c: int init_db(struct repository *repo,
      	    const char *worktree,
      	    const char *template_dir, int hash,
     -	    enum ref_storage_format ref_storage_format,
    -+	    const char *ref_storage_uri,
    ++	    const char *ref_storage_format_uri,
      	    const char *initial_branch,
      	    int init_shared_repository, unsigned int flags)
      {
    @@ setup.c: int init_db(struct repository *repo,
      	 */
      	read_and_verify_repository_format(&repo_fmt, repo_get_git_dir(repo), NULL);
     -	repository_format_configure(&repo_fmt, hash, ref_storage_format);
    -+	repository_format_configure(&repo_fmt, hash, ref_storage_uri);
    ++	repository_format_configure(&repo_fmt, hash, ref_storage_format_uri);
      	if (apply_repository_format(repo, &repo_fmt, APPLY_REPOSITORY_FORMAT_HONOR_ENV, &err) < 0)
      		die("%s", err.buf);
      
    @@ setup.h: int init_db(struct repository *repo,
      	    const char *worktree,
      	    const char *template_dir, int hash_algo,
     -	    enum ref_storage_format ref_storage_format,
    -+	    const char *ref_storage_uri,
    ++	    const char *ref_storage_format_uri,
      	    const char *initial_branch, int init_shared_repository,
      	    unsigned int flags);
      void initialize_repository_version(struct repository *repo,
     
      ## t/t0001-init.sh ##
     @@ t/t0001-init.sh: done
    - test_expect_success 'init with --ref-storage=garbage' '
    + test_expect_success 'init with --ref-storage-format=garbage' '
      	test_when_finished "rm -rf refformat" &&
      	cat >expect <<-EOF &&
     -	fatal: unknown ref storage format ${SQ}garbage${SQ}
    -+	fatal: unknown reference storage format specified via command line: ${SQ}garbage${SQ}
    ++	fatal: unknown ref storage format specified via command line: ${SQ}garbage${SQ}
      	EOF
    - 	test_must_fail git init --ref-storage=garbage refformat 2>err &&
    + 	test_must_fail git init --ref-storage-format=garbage refformat 2>err &&
      	test_cmp expect err
     
      ## t/t1423-ref-backend.sh ##
    @@ t/t1423-ref-backend.sh: test_expect_success 'initializing repository with alt re
      	)
      '
      
    -+test_expect_success 'initializing repository with --ref-storage and payload' '
    ++test_expect_success 'initializing repository with --ref-storage-format and payload' '
     +	test_when_finished "rm -rf repo refdir" &&
     +	mkdir refdir &&
     +	BACKEND="$(test_detect_ref_format)://$(pwd)/refdir" &&
    -+	git init --ref-storage="$BACKEND" repo &&
    ++	git init --ref-storage-format="$BACKEND" repo &&
     +	verify_files_exist repo/.git refdir &&
     +
     +	git -C repo config get extensions.refstorage >actual &&
    @@ t/t1423-ref-backend.sh: test_expect_success 'initializing repository with alt re
     +	# Reinitializing the repository is fine when not specifying any format.
     +	git -C repo init &&
     +	# Reinitializing with the same backend is fine, too.
    -+	git -C repo init --ref-storage="$BACKEND" &&
    ++	git -C repo init --ref-storage-format="$BACKEND" &&
     +	# Reinitializing without a payload should fail.
    -+	test_must_fail git -C repo init --ref-storage="$(test_detect_ref_format)" 2>err &&
    ++	test_must_fail git -C repo init --ref-storage-format="$(test_detect_ref_format)" 2>err &&
     +	test_grep "attempt to reinitialize repository with different reference storage payload" err &&
     +	# Reinitializing with a different payload should fail, too.
    -+	test_must_fail git -C repo init --ref-storage="$(test_detect_ref_format)://$(pwd)/other" 2>err &&
    ++	test_must_fail git -C repo init --ref-storage-format="$(test_detect_ref_format)://$(pwd)/other" 2>err &&
     +	test_grep "attempt to reinitialize repository with different reference storage payload" err &&
     +
     +	git -C repo config get extensions.refstorage >actual &&

---
base-commit: 3cb9185f65410273787f74333cc027d2ea5daada
change-id: 20260904-b4-pks-unify-ref-storage-format-0c81fb038671


^ permalink raw reply	[flat|nested] 61+ messages in thread

* [PATCH v2 01/11] builtin/init: rename "--ref-format=" to "--ref-storage-format="
  2026-09-07 11:18 ` [PATCH v2 " Patrick Steinhardt
@ 2026-09-07 11:18   ` Patrick Steinhardt
  2026-09-08  9:01     ` Kaartic Sivaraam
  2026-09-07 11:18   ` [PATCH v2 02/11] builtin/clone: " Patrick Steinhardt
                     ` (9 subsequent siblings)
  10 siblings, 1 reply; 61+ messages in thread
From: Patrick Steinhardt @ 2026-09-07 11:18 UTC (permalink / raw)
  To: git; +Cc: Karthik Nayak, Junio C Hamano

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>
---
 Documentation/config/init.adoc         |  2 +-
 Documentation/git-init.adoc            |  4 ++--
 Documentation/git.adoc                 |  2 +-
 builtin/init-db.c                      | 16 ++++++++-------
 t/perf/p1401-ref-store-tombstones.sh   |  4 ++--
 t/perf/perf-lib.sh                     |  2 +-
 t/t0001-init.sh                        | 24 +++++++++++------------
 t/t0610-reftable-basics.sh             | 14 ++++++-------
 t/t0611-reftable-httpd.sh              |  2 +-
 t/t1400-update-ref.sh                  |  2 +-
 t/t1423-ref-backend.sh                 |  6 +++---
 t/t1460-refs-migrate.sh                | 36 +++++++++++++++++-----------------
 t/t1900-repo-info.sh                   |  6 +++---
 t/t5510-fetch.sh                       |  8 ++++----
 t/t7424-submodule-mixed-ref-formats.sh |  2 +-
 15 files changed, 66 insertions(+), 64 deletions(-)

diff --git a/Documentation/config/init.adoc b/Documentation/config/init.adoc
index 7b4abdaf8b..a048f0bddc 100644
--- a/Documentation/config/init.adoc
+++ b/Documentation/config/init.adoc
@@ -15,7 +15,7 @@ endif::[]
 	this config.
 `init.defaultRefFormat`::
 	Allows overriding the default ref storage format for new repositories.
-	See `--ref-format=` in linkgit:git-init[1]. Both the command line
+	See `--ref-storage-format=` in linkgit:git-init[1]. Both the command line
 	option and the `GIT_DEFAULT_REF_FORMAT` environment variable take
 	precedence over this config.
 
diff --git a/Documentation/git-init.adoc b/Documentation/git-init.adoc
index bab99b9b47..7e407d3ef1 100644
--- a/Documentation/git-init.adoc
+++ b/Documentation/git-init.adoc
@@ -11,7 +11,7 @@ SYNOPSIS
 [synopsis]
 git init [-q | --quiet] [--bare] [--template=<template-directory>]
 	 [--separate-git-dir <git-dir>] [--object-format=<format>]
-	 [--ref-format=<format>]
+	 [--ref-storage-format=<format>]
 	 [-b <branch-name> | --initial-branch=<branch-name>]
 	 [--shared[=<permissions>]] [<directory>]
 
@@ -57,7 +57,7 @@ values are `sha1` and (if enabled) `sha256`.  `sha1` is the default.
 +
 include::object-format-disclaimer.adoc[]
 
-`--ref-format=<format>`::
+`--ref-storage-format=<format>`::
 Specify the given ref storage _<format>_ for the repository. The valid values are:
 +
 include::ref-storage-format.adoc[]
diff --git a/Documentation/git.adoc b/Documentation/git.adoc
index 8a5cdd3b3d..23ba65656e 100644
--- a/Documentation/git.adoc
+++ b/Documentation/git.adoc
@@ -593,7 +593,7 @@ double-quotes and respecting backslash escapes. E.g., the value
 `GIT_DEFAULT_REF_FORMAT`::
 	If this variable is set, the default reference backend format for new
 	repositories will be set to this value. The default is "files".
-	See `--ref-format` in linkgit:git-init[1].
+	See `--ref-storage-format` in linkgit:git-init[1].
 
 `GIT_REFERENCE_BACKEND`::
     Specify which reference backend to be used along with its URI.
diff --git a/builtin/init-db.c b/builtin/init-db.c
index e96b1283b7..63f33154c0 100644
--- a/builtin/init-db.c
+++ b/builtin/init-db.c
@@ -57,7 +57,7 @@ static int shared_callback(const struct option *opt, const char *arg, int unset)
 static const char *const init_db_usage[] = {
 	N_("git init [-q | --quiet] [--bare] [--template=<template-directory>]\n"
 	   "         [--separate-git-dir <git-dir>] [--object-format=<format>]\n"
-	   "         [--ref-format=<format>]\n"
+	   "         [--ref-storage-format=<format>]\n"
 	   "         [-b <branch-name> | --initial-branch=<branch-name>]\n"
 	   "         [--shared[=<permissions>]] [<directory>]"),
 	NULL
@@ -83,7 +83,7 @@ int cmd_init_db(int argc,
 	unsigned int flags = 0;
 	int bare = startup_info->force_bare_repository ? 1 : -1;
 	const char *object_format = NULL;
-	const char *ref_format = NULL;
+	const char *ref_storage_format_str = NULL;
 	const char *initial_branch = NULL;
 	int hash_algo = GIT_HASH_UNKNOWN;
 	enum ref_storage_format ref_storage_format = REF_STORAGE_FORMAT_UNKNOWN;
@@ -109,8 +109,10 @@ int cmd_init_db(int argc,
 			   N_("override the name of the initial branch")),
 		OPT_STRING(0, "object-format", &object_format, N_("hash"),
 			   N_("specify the hash algorithm to use")),
-		OPT_STRING(0, "ref-format", &ref_format, N_("format"),
-			   N_("specify the reference format to use")),
+		OPT_STRING(0, "ref-storage-format", &ref_storage_format_str, N_("format"),
+			   N_("specify the reference storage format to use")),
+		OPT_STRING_F(0, "ref-format", &ref_storage_format_str, N_("format"),
+			   N_("specify the reference storage format to use"), PARSE_OPT_HIDDEN),
 		OPT_END()
 	};
 	int ret;
@@ -173,10 +175,10 @@ int cmd_init_db(int argc,
 			die(_("unknown hash algorithm '%s'"), object_format);
 	}
 
-	if (ref_format) {
-		ref_storage_format = ref_storage_format_by_name(ref_format);
+	if (ref_storage_format_str) {
+		ref_storage_format = ref_storage_format_by_name(ref_storage_format_str);
 		if (ref_storage_format == REF_STORAGE_FORMAT_UNKNOWN)
-			die(_("unknown ref storage format '%s'"), ref_format);
+			die(_("unknown ref storage format '%s'"), ref_storage_format_str);
 	}
 
 	if (init_shared_repository != -1)
diff --git a/t/perf/p1401-ref-store-tombstones.sh b/t/perf/p1401-ref-store-tombstones.sh
index 9e3d8031aa..37ffe0c3a7 100755
--- a/t/perf/p1401-ref-store-tombstones.sh
+++ b/t/perf/p1401-ref-store-tombstones.sh
@@ -5,7 +5,7 @@ test_description="Tests performance of ref operations with many tombstones"
 . ./perf-lib.sh
 
 test_expect_success "setup" '
-	git init --ref-format=reftable repo &&
+	git init --ref-storage-format=reftable repo &&
 	blob=$(echo foo | git -C repo hash-object -w --stdin) &&
 	for i in $(test_seq 8000)
 	do
@@ -24,7 +24,7 @@ test_perf "recreate refs after mass delete" '
 '
 
 test_expect_success "setup asymmetric" '
-	git init --ref-format=reftable repo2 &&
+	git init --ref-storage-format=reftable repo2 &&
 	blob=$(echo foo | git -C repo2 hash-object -w --stdin) &&
 	for i in $(test_seq 8000)
 	do
diff --git a/t/perf/perf-lib.sh b/t/perf/perf-lib.sh
index 2ac007888e..3ce49fd423 100644
--- a/t/perf/perf-lib.sh
+++ b/t/perf/perf-lib.sh
@@ -153,7 +153,7 @@ test_perf_create_repo_from () {
 	) &&
 	(
 		cd "$repo" &&
-		"$MODERN_GIT" init -q --ref-format="$refformat" --object-format="$objectformat" &&
+		"$MODERN_GIT" init -q --ref-storage-format="$refformat" --object-format="$objectformat" &&
 		test_perf_do_repo_symlink_config_ &&
 		mv .git/hooks .git/hooks-disabled 2>/dev/null &&
 		if test -f .git/index.lock
diff --git a/t/t0001-init.sh b/t/t0001-init.sh
index 5cf2e5a35a..df9a2ff2da 100755
--- a/t/t0001-init.sh
+++ b/t/t0001-init.sh
@@ -696,9 +696,9 @@ do
 		test_cmp expect actual
 	'
 
-	test_expect_success "init with --ref-format=$format" '
+	test_expect_success "init with --ref-storage-format=$format" '
 		test_when_finished "rm -rf refformat" &&
-		git init --ref-format=$format refformat &&
+		git init --ref-storage-format=$format refformat &&
 		echo $format >expect &&
 		git -C refformat rev-parse --show-ref-format >actual &&
 		test_cmp expect actual
@@ -717,9 +717,9 @@ do
 		test_cmp expect actual
 	'
 
-	test_expect_success "--ref-format=$format overrides GIT_DEFAULT_REF_FORMAT" '
+	test_expect_success "--ref-storage-format=$format overrides GIT_DEFAULT_REF_FORMAT" '
 		test_when_finished "rm -rf refformat" &&
-		GIT_DEFAULT_REF_FORMAT=garbage git init --ref-format=$format 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 &&
 		test_cmp expect actual
@@ -735,9 +735,9 @@ do
 	'
 done
 
-test_expect_success "--ref-format= overrides GIT_DEFAULT_REF_FORMAT" '
+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-format=reftable 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 &&
 	test_cmp expect actual
@@ -791,8 +791,8 @@ for from_format in $backends
 do
 	test_expect_success "re-init with same format ($from_format)" '
 		test_when_finished "rm -rf refformat" &&
-		git init --ref-format=$from_format refformat &&
-		git init --ref-format=$from_format refformat &&
+		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 &&
 		test_cmp expect actual
@@ -807,11 +807,11 @@ do
 
 		test_expect_success "re-init with different format fails ($from_format -> $to_format)" '
 			test_when_finished "rm -rf refformat" &&
-			git init --ref-format=$from_format refformat &&
+			git init --ref-storage-format=$from_format refformat &&
 			cat >expect <<-EOF &&
 			fatal: attempt to reinitialize repository with different reference storage format
 			EOF
-			test_must_fail git init --ref-format=$to_format refformat 2>err &&
+			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 &&
@@ -820,12 +820,12 @@ do
 	done
 done
 
-test_expect_success 'init with --ref-format=garbage' '
+test_expect_success 'init with --ref-storage-format=garbage' '
 	test_when_finished "rm -rf refformat" &&
 	cat >expect <<-EOF &&
 	fatal: unknown ref storage format ${SQ}garbage${SQ}
 	EOF
-	test_must_fail git init --ref-format=garbage refformat 2>err &&
+	test_must_fail git init --ref-storage-format=garbage refformat 2>err &&
 	test_cmp expect err
 '
 
diff --git a/t/t0610-reftable-basics.sh b/t/t0610-reftable-basics.sh
index 35e98b43db..1cf96ce2c5 100755
--- a/t/t0610-reftable-basics.sh
+++ b/t/t0610-reftable-basics.sh
@@ -59,28 +59,28 @@ test_expect_success 'init: reinitializing reftable backend succeeds' '
 	test_commit -C repo A &&
 
 	git -C repo for-each-ref >expect &&
-	git init --ref-format=reftable repo &&
+	git init --ref-storage-format=reftable repo &&
 	git -C repo for-each-ref >actual &&
 	test_cmp expect actual
 '
 
 test_expect_success 'init: reinitializing files with reftable backend fails' '
 	test_when_finished "rm -rf repo" &&
-	git init --ref-format=files repo &&
+	git init --ref-storage-format=files repo &&
 	test_commit -C repo file &&
 
 	cp repo/.git/HEAD expect &&
-	test_must_fail git init --ref-format=reftable repo &&
+	test_must_fail git init --ref-storage-format=reftable repo &&
 	test_cmp expect repo/.git/HEAD
 '
 
 test_expect_success 'init: reinitializing reftable with files backend fails' '
 	test_when_finished "rm -rf repo" &&
-	git init --ref-format=reftable repo &&
+	git init --ref-storage-format=reftable repo &&
 	test_commit -C repo file &&
 
 	cp repo/.git/HEAD expect &&
-	test_must_fail git init --ref-format=files repo &&
+	test_must_fail git init --ref-storage-format=files repo &&
 	test_cmp expect repo/.git/HEAD
 '
 
@@ -163,7 +163,7 @@ test_expect_success 'clone: can clone reftable repository' '
 
 test_expect_success 'clone: can clone reffiles into reftable repository' '
 	test_when_finished "rm -rf reffiles reftable" &&
-	git init --ref-format=files reffiles &&
+	git init --ref-storage-format=files reffiles &&
 	test_commit -C reffiles A &&
 	git clone --ref-format=reftable ./reffiles reftable &&
 
@@ -182,7 +182,7 @@ test_expect_success 'clone: can clone reffiles into reftable repository' '
 
 test_expect_success 'clone: can clone reftable into reffiles repository' '
 	test_when_finished "rm -rf reffiles reftable" &&
-	git init --ref-format=reftable reftable &&
+	git init --ref-storage-format=reftable reftable &&
 	test_commit -C reftable A &&
 	git clone --ref-format=files ./reftable reffiles &&
 
diff --git a/t/t0611-reftable-httpd.sh b/t/t0611-reftable-httpd.sh
index 5e05b9c1f2..b030814b9f 100755
--- a/t/t0611-reftable-httpd.sh
+++ b/t/t0611-reftable-httpd.sh
@@ -10,7 +10,7 @@ start_httpd
 REPO="$HTTPD_DOCUMENT_ROOT_PATH/repo"
 
 test_expect_success 'serving ls-remote' '
-	git init --ref-format=reftable -b main "$REPO" &&
+	git init --ref-storage-format=reftable -b main "$REPO" &&
 	cd "$REPO" &&
 	test_commit m1 &&
 	>.git/git-daemon-export-ok &&
diff --git a/t/t1400-update-ref.sh b/t/t1400-update-ref.sh
index 269fdaa3ed..1a164c96f9 100755
--- a/t/t1400-update-ref.sh
+++ b/t/t1400-update-ref.sh
@@ -2361,7 +2361,7 @@ do
 	'
 
 	test_expect_success CASE_INSENSITIVE_FS "stdin $type batch-updates existing reference" '
-		git init --ref-format=reftable repo &&
+		git init --ref-storage-format=reftable repo &&
 		test_when_finished "rm -fr repo" &&
 		(
 			cd repo &&
diff --git a/t/t1423-ref-backend.sh b/t/t1423-ref-backend.sh
index fd47d77e8e..9ae295cf3d 100755
--- a/t/t1423-ref-backend.sh
+++ b/t/t1423-ref-backend.sh
@@ -137,7 +137,7 @@ do
 
 		test_expect_success "$method: read from $to_format backend, $dir dir" '
 			test_when_finished "rm -rf repo" &&
-			git init --ref-format=$from_format repo &&
+			git init --ref-storage-format=$from_format repo &&
 			(
 				cd repo &&
 				test_commit 1 &&
@@ -152,7 +152,7 @@ do
 
 		test_expect_success "$method: write to $to_format backend, $dir dir" '
 			test_when_finished "rm -rf repo" &&
-			git init --ref-format=$from_format repo &&
+			git init --ref-storage-format=$from_format repo &&
 			(
 				cd repo &&
 				test_commit 1 &&
@@ -179,7 +179,7 @@ do
 
 		test_expect_success "$method: with worktree and $to_format backend, $dir dir" '
 			test_when_finished "rm -rf repo wt" &&
-			git init --ref-format=$from_format repo &&
+			git init --ref-storage-format=$from_format repo &&
 			(
 				cd repo &&
 				test_commit 1 &&
diff --git a/t/t1460-refs-migrate.sh b/t/t1460-refs-migrate.sh
index 8f42697143..bb2507f571 100755
--- a/t/t1460-refs-migrate.sh
+++ b/t/t1460-refs-migrate.sh
@@ -105,7 +105,7 @@ do
 
 		test_expect_success "$from_format: migration to same format fails" '
 			test_when_finished "rm -rf repo" &&
-			git init --ref-format=$from_format repo &&
+			git init --ref-storage-format=$from_format repo &&
 			test_must_fail git -C repo refs migrate \
 				--ref-format=$from_format 2>err &&
 			cat >expect <<-EOF &&
@@ -116,7 +116,7 @@ do
 
 		test_expect_success "$from_format -> $to_format: migration with worktree fails" '
 			test_when_finished "rm -rf repo" &&
-			git init --ref-format=$from_format repo &&
+			git init --ref-storage-format=$from_format repo &&
 			git -C repo worktree add wt &&
 			test_must_fail git -C repo refs migrate \
 				--ref-format=$to_format 2>err &&
@@ -128,20 +128,20 @@ do
 
 		test_expect_success "$from_format -> $to_format: unborn HEAD" '
 			test_when_finished "rm -rf repo" &&
-			git init --ref-format=$from_format repo &&
+			git init --ref-storage-format=$from_format repo &&
 			test_migration repo "$to_format"
 		'
 
 		test_expect_success "$from_format -> $to_format: single ref" '
 			test_when_finished "rm -rf repo" &&
-			git init --ref-format=$from_format repo &&
+			git init --ref-storage-format=$from_format repo &&
 			test_commit -C repo initial &&
 			test_migration repo "$to_format"
 		'
 
 		test_expect_success "$from_format -> $to_format: bare repository" '
 			test_when_finished "rm -rf repo repo.git" &&
-			git init --ref-format=$from_format repo &&
+			git init --ref-storage-format=$from_format repo &&
 			test_commit -C repo initial &&
 			git clone --ref-format=$from_format --mirror repo repo.git &&
 			test_migration repo.git "$to_format"
@@ -149,7 +149,7 @@ do
 
 		test_expect_success "$from_format -> $to_format: dangling symref" '
 			test_when_finished "rm -rf repo" &&
-			git init --ref-format=$from_format repo &&
+			git init --ref-storage-format=$from_format repo &&
 			test_commit -C repo initial &&
 			git -C repo symbolic-ref BROKEN_HEAD refs/heads/nonexistent &&
 			test_migration repo "$to_format" &&
@@ -160,7 +160,7 @@ do
 
 		test_expect_success "$from_format -> $to_format: broken ref" '
 			test_when_finished "rm -rf repo" &&
-			git init --ref-format=$from_format repo &&
+			git init --ref-storage-format=$from_format repo &&
 			test_commit -C repo initial &&
 			test-tool -C repo ref-store main update-ref "" refs/heads/broken \
 				"$(test_oid 001)" "$ZERO_OID" REF_SKIP_CREATE_REFLOG,REF_SKIP_OID_VERIFICATION &&
@@ -172,7 +172,7 @@ do
 
 		test_expect_success "$from_format -> $to_format: pseudo-refs" '
 			test_when_finished "rm -rf repo" &&
-			git init --ref-format=$from_format repo &&
+			git init --ref-storage-format=$from_format repo &&
 			test_commit -C repo initial &&
 			git -C repo update-ref FOO_HEAD HEAD &&
 			test_migration repo "$to_format"
@@ -180,7 +180,7 @@ do
 
 		test_expect_success "$from_format -> $to_format: special refs are left alone" '
 			test_when_finished "rm -rf repo" &&
-			git init --ref-format=$from_format repo &&
+			git init --ref-storage-format=$from_format repo &&
 			test_commit -C repo initial &&
 			git -C repo rev-parse HEAD >repo/.git/MERGE_HEAD &&
 			git -C repo rev-parse MERGE_HEAD &&
@@ -190,7 +190,7 @@ do
 
 		test_expect_success "$from_format -> $to_format: a bunch of refs" '
 			test_when_finished "rm -rf repo" &&
-			git init --ref-format=$from_format repo &&
+			git init --ref-storage-format=$from_format repo &&
 
 			test_commit -C repo initial &&
 			cat >input <<-EOF &&
@@ -208,7 +208,7 @@ do
 
 		test_expect_success "$from_format -> $to_format: dry-run migration does not modify repository" '
 			test_when_finished "rm -rf repo" &&
-			git init --ref-format=$from_format repo &&
+			git init --ref-storage-format=$from_format repo &&
 			test_commit -C repo initial &&
 			git -C repo refs migrate --dry-run \
 				--ref-format=$to_format >output &&
@@ -221,7 +221,7 @@ do
 
 		test_expect_success "$from_format -> $to_format: reflogs of symrefs with target deleted" '
 			test_when_finished "rm -rf repo" &&
-			git init --ref-format=$from_format repo &&
+			git init --ref-storage-format=$from_format repo &&
 			test_commit -C repo initial &&
 			git -C repo branch branch-1 HEAD &&
 			git -C repo symbolic-ref refs/heads/symref refs/heads/branch-1 &&
@@ -234,7 +234,7 @@ do
 
 		test_expect_success "$from_format -> $to_format: reflogs order is retained" '
 			test_when_finished "rm -rf repo" &&
-			git init --ref-format=$from_format repo &&
+			git init --ref-storage-format=$from_format repo &&
 			test_commit --date "100005000 +0700" --no-tag -C repo initial &&
 			test_commit --date "100003000 +0700" --no-tag -C repo second &&
 			test_migration repo "$to_format"
@@ -242,7 +242,7 @@ do
 
 		test_expect_success "$from_format -> $to_format: stash is retained" '
 			test_when_finished "rm -rf repo" &&
-			git init --ref-format=$from_format repo &&
+			git init --ref-storage-format=$from_format repo &&
 			(
 				cd repo &&
 				test_commit initial A &&
@@ -259,7 +259,7 @@ do
 
 		test_expect_success "$from_format -> $to_format: skip reflog with --skip-reflog" '
 			test_when_finished "rm -rf repo" &&
-			git init --ref-format=$from_format repo &&
+			git init --ref-storage-format=$from_format repo &&
 			test_commit -C repo initial &&
 			# we see that the repository contains reflogs.
 			git -C repo reflog --all >reflogs &&
@@ -274,7 +274,7 @@ done
 
 test_expect_success 'multiple reftable blocks with multiple entries' '
 	test_when_finished "rm -rf repo" &&
-	git init --ref-format=files repo &&
+	git init --ref-storage-format=files repo &&
 	test_commit -C repo first &&
 	test_seq -f "create refs/heads/ref-%d HEAD" 5000 |
 	git -C repo update-ref --stdin &&
@@ -286,7 +286,7 @@ test_expect_success 'multiple reftable blocks with multiple entries' '
 
 test_expect_success 'migrating from files format deletes backend files' '
 	test_when_finished "rm -rf repo" &&
-	git init --ref-format=files repo &&
+	git init --ref-storage-format=files repo &&
 	test_commit -C repo first &&
 	git -C repo pack-refs --all &&
 	test_commit -C repo second &&
@@ -313,7 +313,7 @@ test_expect_success 'migrating from files format deletes backend files' '
 
 test_expect_success 'migrating from reftable format deletes backend files' '
 	test_when_finished "rm -rf repo" &&
-	git init --ref-format=reftable repo &&
+	git init --ref-storage-format=reftable repo &&
 	test_commit -C repo first &&
 
 	test_path_is_dir repo/.git/reftable &&
diff --git a/t/t1900-repo-info.sh b/t/t1900-repo-info.sh
index c85d390f43..d115d2d9f9 100755
--- a/t/t1900-repo-info.sh
+++ b/t/t1900-repo-info.sh
@@ -39,10 +39,10 @@ test_repo_info () {
 }
 
 test_repo_info 'ref format files is retrieved correctly' \
-	'git init --ref-format=files' 'format-files' 'references.format' 'files'
+	'git init --ref-storage-format=files' 'format-files' 'references.format' 'files'
 
 test_repo_info 'ref format reftable is retrieved correctly' \
-	'git init --ref-format=reftable' 'format-reftable' 'references.format' 'reftable'
+	'git init --ref-storage-format=reftable' 'format-reftable' 'references.format' 'reftable'
 
 test_repo_info 'bare repository = false is retrieved correctly' \
 	'git init' 'nonbare' 'layout.bare' 'false'
@@ -75,7 +75,7 @@ test_expect_success 'values returned in order requested' '
 	references.format=files
 	layout.bare=false
 	EOF
-	git init --ref-format=files ordered &&
+	git init --ref-storage-format=files ordered &&
 	git -C ordered repo info layout.bare references.format layout.bare >actual &&
 	test_cmp expect actual
 '
diff --git a/t/t5510-fetch.sh b/t/t5510-fetch.sh
index a8d38d9176..359c3cf99b 100755
--- a/t/t5510-fetch.sh
+++ b/t/t5510-fetch.sh
@@ -1803,7 +1803,7 @@ test_expect_success CASE_INSENSITIVE_FS,REFFILES 'existing references in a case
 test_expect_success REFFILES 'existing reference lock in repo' '
 	test_when_finished rm -rf base repo &&
 	(
-		git init --ref-format=reftable base &&
+		git init --ref-storage-format=reftable base &&
 		cd base &&
 		echo >file update &&
 		git add . &&
@@ -1814,7 +1814,7 @@ test_expect_success REFFILES 'existing reference lock in repo' '
 		git update-ref refs/heads/branch @ &&
 		cd .. &&
 
-		git init --ref-format=files --bare repo &&
+		git init --ref-storage-format=files --bare repo &&
 		cd repo &&
 		git remote add origin ../base &&
 		touch refs/heads/foo.lock &&
@@ -1857,7 +1857,7 @@ test_expect_success CASE_INSENSITIVE_FS,REFFILES 'D/F conflict on case insensiti
 test_expect_success REFFILES 'D/F conflict on case sensitive filesystem with lock' '
 	test_when_finished rm -rf base repo &&
 	(
-		git init --ref-format=reftable base &&
+		git init --ref-storage-format=reftable base &&
 		cd base &&
 		echo >file update &&
 		git add . &&
@@ -1868,7 +1868,7 @@ test_expect_success REFFILES 'D/F conflict on case sensitive filesystem with loc
 		git update-ref refs/heads/branch @ &&
 		cd .. &&
 
-		git init --ref-format=files --bare repo &&
+		git init --ref-storage-format=files --bare repo &&
 		cd repo &&
 		git remote add origin ../base &&
 		mkdir refs/heads/foo &&
diff --git a/t/t7424-submodule-mixed-ref-formats.sh b/t/t7424-submodule-mixed-ref-formats.sh
index 559713b607..1ca245c732 100755
--- a/t/t7424-submodule-mixed-ref-formats.sh
+++ b/t/t7424-submodule-mixed-ref-formats.sh
@@ -31,7 +31,7 @@ test_expect_success 'add existing repository with different ref storage format'
 	(
 		cd parent &&
 		test_commit parent &&
-		git init --ref-format=$OTHER_FORMAT submodule &&
+		git init --ref-storage-format=$OTHER_FORMAT submodule &&
 		test_commit -C submodule submodule &&
 		git submodule add ./submodule
 	)

-- 
2.55.0.1007.g17ff1f9808.dirty


^ permalink raw reply related	[flat|nested] 61+ messages in thread

* [PATCH v2 02/11] builtin/clone: rename "--ref-format=" to "--ref-storage-format="
  2026-09-07 11:18 ` [PATCH v2 " Patrick Steinhardt
  2026-09-07 11:18   ` [PATCH v2 01/11] builtin/init: rename "--ref-format=" to "--ref-storage-format=" Patrick Steinhardt
@ 2026-09-07 11:18   ` Patrick Steinhardt
  2026-09-08  9:21     ` Kaartic Sivaraam
  2026-09-07 11:18   ` [PATCH v2 03/11] builtin/refs: " Patrick Steinhardt
                     ` (8 subsequent siblings)
  10 siblings, 1 reply; 61+ messages in thread
From: Patrick Steinhardt @ 2026-09-07 11:18 UTC (permalink / raw)
  To: git; +Cc: Karthik Nayak, Junio C Hamano

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

Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
 Documentation/git-clone.adoc           |  2 +-
 builtin/clone.c                        | 14 ++++++++------
 t/t0610-reftable-basics.sh             |  4 ++--
 t/t1460-refs-migrate.sh                |  2 +-
 t/t5510-fetch.sh                       |  6 +++---
 t/t5601-clone.sh                       |  4 ++--
 t/t7424-submodule-mixed-ref-formats.sh |  4 ++--
 7 files changed, 19 insertions(+), 17 deletions(-)

diff --git a/Documentation/git-clone.adoc b/Documentation/git-clone.adoc
index b6e1f8ada2..f5d88d2aae 100644
--- a/Documentation/git-clone.adoc
+++ b/Documentation/git-clone.adoc
@@ -348,7 +348,7 @@ or `--mirror` is given)
 	The result is Git repository can be separated from working
 	tree.
 
-`--ref-format=<ref-format>`::
+`--ref-storage-format=<format>`::
 
 Specify the given ref storage format for the repository. The valid values are:
 +
diff --git a/builtin/clone.c b/builtin/clone.c
index 5b25cca510..511fff9562 100644
--- a/builtin/clone.c
+++ b/builtin/clone.c
@@ -901,7 +901,7 @@ int cmd_clone(int argc,
 	char *option_origin = NULL;
 	struct string_list option_not = STRING_LIST_INIT_NODUP;
 	const char *real_git_dir = NULL;
-	const char *ref_format = NULL;
+	const char *ref_storage_format_str = NULL;
 	const char *option_upload_pack = "git-upload-pack";
 	int option_progress = -1;
 	int option_sparse_checkout = 0;
@@ -981,8 +981,10 @@ int cmd_clone(int argc,
 			 N_("any cloned submodules will be shallow")),
 		OPT_STRING(0, "separate-git-dir", &real_git_dir, N_("gitdir"),
 			   N_("separate git dir from working tree")),
-		OPT_STRING(0, "ref-format", &ref_format, N_("format"),
-			   N_("specify the reference format to use")),
+		OPT_STRING(0, "ref-storage-format", &ref_storage_format_str, N_("format"),
+			   N_("specify the reference storage format to use")),
+		OPT_STRING_F(0, "ref-format", &ref_storage_format_str, N_("format"),
+			   N_("specify the reference storage format to use"), PARSE_OPT_HIDDEN),
 		OPT_STRING_LIST('c', "config", &option_config, N_("key=value"),
 				N_("set config inside the new repository")),
 		OPT_STRING_LIST(0, "server-option", &server_options,
@@ -1027,10 +1029,10 @@ int cmd_clone(int argc,
 	if (option_single_branch == -1)
 		option_single_branch = deepen ? 1 : 0;
 
-	if (ref_format) {
-		ref_storage_format = ref_storage_format_by_name(ref_format);
+	if (ref_storage_format_str) {
+		ref_storage_format = ref_storage_format_by_name(ref_storage_format_str);
 		if (ref_storage_format == REF_STORAGE_FORMAT_UNKNOWN)
-			die(_("unknown ref storage format '%s'"), ref_format);
+			die(_("unknown ref storage format '%s'"), ref_storage_format_str);
 	}
 
 	if (option_mirror) {
diff --git a/t/t0610-reftable-basics.sh b/t/t0610-reftable-basics.sh
index 1cf96ce2c5..d325f17a14 100755
--- a/t/t0610-reftable-basics.sh
+++ b/t/t0610-reftable-basics.sh
@@ -165,7 +165,7 @@ test_expect_success 'clone: can clone reffiles into reftable repository' '
 	test_when_finished "rm -rf reffiles reftable" &&
 	git init --ref-storage-format=files reffiles &&
 	test_commit -C reffiles A &&
-	git clone --ref-format=reftable ./reffiles reftable &&
+	git clone --ref-storage-format=reftable ./reffiles reftable &&
 
 	git -C reffiles rev-parse HEAD >expect &&
 	git -C reftable rev-parse HEAD >actual &&
@@ -184,7 +184,7 @@ test_expect_success 'clone: can clone reftable into reffiles repository' '
 	test_when_finished "rm -rf reffiles reftable" &&
 	git init --ref-storage-format=reftable reftable &&
 	test_commit -C reftable A &&
-	git clone --ref-format=files ./reftable reffiles &&
+	git clone --ref-storage-format=files ./reftable reffiles &&
 
 	git -C reftable rev-parse HEAD >expect &&
 	git -C reffiles rev-parse HEAD >actual &&
diff --git a/t/t1460-refs-migrate.sh b/t/t1460-refs-migrate.sh
index bb2507f571..8aded6597e 100755
--- a/t/t1460-refs-migrate.sh
+++ b/t/t1460-refs-migrate.sh
@@ -143,7 +143,7 @@ do
 			test_when_finished "rm -rf repo repo.git" &&
 			git init --ref-storage-format=$from_format repo &&
 			test_commit -C repo initial &&
-			git clone --ref-format=$from_format --mirror repo repo.git &&
+			git clone --ref-storage-format=$from_format --mirror repo repo.git &&
 			test_migration repo.git "$to_format"
 		'
 
diff --git a/t/t5510-fetch.sh b/t/t5510-fetch.sh
index 359c3cf99b..300bd5396d 100755
--- a/t/t5510-fetch.sh
+++ b/t/t5510-fetch.sh
@@ -46,19 +46,19 @@ test_expect_success "clone and setup child repos" '
 	) &&
 	git clone . bundle &&
 	git clone . seven &&
-	git clone --ref-format=reftable . case_sensitive &&
+	git clone --ref-storage-format=reftable . case_sensitive &&
 	(
 		cd case_sensitive &&
 		git branch branch1 &&
 		git branch bRanch1
 	) &&
-	git clone --ref-format=reftable . case_sensitive_fd &&
+	git clone --ref-storage-format=reftable . case_sensitive_fd &&
 	(
 		cd case_sensitive_fd &&
 		git branch foo/bar &&
 		git branch Foo
 	) &&
-	git clone --ref-format=reftable . case_sensitive_df &&
+	git clone --ref-storage-format=reftable . case_sensitive_df &&
 	(
 		cd case_sensitive_df &&
 		git branch Foo/bar &&
diff --git a/t/t5601-clone.sh b/t/t5601-clone.sh
index b6167582a1..202d86bc83 100755
--- a/t/t5601-clone.sh
+++ b/t/t5601-clone.sh
@@ -166,7 +166,7 @@ test_expect_success 'clone --mirror does not repeat tags' '
 
 test_expect_success 'clone with files ref format' '
 	test_when_finished "rm -rf ref-storage" &&
-	git clone --ref-format=files --mirror src 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 &&
 	test_cmp expect actual
@@ -176,7 +176,7 @@ test_expect_success 'clone with garbage ref format' '
 	cat >expect <<-EOF &&
 	fatal: unknown ref storage format ${SQ}garbage${SQ}
 	EOF
-	test_must_fail git clone --ref-format=garbage --mirror src ref-storage 2>err &&
+	test_must_fail git clone --ref-storage-format=garbage --mirror src ref-storage 2>err &&
 	test_cmp expect err &&
 	test_path_is_missing ref-storage
 '
diff --git a/t/t7424-submodule-mixed-ref-formats.sh b/t/t7424-submodule-mixed-ref-formats.sh
index 1ca245c732..5eaf689d74 100755
--- a/t/t7424-submodule-mixed-ref-formats.sh
+++ b/t/t7424-submodule-mixed-ref-formats.sh
@@ -63,9 +63,9 @@ test_expect_success 'recursive clone propagates ref storage format' '
 	test_ref_format upstream/submodule "$GIT_DEFAULT_REF_FORMAT" &&
 
 	# The cloned repositories should use the other ref format that we have
-	# specified via `--ref-format`. The option should propagate to cloned
+	# specified via `--ref-storage`. The option should propagate to cloned
 	# submodules.
-	git clone --ref-format=$OTHER_FORMAT --recurse-submodules \
+	git clone --ref-storage-format=$OTHER_FORMAT --recurse-submodules \
 		upstream downstream &&
 	test_ref_format downstream "$OTHER_FORMAT" &&
 	test_ref_format downstream/submodule "$OTHER_FORMAT"

-- 
2.55.0.1007.g17ff1f9808.dirty


^ permalink raw reply related	[flat|nested] 61+ messages in thread

* [PATCH v2 03/11] builtin/refs: rename "--ref-format=" to "--ref-storage-format="
  2026-09-07 11:18 ` [PATCH v2 " Patrick Steinhardt
  2026-09-07 11:18   ` [PATCH v2 01/11] builtin/init: rename "--ref-format=" to "--ref-storage-format=" Patrick Steinhardt
  2026-09-07 11:18   ` [PATCH v2 02/11] builtin/clone: " Patrick Steinhardt
@ 2026-09-07 11:18   ` Patrick Steinhardt
  2026-09-08 10:55     ` Kaartic Sivaraam
  2026-09-07 11:18   ` [PATCH v2 04/11] builtin/submodule: " Patrick Steinhardt
                     ` (7 subsequent siblings)
  10 siblings, 1 reply; 61+ messages in thread
From: Patrick Steinhardt @ 2026-09-07 11:18 UTC (permalink / raw)
  To: git; +Cc: Karthik Nayak, Junio C Hamano

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

Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
 Documentation/git-refs.adoc            |  6 +++---
 builtin/fetch.c                        |  2 +-
 builtin/refs.c                         | 11 +++++++----
 t/t1423-ref-backend.sh                 |  8 ++++----
 t/t1460-refs-migrate.sh                | 12 ++++++------
 t/t7424-submodule-mixed-ref-formats.sh |  2 +-
 6 files changed, 22 insertions(+), 19 deletions(-)

diff --git a/Documentation/git-refs.adoc b/Documentation/git-refs.adoc
index 9063892651..09e9bde939 100644
--- a/Documentation/git-refs.adoc
+++ b/Documentation/git-refs.adoc
@@ -9,7 +9,7 @@ git-refs - Low-level access to refs
 SYNOPSIS
 --------
 [synopsis]
-git refs migrate --ref-format=<format> [--no-reflog] [--dry-run]
+git refs migrate --ref-storage-format=<format> [--no-reflog] [--dry-run]
 git refs verify [--strict] [--verbose]
 git refs list [--count=<count>] [--shell|--perl|--python|--tcl]
 		   [(--sort=<key>)...] [--format=<format>]
@@ -97,8 +97,8 @@ OPTIONS
 
 The following options are specific to `git refs migrate`:
 
-`--ref-format=<format>`::
-	The ref format to migrate the ref store to. Can be one of:
+`--ref-storage-format=<format>`::
+	The ref storage format to migrate the ref store to. Can be one of:
 +
 include::ref-storage-format.adoc[]
 
diff --git a/builtin/fetch.c b/builtin/fetch.c
index ab7db2be06..687909c0c4 100644
--- a/builtin/fetch.c
+++ b/builtin/fetch.c
@@ -1848,7 +1848,7 @@ static void ref_transaction_rejection_handler(const char *refname,
 			"can either accept this as-is, in which case you won't be able to\n"
 			"store all remote references on disk. Or you can alternatively\n"
 			"migrate your repository to use the 'reftable' backend with the\n"
-			"following command:\n\n    git refs migrate --ref-format=reftable\n\n"
+			"following command:\n\n    git refs migrate --ref-storage-format=reftable\n\n"
 			"Please keep in mind that not all implementations of Git support this\n"
 			"new format yet. So if you use tools other than Git to access this\n"
 			"repository it may not be an option to migrate to reftables.\n"));
diff --git a/builtin/refs.c b/builtin/refs.c
index 5cd21c25fe..53b12accaf 100644
--- a/builtin/refs.c
+++ b/builtin/refs.c
@@ -10,7 +10,7 @@
 #include "refs/refs-internal.h"
 
 #define REFS_MIGRATE_USAGE \
-	N_("git refs migrate --ref-format=<format> [--no-reflog] [--dry-run]")
+	N_("git refs migrate --ref-storage-format=<format> [--no-reflog] [--dry-run]")
 
 #define REFS_VERIFY_USAGE \
 	N_("git refs verify [--strict] [--verbose]")
@@ -44,9 +44,12 @@ static int cmd_refs_migrate(int argc, const char **argv, const char *prefix,
 	enum ref_storage_format format;
 	unsigned int flags = 0;
 	struct option options[] = {
-		OPT_STRING_F(0, "ref-format", &format_str, N_("format"),
-			N_("specify the reference format to convert to"),
+		OPT_STRING_F(0, "ref-storage-format", &format_str, N_("format"),
+			N_("specify the reference storage format to convert to"),
 			PARSE_OPT_NONEG),
+		OPT_STRING_F(0, "ref-format", &format_str, N_("format"),
+			N_("specify the reference storage format to convert to"),
+			PARSE_OPT_NONEG | PARSE_OPT_HIDDEN),
 		OPT_BIT(0, "dry-run", &flags,
 			N_("perform a non-destructive dry-run"),
 			REPO_MIGRATE_REF_STORAGE_FORMAT_DRYRUN),
@@ -62,7 +65,7 @@ static int cmd_refs_migrate(int argc, const char **argv, const char *prefix,
 	if (argc)
 		usage(_("too many arguments"));
 	if (!format_str)
-		usage(_("missing --ref-format=<format>"));
+		usage(_("missing --ref-storage-format=<format>"));
 
 	format = ref_storage_format_by_name(format_str);
 	if (format == REF_STORAGE_FORMAT_UNKNOWN) {
diff --git a/t/t1423-ref-backend.sh b/t/t1423-ref-backend.sh
index 9ae295cf3d..ab119a6568 100755
--- a/t/t1423-ref-backend.sh
+++ b/t/t1423-ref-backend.sh
@@ -144,7 +144,7 @@ do
 				test_commit 2 &&
 				test_commit 3 &&
 
-				git refs migrate --dry-run --ref-format=$to_format >out &&
+				git refs migrate --dry-run --ref-storage-format=$to_format >out &&
 				BACKEND_PATH="$dir/$(sed "s/.* ${SQ}.git\/\(.*\)${SQ}/\1/" out)" &&
 				test_refs_backend . $from_format "$to_format://$BACKEND_PATH" "$method"
 			)
@@ -159,7 +159,7 @@ do
 				test_commit 2 &&
 				test_commit 3 &&
 
-				git refs migrate --dry-run --ref-format=$to_format >out &&
+				git refs migrate --dry-run --ref-storage-format=$to_format >out &&
 				BACKEND_PATH="$dir/$(sed "s/.* ${SQ}.git\/\(.*\)${SQ}/\1/" out)" &&
 
 				test_refs_backend . $from_format "$to_format://$BACKEND_PATH" "$method" &&
@@ -186,7 +186,7 @@ do
 				test_commit 2 &&
 				test_commit 3 &&
 
-				git refs migrate --dry-run --ref-format=$to_format >out &&
+				git refs migrate --dry-run --ref-storage-format=$to_format >out &&
 				BACKEND_PATH="$dir/$(sed "s/.* ${SQ}.git\/\(.*\)${SQ}/\1/" out)" &&
 
 				run_with_uri . "$from_format" "$to_format://$BACKEND_PATH" \
@@ -218,7 +218,7 @@ do
 			test_commit 2 &&
 			test_commit 3 &&
 
-			git refs migrate --ref-format=$to_format &&
+			git refs migrate --ref-storage-format=$to_format &&
 			git refs list >out &&
 			test_grep "refs/tags/1"	out &&
 			test_grep "refs/tags/2"	out &&
diff --git a/t/t1460-refs-migrate.sh b/t/t1460-refs-migrate.sh
index 8aded6597e..204dd79b41 100755
--- a/t/t1460-refs-migrate.sh
+++ b/t/t1460-refs-migrate.sh
@@ -42,7 +42,7 @@ test_migration () {
 		print_all_reflog_entries "$repo" >expect_logs
 	fi &&
 
-	git -C "$repo" refs migrate --ref-format="$format" "$@" &&
+	git -C "$repo" refs migrate --ref-storage-format="$format" "$@" &&
 
 	git -C "$repo" for-each-ref --include-root-refs \
 		--format='%(refname) %(objectname) %(symref)' >actual &&
@@ -77,7 +77,7 @@ test_expect_success "missing ref storage format" '
 	git init repo &&
 	test_must_fail git -C repo refs migrate 2>err &&
 	cat >expect <<-EOF &&
-	usage: missing --ref-format=<format>
+	usage: missing --ref-storage-format=<format>
 	EOF
 	test_cmp expect err
 '
@@ -86,7 +86,7 @@ test_expect_success "unknown ref storage format" '
 	test_when_finished "rm -rf repo" &&
 	git init repo &&
 	test_must_fail git -C repo refs migrate \
-		--ref-format=unknown 2>err &&
+		--ref-storage-format=unknown 2>err &&
 	cat >expect <<-EOF &&
 	error: unknown ref storage format ${SQ}unknown${SQ}
 	EOF
@@ -107,7 +107,7 @@ do
 			test_when_finished "rm -rf repo" &&
 			git init --ref-storage-format=$from_format repo &&
 			test_must_fail git -C repo refs migrate \
-				--ref-format=$from_format 2>err &&
+				--ref-storage-format=$from_format 2>err &&
 			cat >expect <<-EOF &&
 			error: repository already uses ${SQ}$from_format${SQ} format
 			EOF
@@ -119,7 +119,7 @@ do
 			git init --ref-storage-format=$from_format repo &&
 			git -C repo worktree add wt &&
 			test_must_fail git -C repo refs migrate \
-				--ref-format=$to_format 2>err &&
+				--ref-storage-format=$to_format 2>err &&
 			cat >expect <<-EOF &&
 			error: migrating repositories with worktrees is not supported yet
 			EOF
@@ -211,7 +211,7 @@ do
 			git init --ref-storage-format=$from_format repo &&
 			test_commit -C repo initial &&
 			git -C repo refs migrate --dry-run \
-				--ref-format=$to_format >output &&
+				--ref-storage-format=$to_format >output &&
 			test_grep "Finished dry-run migration of refs" output &&
 			test_path_is_dir repo/.git/ref_migration.* &&
 			echo $from_format >expect &&
diff --git a/t/t7424-submodule-mixed-ref-formats.sh b/t/t7424-submodule-mixed-ref-formats.sh
index 5eaf689d74..9081401509 100755
--- a/t/t7424-submodule-mixed-ref-formats.sh
+++ b/t/t7424-submodule-mixed-ref-formats.sh
@@ -94,7 +94,7 @@ test_expect_success 'status with mixed submodule ref storages' '
 	git init main &&
 	git -C main submodule add "file://$(pwd)/submodule" &&
 	git -C main commit -m "add submodule" &&
-	git -C main/submodule refs migrate --ref-format=$OTHER_FORMAT &&
+	git -C main/submodule refs migrate --ref-storage-format=$OTHER_FORMAT &&
 
 	# The main repository should use the default ref format now, whereas
 	# the submodule should use the other format.

-- 
2.55.0.1007.g17ff1f9808.dirty


^ permalink raw reply related	[flat|nested] 61+ messages in thread

* [PATCH v2 04/11] builtin/submodule: rename "--ref-format=" to "--ref-storage-format="
  2026-09-07 11:18 ` [PATCH v2 " Patrick Steinhardt
                     ` (2 preceding siblings ...)
  2026-09-07 11:18   ` [PATCH v2 03/11] builtin/refs: " Patrick Steinhardt
@ 2026-09-07 11:18   ` Patrick Steinhardt
  2026-09-07 11:18   ` [PATCH v2 05/11] builtin/rev-parse: rename "--show-ref-format" to "--show-ref-storage-format" Patrick Steinhardt
                     ` (6 subsequent siblings)
  10 siblings, 0 replies; 61+ messages in thread
From: Patrick Steinhardt @ 2026-09-07 11:18 UTC (permalink / raw)
  To: git; +Cc: Karthik Nayak, Junio C Hamano

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

Note that this commit is a bit more complex compared to the others as we
also need to adapt the submodule helper for consistency. But overall,
the changes are straight-forward and in the same spirit.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
 Documentation/git-submodule.adoc       |  8 ++++----
 builtin/clone.c                        |  2 +-
 builtin/submodule--helper.c            | 24 +++++++++++++++---------
 git-submodule.sh                       | 20 ++++++++++----------
 t/t7424-submodule-mixed-ref-formats.sh |  8 ++++----
 5 files changed, 34 insertions(+), 28 deletions(-)

diff --git a/Documentation/git-submodule.adoc b/Documentation/git-submodule.adoc
index 722d827908..d22fd4a5b0 100644
--- a/Documentation/git-submodule.adoc
+++ b/Documentation/git-submodule.adoc
@@ -34,7 +34,7 @@ COMMANDS
 With no arguments, shows the status of existing submodules.  Several
 subcommands are available to perform operations on the submodules.
 
-`add [-b <branch>] [-f | --force] [--name <name>] [--reference <repository>] [--ref-format <format>] [--depth <depth>] [--] <repository> [<path>]`::
+`add [-b <branch>] [-f | --force] [--name <name>] [--reference <repository>] [--ref-storage-format <format>] [--depth <depth>] [--] <repository> [<path>]`::
 	Add the given repository as a submodule at the given path
 	to the changeset to be committed next to the current
 	project: the current project is termed the "superproject".
@@ -72,7 +72,7 @@ location, and only the superproject's URL needs to be provided.
 git-submodule will correctly locate the submodule using the relative
 URL in `.gitmodules`.
 +
-If `--ref-format <format>`  is specified, the ref storage format of newly
+If `--ref-storage-format <format>`  is specified, the ref storage format of newly
 cloned submodules will be set accordingly.
 
 `status [--cached] [--recursive] [--] [<path>...]`::
@@ -139,7 +139,7 @@ If you really want to remove a submodule from the repository and commit
 that use linkgit:git-rm[1] instead. See linkgit:gitsubmodules[7] for removal
 options.
 
-`update [--init] [--remote] [-N | --no-fetch] [--[no-]recommend-shallow] [-f | --force] [--checkout | --rebase | --merge] [--reference=<repository>] [--ref-format=<format>] [--depth=<depth>] [--recursive] [--jobs <n>] [--[no-]single-branch] [--filter=<filter-spec>] [--] [<path>...]`::
+`update [--init] [--remote] [-N | --no-fetch] [--[no-]recommend-shallow] [-f | --force] [--checkout | --rebase | --merge] [--reference=<repository>] [--ref-storage-format=<format>] [--depth=<depth>] [--recursive] [--jobs <n>] [--[no-]single-branch] [--filter=<filter-spec>] [--] [<path>...]`::
 +
 --
 Update the registered submodules to match what the superproject
@@ -188,7 +188,7 @@ submodule with the `--init` option.
 If `--recursive` is specified, this command will recurse into the
 registered submodules, and update any nested submodules within.
 
-If `--ref-format <format>`  is specified, the ref storage format of newly
+If `--ref-storage-format <format>`  is specified, the ref storage format of newly
 cloned submodules will be set accordingly.
 
 If `--filter <filter-spec>` is specified, the given partial clone filter will be
diff --git a/builtin/clone.c b/builtin/clone.c
index 511fff9562..93be65efcd 100644
--- a/builtin/clone.c
+++ b/builtin/clone.c
@@ -725,7 +725,7 @@ static int checkout(int submodule_progress,
 		}
 
 		if (ref_storage_format != REF_STORAGE_FORMAT_UNKNOWN)
-			strvec_pushf(&cmd.args, "--ref-format=%s",
+			strvec_pushf(&cmd.args, "--ref-storage-format=%s",
 				     ref_storage_format_to_name(ref_storage_format));
 
 		if (filter_submodules && filter_options->choice)
diff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c
index e7cd3225fa..55eaaab38f 100644
--- a/builtin/submodule--helper.c
+++ b/builtin/submodule--helper.c
@@ -1941,7 +1941,7 @@ static int clone_submodule(const struct module_clone_data *clone_data,
 					     item->string, NULL);
 		}
 		if (clone_data->ref_storage_format != REF_STORAGE_FORMAT_UNKNOWN)
-			strvec_pushf(&cp.args, "--ref-format=%s",
+			strvec_pushf(&cp.args, "--ref-storage-format=%s",
 				     ref_storage_format_to_name(clone_data->ref_storage_format));
 		if (clone_data->dissociate)
 			strvec_push(&cp.args, "--dissociate");
@@ -2057,8 +2057,10 @@ static int module_clone(int argc, const char **argv, const char *prefix,
 		OPT_STRING_LIST(0, "reference", &reference,
 			   N_("repo"),
 			   N_("reference repository")),
-		OPT_STRING(0, "ref-format", &ref_storage_format, N_("format"),
-			   N_("specify the reference format to use")),
+		OPT_STRING(0, "ref-storage-format", &ref_storage_format, N_("format"),
+			   N_("specify the reference storage format to use")),
+		OPT_STRING_F(0, "ref-format", &ref_storage_format, N_("format"),
+			     N_("specify the reference storage format to use"), PARSE_OPT_HIDDEN),
 		OPT_BOOL(0, "dissociate", &dissociate,
 			   N_("use --reference only while cloning")),
 		OPT_INTEGER(0, "depth", &clone_data.depth,
@@ -2357,7 +2359,7 @@ static int prepare_to_clone_next_submodule(const struct cache_entry *ce,
 	if (suc->update_data->require_init)
 		strvec_push(&child->args, "--require-init");
 	if (suc->update_data->ref_storage_format != REF_STORAGE_FORMAT_UNKNOWN)
-		strvec_pushf(&child->args, "--ref-format=%s",
+		strvec_pushf(&child->args, "--ref-storage-format=%s",
 			     ref_storage_format_to_name(suc->update_data->ref_storage_format));
 	strvec_pushl(&child->args, "--path", sub->path, NULL);
 	strvec_pushl(&child->args, "--name", sub->name, NULL);
@@ -2801,7 +2803,7 @@ static void update_data_to_args(const struct update_data *update_data,
 			strvec_pushl(args, "--reference", item->string, NULL);
 	}
 	if (update_data->ref_storage_format != REF_STORAGE_FORMAT_UNKNOWN)
-		strvec_pushf(args, "--ref-format=%s",
+		strvec_pushf(args, "--ref-storage-format=%s",
 			     ref_storage_format_to_name(update_data->ref_storage_format));
 	if (update_data->filter_options && update_data->filter_options->choice)
 		strvec_pushf(args, "--filter=%s",
@@ -3010,8 +3012,10 @@ static int module_update(int argc, const char **argv, const char *prefix,
 			SM_UPDATE_REBASE),
 		OPT_STRING_LIST(0, "reference", &opt.references, N_("repo"),
 			   N_("reference repository")),
-		OPT_STRING(0, "ref-format", &ref_storage_format, N_("format"),
-			   N_("specify the reference format to use")),
+		OPT_STRING(0, "ref-storage-format", &ref_storage_format, N_("format"),
+			   N_("specify the reference storage format to use")),
+		OPT_STRING_F(0, "ref-format", &ref_storage_format, N_("format"),
+			     N_("specify the reference storage format to use"), PARSE_OPT_HIDDEN),
 		OPT_BOOL(0, "dissociate", &opt.dissociate,
 			   N_("use --reference only while cloning")),
 		OPT_INTEGER(0, "depth", &opt.depth,
@@ -3659,8 +3663,10 @@ static int module_add(int argc, const char **argv, const char *prefix,
 		OPT_BOOL(0, "progress", &progress, N_("force cloning progress")),
 		OPT_STRING(0, "reference", &add_data.reference_path, N_("repository"),
 			   N_("reference repository")),
-		OPT_STRING(0, "ref-format", &ref_storage_format, N_("format"),
-			   N_("specify the reference format to use")),
+		OPT_STRING(0, "ref-storage-format", &ref_storage_format, N_("format"),
+			   N_("specify the reference storage format to use")),
+		OPT_STRING_F(0, "ref-format", &ref_storage_format, N_("format"),
+			     N_("specify the reference storage format to use"), PARSE_OPT_HIDDEN),
 		OPT_BOOL(0, "dissociate", &dissociate, N_("borrow the objects from reference repositories")),
 		OPT_STRING(0, "name", &add_data.sm_name, N_("name"),
 			   N_("sets the submodule's name to the given string "
diff --git a/git-submodule.sh b/git-submodule.sh
index 2999b31fad..8632194138 100755
--- a/git-submodule.sh
+++ b/git-submodule.sh
@@ -95,13 +95,13 @@ cmd_add()
 		--reference=*)
 			reference="$1"
 			;;
-		--ref-format)
+		--ref-format|--ref-storage-format)
 			case "$2" in '') usage ;; esac
-			ref_format="--ref-format=$2"
+			ref_storage_format="--ref-storage-format=$2"
 			shift
 			;;
-		--ref-format=*)
-			ref_format="$1"
+		--ref-format=*|--ref-storage-format=*)
+			ref_storage_format="$1"
 			;;
 		--dissociate)
 			dissociate=$1
@@ -147,7 +147,7 @@ cmd_add()
 		$progress \
 		${branch:+"$branch"} \
 		${reference:+"$reference"} \
-		${ref_format:+"$ref_format"} \
+		${ref_storage_format:+"$ref_storage_format"} \
 		$dissociate \
 		${name:+"$name"} \
 		${depth:+"$depth"} \
@@ -302,13 +302,13 @@ cmd_update()
 		-r|--rebase)
 			rebase=$1
 			;;
-		--ref-format)
+		--ref-format|--ref-storage-format)
 			case "$2" in '') usage ;; esac
-			ref_format="--ref-format=$2"
+			ref_storage_format="--ref-storage-format=$2"
 			shift
 			;;
-		--ref-format=*)
-			ref_format="$1"
+		--ref-format=*|--ref-storage-format=*)
+			ref_storage_format="$1"
 			;;
 		--reference)
 			case "$2" in '') usage ;; esac
@@ -385,7 +385,7 @@ cmd_update()
 		$rebase \
 		$merge \
 		$checkout \
-		${ref_format:+"$ref_format"} \
+		${ref_storage_format:+"$ref_storage_format"} \
 		${reference:+"$reference"} \
 		$dissociate \
 		${depth:+"$depth"} \
diff --git a/t/t7424-submodule-mixed-ref-formats.sh b/t/t7424-submodule-mixed-ref-formats.sh
index 9081401509..2ef85289b3 100755
--- a/t/t7424-submodule-mixed-ref-formats.sh
+++ b/t/t7424-submodule-mixed-ref-formats.sh
@@ -44,7 +44,7 @@ test_expect_success 'add submodules with different ref storage format' '
 	test_commit -C submodule submodule-initial &&
 	git init upstream &&
 	test_ref_format upstream "$GIT_DEFAULT_REF_FORMAT" &&
-	git -C upstream submodule add --ref-format="$OTHER_FORMAT" "file://$(pwd)/submodule" &&
+	git -C upstream submodule add --ref-storage-format="$OTHER_FORMAT" "file://$(pwd)/submodule" &&
 	test_ref_format upstream/submodule "$OTHER_FORMAT"
 '
 
@@ -63,7 +63,7 @@ test_expect_success 'recursive clone propagates ref storage format' '
 	test_ref_format upstream/submodule "$GIT_DEFAULT_REF_FORMAT" &&
 
 	# The cloned repositories should use the other ref format that we have
-	# specified via `--ref-storage`. The option should propagate to cloned
+	# specified via `--ref-storage-format`. The option should propagate to cloned
 	# submodules.
 	git clone --ref-storage-format=$OTHER_FORMAT --recurse-submodules \
 		upstream downstream &&
@@ -82,7 +82,7 @@ test_expect_success 'clone submodules with different ref storage format' '
 
 	git clone --no-recurse-submodules "file://$(pwd)/upstream" downstream &&
 	test_ref_format downstream "$GIT_DEFAULT_REF_FORMAT" &&
-	git -C downstream submodule update --init --ref-format=$OTHER_FORMAT &&
+	git -C downstream submodule update --init --ref-storage-format=$OTHER_FORMAT &&
 	test_ref_format downstream/submodule "$OTHER_FORMAT"
 '
 
@@ -122,7 +122,7 @@ test_expect_success 'recursive pull with mixed formats' '
 	# Clone the upstream repository such that the main repo and its
 	# submodules have different formats.
 	git clone --no-recurse-submodules "file://$(pwd)/upstream" downstream &&
-	git -C downstream submodule update --init --ref-format=$OTHER_FORMAT &&
+	git -C downstream submodule update --init --ref-storage-format=$OTHER_FORMAT &&
 	test_ref_format downstream "$GIT_DEFAULT_REF_FORMAT" &&
 	test_ref_format downstream/submodule "$OTHER_FORMAT" &&
 

-- 
2.55.0.1007.g17ff1f9808.dirty


^ permalink raw reply related	[flat|nested] 61+ messages in thread

* [PATCH v2 05/11] builtin/rev-parse: rename "--show-ref-format" to "--show-ref-storage-format"
  2026-09-07 11:18 ` [PATCH v2 " Patrick Steinhardt
                     ` (3 preceding siblings ...)
  2026-09-07 11:18   ` [PATCH v2 04/11] builtin/submodule: " Patrick Steinhardt
@ 2026-09-07 11:18   ` Patrick Steinhardt
  2026-09-07 11:18   ` [PATCH v2 06/11] help: rename "default-ref-format" to "default-ref-storage-format" Patrick Steinhardt
                     ` (5 subsequent siblings)
  10 siblings, 0 replies; 61+ messages in thread
From: Patrick Steinhardt @ 2026-09-07 11:18 UTC (permalink / raw)
  To: git; +Cc: Karthik Nayak, Junio C Hamano

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>
---
 Documentation/git-rev-parse.adoc       |  2 +-
 builtin/rev-parse.c                    |  2 +-
 contrib/completion/git-prompt.sh       |  2 +-
 t/perf/perf-lib.sh                     |  4 ++--
 t/t0001-init.sh                        | 36 +++++++++++++++++-----------------
 t/t0610-reftable-basics.sh             | 16 +++++++--------
 t/t1460-refs-migrate.sh                |  4 ++--
 t/t1500-rev-parse.sh                   |  8 ++++----
 t/t5601-clone.sh                       |  2 +-
 t/t7424-submodule-mixed-ref-formats.sh |  2 +-
 10 files changed, 39 insertions(+), 39 deletions(-)

diff --git a/Documentation/git-rev-parse.adoc b/Documentation/git-rev-parse.adoc
index 5398691f3f..f794ceef22 100644
--- a/Documentation/git-rev-parse.adoc
+++ b/Documentation/git-rev-parse.adoc
@@ -331,7 +331,7 @@ 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.
 
 
diff --git a/builtin/rev-parse.c b/builtin/rev-parse.c
index 43693454d5..ec33c19bdf 100644
--- a/builtin/rev-parse.c
+++ b/builtin/rev-parse.c
@@ -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;
 			}
diff --git a/contrib/completion/git-prompt.sh b/contrib/completion/git-prompt.sh
index 6186c474ba..754a5edc9a 100644
--- a/contrib/completion/git-prompt.sh
+++ b/contrib/completion/git-prompt.sh
@@ -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="$?"
 
diff --git a/t/perf/perf-lib.sh b/t/perf/perf-lib.sh
index 3ce49fd423..846ecc35c3 100644
--- a/t/perf/perf-lib.sh
+++ b/t/perf/perf-lib.sh
@@ -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
diff --git a/t/t0001-init.sh b/t/t0001-init.sh
index df9a2ff2da..b4f19d8077 100755
--- a/t/t0001-init.sh
+++ b/t/t0001-init.sh
@@ -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
 '
 
diff --git a/t/t0610-reftable-basics.sh b/t/t0610-reftable-basics.sh
index d325f17a14..b6db54430a 100755
--- a/t/t0610-reftable-basics.sh
+++ b/t/t0610-reftable-basics.sh
@@ -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
 '
diff --git a/t/t1460-refs-migrate.sh b/t/t1460-refs-migrate.sh
index 204dd79b41..ecf6411288 100755
--- a/t/t1460-refs-migrate.sh
+++ b/t/t1460-refs-migrate.sh
@@ -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
 		'
 
diff --git a/t/t1500-rev-parse.sh b/t/t1500-rev-parse.sh
index 4174ca40c3..30bf8a4d0a 100755
--- a/t/t1500-rev-parse.sh
+++ b/t/t1500-rev-parse.sh
@@ -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
 	)
 '
diff --git a/t/t5601-clone.sh b/t/t5601-clone.sh
index 202d86bc83..06f6121f82 100755
--- a/t/t5601-clone.sh
+++ b/t/t5601-clone.sh
@@ -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
 '
 
diff --git a/t/t7424-submodule-mixed-ref-formats.sh b/t/t7424-submodule-mixed-ref-formats.sh
index 2ef85289b3..9707744644 100755
--- a/t/t7424-submodule-mixed-ref-formats.sh
+++ b/t/t7424-submodule-mixed-ref-formats.sh
@@ -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
 }
 

-- 
2.55.0.1007.g17ff1f9808.dirty


^ permalink raw reply related	[flat|nested] 61+ messages in thread

* [PATCH v2 06/11] help: rename "default-ref-format" to "default-ref-storage-format"
  2026-09-07 11:18 ` [PATCH v2 " Patrick Steinhardt
                     ` (4 preceding siblings ...)
  2026-09-07 11:18   ` [PATCH v2 05/11] builtin/rev-parse: rename "--show-ref-format" to "--show-ref-storage-format" Patrick Steinhardt
@ 2026-09-07 11:18   ` Patrick Steinhardt
  2026-09-07 11:18   ` [PATCH v2 07/11] refs: expose function to parse reference URIs Patrick Steinhardt
                     ` (4 subsequent siblings)
  10 siblings, 0 replies; 61+ messages in thread
From: Patrick Steinhardt @ 2026-09-07 11:18 UTC (permalink / raw)
  To: git; +Cc: Karthik Nayak, Junio C Hamano

When printing information about how specifically Git was built and what
defaults it has we also print the default ref storage format used when
initializing new repositories. This is to prepare for Git 3.0, where the
default storage format will change from the "files" backend to the
"reftable" backend.

In preceding commits we have adapted "ref-format" parameters to be
called "ref-storage-format" instead to resolve some conceptual
mismatches. The build information is now the only place where we still
refer to it as "default-ref-format".

Rename the field to "default-ref-storage-format" instead.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
 help.c          | 2 +-
 t/t0001-init.sh | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/help.c b/help.c
index 46241492ce..1dd8391eeb 100644
--- a/help.c
+++ b/help.c
@@ -824,7 +824,7 @@ void get_version_info(struct strbuf *buf, int show_build_options)
 			    SHA1_UNSAFE_BACKEND);
 #endif
 		strbuf_addf(buf, "SHA-256: %s\n", SHA256_BACKEND);
-		strbuf_addf(buf, "default-ref-format: %s\n",
+		strbuf_addf(buf, "default-ref-storage-format: %s\n",
 			    ref_storage_format_to_name(REF_STORAGE_FORMAT_DEFAULT));
 		strbuf_addf(buf, "default-hash: %s\n", hash_algos[GIT_HASH_DEFAULT].name);
 	}
diff --git a/t/t0001-init.sh b/t/t0001-init.sh
index b4f19d8077..6f4431bed7 100755
--- a/t/t0001-init.sh
+++ b/t/t0001-init.sh
@@ -668,7 +668,7 @@ test_expect_success 'default ref format' '
 		sane_unset GIT_DEFAULT_REF_FORMAT &&
 		git init refformat
 	) &&
-	git version --build-options | sed -ne "s/^default-ref-format: //p" >expect &&
+	git version --build-options | sed -ne "s/^default-ref-storage-format: //p" >expect &&
 	git -C refformat rev-parse --show-ref-storage-format >actual &&
 	test_cmp expect actual
 '

-- 
2.55.0.1007.g17ff1f9808.dirty


^ permalink raw reply related	[flat|nested] 61+ messages in thread

* [PATCH v2 07/11] refs: expose function to parse reference URIs
  2026-09-07 11:18 ` [PATCH v2 " Patrick Steinhardt
                     ` (5 preceding siblings ...)
  2026-09-07 11:18   ` [PATCH v2 06/11] help: rename "default-ref-format" to "default-ref-storage-format" Patrick Steinhardt
@ 2026-09-07 11:18   ` Patrick Steinhardt
  2026-09-08 13:47     ` Kaartic Sivaraam
  2026-09-07 11:18   ` [PATCH v2 08/11] setup: refactor how we configure the ref storage format Patrick Steinhardt
                     ` (3 subsequent siblings)
  10 siblings, 1 reply; 61+ messages in thread
From: Patrick Steinhardt @ 2026-09-07 11:18 UTC (permalink / raw)
  To: git; +Cc: Karthik Nayak, Junio C Hamano

In the next commit we're about to add more sites that want to parse a
reference backends URI into a format and payload. Expose a new function
`ref_storage_format_by_uri()` that enables this.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
 refs.c  | 23 +++++++++++++++++++++++
 refs.h  |  4 ++++
 setup.c | 48 ++++++++++++------------------------------------
 3 files changed, 39 insertions(+), 36 deletions(-)

diff --git a/refs.c b/refs.c
index 92d5df5b71..951db56113 100644
--- a/refs.c
+++ b/refs.c
@@ -54,6 +54,29 @@ enum ref_storage_format ref_storage_format_by_name(const char *name)
 	return REF_STORAGE_FORMAT_UNKNOWN;
 }
 
+enum ref_storage_format ref_storage_format_by_uri(const char *uri,
+						  char **payload)
+{
+	enum ref_storage_format format;
+	const char *schema_end;
+	char *name;
+
+	schema_end = strstr(uri, "://");
+	if (!schema_end) {
+		name = xstrdup(uri);
+		if (payload)
+			*payload = NULL;
+	} else {
+		name = xstrndup(uri, schema_end - uri);
+		if (payload)
+			*payload = xstrdup(schema_end + 3);
+	}
+
+	format = ref_storage_format_by_name(name);
+	free(name);
+	return format;
+}
+
 const char *ref_storage_format_to_name(enum ref_storage_format ref_storage_format)
 {
 	const struct ref_storage_be *be = find_ref_storage_backend(ref_storage_format);
diff --git a/refs.h b/refs.h
index 9979446d15..ee3b8a62ef 100644
--- a/refs.h
+++ b/refs.h
@@ -17,6 +17,10 @@ struct worktree;
 enum ref_storage_format ref_storage_format_by_name(const char *name);
 const char *ref_storage_format_to_name(enum ref_storage_format ref_storage_format);
 
+/* Parse a reference storage URI in the format "<format>[://<payload>]". */
+enum ref_storage_format ref_storage_format_by_uri(const char *uri,
+						  char **payload);
+
 enum ref_transaction_error {
 	/* Default error code */
 	REF_TRANSACTION_ERROR_GENERIC = -1,
diff --git a/setup.c b/setup.c
index dfe05d9a03..3be7dac452 100644
--- a/setup.c
+++ b/setup.c
@@ -632,21 +632,6 @@ static enum extension_result handle_extension_v0(const char *var,
 		return EXTENSION_UNKNOWN;
 }
 
-static void parse_reference_uri(const char *value, char **format,
-				char **payload)
-{
-	const char *schema_end;
-
-	schema_end = strstr(value, "://");
-	if (!schema_end) {
-		*format = xstrdup(value);
-		*payload = NULL;
-	} else {
-		*format = xstrndup(value, schema_end - value);
-		*payload = xstrdup_or_null(schema_end + 3);
-	}
-}
-
 /*
  * Record any new extensions in this function.
  */
@@ -689,16 +674,13 @@ static enum extension_result handle_extension(const char *var,
 		return EXTENSION_OK;
 	} else if (!strcmp(ext, "refstorage")) {
 		unsigned int format;
-		char *format_str;
 
 		if (!value)
 			return config_error_nonbool(var);
 
-		parse_reference_uri(value, &format_str,
-				    &data->ref_storage_payload);
-
-		format = ref_storage_format_by_name(format_str);
-		free(format_str);
+		FREE_AND_NULL(data->ref_storage_payload);
+		format = ref_storage_format_by_uri(value,
+						   &data->ref_storage_payload);
 
 		if (format == REF_STORAGE_FORMAT_UNKNOWN)
 			return error(_("invalid value for '%s': '%s'"),
@@ -2069,16 +2051,12 @@ const char *setup_git_directory_gently(struct repository *repo, int *nongit_ok)
 			 */
 			ref_backend_uri = getenv(GIT_REFERENCE_BACKEND_ENVIRONMENT);
 			if (ref_backend_uri) {
-				char *format;
-
-				free(discovery.format.ref_storage_payload);
-
-				parse_reference_uri(ref_backend_uri, &format, &discovery.format.ref_storage_payload);
-				discovery.format.ref_storage_format = ref_storage_format_by_name(format);
+				FREE_AND_NULL(discovery.format.ref_storage_payload);
+				discovery.format.ref_storage_format =
+					ref_storage_format_by_uri(ref_backend_uri,
+								  &discovery.format.ref_storage_payload);
 				if (discovery.format.ref_storage_format == REF_STORAGE_FORMAT_UNKNOWN)
-					die(_("unknown ref storage format: '%s'"), format);
-
-				free(format);
+					die(_("unknown ref storage format: '%s'"), ref_backend_uri);
 			}
 
 			if (apply_repository_format(repo, &discovery.format,
@@ -2806,18 +2784,16 @@ static void repository_format_configure(struct repository_format *repo_fmt,
 
 	ref_backend_uri = getenv(GIT_REFERENCE_BACKEND_ENVIRONMENT);
 	if (ref_backend_uri) {
-		char *backend, *payload;
 		enum ref_storage_format format;
+		char *payload;
 
-		parse_reference_uri(ref_backend_uri, &backend, &payload);
-		format = ref_storage_format_by_name(backend);
+		format = ref_storage_format_by_uri(ref_backend_uri, &payload);
 		if (format == REF_STORAGE_FORMAT_UNKNOWN)
-			die(_("unknown ref storage format: '%s'"), backend);
+			die(_("unknown ref storage format: '%s'"), ref_backend_uri);
 
 		repo_fmt->ref_storage_format = format;
+		free(repo_fmt->ref_storage_payload);
 		repo_fmt->ref_storage_payload = payload;
-
-		free(backend);
 	}
 }
 

-- 
2.55.0.1007.g17ff1f9808.dirty


^ permalink raw reply related	[flat|nested] 61+ messages in thread

* [PATCH v2 08/11] setup: refactor how we configure the ref storage format
  2026-09-07 11:18 ` [PATCH v2 " Patrick Steinhardt
                     ` (6 preceding siblings ...)
  2026-09-07 11:18   ` [PATCH v2 07/11] refs: expose function to parse reference URIs Patrick Steinhardt
@ 2026-09-07 11:18   ` Patrick Steinhardt
  2026-09-09  8:00     ` Kaartic Sivaraam
  2026-09-07 11:18   ` [PATCH v2 09/11] setup: rename ref storage format environment variables Patrick Steinhardt
                     ` (2 subsequent siblings)
  10 siblings, 1 reply; 61+ messages in thread
From: Patrick Steinhardt @ 2026-09-07 11:18 UTC (permalink / raw)
  To: git; +Cc: Karthik Nayak, Junio C Hamano

When (re)initializing a repository we need to figure out the ref storage
format that the repository ought to use. This logic is surprisingly
complex, as we have grown a lot of different mechanisms over time to
configure the format. Unfortunately, as a result of this organic growth,
the logic that configures the storage format has grown very complex.

The biggest culprit here is that we're mixing the logic that determines
the desired storage format with the logic that validates whether the end
result is sane. This leads to some repetitive code, and makes it very
easy to forget validation for some of the branches.

In fact, the way we handle GIT_REFERENCE_BACKEND shows exactly one such
edge case where we don't properly validate. When initializing a
repository with one storage format and then reinitializing it with the
environment variable set to a different format then we'd corrupt the
repository because we silently change the format:

    $ git init repo
    $ git -C repo commit --allow-empty -m message
    $ GIT_REFERENCE_BACKEND=reftable git -C repo init
    fatal: could not open '.../refs/heads' for writing: Is a directory
    $ git -C repo log
    fatal: your current branch appears to be broken

Refactor the code so that we clearly distinguish between these two
different concerns. This lets us clearly spell out the precedence order
and makes the whole logic significantly easier to extend going forward.

Note that the new logic intentionally changes the precedence order so
that "GIT_REFERENCE_BACKEND" is now overridden by the
"--ref-storage-format=" command line option. This matches our usual
precedence order, where explicit command line arguments override
environment variables.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
 setup.c         | 103 +++++++++++++++++++++++++++++++++++---------------------
 t/t0001-init.sh |  12 ++++++-
 2 files changed, 75 insertions(+), 40 deletions(-)

diff --git a/setup.c b/setup.c
index 3be7dac452..38fa5e854c 100644
--- a/setup.c
+++ b/setup.c
@@ -2674,7 +2674,7 @@ static void separate_git_dir(struct repository *repo,
 
 struct default_format_config {
 	int hash;
-	enum ref_storage_format ref_format;
+	enum ref_storage_format ref_storage_format;
 };
 
 static int read_default_format_config(const char *key, const char *value,
@@ -2699,8 +2699,8 @@ static int read_default_format_config(const char *key, const char *value,
 		ret = git_config_string(&str, key, value);
 		if (ret)
 			goto out;
-		cfg->ref_format = ref_storage_format_by_name(str);
-		if (cfg->ref_format == REF_STORAGE_FORMAT_UNKNOWN)
+		cfg->ref_storage_format = ref_storage_format_by_name(str);
+		if (cfg->ref_storage_format == REF_STORAGE_FORMAT_UNKNOWN)
 			warning(_("unknown ref storage format '%s'"), str);
 		goto out;
 	}
@@ -2710,9 +2710,9 @@ static int read_default_format_config(const char *key, const char *value,
 	 * "init.defaultRefFormat" takes precedence over this setting.
 	 */
 	if (!strcmp(key, "feature.experimental") &&
-	    cfg->ref_format == REF_STORAGE_FORMAT_UNKNOWN &&
+	    cfg->ref_storage_format == REF_STORAGE_FORMAT_UNKNOWN &&
 	    git_config_bool(key, value)) {
-		cfg->ref_format = REF_STORAGE_FORMAT_REFTABLE;
+		cfg->ref_storage_format = REF_STORAGE_FORMAT_REFTABLE;
 		ret = 0;
 		goto out;
 	}
@@ -2724,18 +2724,18 @@ static int read_default_format_config(const char *key, const char *value,
 }
 
 static void repository_format_configure(struct repository_format *repo_fmt,
-					int hash, enum ref_storage_format ref_format)
+					int hash, enum ref_storage_format ref_storage_format)
 {
 	struct default_format_config cfg = {
 		.hash = GIT_HASH_UNKNOWN,
-		.ref_format = REF_STORAGE_FORMAT_UNKNOWN,
+		.ref_storage_format = REF_STORAGE_FORMAT_UNKNOWN,
 	};
 	struct config_options opts = {
 		.respect_includes = 1,
 		.ignore_repo = 1,
 		.ignore_worktree = 1,
 	};
-	const char *ref_backend_uri;
+	char *ref_storage_payload = NULL;
 	const char *env;
 
 	config_with_options(read_default_format_config, &cfg, NULL, NULL, &opts);
@@ -2761,40 +2761,65 @@ static void repository_format_configure(struct repository_format *repo_fmt,
 		repo_fmt->hash_algo = cfg.hash;
 	}
 
-	env = getenv("GIT_DEFAULT_REF_FORMAT");
-	if (repo_fmt->version >= 0 &&
-	    ref_format != REF_STORAGE_FORMAT_UNKNOWN &&
-	    ref_format != repo_fmt->ref_storage_format) {
-		die(_("attempt to reinitialize repository with different reference storage format"));
-	} else if (ref_format != REF_STORAGE_FORMAT_UNKNOWN) {
-		repo_fmt->ref_storage_format = ref_format;
-	} else if (env) {
-		ref_format = ref_storage_format_by_name(env);
-		if (ref_format == REF_STORAGE_FORMAT_UNKNOWN)
-			die(_("unknown ref storage format '%s'"), env);
-		if (repo_fmt->version < 0 ||
-		    repo_fmt->ref_storage_format == REF_STORAGE_FORMAT_UNKNOWN)
-			repo_fmt->ref_storage_format = ref_format;
-	} else if (cfg.ref_format != REF_STORAGE_FORMAT_UNKNOWN) {
-		repo_fmt->ref_storage_format = cfg.ref_format;
+	/*
+	 * We have the following order of preference when configuring the ref
+	 * storage format:
+	 *
+	 *   1. Explicit override via the command line, like in `git init
+	 *      --ref-storage-format=`.
+	 *
+	 *   2. Explicit override via the environment with
+	 *      GIT_REFERENCE_BACKEND.
+	 *
+	 *   3. Existing repository format. All the subsequent sources only
+	 *      kick in when there is no repository yet.
+	 *
+	 *   4. The default ref storage format for new repositories as
+	 *      configured via "GIT_DEFAULT_REF_FORMAT".
+	 *
+	 *   5. The default ref storage format for new repositories as
+	 *      configured via "init.defaultRefFormat"
+	 *
+	 *   6. Otherwise, we fall back to the default ref storage format
+	 *      compiled into Git.
+	 */
+	if (ref_storage_format != REF_STORAGE_FORMAT_UNKNOWN) {
+		/* nothing to do */
+	} else if ((env = getenv(GIT_REFERENCE_BACKEND_ENVIRONMENT))) {
+		ref_storage_format = ref_storage_format_by_uri(env, &ref_storage_payload);
+		if (ref_storage_format == REF_STORAGE_FORMAT_UNKNOWN)
+			die(_("unknown ref storage format specified via %s: '%s'"),
+			    GIT_REFERENCE_BACKEND_ENVIRONMENT, env);
+	} else if (repo_fmt->version >= 0) {
+		ref_storage_format = repo_fmt->ref_storage_format;
+		ref_storage_payload = xstrdup_or_null(repo_fmt->ref_storage_payload);
+	} else if ((env = getenv("GIT_DEFAULT_REF_FORMAT"))) {
+		ref_storage_format = ref_storage_format_by_name(env);
+		if (ref_storage_format == REF_STORAGE_FORMAT_UNKNOWN)
+			die(_("unknown ref storage format specified via %s: '%s'"),
+			    "GIT_DEFAULT_REF_FORMAT", env);
+	} else if (cfg.ref_storage_format != REF_STORAGE_FORMAT_UNKNOWN) {
+		ref_storage_format = cfg.ref_storage_format;
 	} else {
-		repo_fmt->ref_storage_format = REF_STORAGE_FORMAT_DEFAULT;
+		ref_storage_format = REF_STORAGE_FORMAT_DEFAULT;
 	}
 
-
-	ref_backend_uri = getenv(GIT_REFERENCE_BACKEND_ENVIRONMENT);
-	if (ref_backend_uri) {
-		enum ref_storage_format format;
-		char *payload;
-
-		format = ref_storage_format_by_uri(ref_backend_uri, &payload);
-		if (format == REF_STORAGE_FORMAT_UNKNOWN)
-			die(_("unknown ref storage format: '%s'"), ref_backend_uri);
-
-		repo_fmt->ref_storage_format = format;
-		free(repo_fmt->ref_storage_payload);
-		repo_fmt->ref_storage_payload = payload;
-	}
+	/*
+	 * If we have a preexisting repository we need to verify that its
+	 * current ref storage format does not change.
+	 */
+	if (repo_fmt->version >= 0) {
+		if (ref_storage_format != repo_fmt->ref_storage_format)
+			die(_("attempt to reinitialize repository with different reference storage format"));
+		if ((ref_storage_payload || repo_fmt->ref_storage_payload) &&
+		    strcmp(ref_storage_payload ? ref_storage_payload : "",
+			   repo_fmt->ref_storage_payload ? repo_fmt->ref_storage_payload : ""))
+			die(_("attempt to reinitialize repository with different reference storage payload"));
+	}
+
+	free(repo_fmt->ref_storage_payload);
+	repo_fmt->ref_storage_format = ref_storage_format;
+	repo_fmt->ref_storage_payload = ref_storage_payload;
 }
 
 int init_db(struct repository *repo,
diff --git a/t/t0001-init.sh b/t/t0001-init.sh
index 6f4431bed7..ca44dfc1ce 100755
--- a/t/t0001-init.sh
+++ b/t/t0001-init.sh
@@ -643,12 +643,22 @@ test_expect_success DEFAULT_REPO_FORMAT 'extensions.refStorage with unknown back
 test_expect_success 'init with GIT_DEFAULT_REF_FORMAT=garbage' '
 	test_when_finished "rm -rf refformat" &&
 	cat >expect <<-EOF &&
-	fatal: unknown ref storage format ${SQ}garbage${SQ}
+	fatal: unknown ref storage format specified via GIT_DEFAULT_REF_FORMAT: ${SQ}garbage${SQ}
 	EOF
 	test_must_fail env GIT_DEFAULT_REF_FORMAT=garbage git init refformat 2>err &&
 	test_cmp expect err
 '
 
+test_expect_success 'GIT_REFERENCE_BACKEND refuses to reinitialize with different storage format' '
+	test_when_finished "rm -rf refbackend" &&
+	git init --ref-storage-format=files refbackend &&
+	cat >expect <<-EOF &&
+	fatal: attempt to reinitialize repository with different reference storage format
+	EOF
+	test_must_fail env GIT_REFERENCE_BACKEND=reftable git init refbackend 2>err &&
+	test_cmp expect err
+'
+
 test_expect_success 'init warns about invalid init.defaultRefFormat' '
 	test_when_finished "rm -rf repo" &&
 	test_config_global init.defaultRefFormat garbage &&

-- 
2.55.0.1007.g17ff1f9808.dirty


^ permalink raw reply related	[flat|nested] 61+ messages in thread

* [PATCH v2 09/11] setup: rename ref storage format environment variables
  2026-09-07 11:18 ` [PATCH v2 " Patrick Steinhardt
                     ` (7 preceding siblings ...)
  2026-09-07 11:18   ` [PATCH v2 08/11] setup: refactor how we configure the ref storage format Patrick Steinhardt
@ 2026-09-07 11:18   ` Patrick Steinhardt
  2026-09-09  8:10     ` Kaartic Sivaraam
  2026-09-07 11:18   ` [PATCH v2 10/11] setup: rename "init.defaultRefFormat" to "init.defaultRefStorageFormat" Patrick Steinhardt
  2026-09-07 11:18   ` [PATCH v2 11/11] setup: allow "git init --ref-storage-format=" to specify a payload Patrick Steinhardt
  10 siblings, 1 reply; 61+ messages in thread
From: Patrick Steinhardt @ 2026-09-07 11:18 UTC (permalink / raw)
  To: git; +Cc: Karthik Nayak, Junio C Hamano

With the same reasoning as for git-init(1), rename the environment
variables GIT_REFERENCE_BACKEND and GIT_DEFAULT_REF_FORMAT to
GIT_REF_STORAGE_FORMAT and GIT_DEFAULT_REF_STORAGE_FORMAT, respectively.
The old names are kept as an alias to retain compatibility.

While at it, fix indentation for `GIT_REF_STORAGE_FORMAT` docs to use
tabs instead of spaces.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
 Documentation/config/init.adoc         |  2 +-
 Documentation/git.adoc                 | 12 ++++----
 environment.h                          |  1 +
 setup.c                                | 21 ++++++++------
 t/t0001-init.sh                        | 50 +++++++++++++++++-----------------
 t/t1419-exclude-refs.sh                | 16 +++++------
 t/t1423-ref-backend.sh                 | 18 ++++++------
 t/t7424-submodule-mixed-ref-formats.sh | 14 +++++-----
 t/test-lib.sh                          |  8 +++---
 9 files changed, 74 insertions(+), 68 deletions(-)

diff --git a/Documentation/config/init.adoc b/Documentation/config/init.adoc
index a048f0bddc..f82fcf25e6 100644
--- a/Documentation/config/init.adoc
+++ b/Documentation/config/init.adoc
@@ -16,7 +16,7 @@ endif::[]
 `init.defaultRefFormat`::
 	Allows overriding the default ref storage format for new repositories.
 	See `--ref-storage-format=` in linkgit:git-init[1]. Both the command line
-	option and the `GIT_DEFAULT_REF_FORMAT` environment variable take
+	option and the `GIT_DEFAULT_REF_STORAGE_FORMAT` environment variable take
 	precedence over this config.
 
 init.defaultSubmodulePathConfig::
diff --git a/Documentation/git.adoc b/Documentation/git.adoc
index 23ba65656e..d78e2b5c10 100644
--- a/Documentation/git.adoc
+++ b/Documentation/git.adoc
@@ -590,15 +590,15 @@ double-quotes and respecting backslash escapes. E.g., the value
 	is always used. The default is "sha1".
 	See `--object-format` in linkgit:git-init[1].
 
-`GIT_DEFAULT_REF_FORMAT`::
-	If this variable is set, the default reference backend format for new
+`GIT_DEFAULT_REF_STORAGE_FORMAT`::
+	If this variable is set, the default ref storage format for new
 	repositories will be set to this value. The default is "files".
 	See `--ref-storage-format` in linkgit:git-init[1].
 
-`GIT_REFERENCE_BACKEND`::
-    Specify which reference backend to be used along with its URI.
-    See `extensions.refStorage` option in linkgit:git-config[1] for more
-    details. Overrides the config variable when used.
+`GIT_REF_STORAGE_FORMAT`::
+	Specify which ref storage format to use along with its URI.
+	See `extensions.refStorage` option in linkgit:git-config[1] for more
+	details. Overrides the config variable when used.
 
 Git Commits
 ~~~~~~~~~~~
diff --git a/environment.h b/environment.h
index e7ec5b0437..4bd8f08dee 100644
--- a/environment.h
+++ b/environment.h
@@ -44,6 +44,7 @@
 #define GIT_TEXT_DOMAIN_DIR_ENVIRONMENT "GIT_TEXTDOMAINDIR"
 #define GIT_ATTR_SOURCE_ENVIRONMENT "GIT_ATTR_SOURCE"
 #define GIT_REFERENCE_BACKEND_ENVIRONMENT "GIT_REFERENCE_BACKEND"
+#define GIT_REF_STORAGE_FORMAT_ENVIRONMENT "GIT_REF_STORAGE_FORMAT"
 
 /*
  * Environment variable used to propagate the --no-advice global option to the
diff --git a/setup.c b/setup.c
index 38fa5e854c..e2bb04410f 100644
--- a/setup.c
+++ b/setup.c
@@ -2049,7 +2049,9 @@ const char *setup_git_directory_gently(struct repository *repo, int *nongit_ok)
 			 * The env variable should override the repository config
 			 * for 'extensions.refStorage'.
 			 */
-			ref_backend_uri = getenv(GIT_REFERENCE_BACKEND_ENVIRONMENT);
+			ref_backend_uri = getenv(GIT_REF_STORAGE_FORMAT_ENVIRONMENT);
+			if (!ref_backend_uri)
+				ref_backend_uri = getenv(GIT_REFERENCE_BACKEND_ENVIRONMENT);
 			if (ref_backend_uri) {
 				FREE_AND_NULL(discovery.format.ref_storage_payload);
 				discovery.format.ref_storage_format =
@@ -2768,14 +2770,15 @@ static void repository_format_configure(struct repository_format *repo_fmt,
 	 *   1. Explicit override via the command line, like in `git init
 	 *      --ref-storage-format=`.
 	 *
-	 *   2. Explicit override via the environment with
-	 *      GIT_REFERENCE_BACKEND.
+	 *   2. Explicit override via the environment with "GIT_REF_STORAGE_FORMAT"
+	 *      or its deprecated equivalent "GIT_REFERENCE_BACKEND".
 	 *
 	 *   3. Existing repository format. All the subsequent sources only
 	 *      kick in when there is no repository yet.
 	 *
 	 *   4. The default ref storage format for new repositories as
-	 *      configured via "GIT_DEFAULT_REF_FORMAT".
+	 *      configured via "GIT_DEFAULT_REF_STORAGE_FORMAT" or its
+	 *      deprecated equivalent "GIT_DEFAULT_REF_FORMAT".
 	 *
 	 *   5. The default ref storage format for new repositories as
 	 *      configured via "init.defaultRefFormat"
@@ -2785,19 +2788,21 @@ static void repository_format_configure(struct repository_format *repo_fmt,
 	 */
 	if (ref_storage_format != REF_STORAGE_FORMAT_UNKNOWN) {
 		/* nothing to do */
-	} else if ((env = getenv(GIT_REFERENCE_BACKEND_ENVIRONMENT))) {
+	} else if (((env = getenv(GIT_REF_STORAGE_FORMAT_ENVIRONMENT)) ||
+		    (env = getenv(GIT_REFERENCE_BACKEND_ENVIRONMENT)))) {
 		ref_storage_format = ref_storage_format_by_uri(env, &ref_storage_payload);
 		if (ref_storage_format == REF_STORAGE_FORMAT_UNKNOWN)
 			die(_("unknown ref storage format specified via %s: '%s'"),
-			    GIT_REFERENCE_BACKEND_ENVIRONMENT, env);
+			    GIT_REF_STORAGE_FORMAT_ENVIRONMENT, env);
 	} else if (repo_fmt->version >= 0) {
 		ref_storage_format = repo_fmt->ref_storage_format;
 		ref_storage_payload = xstrdup_or_null(repo_fmt->ref_storage_payload);
-	} else if ((env = getenv("GIT_DEFAULT_REF_FORMAT"))) {
+	} else if (((env = getenv("GIT_DEFAULT_REF_STORAGE_FORMAT")) ||
+		    (env = getenv("GIT_DEFAULT_REF_FORMAT")))) {
 		ref_storage_format = ref_storage_format_by_name(env);
 		if (ref_storage_format == REF_STORAGE_FORMAT_UNKNOWN)
 			die(_("unknown ref storage format specified via %s: '%s'"),
-			    "GIT_DEFAULT_REF_FORMAT", env);
+			    "GIT_DEFAULT_REF_STORAGE_FORMAT", env);
 	} else if (cfg.ref_storage_format != REF_STORAGE_FORMAT_UNKNOWN) {
 		ref_storage_format = cfg.ref_storage_format;
 	} else {
diff --git a/t/t0001-init.sh b/t/t0001-init.sh
index ca44dfc1ce..af9a7ba958 100755
--- a/t/t0001-init.sh
+++ b/t/t0001-init.sh
@@ -640,22 +640,22 @@ test_expect_success DEFAULT_REPO_FORMAT 'extensions.refStorage with unknown back
 	test_grep "invalid value for ${SQ}extensions.refstorage${SQ}: ${SQ}garbage${SQ}" err
 '
 
-test_expect_success 'init with GIT_DEFAULT_REF_FORMAT=garbage' '
+test_expect_success 'init with GIT_DEFAULT_REF_STORAGE_FORMAT=garbage' '
 	test_when_finished "rm -rf refformat" &&
 	cat >expect <<-EOF &&
-	fatal: unknown ref storage format specified via GIT_DEFAULT_REF_FORMAT: ${SQ}garbage${SQ}
+	fatal: unknown ref storage format specified via GIT_DEFAULT_REF_STORAGE_FORMAT: ${SQ}garbage${SQ}
 	EOF
-	test_must_fail env GIT_DEFAULT_REF_FORMAT=garbage git init refformat 2>err &&
+	test_must_fail env GIT_DEFAULT_REF_STORAGE_FORMAT=garbage git init refformat 2>err &&
 	test_cmp expect err
 '
 
-test_expect_success 'GIT_REFERENCE_BACKEND refuses to reinitialize with different storage format' '
+test_expect_success 'GIT_REF_STORAGE_FORMAT refuses to reinitialize with different storage format' '
 	test_when_finished "rm -rf refbackend" &&
 	git init --ref-storage-format=files refbackend &&
 	cat >expect <<-EOF &&
 	fatal: attempt to reinitialize repository with different reference storage format
 	EOF
-	test_must_fail env GIT_REFERENCE_BACKEND=reftable git init refbackend 2>err &&
+	test_must_fail env GIT_REF_STORAGE_FORMAT=reftable git init refbackend 2>err &&
 	test_cmp expect err
 '
 
@@ -668,14 +668,14 @@ test_expect_success 'init warns about invalid init.defaultRefFormat' '
 	test_cmp expect err &&
 
 	git -C repo rev-parse --show-ref-storage-format >actual &&
-	echo $GIT_DEFAULT_REF_FORMAT >expected &&
+	echo $GIT_DEFAULT_REF_STORAGE_FORMAT >expected &&
 	test_cmp expected actual
 '
 
 test_expect_success 'default ref format' '
 	test_when_finished "rm -rf refformat" &&
 	(
-		sane_unset GIT_DEFAULT_REF_FORMAT &&
+		sane_unset GIT_DEFAULT_REF_STORAGE_FORMAT &&
 		git init refformat
 	) &&
 	git version --build-options | sed -ne "s/^default-ref-storage-format: //p" >expect &&
@@ -686,9 +686,9 @@ test_expect_success 'default ref format' '
 backends="files reftable"
 for format in $backends
 do
-	test_expect_success DEFAULT_REPO_FORMAT "init with GIT_DEFAULT_REF_FORMAT=$format" '
+	test_expect_success DEFAULT_REPO_FORMAT "init with GIT_DEFAULT_REF_STORAGE_FORMAT=$format" '
 		test_when_finished "rm -rf refformat" &&
-		GIT_DEFAULT_REF_FORMAT=$format git init refformat &&
+		GIT_DEFAULT_REF_STORAGE_FORMAT=$format git init refformat &&
 
 		if test $format = files
 		then
@@ -718,7 +718,7 @@ do
 		test_when_finished "rm -rf refformat" &&
 		test_config_global init.defaultRefFormat $format &&
 		(
-			sane_unset GIT_DEFAULT_REF_FORMAT &&
+			sane_unset GIT_DEFAULT_REF_STORAGE_FORMAT &&
 			git init refformat
 		) &&
 
@@ -727,37 +727,37 @@ do
 		test_cmp expect actual
 	'
 
-	test_expect_success "--ref-storage-format=$format overrides GIT_DEFAULT_REF_FORMAT" '
+	test_expect_success "--ref-storage-format=$format overrides GIT_DEFAULT_REF_STORAGE_FORMAT" '
 		test_when_finished "rm -rf refformat" &&
-		GIT_DEFAULT_REF_FORMAT=garbage git init --ref-storage-format=$format refformat &&
+		GIT_DEFAULT_REF_STORAGE_FORMAT=garbage git init --ref-storage-format=$format refformat &&
 		echo $format >expect &&
 		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_expect_success "reinit repository with GIT_DEFAULT_REF_STORAGE_FORMAT=$format does not change format" '
 		test_when_finished "rm -rf refformat" &&
 		git init refformat &&
 		git -C refformat rev-parse --show-ref-storage-format >expect &&
-		GIT_DEFAULT_REF_FORMAT=$format git init refformat &&
+		GIT_DEFAULT_REF_STORAGE_FORMAT=$format git init refformat &&
 		git -C refformat rev-parse --show-ref-storage-format >actual &&
 		test_cmp expect actual
 	'
 done
 
-test_expect_success "--ref-storage-format= overrides GIT_DEFAULT_REF_FORMAT" '
+test_expect_success "--ref-storage-format= overrides GIT_DEFAULT_REF_STORAGE_FOMAT" '
 	test_when_finished "rm -rf refformat" &&
-	GIT_DEFAULT_REF_FORMAT=files git init --ref-storage-format=reftable refformat &&
+	GIT_DEFAULT_REF_STORAGE_FORMAT=files git init --ref-storage-format=reftable refformat &&
 	echo reftable >expect &&
 	git -C refformat rev-parse --show-ref-storage-format >actual &&
 	test_cmp expect actual
 '
 
-test_expect_success "GIT_DEFAULT_REF_FORMAT= overrides init.defaultRefFormat" '
+test_expect_success "GIT_DEFAULT_REF_STORAGE_FORMAT= overrides init.defaultRefFormat" '
 	test_when_finished "rm -rf refformat" &&
 	test_config_global init.defaultRefFormat files &&
 
-	GIT_DEFAULT_REF_FORMAT=reftable git init refformat &&
+	GIT_DEFAULT_REF_STORAGE_FORMAT=reftable git init refformat &&
 	echo reftable >expect &&
 	git -C refformat rev-parse --show-ref-storage-format >actual &&
 	test_cmp expect actual
@@ -767,7 +767,7 @@ test_expect_success "init with feature.experimental=true" '
 	test_when_finished "rm -rf refformat" &&
 	test_config_global feature.experimental true &&
 	(
-		sane_unset GIT_DEFAULT_REF_FORMAT &&
+		sane_unset GIT_DEFAULT_REF_STORAGE_FORMAT &&
 		git init refformat
 	) &&
 	echo reftable >expect &&
@@ -780,7 +780,7 @@ test_expect_success "init.defaultRefFormat overrides feature.experimental=true"
 	test_config_global feature.experimental true &&
 	test_config_global init.defaultRefFormat files &&
 	(
-		sane_unset GIT_DEFAULT_REF_FORMAT &&
+		sane_unset GIT_DEFAULT_REF_STORAGE_FORMAT &&
 		git init refformat
 	) &&
 	echo files >expect &&
@@ -788,10 +788,10 @@ test_expect_success "init.defaultRefFormat overrides feature.experimental=true"
 	test_cmp expect actual
 '
 
-test_expect_success "GIT_DEFAULT_REF_FORMAT= overrides feature.experimental=true" '
+test_expect_success "GIT_DEFAULT_REF_STORAGE_FORMAT= overrides feature.experimental=true" '
 	test_when_finished "rm -rf refformat" &&
 	test_config_global feature.experimental true &&
-	GIT_DEFAULT_REF_FORMAT=files git init refformat &&
+	GIT_DEFAULT_REF_STORAGE_FORMAT=files git init refformat &&
 	echo files >expect &&
 	git -C refformat rev-parse --show-ref-storage-format >actual &&
 	test_cmp expect actual
@@ -942,7 +942,7 @@ test_expect_success 'branch -m with the initial branch' '
 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 &&
+	echo $GIT_DEFAULT_REF_STORAGE_FORMAT >expect &&
 	git -C repo rev-parse --show-ref-storage-format >actual &&
 	test_cmp expect actual
 '
@@ -951,7 +951,7 @@ test_expect_success 'init with includeIf.onbranch condition with existing direct
 	test_when_finished "rm -rf repo" &&
 	mkdir repo &&
 	git -c includeIf.onbranch:nonexistent.path=/does/not/exist init repo &&
-	echo $GIT_DEFAULT_REF_FORMAT >expect &&
+	echo $GIT_DEFAULT_REF_STORAGE_FORMAT >expect &&
 	git -C repo rev-parse --show-ref-storage-format >actual &&
 	test_cmp expect actual
 '
@@ -960,7 +960,7 @@ test_expect_success 're-init with includeIf.onbranch condition' '
 	test_when_finished "rm -rf repo" &&
 	git init repo &&
 	git -c includeIf.onbranch:nonexistent.path=/does/not/exist init repo &&
-	echo $GIT_DEFAULT_REF_FORMAT >expect &&
+	echo $GIT_DEFAULT_REF_STORAGE_FORMAT >expect &&
 	git -C repo rev-parse --show-ref-storage-format >actual &&
 	test_cmp expect actual
 '
diff --git a/t/t1419-exclude-refs.sh b/t/t1419-exclude-refs.sh
index 04797aee59..50237a5aeb 100755
--- a/t/t1419-exclude-refs.sh
+++ b/t/t1419-exclude-refs.sh
@@ -21,13 +21,13 @@ assert_jumps () {
 	local nr="$1"
 	local trace="$2"
 
-	case "$GIT_DEFAULT_REF_FORMAT" in
+	case "$GIT_DEFAULT_REF_STORAGE_FORMAT" in
 	files)
 		grep -q "name:jumps_made value:$nr$" $trace;;
 	reftable)
 		grep -q "name:reseeks_made value:$nr$" $trace;;
 	*)
-		BUG "unhandled ref format $GIT_DEFAULT_REF_FORMAT";;
+		BUG "unhandled ref storage format $GIT_DEFAULT_REF_STORAGE_FORMAT";;
 	esac
 }
 
@@ -93,13 +93,13 @@ test_expect_success 'adjacent, non-overlapping excluded regions' '
 	for_each_ref refs/heads/foo refs/heads/quux >expect &&
 
 	test_cmp expect actual &&
-	case "$GIT_DEFAULT_REF_FORMAT" in
+	case "$GIT_DEFAULT_REF_STORAGE_FORMAT" in
 	files)
 		assert_jumps 1 perf;;
 	reftable)
 		assert_jumps 2 perf;;
 	*)
-		BUG "unhandled ref format $GIT_DEFAULT_REF_FORMAT";;
+		BUG "unhandled ref storage format $GIT_DEFAULT_REF_STORAGE_FORMAT";;
 	esac
 '
 
@@ -125,13 +125,13 @@ test_expect_success 'several overlapping excluded regions' '
 	for_each_ref refs/heads/quux >expect &&
 
 	test_cmp expect actual &&
-	case "$GIT_DEFAULT_REF_FORMAT" in
+	case "$GIT_DEFAULT_REF_STORAGE_FORMAT" in
 	files)
 		assert_jumps 1 perf;;
 	reftable)
 		assert_jumps 3 perf;;
 	*)
-		BUG "unhandled ref format $GIT_DEFAULT_REF_FORMAT";;
+		BUG "unhandled ref storage format $GIT_DEFAULT_REF_STORAGE_FORMAT";;
 	esac
 '
 
@@ -141,13 +141,13 @@ test_expect_success 'unordered excludes' '
 	for_each_ref refs/heads/bar refs/heads/quux >expect &&
 
 	test_cmp expect actual &&
-	case "$GIT_DEFAULT_REF_FORMAT" in
+	case "$GIT_DEFAULT_REF_STORAGE_FORMAT" in
 	files)
 		assert_jumps 1 perf;;
 	reftable)
 		assert_jumps 2 perf;;
 	*)
-		BUG "unhandled ref format $GIT_DEFAULT_REF_FORMAT";;
+		BUG "unhandled ref storage format $GIT_DEFAULT_REF_STORAGE_FORMAT";;
 	esac
 '
 
diff --git a/t/t1423-ref-backend.sh b/t/t1423-ref-backend.sh
index ab119a6568..525b2a19b4 100755
--- a/t/t1423-ref-backend.sh
+++ b/t/t1423-ref-backend.sh
@@ -12,7 +12,7 @@ test_description='Test reference backend URIs'
 #   <uri> is the new URI to be set for the ref storage.
 #   <cmd> is the git subcommand to be run in the repository.
 #   <via> if 'config', set the backend via the 'extensions.refStorage' config.
-#         if 'env', set the backend via the 'GIT_REFERENCE_BACKEND' env.
+#         if 'env', set the backend via the 'GIT_REF_STORAGE_FORMAT' env.
 run_with_uri () {
 	repo=$1 &&
 	backend=$2 &&
@@ -23,7 +23,7 @@ run_with_uri () {
 	git -C "$repo" config set core.repositoryformatversion 1 &&
 	if test "$via" = "env"
 	then
-		test_env GIT_REFERENCE_BACKEND="$uri" git -C "$repo" $cmd
+		test_env GIT_REF_STORAGE_FORMAT="$uri" git -C "$repo" $cmd
 	elif test "$via" = "config"
 	then
 		git -C "$repo" config set extensions.refStorage "$uri" &&
@@ -40,7 +40,7 @@ run_with_uri () {
 #   <backend> is the original ref storage of the repo.
 #   <uri> is the new URI to be set for the ref storage.
 #   <via> if 'config', set the backend via the 'extensions.refStorage' config.
-#         if 'env', set the backend via the 'GIT_REFERENCE_BACKEND' env.
+#         if 'env', set the backend via the 'GIT_REF_STORAGE_FORMAT' env.
 #   <err_msg> (optional) if set, check if 'git-refs(1)' failed with the provided msg.
 test_refs_backend () {
 	repo=$1 &&
@@ -54,7 +54,7 @@ test_refs_backend () {
 	then
 		if test "$via" = "env"
 		then
-			test_env GIT_REFERENCE_BACKEND="$uri" test_must_fail git -C "$repo" refs list 2>err
+			test_env GIT_REF_STORAGE_FORMAT="$uri" test_must_fail git -C "$repo" refs list 2>err
 		elif test "$via" = "config"
 		then
 			git -C "$repo" config set extensions.refStorage "$uri" &&
@@ -83,7 +83,7 @@ verify_files_exist () {
 	test_cmp expect $gitdir/HEAD
 
 	# verify that backend specific files exist.
-	case "$GIT_DEFAULT_REF_FORMAT" in
+	case "$GIT_DEFAULT_REF_STORAGE_FORMAT" in
 	files)
 		test_path_is_dir $refdir/refs/heads &&
 		test_path_is_file $refdir/HEAD;;
@@ -91,7 +91,7 @@ verify_files_exist () {
 		test_path_is_dir $refdir/reftable &&
 		test_path_is_file $refdir/reftable/tables.list;;
 	*)
-		BUG "unhandled ref format $GIT_DEFAULT_REF_FORMAT";;
+		BUG "unhandled ref storage format $GIT_DEFAULT_REF_STORAGE_FORMAT";;
 	esac
 }
 
@@ -210,7 +210,7 @@ do
 	test_expect_success "migrating repository to $to_format with alternate refs directory" '
 		test_when_finished "rm -rf repo refdir" &&
 		mkdir refdir &&
-		GIT_REFERENCE_BACKEND="${from_format}://$(pwd)/refdir" git init repo &&
+		GIT_REF_STORAGE_FORMAT="${from_format}://$(pwd)/refdir" git init repo &&
 		(
 			cd repo &&
 
@@ -235,7 +235,7 @@ test_expect_success 'initializing repository with alt ref directory' '
 	test_when_finished "rm -rf repo refdir" &&
 	mkdir refdir &&
 	BACKEND="$(test_detect_ref_format)://$(pwd)/refdir" &&
-	GIT_REFERENCE_BACKEND=$BACKEND git init repo &&
+	GIT_REF_STORAGE_FORMAT=$BACKEND git init repo &&
 	verify_files_exist repo/.git refdir &&
 	(
 		cd repo &&
@@ -264,7 +264,7 @@ test_expect_success 'cloning repository with alt ref directory' '
 	test_commit -C source 3 &&
 
 	BACKEND="$(test_detect_ref_format)://$(pwd)/refdir" &&
-	GIT_REFERENCE_BACKEND=$BACKEND git clone source repo &&
+	GIT_REF_STORAGE_FORMAT=$BACKEND git clone source repo &&
 
 	git -C repo config get extensions.refstorage >actual &&
 	echo $BACKEND >expect &&
diff --git a/t/t7424-submodule-mixed-ref-formats.sh b/t/t7424-submodule-mixed-ref-formats.sh
index 9707744644..197c02bcf0 100755
--- a/t/t7424-submodule-mixed-ref-formats.sh
+++ b/t/t7424-submodule-mixed-ref-formats.sh
@@ -12,7 +12,7 @@ test_ref_format () {
 
 for OTHER_FORMAT in files reftable
 do
-	if test "$OTHER_FORMAT" = "$GIT_DEFAULT_REF_FORMAT"
+	if test "$OTHER_FORMAT" = "$GIT_DEFAULT_REF_STORAGE_FORMAT"
 	then
 		continue
 	fi
@@ -43,7 +43,7 @@ test_expect_success 'add submodules with different ref storage format' '
 	git init submodule &&
 	test_commit -C submodule submodule-initial &&
 	git init upstream &&
-	test_ref_format upstream "$GIT_DEFAULT_REF_FORMAT" &&
+	test_ref_format upstream "$GIT_DEFAULT_REF_STORAGE_FORMAT" &&
 	git -C upstream submodule add --ref-storage-format="$OTHER_FORMAT" "file://$(pwd)/submodule" &&
 	test_ref_format upstream/submodule "$OTHER_FORMAT"
 '
@@ -59,8 +59,8 @@ test_expect_success 'recursive clone propagates ref storage format' '
 
 	# The upstream repository and its submodule should be using the default
 	# ref format.
-	test_ref_format upstream "$GIT_DEFAULT_REF_FORMAT" &&
-	test_ref_format upstream/submodule "$GIT_DEFAULT_REF_FORMAT" &&
+	test_ref_format upstream "$GIT_DEFAULT_REF_STORAGE_FORMAT" &&
+	test_ref_format upstream/submodule "$GIT_DEFAULT_REF_STORAGE_FORMAT" &&
 
 	# The cloned repositories should use the other ref format that we have
 	# specified via `--ref-storage-format`. The option should propagate to cloned
@@ -81,7 +81,7 @@ test_expect_success 'clone submodules with different ref storage format' '
 	git -C upstream commit -m "upstream submodule" &&
 
 	git clone --no-recurse-submodules "file://$(pwd)/upstream" downstream &&
-	test_ref_format downstream "$GIT_DEFAULT_REF_FORMAT" &&
+	test_ref_format downstream "$GIT_DEFAULT_REF_STORAGE_FORMAT" &&
 	git -C downstream submodule update --init --ref-storage-format=$OTHER_FORMAT &&
 	test_ref_format downstream/submodule "$OTHER_FORMAT"
 '
@@ -98,7 +98,7 @@ test_expect_success 'status with mixed submodule ref storages' '
 
 	# The main repository should use the default ref format now, whereas
 	# the submodule should use the other format.
-	test_ref_format main "$GIT_DEFAULT_REF_FORMAT" &&
+	test_ref_format main "$GIT_DEFAULT_REF_STORAGE_FORMAT" &&
 	test_ref_format main/submodule "$OTHER_FORMAT" &&
 
 	cat >expect <<-EOF &&
@@ -123,7 +123,7 @@ test_expect_success 'recursive pull with mixed formats' '
 	# submodules have different formats.
 	git clone --no-recurse-submodules "file://$(pwd)/upstream" downstream &&
 	git -C downstream submodule update --init --ref-storage-format=$OTHER_FORMAT &&
-	test_ref_format downstream "$GIT_DEFAULT_REF_FORMAT" &&
+	test_ref_format downstream "$GIT_DEFAULT_REF_STORAGE_FORMAT" &&
 	test_ref_format downstream/submodule "$OTHER_FORMAT" &&
 
 	# Update the upstream submodule as well as the owning repository such
diff --git a/t/test-lib.sh b/t/test-lib.sh
index 1f0505e412..60a2179a0a 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -575,8 +575,8 @@ export EDITOR
 GIT_TEST_BUILTIN_HASH=$("$GIT_BINARY" version --build-options | sed -ne 's/^default-hash: //p')
 GIT_DEFAULT_HASH="${GIT_TEST_DEFAULT_HASH:-$GIT_TEST_BUILTIN_HASH}"
 export GIT_DEFAULT_HASH
-GIT_DEFAULT_REF_FORMAT="${GIT_TEST_DEFAULT_REF_FORMAT:-files}"
-export GIT_DEFAULT_REF_FORMAT
+GIT_DEFAULT_REF_STORAGE_FORMAT="${GIT_TEST_DEFAULT_REF_FORMAT:-files}"
+export GIT_DEFAULT_REF_STORAGE_FORMAT
 
 # Tests using GIT_TRACE typically don't want <timestamp> <file>:<line> output
 GIT_TRACE_BARE=1
@@ -1752,13 +1752,13 @@ parisc* | hppa*)
 	;;
 esac
 
-case "$GIT_DEFAULT_REF_FORMAT" in
+case "$GIT_DEFAULT_REF_STORAGE_FORMAT" in
 files)
 	test_set_prereq REFFILES;;
 reftable)
 	test_set_prereq REFTABLE;;
 *)
-	echo 2>&1 "error: unknown ref format $GIT_DEFAULT_REF_FORMAT"
+	echo 2>&1 "error: unknown ref storage format $GIT_DEFAULT_REF_STORAGE_FORMAT"
 	exit 1
 	;;
 esac

-- 
2.55.0.1007.g17ff1f9808.dirty


^ permalink raw reply related	[flat|nested] 61+ messages in thread

* [PATCH v2 10/11] setup: rename "init.defaultRefFormat" to "init.defaultRefStorageFormat"
  2026-09-07 11:18 ` [PATCH v2 " Patrick Steinhardt
                     ` (8 preceding siblings ...)
  2026-09-07 11:18   ` [PATCH v2 09/11] setup: rename ref storage format environment variables Patrick Steinhardt
@ 2026-09-07 11:18   ` Patrick Steinhardt
  2026-09-07 11:18   ` [PATCH v2 11/11] setup: allow "git init --ref-storage-format=" to specify a payload Patrick Steinhardt
  10 siblings, 0 replies; 61+ messages in thread
From: Patrick Steinhardt @ 2026-09-07 11:18 UTC (permalink / raw)
  To: git; +Cc: Karthik Nayak, Junio C Hamano

With the same reasoning as for git-init(1), rename the
"init.defaultRefFormat" config option to "init.defaultRefStorageFormat"
and keep the old name as an alias.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
 Documentation/BreakingChanges.adoc |  2 +-
 Documentation/config/feature.adoc  |  2 +-
 Documentation/config/init.adoc     |  2 +-
 setup.c                            |  8 +++++---
 t/t0001-init.sh                    | 16 ++++++++--------
 5 files changed, 16 insertions(+), 14 deletions(-)

diff --git a/Documentation/BreakingChanges.adoc b/Documentation/BreakingChanges.adoc
index 73bb939359..c2cef3f528 100644
--- a/Documentation/BreakingChanges.adoc
+++ b/Documentation/BreakingChanges.adoc
@@ -156,7 +156,7 @@ Cf. <2f5de416-04ba-c23d-1e0b-83bb655829a7@zombino.com>,
      "packed-refs" file.
 +
 Users that get immediate benefit from the "reftable" backend could continue to
-opt-in to the "reftable" format manually by setting the "init.defaultRefFormat"
+opt-in to the "reftable" format manually by setting the "init.defaultRefStorageFormat"
 config. But defaults matter, and we think that overall users will have a better
 experience with less platform-specific quirks when they use the new backend by
 default.
diff --git a/Documentation/config/feature.adoc b/Documentation/config/feature.adoc
index 924f5ff4e3..e258770591 100644
--- a/Documentation/config/feature.adoc
+++ b/Documentation/config/feature.adoc
@@ -25,7 +25,7 @@ reusing objects from multiple packs instead of just one.
 significantly smaller in the presence of certain filename collisions with Git's
 default name-hash.
 +
-* `init.defaultRefFormat=reftable` causes newly initialized repositories to use
+* `init.defaultRefStorageFormat=reftable` causes newly initialized repositories to use
 the reftable format for storing references. This new format solves issues with
 case-insensitive filesystems, compresses better and performs significantly
 better with many use cases. Refer to Documentation/technical/reftable.adoc for
diff --git a/Documentation/config/init.adoc b/Documentation/config/init.adoc
index f82fcf25e6..10d6aba3ff 100644
--- a/Documentation/config/init.adoc
+++ b/Documentation/config/init.adoc
@@ -13,7 +13,7 @@ endif::[]
 	`--object-format=` in linkgit:git-init[1]. Both the command line option
 	and the `GIT_DEFAULT_HASH` environment variable take precedence over
 	this config.
-`init.defaultRefFormat`::
+`init.defaultRefStorageFormat`::
 	Allows overriding the default ref storage format for new repositories.
 	See `--ref-storage-format=` in linkgit:git-init[1]. Both the command line
 	option and the `GIT_DEFAULT_REF_STORAGE_FORMAT` environment variable take
diff --git a/setup.c b/setup.c
index e2bb04410f..52ad0f417d 100644
--- a/setup.c
+++ b/setup.c
@@ -2697,7 +2697,8 @@ static int read_default_format_config(const char *key, const char *value,
 		goto out;
 	}
 
-	if (!strcmp(key, "init.defaultrefformat")) {
+	if (!strcmp(key, "init.defaultrefstorageformat") ||
+	    !strcmp(key, "init.defaultrefformat")) {
 		ret = git_config_string(&str, key, value);
 		if (ret)
 			goto out;
@@ -2709,7 +2710,7 @@ static int read_default_format_config(const char *key, const char *value,
 
 	/*
 	 * Enable the reftable format when "features.experimental" is enabled.
-	 * "init.defaultRefFormat" takes precedence over this setting.
+	 * "init.defaultRefStorageFormat" takes precedence over this setting.
 	 */
 	if (!strcmp(key, "feature.experimental") &&
 	    cfg->ref_storage_format == REF_STORAGE_FORMAT_UNKNOWN &&
@@ -2781,7 +2782,8 @@ static void repository_format_configure(struct repository_format *repo_fmt,
 	 *      deprecated equivalent "GIT_DEFAULT_REF_FORMAT".
 	 *
 	 *   5. The default ref storage format for new repositories as
-	 *      configured via "init.defaultRefFormat"
+	 *      configured via "init.defaultRefStorageFormat" or its deprecated
+	 *      equivalent "init.defaultRefFormat".
 	 *
 	 *   6. Otherwise, we fall back to the default ref storage format
 	 *      compiled into Git.
diff --git a/t/t0001-init.sh b/t/t0001-init.sh
index af9a7ba958..fe5bc3d3e1 100755
--- a/t/t0001-init.sh
+++ b/t/t0001-init.sh
@@ -659,9 +659,9 @@ test_expect_success 'GIT_REF_STORAGE_FORMAT refuses to reinitialize with differe
 	test_cmp expect err
 '
 
-test_expect_success 'init warns about invalid init.defaultRefFormat' '
+test_expect_success 'init warns about invalid init.defaultRefStorageFormat' '
 	test_when_finished "rm -rf repo" &&
-	test_config_global init.defaultRefFormat garbage &&
+	test_config_global init.defaultRefStorageFormat garbage &&
 
 	echo "warning: unknown ref storage format ${SQ}garbage${SQ}" >expect &&
 	git init repo 2>err &&
@@ -714,9 +714,9 @@ do
 		test_cmp expect actual
 	'
 
-	test_expect_success "init with init.defaultRefFormat=$format" '
+	test_expect_success "init with init.defaultRefStorageFormat=$format" '
 		test_when_finished "rm -rf refformat" &&
-		test_config_global init.defaultRefFormat $format &&
+		test_config_global init.defaultRefStorageFormat $format &&
 		(
 			sane_unset GIT_DEFAULT_REF_STORAGE_FORMAT &&
 			git init refformat
@@ -753,9 +753,9 @@ test_expect_success "--ref-storage-format= overrides GIT_DEFAULT_REF_STORAGE_FOM
 	test_cmp expect actual
 '
 
-test_expect_success "GIT_DEFAULT_REF_STORAGE_FORMAT= overrides init.defaultRefFormat" '
+test_expect_success "GIT_DEFAULT_REF_STORAGE_FORMAT= overrides init.defaultRefStorageFormat" '
 	test_when_finished "rm -rf refformat" &&
-	test_config_global init.defaultRefFormat files &&
+	test_config_global init.defaultRefStorageFormat files &&
 
 	GIT_DEFAULT_REF_STORAGE_FORMAT=reftable git init refformat &&
 	echo reftable >expect &&
@@ -775,10 +775,10 @@ test_expect_success "init with feature.experimental=true" '
 	test_cmp expect actual
 '
 
-test_expect_success "init.defaultRefFormat overrides feature.experimental=true" '
+test_expect_success "init.defaultRefStorageFormat overrides feature.experimental=true" '
 	test_when_finished "rm -rf refformat" &&
 	test_config_global feature.experimental true &&
-	test_config_global init.defaultRefFormat files &&
+	test_config_global init.defaultRefStorageFormat files &&
 	(
 		sane_unset GIT_DEFAULT_REF_STORAGE_FORMAT &&
 		git init refformat

-- 
2.55.0.1007.g17ff1f9808.dirty


^ permalink raw reply related	[flat|nested] 61+ messages in thread

* [PATCH v2 11/11] setup: allow "git init --ref-storage-format=" to specify a payload
  2026-09-07 11:18 ` [PATCH v2 " Patrick Steinhardt
                     ` (9 preceding siblings ...)
  2026-09-07 11:18   ` [PATCH v2 10/11] setup: rename "init.defaultRefFormat" to "init.defaultRefStorageFormat" Patrick Steinhardt
@ 2026-09-07 11:18   ` Patrick Steinhardt
  2026-09-09  8:54     ` Kaartic Sivaraam
  10 siblings, 1 reply; 61+ messages in thread
From: Patrick Steinhardt @ 2026-09-07 11:18 UTC (permalink / raw)
  To: git; +Cc: Karthik Nayak, Junio C Hamano

Reference storage backends can be configured with a payload via the
"extensions.refStorage" config key and the "GIT_REF_STORAGE_FORMAT"
environment variable, both of which accept a URI in the format
"<format>://<payload>". The payload may contain backend-specific
information, for example an alternate refs directory or which database
references should be stored in.

The `--ref-storage-format=` option of git-init(1) and git-clone(1) does
not know about payloads though: its value is parsed as a plain format
name, so backends that require a payload cannot be conveniently set up
at initialization time via the command line.

Teach the option to accept the same URI syntax. Also, document the
optional payloads for both the "files" and "reftable" backends.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
 Documentation/git-init.adoc           |  5 ++++-
 Documentation/ref-storage-format.adoc |  8 ++++++--
 builtin/clone.c                       | 14 +++++++-------
 builtin/init-db.c                     | 17 +++++------------
 setup.c                               | 16 +++++++++++-----
 setup.h                               |  2 +-
 t/t0001-init.sh                       |  2 +-
 t/t1423-ref-backend.sh                | 30 ++++++++++++++++++++++++++++++
 8 files changed, 65 insertions(+), 29 deletions(-)

diff --git a/Documentation/git-init.adoc b/Documentation/git-init.adoc
index 7e407d3ef1..e078369ed7 100644
--- a/Documentation/git-init.adoc
+++ b/Documentation/git-init.adoc
@@ -58,7 +58,10 @@ values are `sha1` and (if enabled) `sha256`.  `sha1` is the default.
 include::object-format-disclaimer.adoc[]
 
 `--ref-storage-format=<format>`::
-Specify the given ref storage _<format>_ for the repository. The valid values are:
+Specify the given ref storage _<format>_ for the repository. Backends that
+require additional configuration accept a payload in the form
+`<format>://<payload>`, for example a connection string identifying the
+database that shall store the references. The valid values are:
 +
 include::ref-storage-format.adoc[]
 
diff --git a/Documentation/ref-storage-format.adoc b/Documentation/ref-storage-format.adoc
index c5e29ec831..21d62557b7 100644
--- a/Documentation/ref-storage-format.adoc
+++ b/Documentation/ref-storage-format.adoc
@@ -1,8 +1,12 @@
-`files`;; for loose files with packed-refs.
+`files[://<path>]`;; for loose files with packed-refs. The optional payload can
+be specified to change the root directory where references are created. A
+relative path will be resolved relative to the repository's common directory.
 ifndef::with-breaking-changes[]
 	This is the default.
 endif::with-breaking-changes[]
-`reftable`;; for the reftable format.
+`reftable[://<path>]`;; for the reftable format. The optional payload can
+be specified to change the root directory where references are created. A
+relative path will be resolved relative to the repository's common directory.
 ifdef::with-breaking-changes[]
 	This is the default.
 endif::with-breaking-changes[]
diff --git a/builtin/clone.c b/builtin/clone.c
index 93be65efcd..808a40c4fb 100644
--- a/builtin/clone.c
+++ b/builtin/clone.c
@@ -901,7 +901,7 @@ int cmd_clone(int argc,
 	char *option_origin = NULL;
 	struct string_list option_not = STRING_LIST_INIT_NODUP;
 	const char *real_git_dir = NULL;
-	const char *ref_storage_format_str = NULL;
+	const char *ref_storage_format_uri = NULL;
 	const char *option_upload_pack = "git-upload-pack";
 	int option_progress = -1;
 	int option_sparse_checkout = 0;
@@ -981,9 +981,9 @@ int cmd_clone(int argc,
 			 N_("any cloned submodules will be shallow")),
 		OPT_STRING(0, "separate-git-dir", &real_git_dir, N_("gitdir"),
 			   N_("separate git dir from working tree")),
-		OPT_STRING(0, "ref-storage-format", &ref_storage_format_str, N_("format"),
+		OPT_STRING(0, "ref-storage-format", &ref_storage_format_uri, N_("format"),
 			   N_("specify the reference storage format to use")),
-		OPT_STRING_F(0, "ref-format", &ref_storage_format_str, N_("format"),
+		OPT_STRING_F(0, "ref-format", &ref_storage_format_uri, N_("format"),
 			   N_("specify the reference storage format to use"), PARSE_OPT_HIDDEN),
 		OPT_STRING_LIST('c', "config", &option_config, N_("key=value"),
 				N_("set config inside the new repository")),
@@ -1029,10 +1029,10 @@ int cmd_clone(int argc,
 	if (option_single_branch == -1)
 		option_single_branch = deepen ? 1 : 0;
 
-	if (ref_storage_format_str) {
-		ref_storage_format = ref_storage_format_by_name(ref_storage_format_str);
+	if (ref_storage_format_uri) {
+		ref_storage_format = ref_storage_format_by_uri(ref_storage_format_uri, NULL);
 		if (ref_storage_format == REF_STORAGE_FORMAT_UNKNOWN)
-			die(_("unknown ref storage format '%s'"), ref_storage_format_str);
+			die(_("unknown ref storage format '%s'"), ref_storage_format_uri);
 	}
 
 	if (option_mirror) {
@@ -1188,7 +1188,7 @@ int cmd_clone(int argc,
 	 * their on-disk data structures.
 	 */
 	init_db(the_repository, git_dir, real_git_dir, work_tree, option_template,
-		GIT_HASH_UNKNOWN, ref_storage_format, NULL,
+		GIT_HASH_UNKNOWN, ref_storage_format_uri, NULL,
 		do_not_override_repo_unix_permissions,
 		INIT_DB_QUIET | INIT_DB_SKIP_REFDB);
 
diff --git a/builtin/init-db.c b/builtin/init-db.c
index 63f33154c0..48074cb235 100644
--- a/builtin/init-db.c
+++ b/builtin/init-db.c
@@ -83,10 +83,9 @@ int cmd_init_db(int argc,
 	unsigned int flags = 0;
 	int bare = startup_info->force_bare_repository ? 1 : -1;
 	const char *object_format = NULL;
-	const char *ref_storage_format_str = NULL;
+	const char *ref_storage_format_uri = NULL;
 	const char *initial_branch = NULL;
 	int hash_algo = GIT_HASH_UNKNOWN;
-	enum ref_storage_format ref_storage_format = REF_STORAGE_FORMAT_UNKNOWN;
 	int init_shared_repository = -1;
 	const struct option init_db_options[] = {
 		OPT_STRING(0, "template", &template_dir, N_("template-directory"),
@@ -109,9 +108,9 @@ int cmd_init_db(int argc,
 			   N_("override the name of the initial branch")),
 		OPT_STRING(0, "object-format", &object_format, N_("hash"),
 			   N_("specify the hash algorithm to use")),
-		OPT_STRING(0, "ref-storage-format", &ref_storage_format_str, N_("format"),
+		OPT_STRING(0, "ref-storage-format", &ref_storage_format_uri, N_("format"),
 			   N_("specify the reference storage format to use")),
-		OPT_STRING_F(0, "ref-format", &ref_storage_format_str, N_("format"),
+		OPT_STRING_F(0, "ref-format", &ref_storage_format_uri, N_("format"),
 			   N_("specify the reference storage format to use"), PARSE_OPT_HIDDEN),
 		OPT_END()
 	};
@@ -175,12 +174,6 @@ int cmd_init_db(int argc,
 			die(_("unknown hash algorithm '%s'"), object_format);
 	}
 
-	if (ref_storage_format_str) {
-		ref_storage_format = ref_storage_format_by_name(ref_storage_format_str);
-		if (ref_storage_format == REF_STORAGE_FORMAT_UNKNOWN)
-			die(_("unknown ref storage format '%s'"), ref_storage_format_str);
-	}
-
 	if (init_shared_repository != -1)
 		repo_settings_set_shared_repository(the_repository, init_shared_repository);
 
@@ -251,8 +244,8 @@ int cmd_init_db(int argc,
 
 	flags |= INIT_DB_EXIST_OK;
 	ret = init_db(the_repository, git_dir, real_git_dir, work_tree,
-		      template_dir, hash_algo, ref_storage_format, initial_branch,
-		      init_shared_repository, flags);
+		      template_dir, hash_algo, ref_storage_format_uri,
+		      initial_branch, init_shared_repository, flags);
 
 	free(template_dir_to_free);
 	free(real_git_dir_to_free);
diff --git a/setup.c b/setup.c
index 52ad0f417d..4ece4725a5 100644
--- a/setup.c
+++ b/setup.c
@@ -2727,7 +2727,8 @@ static int read_default_format_config(const char *key, const char *value,
 }
 
 static void repository_format_configure(struct repository_format *repo_fmt,
-					int hash, enum ref_storage_format ref_storage_format)
+					int hash,
+					const char *ref_storage_format_uri)
 {
 	struct default_format_config cfg = {
 		.hash = GIT_HASH_UNKNOWN,
@@ -2738,6 +2739,7 @@ static void repository_format_configure(struct repository_format *repo_fmt,
 		.ignore_repo = 1,
 		.ignore_worktree = 1,
 	};
+	enum ref_storage_format ref_storage_format;
 	char *ref_storage_payload = NULL;
 	const char *env;
 
@@ -2788,8 +2790,12 @@ static void repository_format_configure(struct repository_format *repo_fmt,
 	 *   6. Otherwise, we fall back to the default ref storage format
 	 *      compiled into Git.
 	 */
-	if (ref_storage_format != REF_STORAGE_FORMAT_UNKNOWN) {
-		/* nothing to do */
+	if (ref_storage_format_uri) {
+		ref_storage_format = ref_storage_format_by_uri(ref_storage_format_uri,
+							       &ref_storage_payload);
+		if (ref_storage_format == REF_STORAGE_FORMAT_UNKNOWN)
+			die(_("unknown ref storage format specified via command line: '%s'"),
+			    ref_storage_format_uri);
 	} else if (((env = getenv(GIT_REF_STORAGE_FORMAT_ENVIRONMENT)) ||
 		    (env = getenv(GIT_REFERENCE_BACKEND_ENVIRONMENT)))) {
 		ref_storage_format = ref_storage_format_by_uri(env, &ref_storage_payload);
@@ -2834,7 +2840,7 @@ int init_db(struct repository *repo,
 	    const char *real_git_dir,
 	    const char *worktree,
 	    const char *template_dir, int hash,
-	    enum ref_storage_format ref_storage_format,
+	    const char *ref_storage_format_uri,
 	    const char *initial_branch,
 	    int init_shared_repository, unsigned int flags)
 {
@@ -2871,7 +2877,7 @@ int init_db(struct repository *repo,
 	 * is an attempt to reinitialize new repository with an old tool.
 	 */
 	read_and_verify_repository_format(&repo_fmt, repo_get_git_dir(repo), NULL);
-	repository_format_configure(&repo_fmt, hash, ref_storage_format);
+	repository_format_configure(&repo_fmt, hash, ref_storage_format_uri);
 	if (apply_repository_format(repo, &repo_fmt, APPLY_REPOSITORY_FORMAT_HONOR_ENV, &err) < 0)
 		die("%s", err.buf);
 
diff --git a/setup.h b/setup.h
index 763fd384e8..f04d2984b4 100644
--- a/setup.h
+++ b/setup.h
@@ -265,7 +265,7 @@ int init_db(struct repository *repo,
 	    const char *real_git_dir,
 	    const char *worktree,
 	    const char *template_dir, int hash_algo,
-	    enum ref_storage_format ref_storage_format,
+	    const char *ref_storage_format_uri,
 	    const char *initial_branch, int init_shared_repository,
 	    unsigned int flags);
 void initialize_repository_version(struct repository *repo,
diff --git a/t/t0001-init.sh b/t/t0001-init.sh
index fe5bc3d3e1..f1d227f271 100755
--- a/t/t0001-init.sh
+++ b/t/t0001-init.sh
@@ -833,7 +833,7 @@ done
 test_expect_success 'init with --ref-storage-format=garbage' '
 	test_when_finished "rm -rf refformat" &&
 	cat >expect <<-EOF &&
-	fatal: unknown ref storage format ${SQ}garbage${SQ}
+	fatal: unknown ref storage format specified via command line: ${SQ}garbage${SQ}
 	EOF
 	test_must_fail git init --ref-storage-format=garbage refformat 2>err &&
 	test_cmp expect err
diff --git a/t/t1423-ref-backend.sh b/t/t1423-ref-backend.sh
index 525b2a19b4..ee2bb66b99 100755
--- a/t/t1423-ref-backend.sh
+++ b/t/t1423-ref-backend.sh
@@ -254,6 +254,36 @@ test_expect_success 'initializing repository with alt ref directory' '
 	)
 '
 
+test_expect_success 'initializing repository with --ref-storage-format and payload' '
+	test_when_finished "rm -rf repo refdir" &&
+	mkdir refdir &&
+	BACKEND="$(test_detect_ref_format)://$(pwd)/refdir" &&
+	git init --ref-storage-format="$BACKEND" repo &&
+	verify_files_exist repo/.git refdir &&
+
+	git -C repo config get extensions.refstorage >actual &&
+	echo $BACKEND >expect &&
+	test_cmp expect actual &&
+
+	test_commit -C repo 1 &&
+	git -C repo refs list >out &&
+	test_grep "refs/tags/1" out &&
+
+	# Reinitializing the repository is fine when not specifying any format.
+	git -C repo init &&
+	# Reinitializing with the same backend is fine, too.
+	git -C repo init --ref-storage-format="$BACKEND" &&
+	# Reinitializing without a payload should fail.
+	test_must_fail git -C repo init --ref-storage-format="$(test_detect_ref_format)" 2>err &&
+	test_grep "attempt to reinitialize repository with different reference storage payload" err &&
+	# Reinitializing with a different payload should fail, too.
+	test_must_fail git -C repo init --ref-storage-format="$(test_detect_ref_format)://$(pwd)/other" 2>err &&
+	test_grep "attempt to reinitialize repository with different reference storage payload" err &&
+
+	git -C repo config get extensions.refstorage >actual &&
+	test_cmp expect actual
+'
+
 test_expect_success 'cloning repository with alt ref directory' '
 	test_when_finished "rm -rf source repo refdir" &&
 	mkdir refdir &&

-- 
2.55.0.1007.g17ff1f9808.dirty


^ permalink raw reply related	[flat|nested] 61+ messages in thread

* Re: [PATCH v2 01/11] builtin/init: rename "--ref-format=" to "--ref-storage-format="
  2026-09-07 11:18   ` [PATCH v2 01/11] builtin/init: rename "--ref-format=" to "--ref-storage-format=" Patrick Steinhardt
@ 2026-09-08  9:01     ` Kaartic Sivaraam
  2026-09-09  7:00       ` Patrick Steinhardt
  0 siblings, 1 reply; 61+ messages in thread
From: Kaartic Sivaraam @ 2026-09-08  9:01 UTC (permalink / raw)
  To: Patrick Steinhardt, git; +Cc: Karthik Nayak, Junio C Hamano

On 9/7/26 16:48, Patrick Steinhardt wrote:

> 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.
> 

Just a doubt regarding the old option. At the moment, the patch appears 
to introduce the new name alongside the old name. Do we not plan on 
deprecating the old one and issue a warning to users when it is used so 
that we could eventually retire it at some point?

> ---
>   Documentation/config/init.adoc         |  2 +-
>   Documentation/git-init.adoc            |  4 ++--
>   Documentation/git.adoc                 |  2 +-
>   builtin/init-db.c                      | 16 ++++++++-------
>   t/perf/p1401-ref-store-tombstones.sh   |  4 ++--
>   t/perf/perf-lib.sh                     |  2 +-
>   t/t0001-init.sh                        | 24 +++++++++++------------
>   t/t0610-reftable-basics.sh             | 14 ++++++-------
>   t/t0611-reftable-httpd.sh              |  2 +-
>   t/t1400-update-ref.sh                  |  2 +-
>   t/t1423-ref-backend.sh                 |  6 +++---
>   t/t1460-refs-migrate.sh                | 36 +++++++++++++++++-----------------
>   t/t1900-repo-info.sh                   |  6 +++---
>   t/t5510-fetch.sh                       |  8 ++++----
>   t/t7424-submodule-mixed-ref-formats.sh |  2 +-
>   15 files changed, 66 insertions(+), 64 deletions(-)
> 
> diff --git a/Documentation/config/init.adoc b/Documentation/config/init.adoc
> index 7b4abdaf8b..a048f0bddc 100644
> --- a/Documentation/config/init.adoc
> +++ b/Documentation/config/init.adoc
> @@ -15,7 +15,7 @@ endif::[]
>   	this config.
>   `init.defaultRefFormat`::
>   	Allows overriding the default ref storage format for new repositories.
> -	See `--ref-format=` in linkgit:git-init[1]. Both the command line
> +	See `--ref-storage-format=` in linkgit:git-init[1]. Both the command line
>   	option and the `GIT_DEFAULT_REF_FORMAT` environment variable take
>   	precedence over this config.

Relevant only if we are deprecating the old option: we need to mention 
that the old one is deprecated in the documentation so that users are 
aware of the same.

> diff --git a/Documentation/git-init.adoc b/Documentation/git-init.adoc
> index bab99b9b47..7e407d3ef1 100644
> --- a/Documentation/git-init.adoc
> +++ b/Documentation/git-init.adoc
> @@ -11,7 +11,7 @@ SYNOPSIS
>   [synopsis]
>   git init [-q | --quiet] [--bare] [--template=<template-directory>]
>   	 [--separate-git-dir <git-dir>] [--object-format=<format>]
> -	 [--ref-format=<format>]
> +	 [--ref-storage-format=<format>]
>   	 [-b <branch-name> | --initial-branch=<branch-name>]
>   	 [--shared[=<permissions>]] [<directory>]
>   
> @@ -57,7 +57,7 @@ values are `sha1` and (if enabled) `sha256`.  `sha1` is the default.
>   +
>   include::object-format-disclaimer.adoc[]
>   
> -`--ref-format=<format>`::
> +`--ref-storage-format=<format>`::
>   Specify the given ref storage _<format>_ for the repository. The valid values are:
>   +
>   include::ref-storage-format.adoc[]
> diff --git a/Documentation/git.adoc b/Documentation/git.adoc
> index 8a5cdd3b3d..23ba65656e 100644
> --- a/Documentation/git.adoc
> +++ b/Documentation/git.adoc
> @@ -593,7 +593,7 @@ double-quotes and respecting backslash escapes. E.g., the value
>   `GIT_DEFAULT_REF_FORMAT`::
>   	If this variable is set, the default reference backend format for new
>   	repositories will be set to this value. The default is "files".
> -	See `--ref-format` in linkgit:git-init[1].
> +	See `--ref-storage-format` in linkgit:git-init[1].
>   
>   `GIT_REFERENCE_BACKEND`::
>       Specify which reference backend to be used along with its URI.
> diff --git a/builtin/init-db.c b/builtin/init-db.c
> index e96b1283b7..63f33154c0 100644
> --- a/builtin/init-db.c
> +++ b/builtin/init-db.c
> @@ -57,7 +57,7 @@ static int shared_callback(const struct option *opt, const char *arg, int unset)
>   static const char *const init_db_usage[] = {
>   	N_("git init [-q | --quiet] [--bare] [--template=<template-directory>]\n"
>   	   "         [--separate-git-dir <git-dir>] [--object-format=<format>]\n"
> -	   "         [--ref-format=<format>]\n"
> +	   "         [--ref-storage-format=<format>]\n"
>   	   "         [-b <branch-name> | --initial-branch=<branch-name>]\n"
>   	   "         [--shared[=<permissions>]] [<directory>]"),
>   	NULL
> @@ -83,7 +83,7 @@ int cmd_init_db(int argc,
>   	unsigned int flags = 0;
>   	int bare = startup_info->force_bare_repository ? 1 : -1;
>   	const char *object_format = NULL;
> -	const char *ref_format = NULL;
> +	const char *ref_storage_format_str = NULL;
>   	const char *initial_branch = NULL;
>   	int hash_algo = GIT_HASH_UNKNOWN;
>   	enum ref_storage_format ref_storage_format = REF_STORAGE_FORMAT_UNKNOWN;
> @@ -109,8 +109,10 @@ int cmd_init_db(int argc,
>   			   N_("override the name of the initial branch")),
>   		OPT_STRING(0, "object-format", &object_format, N_("hash"),
>   			   N_("specify the hash algorithm to use")),
> -		OPT_STRING(0, "ref-format", &ref_format, N_("format"),
> -			   N_("specify the reference format to use")),
> +		OPT_STRING(0, "ref-storage-format", &ref_storage_format_str, N_("format"),
> +			   N_("specify the reference storage format to use")),
> +		OPT_STRING_F(0, "ref-format", &ref_storage_format_str, N_("format"),
> +			   N_("specify the reference storage format to use"), PARSE_OPT_HIDDEN),

Relevant only if we are deprecating the old option: We could change the 
description of the old option to convey that it is deprecated so that it 
could be easily distinguished by anyone reading through. I suggest this 
by noting a similar pattern in `builtin/name-rev.c` for the `--stdin` 
argument.

If we don't plan to deprecate, I suppose we could use OPT_ALIAS to 
clarify that `ref-format` is an alias of `ref-storage-format` similar to 
how `recursive` is marked as an alias of `recurse-submodules` in 
`builtin/clone.c`.

> diff --git a/t/t7424-submodule-mixed-ref-formats.sh b/t/t7424-submodule-mixed-ref-formats.sh
> index 559713b607..1ca245c732 100755
> --- a/t/t7424-submodule-mixed-ref-formats.sh
> +++ b/t/t7424-submodule-mixed-ref-formats.sh
> @@ -31,7 +31,7 @@ test_expect_success 'add existing repository with different ref storage format'
>   	(
>   		cd parent &&
>   		test_commit parent &&
> -		git init --ref-format=$OTHER_FORMAT submodule &&
> +		git init --ref-storage-format=$OTHER_FORMAT submodule &&
>   		test_commit -C submodule submodule &&
>   		git submodule add ./submodule
>   	)
> 

Rest of the patch looks fine to me.

--
Sivaraam


^ permalink raw reply	[flat|nested] 61+ messages in thread

* Re: [PATCH v2 02/11] builtin/clone: rename "--ref-format=" to "--ref-storage-format="
  2026-09-07 11:18   ` [PATCH v2 02/11] builtin/clone: " Patrick Steinhardt
@ 2026-09-08  9:21     ` Kaartic Sivaraam
  2026-09-09  7:03       ` Patrick Steinhardt
  0 siblings, 1 reply; 61+ messages in thread
From: Kaartic Sivaraam @ 2026-09-08  9:21 UTC (permalink / raw)
  To: Patrick Steinhardt, git; +Cc: Karthik Nayak, Junio C Hamano

On 9/7/26 16:48, Patrick Steinhardt wrote:
> diff --git a/builtin/clone.c b/builtin/clone.c
> index 5b25cca510..511fff9562 100644
> --- a/builtin/clone.c
> +++ b/builtin/clone.c
> @@ -901,7 +901,7 @@ int cmd_clone(int argc,
>   	char *option_origin = NULL;
>   	struct string_list option_not = STRING_LIST_INIT_NODUP;
>   	const char *real_git_dir = NULL;
> -	const char *ref_format = NULL;
> +	const char *ref_storage_format_str = NULL;
>   	const char *option_upload_pack = "git-upload-pack";
>   	int option_progress = -1;
>   	int option_sparse_checkout = 0;
> @@ -981,8 +981,10 @@ int cmd_clone(int argc,
>   			 N_("any cloned submodules will be shallow")),
>   		OPT_STRING(0, "separate-git-dir", &real_git_dir, N_("gitdir"),
>   			   N_("separate git dir from working tree")),
> -		OPT_STRING(0, "ref-format", &ref_format, N_("format"),
> -			   N_("specify the reference format to use")),
> +		OPT_STRING(0, "ref-storage-format", &ref_storage_format_str, N_("format"),
> +			   N_("specify the reference storage format to use")),
> +		OPT_STRING_F(0, "ref-format", &ref_storage_format_str, N_("format"),
> +			   N_("specify the reference storage format to use"), PARSE_OPT_HIDDEN),
>   		OPT_STRING_LIST('c', "config", &option_config, N_("key=value"),
>   				N_("set config inside the new repository")),
>   		OPT_STRING_LIST(0, "server-option", &server_options,

Ditto here about either deprecating / using OPT_ALIAS.


> diff --git a/t/t7424-submodule-mixed-ref-formats.sh b/t/t7424-submodule-mixed-ref-formats.sh
> index 1ca245c732..5eaf689d74 100755
> --- a/t/t7424-submodule-mixed-ref-formats.sh
> +++ b/t/t7424-submodule-mixed-ref-formats.sh
> @@ -63,9 +63,9 @@ test_expect_success 'recursive clone propagates ref storage format' '
>   	test_ref_format upstream/submodule "$GIT_DEFAULT_REF_FORMAT" &&
>   
>   	# The cloned repositories should use the other ref format that we have
> -	# specified via `--ref-format`. The option should propagate to cloned
> +	# specified via `--ref-storage`. The option should propagate to cloned

s/ref-storage/ref-storage-format

Rest of the patch looks fine to me.

--
Sivaraam


^ permalink raw reply	[flat|nested] 61+ messages in thread

* Re: [PATCH v2 03/11] builtin/refs: rename "--ref-format=" to "--ref-storage-format="
  2026-09-07 11:18   ` [PATCH v2 03/11] builtin/refs: " Patrick Steinhardt
@ 2026-09-08 10:55     ` Kaartic Sivaraam
  2026-09-09  7:03       ` Patrick Steinhardt
  0 siblings, 1 reply; 61+ messages in thread
From: Kaartic Sivaraam @ 2026-09-08 10:55 UTC (permalink / raw)
  To: Patrick Steinhardt, git; +Cc: Karthik Nayak, Junio C Hamano

On 9/7/26 16:48, Patrick Steinhardt wrote:
> index 5cd21c25fe..53b12accaf 100644
> --- a/builtin/refs.c
> +++ b/builtin/refs.c
> @@ -10,7 +10,7 @@
>   #include "refs/refs-internal.h"
>   
>   #define REFS_MIGRATE_USAGE \
> -	N_("git refs migrate --ref-format=<format> [--no-reflog] [--dry-run]")
> +	N_("git refs migrate --ref-storage-format=<format> [--no-reflog] [--dry-run]")
>   
>   #define REFS_VERIFY_USAGE \
>   	N_("git refs verify [--strict] [--verbose]")
> @@ -44,9 +44,12 @@ static int cmd_refs_migrate(int argc, const char **argv, const char *prefix,
>   	enum ref_storage_format format;
>   	unsigned int flags = 0;
>   	struct option options[] = {
> -		OPT_STRING_F(0, "ref-format", &format_str, N_("format"),
> -			N_("specify the reference format to convert to"),
> +		OPT_STRING_F(0, "ref-storage-format", &format_str, N_("format"),
> +			N_("specify the reference storage format to convert to"),
>   			PARSE_OPT_NONEG),

This is a bit of a tangent to the change that the patch aims for.

The `PARSE_OPT_NONEG` flag made me wonder if we needed the same in other 
commands that accept this argument too. I tried to take a quick look at 
the series that introduced the `git refs` command and I could not find 
any specific rationale behind why the argument to this specific command 
should have the PARSE_OPT_NONEG flag. May be we could drop the flag for 
`git refs` command to make it consistent with how the argument is 
supported in other commands?

Either way not a show-stopper for this series, of course.

Rest of the patch looks good to me.

--
Sivaraam


^ permalink raw reply	[flat|nested] 61+ messages in thread

* Re: [PATCH v2 07/11] refs: expose function to parse reference URIs
  2026-09-07 11:18   ` [PATCH v2 07/11] refs: expose function to parse reference URIs Patrick Steinhardt
@ 2026-09-08 13:47     ` Kaartic Sivaraam
  2026-09-09  7:03       ` Patrick Steinhardt
  0 siblings, 1 reply; 61+ messages in thread
From: Kaartic Sivaraam @ 2026-09-08 13:47 UTC (permalink / raw)
  To: Patrick Steinhardt, git; +Cc: Karthik Nayak, Junio C Hamano

On 9/7/26 16:48, Patrick Steinhardt wrote:
> In the next commit we're about to add more sites that want to parse a
> reference backends URI into a format and payload. Expose a new function
> `ref_storage_format_by_uri()` that enables this.
> 
> Signed-off-by: Patrick Steinhardt <ps@pks.im>
> ---

>   enum ref_transaction_error {
>   	/* Default error code */
>   	REF_TRANSACTION_ERROR_GENERIC = -1,
> diff --git a/setup.c b/setup.c
> index dfe05d9a03..3be7dac452 100644
> --- a/setup.c
> +++ b/setup.c
>
> @@ -2069,16 +2051,12 @@ const char *setup_git_directory_gently(struct repository *repo, int *nongit_ok)
>   			 */
>   			ref_backend_uri = getenv(GIT_REFERENCE_BACKEND_ENVIRONMENT);
>   			if (ref_backend_uri) {
> -				char *format;
> -
> -				free(discovery.format.ref_storage_payload);
> -
> -				parse_reference_uri(ref_backend_uri, &format, &discovery.format.ref_storage_payload);
> -				discovery.format.ref_storage_format = ref_storage_format_by_name(format);
> +				FREE_AND_NULL(discovery.format.ref_storage_payload);
> +				discovery.format.ref_storage_format =
> +					ref_storage_format_by_uri(ref_backend_uri,
> +								  &discovery.format.ref_storage_payload);
>   				if (discovery.format.ref_storage_format == REF_STORAGE_FORMAT_UNKNOWN)
> -					die(_("unknown ref storage format: '%s'"), format);
> -
> -				free(format);
> +					die(_("unknown ref storage format: '%s'"), ref_backend_uri);

If I'm not mistaken, we have now started printing the whole ref storage 
backend configuration rather than just the name. I could see that we 
don't actually have any variable that returns just the name part after 
the refactor. I could also understand that we can't always expect a 
'://' in the GIT_REF_STORAGE_FORMAT configuration so printing the whole 
configuration may make sense. But could we possibly improve the error 
message a bit? May be phrase it as follows:

   $ GIT_REF_STORAGE_FORMAT=garbage://hello-world ./git status
   fatal: invalid ref storage format configuration: 'garbage://hello-world'

> @@ -2806,18 +2784,16 @@ static void repository_format_configure(struct repository_format *repo_fmt,
>   
>   	ref_backend_uri = getenv(GIT_REFERENCE_BACKEND_ENVIRONMENT);
>   	if (ref_backend_uri) {
> -		char *backend, *payload;
>   		enum ref_storage_format format;
> +		char *payload;
>   
> -		parse_reference_uri(ref_backend_uri, &backend, &payload);
> -		format = ref_storage_format_by_name(backend);
> +		format = ref_storage_format_by_uri(ref_backend_uri, &payload);
>   		if (format == REF_STORAGE_FORMAT_UNKNOWN)
> -			die(_("unknown ref storage format: '%s'"), backend);
> +			die(_("unknown ref storage format: '%s'"), ref_backend_uri);
>   

Ditto here.

--
Sivaraam


^ permalink raw reply	[flat|nested] 61+ messages in thread

* Re: [PATCH v2 01/11] builtin/init: rename "--ref-format=" to "--ref-storage-format="
  2026-09-08  9:01     ` Kaartic Sivaraam
@ 2026-09-09  7:00       ` Patrick Steinhardt
  2026-09-09  9:14         ` Kaartic Sivaraam
  0 siblings, 1 reply; 61+ messages in thread
From: Patrick Steinhardt @ 2026-09-09  7:00 UTC (permalink / raw)
  To: Kaartic Sivaraam; +Cc: git, Karthik Nayak, Junio C Hamano

On Tue, Sep 08, 2026 at 02:31:22PM +0530, Kaartic Sivaraam wrote:
> On 9/7/26 16:48, Patrick Steinhardt wrote:
> 
> > 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.
> > 
> 
> Just a doubt regarding the old option. At the moment, the patch appears to
> introduce the new name alongside the old name. Do we not plan on deprecating
> the old one and issue a warning to users when it is used so that we could
> eventually retire it at some point?

I'm aiming for a a quiet deprecation -- the old options keep on working,
but we don't show them anymore. We may eventually remove them
altogether, but I neither want to warn about use of old options now or
even remove them as that would likely cause more negative consequences
than is worth it. It's not like we want to soon use the old names.

> > diff --git a/Documentation/config/init.adoc b/Documentation/config/init.adoc
> > index 7b4abdaf8b..a048f0bddc 100644
> > --- a/Documentation/config/init.adoc
> > +++ b/Documentation/config/init.adoc
> > @@ -15,7 +15,7 @@ endif::[]
> >   	this config.
> >   `init.defaultRefFormat`::
> >   	Allows overriding the default ref storage format for new repositories.
> > -	See `--ref-format=` in linkgit:git-init[1]. Both the command line
> > +	See `--ref-storage-format=` in linkgit:git-init[1]. Both the command line
> >   	option and the `GIT_DEFAULT_REF_FORMAT` environment variable take
> >   	precedence over this config.
> 
> Relevant only if we are deprecating the old option: we need to mention that
> the old one is deprecated in the documentation so that users are aware of
> the same.

But I agree that we should keep the old options documented. Otherwise,
it might be hard to figure out what those options do in case they for
example still exist in an old script.

> > diff --git a/builtin/init-db.c b/builtin/init-db.c
> > index e96b1283b7..63f33154c0 100644
> > --- a/builtin/init-db.c
> > +++ b/builtin/init-db.c
> > @@ -57,7 +57,7 @@ static int shared_callback(const struct option *opt, const char *arg, int unset)
> >   static const char *const init_db_usage[] = {
> >   	N_("git init [-q | --quiet] [--bare] [--template=<template-directory>]\n"
> >   	   "         [--separate-git-dir <git-dir>] [--object-format=<format>]\n"
> > -	   "         [--ref-format=<format>]\n"
> > +	   "         [--ref-storage-format=<format>]\n"
> >   	   "         [-b <branch-name> | --initial-branch=<branch-name>]\n"
> >   	   "         [--shared[=<permissions>]] [<directory>]"),
> >   	NULL
> > @@ -83,7 +83,7 @@ int cmd_init_db(int argc,
> >   	unsigned int flags = 0;
> >   	int bare = startup_info->force_bare_repository ? 1 : -1;
> >   	const char *object_format = NULL;
> > -	const char *ref_format = NULL;
> > +	const char *ref_storage_format_str = NULL;
> >   	const char *initial_branch = NULL;
> >   	int hash_algo = GIT_HASH_UNKNOWN;
> >   	enum ref_storage_format ref_storage_format = REF_STORAGE_FORMAT_UNKNOWN;
> > @@ -109,8 +109,10 @@ int cmd_init_db(int argc,
> >   			   N_("override the name of the initial branch")),
> >   		OPT_STRING(0, "object-format", &object_format, N_("hash"),
> >   			   N_("specify the hash algorithm to use")),
> > -		OPT_STRING(0, "ref-format", &ref_format, N_("format"),
> > -			   N_("specify the reference format to use")),
> > +		OPT_STRING(0, "ref-storage-format", &ref_storage_format_str, N_("format"),
> > +			   N_("specify the reference storage format to use")),
> > +		OPT_STRING_F(0, "ref-format", &ref_storage_format_str, N_("format"),
> > +			   N_("specify the reference storage format to use"), PARSE_OPT_HIDDEN),
> 
> Relevant only if we are deprecating the old option: We could change the
> description of the old option to convey that it is deprecated so that it
> could be easily distinguished by anyone reading through. I suggest this by
> noting a similar pattern in `builtin/name-rev.c` for the `--stdin` argument.

We don't really have to update the description as we pass
`PARSE_OPT_HIDDEN` anyway, so the option is not even shown.

> If we don't plan to deprecate, I suppose we could use OPT_ALIAS to clarify
> that `ref-format` is an alias of `ref-storage-format` similar to how
> `recursive` is marked as an alias of `recurse-submodules` in
> `builtin/clone.c`.

I was originally planning to use `OPT_ALIAS()`, but we don't seem to
support `PARSE_OPT_HIDDEN` there. Maybe it's better to add a small
preparatory patch to support that though.

Patrick

^ permalink raw reply	[flat|nested] 61+ messages in thread

* Re: [PATCH v2 02/11] builtin/clone: rename "--ref-format=" to "--ref-storage-format="
  2026-09-08  9:21     ` Kaartic Sivaraam
@ 2026-09-09  7:03       ` Patrick Steinhardt
  0 siblings, 0 replies; 61+ messages in thread
From: Patrick Steinhardt @ 2026-09-09  7:03 UTC (permalink / raw)
  To: Kaartic Sivaraam; +Cc: git, Karthik Nayak, Junio C Hamano

On Tue, Sep 08, 2026 at 02:51:37PM +0530, Kaartic Sivaraam wrote:
> On 9/7/26 16:48, Patrick Steinhardt wrote:
> > diff --git a/t/t7424-submodule-mixed-ref-formats.sh b/t/t7424-submodule-mixed-ref-formats.sh
> > index 1ca245c732..5eaf689d74 100755
> > --- a/t/t7424-submodule-mixed-ref-formats.sh
> > +++ b/t/t7424-submodule-mixed-ref-formats.sh
> > @@ -63,9 +63,9 @@ test_expect_success 'recursive clone propagates ref storage format' '
> >   	test_ref_format upstream/submodule "$GIT_DEFAULT_REF_FORMAT" &&
> >   	# The cloned repositories should use the other ref format that we have
> > -	# specified via `--ref-format`. The option should propagate to cloned
> > +	# specified via `--ref-storage`. The option should propagate to cloned
> 
> s/ref-storage/ref-storage-format
> 
> Rest of the patch looks fine to me.

Well spotted, fixed now.

Patrick

^ permalink raw reply	[flat|nested] 61+ messages in thread

* Re: [PATCH v2 03/11] builtin/refs: rename "--ref-format=" to "--ref-storage-format="
  2026-09-08 10:55     ` Kaartic Sivaraam
@ 2026-09-09  7:03       ` Patrick Steinhardt
  0 siblings, 0 replies; 61+ messages in thread
From: Patrick Steinhardt @ 2026-09-09  7:03 UTC (permalink / raw)
  To: Kaartic Sivaraam; +Cc: git, Karthik Nayak, Junio C Hamano

On Tue, Sep 08, 2026 at 04:25:35PM +0530, Kaartic Sivaraam wrote:
> On 9/7/26 16:48, Patrick Steinhardt wrote:
> > index 5cd21c25fe..53b12accaf 100644
> > --- a/builtin/refs.c
> > +++ b/builtin/refs.c
> > @@ -10,7 +10,7 @@
> >   #include "refs/refs-internal.h"
> >   #define REFS_MIGRATE_USAGE \
> > -	N_("git refs migrate --ref-format=<format> [--no-reflog] [--dry-run]")
> > +	N_("git refs migrate --ref-storage-format=<format> [--no-reflog] [--dry-run]")
> >   #define REFS_VERIFY_USAGE \
> >   	N_("git refs verify [--strict] [--verbose]")
> > @@ -44,9 +44,12 @@ static int cmd_refs_migrate(int argc, const char **argv, const char *prefix,
> >   	enum ref_storage_format format;
> >   	unsigned int flags = 0;
> >   	struct option options[] = {
> > -		OPT_STRING_F(0, "ref-format", &format_str, N_("format"),
> > -			N_("specify the reference format to convert to"),
> > +		OPT_STRING_F(0, "ref-storage-format", &format_str, N_("format"),
> > +			N_("specify the reference storage format to convert to"),
> >   			PARSE_OPT_NONEG),
> 
> This is a bit of a tangent to the change that the patch aims for.
> 
> The `PARSE_OPT_NONEG` flag made me wonder if we needed the same in other
> commands that accept this argument too. I tried to take a quick look at the
> series that introduced the `git refs` command and I could not find any
> specific rationale behind why the argument to this specific command should
> have the PARSE_OPT_NONEG flag. May be we could drop the flag for `git refs`
> command to make it consistent with how the argument is supported in other
> commands?
> 
> Either way not a show-stopper for this series, of course.

We might want to do that, yeah. But it's certainly outside the scope of
this patch series, so I'll not include it here.

Patrick

^ permalink raw reply	[flat|nested] 61+ messages in thread

* Re: [PATCH v2 07/11] refs: expose function to parse reference URIs
  2026-09-08 13:47     ` Kaartic Sivaraam
@ 2026-09-09  7:03       ` Patrick Steinhardt
  0 siblings, 0 replies; 61+ messages in thread
From: Patrick Steinhardt @ 2026-09-09  7:03 UTC (permalink / raw)
  To: Kaartic Sivaraam; +Cc: git, Karthik Nayak, Junio C Hamano

On Tue, Sep 08, 2026 at 07:17:06PM +0530, Kaartic Sivaraam wrote:
> On 9/7/26 16:48, Patrick Steinhardt wrote:
> > diff --git a/setup.c b/setup.c
> > index dfe05d9a03..3be7dac452 100644
> > --- a/setup.c
> > +++ b/setup.c
> > 
> > @@ -2069,16 +2051,12 @@ const char *setup_git_directory_gently(struct repository *repo, int *nongit_ok)
> >   			 */
> >   			ref_backend_uri = getenv(GIT_REFERENCE_BACKEND_ENVIRONMENT);
> >   			if (ref_backend_uri) {
> > -				char *format;
> > -
> > -				free(discovery.format.ref_storage_payload);
> > -
> > -				parse_reference_uri(ref_backend_uri, &format, &discovery.format.ref_storage_payload);
> > -				discovery.format.ref_storage_format = ref_storage_format_by_name(format);
> > +				FREE_AND_NULL(discovery.format.ref_storage_payload);
> > +				discovery.format.ref_storage_format =
> > +					ref_storage_format_by_uri(ref_backend_uri,
> > +								  &discovery.format.ref_storage_payload);
> >   				if (discovery.format.ref_storage_format == REF_STORAGE_FORMAT_UNKNOWN)
> > -					die(_("unknown ref storage format: '%s'"), format);
> > -
> > -				free(format);
> > +					die(_("unknown ref storage format: '%s'"), ref_backend_uri);
> 
> If I'm not mistaken, we have now started printing the whole ref storage
> backend configuration rather than just the name. I could see that we don't
> actually have any variable that returns just the name part after the
> refactor. I could also understand that we can't always expect a '://' in the
> GIT_REF_STORAGE_FORMAT configuration so printing the whole configuration may
> make sense. But could we possibly improve the error message a bit? May be
> phrase it as follows:
> 
>   $ GIT_REF_STORAGE_FORMAT=garbage://hello-world ./git status
>   fatal: invalid ref storage format configuration: 'garbage://hello-world'

I think "invalid" would be less precise though compared to "unknown", so
I'm inclined to keep the wording here. I don't think it's too bad that
we're now printing the whole URI, as that may also make the user wonder
less about where specifically that string even comes from.

So for now, I'll leave this as-is.

Patrick

^ permalink raw reply	[flat|nested] 61+ messages in thread

* Re: [PATCH v2 08/11] setup: refactor how we configure the ref storage format
  2026-09-07 11:18   ` [PATCH v2 08/11] setup: refactor how we configure the ref storage format Patrick Steinhardt
@ 2026-09-09  8:00     ` Kaartic Sivaraam
  2026-09-09  9:23       ` Patrick Steinhardt
  0 siblings, 1 reply; 61+ messages in thread
From: Kaartic Sivaraam @ 2026-09-09  8:00 UTC (permalink / raw)
  To: Patrick Steinhardt, git; +Cc: Karthik Nayak, Junio C Hamano

On 9/7/26 16:48, Patrick Steinhardt wrote:
> diff --git a/setup.c b/setup.c
> index 3be7dac452..38fa5e854c 100644
> --- a/setup.c
> +++ b/setup.c
> @@ -2761,40 +2761,65 @@ static void repository_format_configure(struct repository_format *repo_fmt,
>
> ... snip ...
> -
> -	ref_backend_uri = getenv(GIT_REFERENCE_BACKEND_ENVIRONMENT);
> -	if (ref_backend_uri) {
> -		enum ref_storage_format format;
> -		char *payload;
> -
> -		format = ref_storage_format_by_uri(ref_backend_uri, &payload);
> -		if (format == REF_STORAGE_FORMAT_UNKNOWN)
> -			die(_("unknown ref storage format: '%s'"), ref_backend_uri);
> -
> -		repo_fmt->ref_storage_format = format;
> -		free(repo_fmt->ref_storage_payload);
> -		repo_fmt->ref_storage_payload = payload;
> -	}
> +	/*
> +	 * If we have a preexisting repository we need to verify that its
> +	 * current ref storage format does not change.
> +	 */
> +	if (repo_fmt->version >= 0) {
> +		if (ref_storage_format != repo_fmt->ref_storage_format)
> +			die(_("attempt to reinitialize repository with different reference storage format"));
> +		if ((ref_storage_payload || repo_fmt->ref_storage_payload) &&
> +		    strcmp(ref_storage_payload ? ref_storage_payload : "",
> +			   repo_fmt->ref_storage_payload ? repo_fmt->ref_storage_payload : ""))

Rather than a strcmp, wouldn't it be ideal to do the path comparison 
using strbuf_realpath to make sure we avoid similar paths like the 
following from failing during reinitialization?

   $ mkdir store
   $ git init --ref-storage-format="files://$PWD/store" r1
   Initialized empty Git repository in .../r1/.git/
   $ git init --ref-storage-format="files://$PWD/store" r1
   Reinitialized existing Git repository in .../r1/.git/
   $ git init --ref-storage-format="files://$PWD/./store" r1
   fatal: attempt to reinitialize repository with different reference 
storage payload

This matches with how we actually make use of the path at runtime in the 
refs_compute_filesystem_location function in refs.c.

Rest of the patch looks good.

-- 
Sivaraam

^ permalink raw reply	[flat|nested] 61+ messages in thread

* Re: [PATCH v2 09/11] setup: rename ref storage format environment variables
  2026-09-07 11:18   ` [PATCH v2 09/11] setup: rename ref storage format environment variables Patrick Steinhardt
@ 2026-09-09  8:10     ` Kaartic Sivaraam
  2026-09-09  9:23       ` Patrick Steinhardt
  0 siblings, 1 reply; 61+ messages in thread
From: Kaartic Sivaraam @ 2026-09-09  8:10 UTC (permalink / raw)
  To: Patrick Steinhardt, git; +Cc: Karthik Nayak, Junio C Hamano

On 9/7/26 16:48, Patrick Steinhardt wrote:
> 
> diff --git a/Documentation/config/init.adoc b/Documentation/config/init.adoc
> index a048f0bddc..f82fcf25e6 100644
> --- a/Documentation/config/init.adoc
> +++ b/Documentation/config/init.adoc
> @@ -16,7 +16,7 @@ endif::[]
>   `init.defaultRefFormat`::
>   	Allows overriding the default ref storage format for new repositories.
>   	See `--ref-storage-format=` in linkgit:git-init[1]. Both the command line
> -	option and the `GIT_DEFAULT_REF_FORMAT` environment variable take
> +	option and the `GIT_DEFAULT_REF_STORAGE_FORMAT` environment variable take
>   	precedence over this config.
>   
>   init.defaultSubmodulePathConfig::
> diff --git a/Documentation/git.adoc b/Documentation/git.adoc
> index 23ba65656e..d78e2b5c10 100644
> --- a/Documentation/git.adoc
> +++ b/Documentation/git.adoc
> @@ -590,15 +590,15 @@ double-quotes and respecting backslash escapes. E.g., the value
>   	is always used. The default is "sha1".
>   	See `--object-format` in linkgit:git-init[1].
>   
> -`GIT_DEFAULT_REF_FORMAT`::
> -	If this variable is set, the default reference backend format for new
> +`GIT_DEFAULT_REF_STORAGE_FORMAT`::
> +	If this variable is set, the default ref storage format for new
>   	repositories will be set to this value. The default is "files".
>   	See `--ref-storage-format` in linkgit:git-init[1].
>   
> -`GIT_REFERENCE_BACKEND`::
> -    Specify which reference backend to be used along with its URI.
> -    See `extensions.refStorage` option in linkgit:git-config[1] for more
> -    details. Overrides the config variable when used.
> +`GIT_REF_STORAGE_FORMAT`::
> +	Specify which ref storage format to use along with its URI.
> +	See `extensions.refStorage` option in linkgit:git-config[1] for more
> +	details. Overrides the config variable when used.
>   

Given rationale about retaining the documentation discussed in another 
mail in this thread, I think we could do so here too.

> @@ -2785,19 +2788,21 @@ static void repository_format_configure(struct repository_format *repo_fmt,
>   	 */
>   	if (ref_storage_format != REF_STORAGE_FORMAT_UNKNOWN) {
>   		/* nothing to do */
> -	} else if ((env = getenv(GIT_REFERENCE_BACKEND_ENVIRONMENT))) {
> +	} else if (((env = getenv(GIT_REF_STORAGE_FORMAT_ENVIRONMENT)) ||
> +		    (env = getenv(GIT_REFERENCE_BACKEND_ENVIRONMENT)))) {
>   		ref_storage_format = ref_storage_format_by_uri(env, &ref_storage_payload);
>   		if (ref_storage_format == REF_STORAGE_FORMAT_UNKNOWN)
>   			die(_("unknown ref storage format specified via %s: '%s'"),
> -			    GIT_REFERENCE_BACKEND_ENVIRONMENT, env);
> +			    GIT_REF_STORAGE_FORMAT_ENVIRONMENT, env);

We're getting the value from GIT_REFERENCE_BACKEND_ENVIRONMENT as a 
fallback but we are mentioning only GIT_REF_STORAGE_FORMAT_ENVIRONMENT 
in the error message. Would this not be misleading if the value actually 
comes from GIT_REFERENCE_BACKEND_ENVIRONMENT?

>   	} else if (repo_fmt->version >= 0) {
>   		ref_storage_format = repo_fmt->ref_storage_format;
>   		ref_storage_payload = xstrdup_or_null(repo_fmt->ref_storage_payload);
> -	} else if ((env = getenv("GIT_DEFAULT_REF_FORMAT"))) {
> +	} else if (((env = getenv("GIT_DEFAULT_REF_STORAGE_FORMAT")) ||
> +		    (env = getenv("GIT_DEFAULT_REF_FORMAT")))) {
>   		ref_storage_format = ref_storage_format_by_name(env);
>   		if (ref_storage_format == REF_STORAGE_FORMAT_UNKNOWN)
>   			die(_("unknown ref storage format specified via %s: '%s'"),
> -			    "GIT_DEFAULT_REF_FORMAT", env);
> +			    "GIT_DEFAULT_REF_STORAGE_FORMAT", env);

Ditto here.

> diff --git a/t/test-lib.sh b/t/test-lib.sh
> index 1f0505e412..60a2179a0a 100644
> --- a/t/test-lib.sh
> +++ b/t/test-lib.sh
> @@ -575,8 +575,8 @@ export EDITOR
>   GIT_TEST_BUILTIN_HASH=$("$GIT_BINARY" version --build-options | sed -ne 's/^default-hash: //p')
>   GIT_DEFAULT_HASH="${GIT_TEST_DEFAULT_HASH:-$GIT_TEST_BUILTIN_HASH}"
>   export GIT_DEFAULT_HASH
> -GIT_DEFAULT_REF_FORMAT="${GIT_TEST_DEFAULT_REF_FORMAT:-files}"
> -export GIT_DEFAULT_REF_FORMAT
> +GIT_DEFAULT_REF_STORAGE_FORMAT="${GIT_TEST_DEFAULT_REF_FORMAT:-files}"
> +export GIT_DEFAULT_REF_STORAGE_FORMAT
>   

Would it make sense to also rename GIT_TEST_DEFAULT_REF_FORMAT to 
GIT_TEST_DEFAULT_REF_STORAGE_FORMAT for consistency sake?

-- 
Sivaraam


^ permalink raw reply	[flat|nested] 61+ messages in thread

* Re: [PATCH v2 11/11] setup: allow "git init --ref-storage-format=" to specify a payload
  2026-09-07 11:18   ` [PATCH v2 11/11] setup: allow "git init --ref-storage-format=" to specify a payload Patrick Steinhardt
@ 2026-09-09  8:54     ` Kaartic Sivaraam
  2026-09-09  9:23       ` Patrick Steinhardt
  0 siblings, 1 reply; 61+ messages in thread
From: Kaartic Sivaraam @ 2026-09-09  8:54 UTC (permalink / raw)
  To: Patrick Steinhardt, git; +Cc: Karthik Nayak, Junio C Hamano

On 9/7/26 16:48, Patrick Steinhardt wrote:
>   
> diff --git a/Documentation/ref-storage-format.adoc b/Documentation/ref-storage-format.adoc
> index c5e29ec831..21d62557b7 100644
> --- a/Documentation/ref-storage-format.adoc
> +++ b/Documentation/ref-storage-format.adoc
> @@ -1,8 +1,12 @@
> -`files`;; for loose files with packed-refs.
> +`files[://<path>]`;; for loose files with packed-refs. The optional payload can
> +be specified to change the root directory where references are created. A
> +relative path will be resolved relative to the repository's common directory.
>   ifndef::with-breaking-changes[]
>   	This is the default.
>   endif::with-breaking-changes[]
> -`reftable`;; for the reftable format.
> +`reftable[://<path>]`;; for the reftable format. The optional payload can
> +be specified to change the root directory where references are created. A
> +relative path will be resolved relative to the repository's common directory.
>   ifdef::with-breaking-changes[]
>   	This is the default.
>   endif::with-breaking-changes[]

I think we need to be a bit more careful when modifying this ascii doc. 
This is also included in Documentation/git-refs.adoc and 
Documentation/git-repo.adoc.

We need to check if support should also be added to the former. For the 
latter, I think the inclusion may be fine since it is only for 
informational purposes.

Rest of the patch looks good to me.

-- 
Sivaraam


^ permalink raw reply	[flat|nested] 61+ messages in thread

* Re: [PATCH v2 01/11] builtin/init: rename "--ref-format=" to "--ref-storage-format="
  2026-09-09  7:00       ` Patrick Steinhardt
@ 2026-09-09  9:14         ` Kaartic Sivaraam
  0 siblings, 0 replies; 61+ messages in thread
From: Kaartic Sivaraam @ 2026-09-09  9:14 UTC (permalink / raw)
  To: Patrick Steinhardt; +Cc: git, Karthik Nayak, Junio C Hamano

On 9/9/26 12:30, Patrick Steinhardt wrote:
> On Tue, Sep 08, 2026 at 02:31:22PM +0530, Kaartic Sivaraam wrote:
> 
> I'm aiming for a a quiet deprecation -- the old options keep on working,
> but we don't show them anymore. We may eventually remove them
> altogether, but I neither want to warn about use of old options now or
> even remove them as that would likely cause more negative consequences
> than is worth it. It's not like we want to soon use the old names.
> 

Understood.

> 
> But I agree that we should keep the old options documented. Otherwise,
> it might be hard to figure out what those options do in case they for
> example still exist in an old script.
> 

Yeah, makes sense.

>>
>> Relevant only if we are deprecating the old option: We could change the
>> description of the old option to convey that it is deprecated so that it
>> could be easily distinguished by anyone reading through. I suggest this by
>> noting a similar pattern in `builtin/name-rev.c` for the `--stdin` argument.
> 
> We don't really have to update the description as we pass
> `PARSE_OPT_HIDDEN` anyway, so the option is not even shown.
>

Indeed. I was suggesting to change the description only for the sake of 
someone who reads the code to quickly get an idea that we have 
deprecated the old names. The PARSE_OPT_HIDDEN would definitely hint at 
it but this just a suggestion to make it more obvious :-)

That said, it's fine if we don't change the description too. It isn't a 
big deal.

>> If we don't plan to deprecate, I suppose we could use OPT_ALIAS to clarify
>> that `ref-format` is an alias of `ref-storage-format` similar to how
>> `recursive` is marked as an alias of `recurse-submodules` in
>> `builtin/clone.c`.
> 
> I was originally planning to use `OPT_ALIAS()`, but we don't seem to
> support `PARSE_OPT_HIDDEN` there. Maybe it's better to add a small
> preparatory patch to support that though.
> 

Indeed. OPT_ALIAS does have that caveat. A patch to allow the alias to 
be hidden by choice would indeed be worthwhile.

-- 
Sivaraam


^ permalink raw reply	[flat|nested] 61+ messages in thread

* Re: [PATCH v2 09/11] setup: rename ref storage format environment variables
  2026-09-09  8:10     ` Kaartic Sivaraam
@ 2026-09-09  9:23       ` Patrick Steinhardt
  0 siblings, 0 replies; 61+ messages in thread
From: Patrick Steinhardt @ 2026-09-09  9:23 UTC (permalink / raw)
  To: Kaartic Sivaraam; +Cc: git, Karthik Nayak, Junio C Hamano

On Wed, Sep 09, 2026 at 01:40:07PM +0530, Kaartic Sivaraam wrote:
> On 9/7/26 16:48, Patrick Steinhardt wrote:
> > @@ -2785,19 +2788,21 @@ static void repository_format_configure(struct repository_format *repo_fmt,
> >   	 */
> >   	if (ref_storage_format != REF_STORAGE_FORMAT_UNKNOWN) {
> >   		/* nothing to do */
> > -	} else if ((env = getenv(GIT_REFERENCE_BACKEND_ENVIRONMENT))) {
> > +	} else if (((env = getenv(GIT_REF_STORAGE_FORMAT_ENVIRONMENT)) ||
> > +		    (env = getenv(GIT_REFERENCE_BACKEND_ENVIRONMENT)))) {
> >   		ref_storage_format = ref_storage_format_by_uri(env, &ref_storage_payload);
> >   		if (ref_storage_format == REF_STORAGE_FORMAT_UNKNOWN)
> >   			die(_("unknown ref storage format specified via %s: '%s'"),
> > -			    GIT_REFERENCE_BACKEND_ENVIRONMENT, env);
> > +			    GIT_REF_STORAGE_FORMAT_ENVIRONMENT, env);
> 
> We're getting the value from GIT_REFERENCE_BACKEND_ENVIRONMENT as a fallback
> but we are mentioning only GIT_REF_STORAGE_FORMAT_ENVIRONMENT in the error
> message. Would this not be misleading if the value actually comes from
> GIT_REFERENCE_BACKEND_ENVIRONMENT?

Yeah, fair. I already had this on my radar, but thought that the
solution was a bit too ugly because it resulted in a bit of duplication.
I was thus sweeping this under the rug a bit, if I'm being totally
honest.

Anyway, will adapt.

> > diff --git a/t/test-lib.sh b/t/test-lib.sh
> > index 1f0505e412..60a2179a0a 100644
> > --- a/t/test-lib.sh
> > +++ b/t/test-lib.sh
> > @@ -575,8 +575,8 @@ export EDITOR
> >   GIT_TEST_BUILTIN_HASH=$("$GIT_BINARY" version --build-options | sed -ne 's/^default-hash: //p')
> >   GIT_DEFAULT_HASH="${GIT_TEST_DEFAULT_HASH:-$GIT_TEST_BUILTIN_HASH}"
> >   export GIT_DEFAULT_HASH
> > -GIT_DEFAULT_REF_FORMAT="${GIT_TEST_DEFAULT_REF_FORMAT:-files}"
> > -export GIT_DEFAULT_REF_FORMAT
> > +GIT_DEFAULT_REF_STORAGE_FORMAT="${GIT_TEST_DEFAULT_REF_FORMAT:-files}"
> > +export GIT_DEFAULT_REF_STORAGE_FORMAT
> 
> Would it make sense to also rename GIT_TEST_DEFAULT_REF_FORMAT to
> GIT_TEST_DEFAULT_REF_STORAGE_FORMAT for consistency sake?

Oh, that one I completely missed. Good catch, thanks!

Patrick

^ permalink raw reply	[flat|nested] 61+ messages in thread

* Re: [PATCH v2 08/11] setup: refactor how we configure the ref storage format
  2026-09-09  8:00     ` Kaartic Sivaraam
@ 2026-09-09  9:23       ` Patrick Steinhardt
  0 siblings, 0 replies; 61+ messages in thread
From: Patrick Steinhardt @ 2026-09-09  9:23 UTC (permalink / raw)
  To: Kaartic Sivaraam; +Cc: git, Karthik Nayak, Junio C Hamano

On Wed, Sep 09, 2026 at 01:30:55PM +0530, Kaartic Sivaraam wrote:
> On 9/7/26 16:48, Patrick Steinhardt wrote:
> > diff --git a/setup.c b/setup.c
> > index 3be7dac452..38fa5e854c 100644
> > --- a/setup.c
> > +++ b/setup.c
> > @@ -2761,40 +2761,65 @@ static void repository_format_configure(struct repository_format *repo_fmt,
> > 
> > ... snip ...
> > -
> > -	ref_backend_uri = getenv(GIT_REFERENCE_BACKEND_ENVIRONMENT);
> > -	if (ref_backend_uri) {
> > -		enum ref_storage_format format;
> > -		char *payload;
> > -
> > -		format = ref_storage_format_by_uri(ref_backend_uri, &payload);
> > -		if (format == REF_STORAGE_FORMAT_UNKNOWN)
> > -			die(_("unknown ref storage format: '%s'"), ref_backend_uri);
> > -
> > -		repo_fmt->ref_storage_format = format;
> > -		free(repo_fmt->ref_storage_payload);
> > -		repo_fmt->ref_storage_payload = payload;
> > -	}
> > +	/*
> > +	 * If we have a preexisting repository we need to verify that its
> > +	 * current ref storage format does not change.
> > +	 */
> > +	if (repo_fmt->version >= 0) {
> > +		if (ref_storage_format != repo_fmt->ref_storage_format)
> > +			die(_("attempt to reinitialize repository with different reference storage format"));
> > +		if ((ref_storage_payload || repo_fmt->ref_storage_payload) &&
> > +		    strcmp(ref_storage_payload ? ref_storage_payload : "",
> > +			   repo_fmt->ref_storage_payload ? repo_fmt->ref_storage_payload : ""))
> 
> Rather than a strcmp, wouldn't it be ideal to do the path comparison using
> strbuf_realpath to make sure we avoid similar paths like the following from
> failing during reinitialization?
> 
>   $ mkdir store
>   $ git init --ref-storage-format="files://$PWD/store" r1
>   Initialized empty Git repository in .../r1/.git/
>   $ git init --ref-storage-format="files://$PWD/store" r1
>   Reinitialized existing Git repository in .../r1/.git/
>   $ git init --ref-storage-format="files://$PWD/./store" r1
>   fatal: attempt to reinitialize repository with different reference storage
> payload
> 
> This matches with how we actually make use of the path at runtime in the
> refs_compute_filesystem_location function in refs.c.

No, because that'd assume that the payload even is a path. But in
theory, it could be anything, like for example a database host to
connect to. In `refs_compute_filesystem_location()` it's a different
thing though as that call happens inside the backends themselves, and
they know what kind of payload to expect.

Patrick

^ permalink raw reply	[flat|nested] 61+ messages in thread

* Re: [PATCH v2 11/11] setup: allow "git init --ref-storage-format=" to specify a payload
  2026-09-09  8:54     ` Kaartic Sivaraam
@ 2026-09-09  9:23       ` Patrick Steinhardt
  0 siblings, 0 replies; 61+ messages in thread
From: Patrick Steinhardt @ 2026-09-09  9:23 UTC (permalink / raw)
  To: Kaartic Sivaraam; +Cc: git, Karthik Nayak, Junio C Hamano

On Wed, Sep 09, 2026 at 02:24:28PM +0530, Kaartic Sivaraam wrote:
> On 9/7/26 16:48, Patrick Steinhardt wrote:
> > diff --git a/Documentation/ref-storage-format.adoc b/Documentation/ref-storage-format.adoc
> > index c5e29ec831..21d62557b7 100644
> > --- a/Documentation/ref-storage-format.adoc
> > +++ b/Documentation/ref-storage-format.adoc
> > @@ -1,8 +1,12 @@
> > -`files`;; for loose files with packed-refs.
> > +`files[://<path>]`;; for loose files with packed-refs. The optional payload can
> > +be specified to change the root directory where references are created. A
> > +relative path will be resolved relative to the repository's common directory.
> >   ifndef::with-breaking-changes[]
> >   	This is the default.
> >   endif::with-breaking-changes[]
> > -`reftable`;; for the reftable format.
> > +`reftable[://<path>]`;; for the reftable format. The optional payload can
> > +be specified to change the root directory where references are created. A
> > +relative path will be resolved relative to the repository's common directory.
> >   ifdef::with-breaking-changes[]
> >   	This is the default.
> >   endif::with-breaking-changes[]
> 
> I think we need to be a bit more careful when modifying this ascii doc. This
> is also included in Documentation/git-refs.adoc and
> Documentation/git-repo.adoc.
> 
> We need to check if support should also be added to the former. For the
> latter, I think the inclusion may be fine since it is only for informational
> purposes.

Yeha, for git-repo(1) it's a good change even, I'd argue. But for the
former I'd also argue that git-refs(1) itself should learn to use URIs
here. But that's a bigger change, and one that I'd rather avoid doing as
part of this already-huge patch series.

You know, I'll probably keep this specific change out and only change
documentation of git-init(1) and git-clone(1) for now.

Thanks!

Patrick

^ permalink raw reply	[flat|nested] 61+ messages in thread

* [PATCH v3 00/13] Fix inconsistent ref storage format terminology
  2026-09-04 10:36 [PATCH 00/11] Fix inconsistent ref storage format terminology Patrick Steinhardt
                   ` (13 preceding siblings ...)
  2026-09-07 11:18 ` [PATCH v2 " Patrick Steinhardt
@ 2026-09-09 11:12 ` Patrick Steinhardt
  2026-09-09 11:12   ` [PATCH v3 01/13] parse-options: allow for hidden aliases Patrick Steinhardt
                     ` (12 more replies)
  14 siblings, 13 replies; 61+ messages in thread
From: Patrick Steinhardt @ 2026-09-09 11:12 UTC (permalink / raw)
  To: git; +Cc: Karthik Nayak, Junio C Hamano, Kaartic Sivaraam

Hi,

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 a lot of 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 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=reftable --object-format=sha256 --object-storage=foo`
    just feels extremely awkward.

So this patch series aims to clean up this huge mess that we (well, to a
large extent I) have created, by bringing consistency to our command
line switches, environment variables and config options to all use "ref
storage format" instead. And that also paves the way for the eventual
"object storage format" switches.

As a cherry on top, this patch series also extends the
"--ref-storage-format=" switch to allow URIs in the form of
"files://foo/bar" to bring it in line with all the other ways to specify
the ref storage format that already allow for URIs.

Changes in v3:
  - Add breadcrumbs for the old names to our documentation.
  - Use `OPT_ALIAS()` instead of manually aliasing the options.
  - Fix a comment in one of our tests that still referred to the v1
    "--ref-storage=" option.
  - Print the correct environment variables in error messages.
  - Also rename GIT_TEST_DEFAULT_REF_FORMAT.
  - Don't adapt "ref-storage-format.adoc", as that documentation is also
    shared with commands that don't support URIs yet.
  - Link to v2: https://patch.msgid.link/20260907-b4-pks-unify-ref-storage-format-v2-0-6733c90ca5b0@pks.im

Changes in v2:
  - Based on Junio's feedback I've renamed all of this to instead be
    called "ref storage format".
  - Link to v1: https://patch.msgid.link/20260904-b4-pks-unify-ref-storage-format-v1-0-08144e5004ff@pks.im

Thanks!

Patrick

---
Patrick Steinhardt (13):
      parse-options: allow for hidden aliases
      builtin/init: rename "--ref-format=" to "--ref-storage-format="
      builtin/clone: rename "--ref-format=" to "--ref-storage-format="
      builtin/refs: rename "--ref-format=" to "--ref-storage-format="
      builtin/submodule: rename "--ref-format=" to "--ref-storage-format="
      builtin/rev-parse: rename "--show-ref-format" to "--show-ref-storage-format"
      help: rename "default-ref-format" to "default-ref-storage-format"
      refs: expose function to parse reference URIs
      setup: refactor how we configure the ref storage format
      setup: rename ref storage format environment variables
      t: rename GIT_TEST_DEFAULT_REF_FORMAT
      setup: rename "init.defaultRefFormat" to "init.defaultRefStorageFormat"
      setup: allow "--ref-storage-format=" to specify a payload

 Documentation/BreakingChanges.adoc     |   2 +-
 Documentation/config/feature.adoc      |   2 +-
 Documentation/config/init.adoc         |   8 +-
 Documentation/git-clone.adoc           |  10 +-
 Documentation/git-init.adoc            |  12 ++-
 Documentation/git-refs.adoc            |   9 +-
 Documentation/git-rev-parse.adoc       |   5 +-
 Documentation/git-submodule.adoc       |  14 +--
 Documentation/git.adoc                 |  18 ++--
 builtin/clone.c                        |  17 ++--
 builtin/fetch.c                        |   2 +-
 builtin/init-db.c                      |  20 ++--
 builtin/refs.c                         |   9 +-
 builtin/rev-parse.c                    |   2 +-
 builtin/submodule--helper.c            |  21 ++--
 ci/run-build-and-tests.sh              |   2 +-
 contrib/completion/git-prompt.sh       |   2 +-
 environment.h                          |   1 +
 git-submodule.sh                       |  20 ++--
 help.c                                 |   2 +-
 parse-options.c                        |   4 +-
 parse-options.h                        |   5 +-
 refs.c                                 |  23 +++++
 refs.h                                 |   4 +
 setup.c                                | 175 +++++++++++++++++++--------------
 setup.h                                |   2 +-
 t/README                               |   4 +-
 t/perf/p1401-ref-store-tombstones.sh   |   4 +-
 t/perf/perf-lib.sh                     |   4 +-
 t/t0001-init.sh                        | 126 +++++++++++++-----------
 t/t0600-reffiles-backend.sh            |   4 +-
 t/t0601-reffiles-pack-refs.sh          |   4 +-
 t/t0602-reffiles-fsck.sh               |   4 +-
 t/t0610-reftable-basics.sh             |  38 +++----
 t/t0611-reftable-httpd.sh              |   2 +-
 t/t0612-reftable-jgit-compatibility.sh |   4 +-
 t/t0613-reftable-write-options.sh      |   4 +-
 t/t0614-reftable-fsck.sh               |   4 +-
 t/t1400-update-ref.sh                  |   2 +-
 t/t1419-exclude-refs.sh                |  16 +--
 t/t1423-ref-backend.sh                 |  62 +++++++++---
 t/t1460-refs-migrate.sh                |  54 +++++-----
 t/t1463-refs-optimize.sh               |   4 +-
 t/t1500-rev-parse.sh                   |   8 +-
 t/t1900-repo-info.sh                   |   6 +-
 t/t5510-fetch.sh                       |  14 +--
 t/t5601-clone.sh                       |   6 +-
 t/t7424-submodule-mixed-ref-formats.sh |  30 +++---
 t/test-lib-functions.sh                |   2 +-
 t/test-lib.sh                          |   8 +-
 50 files changed, 465 insertions(+), 340 deletions(-)

Range-diff versus v2:

 -:  ---------- >  1:  0f7f8494b2 parse-options: allow for hidden aliases
 1:  0cebb933a4 !  2:  f837dbb9f2 builtin/init: rename "--ref-format=" to "--ref-storage-format="
    @@ Documentation/git-init.adoc: values are `sha1` and (if enabled) `sha256`.  `sha1
      Specify the given ref storage _<format>_ for the repository. The valid values are:
      +
      include::ref-storage-format.adoc[]
    + 
    ++`--ref-format=<format>`::
    ++Deprecated alias of `--ref-storage-format=<format>`.
    ++
    + `--template=<template-directory>`::
    + Specify the directory from which templates will be used.  (See the "TEMPLATE
    + DIRECTORY" section below.)
     
      ## Documentation/git.adoc ##
     @@ Documentation/git.adoc: double-quotes and respecting backslash escapes. E.g., the value
    @@ builtin/init-db.c: int cmd_init_db(int argc,
     -			   N_("specify the reference format to use")),
     +		OPT_STRING(0, "ref-storage-format", &ref_storage_format_str, N_("format"),
     +			   N_("specify the reference storage format to use")),
    -+		OPT_STRING_F(0, "ref-format", &ref_storage_format_str, N_("format"),
    -+			   N_("specify the reference storage format to use"), PARSE_OPT_HIDDEN),
    ++		OPT_ALIAS_F(0, "ref-format", "ref-storage-format", PARSE_OPT_HIDDEN),
      		OPT_END()
      	};
      	int ret;
 2:  c170c3f889 !  3:  693dcc7a24 builtin/clone: rename "--ref-format=" to "--ref-storage-format="
    @@ Documentation/git-clone.adoc: or `--mirror` is given)
      
      Specify the given ref storage format for the repository. The valid values are:
      +
    + include::ref-storage-format.adoc[]
    + 
    ++`--ref-format=<format>`::
    ++Deprecated alias of `--ref-storage-format=<format>`.
    ++
    + `-j<n>`::
    + `--jobs=<n>`::
    + 	The number of submodules fetched at the same time.
     
      ## builtin/clone.c ##
     @@ builtin/clone.c: int cmd_clone(int argc,
    @@ builtin/clone.c: int cmd_clone(int argc,
     -			   N_("specify the reference format to use")),
     +		OPT_STRING(0, "ref-storage-format", &ref_storage_format_str, N_("format"),
     +			   N_("specify the reference storage format to use")),
    -+		OPT_STRING_F(0, "ref-format", &ref_storage_format_str, N_("format"),
    -+			   N_("specify the reference storage format to use"), PARSE_OPT_HIDDEN),
    ++		OPT_ALIAS_F(0, "ref-format", "ref-storage-format", PARSE_OPT_HIDDEN),
      		OPT_STRING_LIST('c', "config", &option_config, N_("key=value"),
      				N_("set config inside the new repository")),
      		OPT_STRING_LIST(0, "server-option", &server_options,
    @@ t/t7424-submodule-mixed-ref-formats.sh: test_expect_success 'recursive clone pro
      
      	# The cloned repositories should use the other ref format that we have
     -	# specified via `--ref-format`. The option should propagate to cloned
    -+	# specified via `--ref-storage`. The option should propagate to cloned
    ++	# specified via `--ref-storage-format`. The option should propagate to cloned
      	# submodules.
     -	git clone --ref-format=$OTHER_FORMAT --recurse-submodules \
     +	git clone --ref-storage-format=$OTHER_FORMAT --recurse-submodules \
 3:  ce71f5c6de !  4:  ac7745edc0 builtin/refs: rename "--ref-format=" to "--ref-storage-format="
    @@ Documentation/git-refs.adoc: OPTIONS
      +
      include::ref-storage-format.adoc[]
      
    ++`--ref-format=<format>`::
    ++Deprecated alias of `--ref-storage-format=<format>`.
    ++
    + `--dry-run`::
    + 	Perform the migration, but do not modify the repository. The migrated
    + 	refs will be written into a separate directory that can be inspected
     
      ## builtin/fetch.c ##
     @@ builtin/fetch.c: static void ref_transaction_rejection_handler(const char *refname,
    @@ builtin/refs.c: static int cmd_refs_migrate(int argc, const char **argv, const c
     +		OPT_STRING_F(0, "ref-storage-format", &format_str, N_("format"),
     +			N_("specify the reference storage format to convert to"),
      			PARSE_OPT_NONEG),
    -+		OPT_STRING_F(0, "ref-format", &format_str, N_("format"),
    -+			N_("specify the reference storage format to convert to"),
    -+			PARSE_OPT_NONEG | PARSE_OPT_HIDDEN),
    ++		OPT_ALIAS_F(0, "ref-format", "ref-storage-format", PARSE_OPT_HIDDEN),
      		OPT_BIT(0, "dry-run", &flags,
      			N_("perform a non-destructive dry-run"),
      			REPO_MIGRATE_REF_STORAGE_FORMAT_DRYRUN),
 4:  576ae81258 !  5:  2971bd413c builtin/submodule: rename "--ref-format=" to "--ref-storage-format="
    @@ Documentation/git-submodule.adoc: location, and only the superproject's URL need
      URL in `.gitmodules`.
      +
     -If `--ref-format <format>`  is specified, the ref storage format of newly
    -+If `--ref-storage-format <format>`  is specified, the ref storage format of newly
    - cloned submodules will be set accordingly.
    +-cloned submodules will be set accordingly.
    ++If `--ref-storage-format <format>` or its deprecated alias `--ref-format
    ++<format>` is specified, the ref storage format of the newly cloned submodules
    ++will be set accordingly.
      
      `status [--cached] [--recursive] [--] [<path>...]`::
    + 	Show the status of the submodules. This will print the SHA-1 of the
     @@ Documentation/git-submodule.adoc: If you really want to remove a submodule from the repository and commit
      that use linkgit:git-rm[1] instead. See linkgit:gitsubmodules[7] for removal
      options.
    @@ Documentation/git-submodule.adoc: submodule with the `--init` option.
      registered submodules, and update any nested submodules within.
      
     -If `--ref-format <format>`  is specified, the ref storage format of newly
    -+If `--ref-storage-format <format>`  is specified, the ref storage format of newly
    - cloned submodules will be set accordingly.
    +-cloned submodules will be set accordingly.
    ++If `--ref-storage-format <format>` or its deprecated alias `--ref-format
    ++<format>` is specified, the ref storage format of the newly cloned submodules
    ++will be set accordingly.
      
      If `--filter <filter-spec>` is specified, the given partial clone filter will be
    + applied to the submodule. See linkgit:git-rev-list[1] for details on filter
     
      ## builtin/clone.c ##
     @@ builtin/clone.c: static int checkout(int submodule_progress,
    @@ builtin/submodule--helper.c: static int module_clone(int argc, const char **argv
     -			   N_("specify the reference format to use")),
     +		OPT_STRING(0, "ref-storage-format", &ref_storage_format, N_("format"),
     +			   N_("specify the reference storage format to use")),
    -+		OPT_STRING_F(0, "ref-format", &ref_storage_format, N_("format"),
    -+			     N_("specify the reference storage format to use"), PARSE_OPT_HIDDEN),
    ++		OPT_ALIAS_F(0, "ref-format", "ref-storage-format", PARSE_OPT_HIDDEN),
      		OPT_BOOL(0, "dissociate", &dissociate,
      			   N_("use --reference only while cloning")),
      		OPT_INTEGER(0, "depth", &clone_data.depth,
    @@ builtin/submodule--helper.c: static int module_update(int argc, const char **arg
     -			   N_("specify the reference format to use")),
     +		OPT_STRING(0, "ref-storage-format", &ref_storage_format, N_("format"),
     +			   N_("specify the reference storage format to use")),
    -+		OPT_STRING_F(0, "ref-format", &ref_storage_format, N_("format"),
    -+			     N_("specify the reference storage format to use"), PARSE_OPT_HIDDEN),
    ++		OPT_ALIAS_F(0, "ref-format", "ref-storage-format", PARSE_OPT_HIDDEN),
      		OPT_BOOL(0, "dissociate", &opt.dissociate,
      			   N_("use --reference only while cloning")),
      		OPT_INTEGER(0, "depth", &opt.depth,
    @@ builtin/submodule--helper.c: static int module_add(int argc, const char **argv,
     -			   N_("specify the reference format to use")),
     +		OPT_STRING(0, "ref-storage-format", &ref_storage_format, N_("format"),
     +			   N_("specify the reference storage format to use")),
    -+		OPT_STRING_F(0, "ref-format", &ref_storage_format, N_("format"),
    -+			     N_("specify the reference storage format to use"), PARSE_OPT_HIDDEN),
    ++		OPT_ALIAS_F(0, "ref-format", "ref-storage-format", PARSE_OPT_HIDDEN),
      		OPT_BOOL(0, "dissociate", &dissociate, N_("borrow the objects from reference repositories")),
      		OPT_STRING(0, "name", &add_data.sm_name, N_("name"),
      			   N_("sets the submodule's name to the given string "
    @@ t/t7424-submodule-mixed-ref-formats.sh: test_expect_success 'add submodules with
      	test_ref_format upstream/submodule "$OTHER_FORMAT"
      '
      
    -@@ t/t7424-submodule-mixed-ref-formats.sh: test_expect_success 'recursive clone propagates ref storage format' '
    - 	test_ref_format upstream/submodule "$GIT_DEFAULT_REF_FORMAT" &&
    - 
    - 	# The cloned repositories should use the other ref format that we have
    --	# specified via `--ref-storage`. The option should propagate to cloned
    -+	# specified via `--ref-storage-format`. The option should propagate to cloned
    - 	# submodules.
    - 	git clone --ref-storage-format=$OTHER_FORMAT --recurse-submodules \
    - 		upstream downstream &&
     @@ t/t7424-submodule-mixed-ref-formats.sh: test_expect_success 'clone submodules with different ref storage format' '
      
      	git clone --no-recurse-submodules "file://$(pwd)/upstream" downstream &&
 5:  7e052492a5 !  6:  df63f371f0 builtin/rev-parse: rename "--show-ref-format" to "--show-ref-storage-format"
    @@ Documentation/git-rev-parse.adoc: The following options are unaffected by `--pat
     +--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
    + ~~~~~~~~~~~~~
     
      ## builtin/rev-parse.c ##
     @@ builtin/rev-parse.c: int cmd_rev_parse(int argc,
 6:  860a12c036 =  7:  230e87bc3f help: rename "default-ref-format" to "default-ref-storage-format"
 7:  b2f66d143e =  8:  4e6e92f936 refs: expose function to parse reference URIs
 8:  0573eb69f6 =  9:  80f5e37350 setup: refactor how we configure the ref storage format
 9:  32167facdd ! 10:  20d5f660f8 setup: rename ref storage format environment variables
    @@ Documentation/git.adoc: double-quotes and respecting backslash escapes. E.g., th
      	repositories will be set to this value. The default is "files".
      	See `--ref-storage-format` in linkgit:git-init[1].
      
    --`GIT_REFERENCE_BACKEND`::
    --    Specify which reference backend to be used along with its URI.
    --    See `extensions.refStorage` option in linkgit:git-config[1] for more
    --    details. Overrides the config variable when used.
    ++`GIT_DEFAULT_REF_FORMAT`::
    ++	Deprecated alias of `GIT_DEFAULT_REF_STORAGE_FORMAT`.
    ++
     +`GIT_REF_STORAGE_FORMAT`::
     +	Specify which ref storage format to use along with its URI.
     +	See `extensions.refStorage` option in linkgit:git-config[1] for more
     +	details. Overrides the config variable when used.
    ++
    + `GIT_REFERENCE_BACKEND`::
    +-    Specify which reference backend to be used along with its URI.
    +-    See `extensions.refStorage` option in linkgit:git-config[1] for more
    +-    details. Overrides the config variable when used.
    ++	Deprecated alias of `GIT_REF_STORAGE_FORMAT`.
      
      Git Commits
      ~~~~~~~~~~~
    @@ setup.c: const char *setup_git_directory_gently(struct repository *repo, int *no
      				FREE_AND_NULL(discovery.format.ref_storage_payload);
      				discovery.format.ref_storage_format =
     @@ setup.c: static void repository_format_configure(struct repository_format *repo_fmt,
    - 	 *   1. Explicit override via the command line, like in `git init
      	 *      --ref-storage-format=`.
      	 *
    --	 *   2. Explicit override via the environment with
    + 	 *   2. Explicit override via the environment with
     -	 *      GIT_REFERENCE_BACKEND.
    -+	 *   2. Explicit override via the environment with "GIT_REF_STORAGE_FORMAT"
    -+	 *      or its deprecated equivalent "GIT_REFERENCE_BACKEND".
    ++	 *      "GIT_REF_STORAGE_FORMAT".
      	 *
    - 	 *   3. Existing repository format. All the subsequent sources only
    +-	 *   3. Existing repository format. All the subsequent sources only
    ++	 *   3. Its deprecated equivalent "GIT_REFERENCE_BACKEND".
    ++	 *
    ++	 *   4. Existing repository format. All the subsequent sources only
      	 *      kick in when there is no repository yet.
      	 *
      	 *   4. The default ref storage format for new repositories as
     -	 *      configured via "GIT_DEFAULT_REF_FORMAT".
    -+	 *      configured via "GIT_DEFAULT_REF_STORAGE_FORMAT" or its
    -+	 *      deprecated equivalent "GIT_DEFAULT_REF_FORMAT".
    ++	 *      configured via "GIT_DEFAULT_REF_STORAGE_FORMAT".
    ++	 *
    ++	 *   5. Its deprecated equivalent "GIT_DEFAULT_REF_FORMAT".
      	 *
    - 	 *   5. The default ref storage format for new repositories as
    +-	 *   5. The default ref storage format for new repositories as
    ++	 *   6. The default ref storage format for new repositories as
      	 *      configured via "init.defaultRefFormat"
    -@@ setup.c: static void repository_format_configure(struct repository_format *repo_fmt,
    + 	 *
    +-	 *   6. Otherwise, we fall back to the default ref storage format
    ++	 *   7. Otherwise, we fall back to the default ref storage format
    + 	 *      compiled into Git.
      	 */
      	if (ref_storage_format != REF_STORAGE_FORMAT_UNKNOWN) {
      		/* nothing to do */
    --	} else if ((env = getenv(GIT_REFERENCE_BACKEND_ENVIRONMENT))) {
    -+	} else if (((env = getenv(GIT_REF_STORAGE_FORMAT_ENVIRONMENT)) ||
    -+		    (env = getenv(GIT_REFERENCE_BACKEND_ENVIRONMENT)))) {
    ++	} else if ((env = getenv(GIT_REF_STORAGE_FORMAT_ENVIRONMENT))) {
    ++		ref_storage_format = ref_storage_format_by_uri(env, &ref_storage_payload);
    ++		if (ref_storage_format == REF_STORAGE_FORMAT_UNKNOWN)
    ++			die(_("unknown ref storage format specified via %s: '%s'"),
    ++			    GIT_REF_STORAGE_FORMAT_ENVIRONMENT, env);
    + 	} else if ((env = getenv(GIT_REFERENCE_BACKEND_ENVIRONMENT))) {
      		ref_storage_format = ref_storage_format_by_uri(env, &ref_storage_payload);
      		if (ref_storage_format == REF_STORAGE_FORMAT_UNKNOWN)
    - 			die(_("unknown ref storage format specified via %s: '%s'"),
    --			    GIT_REFERENCE_BACKEND_ENVIRONMENT, env);
    -+			    GIT_REF_STORAGE_FORMAT_ENVIRONMENT, env);
    +@@ setup.c: static void repository_format_configure(struct repository_format *repo_fmt,
      	} else if (repo_fmt->version >= 0) {
      		ref_storage_format = repo_fmt->ref_storage_format;
      		ref_storage_payload = xstrdup_or_null(repo_fmt->ref_storage_payload);
    --	} else if ((env = getenv("GIT_DEFAULT_REF_FORMAT"))) {
    -+	} else if (((env = getenv("GIT_DEFAULT_REF_STORAGE_FORMAT")) ||
    -+		    (env = getenv("GIT_DEFAULT_REF_FORMAT")))) {
    ++	} else if ((env = getenv("GIT_DEFAULT_REF_STORAGE_FORMAT"))) {
    ++		ref_storage_format = ref_storage_format_by_name(env);
    ++		if (ref_storage_format == REF_STORAGE_FORMAT_UNKNOWN)
    ++			die(_("unknown ref storage format specified via %s: '%s'"),
    ++			    "GIT_DEFAULT_REF_STORAGE_FORMAT", env);
    + 	} else if ((env = getenv("GIT_DEFAULT_REF_FORMAT"))) {
      		ref_storage_format = ref_storage_format_by_name(env);
      		if (ref_storage_format == REF_STORAGE_FORMAT_UNKNOWN)
    - 			die(_("unknown ref storage format specified via %s: '%s'"),
    --			    "GIT_DEFAULT_REF_FORMAT", env);
    -+			    "GIT_DEFAULT_REF_STORAGE_FORMAT", env);
    - 	} else if (cfg.ref_storage_format != REF_STORAGE_FORMAT_UNKNOWN) {
    - 		ref_storage_format = cfg.ref_storage_format;
    - 	} else {
     
      ## t/t0001-init.sh ##
     @@ t/t0001-init.sh: test_expect_success DEFAULT_REPO_FORMAT 'extensions.refStorage with unknown back
 -:  ---------- > 11:  bf4e73796a t: rename GIT_TEST_DEFAULT_REF_FORMAT
10:  feb6ab56d6 ! 12:  75d21c088f setup: rename "init.defaultRefFormat" to "init.defaultRefStorageFormat"
    @@ Documentation/config/init.adoc: endif::[]
      	Allows overriding the default ref storage format for new repositories.
      	See `--ref-storage-format=` in linkgit:git-init[1]. Both the command line
      	option and the `GIT_DEFAULT_REF_STORAGE_FORMAT` environment variable take
    + 	precedence over this config.
    ++`init.defaultRefFormat`::
    ++	Deprecated alias of `init.defaultRefStorageFormat`.
    + 
    + init.defaultSubmodulePathConfig::
    + 	A boolean that specifies if `git init` and `git clone` should
     
      ## setup.c ##
     @@ setup.c: static int read_default_format_config(const char *key, const char *value,
    @@ setup.c: static int read_default_format_config(const char *key, const char *valu
      	if (!strcmp(key, "feature.experimental") &&
      	    cfg->ref_storage_format == REF_STORAGE_FORMAT_UNKNOWN &&
     @@ setup.c: static void repository_format_configure(struct repository_format *repo_fmt,
    - 	 *      deprecated equivalent "GIT_DEFAULT_REF_FORMAT".
    + 	 *   5. Its deprecated equivalent "GIT_DEFAULT_REF_FORMAT".
      	 *
    - 	 *   5. The default ref storage format for new repositories as
    + 	 *   6. The default ref storage format for new repositories as
     -	 *      configured via "init.defaultRefFormat"
     +	 *      configured via "init.defaultRefStorageFormat" or its deprecated
     +	 *      equivalent "init.defaultRefFormat".
      	 *
    - 	 *   6. Otherwise, we fall back to the default ref storage format
    + 	 *   7. Otherwise, we fall back to the default ref storage format
      	 *      compiled into Git.
     
      ## t/t0001-init.sh ##
11:  b0c5523790 ! 13:  894675e619 setup: allow "git init --ref-storage-format=" to specify a payload
    @@ Metadata
     Author: Patrick Steinhardt <ps@pks.im>
     
      ## Commit message ##
    -    setup: allow "git init --ref-storage-format=" to specify a payload
    +    setup: allow "--ref-storage-format=" to specify a payload
     
         Reference storage backends can be configured with a payload via the
         "extensions.refStorage" config key and the "GIT_REF_STORAGE_FORMAT"
    @@ Commit message
     
         Signed-off-by: Patrick Steinhardt <ps@pks.im>
     
    + ## Documentation/git-clone.adoc ##
    +@@ Documentation/git-clone.adoc: or `--mirror` is given)
    + 
    + `--ref-storage-format=<format>`::
    + 
    +-Specify the given ref storage format for the repository. The valid values are:
    ++Specify the given ref storage _<format>_ for the repository. Backends that
    ++require additional configuration accept a payload in the form
    ++`<format>://<payload>`, for example a connection string identifying the
    ++database that shall store the references. The valid values are:
    + +
    + include::ref-storage-format.adoc[]
    + 
    +
      ## Documentation/git-init.adoc ##
     @@ Documentation/git-init.adoc: values are `sha1` and (if enabled) `sha256`.  `sha1` is the default.
      include::object-format-disclaimer.adoc[]
    @@ Documentation/git-init.adoc: values are `sha1` and (if enabled) `sha256`.  `sha1
      include::ref-storage-format.adoc[]
      
     
    - ## Documentation/ref-storage-format.adoc ##
    -@@
    --`files`;; for loose files with packed-refs.
    -+`files[://<path>]`;; for loose files with packed-refs. The optional payload can
    -+be specified to change the root directory where references are created. A
    -+relative path will be resolved relative to the repository's common directory.
    - ifndef::with-breaking-changes[]
    - 	This is the default.
    - endif::with-breaking-changes[]
    --`reftable`;; for the reftable format.
    -+`reftable[://<path>]`;; for the reftable format. The optional payload can
    -+be specified to change the root directory where references are created. A
    -+relative path will be resolved relative to the repository's common directory.
    - ifdef::with-breaking-changes[]
    - 	This is the default.
    - endif::with-breaking-changes[]
    -
      ## builtin/clone.c ##
     @@ builtin/clone.c: int cmd_clone(int argc,
      	char *option_origin = NULL;
    @@ builtin/clone.c: int cmd_clone(int argc,
     -		OPT_STRING(0, "ref-storage-format", &ref_storage_format_str, N_("format"),
     +		OPT_STRING(0, "ref-storage-format", &ref_storage_format_uri, N_("format"),
      			   N_("specify the reference storage format to use")),
    --		OPT_STRING_F(0, "ref-format", &ref_storage_format_str, N_("format"),
    -+		OPT_STRING_F(0, "ref-format", &ref_storage_format_uri, N_("format"),
    - 			   N_("specify the reference storage format to use"), PARSE_OPT_HIDDEN),
    + 		OPT_ALIAS_F(0, "ref-format", "ref-storage-format", PARSE_OPT_HIDDEN),
      		OPT_STRING_LIST('c', "config", &option_config, N_("key=value"),
    - 				N_("set config inside the new repository")),
     @@ builtin/clone.c: int cmd_clone(int argc,
      	if (option_single_branch == -1)
      		option_single_branch = deepen ? 1 : 0;
    @@ builtin/init-db.c: int cmd_init_db(int argc,
     -		OPT_STRING(0, "ref-storage-format", &ref_storage_format_str, N_("format"),
     +		OPT_STRING(0, "ref-storage-format", &ref_storage_format_uri, N_("format"),
      			   N_("specify the reference storage format to use")),
    --		OPT_STRING_F(0, "ref-format", &ref_storage_format_str, N_("format"),
    -+		OPT_STRING_F(0, "ref-format", &ref_storage_format_uri, N_("format"),
    - 			   N_("specify the reference storage format to use"), PARSE_OPT_HIDDEN),
    + 		OPT_ALIAS_F(0, "ref-format", "ref-storage-format", PARSE_OPT_HIDDEN),
      		OPT_END()
    - 	};
     @@ builtin/init-db.c: int cmd_init_db(int argc,
      			die(_("unknown hash algorithm '%s'"), object_format);
      	}
    @@ setup.c: static void repository_format_configure(struct repository_format *repo_
      	const char *env;
      
     @@ setup.c: static void repository_format_configure(struct repository_format *repo_fmt,
    - 	 *   6. Otherwise, we fall back to the default ref storage format
    + 	 *   7. Otherwise, we fall back to the default ref storage format
      	 *      compiled into Git.
      	 */
     -	if (ref_storage_format != REF_STORAGE_FORMAT_UNKNOWN) {
    @@ setup.c: static void repository_format_configure(struct repository_format *repo_
     +		if (ref_storage_format == REF_STORAGE_FORMAT_UNKNOWN)
     +			die(_("unknown ref storage format specified via command line: '%s'"),
     +			    ref_storage_format_uri);
    - 	} else if (((env = getenv(GIT_REF_STORAGE_FORMAT_ENVIRONMENT)) ||
    - 		    (env = getenv(GIT_REFERENCE_BACKEND_ENVIRONMENT)))) {
    + 	} else if ((env = getenv(GIT_REF_STORAGE_FORMAT_ENVIRONMENT))) {
      		ref_storage_format = ref_storage_format_by_uri(env, &ref_storage_payload);
    + 		if (ref_storage_format == REF_STORAGE_FORMAT_UNKNOWN)
     @@ setup.c: int init_db(struct repository *repo,
      	    const char *real_git_dir,
      	    const char *worktree,

---
base-commit: 3cb9185f65410273787f74333cc027d2ea5daada
change-id: 20260904-b4-pks-unify-ref-storage-format-0c81fb038671


^ permalink raw reply	[flat|nested] 61+ messages in thread

* [PATCH v3 01/13] parse-options: allow for hidden aliases
  2026-09-09 11:12 ` [PATCH v3 00/13] Fix inconsistent ref storage format terminology Patrick Steinhardt
@ 2026-09-09 11:12   ` Patrick Steinhardt
  2026-09-09 11:12   ` [PATCH v3 02/13] builtin/init: rename "--ref-format=" to "--ref-storage-format=" Patrick Steinhardt
                     ` (11 subsequent siblings)
  12 siblings, 0 replies; 61+ messages in thread
From: Patrick Steinhardt @ 2026-09-09 11:12 UTC (permalink / raw)
  To: git; +Cc: Karthik Nayak, Junio C Hamano, Kaartic Sivaraam

The `OPT_ALIAS()` option can be used to create an exact alias that maps
one option name to the same semantics as another option name. This
option type is especially useful when deprecating an old name in favor
of a new one. But curiously enough, we don't have the infrastructure in
place to properly support this use case because we don't expose the
ability to hide the alias via `PARSE_OPT_HIDDEN`.

Introduce a new `OPT_ALIAS_F()` function that allows the user to pass
flags and propagate these flags when rewriting aliases to match their
respective source options.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
 parse-options.c | 4 +++-
 parse-options.h | 5 ++++-
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/parse-options.c b/parse-options.c
index 4519ead9dc..51a49792d1 100644
--- a/parse-options.c
+++ b/parse-options.c
@@ -925,6 +925,7 @@ static struct option *preprocess_options(struct parse_opt_ctx_t *ctx,
 		const char *long_name;
 		const char *source;
 		struct strbuf help = STRBUF_INIT;
+		enum parse_opt_option_flags flags;
 		int j;
 
 		if (newopt[i].type != OPTION_ALIAS)
@@ -933,6 +934,7 @@ static struct option *preprocess_options(struct parse_opt_ctx_t *ctx,
 		short_name = newopt[i].short_name;
 		long_name = newopt[i].long_name;
 		source = newopt[i].value;
+		flags = newopt[i].flags;
 
 		if (!long_name)
 			BUG("An alias must have long option name");
@@ -951,7 +953,7 @@ static struct option *preprocess_options(struct parse_opt_ctx_t *ctx,
 			newopt[i].short_name = short_name;
 			newopt[i].long_name = long_name;
 			newopt[i].help = strbuf_detach(&help, NULL);
-			newopt[i].flags |= PARSE_OPT_FROM_ALIAS;
+			newopt[i].flags |= flags | PARSE_OPT_FROM_ALIAS;
 			break;
 		}
 
diff --git a/parse-options.h b/parse-options.h
index d7f896a933..a0b30f3c04 100644
--- a/parse-options.h
+++ b/parse-options.h
@@ -386,13 +386,16 @@ static char *parse_options_noop_ignored_value MAYBE_UNUSED;
 	.callback = parse_opt_noop_cb, \
 }
 
-#define OPT_ALIAS(s, l, source_long_name) { \
+#define OPT_ALIAS_F(s, l, source_long_name, f) { \
 	.type = OPTION_ALIAS, \
 	.short_name = (s), \
 	.long_name = (l), \
 	.value = (char *)(source_long_name), \
+	.flags = (f), \
 }
 
+#define OPT_ALIAS(s, l, source_long_name) OPT_ALIAS_F(s, l, source_long_name, 0)
+
 #define OPT_SUBCOMMAND_F(l, v, fn, f) { \
 	.type = OPTION_SUBCOMMAND, \
 	.long_name = (l), \

-- 
2.55.0.1074.ge7621b4bad.dirty


^ permalink raw reply related	[flat|nested] 61+ messages in thread

* [PATCH v3 02/13] builtin/init: rename "--ref-format=" to "--ref-storage-format="
  2026-09-09 11:12 ` [PATCH v3 00/13] Fix inconsistent ref storage format terminology Patrick Steinhardt
  2026-09-09 11:12   ` [PATCH v3 01/13] parse-options: allow for hidden aliases Patrick Steinhardt
@ 2026-09-09 11:12   ` Patrick Steinhardt
  2026-09-09 11:12   ` [PATCH v3 03/13] builtin/clone: " Patrick Steinhardt
                     ` (10 subsequent siblings)
  12 siblings, 0 replies; 61+ messages in thread
From: Patrick Steinhardt @ 2026-09-09 11:12 UTC (permalink / raw)
  To: git; +Cc: Karthik Nayak, Junio C Hamano, Kaartic Sivaraam

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>
---
 Documentation/config/init.adoc         |  2 +-
 Documentation/git-init.adoc            |  7 +++++--
 Documentation/git.adoc                 |  2 +-
 builtin/init-db.c                      | 15 +++++++-------
 t/perf/p1401-ref-store-tombstones.sh   |  4 ++--
 t/perf/perf-lib.sh                     |  2 +-
 t/t0001-init.sh                        | 24 +++++++++++------------
 t/t0610-reftable-basics.sh             | 14 ++++++-------
 t/t0611-reftable-httpd.sh              |  2 +-
 t/t1400-update-ref.sh                  |  2 +-
 t/t1423-ref-backend.sh                 |  6 +++---
 t/t1460-refs-migrate.sh                | 36 +++++++++++++++++-----------------
 t/t1900-repo-info.sh                   |  6 +++---
 t/t5510-fetch.sh                       |  8 ++++----
 t/t7424-submodule-mixed-ref-formats.sh |  2 +-
 15 files changed, 68 insertions(+), 64 deletions(-)

diff --git a/Documentation/config/init.adoc b/Documentation/config/init.adoc
index 7b4abdaf8b..a048f0bddc 100644
--- a/Documentation/config/init.adoc
+++ b/Documentation/config/init.adoc
@@ -15,7 +15,7 @@ endif::[]
 	this config.
 `init.defaultRefFormat`::
 	Allows overriding the default ref storage format for new repositories.
-	See `--ref-format=` in linkgit:git-init[1]. Both the command line
+	See `--ref-storage-format=` in linkgit:git-init[1]. Both the command line
 	option and the `GIT_DEFAULT_REF_FORMAT` environment variable take
 	precedence over this config.
 
diff --git a/Documentation/git-init.adoc b/Documentation/git-init.adoc
index bab99b9b47..73e1f787cb 100644
--- a/Documentation/git-init.adoc
+++ b/Documentation/git-init.adoc
@@ -11,7 +11,7 @@ SYNOPSIS
 [synopsis]
 git init [-q | --quiet] [--bare] [--template=<template-directory>]
 	 [--separate-git-dir <git-dir>] [--object-format=<format>]
-	 [--ref-format=<format>]
+	 [--ref-storage-format=<format>]
 	 [-b <branch-name> | --initial-branch=<branch-name>]
 	 [--shared[=<permissions>]] [<directory>]
 
@@ -57,11 +57,14 @@ values are `sha1` and (if enabled) `sha256`.  `sha1` is the default.
 +
 include::object-format-disclaimer.adoc[]
 
-`--ref-format=<format>`::
+`--ref-storage-format=<format>`::
 Specify the given ref storage _<format>_ for the repository. The valid values are:
 +
 include::ref-storage-format.adoc[]
 
+`--ref-format=<format>`::
+Deprecated alias of `--ref-storage-format=<format>`.
+
 `--template=<template-directory>`::
 Specify the directory from which templates will be used.  (See the "TEMPLATE
 DIRECTORY" section below.)
diff --git a/Documentation/git.adoc b/Documentation/git.adoc
index 8a5cdd3b3d..23ba65656e 100644
--- a/Documentation/git.adoc
+++ b/Documentation/git.adoc
@@ -593,7 +593,7 @@ double-quotes and respecting backslash escapes. E.g., the value
 `GIT_DEFAULT_REF_FORMAT`::
 	If this variable is set, the default reference backend format for new
 	repositories will be set to this value. The default is "files".
-	See `--ref-format` in linkgit:git-init[1].
+	See `--ref-storage-format` in linkgit:git-init[1].
 
 `GIT_REFERENCE_BACKEND`::
     Specify which reference backend to be used along with its URI.
diff --git a/builtin/init-db.c b/builtin/init-db.c
index e96b1283b7..1612413af0 100644
--- a/builtin/init-db.c
+++ b/builtin/init-db.c
@@ -57,7 +57,7 @@ static int shared_callback(const struct option *opt, const char *arg, int unset)
 static const char *const init_db_usage[] = {
 	N_("git init [-q | --quiet] [--bare] [--template=<template-directory>]\n"
 	   "         [--separate-git-dir <git-dir>] [--object-format=<format>]\n"
-	   "         [--ref-format=<format>]\n"
+	   "         [--ref-storage-format=<format>]\n"
 	   "         [-b <branch-name> | --initial-branch=<branch-name>]\n"
 	   "         [--shared[=<permissions>]] [<directory>]"),
 	NULL
@@ -83,7 +83,7 @@ int cmd_init_db(int argc,
 	unsigned int flags = 0;
 	int bare = startup_info->force_bare_repository ? 1 : -1;
 	const char *object_format = NULL;
-	const char *ref_format = NULL;
+	const char *ref_storage_format_str = NULL;
 	const char *initial_branch = NULL;
 	int hash_algo = GIT_HASH_UNKNOWN;
 	enum ref_storage_format ref_storage_format = REF_STORAGE_FORMAT_UNKNOWN;
@@ -109,8 +109,9 @@ int cmd_init_db(int argc,
 			   N_("override the name of the initial branch")),
 		OPT_STRING(0, "object-format", &object_format, N_("hash"),
 			   N_("specify the hash algorithm to use")),
-		OPT_STRING(0, "ref-format", &ref_format, N_("format"),
-			   N_("specify the reference format to use")),
+		OPT_STRING(0, "ref-storage-format", &ref_storage_format_str, N_("format"),
+			   N_("specify the reference storage format to use")),
+		OPT_ALIAS_F(0, "ref-format", "ref-storage-format", PARSE_OPT_HIDDEN),
 		OPT_END()
 	};
 	int ret;
@@ -173,10 +174,10 @@ int cmd_init_db(int argc,
 			die(_("unknown hash algorithm '%s'"), object_format);
 	}
 
-	if (ref_format) {
-		ref_storage_format = ref_storage_format_by_name(ref_format);
+	if (ref_storage_format_str) {
+		ref_storage_format = ref_storage_format_by_name(ref_storage_format_str);
 		if (ref_storage_format == REF_STORAGE_FORMAT_UNKNOWN)
-			die(_("unknown ref storage format '%s'"), ref_format);
+			die(_("unknown ref storage format '%s'"), ref_storage_format_str);
 	}
 
 	if (init_shared_repository != -1)
diff --git a/t/perf/p1401-ref-store-tombstones.sh b/t/perf/p1401-ref-store-tombstones.sh
index 9e3d8031aa..37ffe0c3a7 100755
--- a/t/perf/p1401-ref-store-tombstones.sh
+++ b/t/perf/p1401-ref-store-tombstones.sh
@@ -5,7 +5,7 @@ test_description="Tests performance of ref operations with many tombstones"
 . ./perf-lib.sh
 
 test_expect_success "setup" '
-	git init --ref-format=reftable repo &&
+	git init --ref-storage-format=reftable repo &&
 	blob=$(echo foo | git -C repo hash-object -w --stdin) &&
 	for i in $(test_seq 8000)
 	do
@@ -24,7 +24,7 @@ test_perf "recreate refs after mass delete" '
 '
 
 test_expect_success "setup asymmetric" '
-	git init --ref-format=reftable repo2 &&
+	git init --ref-storage-format=reftable repo2 &&
 	blob=$(echo foo | git -C repo2 hash-object -w --stdin) &&
 	for i in $(test_seq 8000)
 	do
diff --git a/t/perf/perf-lib.sh b/t/perf/perf-lib.sh
index 2ac007888e..3ce49fd423 100644
--- a/t/perf/perf-lib.sh
+++ b/t/perf/perf-lib.sh
@@ -153,7 +153,7 @@ test_perf_create_repo_from () {
 	) &&
 	(
 		cd "$repo" &&
-		"$MODERN_GIT" init -q --ref-format="$refformat" --object-format="$objectformat" &&
+		"$MODERN_GIT" init -q --ref-storage-format="$refformat" --object-format="$objectformat" &&
 		test_perf_do_repo_symlink_config_ &&
 		mv .git/hooks .git/hooks-disabled 2>/dev/null &&
 		if test -f .git/index.lock
diff --git a/t/t0001-init.sh b/t/t0001-init.sh
index 5cf2e5a35a..df9a2ff2da 100755
--- a/t/t0001-init.sh
+++ b/t/t0001-init.sh
@@ -696,9 +696,9 @@ do
 		test_cmp expect actual
 	'
 
-	test_expect_success "init with --ref-format=$format" '
+	test_expect_success "init with --ref-storage-format=$format" '
 		test_when_finished "rm -rf refformat" &&
-		git init --ref-format=$format refformat &&
+		git init --ref-storage-format=$format refformat &&
 		echo $format >expect &&
 		git -C refformat rev-parse --show-ref-format >actual &&
 		test_cmp expect actual
@@ -717,9 +717,9 @@ do
 		test_cmp expect actual
 	'
 
-	test_expect_success "--ref-format=$format overrides GIT_DEFAULT_REF_FORMAT" '
+	test_expect_success "--ref-storage-format=$format overrides GIT_DEFAULT_REF_FORMAT" '
 		test_when_finished "rm -rf refformat" &&
-		GIT_DEFAULT_REF_FORMAT=garbage git init --ref-format=$format 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 &&
 		test_cmp expect actual
@@ -735,9 +735,9 @@ do
 	'
 done
 
-test_expect_success "--ref-format= overrides GIT_DEFAULT_REF_FORMAT" '
+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-format=reftable 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 &&
 	test_cmp expect actual
@@ -791,8 +791,8 @@ for from_format in $backends
 do
 	test_expect_success "re-init with same format ($from_format)" '
 		test_when_finished "rm -rf refformat" &&
-		git init --ref-format=$from_format refformat &&
-		git init --ref-format=$from_format refformat &&
+		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 &&
 		test_cmp expect actual
@@ -807,11 +807,11 @@ do
 
 		test_expect_success "re-init with different format fails ($from_format -> $to_format)" '
 			test_when_finished "rm -rf refformat" &&
-			git init --ref-format=$from_format refformat &&
+			git init --ref-storage-format=$from_format refformat &&
 			cat >expect <<-EOF &&
 			fatal: attempt to reinitialize repository with different reference storage format
 			EOF
-			test_must_fail git init --ref-format=$to_format refformat 2>err &&
+			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 &&
@@ -820,12 +820,12 @@ do
 	done
 done
 
-test_expect_success 'init with --ref-format=garbage' '
+test_expect_success 'init with --ref-storage-format=garbage' '
 	test_when_finished "rm -rf refformat" &&
 	cat >expect <<-EOF &&
 	fatal: unknown ref storage format ${SQ}garbage${SQ}
 	EOF
-	test_must_fail git init --ref-format=garbage refformat 2>err &&
+	test_must_fail git init --ref-storage-format=garbage refformat 2>err &&
 	test_cmp expect err
 '
 
diff --git a/t/t0610-reftable-basics.sh b/t/t0610-reftable-basics.sh
index 35e98b43db..1cf96ce2c5 100755
--- a/t/t0610-reftable-basics.sh
+++ b/t/t0610-reftable-basics.sh
@@ -59,28 +59,28 @@ test_expect_success 'init: reinitializing reftable backend succeeds' '
 	test_commit -C repo A &&
 
 	git -C repo for-each-ref >expect &&
-	git init --ref-format=reftable repo &&
+	git init --ref-storage-format=reftable repo &&
 	git -C repo for-each-ref >actual &&
 	test_cmp expect actual
 '
 
 test_expect_success 'init: reinitializing files with reftable backend fails' '
 	test_when_finished "rm -rf repo" &&
-	git init --ref-format=files repo &&
+	git init --ref-storage-format=files repo &&
 	test_commit -C repo file &&
 
 	cp repo/.git/HEAD expect &&
-	test_must_fail git init --ref-format=reftable repo &&
+	test_must_fail git init --ref-storage-format=reftable repo &&
 	test_cmp expect repo/.git/HEAD
 '
 
 test_expect_success 'init: reinitializing reftable with files backend fails' '
 	test_when_finished "rm -rf repo" &&
-	git init --ref-format=reftable repo &&
+	git init --ref-storage-format=reftable repo &&
 	test_commit -C repo file &&
 
 	cp repo/.git/HEAD expect &&
-	test_must_fail git init --ref-format=files repo &&
+	test_must_fail git init --ref-storage-format=files repo &&
 	test_cmp expect repo/.git/HEAD
 '
 
@@ -163,7 +163,7 @@ test_expect_success 'clone: can clone reftable repository' '
 
 test_expect_success 'clone: can clone reffiles into reftable repository' '
 	test_when_finished "rm -rf reffiles reftable" &&
-	git init --ref-format=files reffiles &&
+	git init --ref-storage-format=files reffiles &&
 	test_commit -C reffiles A &&
 	git clone --ref-format=reftable ./reffiles reftable &&
 
@@ -182,7 +182,7 @@ test_expect_success 'clone: can clone reffiles into reftable repository' '
 
 test_expect_success 'clone: can clone reftable into reffiles repository' '
 	test_when_finished "rm -rf reffiles reftable" &&
-	git init --ref-format=reftable reftable &&
+	git init --ref-storage-format=reftable reftable &&
 	test_commit -C reftable A &&
 	git clone --ref-format=files ./reftable reffiles &&
 
diff --git a/t/t0611-reftable-httpd.sh b/t/t0611-reftable-httpd.sh
index 5e05b9c1f2..b030814b9f 100755
--- a/t/t0611-reftable-httpd.sh
+++ b/t/t0611-reftable-httpd.sh
@@ -10,7 +10,7 @@ start_httpd
 REPO="$HTTPD_DOCUMENT_ROOT_PATH/repo"
 
 test_expect_success 'serving ls-remote' '
-	git init --ref-format=reftable -b main "$REPO" &&
+	git init --ref-storage-format=reftable -b main "$REPO" &&
 	cd "$REPO" &&
 	test_commit m1 &&
 	>.git/git-daemon-export-ok &&
diff --git a/t/t1400-update-ref.sh b/t/t1400-update-ref.sh
index 269fdaa3ed..1a164c96f9 100755
--- a/t/t1400-update-ref.sh
+++ b/t/t1400-update-ref.sh
@@ -2361,7 +2361,7 @@ do
 	'
 
 	test_expect_success CASE_INSENSITIVE_FS "stdin $type batch-updates existing reference" '
-		git init --ref-format=reftable repo &&
+		git init --ref-storage-format=reftable repo &&
 		test_when_finished "rm -fr repo" &&
 		(
 			cd repo &&
diff --git a/t/t1423-ref-backend.sh b/t/t1423-ref-backend.sh
index fd47d77e8e..9ae295cf3d 100755
--- a/t/t1423-ref-backend.sh
+++ b/t/t1423-ref-backend.sh
@@ -137,7 +137,7 @@ do
 
 		test_expect_success "$method: read from $to_format backend, $dir dir" '
 			test_when_finished "rm -rf repo" &&
-			git init --ref-format=$from_format repo &&
+			git init --ref-storage-format=$from_format repo &&
 			(
 				cd repo &&
 				test_commit 1 &&
@@ -152,7 +152,7 @@ do
 
 		test_expect_success "$method: write to $to_format backend, $dir dir" '
 			test_when_finished "rm -rf repo" &&
-			git init --ref-format=$from_format repo &&
+			git init --ref-storage-format=$from_format repo &&
 			(
 				cd repo &&
 				test_commit 1 &&
@@ -179,7 +179,7 @@ do
 
 		test_expect_success "$method: with worktree and $to_format backend, $dir dir" '
 			test_when_finished "rm -rf repo wt" &&
-			git init --ref-format=$from_format repo &&
+			git init --ref-storage-format=$from_format repo &&
 			(
 				cd repo &&
 				test_commit 1 &&
diff --git a/t/t1460-refs-migrate.sh b/t/t1460-refs-migrate.sh
index 8f42697143..bb2507f571 100755
--- a/t/t1460-refs-migrate.sh
+++ b/t/t1460-refs-migrate.sh
@@ -105,7 +105,7 @@ do
 
 		test_expect_success "$from_format: migration to same format fails" '
 			test_when_finished "rm -rf repo" &&
-			git init --ref-format=$from_format repo &&
+			git init --ref-storage-format=$from_format repo &&
 			test_must_fail git -C repo refs migrate \
 				--ref-format=$from_format 2>err &&
 			cat >expect <<-EOF &&
@@ -116,7 +116,7 @@ do
 
 		test_expect_success "$from_format -> $to_format: migration with worktree fails" '
 			test_when_finished "rm -rf repo" &&
-			git init --ref-format=$from_format repo &&
+			git init --ref-storage-format=$from_format repo &&
 			git -C repo worktree add wt &&
 			test_must_fail git -C repo refs migrate \
 				--ref-format=$to_format 2>err &&
@@ -128,20 +128,20 @@ do
 
 		test_expect_success "$from_format -> $to_format: unborn HEAD" '
 			test_when_finished "rm -rf repo" &&
-			git init --ref-format=$from_format repo &&
+			git init --ref-storage-format=$from_format repo &&
 			test_migration repo "$to_format"
 		'
 
 		test_expect_success "$from_format -> $to_format: single ref" '
 			test_when_finished "rm -rf repo" &&
-			git init --ref-format=$from_format repo &&
+			git init --ref-storage-format=$from_format repo &&
 			test_commit -C repo initial &&
 			test_migration repo "$to_format"
 		'
 
 		test_expect_success "$from_format -> $to_format: bare repository" '
 			test_when_finished "rm -rf repo repo.git" &&
-			git init --ref-format=$from_format repo &&
+			git init --ref-storage-format=$from_format repo &&
 			test_commit -C repo initial &&
 			git clone --ref-format=$from_format --mirror repo repo.git &&
 			test_migration repo.git "$to_format"
@@ -149,7 +149,7 @@ do
 
 		test_expect_success "$from_format -> $to_format: dangling symref" '
 			test_when_finished "rm -rf repo" &&
-			git init --ref-format=$from_format repo &&
+			git init --ref-storage-format=$from_format repo &&
 			test_commit -C repo initial &&
 			git -C repo symbolic-ref BROKEN_HEAD refs/heads/nonexistent &&
 			test_migration repo "$to_format" &&
@@ -160,7 +160,7 @@ do
 
 		test_expect_success "$from_format -> $to_format: broken ref" '
 			test_when_finished "rm -rf repo" &&
-			git init --ref-format=$from_format repo &&
+			git init --ref-storage-format=$from_format repo &&
 			test_commit -C repo initial &&
 			test-tool -C repo ref-store main update-ref "" refs/heads/broken \
 				"$(test_oid 001)" "$ZERO_OID" REF_SKIP_CREATE_REFLOG,REF_SKIP_OID_VERIFICATION &&
@@ -172,7 +172,7 @@ do
 
 		test_expect_success "$from_format -> $to_format: pseudo-refs" '
 			test_when_finished "rm -rf repo" &&
-			git init --ref-format=$from_format repo &&
+			git init --ref-storage-format=$from_format repo &&
 			test_commit -C repo initial &&
 			git -C repo update-ref FOO_HEAD HEAD &&
 			test_migration repo "$to_format"
@@ -180,7 +180,7 @@ do
 
 		test_expect_success "$from_format -> $to_format: special refs are left alone" '
 			test_when_finished "rm -rf repo" &&
-			git init --ref-format=$from_format repo &&
+			git init --ref-storage-format=$from_format repo &&
 			test_commit -C repo initial &&
 			git -C repo rev-parse HEAD >repo/.git/MERGE_HEAD &&
 			git -C repo rev-parse MERGE_HEAD &&
@@ -190,7 +190,7 @@ do
 
 		test_expect_success "$from_format -> $to_format: a bunch of refs" '
 			test_when_finished "rm -rf repo" &&
-			git init --ref-format=$from_format repo &&
+			git init --ref-storage-format=$from_format repo &&
 
 			test_commit -C repo initial &&
 			cat >input <<-EOF &&
@@ -208,7 +208,7 @@ do
 
 		test_expect_success "$from_format -> $to_format: dry-run migration does not modify repository" '
 			test_when_finished "rm -rf repo" &&
-			git init --ref-format=$from_format repo &&
+			git init --ref-storage-format=$from_format repo &&
 			test_commit -C repo initial &&
 			git -C repo refs migrate --dry-run \
 				--ref-format=$to_format >output &&
@@ -221,7 +221,7 @@ do
 
 		test_expect_success "$from_format -> $to_format: reflogs of symrefs with target deleted" '
 			test_when_finished "rm -rf repo" &&
-			git init --ref-format=$from_format repo &&
+			git init --ref-storage-format=$from_format repo &&
 			test_commit -C repo initial &&
 			git -C repo branch branch-1 HEAD &&
 			git -C repo symbolic-ref refs/heads/symref refs/heads/branch-1 &&
@@ -234,7 +234,7 @@ do
 
 		test_expect_success "$from_format -> $to_format: reflogs order is retained" '
 			test_when_finished "rm -rf repo" &&
-			git init --ref-format=$from_format repo &&
+			git init --ref-storage-format=$from_format repo &&
 			test_commit --date "100005000 +0700" --no-tag -C repo initial &&
 			test_commit --date "100003000 +0700" --no-tag -C repo second &&
 			test_migration repo "$to_format"
@@ -242,7 +242,7 @@ do
 
 		test_expect_success "$from_format -> $to_format: stash is retained" '
 			test_when_finished "rm -rf repo" &&
-			git init --ref-format=$from_format repo &&
+			git init --ref-storage-format=$from_format repo &&
 			(
 				cd repo &&
 				test_commit initial A &&
@@ -259,7 +259,7 @@ do
 
 		test_expect_success "$from_format -> $to_format: skip reflog with --skip-reflog" '
 			test_when_finished "rm -rf repo" &&
-			git init --ref-format=$from_format repo &&
+			git init --ref-storage-format=$from_format repo &&
 			test_commit -C repo initial &&
 			# we see that the repository contains reflogs.
 			git -C repo reflog --all >reflogs &&
@@ -274,7 +274,7 @@ done
 
 test_expect_success 'multiple reftable blocks with multiple entries' '
 	test_when_finished "rm -rf repo" &&
-	git init --ref-format=files repo &&
+	git init --ref-storage-format=files repo &&
 	test_commit -C repo first &&
 	test_seq -f "create refs/heads/ref-%d HEAD" 5000 |
 	git -C repo update-ref --stdin &&
@@ -286,7 +286,7 @@ test_expect_success 'multiple reftable blocks with multiple entries' '
 
 test_expect_success 'migrating from files format deletes backend files' '
 	test_when_finished "rm -rf repo" &&
-	git init --ref-format=files repo &&
+	git init --ref-storage-format=files repo &&
 	test_commit -C repo first &&
 	git -C repo pack-refs --all &&
 	test_commit -C repo second &&
@@ -313,7 +313,7 @@ test_expect_success 'migrating from files format deletes backend files' '
 
 test_expect_success 'migrating from reftable format deletes backend files' '
 	test_when_finished "rm -rf repo" &&
-	git init --ref-format=reftable repo &&
+	git init --ref-storage-format=reftable repo &&
 	test_commit -C repo first &&
 
 	test_path_is_dir repo/.git/reftable &&
diff --git a/t/t1900-repo-info.sh b/t/t1900-repo-info.sh
index c85d390f43..d115d2d9f9 100755
--- a/t/t1900-repo-info.sh
+++ b/t/t1900-repo-info.sh
@@ -39,10 +39,10 @@ test_repo_info () {
 }
 
 test_repo_info 'ref format files is retrieved correctly' \
-	'git init --ref-format=files' 'format-files' 'references.format' 'files'
+	'git init --ref-storage-format=files' 'format-files' 'references.format' 'files'
 
 test_repo_info 'ref format reftable is retrieved correctly' \
-	'git init --ref-format=reftable' 'format-reftable' 'references.format' 'reftable'
+	'git init --ref-storage-format=reftable' 'format-reftable' 'references.format' 'reftable'
 
 test_repo_info 'bare repository = false is retrieved correctly' \
 	'git init' 'nonbare' 'layout.bare' 'false'
@@ -75,7 +75,7 @@ test_expect_success 'values returned in order requested' '
 	references.format=files
 	layout.bare=false
 	EOF
-	git init --ref-format=files ordered &&
+	git init --ref-storage-format=files ordered &&
 	git -C ordered repo info layout.bare references.format layout.bare >actual &&
 	test_cmp expect actual
 '
diff --git a/t/t5510-fetch.sh b/t/t5510-fetch.sh
index a8d38d9176..359c3cf99b 100755
--- a/t/t5510-fetch.sh
+++ b/t/t5510-fetch.sh
@@ -1803,7 +1803,7 @@ test_expect_success CASE_INSENSITIVE_FS,REFFILES 'existing references in a case
 test_expect_success REFFILES 'existing reference lock in repo' '
 	test_when_finished rm -rf base repo &&
 	(
-		git init --ref-format=reftable base &&
+		git init --ref-storage-format=reftable base &&
 		cd base &&
 		echo >file update &&
 		git add . &&
@@ -1814,7 +1814,7 @@ test_expect_success REFFILES 'existing reference lock in repo' '
 		git update-ref refs/heads/branch @ &&
 		cd .. &&
 
-		git init --ref-format=files --bare repo &&
+		git init --ref-storage-format=files --bare repo &&
 		cd repo &&
 		git remote add origin ../base &&
 		touch refs/heads/foo.lock &&
@@ -1857,7 +1857,7 @@ test_expect_success CASE_INSENSITIVE_FS,REFFILES 'D/F conflict on case insensiti
 test_expect_success REFFILES 'D/F conflict on case sensitive filesystem with lock' '
 	test_when_finished rm -rf base repo &&
 	(
-		git init --ref-format=reftable base &&
+		git init --ref-storage-format=reftable base &&
 		cd base &&
 		echo >file update &&
 		git add . &&
@@ -1868,7 +1868,7 @@ test_expect_success REFFILES 'D/F conflict on case sensitive filesystem with loc
 		git update-ref refs/heads/branch @ &&
 		cd .. &&
 
-		git init --ref-format=files --bare repo &&
+		git init --ref-storage-format=files --bare repo &&
 		cd repo &&
 		git remote add origin ../base &&
 		mkdir refs/heads/foo &&
diff --git a/t/t7424-submodule-mixed-ref-formats.sh b/t/t7424-submodule-mixed-ref-formats.sh
index 559713b607..1ca245c732 100755
--- a/t/t7424-submodule-mixed-ref-formats.sh
+++ b/t/t7424-submodule-mixed-ref-formats.sh
@@ -31,7 +31,7 @@ test_expect_success 'add existing repository with different ref storage format'
 	(
 		cd parent &&
 		test_commit parent &&
-		git init --ref-format=$OTHER_FORMAT submodule &&
+		git init --ref-storage-format=$OTHER_FORMAT submodule &&
 		test_commit -C submodule submodule &&
 		git submodule add ./submodule
 	)

-- 
2.55.0.1074.ge7621b4bad.dirty


^ permalink raw reply related	[flat|nested] 61+ messages in thread

* [PATCH v3 03/13] builtin/clone: rename "--ref-format=" to "--ref-storage-format="
  2026-09-09 11:12 ` [PATCH v3 00/13] Fix inconsistent ref storage format terminology Patrick Steinhardt
  2026-09-09 11:12   ` [PATCH v3 01/13] parse-options: allow for hidden aliases Patrick Steinhardt
  2026-09-09 11:12   ` [PATCH v3 02/13] builtin/init: rename "--ref-format=" to "--ref-storage-format=" Patrick Steinhardt
@ 2026-09-09 11:12   ` Patrick Steinhardt
  2026-09-09 11:12   ` [PATCH v3 04/13] builtin/refs: " Patrick Steinhardt
                     ` (9 subsequent siblings)
  12 siblings, 0 replies; 61+ messages in thread
From: Patrick Steinhardt @ 2026-09-09 11:12 UTC (permalink / raw)
  To: git; +Cc: Karthik Nayak, Junio C Hamano, Kaartic Sivaraam

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

Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
 Documentation/git-clone.adoc           |  5 ++++-
 builtin/clone.c                        | 13 +++++++------
 t/t0610-reftable-basics.sh             |  4 ++--
 t/t1460-refs-migrate.sh                |  2 +-
 t/t5510-fetch.sh                       |  6 +++---
 t/t5601-clone.sh                       |  4 ++--
 t/t7424-submodule-mixed-ref-formats.sh |  4 ++--
 7 files changed, 21 insertions(+), 17 deletions(-)

diff --git a/Documentation/git-clone.adoc b/Documentation/git-clone.adoc
index b6e1f8ada2..27e4d13942 100644
--- a/Documentation/git-clone.adoc
+++ b/Documentation/git-clone.adoc
@@ -348,12 +348,15 @@ or `--mirror` is given)
 	The result is Git repository can be separated from working
 	tree.
 
-`--ref-format=<ref-format>`::
+`--ref-storage-format=<format>`::
 
 Specify the given ref storage format for the repository. The valid values are:
 +
 include::ref-storage-format.adoc[]
 
+`--ref-format=<format>`::
+Deprecated alias of `--ref-storage-format=<format>`.
+
 `-j<n>`::
 `--jobs=<n>`::
 	The number of submodules fetched at the same time.
diff --git a/builtin/clone.c b/builtin/clone.c
index 5b25cca510..42cae9e0f6 100644
--- a/builtin/clone.c
+++ b/builtin/clone.c
@@ -901,7 +901,7 @@ int cmd_clone(int argc,
 	char *option_origin = NULL;
 	struct string_list option_not = STRING_LIST_INIT_NODUP;
 	const char *real_git_dir = NULL;
-	const char *ref_format = NULL;
+	const char *ref_storage_format_str = NULL;
 	const char *option_upload_pack = "git-upload-pack";
 	int option_progress = -1;
 	int option_sparse_checkout = 0;
@@ -981,8 +981,9 @@ int cmd_clone(int argc,
 			 N_("any cloned submodules will be shallow")),
 		OPT_STRING(0, "separate-git-dir", &real_git_dir, N_("gitdir"),
 			   N_("separate git dir from working tree")),
-		OPT_STRING(0, "ref-format", &ref_format, N_("format"),
-			   N_("specify the reference format to use")),
+		OPT_STRING(0, "ref-storage-format", &ref_storage_format_str, N_("format"),
+			   N_("specify the reference storage format to use")),
+		OPT_ALIAS_F(0, "ref-format", "ref-storage-format", PARSE_OPT_HIDDEN),
 		OPT_STRING_LIST('c', "config", &option_config, N_("key=value"),
 				N_("set config inside the new repository")),
 		OPT_STRING_LIST(0, "server-option", &server_options,
@@ -1027,10 +1028,10 @@ int cmd_clone(int argc,
 	if (option_single_branch == -1)
 		option_single_branch = deepen ? 1 : 0;
 
-	if (ref_format) {
-		ref_storage_format = ref_storage_format_by_name(ref_format);
+	if (ref_storage_format_str) {
+		ref_storage_format = ref_storage_format_by_name(ref_storage_format_str);
 		if (ref_storage_format == REF_STORAGE_FORMAT_UNKNOWN)
-			die(_("unknown ref storage format '%s'"), ref_format);
+			die(_("unknown ref storage format '%s'"), ref_storage_format_str);
 	}
 
 	if (option_mirror) {
diff --git a/t/t0610-reftable-basics.sh b/t/t0610-reftable-basics.sh
index 1cf96ce2c5..d325f17a14 100755
--- a/t/t0610-reftable-basics.sh
+++ b/t/t0610-reftable-basics.sh
@@ -165,7 +165,7 @@ test_expect_success 'clone: can clone reffiles into reftable repository' '
 	test_when_finished "rm -rf reffiles reftable" &&
 	git init --ref-storage-format=files reffiles &&
 	test_commit -C reffiles A &&
-	git clone --ref-format=reftable ./reffiles reftable &&
+	git clone --ref-storage-format=reftable ./reffiles reftable &&
 
 	git -C reffiles rev-parse HEAD >expect &&
 	git -C reftable rev-parse HEAD >actual &&
@@ -184,7 +184,7 @@ test_expect_success 'clone: can clone reftable into reffiles repository' '
 	test_when_finished "rm -rf reffiles reftable" &&
 	git init --ref-storage-format=reftable reftable &&
 	test_commit -C reftable A &&
-	git clone --ref-format=files ./reftable reffiles &&
+	git clone --ref-storage-format=files ./reftable reffiles &&
 
 	git -C reftable rev-parse HEAD >expect &&
 	git -C reffiles rev-parse HEAD >actual &&
diff --git a/t/t1460-refs-migrate.sh b/t/t1460-refs-migrate.sh
index bb2507f571..8aded6597e 100755
--- a/t/t1460-refs-migrate.sh
+++ b/t/t1460-refs-migrate.sh
@@ -143,7 +143,7 @@ do
 			test_when_finished "rm -rf repo repo.git" &&
 			git init --ref-storage-format=$from_format repo &&
 			test_commit -C repo initial &&
-			git clone --ref-format=$from_format --mirror repo repo.git &&
+			git clone --ref-storage-format=$from_format --mirror repo repo.git &&
 			test_migration repo.git "$to_format"
 		'
 
diff --git a/t/t5510-fetch.sh b/t/t5510-fetch.sh
index 359c3cf99b..300bd5396d 100755
--- a/t/t5510-fetch.sh
+++ b/t/t5510-fetch.sh
@@ -46,19 +46,19 @@ test_expect_success "clone and setup child repos" '
 	) &&
 	git clone . bundle &&
 	git clone . seven &&
-	git clone --ref-format=reftable . case_sensitive &&
+	git clone --ref-storage-format=reftable . case_sensitive &&
 	(
 		cd case_sensitive &&
 		git branch branch1 &&
 		git branch bRanch1
 	) &&
-	git clone --ref-format=reftable . case_sensitive_fd &&
+	git clone --ref-storage-format=reftable . case_sensitive_fd &&
 	(
 		cd case_sensitive_fd &&
 		git branch foo/bar &&
 		git branch Foo
 	) &&
-	git clone --ref-format=reftable . case_sensitive_df &&
+	git clone --ref-storage-format=reftable . case_sensitive_df &&
 	(
 		cd case_sensitive_df &&
 		git branch Foo/bar &&
diff --git a/t/t5601-clone.sh b/t/t5601-clone.sh
index b6167582a1..202d86bc83 100755
--- a/t/t5601-clone.sh
+++ b/t/t5601-clone.sh
@@ -166,7 +166,7 @@ test_expect_success 'clone --mirror does not repeat tags' '
 
 test_expect_success 'clone with files ref format' '
 	test_when_finished "rm -rf ref-storage" &&
-	git clone --ref-format=files --mirror src 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 &&
 	test_cmp expect actual
@@ -176,7 +176,7 @@ test_expect_success 'clone with garbage ref format' '
 	cat >expect <<-EOF &&
 	fatal: unknown ref storage format ${SQ}garbage${SQ}
 	EOF
-	test_must_fail git clone --ref-format=garbage --mirror src ref-storage 2>err &&
+	test_must_fail git clone --ref-storage-format=garbage --mirror src ref-storage 2>err &&
 	test_cmp expect err &&
 	test_path_is_missing ref-storage
 '
diff --git a/t/t7424-submodule-mixed-ref-formats.sh b/t/t7424-submodule-mixed-ref-formats.sh
index 1ca245c732..5f31d233e9 100755
--- a/t/t7424-submodule-mixed-ref-formats.sh
+++ b/t/t7424-submodule-mixed-ref-formats.sh
@@ -63,9 +63,9 @@ test_expect_success 'recursive clone propagates ref storage format' '
 	test_ref_format upstream/submodule "$GIT_DEFAULT_REF_FORMAT" &&
 
 	# The cloned repositories should use the other ref format that we have
-	# specified via `--ref-format`. The option should propagate to cloned
+	# specified via `--ref-storage-format`. The option should propagate to cloned
 	# submodules.
-	git clone --ref-format=$OTHER_FORMAT --recurse-submodules \
+	git clone --ref-storage-format=$OTHER_FORMAT --recurse-submodules \
 		upstream downstream &&
 	test_ref_format downstream "$OTHER_FORMAT" &&
 	test_ref_format downstream/submodule "$OTHER_FORMAT"

-- 
2.55.0.1074.ge7621b4bad.dirty


^ permalink raw reply related	[flat|nested] 61+ messages in thread

* [PATCH v3 04/13] builtin/refs: rename "--ref-format=" to "--ref-storage-format="
  2026-09-09 11:12 ` [PATCH v3 00/13] Fix inconsistent ref storage format terminology Patrick Steinhardt
                     ` (2 preceding siblings ...)
  2026-09-09 11:12   ` [PATCH v3 03/13] builtin/clone: " Patrick Steinhardt
@ 2026-09-09 11:12   ` Patrick Steinhardt
  2026-09-09 11:12   ` [PATCH v3 05/13] builtin/submodule: " Patrick Steinhardt
                     ` (8 subsequent siblings)
  12 siblings, 0 replies; 61+ messages in thread
From: Patrick Steinhardt @ 2026-09-09 11:12 UTC (permalink / raw)
  To: git; +Cc: Karthik Nayak, Junio C Hamano, Kaartic Sivaraam

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

Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
 Documentation/git-refs.adoc            |  9 ++++++---
 builtin/fetch.c                        |  2 +-
 builtin/refs.c                         |  9 +++++----
 t/t1423-ref-backend.sh                 |  8 ++++----
 t/t1460-refs-migrate.sh                | 12 ++++++------
 t/t7424-submodule-mixed-ref-formats.sh |  2 +-
 6 files changed, 23 insertions(+), 19 deletions(-)

diff --git a/Documentation/git-refs.adoc b/Documentation/git-refs.adoc
index 9063892651..ae722c60e6 100644
--- a/Documentation/git-refs.adoc
+++ b/Documentation/git-refs.adoc
@@ -9,7 +9,7 @@ git-refs - Low-level access to refs
 SYNOPSIS
 --------
 [synopsis]
-git refs migrate --ref-format=<format> [--no-reflog] [--dry-run]
+git refs migrate --ref-storage-format=<format> [--no-reflog] [--dry-run]
 git refs verify [--strict] [--verbose]
 git refs list [--count=<count>] [--shell|--perl|--python|--tcl]
 		   [(--sort=<key>)...] [--format=<format>]
@@ -97,11 +97,14 @@ OPTIONS
 
 The following options are specific to `git refs migrate`:
 
-`--ref-format=<format>`::
-	The ref format to migrate the ref store to. Can be one of:
+`--ref-storage-format=<format>`::
+	The ref storage format to migrate the ref store to. Can be one of:
 +
 include::ref-storage-format.adoc[]
 
+`--ref-format=<format>`::
+Deprecated alias of `--ref-storage-format=<format>`.
+
 `--dry-run`::
 	Perform the migration, but do not modify the repository. The migrated
 	refs will be written into a separate directory that can be inspected
diff --git a/builtin/fetch.c b/builtin/fetch.c
index ab7db2be06..687909c0c4 100644
--- a/builtin/fetch.c
+++ b/builtin/fetch.c
@@ -1848,7 +1848,7 @@ static void ref_transaction_rejection_handler(const char *refname,
 			"can either accept this as-is, in which case you won't be able to\n"
 			"store all remote references on disk. Or you can alternatively\n"
 			"migrate your repository to use the 'reftable' backend with the\n"
-			"following command:\n\n    git refs migrate --ref-format=reftable\n\n"
+			"following command:\n\n    git refs migrate --ref-storage-format=reftable\n\n"
 			"Please keep in mind that not all implementations of Git support this\n"
 			"new format yet. So if you use tools other than Git to access this\n"
 			"repository it may not be an option to migrate to reftables.\n"));
diff --git a/builtin/refs.c b/builtin/refs.c
index 5cd21c25fe..31aafb9974 100644
--- a/builtin/refs.c
+++ b/builtin/refs.c
@@ -10,7 +10,7 @@
 #include "refs/refs-internal.h"
 
 #define REFS_MIGRATE_USAGE \
-	N_("git refs migrate --ref-format=<format> [--no-reflog] [--dry-run]")
+	N_("git refs migrate --ref-storage-format=<format> [--no-reflog] [--dry-run]")
 
 #define REFS_VERIFY_USAGE \
 	N_("git refs verify [--strict] [--verbose]")
@@ -44,9 +44,10 @@ static int cmd_refs_migrate(int argc, const char **argv, const char *prefix,
 	enum ref_storage_format format;
 	unsigned int flags = 0;
 	struct option options[] = {
-		OPT_STRING_F(0, "ref-format", &format_str, N_("format"),
-			N_("specify the reference format to convert to"),
+		OPT_STRING_F(0, "ref-storage-format", &format_str, N_("format"),
+			N_("specify the reference storage format to convert to"),
 			PARSE_OPT_NONEG),
+		OPT_ALIAS_F(0, "ref-format", "ref-storage-format", PARSE_OPT_HIDDEN),
 		OPT_BIT(0, "dry-run", &flags,
 			N_("perform a non-destructive dry-run"),
 			REPO_MIGRATE_REF_STORAGE_FORMAT_DRYRUN),
@@ -62,7 +63,7 @@ static int cmd_refs_migrate(int argc, const char **argv, const char *prefix,
 	if (argc)
 		usage(_("too many arguments"));
 	if (!format_str)
-		usage(_("missing --ref-format=<format>"));
+		usage(_("missing --ref-storage-format=<format>"));
 
 	format = ref_storage_format_by_name(format_str);
 	if (format == REF_STORAGE_FORMAT_UNKNOWN) {
diff --git a/t/t1423-ref-backend.sh b/t/t1423-ref-backend.sh
index 9ae295cf3d..ab119a6568 100755
--- a/t/t1423-ref-backend.sh
+++ b/t/t1423-ref-backend.sh
@@ -144,7 +144,7 @@ do
 				test_commit 2 &&
 				test_commit 3 &&
 
-				git refs migrate --dry-run --ref-format=$to_format >out &&
+				git refs migrate --dry-run --ref-storage-format=$to_format >out &&
 				BACKEND_PATH="$dir/$(sed "s/.* ${SQ}.git\/\(.*\)${SQ}/\1/" out)" &&
 				test_refs_backend . $from_format "$to_format://$BACKEND_PATH" "$method"
 			)
@@ -159,7 +159,7 @@ do
 				test_commit 2 &&
 				test_commit 3 &&
 
-				git refs migrate --dry-run --ref-format=$to_format >out &&
+				git refs migrate --dry-run --ref-storage-format=$to_format >out &&
 				BACKEND_PATH="$dir/$(sed "s/.* ${SQ}.git\/\(.*\)${SQ}/\1/" out)" &&
 
 				test_refs_backend . $from_format "$to_format://$BACKEND_PATH" "$method" &&
@@ -186,7 +186,7 @@ do
 				test_commit 2 &&
 				test_commit 3 &&
 
-				git refs migrate --dry-run --ref-format=$to_format >out &&
+				git refs migrate --dry-run --ref-storage-format=$to_format >out &&
 				BACKEND_PATH="$dir/$(sed "s/.* ${SQ}.git\/\(.*\)${SQ}/\1/" out)" &&
 
 				run_with_uri . "$from_format" "$to_format://$BACKEND_PATH" \
@@ -218,7 +218,7 @@ do
 			test_commit 2 &&
 			test_commit 3 &&
 
-			git refs migrate --ref-format=$to_format &&
+			git refs migrate --ref-storage-format=$to_format &&
 			git refs list >out &&
 			test_grep "refs/tags/1"	out &&
 			test_grep "refs/tags/2"	out &&
diff --git a/t/t1460-refs-migrate.sh b/t/t1460-refs-migrate.sh
index 8aded6597e..204dd79b41 100755
--- a/t/t1460-refs-migrate.sh
+++ b/t/t1460-refs-migrate.sh
@@ -42,7 +42,7 @@ test_migration () {
 		print_all_reflog_entries "$repo" >expect_logs
 	fi &&
 
-	git -C "$repo" refs migrate --ref-format="$format" "$@" &&
+	git -C "$repo" refs migrate --ref-storage-format="$format" "$@" &&
 
 	git -C "$repo" for-each-ref --include-root-refs \
 		--format='%(refname) %(objectname) %(symref)' >actual &&
@@ -77,7 +77,7 @@ test_expect_success "missing ref storage format" '
 	git init repo &&
 	test_must_fail git -C repo refs migrate 2>err &&
 	cat >expect <<-EOF &&
-	usage: missing --ref-format=<format>
+	usage: missing --ref-storage-format=<format>
 	EOF
 	test_cmp expect err
 '
@@ -86,7 +86,7 @@ test_expect_success "unknown ref storage format" '
 	test_when_finished "rm -rf repo" &&
 	git init repo &&
 	test_must_fail git -C repo refs migrate \
-		--ref-format=unknown 2>err &&
+		--ref-storage-format=unknown 2>err &&
 	cat >expect <<-EOF &&
 	error: unknown ref storage format ${SQ}unknown${SQ}
 	EOF
@@ -107,7 +107,7 @@ do
 			test_when_finished "rm -rf repo" &&
 			git init --ref-storage-format=$from_format repo &&
 			test_must_fail git -C repo refs migrate \
-				--ref-format=$from_format 2>err &&
+				--ref-storage-format=$from_format 2>err &&
 			cat >expect <<-EOF &&
 			error: repository already uses ${SQ}$from_format${SQ} format
 			EOF
@@ -119,7 +119,7 @@ do
 			git init --ref-storage-format=$from_format repo &&
 			git -C repo worktree add wt &&
 			test_must_fail git -C repo refs migrate \
-				--ref-format=$to_format 2>err &&
+				--ref-storage-format=$to_format 2>err &&
 			cat >expect <<-EOF &&
 			error: migrating repositories with worktrees is not supported yet
 			EOF
@@ -211,7 +211,7 @@ do
 			git init --ref-storage-format=$from_format repo &&
 			test_commit -C repo initial &&
 			git -C repo refs migrate --dry-run \
-				--ref-format=$to_format >output &&
+				--ref-storage-format=$to_format >output &&
 			test_grep "Finished dry-run migration of refs" output &&
 			test_path_is_dir repo/.git/ref_migration.* &&
 			echo $from_format >expect &&
diff --git a/t/t7424-submodule-mixed-ref-formats.sh b/t/t7424-submodule-mixed-ref-formats.sh
index 5f31d233e9..e61389af05 100755
--- a/t/t7424-submodule-mixed-ref-formats.sh
+++ b/t/t7424-submodule-mixed-ref-formats.sh
@@ -94,7 +94,7 @@ test_expect_success 'status with mixed submodule ref storages' '
 	git init main &&
 	git -C main submodule add "file://$(pwd)/submodule" &&
 	git -C main commit -m "add submodule" &&
-	git -C main/submodule refs migrate --ref-format=$OTHER_FORMAT &&
+	git -C main/submodule refs migrate --ref-storage-format=$OTHER_FORMAT &&
 
 	# The main repository should use the default ref format now, whereas
 	# the submodule should use the other format.

-- 
2.55.0.1074.ge7621b4bad.dirty


^ permalink raw reply related	[flat|nested] 61+ messages in thread

* [PATCH v3 05/13] builtin/submodule: rename "--ref-format=" to "--ref-storage-format="
  2026-09-09 11:12 ` [PATCH v3 00/13] Fix inconsistent ref storage format terminology Patrick Steinhardt
                     ` (3 preceding siblings ...)
  2026-09-09 11:12   ` [PATCH v3 04/13] builtin/refs: " Patrick Steinhardt
@ 2026-09-09 11:12   ` Patrick Steinhardt
  2026-09-09 11:12   ` [PATCH v3 06/13] builtin/rev-parse: rename "--show-ref-format" to "--show-ref-storage-format" Patrick Steinhardt
                     ` (7 subsequent siblings)
  12 siblings, 0 replies; 61+ messages in thread
From: Patrick Steinhardt @ 2026-09-09 11:12 UTC (permalink / raw)
  To: git; +Cc: Karthik Nayak, Junio C Hamano, Kaartic Sivaraam

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

Note that this commit is a bit more complex compared to the others as we
also need to adapt the submodule helper for consistency. But overall,
the changes are straight-forward and in the same spirit.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
 Documentation/git-submodule.adoc       | 14 ++++++++------
 builtin/clone.c                        |  2 +-
 builtin/submodule--helper.c            | 21 ++++++++++++---------
 git-submodule.sh                       | 20 ++++++++++----------
 t/t7424-submodule-mixed-ref-formats.sh |  6 +++---
 5 files changed, 34 insertions(+), 29 deletions(-)

diff --git a/Documentation/git-submodule.adoc b/Documentation/git-submodule.adoc
index 722d827908..e9c81a7170 100644
--- a/Documentation/git-submodule.adoc
+++ b/Documentation/git-submodule.adoc
@@ -34,7 +34,7 @@ COMMANDS
 With no arguments, shows the status of existing submodules.  Several
 subcommands are available to perform operations on the submodules.
 
-`add [-b <branch>] [-f | --force] [--name <name>] [--reference <repository>] [--ref-format <format>] [--depth <depth>] [--] <repository> [<path>]`::
+`add [-b <branch>] [-f | --force] [--name <name>] [--reference <repository>] [--ref-storage-format <format>] [--depth <depth>] [--] <repository> [<path>]`::
 	Add the given repository as a submodule at the given path
 	to the changeset to be committed next to the current
 	project: the current project is termed the "superproject".
@@ -72,8 +72,9 @@ location, and only the superproject's URL needs to be provided.
 git-submodule will correctly locate the submodule using the relative
 URL in `.gitmodules`.
 +
-If `--ref-format <format>`  is specified, the ref storage format of newly
-cloned submodules will be set accordingly.
+If `--ref-storage-format <format>` or its deprecated alias `--ref-format
+<format>` is specified, the ref storage format of the newly cloned submodules
+will be set accordingly.
 
 `status [--cached] [--recursive] [--] [<path>...]`::
 	Show the status of the submodules. This will print the SHA-1 of the
@@ -139,7 +140,7 @@ If you really want to remove a submodule from the repository and commit
 that use linkgit:git-rm[1] instead. See linkgit:gitsubmodules[7] for removal
 options.
 
-`update [--init] [--remote] [-N | --no-fetch] [--[no-]recommend-shallow] [-f | --force] [--checkout | --rebase | --merge] [--reference=<repository>] [--ref-format=<format>] [--depth=<depth>] [--recursive] [--jobs <n>] [--[no-]single-branch] [--filter=<filter-spec>] [--] [<path>...]`::
+`update [--init] [--remote] [-N | --no-fetch] [--[no-]recommend-shallow] [-f | --force] [--checkout | --rebase | --merge] [--reference=<repository>] [--ref-storage-format=<format>] [--depth=<depth>] [--recursive] [--jobs <n>] [--[no-]single-branch] [--filter=<filter-spec>] [--] [<path>...]`::
 +
 --
 Update the registered submodules to match what the superproject
@@ -188,8 +189,9 @@ submodule with the `--init` option.
 If `--recursive` is specified, this command will recurse into the
 registered submodules, and update any nested submodules within.
 
-If `--ref-format <format>`  is specified, the ref storage format of newly
-cloned submodules will be set accordingly.
+If `--ref-storage-format <format>` or its deprecated alias `--ref-format
+<format>` is specified, the ref storage format of the newly cloned submodules
+will be set accordingly.
 
 If `--filter <filter-spec>` is specified, the given partial clone filter will be
 applied to the submodule. See linkgit:git-rev-list[1] for details on filter
diff --git a/builtin/clone.c b/builtin/clone.c
index 42cae9e0f6..dd722e4de1 100644
--- a/builtin/clone.c
+++ b/builtin/clone.c
@@ -725,7 +725,7 @@ static int checkout(int submodule_progress,
 		}
 
 		if (ref_storage_format != REF_STORAGE_FORMAT_UNKNOWN)
-			strvec_pushf(&cmd.args, "--ref-format=%s",
+			strvec_pushf(&cmd.args, "--ref-storage-format=%s",
 				     ref_storage_format_to_name(ref_storage_format));
 
 		if (filter_submodules && filter_options->choice)
diff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c
index e7cd3225fa..41883af2ac 100644
--- a/builtin/submodule--helper.c
+++ b/builtin/submodule--helper.c
@@ -1941,7 +1941,7 @@ static int clone_submodule(const struct module_clone_data *clone_data,
 					     item->string, NULL);
 		}
 		if (clone_data->ref_storage_format != REF_STORAGE_FORMAT_UNKNOWN)
-			strvec_pushf(&cp.args, "--ref-format=%s",
+			strvec_pushf(&cp.args, "--ref-storage-format=%s",
 				     ref_storage_format_to_name(clone_data->ref_storage_format));
 		if (clone_data->dissociate)
 			strvec_push(&cp.args, "--dissociate");
@@ -2057,8 +2057,9 @@ static int module_clone(int argc, const char **argv, const char *prefix,
 		OPT_STRING_LIST(0, "reference", &reference,
 			   N_("repo"),
 			   N_("reference repository")),
-		OPT_STRING(0, "ref-format", &ref_storage_format, N_("format"),
-			   N_("specify the reference format to use")),
+		OPT_STRING(0, "ref-storage-format", &ref_storage_format, N_("format"),
+			   N_("specify the reference storage format to use")),
+		OPT_ALIAS_F(0, "ref-format", "ref-storage-format", PARSE_OPT_HIDDEN),
 		OPT_BOOL(0, "dissociate", &dissociate,
 			   N_("use --reference only while cloning")),
 		OPT_INTEGER(0, "depth", &clone_data.depth,
@@ -2357,7 +2358,7 @@ static int prepare_to_clone_next_submodule(const struct cache_entry *ce,
 	if (suc->update_data->require_init)
 		strvec_push(&child->args, "--require-init");
 	if (suc->update_data->ref_storage_format != REF_STORAGE_FORMAT_UNKNOWN)
-		strvec_pushf(&child->args, "--ref-format=%s",
+		strvec_pushf(&child->args, "--ref-storage-format=%s",
 			     ref_storage_format_to_name(suc->update_data->ref_storage_format));
 	strvec_pushl(&child->args, "--path", sub->path, NULL);
 	strvec_pushl(&child->args, "--name", sub->name, NULL);
@@ -2801,7 +2802,7 @@ static void update_data_to_args(const struct update_data *update_data,
 			strvec_pushl(args, "--reference", item->string, NULL);
 	}
 	if (update_data->ref_storage_format != REF_STORAGE_FORMAT_UNKNOWN)
-		strvec_pushf(args, "--ref-format=%s",
+		strvec_pushf(args, "--ref-storage-format=%s",
 			     ref_storage_format_to_name(update_data->ref_storage_format));
 	if (update_data->filter_options && update_data->filter_options->choice)
 		strvec_pushf(args, "--filter=%s",
@@ -3010,8 +3011,9 @@ static int module_update(int argc, const char **argv, const char *prefix,
 			SM_UPDATE_REBASE),
 		OPT_STRING_LIST(0, "reference", &opt.references, N_("repo"),
 			   N_("reference repository")),
-		OPT_STRING(0, "ref-format", &ref_storage_format, N_("format"),
-			   N_("specify the reference format to use")),
+		OPT_STRING(0, "ref-storage-format", &ref_storage_format, N_("format"),
+			   N_("specify the reference storage format to use")),
+		OPT_ALIAS_F(0, "ref-format", "ref-storage-format", PARSE_OPT_HIDDEN),
 		OPT_BOOL(0, "dissociate", &opt.dissociate,
 			   N_("use --reference only while cloning")),
 		OPT_INTEGER(0, "depth", &opt.depth,
@@ -3659,8 +3661,9 @@ static int module_add(int argc, const char **argv, const char *prefix,
 		OPT_BOOL(0, "progress", &progress, N_("force cloning progress")),
 		OPT_STRING(0, "reference", &add_data.reference_path, N_("repository"),
 			   N_("reference repository")),
-		OPT_STRING(0, "ref-format", &ref_storage_format, N_("format"),
-			   N_("specify the reference format to use")),
+		OPT_STRING(0, "ref-storage-format", &ref_storage_format, N_("format"),
+			   N_("specify the reference storage format to use")),
+		OPT_ALIAS_F(0, "ref-format", "ref-storage-format", PARSE_OPT_HIDDEN),
 		OPT_BOOL(0, "dissociate", &dissociate, N_("borrow the objects from reference repositories")),
 		OPT_STRING(0, "name", &add_data.sm_name, N_("name"),
 			   N_("sets the submodule's name to the given string "
diff --git a/git-submodule.sh b/git-submodule.sh
index 2999b31fad..8632194138 100755
--- a/git-submodule.sh
+++ b/git-submodule.sh
@@ -95,13 +95,13 @@ cmd_add()
 		--reference=*)
 			reference="$1"
 			;;
-		--ref-format)
+		--ref-format|--ref-storage-format)
 			case "$2" in '') usage ;; esac
-			ref_format="--ref-format=$2"
+			ref_storage_format="--ref-storage-format=$2"
 			shift
 			;;
-		--ref-format=*)
-			ref_format="$1"
+		--ref-format=*|--ref-storage-format=*)
+			ref_storage_format="$1"
 			;;
 		--dissociate)
 			dissociate=$1
@@ -147,7 +147,7 @@ cmd_add()
 		$progress \
 		${branch:+"$branch"} \
 		${reference:+"$reference"} \
-		${ref_format:+"$ref_format"} \
+		${ref_storage_format:+"$ref_storage_format"} \
 		$dissociate \
 		${name:+"$name"} \
 		${depth:+"$depth"} \
@@ -302,13 +302,13 @@ cmd_update()
 		-r|--rebase)
 			rebase=$1
 			;;
-		--ref-format)
+		--ref-format|--ref-storage-format)
 			case "$2" in '') usage ;; esac
-			ref_format="--ref-format=$2"
+			ref_storage_format="--ref-storage-format=$2"
 			shift
 			;;
-		--ref-format=*)
-			ref_format="$1"
+		--ref-format=*|--ref-storage-format=*)
+			ref_storage_format="$1"
 			;;
 		--reference)
 			case "$2" in '') usage ;; esac
@@ -385,7 +385,7 @@ cmd_update()
 		$rebase \
 		$merge \
 		$checkout \
-		${ref_format:+"$ref_format"} \
+		${ref_storage_format:+"$ref_storage_format"} \
 		${reference:+"$reference"} \
 		$dissociate \
 		${depth:+"$depth"} \
diff --git a/t/t7424-submodule-mixed-ref-formats.sh b/t/t7424-submodule-mixed-ref-formats.sh
index e61389af05..2ef85289b3 100755
--- a/t/t7424-submodule-mixed-ref-formats.sh
+++ b/t/t7424-submodule-mixed-ref-formats.sh
@@ -44,7 +44,7 @@ test_expect_success 'add submodules with different ref storage format' '
 	test_commit -C submodule submodule-initial &&
 	git init upstream &&
 	test_ref_format upstream "$GIT_DEFAULT_REF_FORMAT" &&
-	git -C upstream submodule add --ref-format="$OTHER_FORMAT" "file://$(pwd)/submodule" &&
+	git -C upstream submodule add --ref-storage-format="$OTHER_FORMAT" "file://$(pwd)/submodule" &&
 	test_ref_format upstream/submodule "$OTHER_FORMAT"
 '
 
@@ -82,7 +82,7 @@ test_expect_success 'clone submodules with different ref storage format' '
 
 	git clone --no-recurse-submodules "file://$(pwd)/upstream" downstream &&
 	test_ref_format downstream "$GIT_DEFAULT_REF_FORMAT" &&
-	git -C downstream submodule update --init --ref-format=$OTHER_FORMAT &&
+	git -C downstream submodule update --init --ref-storage-format=$OTHER_FORMAT &&
 	test_ref_format downstream/submodule "$OTHER_FORMAT"
 '
 
@@ -122,7 +122,7 @@ test_expect_success 'recursive pull with mixed formats' '
 	# Clone the upstream repository such that the main repo and its
 	# submodules have different formats.
 	git clone --no-recurse-submodules "file://$(pwd)/upstream" downstream &&
-	git -C downstream submodule update --init --ref-format=$OTHER_FORMAT &&
+	git -C downstream submodule update --init --ref-storage-format=$OTHER_FORMAT &&
 	test_ref_format downstream "$GIT_DEFAULT_REF_FORMAT" &&
 	test_ref_format downstream/submodule "$OTHER_FORMAT" &&
 

-- 
2.55.0.1074.ge7621b4bad.dirty


^ permalink raw reply related	[flat|nested] 61+ messages in thread

* [PATCH v3 06/13] builtin/rev-parse: rename "--show-ref-format" to "--show-ref-storage-format"
  2026-09-09 11:12 ` [PATCH v3 00/13] Fix inconsistent ref storage format terminology Patrick Steinhardt
                     ` (4 preceding siblings ...)
  2026-09-09 11:12   ` [PATCH v3 05/13] builtin/submodule: " Patrick Steinhardt
@ 2026-09-09 11:12   ` Patrick Steinhardt
  2026-09-09 11:12   ` [PATCH v3 07/13] help: rename "default-ref-format" to "default-ref-storage-format" Patrick Steinhardt
                     ` (6 subsequent siblings)
  12 siblings, 0 replies; 61+ messages in thread
From: Patrick Steinhardt @ 2026-09-09 11:12 UTC (permalink / raw)
  To: git; +Cc: Karthik Nayak, Junio C Hamano, Kaartic Sivaraam

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>
---
 Documentation/git-rev-parse.adoc       |  5 ++++-
 builtin/rev-parse.c                    |  2 +-
 contrib/completion/git-prompt.sh       |  2 +-
 t/perf/perf-lib.sh                     |  4 ++--
 t/t0001-init.sh                        | 36 +++++++++++++++++-----------------
 t/t0610-reftable-basics.sh             | 16 +++++++--------
 t/t1460-refs-migrate.sh                |  4 ++--
 t/t1500-rev-parse.sh                   |  8 ++++----
 t/t5601-clone.sh                       |  2 +-
 t/t7424-submodule-mixed-ref-formats.sh |  2 +-
 10 files changed, 42 insertions(+), 39 deletions(-)

diff --git a/Documentation/git-rev-parse.adoc b/Documentation/git-rev-parse.adoc
index 5398691f3f..14462ce7d9 100644
--- a/Documentation/git-rev-parse.adoc
+++ b/Documentation/git-rev-parse.adoc
@@ -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
 ~~~~~~~~~~~~~
diff --git a/builtin/rev-parse.c b/builtin/rev-parse.c
index 43693454d5..ec33c19bdf 100644
--- a/builtin/rev-parse.c
+++ b/builtin/rev-parse.c
@@ -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;
 			}
diff --git a/contrib/completion/git-prompt.sh b/contrib/completion/git-prompt.sh
index 6186c474ba..754a5edc9a 100644
--- a/contrib/completion/git-prompt.sh
+++ b/contrib/completion/git-prompt.sh
@@ -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="$?"
 
diff --git a/t/perf/perf-lib.sh b/t/perf/perf-lib.sh
index 3ce49fd423..846ecc35c3 100644
--- a/t/perf/perf-lib.sh
+++ b/t/perf/perf-lib.sh
@@ -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
diff --git a/t/t0001-init.sh b/t/t0001-init.sh
index df9a2ff2da..b4f19d8077 100755
--- a/t/t0001-init.sh
+++ b/t/t0001-init.sh
@@ -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
 '
 
diff --git a/t/t0610-reftable-basics.sh b/t/t0610-reftable-basics.sh
index d325f17a14..b6db54430a 100755
--- a/t/t0610-reftable-basics.sh
+++ b/t/t0610-reftable-basics.sh
@@ -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
 '
diff --git a/t/t1460-refs-migrate.sh b/t/t1460-refs-migrate.sh
index 204dd79b41..ecf6411288 100755
--- a/t/t1460-refs-migrate.sh
+++ b/t/t1460-refs-migrate.sh
@@ -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
 		'
 
diff --git a/t/t1500-rev-parse.sh b/t/t1500-rev-parse.sh
index 4174ca40c3..30bf8a4d0a 100755
--- a/t/t1500-rev-parse.sh
+++ b/t/t1500-rev-parse.sh
@@ -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
 	)
 '
diff --git a/t/t5601-clone.sh b/t/t5601-clone.sh
index 202d86bc83..06f6121f82 100755
--- a/t/t5601-clone.sh
+++ b/t/t5601-clone.sh
@@ -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
 '
 
diff --git a/t/t7424-submodule-mixed-ref-formats.sh b/t/t7424-submodule-mixed-ref-formats.sh
index 2ef85289b3..9707744644 100755
--- a/t/t7424-submodule-mixed-ref-formats.sh
+++ b/t/t7424-submodule-mixed-ref-formats.sh
@@ -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
 }
 

-- 
2.55.0.1074.ge7621b4bad.dirty


^ permalink raw reply related	[flat|nested] 61+ messages in thread

* [PATCH v3 07/13] help: rename "default-ref-format" to "default-ref-storage-format"
  2026-09-09 11:12 ` [PATCH v3 00/13] Fix inconsistent ref storage format terminology Patrick Steinhardt
                     ` (5 preceding siblings ...)
  2026-09-09 11:12   ` [PATCH v3 06/13] builtin/rev-parse: rename "--show-ref-format" to "--show-ref-storage-format" Patrick Steinhardt
@ 2026-09-09 11:12   ` Patrick Steinhardt
  2026-09-09 11:12   ` [PATCH v3 08/13] refs: expose function to parse reference URIs Patrick Steinhardt
                     ` (5 subsequent siblings)
  12 siblings, 0 replies; 61+ messages in thread
From: Patrick Steinhardt @ 2026-09-09 11:12 UTC (permalink / raw)
  To: git; +Cc: Karthik Nayak, Junio C Hamano, Kaartic Sivaraam

When printing information about how specifically Git was built and what
defaults it has we also print the default ref storage format used when
initializing new repositories. This is to prepare for Git 3.0, where the
default storage format will change from the "files" backend to the
"reftable" backend.

In preceding commits we have adapted "ref-format" parameters to be
called "ref-storage-format" instead to resolve some conceptual
mismatches. The build information is now the only place where we still
refer to it as "default-ref-format".

Rename the field to "default-ref-storage-format" instead.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
 help.c          | 2 +-
 t/t0001-init.sh | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/help.c b/help.c
index 46241492ce..1dd8391eeb 100644
--- a/help.c
+++ b/help.c
@@ -824,7 +824,7 @@ void get_version_info(struct strbuf *buf, int show_build_options)
 			    SHA1_UNSAFE_BACKEND);
 #endif
 		strbuf_addf(buf, "SHA-256: %s\n", SHA256_BACKEND);
-		strbuf_addf(buf, "default-ref-format: %s\n",
+		strbuf_addf(buf, "default-ref-storage-format: %s\n",
 			    ref_storage_format_to_name(REF_STORAGE_FORMAT_DEFAULT));
 		strbuf_addf(buf, "default-hash: %s\n", hash_algos[GIT_HASH_DEFAULT].name);
 	}
diff --git a/t/t0001-init.sh b/t/t0001-init.sh
index b4f19d8077..6f4431bed7 100755
--- a/t/t0001-init.sh
+++ b/t/t0001-init.sh
@@ -668,7 +668,7 @@ test_expect_success 'default ref format' '
 		sane_unset GIT_DEFAULT_REF_FORMAT &&
 		git init refformat
 	) &&
-	git version --build-options | sed -ne "s/^default-ref-format: //p" >expect &&
+	git version --build-options | sed -ne "s/^default-ref-storage-format: //p" >expect &&
 	git -C refformat rev-parse --show-ref-storage-format >actual &&
 	test_cmp expect actual
 '

-- 
2.55.0.1074.ge7621b4bad.dirty


^ permalink raw reply related	[flat|nested] 61+ messages in thread

* [PATCH v3 08/13] refs: expose function to parse reference URIs
  2026-09-09 11:12 ` [PATCH v3 00/13] Fix inconsistent ref storage format terminology Patrick Steinhardt
                     ` (6 preceding siblings ...)
  2026-09-09 11:12   ` [PATCH v3 07/13] help: rename "default-ref-format" to "default-ref-storage-format" Patrick Steinhardt
@ 2026-09-09 11:12   ` Patrick Steinhardt
  2026-09-09 11:12   ` [PATCH v3 09/13] setup: refactor how we configure the ref storage format Patrick Steinhardt
                     ` (4 subsequent siblings)
  12 siblings, 0 replies; 61+ messages in thread
From: Patrick Steinhardt @ 2026-09-09 11:12 UTC (permalink / raw)
  To: git; +Cc: Karthik Nayak, Junio C Hamano, Kaartic Sivaraam

In the next commit we're about to add more sites that want to parse a
reference backends URI into a format and payload. Expose a new function
`ref_storage_format_by_uri()` that enables this.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
 refs.c  | 23 +++++++++++++++++++++++
 refs.h  |  4 ++++
 setup.c | 48 ++++++++++++------------------------------------
 3 files changed, 39 insertions(+), 36 deletions(-)

diff --git a/refs.c b/refs.c
index 92d5df5b71..951db56113 100644
--- a/refs.c
+++ b/refs.c
@@ -54,6 +54,29 @@ enum ref_storage_format ref_storage_format_by_name(const char *name)
 	return REF_STORAGE_FORMAT_UNKNOWN;
 }
 
+enum ref_storage_format ref_storage_format_by_uri(const char *uri,
+						  char **payload)
+{
+	enum ref_storage_format format;
+	const char *schema_end;
+	char *name;
+
+	schema_end = strstr(uri, "://");
+	if (!schema_end) {
+		name = xstrdup(uri);
+		if (payload)
+			*payload = NULL;
+	} else {
+		name = xstrndup(uri, schema_end - uri);
+		if (payload)
+			*payload = xstrdup(schema_end + 3);
+	}
+
+	format = ref_storage_format_by_name(name);
+	free(name);
+	return format;
+}
+
 const char *ref_storage_format_to_name(enum ref_storage_format ref_storage_format)
 {
 	const struct ref_storage_be *be = find_ref_storage_backend(ref_storage_format);
diff --git a/refs.h b/refs.h
index 9979446d15..ee3b8a62ef 100644
--- a/refs.h
+++ b/refs.h
@@ -17,6 +17,10 @@ struct worktree;
 enum ref_storage_format ref_storage_format_by_name(const char *name);
 const char *ref_storage_format_to_name(enum ref_storage_format ref_storage_format);
 
+/* Parse a reference storage URI in the format "<format>[://<payload>]". */
+enum ref_storage_format ref_storage_format_by_uri(const char *uri,
+						  char **payload);
+
 enum ref_transaction_error {
 	/* Default error code */
 	REF_TRANSACTION_ERROR_GENERIC = -1,
diff --git a/setup.c b/setup.c
index dfe05d9a03..3be7dac452 100644
--- a/setup.c
+++ b/setup.c
@@ -632,21 +632,6 @@ static enum extension_result handle_extension_v0(const char *var,
 		return EXTENSION_UNKNOWN;
 }
 
-static void parse_reference_uri(const char *value, char **format,
-				char **payload)
-{
-	const char *schema_end;
-
-	schema_end = strstr(value, "://");
-	if (!schema_end) {
-		*format = xstrdup(value);
-		*payload = NULL;
-	} else {
-		*format = xstrndup(value, schema_end - value);
-		*payload = xstrdup_or_null(schema_end + 3);
-	}
-}
-
 /*
  * Record any new extensions in this function.
  */
@@ -689,16 +674,13 @@ static enum extension_result handle_extension(const char *var,
 		return EXTENSION_OK;
 	} else if (!strcmp(ext, "refstorage")) {
 		unsigned int format;
-		char *format_str;
 
 		if (!value)
 			return config_error_nonbool(var);
 
-		parse_reference_uri(value, &format_str,
-				    &data->ref_storage_payload);
-
-		format = ref_storage_format_by_name(format_str);
-		free(format_str);
+		FREE_AND_NULL(data->ref_storage_payload);
+		format = ref_storage_format_by_uri(value,
+						   &data->ref_storage_payload);
 
 		if (format == REF_STORAGE_FORMAT_UNKNOWN)
 			return error(_("invalid value for '%s': '%s'"),
@@ -2069,16 +2051,12 @@ const char *setup_git_directory_gently(struct repository *repo, int *nongit_ok)
 			 */
 			ref_backend_uri = getenv(GIT_REFERENCE_BACKEND_ENVIRONMENT);
 			if (ref_backend_uri) {
-				char *format;
-
-				free(discovery.format.ref_storage_payload);
-
-				parse_reference_uri(ref_backend_uri, &format, &discovery.format.ref_storage_payload);
-				discovery.format.ref_storage_format = ref_storage_format_by_name(format);
+				FREE_AND_NULL(discovery.format.ref_storage_payload);
+				discovery.format.ref_storage_format =
+					ref_storage_format_by_uri(ref_backend_uri,
+								  &discovery.format.ref_storage_payload);
 				if (discovery.format.ref_storage_format == REF_STORAGE_FORMAT_UNKNOWN)
-					die(_("unknown ref storage format: '%s'"), format);
-
-				free(format);
+					die(_("unknown ref storage format: '%s'"), ref_backend_uri);
 			}
 
 			if (apply_repository_format(repo, &discovery.format,
@@ -2806,18 +2784,16 @@ static void repository_format_configure(struct repository_format *repo_fmt,
 
 	ref_backend_uri = getenv(GIT_REFERENCE_BACKEND_ENVIRONMENT);
 	if (ref_backend_uri) {
-		char *backend, *payload;
 		enum ref_storage_format format;
+		char *payload;
 
-		parse_reference_uri(ref_backend_uri, &backend, &payload);
-		format = ref_storage_format_by_name(backend);
+		format = ref_storage_format_by_uri(ref_backend_uri, &payload);
 		if (format == REF_STORAGE_FORMAT_UNKNOWN)
-			die(_("unknown ref storage format: '%s'"), backend);
+			die(_("unknown ref storage format: '%s'"), ref_backend_uri);
 
 		repo_fmt->ref_storage_format = format;
+		free(repo_fmt->ref_storage_payload);
 		repo_fmt->ref_storage_payload = payload;
-
-		free(backend);
 	}
 }
 

-- 
2.55.0.1074.ge7621b4bad.dirty


^ permalink raw reply related	[flat|nested] 61+ messages in thread

* [PATCH v3 09/13] setup: refactor how we configure the ref storage format
  2026-09-09 11:12 ` [PATCH v3 00/13] Fix inconsistent ref storage format terminology Patrick Steinhardt
                     ` (7 preceding siblings ...)
  2026-09-09 11:12   ` [PATCH v3 08/13] refs: expose function to parse reference URIs Patrick Steinhardt
@ 2026-09-09 11:12   ` Patrick Steinhardt
  2026-09-09 11:12   ` [PATCH v3 10/13] setup: rename ref storage format environment variables Patrick Steinhardt
                     ` (3 subsequent siblings)
  12 siblings, 0 replies; 61+ messages in thread
From: Patrick Steinhardt @ 2026-09-09 11:12 UTC (permalink / raw)
  To: git; +Cc: Karthik Nayak, Junio C Hamano, Kaartic Sivaraam

When (re)initializing a repository we need to figure out the ref storage
format that the repository ought to use. This logic is surprisingly
complex, as we have grown a lot of different mechanisms over time to
configure the format. Unfortunately, as a result of this organic growth,
the logic that configures the storage format has grown very complex.

The biggest culprit here is that we're mixing the logic that determines
the desired storage format with the logic that validates whether the end
result is sane. This leads to some repetitive code, and makes it very
easy to forget validation for some of the branches.

In fact, the way we handle GIT_REFERENCE_BACKEND shows exactly one such
edge case where we don't properly validate. When initializing a
repository with one storage format and then reinitializing it with the
environment variable set to a different format then we'd corrupt the
repository because we silently change the format:

    $ git init repo
    $ git -C repo commit --allow-empty -m message
    $ GIT_REFERENCE_BACKEND=reftable git -C repo init
    fatal: could not open '.../refs/heads' for writing: Is a directory
    $ git -C repo log
    fatal: your current branch appears to be broken

Refactor the code so that we clearly distinguish between these two
different concerns. This lets us clearly spell out the precedence order
and makes the whole logic significantly easier to extend going forward.

Note that the new logic intentionally changes the precedence order so
that "GIT_REFERENCE_BACKEND" is now overridden by the
"--ref-storage-format=" command line option. This matches our usual
precedence order, where explicit command line arguments override
environment variables.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
 setup.c         | 103 +++++++++++++++++++++++++++++++++++---------------------
 t/t0001-init.sh |  12 ++++++-
 2 files changed, 75 insertions(+), 40 deletions(-)

diff --git a/setup.c b/setup.c
index 3be7dac452..38fa5e854c 100644
--- a/setup.c
+++ b/setup.c
@@ -2674,7 +2674,7 @@ static void separate_git_dir(struct repository *repo,
 
 struct default_format_config {
 	int hash;
-	enum ref_storage_format ref_format;
+	enum ref_storage_format ref_storage_format;
 };
 
 static int read_default_format_config(const char *key, const char *value,
@@ -2699,8 +2699,8 @@ static int read_default_format_config(const char *key, const char *value,
 		ret = git_config_string(&str, key, value);
 		if (ret)
 			goto out;
-		cfg->ref_format = ref_storage_format_by_name(str);
-		if (cfg->ref_format == REF_STORAGE_FORMAT_UNKNOWN)
+		cfg->ref_storage_format = ref_storage_format_by_name(str);
+		if (cfg->ref_storage_format == REF_STORAGE_FORMAT_UNKNOWN)
 			warning(_("unknown ref storage format '%s'"), str);
 		goto out;
 	}
@@ -2710,9 +2710,9 @@ static int read_default_format_config(const char *key, const char *value,
 	 * "init.defaultRefFormat" takes precedence over this setting.
 	 */
 	if (!strcmp(key, "feature.experimental") &&
-	    cfg->ref_format == REF_STORAGE_FORMAT_UNKNOWN &&
+	    cfg->ref_storage_format == REF_STORAGE_FORMAT_UNKNOWN &&
 	    git_config_bool(key, value)) {
-		cfg->ref_format = REF_STORAGE_FORMAT_REFTABLE;
+		cfg->ref_storage_format = REF_STORAGE_FORMAT_REFTABLE;
 		ret = 0;
 		goto out;
 	}
@@ -2724,18 +2724,18 @@ static int read_default_format_config(const char *key, const char *value,
 }
 
 static void repository_format_configure(struct repository_format *repo_fmt,
-					int hash, enum ref_storage_format ref_format)
+					int hash, enum ref_storage_format ref_storage_format)
 {
 	struct default_format_config cfg = {
 		.hash = GIT_HASH_UNKNOWN,
-		.ref_format = REF_STORAGE_FORMAT_UNKNOWN,
+		.ref_storage_format = REF_STORAGE_FORMAT_UNKNOWN,
 	};
 	struct config_options opts = {
 		.respect_includes = 1,
 		.ignore_repo = 1,
 		.ignore_worktree = 1,
 	};
-	const char *ref_backend_uri;
+	char *ref_storage_payload = NULL;
 	const char *env;
 
 	config_with_options(read_default_format_config, &cfg, NULL, NULL, &opts);
@@ -2761,40 +2761,65 @@ static void repository_format_configure(struct repository_format *repo_fmt,
 		repo_fmt->hash_algo = cfg.hash;
 	}
 
-	env = getenv("GIT_DEFAULT_REF_FORMAT");
-	if (repo_fmt->version >= 0 &&
-	    ref_format != REF_STORAGE_FORMAT_UNKNOWN &&
-	    ref_format != repo_fmt->ref_storage_format) {
-		die(_("attempt to reinitialize repository with different reference storage format"));
-	} else if (ref_format != REF_STORAGE_FORMAT_UNKNOWN) {
-		repo_fmt->ref_storage_format = ref_format;
-	} else if (env) {
-		ref_format = ref_storage_format_by_name(env);
-		if (ref_format == REF_STORAGE_FORMAT_UNKNOWN)
-			die(_("unknown ref storage format '%s'"), env);
-		if (repo_fmt->version < 0 ||
-		    repo_fmt->ref_storage_format == REF_STORAGE_FORMAT_UNKNOWN)
-			repo_fmt->ref_storage_format = ref_format;
-	} else if (cfg.ref_format != REF_STORAGE_FORMAT_UNKNOWN) {
-		repo_fmt->ref_storage_format = cfg.ref_format;
+	/*
+	 * We have the following order of preference when configuring the ref
+	 * storage format:
+	 *
+	 *   1. Explicit override via the command line, like in `git init
+	 *      --ref-storage-format=`.
+	 *
+	 *   2. Explicit override via the environment with
+	 *      GIT_REFERENCE_BACKEND.
+	 *
+	 *   3. Existing repository format. All the subsequent sources only
+	 *      kick in when there is no repository yet.
+	 *
+	 *   4. The default ref storage format for new repositories as
+	 *      configured via "GIT_DEFAULT_REF_FORMAT".
+	 *
+	 *   5. The default ref storage format for new repositories as
+	 *      configured via "init.defaultRefFormat"
+	 *
+	 *   6. Otherwise, we fall back to the default ref storage format
+	 *      compiled into Git.
+	 */
+	if (ref_storage_format != REF_STORAGE_FORMAT_UNKNOWN) {
+		/* nothing to do */
+	} else if ((env = getenv(GIT_REFERENCE_BACKEND_ENVIRONMENT))) {
+		ref_storage_format = ref_storage_format_by_uri(env, &ref_storage_payload);
+		if (ref_storage_format == REF_STORAGE_FORMAT_UNKNOWN)
+			die(_("unknown ref storage format specified via %s: '%s'"),
+			    GIT_REFERENCE_BACKEND_ENVIRONMENT, env);
+	} else if (repo_fmt->version >= 0) {
+		ref_storage_format = repo_fmt->ref_storage_format;
+		ref_storage_payload = xstrdup_or_null(repo_fmt->ref_storage_payload);
+	} else if ((env = getenv("GIT_DEFAULT_REF_FORMAT"))) {
+		ref_storage_format = ref_storage_format_by_name(env);
+		if (ref_storage_format == REF_STORAGE_FORMAT_UNKNOWN)
+			die(_("unknown ref storage format specified via %s: '%s'"),
+			    "GIT_DEFAULT_REF_FORMAT", env);
+	} else if (cfg.ref_storage_format != REF_STORAGE_FORMAT_UNKNOWN) {
+		ref_storage_format = cfg.ref_storage_format;
 	} else {
-		repo_fmt->ref_storage_format = REF_STORAGE_FORMAT_DEFAULT;
+		ref_storage_format = REF_STORAGE_FORMAT_DEFAULT;
 	}
 
-
-	ref_backend_uri = getenv(GIT_REFERENCE_BACKEND_ENVIRONMENT);
-	if (ref_backend_uri) {
-		enum ref_storage_format format;
-		char *payload;
-
-		format = ref_storage_format_by_uri(ref_backend_uri, &payload);
-		if (format == REF_STORAGE_FORMAT_UNKNOWN)
-			die(_("unknown ref storage format: '%s'"), ref_backend_uri);
-
-		repo_fmt->ref_storage_format = format;
-		free(repo_fmt->ref_storage_payload);
-		repo_fmt->ref_storage_payload = payload;
-	}
+	/*
+	 * If we have a preexisting repository we need to verify that its
+	 * current ref storage format does not change.
+	 */
+	if (repo_fmt->version >= 0) {
+		if (ref_storage_format != repo_fmt->ref_storage_format)
+			die(_("attempt to reinitialize repository with different reference storage format"));
+		if ((ref_storage_payload || repo_fmt->ref_storage_payload) &&
+		    strcmp(ref_storage_payload ? ref_storage_payload : "",
+			   repo_fmt->ref_storage_payload ? repo_fmt->ref_storage_payload : ""))
+			die(_("attempt to reinitialize repository with different reference storage payload"));
+	}
+
+	free(repo_fmt->ref_storage_payload);
+	repo_fmt->ref_storage_format = ref_storage_format;
+	repo_fmt->ref_storage_payload = ref_storage_payload;
 }
 
 int init_db(struct repository *repo,
diff --git a/t/t0001-init.sh b/t/t0001-init.sh
index 6f4431bed7..ca44dfc1ce 100755
--- a/t/t0001-init.sh
+++ b/t/t0001-init.sh
@@ -643,12 +643,22 @@ test_expect_success DEFAULT_REPO_FORMAT 'extensions.refStorage with unknown back
 test_expect_success 'init with GIT_DEFAULT_REF_FORMAT=garbage' '
 	test_when_finished "rm -rf refformat" &&
 	cat >expect <<-EOF &&
-	fatal: unknown ref storage format ${SQ}garbage${SQ}
+	fatal: unknown ref storage format specified via GIT_DEFAULT_REF_FORMAT: ${SQ}garbage${SQ}
 	EOF
 	test_must_fail env GIT_DEFAULT_REF_FORMAT=garbage git init refformat 2>err &&
 	test_cmp expect err
 '
 
+test_expect_success 'GIT_REFERENCE_BACKEND refuses to reinitialize with different storage format' '
+	test_when_finished "rm -rf refbackend" &&
+	git init --ref-storage-format=files refbackend &&
+	cat >expect <<-EOF &&
+	fatal: attempt to reinitialize repository with different reference storage format
+	EOF
+	test_must_fail env GIT_REFERENCE_BACKEND=reftable git init refbackend 2>err &&
+	test_cmp expect err
+'
+
 test_expect_success 'init warns about invalid init.defaultRefFormat' '
 	test_when_finished "rm -rf repo" &&
 	test_config_global init.defaultRefFormat garbage &&

-- 
2.55.0.1074.ge7621b4bad.dirty


^ permalink raw reply related	[flat|nested] 61+ messages in thread

* [PATCH v3 10/13] setup: rename ref storage format environment variables
  2026-09-09 11:12 ` [PATCH v3 00/13] Fix inconsistent ref storage format terminology Patrick Steinhardt
                     ` (8 preceding siblings ...)
  2026-09-09 11:12   ` [PATCH v3 09/13] setup: refactor how we configure the ref storage format Patrick Steinhardt
@ 2026-09-09 11:12   ` Patrick Steinhardt
  2026-09-09 11:12   ` [PATCH v3 11/13] t: rename GIT_TEST_DEFAULT_REF_FORMAT Patrick Steinhardt
                     ` (2 subsequent siblings)
  12 siblings, 0 replies; 61+ messages in thread
From: Patrick Steinhardt @ 2026-09-09 11:12 UTC (permalink / raw)
  To: git; +Cc: Karthik Nayak, Junio C Hamano, Kaartic Sivaraam

With the same reasoning as for git-init(1), rename the environment
variables GIT_REFERENCE_BACKEND and GIT_DEFAULT_REF_FORMAT to
GIT_REF_STORAGE_FORMAT and GIT_DEFAULT_REF_STORAGE_FORMAT, respectively.
The old names are kept as an alias to retain compatibility.

While at it, fix indentation for `GIT_REF_STORAGE_FORMAT` docs to use
tabs instead of spaces.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
 Documentation/config/init.adoc         |  2 +-
 Documentation/git.adoc                 | 16 +++++++----
 environment.h                          |  1 +
 setup.c                                | 28 +++++++++++++++----
 t/t0001-init.sh                        | 50 +++++++++++++++++-----------------
 t/t1419-exclude-refs.sh                | 16 +++++------
 t/t1423-ref-backend.sh                 | 18 ++++++------
 t/t7424-submodule-mixed-ref-formats.sh | 14 +++++-----
 t/test-lib.sh                          |  8 +++---
 9 files changed, 88 insertions(+), 65 deletions(-)

diff --git a/Documentation/config/init.adoc b/Documentation/config/init.adoc
index a048f0bddc..f82fcf25e6 100644
--- a/Documentation/config/init.adoc
+++ b/Documentation/config/init.adoc
@@ -16,7 +16,7 @@ endif::[]
 `init.defaultRefFormat`::
 	Allows overriding the default ref storage format for new repositories.
 	See `--ref-storage-format=` in linkgit:git-init[1]. Both the command line
-	option and the `GIT_DEFAULT_REF_FORMAT` environment variable take
+	option and the `GIT_DEFAULT_REF_STORAGE_FORMAT` environment variable take
 	precedence over this config.
 
 init.defaultSubmodulePathConfig::
diff --git a/Documentation/git.adoc b/Documentation/git.adoc
index 23ba65656e..cee0da28db 100644
--- a/Documentation/git.adoc
+++ b/Documentation/git.adoc
@@ -590,15 +590,21 @@ double-quotes and respecting backslash escapes. E.g., the value
 	is always used. The default is "sha1".
 	See `--object-format` in linkgit:git-init[1].
 
-`GIT_DEFAULT_REF_FORMAT`::
-	If this variable is set, the default reference backend format for new
+`GIT_DEFAULT_REF_STORAGE_FORMAT`::
+	If this variable is set, the default ref storage format for new
 	repositories will be set to this value. The default is "files".
 	See `--ref-storage-format` in linkgit:git-init[1].
 
+`GIT_DEFAULT_REF_FORMAT`::
+	Deprecated alias of `GIT_DEFAULT_REF_STORAGE_FORMAT`.
+
+`GIT_REF_STORAGE_FORMAT`::
+	Specify which ref storage format to use along with its URI.
+	See `extensions.refStorage` option in linkgit:git-config[1] for more
+	details. Overrides the config variable when used.
+
 `GIT_REFERENCE_BACKEND`::
-    Specify which reference backend to be used along with its URI.
-    See `extensions.refStorage` option in linkgit:git-config[1] for more
-    details. Overrides the config variable when used.
+	Deprecated alias of `GIT_REF_STORAGE_FORMAT`.
 
 Git Commits
 ~~~~~~~~~~~
diff --git a/environment.h b/environment.h
index e7ec5b0437..4bd8f08dee 100644
--- a/environment.h
+++ b/environment.h
@@ -44,6 +44,7 @@
 #define GIT_TEXT_DOMAIN_DIR_ENVIRONMENT "GIT_TEXTDOMAINDIR"
 #define GIT_ATTR_SOURCE_ENVIRONMENT "GIT_ATTR_SOURCE"
 #define GIT_REFERENCE_BACKEND_ENVIRONMENT "GIT_REFERENCE_BACKEND"
+#define GIT_REF_STORAGE_FORMAT_ENVIRONMENT "GIT_REF_STORAGE_FORMAT"
 
 /*
  * Environment variable used to propagate the --no-advice global option to the
diff --git a/setup.c b/setup.c
index 38fa5e854c..621cf87c9c 100644
--- a/setup.c
+++ b/setup.c
@@ -2049,7 +2049,9 @@ const char *setup_git_directory_gently(struct repository *repo, int *nongit_ok)
 			 * The env variable should override the repository config
 			 * for 'extensions.refStorage'.
 			 */
-			ref_backend_uri = getenv(GIT_REFERENCE_BACKEND_ENVIRONMENT);
+			ref_backend_uri = getenv(GIT_REF_STORAGE_FORMAT_ENVIRONMENT);
+			if (!ref_backend_uri)
+				ref_backend_uri = getenv(GIT_REFERENCE_BACKEND_ENVIRONMENT);
 			if (ref_backend_uri) {
 				FREE_AND_NULL(discovery.format.ref_storage_payload);
 				discovery.format.ref_storage_format =
@@ -2769,22 +2771,31 @@ static void repository_format_configure(struct repository_format *repo_fmt,
 	 *      --ref-storage-format=`.
 	 *
 	 *   2. Explicit override via the environment with
-	 *      GIT_REFERENCE_BACKEND.
+	 *      "GIT_REF_STORAGE_FORMAT".
 	 *
-	 *   3. Existing repository format. All the subsequent sources only
+	 *   3. Its deprecated equivalent "GIT_REFERENCE_BACKEND".
+	 *
+	 *   4. Existing repository format. All the subsequent sources only
 	 *      kick in when there is no repository yet.
 	 *
 	 *   4. The default ref storage format for new repositories as
-	 *      configured via "GIT_DEFAULT_REF_FORMAT".
+	 *      configured via "GIT_DEFAULT_REF_STORAGE_FORMAT".
+	 *
+	 *   5. Its deprecated equivalent "GIT_DEFAULT_REF_FORMAT".
 	 *
-	 *   5. The default ref storage format for new repositories as
+	 *   6. The default ref storage format for new repositories as
 	 *      configured via "init.defaultRefFormat"
 	 *
-	 *   6. Otherwise, we fall back to the default ref storage format
+	 *   7. Otherwise, we fall back to the default ref storage format
 	 *      compiled into Git.
 	 */
 	if (ref_storage_format != REF_STORAGE_FORMAT_UNKNOWN) {
 		/* nothing to do */
+	} else if ((env = getenv(GIT_REF_STORAGE_FORMAT_ENVIRONMENT))) {
+		ref_storage_format = ref_storage_format_by_uri(env, &ref_storage_payload);
+		if (ref_storage_format == REF_STORAGE_FORMAT_UNKNOWN)
+			die(_("unknown ref storage format specified via %s: '%s'"),
+			    GIT_REF_STORAGE_FORMAT_ENVIRONMENT, env);
 	} else if ((env = getenv(GIT_REFERENCE_BACKEND_ENVIRONMENT))) {
 		ref_storage_format = ref_storage_format_by_uri(env, &ref_storage_payload);
 		if (ref_storage_format == REF_STORAGE_FORMAT_UNKNOWN)
@@ -2793,6 +2804,11 @@ static void repository_format_configure(struct repository_format *repo_fmt,
 	} else if (repo_fmt->version >= 0) {
 		ref_storage_format = repo_fmt->ref_storage_format;
 		ref_storage_payload = xstrdup_or_null(repo_fmt->ref_storage_payload);
+	} else if ((env = getenv("GIT_DEFAULT_REF_STORAGE_FORMAT"))) {
+		ref_storage_format = ref_storage_format_by_name(env);
+		if (ref_storage_format == REF_STORAGE_FORMAT_UNKNOWN)
+			die(_("unknown ref storage format specified via %s: '%s'"),
+			    "GIT_DEFAULT_REF_STORAGE_FORMAT", env);
 	} else if ((env = getenv("GIT_DEFAULT_REF_FORMAT"))) {
 		ref_storage_format = ref_storage_format_by_name(env);
 		if (ref_storage_format == REF_STORAGE_FORMAT_UNKNOWN)
diff --git a/t/t0001-init.sh b/t/t0001-init.sh
index ca44dfc1ce..af9a7ba958 100755
--- a/t/t0001-init.sh
+++ b/t/t0001-init.sh
@@ -640,22 +640,22 @@ test_expect_success DEFAULT_REPO_FORMAT 'extensions.refStorage with unknown back
 	test_grep "invalid value for ${SQ}extensions.refstorage${SQ}: ${SQ}garbage${SQ}" err
 '
 
-test_expect_success 'init with GIT_DEFAULT_REF_FORMAT=garbage' '
+test_expect_success 'init with GIT_DEFAULT_REF_STORAGE_FORMAT=garbage' '
 	test_when_finished "rm -rf refformat" &&
 	cat >expect <<-EOF &&
-	fatal: unknown ref storage format specified via GIT_DEFAULT_REF_FORMAT: ${SQ}garbage${SQ}
+	fatal: unknown ref storage format specified via GIT_DEFAULT_REF_STORAGE_FORMAT: ${SQ}garbage${SQ}
 	EOF
-	test_must_fail env GIT_DEFAULT_REF_FORMAT=garbage git init refformat 2>err &&
+	test_must_fail env GIT_DEFAULT_REF_STORAGE_FORMAT=garbage git init refformat 2>err &&
 	test_cmp expect err
 '
 
-test_expect_success 'GIT_REFERENCE_BACKEND refuses to reinitialize with different storage format' '
+test_expect_success 'GIT_REF_STORAGE_FORMAT refuses to reinitialize with different storage format' '
 	test_when_finished "rm -rf refbackend" &&
 	git init --ref-storage-format=files refbackend &&
 	cat >expect <<-EOF &&
 	fatal: attempt to reinitialize repository with different reference storage format
 	EOF
-	test_must_fail env GIT_REFERENCE_BACKEND=reftable git init refbackend 2>err &&
+	test_must_fail env GIT_REF_STORAGE_FORMAT=reftable git init refbackend 2>err &&
 	test_cmp expect err
 '
 
@@ -668,14 +668,14 @@ test_expect_success 'init warns about invalid init.defaultRefFormat' '
 	test_cmp expect err &&
 
 	git -C repo rev-parse --show-ref-storage-format >actual &&
-	echo $GIT_DEFAULT_REF_FORMAT >expected &&
+	echo $GIT_DEFAULT_REF_STORAGE_FORMAT >expected &&
 	test_cmp expected actual
 '
 
 test_expect_success 'default ref format' '
 	test_when_finished "rm -rf refformat" &&
 	(
-		sane_unset GIT_DEFAULT_REF_FORMAT &&
+		sane_unset GIT_DEFAULT_REF_STORAGE_FORMAT &&
 		git init refformat
 	) &&
 	git version --build-options | sed -ne "s/^default-ref-storage-format: //p" >expect &&
@@ -686,9 +686,9 @@ test_expect_success 'default ref format' '
 backends="files reftable"
 for format in $backends
 do
-	test_expect_success DEFAULT_REPO_FORMAT "init with GIT_DEFAULT_REF_FORMAT=$format" '
+	test_expect_success DEFAULT_REPO_FORMAT "init with GIT_DEFAULT_REF_STORAGE_FORMAT=$format" '
 		test_when_finished "rm -rf refformat" &&
-		GIT_DEFAULT_REF_FORMAT=$format git init refformat &&
+		GIT_DEFAULT_REF_STORAGE_FORMAT=$format git init refformat &&
 
 		if test $format = files
 		then
@@ -718,7 +718,7 @@ do
 		test_when_finished "rm -rf refformat" &&
 		test_config_global init.defaultRefFormat $format &&
 		(
-			sane_unset GIT_DEFAULT_REF_FORMAT &&
+			sane_unset GIT_DEFAULT_REF_STORAGE_FORMAT &&
 			git init refformat
 		) &&
 
@@ -727,37 +727,37 @@ do
 		test_cmp expect actual
 	'
 
-	test_expect_success "--ref-storage-format=$format overrides GIT_DEFAULT_REF_FORMAT" '
+	test_expect_success "--ref-storage-format=$format overrides GIT_DEFAULT_REF_STORAGE_FORMAT" '
 		test_when_finished "rm -rf refformat" &&
-		GIT_DEFAULT_REF_FORMAT=garbage git init --ref-storage-format=$format refformat &&
+		GIT_DEFAULT_REF_STORAGE_FORMAT=garbage git init --ref-storage-format=$format refformat &&
 		echo $format >expect &&
 		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_expect_success "reinit repository with GIT_DEFAULT_REF_STORAGE_FORMAT=$format does not change format" '
 		test_when_finished "rm -rf refformat" &&
 		git init refformat &&
 		git -C refformat rev-parse --show-ref-storage-format >expect &&
-		GIT_DEFAULT_REF_FORMAT=$format git init refformat &&
+		GIT_DEFAULT_REF_STORAGE_FORMAT=$format git init refformat &&
 		git -C refformat rev-parse --show-ref-storage-format >actual &&
 		test_cmp expect actual
 	'
 done
 
-test_expect_success "--ref-storage-format= overrides GIT_DEFAULT_REF_FORMAT" '
+test_expect_success "--ref-storage-format= overrides GIT_DEFAULT_REF_STORAGE_FOMAT" '
 	test_when_finished "rm -rf refformat" &&
-	GIT_DEFAULT_REF_FORMAT=files git init --ref-storage-format=reftable refformat &&
+	GIT_DEFAULT_REF_STORAGE_FORMAT=files git init --ref-storage-format=reftable refformat &&
 	echo reftable >expect &&
 	git -C refformat rev-parse --show-ref-storage-format >actual &&
 	test_cmp expect actual
 '
 
-test_expect_success "GIT_DEFAULT_REF_FORMAT= overrides init.defaultRefFormat" '
+test_expect_success "GIT_DEFAULT_REF_STORAGE_FORMAT= overrides init.defaultRefFormat" '
 	test_when_finished "rm -rf refformat" &&
 	test_config_global init.defaultRefFormat files &&
 
-	GIT_DEFAULT_REF_FORMAT=reftable git init refformat &&
+	GIT_DEFAULT_REF_STORAGE_FORMAT=reftable git init refformat &&
 	echo reftable >expect &&
 	git -C refformat rev-parse --show-ref-storage-format >actual &&
 	test_cmp expect actual
@@ -767,7 +767,7 @@ test_expect_success "init with feature.experimental=true" '
 	test_when_finished "rm -rf refformat" &&
 	test_config_global feature.experimental true &&
 	(
-		sane_unset GIT_DEFAULT_REF_FORMAT &&
+		sane_unset GIT_DEFAULT_REF_STORAGE_FORMAT &&
 		git init refformat
 	) &&
 	echo reftable >expect &&
@@ -780,7 +780,7 @@ test_expect_success "init.defaultRefFormat overrides feature.experimental=true"
 	test_config_global feature.experimental true &&
 	test_config_global init.defaultRefFormat files &&
 	(
-		sane_unset GIT_DEFAULT_REF_FORMAT &&
+		sane_unset GIT_DEFAULT_REF_STORAGE_FORMAT &&
 		git init refformat
 	) &&
 	echo files >expect &&
@@ -788,10 +788,10 @@ test_expect_success "init.defaultRefFormat overrides feature.experimental=true"
 	test_cmp expect actual
 '
 
-test_expect_success "GIT_DEFAULT_REF_FORMAT= overrides feature.experimental=true" '
+test_expect_success "GIT_DEFAULT_REF_STORAGE_FORMAT= overrides feature.experimental=true" '
 	test_when_finished "rm -rf refformat" &&
 	test_config_global feature.experimental true &&
-	GIT_DEFAULT_REF_FORMAT=files git init refformat &&
+	GIT_DEFAULT_REF_STORAGE_FORMAT=files git init refformat &&
 	echo files >expect &&
 	git -C refformat rev-parse --show-ref-storage-format >actual &&
 	test_cmp expect actual
@@ -942,7 +942,7 @@ test_expect_success 'branch -m with the initial branch' '
 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 &&
+	echo $GIT_DEFAULT_REF_STORAGE_FORMAT >expect &&
 	git -C repo rev-parse --show-ref-storage-format >actual &&
 	test_cmp expect actual
 '
@@ -951,7 +951,7 @@ test_expect_success 'init with includeIf.onbranch condition with existing direct
 	test_when_finished "rm -rf repo" &&
 	mkdir repo &&
 	git -c includeIf.onbranch:nonexistent.path=/does/not/exist init repo &&
-	echo $GIT_DEFAULT_REF_FORMAT >expect &&
+	echo $GIT_DEFAULT_REF_STORAGE_FORMAT >expect &&
 	git -C repo rev-parse --show-ref-storage-format >actual &&
 	test_cmp expect actual
 '
@@ -960,7 +960,7 @@ test_expect_success 're-init with includeIf.onbranch condition' '
 	test_when_finished "rm -rf repo" &&
 	git init repo &&
 	git -c includeIf.onbranch:nonexistent.path=/does/not/exist init repo &&
-	echo $GIT_DEFAULT_REF_FORMAT >expect &&
+	echo $GIT_DEFAULT_REF_STORAGE_FORMAT >expect &&
 	git -C repo rev-parse --show-ref-storage-format >actual &&
 	test_cmp expect actual
 '
diff --git a/t/t1419-exclude-refs.sh b/t/t1419-exclude-refs.sh
index 04797aee59..50237a5aeb 100755
--- a/t/t1419-exclude-refs.sh
+++ b/t/t1419-exclude-refs.sh
@@ -21,13 +21,13 @@ assert_jumps () {
 	local nr="$1"
 	local trace="$2"
 
-	case "$GIT_DEFAULT_REF_FORMAT" in
+	case "$GIT_DEFAULT_REF_STORAGE_FORMAT" in
 	files)
 		grep -q "name:jumps_made value:$nr$" $trace;;
 	reftable)
 		grep -q "name:reseeks_made value:$nr$" $trace;;
 	*)
-		BUG "unhandled ref format $GIT_DEFAULT_REF_FORMAT";;
+		BUG "unhandled ref storage format $GIT_DEFAULT_REF_STORAGE_FORMAT";;
 	esac
 }
 
@@ -93,13 +93,13 @@ test_expect_success 'adjacent, non-overlapping excluded regions' '
 	for_each_ref refs/heads/foo refs/heads/quux >expect &&
 
 	test_cmp expect actual &&
-	case "$GIT_DEFAULT_REF_FORMAT" in
+	case "$GIT_DEFAULT_REF_STORAGE_FORMAT" in
 	files)
 		assert_jumps 1 perf;;
 	reftable)
 		assert_jumps 2 perf;;
 	*)
-		BUG "unhandled ref format $GIT_DEFAULT_REF_FORMAT";;
+		BUG "unhandled ref storage format $GIT_DEFAULT_REF_STORAGE_FORMAT";;
 	esac
 '
 
@@ -125,13 +125,13 @@ test_expect_success 'several overlapping excluded regions' '
 	for_each_ref refs/heads/quux >expect &&
 
 	test_cmp expect actual &&
-	case "$GIT_DEFAULT_REF_FORMAT" in
+	case "$GIT_DEFAULT_REF_STORAGE_FORMAT" in
 	files)
 		assert_jumps 1 perf;;
 	reftable)
 		assert_jumps 3 perf;;
 	*)
-		BUG "unhandled ref format $GIT_DEFAULT_REF_FORMAT";;
+		BUG "unhandled ref storage format $GIT_DEFAULT_REF_STORAGE_FORMAT";;
 	esac
 '
 
@@ -141,13 +141,13 @@ test_expect_success 'unordered excludes' '
 	for_each_ref refs/heads/bar refs/heads/quux >expect &&
 
 	test_cmp expect actual &&
-	case "$GIT_DEFAULT_REF_FORMAT" in
+	case "$GIT_DEFAULT_REF_STORAGE_FORMAT" in
 	files)
 		assert_jumps 1 perf;;
 	reftable)
 		assert_jumps 2 perf;;
 	*)
-		BUG "unhandled ref format $GIT_DEFAULT_REF_FORMAT";;
+		BUG "unhandled ref storage format $GIT_DEFAULT_REF_STORAGE_FORMAT";;
 	esac
 '
 
diff --git a/t/t1423-ref-backend.sh b/t/t1423-ref-backend.sh
index ab119a6568..525b2a19b4 100755
--- a/t/t1423-ref-backend.sh
+++ b/t/t1423-ref-backend.sh
@@ -12,7 +12,7 @@ test_description='Test reference backend URIs'
 #   <uri> is the new URI to be set for the ref storage.
 #   <cmd> is the git subcommand to be run in the repository.
 #   <via> if 'config', set the backend via the 'extensions.refStorage' config.
-#         if 'env', set the backend via the 'GIT_REFERENCE_BACKEND' env.
+#         if 'env', set the backend via the 'GIT_REF_STORAGE_FORMAT' env.
 run_with_uri () {
 	repo=$1 &&
 	backend=$2 &&
@@ -23,7 +23,7 @@ run_with_uri () {
 	git -C "$repo" config set core.repositoryformatversion 1 &&
 	if test "$via" = "env"
 	then
-		test_env GIT_REFERENCE_BACKEND="$uri" git -C "$repo" $cmd
+		test_env GIT_REF_STORAGE_FORMAT="$uri" git -C "$repo" $cmd
 	elif test "$via" = "config"
 	then
 		git -C "$repo" config set extensions.refStorage "$uri" &&
@@ -40,7 +40,7 @@ run_with_uri () {
 #   <backend> is the original ref storage of the repo.
 #   <uri> is the new URI to be set for the ref storage.
 #   <via> if 'config', set the backend via the 'extensions.refStorage' config.
-#         if 'env', set the backend via the 'GIT_REFERENCE_BACKEND' env.
+#         if 'env', set the backend via the 'GIT_REF_STORAGE_FORMAT' env.
 #   <err_msg> (optional) if set, check if 'git-refs(1)' failed with the provided msg.
 test_refs_backend () {
 	repo=$1 &&
@@ -54,7 +54,7 @@ test_refs_backend () {
 	then
 		if test "$via" = "env"
 		then
-			test_env GIT_REFERENCE_BACKEND="$uri" test_must_fail git -C "$repo" refs list 2>err
+			test_env GIT_REF_STORAGE_FORMAT="$uri" test_must_fail git -C "$repo" refs list 2>err
 		elif test "$via" = "config"
 		then
 			git -C "$repo" config set extensions.refStorage "$uri" &&
@@ -83,7 +83,7 @@ verify_files_exist () {
 	test_cmp expect $gitdir/HEAD
 
 	# verify that backend specific files exist.
-	case "$GIT_DEFAULT_REF_FORMAT" in
+	case "$GIT_DEFAULT_REF_STORAGE_FORMAT" in
 	files)
 		test_path_is_dir $refdir/refs/heads &&
 		test_path_is_file $refdir/HEAD;;
@@ -91,7 +91,7 @@ verify_files_exist () {
 		test_path_is_dir $refdir/reftable &&
 		test_path_is_file $refdir/reftable/tables.list;;
 	*)
-		BUG "unhandled ref format $GIT_DEFAULT_REF_FORMAT";;
+		BUG "unhandled ref storage format $GIT_DEFAULT_REF_STORAGE_FORMAT";;
 	esac
 }
 
@@ -210,7 +210,7 @@ do
 	test_expect_success "migrating repository to $to_format with alternate refs directory" '
 		test_when_finished "rm -rf repo refdir" &&
 		mkdir refdir &&
-		GIT_REFERENCE_BACKEND="${from_format}://$(pwd)/refdir" git init repo &&
+		GIT_REF_STORAGE_FORMAT="${from_format}://$(pwd)/refdir" git init repo &&
 		(
 			cd repo &&
 
@@ -235,7 +235,7 @@ test_expect_success 'initializing repository with alt ref directory' '
 	test_when_finished "rm -rf repo refdir" &&
 	mkdir refdir &&
 	BACKEND="$(test_detect_ref_format)://$(pwd)/refdir" &&
-	GIT_REFERENCE_BACKEND=$BACKEND git init repo &&
+	GIT_REF_STORAGE_FORMAT=$BACKEND git init repo &&
 	verify_files_exist repo/.git refdir &&
 	(
 		cd repo &&
@@ -264,7 +264,7 @@ test_expect_success 'cloning repository with alt ref directory' '
 	test_commit -C source 3 &&
 
 	BACKEND="$(test_detect_ref_format)://$(pwd)/refdir" &&
-	GIT_REFERENCE_BACKEND=$BACKEND git clone source repo &&
+	GIT_REF_STORAGE_FORMAT=$BACKEND git clone source repo &&
 
 	git -C repo config get extensions.refstorage >actual &&
 	echo $BACKEND >expect &&
diff --git a/t/t7424-submodule-mixed-ref-formats.sh b/t/t7424-submodule-mixed-ref-formats.sh
index 9707744644..197c02bcf0 100755
--- a/t/t7424-submodule-mixed-ref-formats.sh
+++ b/t/t7424-submodule-mixed-ref-formats.sh
@@ -12,7 +12,7 @@ test_ref_format () {
 
 for OTHER_FORMAT in files reftable
 do
-	if test "$OTHER_FORMAT" = "$GIT_DEFAULT_REF_FORMAT"
+	if test "$OTHER_FORMAT" = "$GIT_DEFAULT_REF_STORAGE_FORMAT"
 	then
 		continue
 	fi
@@ -43,7 +43,7 @@ test_expect_success 'add submodules with different ref storage format' '
 	git init submodule &&
 	test_commit -C submodule submodule-initial &&
 	git init upstream &&
-	test_ref_format upstream "$GIT_DEFAULT_REF_FORMAT" &&
+	test_ref_format upstream "$GIT_DEFAULT_REF_STORAGE_FORMAT" &&
 	git -C upstream submodule add --ref-storage-format="$OTHER_FORMAT" "file://$(pwd)/submodule" &&
 	test_ref_format upstream/submodule "$OTHER_FORMAT"
 '
@@ -59,8 +59,8 @@ test_expect_success 'recursive clone propagates ref storage format' '
 
 	# The upstream repository and its submodule should be using the default
 	# ref format.
-	test_ref_format upstream "$GIT_DEFAULT_REF_FORMAT" &&
-	test_ref_format upstream/submodule "$GIT_DEFAULT_REF_FORMAT" &&
+	test_ref_format upstream "$GIT_DEFAULT_REF_STORAGE_FORMAT" &&
+	test_ref_format upstream/submodule "$GIT_DEFAULT_REF_STORAGE_FORMAT" &&
 
 	# The cloned repositories should use the other ref format that we have
 	# specified via `--ref-storage-format`. The option should propagate to cloned
@@ -81,7 +81,7 @@ test_expect_success 'clone submodules with different ref storage format' '
 	git -C upstream commit -m "upstream submodule" &&
 
 	git clone --no-recurse-submodules "file://$(pwd)/upstream" downstream &&
-	test_ref_format downstream "$GIT_DEFAULT_REF_FORMAT" &&
+	test_ref_format downstream "$GIT_DEFAULT_REF_STORAGE_FORMAT" &&
 	git -C downstream submodule update --init --ref-storage-format=$OTHER_FORMAT &&
 	test_ref_format downstream/submodule "$OTHER_FORMAT"
 '
@@ -98,7 +98,7 @@ test_expect_success 'status with mixed submodule ref storages' '
 
 	# The main repository should use the default ref format now, whereas
 	# the submodule should use the other format.
-	test_ref_format main "$GIT_DEFAULT_REF_FORMAT" &&
+	test_ref_format main "$GIT_DEFAULT_REF_STORAGE_FORMAT" &&
 	test_ref_format main/submodule "$OTHER_FORMAT" &&
 
 	cat >expect <<-EOF &&
@@ -123,7 +123,7 @@ test_expect_success 'recursive pull with mixed formats' '
 	# submodules have different formats.
 	git clone --no-recurse-submodules "file://$(pwd)/upstream" downstream &&
 	git -C downstream submodule update --init --ref-storage-format=$OTHER_FORMAT &&
-	test_ref_format downstream "$GIT_DEFAULT_REF_FORMAT" &&
+	test_ref_format downstream "$GIT_DEFAULT_REF_STORAGE_FORMAT" &&
 	test_ref_format downstream/submodule "$OTHER_FORMAT" &&
 
 	# Update the upstream submodule as well as the owning repository such
diff --git a/t/test-lib.sh b/t/test-lib.sh
index 1f0505e412..60a2179a0a 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -575,8 +575,8 @@ export EDITOR
 GIT_TEST_BUILTIN_HASH=$("$GIT_BINARY" version --build-options | sed -ne 's/^default-hash: //p')
 GIT_DEFAULT_HASH="${GIT_TEST_DEFAULT_HASH:-$GIT_TEST_BUILTIN_HASH}"
 export GIT_DEFAULT_HASH
-GIT_DEFAULT_REF_FORMAT="${GIT_TEST_DEFAULT_REF_FORMAT:-files}"
-export GIT_DEFAULT_REF_FORMAT
+GIT_DEFAULT_REF_STORAGE_FORMAT="${GIT_TEST_DEFAULT_REF_FORMAT:-files}"
+export GIT_DEFAULT_REF_STORAGE_FORMAT
 
 # Tests using GIT_TRACE typically don't want <timestamp> <file>:<line> output
 GIT_TRACE_BARE=1
@@ -1752,13 +1752,13 @@ parisc* | hppa*)
 	;;
 esac
 
-case "$GIT_DEFAULT_REF_FORMAT" in
+case "$GIT_DEFAULT_REF_STORAGE_FORMAT" in
 files)
 	test_set_prereq REFFILES;;
 reftable)
 	test_set_prereq REFTABLE;;
 *)
-	echo 2>&1 "error: unknown ref format $GIT_DEFAULT_REF_FORMAT"
+	echo 2>&1 "error: unknown ref storage format $GIT_DEFAULT_REF_STORAGE_FORMAT"
 	exit 1
 	;;
 esac

-- 
2.55.0.1074.ge7621b4bad.dirty


^ permalink raw reply related	[flat|nested] 61+ messages in thread

* [PATCH v3 11/13] t: rename GIT_TEST_DEFAULT_REF_FORMAT
  2026-09-09 11:12 ` [PATCH v3 00/13] Fix inconsistent ref storage format terminology Patrick Steinhardt
                     ` (9 preceding siblings ...)
  2026-09-09 11:12   ` [PATCH v3 10/13] setup: rename ref storage format environment variables Patrick Steinhardt
@ 2026-09-09 11:12   ` Patrick Steinhardt
  2026-09-09 11:12   ` [PATCH v3 12/13] setup: rename "init.defaultRefFormat" to "init.defaultRefStorageFormat" Patrick Steinhardt
  2026-09-09 11:12   ` [PATCH v3 13/13] setup: allow "--ref-storage-format=" to specify a payload Patrick Steinhardt
  12 siblings, 0 replies; 61+ messages in thread
From: Patrick Steinhardt @ 2026-09-09 11:12 UTC (permalink / raw)
  To: git; +Cc: Karthik Nayak, Junio C Hamano, Kaartic Sivaraam

With the same reasoning as for all the other environment variables,
rename the GIT_TEST_DEFAULT_REF_FORMAT environment variable to
GIT_TEST_DEFAULT_REF_STORAGE_FORMAT.

Note that in this case, the old name is not retained for backwards
compatibility as this is only running in the context of tests anyway.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
 ci/run-build-and-tests.sh              | 2 +-
 t/README                               | 4 ++--
 t/t0600-reffiles-backend.sh            | 4 ++--
 t/t0601-reffiles-pack-refs.sh          | 4 ++--
 t/t0602-reffiles-fsck.sh               | 4 ++--
 t/t0610-reftable-basics.sh             | 4 ++--
 t/t0612-reftable-jgit-compatibility.sh | 4 ++--
 t/t0613-reftable-write-options.sh      | 4 ++--
 t/t0614-reftable-fsck.sh               | 4 ++--
 t/t1463-refs-optimize.sh               | 4 ++--
 t/test-lib-functions.sh                | 2 +-
 t/test-lib.sh                          | 2 +-
 12 files changed, 21 insertions(+), 21 deletions(-)

diff --git a/ci/run-build-and-tests.sh b/ci/run-build-and-tests.sh
index 1d9a0a736d..6a3b43b366 100755
--- a/ci/run-build-and-tests.sh
+++ b/ci/run-build-and-tests.sh
@@ -45,7 +45,7 @@ linux-sha256)
 	export GIT_TEST_DEFAULT_HASH=sha256
 	;;
 linux-reftable|linux-reftable-leaks|osx-reftable)
-	export GIT_TEST_DEFAULT_REF_FORMAT=reftable
+	export GIT_TEST_DEFAULT_REF_STORAGE_FORMAT=reftable
 	;;
 
 esac
diff --git a/t/README b/t/README
index 9a9daaf2af..42716bb14a 100644
--- a/t/README
+++ b/t/README
@@ -448,8 +448,8 @@ GIT_TEST_DEFAULT_HASH=<hash-algo> specifies which hash algorithm to
 use in the test scripts. Recognized values for <hash-algo> are "sha1"
 and "sha256".
 
-GIT_TEST_DEFAULT_REF_FORMAT=<format> specifies which ref storage format to use
-in the test scripts. Recognized values for <format> are "files" and
+GIT_TEST_DEFAULT_REF_STORAGE_FORMAT=<format> specifies which ref storage format
+to use in the test scripts. Recognized values for <format> are "files" and
 "reftable".
 
 GIT_TEST_NO_WRITE_REV_INDEX=<boolean>, when true disables the
diff --git a/t/t0600-reffiles-backend.sh b/t/t0600-reffiles-backend.sh
index bbbf6fa422..23e38a1695 100755
--- a/t/t0600-reffiles-backend.sh
+++ b/t/t0600-reffiles-backend.sh
@@ -4,8 +4,8 @@ test_description='Test reffiles backend'
 
 GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
-GIT_TEST_DEFAULT_REF_FORMAT=files
-export GIT_TEST_DEFAULT_REF_FORMAT
+GIT_TEST_DEFAULT_REF_STORAGE_FORMAT=files
+export GIT_TEST_DEFAULT_REF_STORAGE_FORMAT
 
 . ./test-lib.sh
 
diff --git a/t/t0601-reffiles-pack-refs.sh b/t/t0601-reffiles-pack-refs.sh
index 3c706978ef..17283f8bea 100755
--- a/t/t0601-reffiles-pack-refs.sh
+++ b/t/t0601-reffiles-pack-refs.sh
@@ -12,8 +12,8 @@ semantic is still the same.
 
 GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
-GIT_TEST_DEFAULT_REF_FORMAT=files
-export GIT_TEST_DEFAULT_REF_FORMAT
+GIT_TEST_DEFAULT_REF_STORAGE_FORMAT=files
+export GIT_TEST_DEFAULT_REF_STORAGE_FORMAT
 
 . ./test-lib.sh
 
diff --git a/t/t0602-reffiles-fsck.sh b/t/t0602-reffiles-fsck.sh
index 13259821a0..10781417fd 100755
--- a/t/t0602-reffiles-fsck.sh
+++ b/t/t0602-reffiles-fsck.sh
@@ -4,8 +4,8 @@ test_description='Test reffiles backend consistency check'
 
 GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
-GIT_TEST_DEFAULT_REF_FORMAT=files
-export GIT_TEST_DEFAULT_REF_FORMAT
+GIT_TEST_DEFAULT_REF_STORAGE_FORMAT=files
+export GIT_TEST_DEFAULT_REF_STORAGE_FORMAT
 
 . ./test-lib.sh
 
diff --git a/t/t0610-reftable-basics.sh b/t/t0610-reftable-basics.sh
index b6db54430a..065d6a69b4 100755
--- a/t/t0610-reftable-basics.sh
+++ b/t/t0610-reftable-basics.sh
@@ -7,8 +7,8 @@ test_description='reftable basics'
 
 GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
-GIT_TEST_DEFAULT_REF_FORMAT=reftable
-export GIT_TEST_DEFAULT_REF_FORMAT
+GIT_TEST_DEFAULT_REF_STORAGE_FORMAT=reftable
+export GIT_TEST_DEFAULT_REF_STORAGE_FORMAT
 
 . ./test-lib.sh
 
diff --git a/t/t0612-reftable-jgit-compatibility.sh b/t/t0612-reftable-jgit-compatibility.sh
index 7df2ad5817..eddfd9a152 100755
--- a/t/t0612-reftable-jgit-compatibility.sh
+++ b/t/t0612-reftable-jgit-compatibility.sh
@@ -4,8 +4,8 @@ test_description='reftables are compatible with JGit'
 
 GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
-GIT_TEST_DEFAULT_REF_FORMAT=reftable
-export GIT_TEST_DEFAULT_REF_FORMAT
+GIT_TEST_DEFAULT_REF_STORAGE_FORMAT=reftable
+export GIT_TEST_DEFAULT_REF_STORAGE_FORMAT
 
 # JGit does not support the 'link' DIRC extension.
 GIT_TEST_SPLIT_INDEX=0
diff --git a/t/t0613-reftable-write-options.sh b/t/t0613-reftable-write-options.sh
index a65960d048..0b27d75fe3 100755
--- a/t/t0613-reftable-write-options.sh
+++ b/t/t0613-reftable-write-options.sh
@@ -2,8 +2,8 @@
 
 test_description='reftable write options'
 
-GIT_TEST_DEFAULT_REF_FORMAT=reftable
-export GIT_TEST_DEFAULT_REF_FORMAT
+GIT_TEST_DEFAULT_REF_STORAGE_FORMAT=reftable
+export GIT_TEST_DEFAULT_REF_STORAGE_FORMAT
 # Disable auto-compaction for all tests as we explicitly control repacking of
 # refs.
 GIT_TEST_REFTABLE_AUTOCOMPACTION=false
diff --git a/t/t0614-reftable-fsck.sh b/t/t0614-reftable-fsck.sh
index d24b87f961..9576a82478 100755
--- a/t/t0614-reftable-fsck.sh
+++ b/t/t0614-reftable-fsck.sh
@@ -2,8 +2,8 @@
 
 test_description='Test reftable backend consistency check'
 
-GIT_TEST_DEFAULT_REF_FORMAT=reftable
-export GIT_TEST_DEFAULT_REF_FORMAT
+GIT_TEST_DEFAULT_REF_STORAGE_FORMAT=reftable
+export GIT_TEST_DEFAULT_REF_STORAGE_FORMAT
 
 . ./test-lib.sh
 
diff --git a/t/t1463-refs-optimize.sh b/t/t1463-refs-optimize.sh
index 9afe3c1ed7..b4b9735828 100755
--- a/t/t1463-refs-optimize.sh
+++ b/t/t1463-refs-optimize.sh
@@ -8,8 +8,8 @@ semantic is still the same.
 
 GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
-GIT_TEST_DEFAULT_REF_FORMAT=files
-export GIT_TEST_DEFAULT_REF_FORMAT
+GIT_TEST_DEFAULT_REF_STORAGE_FORMAT=files
+export GIT_TEST_DEFAULT_REF_STORAGE_FORMAT
 
 . ./test-lib.sh
 
diff --git a/t/test-lib-functions.sh b/t/test-lib-functions.sh
index ed9779b0f7..09a41d51ad 100644
--- a/t/test-lib-functions.sh
+++ b/t/test-lib-functions.sh
@@ -1737,7 +1737,7 @@ test_detect_hash () {
 
 # Detect the ref format in use.
 test_detect_ref_format () {
-	echo "${GIT_TEST_DEFAULT_REF_FORMAT:-files}"
+	echo "${GIT_TEST_DEFAULT_REF_STORAGE_FORMAT:-files}"
 }
 
 # Load common hash metadata and common placeholder object IDs for use with
diff --git a/t/test-lib.sh b/t/test-lib.sh
index 60a2179a0a..321c2ba339 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -575,7 +575,7 @@ export EDITOR
 GIT_TEST_BUILTIN_HASH=$("$GIT_BINARY" version --build-options | sed -ne 's/^default-hash: //p')
 GIT_DEFAULT_HASH="${GIT_TEST_DEFAULT_HASH:-$GIT_TEST_BUILTIN_HASH}"
 export GIT_DEFAULT_HASH
-GIT_DEFAULT_REF_STORAGE_FORMAT="${GIT_TEST_DEFAULT_REF_FORMAT:-files}"
+GIT_DEFAULT_REF_STORAGE_FORMAT="${GIT_TEST_DEFAULT_REF_STORAGE_FORMAT:-files}"
 export GIT_DEFAULT_REF_STORAGE_FORMAT
 
 # Tests using GIT_TRACE typically don't want <timestamp> <file>:<line> output

-- 
2.55.0.1074.ge7621b4bad.dirty


^ permalink raw reply related	[flat|nested] 61+ messages in thread

* [PATCH v3 12/13] setup: rename "init.defaultRefFormat" to "init.defaultRefStorageFormat"
  2026-09-09 11:12 ` [PATCH v3 00/13] Fix inconsistent ref storage format terminology Patrick Steinhardt
                     ` (10 preceding siblings ...)
  2026-09-09 11:12   ` [PATCH v3 11/13] t: rename GIT_TEST_DEFAULT_REF_FORMAT Patrick Steinhardt
@ 2026-09-09 11:12   ` Patrick Steinhardt
  2026-09-09 11:12   ` [PATCH v3 13/13] setup: allow "--ref-storage-format=" to specify a payload Patrick Steinhardt
  12 siblings, 0 replies; 61+ messages in thread
From: Patrick Steinhardt @ 2026-09-09 11:12 UTC (permalink / raw)
  To: git; +Cc: Karthik Nayak, Junio C Hamano, Kaartic Sivaraam

With the same reasoning as for git-init(1), rename the
"init.defaultRefFormat" config option to "init.defaultRefStorageFormat"
and keep the old name as an alias.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
 Documentation/BreakingChanges.adoc |  2 +-
 Documentation/config/feature.adoc  |  2 +-
 Documentation/config/init.adoc     |  4 +++-
 setup.c                            |  8 +++++---
 t/t0001-init.sh                    | 16 ++++++++--------
 5 files changed, 18 insertions(+), 14 deletions(-)

diff --git a/Documentation/BreakingChanges.adoc b/Documentation/BreakingChanges.adoc
index 73bb939359..c2cef3f528 100644
--- a/Documentation/BreakingChanges.adoc
+++ b/Documentation/BreakingChanges.adoc
@@ -156,7 +156,7 @@ Cf. <2f5de416-04ba-c23d-1e0b-83bb655829a7@zombino.com>,
      "packed-refs" file.
 +
 Users that get immediate benefit from the "reftable" backend could continue to
-opt-in to the "reftable" format manually by setting the "init.defaultRefFormat"
+opt-in to the "reftable" format manually by setting the "init.defaultRefStorageFormat"
 config. But defaults matter, and we think that overall users will have a better
 experience with less platform-specific quirks when they use the new backend by
 default.
diff --git a/Documentation/config/feature.adoc b/Documentation/config/feature.adoc
index 924f5ff4e3..e258770591 100644
--- a/Documentation/config/feature.adoc
+++ b/Documentation/config/feature.adoc
@@ -25,7 +25,7 @@ reusing objects from multiple packs instead of just one.
 significantly smaller in the presence of certain filename collisions with Git's
 default name-hash.
 +
-* `init.defaultRefFormat=reftable` causes newly initialized repositories to use
+* `init.defaultRefStorageFormat=reftable` causes newly initialized repositories to use
 the reftable format for storing references. This new format solves issues with
 case-insensitive filesystems, compresses better and performs significantly
 better with many use cases. Refer to Documentation/technical/reftable.adoc for
diff --git a/Documentation/config/init.adoc b/Documentation/config/init.adoc
index f82fcf25e6..e45bd692db 100644
--- a/Documentation/config/init.adoc
+++ b/Documentation/config/init.adoc
@@ -13,11 +13,13 @@ endif::[]
 	`--object-format=` in linkgit:git-init[1]. Both the command line option
 	and the `GIT_DEFAULT_HASH` environment variable take precedence over
 	this config.
-`init.defaultRefFormat`::
+`init.defaultRefStorageFormat`::
 	Allows overriding the default ref storage format for new repositories.
 	See `--ref-storage-format=` in linkgit:git-init[1]. Both the command line
 	option and the `GIT_DEFAULT_REF_STORAGE_FORMAT` environment variable take
 	precedence over this config.
+`init.defaultRefFormat`::
+	Deprecated alias of `init.defaultRefStorageFormat`.
 
 init.defaultSubmodulePathConfig::
 	A boolean that specifies if `git init` and `git clone` should
diff --git a/setup.c b/setup.c
index 621cf87c9c..df8cbf196d 100644
--- a/setup.c
+++ b/setup.c
@@ -2697,7 +2697,8 @@ static int read_default_format_config(const char *key, const char *value,
 		goto out;
 	}
 
-	if (!strcmp(key, "init.defaultrefformat")) {
+	if (!strcmp(key, "init.defaultrefstorageformat") ||
+	    !strcmp(key, "init.defaultrefformat")) {
 		ret = git_config_string(&str, key, value);
 		if (ret)
 			goto out;
@@ -2709,7 +2710,7 @@ static int read_default_format_config(const char *key, const char *value,
 
 	/*
 	 * Enable the reftable format when "features.experimental" is enabled.
-	 * "init.defaultRefFormat" takes precedence over this setting.
+	 * "init.defaultRefStorageFormat" takes precedence over this setting.
 	 */
 	if (!strcmp(key, "feature.experimental") &&
 	    cfg->ref_storage_format == REF_STORAGE_FORMAT_UNKNOWN &&
@@ -2784,7 +2785,8 @@ static void repository_format_configure(struct repository_format *repo_fmt,
 	 *   5. Its deprecated equivalent "GIT_DEFAULT_REF_FORMAT".
 	 *
 	 *   6. The default ref storage format for new repositories as
-	 *      configured via "init.defaultRefFormat"
+	 *      configured via "init.defaultRefStorageFormat" or its deprecated
+	 *      equivalent "init.defaultRefFormat".
 	 *
 	 *   7. Otherwise, we fall back to the default ref storage format
 	 *      compiled into Git.
diff --git a/t/t0001-init.sh b/t/t0001-init.sh
index af9a7ba958..fe5bc3d3e1 100755
--- a/t/t0001-init.sh
+++ b/t/t0001-init.sh
@@ -659,9 +659,9 @@ test_expect_success 'GIT_REF_STORAGE_FORMAT refuses to reinitialize with differe
 	test_cmp expect err
 '
 
-test_expect_success 'init warns about invalid init.defaultRefFormat' '
+test_expect_success 'init warns about invalid init.defaultRefStorageFormat' '
 	test_when_finished "rm -rf repo" &&
-	test_config_global init.defaultRefFormat garbage &&
+	test_config_global init.defaultRefStorageFormat garbage &&
 
 	echo "warning: unknown ref storage format ${SQ}garbage${SQ}" >expect &&
 	git init repo 2>err &&
@@ -714,9 +714,9 @@ do
 		test_cmp expect actual
 	'
 
-	test_expect_success "init with init.defaultRefFormat=$format" '
+	test_expect_success "init with init.defaultRefStorageFormat=$format" '
 		test_when_finished "rm -rf refformat" &&
-		test_config_global init.defaultRefFormat $format &&
+		test_config_global init.defaultRefStorageFormat $format &&
 		(
 			sane_unset GIT_DEFAULT_REF_STORAGE_FORMAT &&
 			git init refformat
@@ -753,9 +753,9 @@ test_expect_success "--ref-storage-format= overrides GIT_DEFAULT_REF_STORAGE_FOM
 	test_cmp expect actual
 '
 
-test_expect_success "GIT_DEFAULT_REF_STORAGE_FORMAT= overrides init.defaultRefFormat" '
+test_expect_success "GIT_DEFAULT_REF_STORAGE_FORMAT= overrides init.defaultRefStorageFormat" '
 	test_when_finished "rm -rf refformat" &&
-	test_config_global init.defaultRefFormat files &&
+	test_config_global init.defaultRefStorageFormat files &&
 
 	GIT_DEFAULT_REF_STORAGE_FORMAT=reftable git init refformat &&
 	echo reftable >expect &&
@@ -775,10 +775,10 @@ test_expect_success "init with feature.experimental=true" '
 	test_cmp expect actual
 '
 
-test_expect_success "init.defaultRefFormat overrides feature.experimental=true" '
+test_expect_success "init.defaultRefStorageFormat overrides feature.experimental=true" '
 	test_when_finished "rm -rf refformat" &&
 	test_config_global feature.experimental true &&
-	test_config_global init.defaultRefFormat files &&
+	test_config_global init.defaultRefStorageFormat files &&
 	(
 		sane_unset GIT_DEFAULT_REF_STORAGE_FORMAT &&
 		git init refformat

-- 
2.55.0.1074.ge7621b4bad.dirty


^ permalink raw reply related	[flat|nested] 61+ messages in thread

* [PATCH v3 13/13] setup: allow "--ref-storage-format=" to specify a payload
  2026-09-09 11:12 ` [PATCH v3 00/13] Fix inconsistent ref storage format terminology Patrick Steinhardt
                     ` (11 preceding siblings ...)
  2026-09-09 11:12   ` [PATCH v3 12/13] setup: rename "init.defaultRefFormat" to "init.defaultRefStorageFormat" Patrick Steinhardt
@ 2026-09-09 11:12   ` Patrick Steinhardt
  12 siblings, 0 replies; 61+ messages in thread
From: Patrick Steinhardt @ 2026-09-09 11:12 UTC (permalink / raw)
  To: git; +Cc: Karthik Nayak, Junio C Hamano, Kaartic Sivaraam

Reference storage backends can be configured with a payload via the
"extensions.refStorage" config key and the "GIT_REF_STORAGE_FORMAT"
environment variable, both of which accept a URI in the format
"<format>://<payload>". The payload may contain backend-specific
information, for example an alternate refs directory or which database
references should be stored in.

The `--ref-storage-format=` option of git-init(1) and git-clone(1) does
not know about payloads though: its value is parsed as a plain format
name, so backends that require a payload cannot be conveniently set up
at initialization time via the command line.

Teach the option to accept the same URI syntax. Also, document the
optional payloads for both the "files" and "reftable" backends.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
 Documentation/git-clone.adoc |  5 ++++-
 Documentation/git-init.adoc  |  5 ++++-
 builtin/clone.c              | 12 ++++++------
 builtin/init-db.c            | 15 ++++-----------
 setup.c                      | 16 +++++++++++-----
 setup.h                      |  2 +-
 t/t0001-init.sh              |  2 +-
 t/t1423-ref-backend.sh       | 30 ++++++++++++++++++++++++++++++
 8 files changed, 61 insertions(+), 26 deletions(-)

diff --git a/Documentation/git-clone.adoc b/Documentation/git-clone.adoc
index 27e4d13942..07f7cf1a98 100644
--- a/Documentation/git-clone.adoc
+++ b/Documentation/git-clone.adoc
@@ -350,7 +350,10 @@ or `--mirror` is given)
 
 `--ref-storage-format=<format>`::
 
-Specify the given ref storage format for the repository. The valid values are:
+Specify the given ref storage _<format>_ for the repository. Backends that
+require additional configuration accept a payload in the form
+`<format>://<payload>`, for example a connection string identifying the
+database that shall store the references. The valid values are:
 +
 include::ref-storage-format.adoc[]
 
diff --git a/Documentation/git-init.adoc b/Documentation/git-init.adoc
index 73e1f787cb..b02af22ad1 100644
--- a/Documentation/git-init.adoc
+++ b/Documentation/git-init.adoc
@@ -58,7 +58,10 @@ values are `sha1` and (if enabled) `sha256`.  `sha1` is the default.
 include::object-format-disclaimer.adoc[]
 
 `--ref-storage-format=<format>`::
-Specify the given ref storage _<format>_ for the repository. The valid values are:
+Specify the given ref storage _<format>_ for the repository. Backends that
+require additional configuration accept a payload in the form
+`<format>://<payload>`, for example a connection string identifying the
+database that shall store the references. The valid values are:
 +
 include::ref-storage-format.adoc[]
 
diff --git a/builtin/clone.c b/builtin/clone.c
index dd722e4de1..9812aaec8f 100644
--- a/builtin/clone.c
+++ b/builtin/clone.c
@@ -901,7 +901,7 @@ int cmd_clone(int argc,
 	char *option_origin = NULL;
 	struct string_list option_not = STRING_LIST_INIT_NODUP;
 	const char *real_git_dir = NULL;
-	const char *ref_storage_format_str = NULL;
+	const char *ref_storage_format_uri = NULL;
 	const char *option_upload_pack = "git-upload-pack";
 	int option_progress = -1;
 	int option_sparse_checkout = 0;
@@ -981,7 +981,7 @@ int cmd_clone(int argc,
 			 N_("any cloned submodules will be shallow")),
 		OPT_STRING(0, "separate-git-dir", &real_git_dir, N_("gitdir"),
 			   N_("separate git dir from working tree")),
-		OPT_STRING(0, "ref-storage-format", &ref_storage_format_str, N_("format"),
+		OPT_STRING(0, "ref-storage-format", &ref_storage_format_uri, N_("format"),
 			   N_("specify the reference storage format to use")),
 		OPT_ALIAS_F(0, "ref-format", "ref-storage-format", PARSE_OPT_HIDDEN),
 		OPT_STRING_LIST('c', "config", &option_config, N_("key=value"),
@@ -1028,10 +1028,10 @@ int cmd_clone(int argc,
 	if (option_single_branch == -1)
 		option_single_branch = deepen ? 1 : 0;
 
-	if (ref_storage_format_str) {
-		ref_storage_format = ref_storage_format_by_name(ref_storage_format_str);
+	if (ref_storage_format_uri) {
+		ref_storage_format = ref_storage_format_by_uri(ref_storage_format_uri, NULL);
 		if (ref_storage_format == REF_STORAGE_FORMAT_UNKNOWN)
-			die(_("unknown ref storage format '%s'"), ref_storage_format_str);
+			die(_("unknown ref storage format '%s'"), ref_storage_format_uri);
 	}
 
 	if (option_mirror) {
@@ -1187,7 +1187,7 @@ int cmd_clone(int argc,
 	 * their on-disk data structures.
 	 */
 	init_db(the_repository, git_dir, real_git_dir, work_tree, option_template,
-		GIT_HASH_UNKNOWN, ref_storage_format, NULL,
+		GIT_HASH_UNKNOWN, ref_storage_format_uri, NULL,
 		do_not_override_repo_unix_permissions,
 		INIT_DB_QUIET | INIT_DB_SKIP_REFDB);
 
diff --git a/builtin/init-db.c b/builtin/init-db.c
index 1612413af0..7a65d1673b 100644
--- a/builtin/init-db.c
+++ b/builtin/init-db.c
@@ -83,10 +83,9 @@ int cmd_init_db(int argc,
 	unsigned int flags = 0;
 	int bare = startup_info->force_bare_repository ? 1 : -1;
 	const char *object_format = NULL;
-	const char *ref_storage_format_str = NULL;
+	const char *ref_storage_format_uri = NULL;
 	const char *initial_branch = NULL;
 	int hash_algo = GIT_HASH_UNKNOWN;
-	enum ref_storage_format ref_storage_format = REF_STORAGE_FORMAT_UNKNOWN;
 	int init_shared_repository = -1;
 	const struct option init_db_options[] = {
 		OPT_STRING(0, "template", &template_dir, N_("template-directory"),
@@ -109,7 +108,7 @@ int cmd_init_db(int argc,
 			   N_("override the name of the initial branch")),
 		OPT_STRING(0, "object-format", &object_format, N_("hash"),
 			   N_("specify the hash algorithm to use")),
-		OPT_STRING(0, "ref-storage-format", &ref_storage_format_str, N_("format"),
+		OPT_STRING(0, "ref-storage-format", &ref_storage_format_uri, N_("format"),
 			   N_("specify the reference storage format to use")),
 		OPT_ALIAS_F(0, "ref-format", "ref-storage-format", PARSE_OPT_HIDDEN),
 		OPT_END()
@@ -174,12 +173,6 @@ int cmd_init_db(int argc,
 			die(_("unknown hash algorithm '%s'"), object_format);
 	}
 
-	if (ref_storage_format_str) {
-		ref_storage_format = ref_storage_format_by_name(ref_storage_format_str);
-		if (ref_storage_format == REF_STORAGE_FORMAT_UNKNOWN)
-			die(_("unknown ref storage format '%s'"), ref_storage_format_str);
-	}
-
 	if (init_shared_repository != -1)
 		repo_settings_set_shared_repository(the_repository, init_shared_repository);
 
@@ -250,8 +243,8 @@ int cmd_init_db(int argc,
 
 	flags |= INIT_DB_EXIST_OK;
 	ret = init_db(the_repository, git_dir, real_git_dir, work_tree,
-		      template_dir, hash_algo, ref_storage_format, initial_branch,
-		      init_shared_repository, flags);
+		      template_dir, hash_algo, ref_storage_format_uri,
+		      initial_branch, init_shared_repository, flags);
 
 	free(template_dir_to_free);
 	free(real_git_dir_to_free);
diff --git a/setup.c b/setup.c
index df8cbf196d..13f4a0aba9 100644
--- a/setup.c
+++ b/setup.c
@@ -2727,7 +2727,8 @@ static int read_default_format_config(const char *key, const char *value,
 }
 
 static void repository_format_configure(struct repository_format *repo_fmt,
-					int hash, enum ref_storage_format ref_storage_format)
+					int hash,
+					const char *ref_storage_format_uri)
 {
 	struct default_format_config cfg = {
 		.hash = GIT_HASH_UNKNOWN,
@@ -2738,6 +2739,7 @@ static void repository_format_configure(struct repository_format *repo_fmt,
 		.ignore_repo = 1,
 		.ignore_worktree = 1,
 	};
+	enum ref_storage_format ref_storage_format;
 	char *ref_storage_payload = NULL;
 	const char *env;
 
@@ -2791,8 +2793,12 @@ static void repository_format_configure(struct repository_format *repo_fmt,
 	 *   7. Otherwise, we fall back to the default ref storage format
 	 *      compiled into Git.
 	 */
-	if (ref_storage_format != REF_STORAGE_FORMAT_UNKNOWN) {
-		/* nothing to do */
+	if (ref_storage_format_uri) {
+		ref_storage_format = ref_storage_format_by_uri(ref_storage_format_uri,
+							       &ref_storage_payload);
+		if (ref_storage_format == REF_STORAGE_FORMAT_UNKNOWN)
+			die(_("unknown ref storage format specified via command line: '%s'"),
+			    ref_storage_format_uri);
 	} else if ((env = getenv(GIT_REF_STORAGE_FORMAT_ENVIRONMENT))) {
 		ref_storage_format = ref_storage_format_by_uri(env, &ref_storage_payload);
 		if (ref_storage_format == REF_STORAGE_FORMAT_UNKNOWN)
@@ -2845,7 +2851,7 @@ int init_db(struct repository *repo,
 	    const char *real_git_dir,
 	    const char *worktree,
 	    const char *template_dir, int hash,
-	    enum ref_storage_format ref_storage_format,
+	    const char *ref_storage_format_uri,
 	    const char *initial_branch,
 	    int init_shared_repository, unsigned int flags)
 {
@@ -2882,7 +2888,7 @@ int init_db(struct repository *repo,
 	 * is an attempt to reinitialize new repository with an old tool.
 	 */
 	read_and_verify_repository_format(&repo_fmt, repo_get_git_dir(repo), NULL);
-	repository_format_configure(&repo_fmt, hash, ref_storage_format);
+	repository_format_configure(&repo_fmt, hash, ref_storage_format_uri);
 	if (apply_repository_format(repo, &repo_fmt, APPLY_REPOSITORY_FORMAT_HONOR_ENV, &err) < 0)
 		die("%s", err.buf);
 
diff --git a/setup.h b/setup.h
index 763fd384e8..f04d2984b4 100644
--- a/setup.h
+++ b/setup.h
@@ -265,7 +265,7 @@ int init_db(struct repository *repo,
 	    const char *real_git_dir,
 	    const char *worktree,
 	    const char *template_dir, int hash_algo,
-	    enum ref_storage_format ref_storage_format,
+	    const char *ref_storage_format_uri,
 	    const char *initial_branch, int init_shared_repository,
 	    unsigned int flags);
 void initialize_repository_version(struct repository *repo,
diff --git a/t/t0001-init.sh b/t/t0001-init.sh
index fe5bc3d3e1..f1d227f271 100755
--- a/t/t0001-init.sh
+++ b/t/t0001-init.sh
@@ -833,7 +833,7 @@ done
 test_expect_success 'init with --ref-storage-format=garbage' '
 	test_when_finished "rm -rf refformat" &&
 	cat >expect <<-EOF &&
-	fatal: unknown ref storage format ${SQ}garbage${SQ}
+	fatal: unknown ref storage format specified via command line: ${SQ}garbage${SQ}
 	EOF
 	test_must_fail git init --ref-storage-format=garbage refformat 2>err &&
 	test_cmp expect err
diff --git a/t/t1423-ref-backend.sh b/t/t1423-ref-backend.sh
index 525b2a19b4..ee2bb66b99 100755
--- a/t/t1423-ref-backend.sh
+++ b/t/t1423-ref-backend.sh
@@ -254,6 +254,36 @@ test_expect_success 'initializing repository with alt ref directory' '
 	)
 '
 
+test_expect_success 'initializing repository with --ref-storage-format and payload' '
+	test_when_finished "rm -rf repo refdir" &&
+	mkdir refdir &&
+	BACKEND="$(test_detect_ref_format)://$(pwd)/refdir" &&
+	git init --ref-storage-format="$BACKEND" repo &&
+	verify_files_exist repo/.git refdir &&
+
+	git -C repo config get extensions.refstorage >actual &&
+	echo $BACKEND >expect &&
+	test_cmp expect actual &&
+
+	test_commit -C repo 1 &&
+	git -C repo refs list >out &&
+	test_grep "refs/tags/1" out &&
+
+	# Reinitializing the repository is fine when not specifying any format.
+	git -C repo init &&
+	# Reinitializing with the same backend is fine, too.
+	git -C repo init --ref-storage-format="$BACKEND" &&
+	# Reinitializing without a payload should fail.
+	test_must_fail git -C repo init --ref-storage-format="$(test_detect_ref_format)" 2>err &&
+	test_grep "attempt to reinitialize repository with different reference storage payload" err &&
+	# Reinitializing with a different payload should fail, too.
+	test_must_fail git -C repo init --ref-storage-format="$(test_detect_ref_format)://$(pwd)/other" 2>err &&
+	test_grep "attempt to reinitialize repository with different reference storage payload" err &&
+
+	git -C repo config get extensions.refstorage >actual &&
+	test_cmp expect actual
+'
+
 test_expect_success 'cloning repository with alt ref directory' '
 	test_when_finished "rm -rf source repo refdir" &&
 	mkdir refdir &&

-- 
2.55.0.1074.ge7621b4bad.dirty


^ permalink raw reply related	[flat|nested] 61+ messages in thread

end of thread, other threads:[~2026-09-09 11:13 UTC | newest]

Thread overview: 61+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-04 10:36 [PATCH 00/11] Fix inconsistent ref storage format terminology Patrick Steinhardt
2026-09-04 10:36 ` [PATCH 01/11] builtin/init: rename "--ref-format=" to "--ref-storage=" Patrick Steinhardt
2026-09-04 13:05   ` Karthik Nayak
2026-09-07 10:00     ` Patrick Steinhardt
2026-09-04 10:36 ` [PATCH 02/11] builtin/clone: " Patrick Steinhardt
2026-09-04 10:36 ` [PATCH 03/11] builtin/refs: " Patrick Steinhardt
2026-09-04 10:36 ` [PATCH 04/11] builtin/submodule: " Patrick Steinhardt
2026-09-04 10:36 ` [PATCH 05/11] builtin/rev-parse: rename "--show-ref-format" to "--show-ref-storage" Patrick Steinhardt
2026-09-04 10:36 ` [PATCH 06/11] help: rename "default-ref-format" to "default-ref-storage" Patrick Steinhardt
2026-09-04 10:36 ` [PATCH 07/11] refs: expose function to parse reference URIs Patrick Steinhardt
2026-09-04 13:12   ` Karthik Nayak
2026-09-04 10:36 ` [PATCH 08/11] setup: refactor how we configure the ref storage format Patrick Steinhardt
2026-09-04 10:36 ` [PATCH 09/11] setup: rename ref storage format environment variables Patrick Steinhardt
2026-09-04 13:20   ` Karthik Nayak
2026-09-07 10:00     ` Patrick Steinhardt
2026-09-04 10:36 ` [PATCH 10/11] setup: rename "init.defaultRefFormat" to "init.defaultRefStorage" Patrick Steinhardt
2026-09-04 10:36 ` [PATCH 11/11] setup: allow "git init --ref-storage=" to specify a payload Patrick Steinhardt
2026-09-04 13:23 ` [PATCH 00/11] Fix inconsistent ref storage format terminology Karthik Nayak
2026-09-04 17:15 ` Junio C Hamano
2026-09-07 10:00   ` Patrick Steinhardt
2026-09-07 11:18 ` [PATCH v2 " Patrick Steinhardt
2026-09-07 11:18   ` [PATCH v2 01/11] builtin/init: rename "--ref-format=" to "--ref-storage-format=" Patrick Steinhardt
2026-09-08  9:01     ` Kaartic Sivaraam
2026-09-09  7:00       ` Patrick Steinhardt
2026-09-09  9:14         ` Kaartic Sivaraam
2026-09-07 11:18   ` [PATCH v2 02/11] builtin/clone: " Patrick Steinhardt
2026-09-08  9:21     ` Kaartic Sivaraam
2026-09-09  7:03       ` Patrick Steinhardt
2026-09-07 11:18   ` [PATCH v2 03/11] builtin/refs: " Patrick Steinhardt
2026-09-08 10:55     ` Kaartic Sivaraam
2026-09-09  7:03       ` Patrick Steinhardt
2026-09-07 11:18   ` [PATCH v2 04/11] builtin/submodule: " Patrick Steinhardt
2026-09-07 11:18   ` [PATCH v2 05/11] builtin/rev-parse: rename "--show-ref-format" to "--show-ref-storage-format" Patrick Steinhardt
2026-09-07 11:18   ` [PATCH v2 06/11] help: rename "default-ref-format" to "default-ref-storage-format" Patrick Steinhardt
2026-09-07 11:18   ` [PATCH v2 07/11] refs: expose function to parse reference URIs Patrick Steinhardt
2026-09-08 13:47     ` Kaartic Sivaraam
2026-09-09  7:03       ` Patrick Steinhardt
2026-09-07 11:18   ` [PATCH v2 08/11] setup: refactor how we configure the ref storage format Patrick Steinhardt
2026-09-09  8:00     ` Kaartic Sivaraam
2026-09-09  9:23       ` Patrick Steinhardt
2026-09-07 11:18   ` [PATCH v2 09/11] setup: rename ref storage format environment variables Patrick Steinhardt
2026-09-09  8:10     ` Kaartic Sivaraam
2026-09-09  9:23       ` Patrick Steinhardt
2026-09-07 11:18   ` [PATCH v2 10/11] setup: rename "init.defaultRefFormat" to "init.defaultRefStorageFormat" Patrick Steinhardt
2026-09-07 11:18   ` [PATCH v2 11/11] setup: allow "git init --ref-storage-format=" to specify a payload Patrick Steinhardt
2026-09-09  8:54     ` Kaartic Sivaraam
2026-09-09  9:23       ` Patrick Steinhardt
2026-09-09 11:12 ` [PATCH v3 00/13] Fix inconsistent ref storage format terminology Patrick Steinhardt
2026-09-09 11:12   ` [PATCH v3 01/13] parse-options: allow for hidden aliases Patrick Steinhardt
2026-09-09 11:12   ` [PATCH v3 02/13] builtin/init: rename "--ref-format=" to "--ref-storage-format=" Patrick Steinhardt
2026-09-09 11:12   ` [PATCH v3 03/13] builtin/clone: " Patrick Steinhardt
2026-09-09 11:12   ` [PATCH v3 04/13] builtin/refs: " Patrick Steinhardt
2026-09-09 11:12   ` [PATCH v3 05/13] builtin/submodule: " Patrick Steinhardt
2026-09-09 11:12   ` [PATCH v3 06/13] builtin/rev-parse: rename "--show-ref-format" to "--show-ref-storage-format" Patrick Steinhardt
2026-09-09 11:12   ` [PATCH v3 07/13] help: rename "default-ref-format" to "default-ref-storage-format" Patrick Steinhardt
2026-09-09 11:12   ` [PATCH v3 08/13] refs: expose function to parse reference URIs Patrick Steinhardt
2026-09-09 11:12   ` [PATCH v3 09/13] setup: refactor how we configure the ref storage format Patrick Steinhardt
2026-09-09 11:12   ` [PATCH v3 10/13] setup: rename ref storage format environment variables Patrick Steinhardt
2026-09-09 11:12   ` [PATCH v3 11/13] t: rename GIT_TEST_DEFAULT_REF_FORMAT Patrick Steinhardt
2026-09-09 11:12   ` [PATCH v3 12/13] setup: rename "init.defaultRefFormat" to "init.defaultRefStorageFormat" Patrick Steinhardt
2026-09-09 11:12   ` [PATCH v3 13/13] setup: allow "--ref-storage-format=" to specify a payload Patrick Steinhardt

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.