When initializing a repository's object database we have to respect the GIT_OBJECT_DIRECTORY and GIT_ALTERNATE_OBJECT_DIRECTORIES environment variables, which can be set by the user to override the default location of where we write objects to and read objects from. This is handled in `apply_repository_format()`, which is fine. But in a subsequent commit we'll have to defer constructing the object database to a later point in some cases, and that will require a second site where we call `odb_new()`. And of course, that second site would have to handle those environment variables, as well. It would be somewhat awkward to duplicate the logic though. But there's a better alternative: instead of handling this logic in "setup.c", we can easily handle environment variables in `odb_new()` itself. This ensures that object database creation is neatly self-contained, and we don't have to duplicate any of the logic. Another benefit is that in a future patch series we plan to move handling of alternates into the backends themselves [1], and that will require us to also handle those environment variables in the "files" backend itself. So moving the logic into the ODB level already gets us one step closer to that goal. Refactor the logic accordingly. [1]: https://lore.kernel.org/git/amLgMqkqxR8mKIbT@pks.im/ Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com> |
||
|---|---|---|
| .. | ||
| clar | ||
| .gitignore | ||
| generate-clar-decls.sh | ||
| generate-clar-suites.sh | ||
| lib-oid.c | ||
| lib-oid.h | ||
| lib-reftable.c | ||
| lib-reftable.h | ||
| test-lib.c | ||
| test-lib.h | ||
| u-ctype.c | ||
| u-dir.c | ||
| u-example-decorate.c | ||
| u-hash.c | ||
| u-hashmap.c | ||
| u-list-objects-filter-options.c | ||
| u-mem-pool.c | ||
| u-odb-inmemory.c | ||
| u-oid-array.c | ||
| u-oidmap.c | ||
| u-oidtree.c | ||
| u-prio-queue.c | ||
| u-reftable-basics.c | ||
| u-reftable-block.c | ||
| u-reftable-merged.c | ||
| u-reftable-pq.c | ||
| u-reftable-readwrite.c | ||
| u-reftable-record.c | ||
| u-reftable-stack.c | ||
| u-reftable-table.c | ||
| u-reftable-tree.c | ||
| u-strbuf.c | ||
| u-strcmp-offset.c | ||
| u-string-list.c | ||
| u-strvec.c | ||
| u-trailer.c | ||
| u-urlmatch-normalization.c | ||
| u-utf8-width.c | ||
| unit-test.c | ||
| unit-test.h | ||