On Thu, Aug 15, 2024 at 02:52:21PM -0700, Junio C Hamano wrote: > "brian m. carlson" <sandals@xxxxxxxxxxxxxxxxxxxx> writes: > > > On 2024-08-15 at 15:24:47, shejialuo wrote: > >> If the user uses the following command: > >> > >> $ export GIT_DEFAULT_HASH_ENVIRONMENT=sha1 > >> $ git -c init.defaultObjectFormat=sha256 repo > >> > >> The repo would be initialized with the sha1 algorithm. I think we should > >> think carefully which precedence should be higher. I cannot give an > >> answer here. I am not familiar with the whole database and do not the > >> concern. But from my own perspective, I think the precedence of the > >> config should be higher than the environment variable. This is a new > >> feature, the people who would like to use it, they will never use > >> environment variable and we should ignore the functionality of the > >> environment variable. But for people who do not know this feature, they > >> will continue to use the environment variable and they will never be > >> influenced by the configs. > > > > The standard behaviour we have with other environment variables is that > > they override the config, such as with `GIT_SSH_COMMAND` and > > `GIT_SSH_VARIANT`. The reason is that the config in this case is > > usually per-user or per-system, but it's very common to override > > settings on an ephemeral basis with the environment. > > Right. It is good that somebody can give a clear answer when a new > person says they cannot and then give an answer that contradicts > with an established practice ;-). Yeah, thanks for putting it so clearly. I'll also put a variant of this into the commit message to clarify. Patrick