Re: [PATCH v5 4/4] environment: move has_symlinks into repo_config_values
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Jul 15, 2026, 18:23 UTC
- Message-ID
- <xmqqwluwm7sp.fsf@gitster.g>
- In-Reply-To
- <20260715035501.48271-5-cat@malon.dev>
Tian Yuchen <cat@malon.dev> writes:
Show 6 quoted lines
> 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
#endifAnd 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.