All of lore.kernel.org
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Tian Yuchen <cat@malon.dev>
Cc: git@vger.kernel.org,  ps@pks.im,  phillip.wood123@gmail.com,
	johannes.schindelin@gmx.de,  stolee@gmail.com,
	 Christian Couder <christian.couder@gmail.com>,
	 Ayush Chandekar <ayu.chandekar@gmail.com>,
	Olamide Caleb Bello <belkid98@gmail.com>
Subject: Re: [PATCH 1/2] environment: move ignore_case into repo_config_values
Date: Wed, 17 Jun 2026 10:16:32 -0700	[thread overview]
Message-ID: <xmqqh5n1w0i7.fsf@gitster.g> (raw)
In-Reply-To: <20260617154929.564498-2-cat@malon.dev> (Tian Yuchen's message of "Wed, 17 Jun 2026 23:49:28 +0800")

Tian Yuchen <cat@malon.dev> writes:

> Note that the newly introduced getter, 'repo_get_ignore_case()',
> intentionally avoids checking 'repo->gitdir'. This could safely
> accommodates early dynamic probing of the filesystem during
> 'git init' or clone operations, where the 'gitdir' might not be fully
> initialized but the filesystem capability must be recorded.

Why "could"?  It either "safely accommodates" or it doesn't.

I do not quite understand the logic behind this part.  Why is it OK
to punt until .gitdir is ready for trust-executable-bit, like it is
done in f951ed98 (environment: move trust_executable_bit into
repo_config_values, 2026-06-13)

diff --git a/environment.c b/environment.c
index fc3ed8bb1c..75069a884d 100644
--- a/environment.c
+++ b/environment.c
@@ -142,6 +141,13 @@ int is_bare_repository(void)
 	return is_bare_repository_cfg && !repo_get_work_tree(the_repository);
 }
 
+int repo_trust_executable_bit(struct repository *repo)
+{
+	return repo->gitdir?
+		repo_config_values(repo)->trust_executable_bit :
+		1;
+}
+

or hfs/ntfs in 71386c21 (environment: move 'protect_hfs' and
'protect_ntfs' into 'repo_config_values', 2026-06-10)

diff --git a/environment.c b/environment.c
index fc3ed8bb1c..683fe1b4d3 100644
--- a/environment.c
+++ b/environment.c
@@ -142,6 +140,20 @@ int is_bare_repository(void)
 	return is_bare_repository_cfg && !repo_get_work_tree(the_repository);
 }
 
+int repo_protect_ntfs(struct repository *repo)
+{
+	return repo->gitdir ?
+		repo_config_values(repo)->protect_ntfs :
+		PROTECT_NTFS_DEFAULT;
+}
+
+int repo_protect_hfs(struct repository *repo)
+{
+	return repo->gitdir ?
+		repo_config_values(repo)->protect_hfs :
+		PROTECT_HFS_DEFAULT;
+}
+
 int have_git_dir(void)
 {
 	return startup_info->have_repository

but not for this bit?

> +int repo_get_ignore_case(struct repository *repo)
> +{
> +	if (repo)
> +		return repo_config_values(repo)->ignore_case;
> +	return 0;
> +}

What makes ignore-case so special?  Doesn't the same logic apply to
the other three bits?

Or use a more direct

	if (repo && repo->initialized)
		...;

for all three, as repo_config_values(repo) barfs when repo is not
initialized?

I dunno.

  reply	other threads:[~2026-06-17 17:16 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-17 15:49 [PATCH 0/2] environment: move ignore_case into repo_config_values Tian Yuchen
2026-06-17 15:49 ` [PATCH 1/2] " Tian Yuchen
2026-06-17 17:16   ` Junio C Hamano [this message]
2026-06-17 15:49 ` [PATCH 2/2] config: use repo_get_ignore_case() to access core.ignorecase 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=xmqqh5n1w0i7.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 \
    --cc=johannes.schindelin@gmx.de \
    --cc=phillip.wood123@gmail.com \
    --cc=ps@pks.im \
    --cc=stolee@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.