Subject: Re: [PATCH v8] setup: allow cwd/.git to be a symlink to a directory

From: Junio C Hamano <[email-masked]>
Date: Sat, 21 Feb 2026 09:20:38 -0800

Tian Yuchen <[email-masked]> writes:

>> This design decision may be debatable, but not tightening everything
>> at once may be a prudent thing to do to avoid accidental regression.
>> 
>> Having said that.
>>
>> If you have a directory ".git/" somewhere in your working tree, and
>> the directory is somehow corrupt that is_git_directory() says "nope,
>> that is not a valid Git directory", wouldn't you rather want to know
>> about it as a potential problem?
>
> Great point. A corrupt '.git' dir is definitely a red flag. However, 
> silently ignoring it and moving on has been the historical behavior, 
> hasn't it?

Exactly.  That is where my reference to "not tightening everything
at once" comes from.

> Still, if we decide to tighten this in the future, it will be very 
> simple change within this new 'switch' structure. Nothing much to worry 
> about IMO.

Yup.  Perhaps it would deserve a new "/* NEEDSWORK: should we catch a
directory .git that is not a git directory here? */" comment there.

> Will send v9 soon, with commit message rewritten.

Thanks.