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

From: Tian Yuchen <[email-masked]>
Date: Fri, 27 Feb 2026 13:26:51 +0800

Hi Junio,

Thank you for the error reporting.

It seems that failure "fatal: error reading 'nul'" matches the 
'die(_("error reading %s"), path)', if my understanding is correct?

So during 'git diff --no-index', the test passes 'GIT_DIR=/dev/null'. I 
highly suspect that 'stat("nul")' on Windows fails with an 'errno' other 
than 'ENOENT', so it falls into the 'STAT_FAILED' branch...

...which can be simply fixed by reverting 'READ_GITFILE_ERR_STAT_FAILED' 
(and probably 'READ_GITFILE_ERR_NOT_A_FILE') back to being non-fatal 
inside 'read_gitfile_error_die()', if I'm correct? In that case, the 
logic of the test script should also be changed, shouldn't it?

However, I'm sure that this change runs counter to our previous 
discussions. I can't think of any good ideas since I'm no windows expert 
either. So you can pretend I never said anything :P

Regards,

Yuchen