Git development
 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,  cirnovskyv@gmail.com,
	 Christian Couder <christian.couder@gmail.com>,
	 Ayush Chandekar <ayu.chandekar@gmail.com>,
	 Olamide Caleb Bello <belkid98@gmail.com>
Subject: Re: [PATCH v5 4/4] environment: move has_symlinks into repo_config_values
Date: Wed, 15 Jul 2026 11:23:02 -0700	[thread overview]
Message-ID: <xmqqwluwm7sp.fsf@gitster.g> (raw)
In-Reply-To: <20260715035501.48271-5-cat@malon.dev> (Tian Yuchen's message of "Wed, 15 Jul 2026 11:55:01 +0800")

Tian Yuchen <cat@malon.dev> writes:

> Note:
> To support early platform-specific (MinGW) overrides
> before repository initialization, a global variable
> 'default_has_symlinks' fallback is introduced as a fallback
> in environment.h. The *writer* in compat/mingw.c can only
> access this variable.

This may invite people to abuse the global variable.  I wonder if we
want to do something similar to how we handle is_dir_sep() and
friends instead.

The idea is to have something like this in the generic header:

        #ifndef platform_has_symlinks
        #define platform_has_symlinks() 1
        #endif

And then allow selected platforms override it:

        /* in compat/mingw.h */
        #define platform_has_symlinks() mingw_platform_has_symlinks()
        extern int mingw_platform_has_symlinks(void);

        /* in compat/mingw.c */
        int mingw_platform_has_symlinks(void)
        {
                if (!(tmp = getenv("MSYS")) || !strstr(tmp, "winsymlinks:nativestrict"))
                        return 0;
                else
                        return 1;
        }

This keeps the namespace clean and avoids exposing a mutable state
variable that others might be tempted to meddle with.

      parent reply	other threads:[~2026-07-15 18:23 UTC|newest]

Thread overview: 39+ 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 [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=xmqqwluwm7sp.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=cirnovskyv@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=ps@pks.im \
    /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