Re: [PATCH] builtin/commit.c: memoize git-path for COMMIT_EDITMSG
- From
Junio C Hamano <gitster@pobox.com>
- Date
- May 24, 2016, 22:25 UTC
- Message-ID
- <xmqqy46z2iwz.fsf@gitster.mtv.corp.google.com>
- In-Reply-To
- <vpq1t4rri2a.fsf@anie.imag.fr>
Matthieu Moy <Matthieu.Moy@grenoble-inp.fr> writes:
Show 5 quoted lines
>> More importantly, when is this function evaluated and returned value >> used to fill commit_editmsg_path[]? > > I may have missed something, but I'd say "never", as the code is not > compilable at least with my gcc:
It was a rhetorical question ;-) But "the more important part" was that initialization by calling non-trivial function is not a good idea even in C++ where it is allowed, as you said below.
> And indeed, this construct is a huge source of trouble, as it would mean > that git_path_commit_editmsg() is called 1) unconditionnally, and 2) > before entering main().
Indeed. Thanks.