git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Patrick Steinhardt <ps@pks.im>
To: git@vger.kernel.org
Cc: "brian m. carlson" <sandals@crustytoothpaste.net>,
	 Karthik Nayak <karthik.188@gmail.com>,
	 K Jayatheerth <jayatheerthkulkarni2005@gmail.com>,
	ryenus@gmail.com,  Junio C Hamano <gitster@pobox.com>,
	Justin Tobler <jltobler@gmail.com>
Subject: [PATCH v2 0/2] Add reftable by default as a breaking change
Date: Thu, 03 Jul 2025 08:15:29 +0200	[thread overview]
Message-ID: <20250703-pks-reftable-default-backend-v2-0-5a27e72a8c5e@pks.im> (raw)
In-Reply-To: <20250702-pks-reftable-default-backend-v1-0-84dbaddafb50@pks.im>

Hi,

the recent thread at [1] motivated me to hack together this tiny patch
series that paves our path towards making the reftable backend the
default backend. It does two things:

  - It announces the breaking change for Git 3.0.

  - It makes it the default now already when "feature.experimental" is
    enabled.

The first item is subject to ecosystem support, most notably in
libraries like Gitoxide, libgit2 and JGit. The second item is intended
to extend the user base to power users so that we get more test exposure
out in the wild before we make it the default in Git 3.0.

Changes in v2:
  - Improve the breaking changes announcement a bit based on feedback.
  - Introduce a `REF_STORAGE_FORMAT_DEFAULT` define.
  - Print the default ref format as part of `git version --build-options`.
  - Link to v1: https://lore.kernel.org/r/20250702-pks-reftable-default-backend-v1-0-84dbaddafb50@pks.im

Thanks!

Patrick

[1]: <xmqqtt3vkhwk.fsf@gitster.g>

---
Patrick Steinhardt (2):
      BreakingChanges: announce switch to "reftable" format
      setup: use "reftable" format when experimental features are enabled

 Documentation/BreakingChanges.adoc | 44 +++++++++++++++++++++++++++++++++++++
 Documentation/config/feature.adoc  |  6 +++++
 help.c                             |  2 ++
 repository.h                       |  6 +++++
 setup.c                            | 14 ++++++++++++
 t/t0001-init.sh                    | 45 ++++++++++++++++++++++++++++++++++++++
 6 files changed, 117 insertions(+)

Range-diff versus v1:

1:  f12545f39d3 ! 1:  0b4cf2c7a25 BreakingChanges: announce switch to "reftable" format
    @@ Documentation/BreakingChanges.adoc: Cf. <2f5de416-04ba-c23d-1e0b-83bb655829a7@zo
     +  multiple advantages over the "files" format:
     ++
     +  ** It is impossible to store two references that only differ in casing on
    -+     case-insensitive filesystems with the "files" format. This issue is
    -+     especially common on Windows, but also on older versions of macOS. As the
    -+     "reftable" backend does not use filesystem paths anymore to encode
    -+     reference names this problem goes away.
    ++     case-insensitive filesystems with the "files" format. This issue is common
    ++     on Windows and macOS platforms. As the "reftable" backend does not use
    ++     filesystem paths anymore to encode reference names this problem goes away.
     +  ** Similarly, macOS normalizes path names that contain unicode characters,
     +     which has the consequence that you cannot store two names with unicode
     +     characters that are encoded differently with the "files" backend. Again,
    @@ Documentation/BreakingChanges.adoc: Cf. <2f5de416-04ba-c23d-1e0b-83bb655829a7@zo
     +     significantly outperforms the "files" backend by multiple orders of
     +     magnitude.
     ++
    ++Users that get immediate benefit from the "reftable" backend could continue to
    ++opt-in to the "reftable" format manually by setting the "init.defaultRefFormat"
    ++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.
    +++
     +A prerequisite for this change is that the ecosystem is ready to support the
     +"reftable" format. Most importantly, alternative implementations of Git like
     +JGit, libgit2 and Gitoxide need to support it.
    @@ Documentation/BreakingChanges.adoc: Cf. <2f5de416-04ba-c23d-1e0b-83bb655829a7@zo
      
      * Support for grafting commits has long been superseded by git-replace(1).
     
    + ## help.c ##
    +@@ help.c: 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",
    ++			    ref_storage_format_to_name(REF_STORAGE_FORMAT_DEFAULT));
    + 	}
    + }
    + 
    +
    + ## repository.h ##
    +@@ repository.h: enum ref_storage_format {
    + 	REF_STORAGE_FORMAT_REFTABLE,
    + };
    + 
    ++#ifdef WITH_BREAKING_CHANGES /* Git 3.0 */
    ++# define REF_STORAGE_FORMAT_DEFAULT REF_STORAGE_FORMAT_REFTABLE
    ++#else
    ++# define REF_STORAGE_FORMAT_DEFAULT REF_STORAGE_FORMAT_FILES
    ++#endif
    ++
    + struct repo_path_cache {
    + 	char *squash_msg;
    + 	char *merge_msg;
    +
      ## setup.c ##
     @@ setup.c: static void repository_format_configure(struct repository_format *repo_fmt,
      			repo_fmt->ref_storage_format = ref_format;
      	} else if (cfg.ref_format != REF_STORAGE_FORMAT_UNKNOWN) {
      		repo_fmt->ref_storage_format = cfg.ref_format;
     +	} else {
    -+#ifdef WITH_BREAKING_CHANGES
    -+		repo_fmt->ref_storage_format = REF_STORAGE_FORMAT_REFTABLE;
    -+#else
    -+		repo_fmt->ref_storage_format = REF_STORAGE_FORMAT_FILES;
    -+#endif
    ++		repo_fmt->ref_storage_format = REF_STORAGE_FORMAT_DEFAULT;
      	}
      	repo_set_ref_storage_format(the_repository, repo_fmt->ref_storage_format);
      }
    @@ t/t0001-init.sh: test_expect_success 'init warns about invalid init.defaultRefFo
     +		sane_unset GIT_DEFAULT_REF_FORMAT &&
     +		git init refformat
     +	) &&
    -+	if test_have_prereq WITH_BREAKING_CHANGES
    -+	then
    -+		echo reftable >expect
    -+	else
    -+		echo files >expect
    -+	fi &&
    ++	git version --build-options | sed -ne "s/^default-ref-format: //p" >expect &&
     +	git -C refformat rev-parse --show-ref-format >actual &&
     +	test_cmp expect actual
     +'
