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

Re: [PATCH v2 09/11] setup: rename ref storage format environment variables

From
Kaartic Sivaraam <kaartic.sivaraam@gmail.com>
Date
Sep 9, 2026, 08:10 UTC
Message-ID
<57f08562-ecea-4e51-8e5a-ae3aa91b23d1@gmail.com>
In-Reply-To
<20260907-b4-pks-unify-ref-storage-format-v2-9-6733c90ca5b0@pks.im>
On 9/7/26 16:48, Patrick Steinhardt wrote:
Show 38 quoted lines
> 
> 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.

Show 12 quoted lines
> @@ -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?

Show 11 quoted lines
>   	} 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.
Show 13 quoted lines
> 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
Previous: Patrick SteinhardtNext: Patrick Steinhardt
Message 22 of 27 in “Fix inconsistent ref storage format terminology”
  1. 00/11 Fix inconsistent ref storage format terminologyPatrick Steinhardt, Sep 7, 2026
  2. 01/11 builtin/init: rename "--ref-format=" to "--ref-storage-format="Patrick Steinhardt, Sep 7, 2026
  3. Kaartic SivaraamSep 8, 2026
  4. Patrick SteinhardtSep 9, 2026
  5. Kaartic SivaraamSep 9, 2026
  6. 02/11 builtin/clone: rename "--ref-format=" to "--ref-storage-format="Patrick Steinhardt, Sep 7, 2026
  7. Kaartic SivaraamSep 8, 2026
  8. Patrick SteinhardtSep 9, 2026
  9. 03/11 builtin/refs: rename "--ref-format=" to "--ref-storage-format="Patrick Steinhardt, Sep 7, 2026
  10. Kaartic SivaraamSep 8, 2026
  11. Patrick SteinhardtSep 9, 2026
  12. 04/11 builtin/submodule: rename "--ref-format=" to "--ref-storage-format="Patrick Steinhardt, Sep 7, 2026
  13. 05/11 builtin/rev-parse: rename "--show-ref-format" to "--show-ref-storage-format"Patrick Steinhardt, Sep 7, 2026
  14. 06/11 help: rename "default-ref-format" to "default-ref-storage-format"Patrick Steinhardt, Sep 7, 2026
  15. 07/11 refs: expose function to parse reference URIsPatrick Steinhardt, Sep 7, 2026
  16. Kaartic SivaraamSep 8, 2026
  17. Patrick SteinhardtSep 9, 2026
  18. 08/11 setup: refactor how we configure the ref storage formatPatrick Steinhardt, Sep 7, 2026
  19. Kaartic SivaraamSep 9, 2026
  20. Patrick SteinhardtSep 9, 2026
  21. 09/11 setup: rename ref storage format environment variablesPatrick Steinhardt, Sep 7, 2026
  22. Kaartic SivaraamSep 9, 2026
  23. Patrick SteinhardtSep 9, 2026
  24. 10/11 setup: rename "init.defaultRefFormat" to "init.defaultRefStorageFormat"Patrick Steinhardt, Sep 7, 2026
  25. 11/11 setup: allow "git init --ref-storage-format=" to specify a payloadPatrick Steinhardt, Sep 7, 2026
  26. Kaartic SivaraamSep 9, 2026
  27. Patrick SteinhardtSep 9, 2026

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

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