Subject: [PATCH 00/12] Introduce `refStorage` extension

From: Patrick Steinhardt <[email-masked]>
Date: Wed, 20 Dec 2023 11:54:50 +0100

Hi,

this patch series introduces a new `refStorage` extension and related
tooling. While there is only a single user-visible ref backend for now,
this extension will eventually allow us to determine which backend shall
be used for a repository. Furthermore, the series introduces tooling so
that the ref storage format becomes more accessible.

The series is structured as follows:

  - Patches 1 - 3: preliminary refactorings that prepare for the
    introduction of the ref storage format.

  - Patches 4 - 6: wire up the ref format when setting up the repository
    and creating a new one.

  - Patches 7 - 8: introduction of envvars to control the ref format
    globally.

  - Patches 9 - 11: amend our tooling to know how to access and set the
    ref storage format.

  - Patch 12: small patch for t9500 to make it handle ref storage
    extensions in the future.

I've been kind of torn regarding how to name this in the user-facing
parts. Even though the extension is called "refStorage", I rather opted
to use "ref format" in the user-facing parts, which is similar in nature
to the "object format". Changing the extension to be called "refFormat"
would cause issues for JGit though, so it's likely not an option to
change it now.

Anyway, I'd appreciate your thoughts and proposals and am happy to
rename the user-facing parts if we get to a preferable agreement.

This series depends on 18c9cb7524 (builtin/clone: create the refdb with
the correct object format, 2023-12-12) because it relies on the more
careful setup of the repository's refdb during clones.

Thanks!

Patrick

Patrick Steinhardt (12):
  t: introduce DEFAULT_REPO_FORMAT prereq
  worktree: skip reading HEAD when repairing worktrees
  refs: refactor logic to look up storage backends
  setup: start tracking ref storage format when
  setup: set repository's formats on init
  setup: introduce "extensions.refStorage" extension
  setup: introduce GIT_DEFAULT_REF_FORMAT envvar
  t: introduce GIT_TEST_DEFAULT_REF_FORMAT envvar
  builtin/rev-parse: introduce `--show-ref-format` flag
  builtin/init: introduce `--ref-format=` value flag
  builtin/clone: introduce `--ref-format=` value flag
  t9500: write "extensions.refstorage" into config

 Documentation/config/extensions.txt           | 11 +++
 Documentation/git-clone.txt                   |  6 ++
 Documentation/git-init.txt                    |  7 ++
 Documentation/git-rev-parse.txt               |  3 +
 Documentation/git.txt                         |  5 ++
 Documentation/ref-storage-format.txt          |  1 +
 .../technical/repository-version.txt          |  5 ++
 builtin/clone.c                               | 17 ++++-
 builtin/init-db.c                             | 15 +++-
 builtin/rev-parse.c                           |  4 ++
 refs.c                                        | 34 ++++++---
 refs.h                                        |  4 ++
 refs/debug.c                                  |  1 -
 refs/files-backend.c                          |  1 -
 refs/packed-backend.c                         |  1 -
 refs/refs-internal.h                          |  1 -
 repository.c                                  |  1 +
 repository.h                                  |  6 ++
 setup.c                                       | 63 +++++++++++++++--
 setup.h                                       |  9 ++-
 t/README                                      |  3 +
 t/t0001-init.sh                               | 70 +++++++++++++++++++
 t/t1500-rev-parse.sh                          | 17 +++++
 t/t3200-branch.sh                             |  2 +-
 t/t5601-clone.sh                              | 17 +++++
 t/t9500-gitweb-standalone-no-errors.sh        |  5 ++
 t/test-lib-functions.sh                       |  5 ++
 t/test-lib.sh                                 | 15 +++-
 worktree.c                                    | 24 ++++---
 29 files changed, 318 insertions(+), 35 deletions(-)
 create mode 100644 Documentation/ref-storage-format.txt

-- 
2.43.GIT