From: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org, Jeff King <peff@peff.net>,
Max Gautier <max.gautier@redhat.com>
Subject: Re: [PATCH 0/2] gpg-interface: cleanup + convert low hanging fruit to configset API
Date: Fri, 10 Feb 2023 11:29:31 +0100 [thread overview]
Message-ID: <230210.86mt5lx0bq.gmgdl@evledraar.gmail.com> (raw)
In-Reply-To: <xmqqlel6mswo.fsf@gitster.g>
On Thu, Feb 09 2023, Junio C Hamano wrote:
> Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:
>
>> On Thu, Feb 09 2023, Jeff King wrote:
>>
>>> If the gpg code used git_config_get_string(), etc, then they could just
>>> access each key on demand (efficiently, from an internal hash table),
>>> which reduces the risk of "oops, we forgot to initialize the config
>>> here". It does probably mean restructuring the code a little, though
>>> (since you'd often have an accessor function to get "foo.bar" rather
>>> than assuming "foo.bar" was parsed into an enum already, etc). That may
>>> not be worth the effort (and risk of regression) to convert.
>>
>> I'd already played around with that a bit as part of reviewing Junio's
>> change, this goes on top of that.
>
> What's your intention of sending these?
For them to be picked up on top of your jc/gpg-lazy-init.
> I think we are already in
> agreement that the churn may not be worth the risk, so if these are
> "and here is the churn would look like, not for application", I
> would understand it and appreciate it. But did you mean that these
> patches are for application? I am not sure...
I understood your "I specifically did not want anybody to start doing
this line of analysis" in [1] to mean that you didn't want to have the
sort of change that the last paragraph of 2/2 notes that we're
deliberately not doing.
I.e. that we'd like to keep the gpg_interface_lazy_init() boilerplate,
even though we might carefully reason that a specific API entry point
won't need to initialize the file-scoped config variables right now.
I then took your "it is vastly preferred not to do such a change in this
step" in [2] as a note that it was deliberate that the change in 1/2
here wasn't part of your jc/gpg-lazy-init, but not that we shouldn't
follow-up with such a clean-up.
The "on top once the dust settled" in [2] can then be addressed by
graduating your jc/gpg-lazy-init soon, and keeping this in "seen" for a
bit, although I think the changes here (and in particular 1/2) are
trivial enough to graduate soon thereafter.
Given that I had mixed feelings about submitting this now, but Jeff's
[3] convinced me. I.e. the change in 2/2 'reduces the risk of "oops, we
forgot to initialize the config here"' in the future.
But obviously it's up to you whether you pick this up, and you don't
seem especially keen on doing so, so if not I guess we'll just drop
this, but I'd be happy if you did.
I do think that the 2/2 here has the added benefit of making your change
easier to review, and that's why I wrote it initially. I was poking at
your patch to see what behavior changes, logic errors or bugs I could
find in it.
I.e. your end state is that we're reading 7 config variables (I'm
counting the *.program ones as one variable). The 2/2 here brings that
down to just 3. Thus the surface area of potential issues where we don't
call gpg_interface_lazy_init() before accessing the values is reduced.
Which is also I why I opted to send this sooner than later, having that
as a review aid helps others now, and not in a few months.
1. https://lore.kernel.org/git/xmqq5ycbpp8a.fsf@gitster.g/
2. https://lore.kernel.org/git/xmqqpmaimvtd.fsf_-_@gitster.g/
3. https://lore.kernel.org/git/Y+TqEM21o+3TGx6D@coredump.intra.peff.net/
next prev parent reply other threads:[~2023-02-10 10:49 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <+TqEM21o+3TGx6D@coredump.intra.peff.net>
2023-02-09 14:35 ` [PATCH 0/2] gpg-interface: cleanup + convert low hanging fruit to configset API Ævar Arnfjörð Bjarmason
2023-02-09 14:35 ` [PATCH 1/2] {am,commit-tree,verify-{commit,tag}}: refactor away config wrapper Ævar Arnfjörð Bjarmason
2023-02-09 14:35 ` [PATCH 2/2] gpg-interface.c: lazily get GPG config variables on demand Ævar Arnfjörð Bjarmason
2023-02-09 21:27 ` [PATCH 0/2] gpg-interface: cleanup + convert low hanging fruit to configset API Junio C Hamano
2023-02-10 10:29 ` Ævar Arnfjörð Bjarmason [this message]
2023-02-10 19:02 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=230210.86mt5lx0bq.gmgdl@evledraar.gmail.com \
--to=avarab@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=max.gautier@redhat.com \
--cc=peff@peff.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).