git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v2 00/18] setup: drop uses of `the_repository`

From
Patrick Steinhardt <ps@pks.im>
Date
May 19, 2026, 09:51 UTC
Message-ID
<agwytzUXxa6zIBHV@pks.im>
In-Reply-To
<CAOLa=ZSxhtorR+t-4M_COxfu6HwpcB0hr43OhqcwgkU+VLX6qQ@mail.gmail.com>
On Tue, May 19, 2026 at 02:26:35AM -0700, Karthik Nayak wrote:
Show 32 quoted lines
> Patrick Steinhardt <ps@pks.im> writes:
> 
> > Hi,
> >
> > I've had enough of "setup.c" and its complexities, so I finally decided
> > to take the bullet and start refactoring this subsystem. This here is
> > the first out of the following three steps:
> >
> >   1. Drop all uses of `the_repository`. This doesn't yet allow us to get
> >      rid of `USE_THE_REPOSITORY_VARIABLE`.
> >
> >   2. Convert a couple of global variables and drop
> >      `is_bare_repository_cfg`, which then allows us to drop
> >      `USE_THE_REPOSITORY_VARIABLE`.
> >
> >   3. Refactor the subsystem a bit so that we stop intermixing repository
> >      discovery and repository initialization. This is my original
> >      motivation as I want to get rid of `odb_prepare_alternates()`, but
> >      due to the way we initialize the repository it has proven to be
> >      extremely tedious.
> >
> > Most of the patches in this series here are rather mechanical. There's
> > only a handful of patches that warrant more attention:
> >
> >   -  2/18: setup: stop using `the_repository` in `is_inside_worktree()`
> >   -  3/18: setup: stop using `the_repository` in `is_inside_git_dir()`
> >   -  9/18: setup: stop using `the_repository` in `setup_work_tree()`
> >   - 10/18: setup: stop using `the_repository` in `set_git_work_tree()`
> >
> 
> I think the series looks to be in a good state, I left some small nits,
> feel free to ignore.
I'll send one more round to address your feedback. Thanks!
Patrick
Previous: Karthik NayakNext: Patrick Steinhardt
Message 53 of 73 in “setup: drop uses of `the_repository`”
  1. 00/18 setup: drop uses of `the_repository`Patrick Steinhardt, Apr 20, 2026
  2. 01/18 setup: replace use of `the_repository` in static functionsPatrick Steinhardt, Apr 20, 2026
  3. 02/18 setup: stop using `the_repository` in `is_inside_worktree()`Patrick Steinhardt, Apr 20, 2026
  4. Tian YuchenMay 17, 2026
  5. Junio C HamanoMay 17, 2026
  6. Patrick SteinhardtMay 18, 2026
  7. Junio C HamanoMay 19, 2026
  8. Patrick SteinhardtMay 19, 2026
  9. 03/18 setup: stop using `the_repository` in `is_inside_git_dir()`Patrick Steinhardt, Apr 20, 2026
  10. 04/18 setup: stop using `the_repository` in `prefix_path()`Patrick Steinhardt, Apr 20, 2026
  11. 05/18 setup: stop using `the_repository` in `path_inside_repo()`Patrick Steinhardt, Apr 20, 2026
  12. 06/18 setup: stop using `the_repository` in `verify_filename()`Patrick Steinhardt, Apr 20, 2026
  13. 07/18 setup: stop using `the_repository` in `verify_non_filename()`Patrick Steinhardt, Apr 20, 2026
  14. 08/18 setup: stop using `the_repository` in `enter_repo()`Patrick Steinhardt, Apr 20, 2026
  15. 09/18 setup: stop using `the_repository` in `setup_work_tree()`Patrick Steinhardt, Apr 20, 2026
  16. 10/18 setup: stop using `the_repository` in `set_git_work_tree()`Patrick Steinhardt, Apr 20, 2026
  17. 11/18 setup: stop using `the_repository` in `setup_git_env()`Patrick Steinhardt, Apr 20, 2026
  18. 12/18 setup: stop using `the_repository` in `setup_git_directory_gently()`Patrick Steinhardt, Apr 20, 2026
  19. 13/18 setup: stop using `the_repository` in `setup_git_directory()`Patrick Steinhardt, Apr 20, 2026
  20. 14/18 setup: stop using `the_repository` in `upgrade_repository_format()`Patrick Steinhardt, Apr 20, 2026
  21. 15/18 setup: stop using `the_repository` in `check_repository_format()`Patrick Steinhardt, Apr 20, 2026
  22. 16/18 setup: stop using `the_repository` in `initialize_repository_version()`Patrick Steinhardt, Apr 20, 2026
  23. 17/18 setup: stop using `the_repository` in `create_reference_database()`Patrick Steinhardt, Apr 20, 2026
  24. 18/18 setup: stop using `the_repository` in `init_db()`Patrick Steinhardt, Apr 20, 2026
  25. Elijah NewrenApr 20, 2026
  26. Patrick SteinhardtApr 21, 2026
  27. Junio C HamanoApr 20, 2026
  28. Patrick SteinhardtApr 21, 2026
  29. 00/18 setup: drop uses of `the_repository`Patrick Steinhardt, May 18, 2026
  30. 01/18 setup: replace use of `the_repository` in static functionsPatrick Steinhardt, May 18, 2026
  31. Karthik NayakMay 19, 2026
  32. 02/18 setup: stop using `the_repository` in `is_inside_worktree()`Patrick Steinhardt, May 18, 2026
  33. Karthik NayakMay 19, 2026
  34. Patrick SteinhardtMay 19, 2026
  35. 03/18 setup: stop using `the_repository` in `is_inside_git_dir()`Patrick Steinhardt, May 18, 2026
  36. Karthik NayakMay 19, 2026
  37. 04/18 setup: stop using `the_repository` in `prefix_path()`Patrick Steinhardt, May 18, 2026
  38. 05/18 setup: stop using `the_repository` in `path_inside_repo()`Patrick Steinhardt, May 18, 2026
  39. 06/18 setup: stop using `the_repository` in `verify_filename()`Patrick Steinhardt, May 18, 2026
  40. 07/18 setup: stop using `the_repository` in `verify_non_filename()`Patrick Steinhardt, May 18, 2026
  41. 08/18 setup: stop using `the_repository` in `enter_repo()`Patrick Steinhardt, May 18, 2026
  42. 09/18 setup: stop using `the_repository` in `setup_work_tree()`Patrick Steinhardt, May 18, 2026
  43. 10/18 setup: stop using `the_repository` in `set_git_work_tree()`Patrick Steinhardt, May 18, 2026
  44. 11/18 setup: stop using `the_repository` in `setup_git_env()`Patrick Steinhardt, May 18, 2026
  45. 12/18 setup: stop using `the_repository` in `setup_git_directory_gently()`Patrick Steinhardt, May 18, 2026
  46. 13/18 setup: stop using `the_repository` in `setup_git_directory()`Patrick Steinhardt, May 18, 2026
  47. 14/18 setup: stop using `the_repository` in `upgrade_repository_format()`Patrick Steinhardt, May 18, 2026
  48. 15/18 setup: stop using `the_repository` in `check_repository_format()`Patrick Steinhardt, May 18, 2026
  49. 16/18 setup: stop using `the_repository` in `initialize_repository_version()`Patrick Steinhardt, May 18, 2026
  50. 17/18 setup: stop using `the_repository` in `create_reference_database()`Patrick Steinhardt, May 18, 2026
  51. 18/18 setup: stop using `the_repository` in `init_db()`Patrick Steinhardt, May 18, 2026
  52. Karthik NayakMay 19, 2026
  53. Patrick SteinhardtMay 19, 2026
  54. 00/18 setup: drop uses of `the_repository`Patrick Steinhardt, May 19, 2026
  55. 01/18 setup: replace use of `the_repository` in static functionsPatrick Steinhardt, May 19, 2026
  56. 02/18 setup: stop using `the_repository` in `is_inside_git_dir()`Patrick Steinhardt, May 19, 2026
  57. 03/18 setup: stop using `the_repository` in `is_inside_work_tree()`Patrick Steinhardt, May 19, 2026
  58. 04/18 setup: stop using `the_repository` in `prefix_path()`Patrick Steinhardt, May 19, 2026
  59. 05/18 setup: stop using `the_repository` in `path_inside_repo()`Patrick Steinhardt, May 19, 2026
  60. 06/18 setup: stop using `the_repository` in `verify_filename()`Patrick Steinhardt, May 19, 2026
  61. 07/18 setup: stop using `the_repository` in `verify_non_filename()`Patrick Steinhardt, May 19, 2026
  62. 08/18 setup: stop using `the_repository` in `enter_repo()`Patrick Steinhardt, May 19, 2026
  63. 09/18 setup: stop using `the_repository` in `setup_work_tree()`Patrick Steinhardt, May 19, 2026
  64. 10/18 setup: stop using `the_repository` in `set_git_work_tree()`Patrick Steinhardt, May 19, 2026
  65. 11/18 setup: stop using `the_repository` in `setup_git_env()`Patrick Steinhardt, May 19, 2026
  66. 12/18 setup: stop using `the_repository` in `setup_git_directory_gently()`Patrick Steinhardt, May 19, 2026
  67. 14/18 setup: stop using `the_repository` in `upgrade_repository_format()`Patrick Steinhardt, May 19, 2026
  68. 13/18 setup: stop using `the_repository` in `setup_git_directory()`Patrick Steinhardt, May 19, 2026
  69. 15/18 setup: stop using `the_repository` in `check_repository_format()`Patrick Steinhardt, May 19, 2026
  70. 16/18 setup: stop using `the_repository` in `initialize_repository_version()`Patrick Steinhardt, May 19, 2026
  71. 17/18 setup: stop using `the_repository` in `create_reference_database()`Patrick Steinhardt, May 19, 2026
  72. 18/18 setup: stop using `the_repository` in `init_db()`Patrick Steinhardt, May 19, 2026
  73. Junio C HamanoMay 20, 2026

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.