Merge branch 'ps/ref-storage-migration'

A new command has been added to migrate a repository that uses the
files backend for its ref storage to use the reftable backend, with
limitations.

* ps/ref-storage-migration:
  builtin/refs: new command to migrate ref storage formats
  refs: implement logic to migrate between ref storage formats
  refs: implement removal of ref storages
  worktree: don't store main worktree twice
  reftable: inline `merged_table_release()`
  refs/files: fix NULL pointer deref when releasing ref store
  refs/files: extract function to iterate through root refs
  refs/files: refactor `add_pseudoref_and_head_entries()`
  refs: allow to skip creation of reflog entries
  refs: pass storage format to `ref_store_init()` explicitly
  refs: convert ref storage format to an enum
  setup: unset ref storage when reinitializing repository version
This commit is contained in:
Junio C Hamano
2024-06-17 15:55:55 -07:00
26 changed files with 979 additions and 82 deletions

View File

@ -225,19 +225,11 @@ int reftable_new_merged_table(struct reftable_merged_table **dest,
return 0;
}
/* clears the list of subtable, without affecting the readers themselves. */
void merged_table_release(struct reftable_merged_table *mt)
{
FREE_AND_NULL(mt->stack);
mt->stack_len = 0;
}
void reftable_merged_table_free(struct reftable_merged_table *mt)
{
if (!mt) {
if (!mt)
return;
}
merged_table_release(mt);
FREE_AND_NULL(mt->stack);
reftable_free(mt);
}