From: Junio C Hamano <gitster@pobox.com>
To: Tian Yuchen <cat@malon.dev>
Cc: git@vger.kernel.org,
Christian Couder <christian.couder@gmail.com>,
Ayush Chandekar <ayu.chandekar@gmail.com>,
Olamide Caleb Bello <belkid98@gmail.com>
Subject: Re: [PATCH] environment: use 'repo->initialized' for repo_protect_hfs() and repo_protect_ntfs()
Date: Sat, 20 Jun 2026 08:18:01 -0700 [thread overview]
Message-ID: <xmqqpl1lfdg6.fsf@gitster.g> (raw)
In-Reply-To: <20260620140957.667820-1-cat@malon.dev> (Tian Yuchen's message of "Sat, 20 Jun 2026 22:09:57 +0800")
Tian Yuchen <cat@malon.dev> writes:
> To match how we refrain from calling repo_config_values() on an
> uninitialized instance of a repository object in other two topics
> that deal with ignore_case and trust_executable_bit, check the
> repo->initialized bit instead of the repo->gitdir member.
OK.
> Base commit: 43192e7977f5f05138abcdb3212a3f87ab513bef
This line does not belong here. Besides, you do not build directly
on top of 'next', ever.
> Mentored-by: Christian Couder <christian.couder@gmail.com>
> Mentored-by: Ayush Chandekar <ayu.chandekar@gmail.com>
> Mentored-by: Olamide Caleb Bello <belkid98@gmail.com>
> Signed-off-by: Tian Yuchen <cat@malon.dev>
> ---
> environment.c | 4 ++--
> environment.h | 4 ++--
> 2 files changed, 4 insertions(+), 4 deletions(-)
I'll queue the change directly on top of ty/move-protect-hfs-ntfs
topic, which will be merged to 'next'.
Thanks.
> diff --git a/environment.c b/environment.c
> index 6ee11e9fc8..8f0c1c4f25 100644
> --- a/environment.c
> +++ b/environment.c
> @@ -130,14 +130,14 @@ int is_bare_repository(struct repository *repo)
>
> int repo_protect_ntfs(struct repository *repo)
> {
> - return repo->gitdir ?
> + return (repo && repo->initialized) ?
> repo_config_values(repo)->protect_ntfs :
> PROTECT_NTFS_DEFAULT;
> }
>
> int repo_protect_hfs(struct repository *repo)
> {
> - return repo->gitdir ?
> + return (repo && repo->initialized) ?
> repo_config_values(repo)->protect_hfs :
> PROTECT_HFS_DEFAULT;
> }
> diff --git a/environment.h b/environment.h
> index d188955f5b..8aaedcfea3 100644
> --- a/environment.h
> +++ b/environment.h
> @@ -137,8 +137,8 @@ int git_default_core_config(const char *var, const char *value,
>
> /*
> * Getters for the `protect_hfs` and `protect_ntfs` fields of `struct repo_config_values`.
> - * They check `repo->gitdir` to prevent calling repo_config_values()
> - * before the configuration is loaded or in bare environments.
> + * They check `repo->initialized` to prevent calling `repo_config_values()`
> + * before the repository setup is fully complete or in non-git environments.
> */
> int repo_protect_hfs(struct repository *repo);
> int repo_protect_ntfs(struct repository *repo);
prev parent reply other threads:[~2026-06-20 15:18 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-19 16:38 [PATCH v4 0/1] environment: move protect_hfs and protect_ntfs into repo_config_values Tian Yuchen
2026-06-19 16:38 ` [PATCH v4 1/1] environment: move 'protect_hfs' and 'protect_ntfs' into 'repo_config_values' Tian Yuchen
2026-06-19 17:14 ` [PATCH v4 0/1] environment: move protect_hfs and protect_ntfs into repo_config_values Junio C Hamano
2026-06-19 17:25 ` Junio C Hamano
2026-06-20 13:38 ` Tian Yuchen
2026-06-20 14:09 ` [PATCH] environment: use 'repo->initialized' for repo_protect_hfs() and repo_protect_ntfs() Tian Yuchen
2026-06-20 15:18 ` Junio C Hamano [this message]
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=xmqqpl1lfdg6.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=ayu.chandekar@gmail.com \
--cc=belkid98@gmail.com \
--cc=cat@malon.dev \
--cc=christian.couder@gmail.com \
--cc=git@vger.kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox