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

Re: [PATCH 3/5] setup: merge configuration of repository formats

From
Justin Tobler <jltobler@gmail.com>
Date
Aug 15, 2024, 21:37 UTC
Message-ID
<hxnibmbakpvh72kfrycxnvo5a24f6atcqa73yys4zthbqpwikq@s7435n3nqmlz>
In-Reply-To
<16f52b75d8972343776adb269da305e7406ff385.1723708417.git.ps@pks.im>
On 24/08/15 10:00AM, Patrick Steinhardt wrote:
Show 7 quoted lines
> The configuration of repository formats is split up across two functions
> `validate_hash_algorithm()` and `validate_ref_storage_format()`. This is
> fine as-is, but we are about to extend the logic to also read default
> values from the config. With the logic split across two functions, we
> would either have to pass in additional parameters read from the config,
> or read the config multiple times. Both of these options feel a bit
> unwieldy.

Combining the repository format configuration logic into a single function seems like a good option. It looks like go we even further though since we also include setting the hash and ref format for `the_repository`. Might be nice to also mention this.

> Merge the code into a new a new function `repository_format_configure()`
s/new a new/new/
Show 5 quoted lines
> that is responsible for configuring the whole repository's format. Like
> this, we can easily read the config in a single place, only.
> 
> Signed-off-by: Patrick Steinhardt <ps@pks.im>
> ---
[snip]
> -	/*
> -	 * Now that we have set up both the hash algorithm and the ref storage
> -	 * format we can update the repository's settings accordingly.
> -	 */

The above comment somewhat made it sound like the repository format had to be configured for both the hash algo and ref storage before updating `the_repository`, but that does not seem to be a requirement in actuality.

> -	repo_set_hash_algo(the_repository, repo_fmt.hash_algo);
> -	repo_set_ref_storage_format(the_repository, repo_fmt.ref_storage_format);
> +	repository_format_configure(&repo_fmt, hash, ref_storage_format);

Overall, I like that this repostory format configuration is under `repository_format_configure()`. The `validate_*()` functions names confused me slightly initially because I assumed they were only validating, but they also configure the repo format. Looking good :)

-Justin
Previous: Patrick SteinhardtNext: Patrick Steinhardt
Message 6 of 24 in “Introduce configs for default repo format”
  1. 0/5 Introduce configs for default repo formatPatrick Steinhardt, Aug 15, 2024
  2. 1/5 t0001: exercise initialization with ref formats more thoroughlyPatrick Steinhardt, Aug 15, 2024
  3. Justin ToblerAug 15, 2024
  4. 2/5 t0001: delete repositories when object format tests finishPatrick Steinhardt, Aug 15, 2024
  5. 3/5 setup: merge configuration of repository formatsPatrick Steinhardt, Aug 15, 2024
  6. Justin ToblerAug 15, 2024
  7. Patrick SteinhardtAug 16, 2024
  8. 5/5 setup: make ref storage format configurable via configPatrick Steinhardt, Aug 15, 2024
  9. Justin ToblerAug 15, 2024
  10. 4/5 setup: make object format configurable via configPatrick Steinhardt, Aug 15, 2024
  11. Justin ToblerAug 15, 2024
  12. shejialuoAug 15, 2024
  13. brian m. carlsonAug 15, 2024
  14. Junio C HamanoAug 15, 2024
  15. Patrick SteinhardtAug 16, 2024
  16. brian m. carlsonAug 15, 2024
  17. 0/5 Introduce configs for default repo formatPatrick Steinhardt, Aug 16, 2024
  18. 2/5 t0001: delete repositories when object format tests finishPatrick Steinhardt, Aug 16, 2024
  19. 5/5 setup: make ref storage format configurable via configPatrick Steinhardt, Aug 16, 2024
  20. 3/5 setup: merge configuration of repository formatsPatrick Steinhardt, Aug 16, 2024
  21. 1/5 t0001: exercise initialization with ref formats more thoroughlyPatrick Steinhardt, Aug 16, 2024
  22. 4/5 setup: make object format configurable via configPatrick Steinhardt, Aug 16, 2024
  23. Junio C HamanoAug 16, 2024
  24. Justin ToblerAug 16, 2024

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.