Subject: Re: [PATCH v10] setup: improve error diagnosis for invalid .git files

From: Junio C Hamano <[email-masked]>
Date: Tue, 24 Feb 2026 18:50:19 -0800

Tian Yuchen <[email-masked]> writes:

>   1. Perhaps I took it literally, but as far as the original intent 
> goes, shouldn't 'read_gitfile_gently()' be solely responsible for 
> *opening a .git file and parsing the gitdir: <path> format*? However, it 
> currently executes 'stat()', checks 'S_ISDIR', checks 'S_ISREG', handles 
> missing components, and *then* attempts to parse. Do we need an 'enum 
> git_componet_type git_componet(cost char *path)' which returns pure 
> filesystem states, then parse it with 'parse_gitfile_format(const char 
> *path)'? I don't know.

Sorry, but I do not see what such a change buys us.

>   2. Let's say, when stat() encounters a EACCES when cheaking a 
> restricted sub-folder. Git funnels this into STAT_FAILED and 
> subsequently invokes die(), which calls exit().

Yes all this happens in repository set-up which should happen very
early in the process, no?

> I'm thinking of 
> libification: if a long running multi threaded git server encounters a 
> permission-denied directory, is killing the entire process the expected 
> behavior?

It is a bug in the way you wrote that multi-threaded git server, no?

We have the "_gently" variant for such a use case, and I do not
think we expect the normal single-process git start-up sequence
should be reused there.