]> git.99rst.org Git - git.git/commit
read-cache: pass 'repo' to 'ce_mode_from_stat()'
authorTian Yuchen <redacted>
Mon, 20 Jul 2026 10:53:33 +0000 (18:53 +0800)
committerJunio C Hamano <redacted>
Mon, 20 Jul 2026 14:37:05 +0000 (07:37 -0700)
commitb7b6e9e02f6b6b84848b2458d5d2b3d47260d4bb
treee664b132d37b3a7539c3d5082591bddfc9211729
parent8817d7931aab41d4423fbf588f1ab2247070d816
read-cache: pass 'repo' to 'ce_mode_from_stat()'

The ce_mode_from_stat() function is a performance-critical static
inline helper in 'read-cache.h'. As we migrate configuration
variables into the repository struct, this helper needs access
to the repository context.

Update the signature of ce_mode_from_stat() to take a 'struct
repository *' parameter, and update all callers to pass the
appropriate repository instance.

To prepare for the overhead of replacing cheap global variable
accesses with getter functions, the boolean expressions are
reordered to evaluate 'S_ISREG(mode)' first.

While at it, add a comment for ce_mode_from_stat().

Mentored-by: Christian Couder <redacted>
Mentored-by: Ayush Chandekar <redacted>
Mentored-by: Olamide Caleb Bello <redacted>
Signed-off-by: Tian Yuchen <redacted>
Signed-off-by: Junio C Hamano <redacted>
apply.c
builtin/update-index.c
diff-lib.c
read-cache.c
read-cache.h
git clone https://git.99rst.org/PROJECT