Subject: [PATCH v4 00/12] refs: ref storage migrations

From: Patrick Steinhardt <[email-masked]>
Date: Mon, 3 Jun 2024 11:30:06 +0200

Hi,

this is the fourth version of my patch series that implements the logic
to migrate between ref storage formats.

Changes compared to v3:

  - Add missing entry in "command-list.txt".

  - Adapt manpage so that relevant data can be extracted from it.

Thanks!

Patrick

Patrick Steinhardt (12):
  setup: unset ref storage when reinitializing repository version
  refs: convert ref storage format to an enum
  refs: pass storage format to `ref_store_init()` explicitly
  refs: allow to skip creation of reflog entries
  refs/files: refactor `add_pseudoref_and_head_entries()`
  refs/files: extract function to iterate through root refs
  refs/files: fix NULL pointer deref when releasing ref store
  reftable: inline `merged_table_release()`
  worktree: don't store main worktree twice
  refs: implement removal of ref storages
  refs: implement logic to migrate between ref storage formats
  builtin/refs: new command to migrate ref storage formats

 .gitignore                 |   1 +
 Documentation/git-refs.txt |  61 +++++++
 Makefile                   |   1 +
 builtin.h                  |   1 +
 builtin/clone.c            |   2 +-
 builtin/init-db.c          |   2 +-
 builtin/refs.c             |  75 ++++++++
 command-list.txt           |   1 +
 git.c                      |   1 +
 refs.c                     | 340 +++++++++++++++++++++++++++++++++++--
 refs.h                     |  41 ++++-
 refs/files-backend.c       | 123 ++++++++++++--
 refs/packed-backend.c      |  15 ++
 refs/ref-cache.c           |   2 +
 refs/refs-internal.h       |   7 +
 refs/reftable-backend.c    |  55 +++++-
 reftable/merged.c          |  12 +-
 reftable/merged.h          |   2 -
 reftable/stack.c           |   8 +-
 repository.c               |   3 +-
 repository.h               |  10 +-
 setup.c                    |  10 +-
 setup.h                    |   9 +-
 t/helper/test-ref-store.c  |   1 +
 t/t1460-refs-migrate.sh    | 243 ++++++++++++++++++++++++++
 worktree.c                 |  29 ++--
 26 files changed, 974 insertions(+), 81 deletions(-)
 create mode 100644 Documentation/git-refs.txt
 create mode 100644 builtin/refs.c
 create mode 100755 t/t1460-refs-migrate.sh

Range-diff against v3:
 1:  afb705f6a0 =  1:  afb705f6a0 setup: unset ref storage when reinitializing repository version
 2:  7989e82dcd =  2:  7989e82dcd refs: convert ref storage format to an enum
 3:  7d1a86292c =  3:  7d1a86292c refs: pass storage format to `ref_store_init()` explicitly
 4:  d0539b7456 =  4:  d0539b7456 refs: allow to skip creation of reflog entries
 5:  7f9ce5af2e =  5:  7f9ce5af2e refs/files: refactor `add_pseudoref_and_head_entries()`
 6:  f7577a0ab3 =  6:  f7577a0ab3 refs/files: extract function to iterate through root refs
 7:  56baa798fb =  7:  56baa798fb refs/files: fix NULL pointer deref when releasing ref store
 8:  c7e8ab40b5 =  8:  c7e8ab40b5 reftable: inline `merged_table_release()`
 9:  7a89aae515 =  9:  7a89aae515 worktree: don't store main worktree twice
10:  f9d9420cf9 = 10:  f9d9420cf9 refs: implement removal of ref storages
11:  1f26051eff = 11:  1f26051eff refs: implement logic to migrate between ref storage formats
12:  d832414d1f ! 12:  83cb3f8c96 builtin/refs: new command to migrate ref storage formats
    @@ Documentation/git-refs.txt (new)
     +
     +NAME
     +----
    -+
     +git-refs - Low-level access to refs
     +
    ++
     +SYNOPSIS
     +--------
    -+
     +[verse]
     +'git refs migrate' --ref-format=<format> [--dry-run]
     +
    @@ builtin/refs.c (new)
     +	return fn(argc, argv, prefix);
     +}
     
    + ## command-list.txt ##
    +@@ command-list.txt: git-read-tree                           plumbingmanipulators
    + git-rebase                              mainporcelain           history
    + git-receive-pack                        synchelpers
    + git-reflog                              ancillarymanipulators           complete
    ++git-refs                                ancillarymanipulators           complete
    + git-remote                              ancillarymanipulators           complete
    + git-repack                              ancillarymanipulators           complete
    + git-replace                             ancillarymanipulators           complete
    +
      ## git.c ##
     @@ git.c: static struct cmd_struct commands[] = {
      	{ "rebase", cmd_rebase, RUN_SETUP | NEED_WORK_TREE },
-- 
2.45.1.410.g58bac47f8e.dirty