]> git.ipfire.org Git - thirdparty/git.git/commit
setup: stop applying repository format twice
authorPatrick Steinhardt <ps@pks.im>
Thu, 25 Jun 2026 09:20:00 +0000 (11:20 +0200)
committerJunio C Hamano <gitster@pobox.com>
Fri, 26 Jun 2026 15:27:19 +0000 (08:27 -0700)
commit93c4361c41c3ac554ce8f61d8551d272d39ccd79
tree003d3cae36deb74ff0ce3be8bda4d4c6b1250cb9
parent35b6b8256cb793a7f5d4903635038b5002f338f6
setup: stop applying repository format twice

When discovering the repository in "setup.c" we apply the final
repository format multiple times:

  - Once via `repository_format_configure()`, where we apply the hash
    algorithm and ref storage format to both `struct repository_format`
    and `struct repository`.

  - And once via `apply_repository_format()`, where we apply these two
    settings from `struct repository_format` to `struct repository`.

With the current flow both of these are in fact necessary. But this is
only because we call `repository_format_configure()` after we have
called `apply_repository_format()`. Consequently, if we only changed the
repository format in `repository_format_configure()` it would never
propagate to the repository.

Refactor the code so that we first configure the repository format
before applying it to the repository so that we can stop setting the
hash and reference storage format multiple times.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
setup.c