Subject: Re: [PATCH v5 2/2] setup: allow cwd/.git to be a symlink to a directory

From: Tian Yuchen <[email-masked]>
Date: Wed, 18 Feb 2026 19:20:05 +0800

Hi Karthik,

> But we don't really do this no? We were calling `read_gitfile_gently()`
> before and continue to do so, so there was no change regards to calling
> `stat()` here. Or am I missing something?

Oops, It seems I mixed up the changes in previous patches. I did make a 
mistake.

> But now we'd die. Correct? Doesn't that change the expected flow?

Yes, this is a regression I missed. If 'die_on_error' is false, 
encountering an error like 'READ_GITFILE_ERR_INVALID_FORMAT' should 
return 'GIT_DIR_INVALID_GITFILE' rather than dying.

So in v6 I will ensure that we only delegate to 
'read_gitfile_error_die()' when:

1. It is a happy case we want to ignore
2. It is a security case we MUST die on;
3. 'die_on_error' is tru

Otherwise, we should fall back to returning the error code as before.

Thank you for your time,

Regards,

Yuchen

>> +		} else {
>>   			gitfile = xstrdup(dir->buf);
>> +		}
>>   		/*
>>   		 * Earlier, we tentatively added DEFAULT_GIT_DIR_ENVIRONMENT
>>   		 * to check that directory for a repository.
> 
> [snip]