Re: [PATCH v8] setup: allow cwd/.git to be a symlink to a directory
- From
Tian Yuchen <a3205153416@gmail.com>
- Date
- Feb 21, 2026, 08:10 UTC
- Message-ID
- <60e4cbcd-6dfe-4e1a-9c63-be905c815bed@gmail.com>
- In-Reply-To
- <xmqqfr6vxpkn.fsf@gitster.g>
Hi junio,
> So, "Fix this" written here does not resonate with my understanding > of what we have been discussing so far. Puzzled.
You are completely right to be puzzled.
In an earlier iteration of this patch, another reviewer brought up a case regarding symlinks. I adjusted the logic and wrote the commit message around that "symlinks" narrative.
Through the subsequent refactors up to v8, the code evolved to tackle the much deeper issue-addressing the two decade-old 'NEEDSWORK' comments. The code structure was completely rewritten but I forgot that the symlinks stuff was not relevant anymore.
You are right. The actual value of this patch is the error code refactoring, not fixing symlinks.
> All of the above are exactly what I expected to see. Nice.
I'm glad I finally got it right ;)
Show 9 quoted lines
> 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?
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.
Will send v9 soon, with commit message rewritten.
Regards,
Yuchen