2:  1fff73157a9 = 2:  3fddba1a29a setup: use "reftable" format when experimental features are enabled

---
base-commit: 83014dc05f6fc9275c0a02886cb428805abaf9e5
change-id: 20250702-pks-reftable-default-backend-6c30f330250a


  parent reply	other threads:[~2025-07-03  6:15 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-02 10:14 [PATCH 0/2] Add reftable by default as a breaking change Patrick Steinhardt
2025-07-02 10:14 ` [PATCH 1/2] BreakingChanges: announce switch to "reftable" format Patrick Steinhardt
2025-07-02 17:03   ` Junio C Hamano
2025-07-02 21:21     ` brian m. carlson
2025-07-03  4:43       ` Patrick Steinhardt
2025-07-03  4:43     ` Patrick Steinhardt
2025-07-02 17:17   ` Justin Tobler
2025-07-03  5:00     ` Patrick Steinhardt
2025-07-02 10:14 ` [PATCH 2/2] setup: use "reftable" format when experimental features are enabled Patrick Steinhardt
2025-07-03  6:15 ` Patrick Steinhardt [this message]
2025-07-03  6:15   ` [PATCH v2 1/2] BreakingChanges: announce switch to "reftable" format Patrick Steinhardt
2025-07-03 10:54     ` Karthik Nayak
2025-07-03 11:42       ` Patrick Steinhardt
2025-07-03 12:24         ` Karthik Nayak
2025-07-03 13:08           ` Patrick Steinhardt
2025-07-03  6:15   ` [PATCH v2 2/2] setup: use "reftable" format when experimental features are enabled Patrick Steinhardt
2025-07-07  5:37   ` [PATCH v2 0/2] Add reftable by default as a breaking change Junio C Hamano
2025-07-04  9:42 ` [PATCH v3 " Patrick Steinhardt
2025-07-04  9:42   ` [PATCH v3 1/2] BreakingChanges: announce switch to "reftable" format Patrick Steinhardt
2025-07-04  9:42   ` [PATCH v3 2/2] setup: use "reftable" format when experimental features are enabled Patrick Steinhardt
2025-07-04 13:14   ` [PATCH v3 0/2] Add reftable by default as a breaking change Karthik Nayak

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250703-pks-reftable-default-backend-v2-0-5a27e72a8c5e@pks.im \
    --to=ps@pks.im \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=jayatheerthkulkarni2005@gmail.com \
    --cc=jltobler@gmail.com \
    --cc=karthik.188@gmail.com \
    --cc=ryenus@gmail.com \
    --cc=sandals@crustytoothpaste.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).