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

From: Tian Yuchen <[email-masked]>
Date: Wed, 25 Feb 2026 01:01:36 +0800

Hi Junio,

I believe we have made some progress so far. However, after reviewing 
the code again just now, I still have a few questions I'd like to ask:

  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.

  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(). 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? Should 'permission-denied' really be considered as an 'error'? 
Does a library has the authority to terminate the application?

I won't touch any of this right now to keep the current scope focused, 
but I plan to incorporate thoughts into my GSoC proposal for the global 
state/libification project.

If you have more important things to do, feel free to ignore this email. 
After all, I consider it a minor issue.

This is my first patch at my nineteen, and I'm more than delighted to 
spend my birthday reviewing git code ;)

Regards,

Yuchen