Re: [PATCH v6 2/4] read-cache: move 'ce_mode_from_stat()' to 'read-cache.c'
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Jul 16, 2026, 20:20 UTC
- Message-ID
- <xmqqa4rqfzys.fsf@gitster.g>
- In-Reply-To
- <20260716084941.1101918-3-cat@malon.dev>
Tian Yuchen <cat@malon.dev> writes:
Show 9 quoted lines
> The ce_mode_from_stat() function is declared as a static inline function > in 'read-cache.h'. As we want to migrate configuration variables, this > helper function will need access to corresponding repository-specific > configuration logic. Move the implementation to 'read-cache.c' to > cleanly encapsulate its dependencies. > > Note that the 'extern int trust_executable_bit, has_symlinks;' line is > discarded because it's not necessary when the function lives in > "read-cache.c".
A "static inline" function in a header typically signals that it is expected to be called from the depths of a performance- critical loop. I am not sure if this helper is still in such a hot path, but I wonder if we can keep it inline and still teach it to take a "struct repository *r" (or whatever extra parameter you need) to move these two bits from being global variables to members of a per-repository structure.