Re: [PATCH v11] setup: improve error diagnosis for invalid .git files
- From
Tian Yuchen <a3205153416@gmail.com>
- Date
- Mar 4, 2026, 11:03 UTC
- Message-ID
- <99c6a437-3fc3-4d9a-9465-4c47a9777776@gmail.com>
- In-Reply-To
- <xmqqo6l49mrt.fsf@gitster.g>
Hi Junio and Phillip,
Thanks for the detailed reply!
After reading through your discussion, I believe the most crucial point is:
> "We were given an invalid GIT_DIR, we are not doing > discovery, hence we are operating without a repository"
If I understand correctly, the expected behavior should be: when a user explicitly passes 'GIT_DIR=/dev/null git diff', Git should no longer need to "search" or "guess" anything. Instead, if it's a trash file (or something similar) rather a repository, Git should simply act as if no repository exists. Is that correct?
So what I'm doing next is:
> All calls to read_gitfile_gently(path, NULL) need to be > audited and then we need to decide which ones to leave lenient, and > which ones are OK to tighten together with the call used during the > repository discovery.
Will be working on it in the next few days.
Regards,
Yuchen