Re: [PATCH v11] setup: improve error diagnosis for invalid .git files
- From
Tian Yuchen <a3205153416@gmail.com>
- Date
- Feb 27, 2026, 05:26 UTC
- Message-ID
- <bcf64540-fe84-4fcc-a969-6927f348608e@gmail.com>
- In-Reply-To
- <xmqqpl5rumy0.fsf@gitster.g>
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