Re: [PATCH 2/3] setup: fix reinit of repos with incompatible GIT_DEFAULT_REF_FORMAT
- From
Patrick Steinhardt <ps@pks.im>
- Date
- Feb 3, 2025, 15:02 UTC
- Message-ID
- <Z6DabWZqB5QJed3F@pks.im>
- In-Reply-To
- <xmqqikpryvnm.fsf@gitster.g>
On Mon, Feb 03, 2025 at 06:01:33AM -0800, Junio C Hamano wrote:
Show 18 quoted lines
> Patrick Steinhardt <ps@pks.im> writes: > > > So from my point of view we should treat the environment variables the > > same as we treat "init.defaultRefFormat" and "init.defaultObjectFormat". > > Those indicate defaults, but do not cause us to change the format of > > existing repostiories. > > Hmph, as somebody who often does things like > > $ GIT_EDITOR=: git do-something > $ GIT_AUTHOR_NAME=foo GIT_AUTHOR_EMAIL=bar@baz git commit -a > > I do not necessarily see the environment variables as replacement > for configured defaults. They are, at least to me, more like a > single-shot override of the configured defaults, so if we were to > complain and error out command line options (we do do so, don't we?), > I would expect the environment variable that gives a single-shot > setting to be treated the same way.
Especially the second one is a good example though that works mostly as I propose: GIT_AUTHOR_NAME will impact _new_ commits, but not _existing_ ones when you for example `--amend` the commit. So this is somewhat equivalent to how both GIT_DEFAULT_REF_FORMAT and GIT_DEFAULT_HASH work with git-init(1), isn't it?
Patrick