git/list[1] front-page[2] threads[3] people[4] search[5] about
wed 2026-10-07 16:54 UTC

Re: [PATCH 3/3] environment: reorder variables in repo_config_values structure

From
Tian Yuchen <cat@malon.dev>
Date
Aug 7, 2026, 08:26 UTC
Message-ID
<dc22396e-21b8-442f-a93d-f49e7af5e99a@malon.dev>
In-Reply-To
<xmqq5x1nmc90.fsf@gitster.g>
On 8/7/26 00:42, Junio C Hamano wrote:
Show 42 quoted lines
> Tian Yuchen <cat@malon.dev> writes:
> 
>> On 8/6/26 05:47, Junio C Hamano wrote:
>>> Tian Yuchen <cat@malon.dev> writes:
>>>
>>>> Reorder the fields in struct repo_config_values and its initialization
>>>> function to follow the order of configuration sections.
>>>>
>>>> Keeping the declaration and initialization order aligned makes the
>>>> structure easier to review and maintain.
>>>
>>> Really?
>>>
>>> Do you have some automated tool to make sure these initialization
>>> assignments in the environment.c file and declaration in the
>>> environment.h file match the order in Documentation/config/*.adoc or
>>> something else?  Have you designated some list as the authoritative
>>> source of truth to check these against?  Without such a list to
>>> check the code against and a mechanism to enforce the ordering, I
>>> find it hard to agree with such a claim that this makes it easier to
>>> maintain.
>>
>> I see.
>>
>>>
>>> It is typical to list the structure members in the order of stricter
>>> to looser alignment requirement of their types.  I do not know how
>>> strictly it is followed for "struct repo_config_values", but by
>>> spreading pointer valued members more widely with smaller enums in
>>> between, the change certainly is making the overall structure size
>>> larger by requiring more padding between the members with different
>>> alignment requirements.  Not that we would have 100s of instances of
>>> these structures.
>>>
>>
>> Oh, I overlooked the size issue. Thanks for pointing out.
> 
> I didn't mean to "point out" any size issue.  As I said, it is not
> like we have hundreds of these, so padding bloat here and there
> would not matter and if we get a readability boost by reordering
> into a sensible order, that by itself could be a win.
> 
Okay.

As you said before, the boost on readability seems to be limited. Reordering by config section is not a strong maintenance rule without an authoritative source. So let's don't reorder them anyways.

Thanks, yuchen
Previous: Junio C HamanoNext: Tian Yuchen
Message 17 of 27 in “environment: clean up repository config handling”
  1. 0/3 environment: clean up repository config handlingTian Yuchen, Aug 5, 2026
  2. 2/3 environment: clarify repository config getter documentationTian Yuchen, Aug 5, 2026
  3. 1/3 environment: simplify repository config gettersTian Yuchen, Aug 5, 2026
  4. 3/3 environment: reorder variables in repo_config_values structureTian Yuchen, Aug 5, 2026
  5. Junio C HamanoAug 5, 2026
  6. Junio C HamanoAug 5, 2026
  7. Junio C HamanoAug 5, 2026
  8. Tian YuchenAug 6, 2026
  9. Tian YuchenAug 6, 2026
  10. 0/3 environment: clean up repository config handlingTian Yuchen, Aug 6, 2026
  11. 1/3 environment: simplify repository config gettersTian Yuchen, Aug 6, 2026
  12. 2/3 environment: clarify repository config getter documentationTian Yuchen, Aug 6, 2026
  13. 3/3 environment: remove inaccurate repo_config_values commentsTian Yuchen, Aug 6, 2026
  14. Junio C HamanoAug 6, 2026
  15. Junio C HamanoAug 6, 2026
  16. Junio C HamanoAug 6, 2026
  17. Tian YuchenAug 7, 2026
  18. Tian YuchenAug 7, 2026
  19. 0/3 environment: clean up repository config handlingTian Yuchen, Aug 7, 2026
  20. 1/3 environment: drop redundant NULL checks in config gettersTian Yuchen, Aug 7, 2026
  21. 2/3 environment: clarify repository config getter documentationTian Yuchen, Aug 7, 2026
  22. 3/3 environment: remove inaccurate repo_config_values commentsTian Yuchen, Aug 7, 2026
  23. Patrick SteinhardtAug 7, 2026
  24. Junio C HamanoAug 7, 2026
  25. Patrick SteinhardtAug 10, 2026
  26. Junio C HamanoAug 26, 2026
  27. Patrick SteinhardtSep 11, 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.