Re: [PATCH v1 2/4] read-cache: move 'ce_mode_from_stat()' to 'read-cache.c'
- From
Patrick Steinhardt <ps@pks.im>
- Date
- Jun 4, 2026, 06:47 UTC
- Message-ID
- <aiEfkOtlnemkWgXV@pks.im>
- In-Reply-To
- <20260530160520.77859-3-cat@malon.dev>
On Sun, May 31, 2026 at 12:05:17AM +0800, Tian Yuchen wrote:
Show 24 quoted lines
> diff --git a/read-cache.h b/read-cache.h
> index 043da1f1aa..3c4af2faeb 100644
> --- a/read-cache.h
> +++ b/read-cache.h
> @@ -5,20 +5,8 @@
> #include "object.h"
> #include "pathspec.h"
>
> -static inline unsigned int ce_mode_from_stat(const struct cache_entry *ce,
> - unsigned int mode)
> -{
> - extern int trust_executable_bit, has_symlinks;
> - if (!has_symlinks && S_ISREG(mode) &&
> - ce && S_ISLNK(ce->ce_mode))
> - return ce->ce_mode;
> - if (!trust_executable_bit && S_ISREG(mode)) {
> - if (ce && S_ISREG(ce->ce_mode))
> - return ce->ce_mode;
> - return create_ce_mode(0666);
> - }
> - return create_ce_mode(mode);
> -}
> +unsigned int ce_mode_from_stat(const struct cache_entry *ce,
> + unsigned int mode);This is moving goalposts a bit, so please feel free to ignore: should we maybe add a small comment what the function does while at it?
Patrick