All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tian Yuchen <cat@malon.dev>
To: "SZEDER Gábor" <szeder.dev@gmail.com>
Cc: git@vger.kernel.org, ps@pks.im,
	Christian Couder <christian.couder@gmail.com>,
	Ayush Chandekar <ayu.chandekar@gmail.com>,
	Olamide Caleb Bello <belkid98@gmail.com>
Subject: Re: [PATCH v7 2/4] read-cache: pass 'repo' to 'ce_mode_from_stat()'
Date: Mon, 20 Jul 2026 18:12:30 +0800	[thread overview]
Message-ID: <6407614a-156b-40e1-bf70-e54ce84427ad@malon.dev> (raw)
In-Reply-To: <al3v0NVZJYS9SVZF@szeder.dev>

On 7/20/26 17:52, SZEDER Gábor wrote:
> On Mon, Jul 20, 2026 at 05:13:17PM +0800, Tian Yuchen wrote:
>> On 7/19/26 03:02, SZEDER Gábor wrote:
>>> On Fri, Jul 17, 2026 at 02:35:57PM +0800, Tian Yuchen wrote:
>>>> diff --git a/read-cache.h b/read-cache.h
>>>> index 043da1f1aa..94b8d3e547 100644
>>>> --- a/read-cache.h
>>>> +++ b/read-cache.h
>>>> @@ -4,15 +4,24 @@
>>>>    #include "read-cache-ll.h"
>>>>    #include "object.h"
>>>>    #include "pathspec.h"
>>>> +#include "environment.h"
>>>> -static inline unsigned int ce_mode_from_stat(const struct cache_entry *ce,
>>>> +/*
>>>> + * Determine the appropriate index mode for a file based on its stat()
>>>> + * information and the existing cache entry (if any).
>>>> + *
>>>> + * This function handles degradation for filesystems that lack
>>>> + * symlink support or reliable executable bits.
>>>> + */
>>>> +static inline unsigned int ce_mode_from_stat(struct repository *repo,
>>>
>>> This new parameter is not yet used in this function, which causes
>>> compilation errors in all source files which include "read-cache.h"
>>> when trying to build this commit using DEVELOPER=1, e.g.:
> 
>>> I think the new parameter should be marked as UNUSED in this patch,
>>> and then the UNUSED should be dropped in the next, where you start
>>> using the parameter.
>>>
>>>> +					     const struct cache_entry *ce,
>>>>    					     unsigned int mode)
>>>>    {
>>>>    	extern int trust_executable_bit, has_symlinks;
>>>> -	if (!has_symlinks && S_ISREG(mode) &&
>>>> +	if (S_ISREG(mode) && !has_symlinks &&
>>>>    	    ce && S_ISLNK(ce->ce_mode))
>>>>    		return ce->ce_mode;
>>>> -	if (!trust_executable_bit && S_ISREG(mode)) {
>>>> +	if (S_ISREG(mode) && !trust_executable_bit) {
>>>>    		if (ce && S_ISREG(ce->ce_mode))
>>>>    			return ce->ce_mode;
>>>>    		return create_ce_mode(0666);
>>>> -- 
>>>> 2.43.0
>>>>
>>
>> But 'USUSED' cannot be used here since the corresponding header
>> (git-compat-util.h, or more specifically compat/posix.h) is not included.
> 
> UNUSED _can_ be used here, because:
> 
>    - This is a header file, so it's not supposed to be compiled on its
>      own.
>    - All C source files including this header file must start with
>      including "git-compat-util.h", so by the time they include
>      "read-cache.h", the UNUSED macro is already defined.
> 

I see.

Thanks, yuchen

  reply	other threads:[~2026-07-20 10:12 UTC|newest]

Thread overview: 62+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-30 16:05 [PATCH v1 0/4] environment.c: migrate 'trust_executable_bit' into 'repo_config_values' Tian Yuchen
2026-05-30 16:05 ` [PATCH v1 1/4] read-cache: remove redundant extern declarations Tian Yuchen
2026-05-30 16:05 ` [PATCH v1 2/4] read-cache: move 'ce_mode_from_stat()' to 'read-cache.c' Tian Yuchen
2026-06-04  6:47   ` Patrick Steinhardt
2026-06-10  8:30     ` Tian Yuchen
2026-05-30 16:05 ` [PATCH v1 3/4] environment: move 'trust_executable_bit' into repo_config_values Tian Yuchen
2026-05-30 18:02   ` Christian Couder
2026-05-30 23:17   ` Junio C Hamano
2026-06-01 10:10     ` Tian Yuchen
2026-06-01 18:03       ` Tian Yuchen
2026-06-09 13:45         ` Junio C Hamano
2026-05-30 16:05 ` [PATCH v1 4/4] read-cache: pass 'istate' to stat/mode helper functions Tian Yuchen
2026-05-30 18:14   ` Christian Couder
2026-06-10  9:36 ` [PATCH v2 0/3] environment: migrate 'trust_executable_bit' into 'repo_config_values' Tian Yuchen
2026-06-10  9:36   ` [PATCH v2 1/3] read-cache: remove redundant extern declarations Tian Yuchen
2026-06-10  9:36   ` [PATCH v2 2/3] read-cache: move 'ce_mode_from_stat()' to 'read-cache.c' Tian Yuchen
2026-06-12  7:43     ` Christian Couder
2026-06-10  9:36   ` [PATCH v2 3/3] environment: move trust_executable_bit into repo_config_values Tian Yuchen
2026-06-11  2:58     ` Tian Yuchen
2026-06-12  7:48     ` Christian Couder
2026-06-12 15:21       ` Junio C Hamano
2026-06-12 16:05   ` [PATCH v3 0/3] environment: migrate 'trust_executable_bit' into 'repo_config_values' Tian Yuchen
2026-06-12 16:05     ` [PATCH v3 1/3] read-cache: remove redundant extern declarations Tian Yuchen
2026-06-12 16:05     ` [PATCH v3 2/3] read-cache: move 'ce_mode_from_stat()' to 'read-cache.c' Tian Yuchen
2026-06-12 16:05     ` [PATCH v3 3/3] environment: move trust_executable_bit into repo_config_values Tian Yuchen
2026-06-19 16:21     ` [PATCH v4 0/3] environment: migrate 'trust_executable_bit' into 'repo_config_values' Tian Yuchen
2026-06-19 16:21       ` [PATCH v4 1/3] read-cache: remove redundant extern declarations Tian Yuchen
2026-06-19 16:21       ` [PATCH v4 2/3] read-cache: move 'ce_mode_from_stat()' to 'read-cache.c' Tian Yuchen
2026-06-19 16:21       ` [PATCH v4 3/3] environment: move trust_executable_bit into repo_config_values Tian Yuchen
2026-06-29 20:55       ` [PATCH v4 0/3] environment: migrate 'trust_executable_bit' into 'repo_config_values' Junio C Hamano
2026-07-15  3:28         ` Tian Yuchen
2026-07-15  3:54       ` [PATCH v5 0/4] environment: migrate 'trust_executable_bit' and 'has_symlinks' " Tian Yuchen
2026-07-15  3:54         ` [PATCH v5 1/4] read-cache: remove redundant extern declarations Tian Yuchen
2026-07-15  3:54         ` [PATCH v5 2/4] read-cache: move 'ce_mode_from_stat()' to 'read-cache.c' Tian Yuchen
2026-07-15  3:55         ` [PATCH v5 3/4] environment: move trust_executable_bit into repo_config_values Tian Yuchen
2026-07-15  3:55         ` [PATCH v5 4/4] environment: move has_symlinks " Tian Yuchen
2026-07-15  6:21           ` Christian Couder
2026-07-15 17:18             ` Junio C Hamano
2026-07-15 18:23           ` Junio C Hamano
2026-07-16  8:49         ` [PATCH v6 0/4] environment: migrate 'trust_executable_bit' and 'has_symlinks' into 'repo_config_values' Tian Yuchen
2026-07-16  8:49           ` [PATCH v6 1/4] read-cache: remove redundant extern declarations Tian Yuchen
2026-07-16  8:49           ` [PATCH v6 2/4] read-cache: move 'ce_mode_from_stat()' to 'read-cache.c' Tian Yuchen
2026-07-16 20:20             ` Junio C Hamano
2026-07-16  8:49           ` [PATCH v6 3/4] environment: move trust_executable_bit into repo_config_values Tian Yuchen
2026-07-16  8:49           ` [PATCH v6 4/4] environment: move has_symlinks " Tian Yuchen
2026-07-16 20:27             ` Junio C Hamano
2026-07-17  6:35           ` [PATCH v7 0/4] environment: migrate 'trust_executable_bit' and 'has_symlinks' into 'repo_config_values' Tian Yuchen
2026-07-17  6:35             ` [PATCH v7 1/4] read-cache: remove redundant extern declarations Tian Yuchen
2026-07-17  6:35             ` [PATCH v7 2/4] read-cache: pass 'repo' to 'ce_mode_from_stat()' Tian Yuchen
2026-07-18 19:02               ` SZEDER Gábor
2026-07-20  9:13                 ` Tian Yuchen
2026-07-20  9:52                   ` SZEDER Gábor
2026-07-20 10:12                     ` Tian Yuchen [this message]
2026-07-17  6:35             ` [PATCH v7 3/4] environment: move trust_executable_bit into repo_config_values Tian Yuchen
2026-07-17 16:01               ` Junio C Hamano
2026-07-20 10:09                 ` Tian Yuchen
2026-07-17  6:35             ` [PATCH v7 4/4] environment: move has_symlinks " Tian Yuchen
2026-07-20 10:53             ` [PATCH v8 0/4] environment: migrate 'trust_executable_bit' and 'has_symlinks' into 'repo_config_values' Tian Yuchen
2026-07-20 10:53               ` [PATCH v8 1/4] read-cache: remove redundant extern declarations Tian Yuchen
2026-07-20 10:53               ` [PATCH v8 2/4] read-cache: pass 'repo' to 'ce_mode_from_stat()' Tian Yuchen
2026-07-20 10:53               ` [PATCH v8 3/4] environment: move trust_executable_bit into repo_config_values Tian Yuchen
2026-07-20 10:53               ` [PATCH v8 4/4] environment: move has_symlinks " Tian Yuchen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6407614a-156b-40e1-bf70-e54ce84427ad@malon.dev \
    --to=cat@malon.dev \
    --cc=ayu.chandekar@gmail.com \
    --cc=belkid98@gmail.com \
    --cc=christian.couder@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=ps@pks.im \
    --cc=szeder.dev@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.