From: Patrick Steinhardt <ps@pks.im>
To: Tian Yuchen <cat@malon.dev>
Cc: Junio C Hamano <gitster@pobox.com>, Git <git@vger.kernel.org>
Subject: Re: [Question] check_repository_format_gently() is not side-effect-free
Date: Fri, 20 Mar 2026 07:07:07 +0100 [thread overview]
Message-ID: <abzkC9uLwZz_nmgv@pks.im> (raw)
In-Reply-To: <00d622d4-cfb8-41ff-b2df-5fb58a492a75@malon.dev>
On Fri, Mar 20, 2026 at 08:24:09AM +0800, Tian Yuchen wrote:
> On 3/20/26 02:07, Junio C Hamano wrote:
> > The verb "check" does not imply side-effect-free. By checking, each
> > of these functions tries to achieve something, and the way the
> > result of their work is conveyed back to the caller may not
> > necessarily be only by their return values.
> >
> > The adverb "gently" in this codebase typically means "the variant
> > without gently signals problems by dying. Instead of dying, return
> > to the caller with error code, so that the caller can decide to
> > die".
>
> Ah, I see. I guess I took it too literally. Thank you for clarification!
>
> Setting the semantics aside, the problem remains: I still think the setup
> method here isn't quite right. It creates a bottleneck for eventually
> handling multiple repositories in the same process without data races.
>
> Do you think this is worth a patch?
Yes, I think that the whole of "setup.c" is something we will want to
refactor eventually so that it does not modify global state anymore. So
it's not only `check_repository_format_gently()`, but also lots of other
functionality in that file. The motivation is not only being able to set
up multiple repositories, but also making the code overall easier to
understand.
That being said, I'll give a small warning that it's probably
non-trivial to refactor this subystem :)
Thanks!
Patrick
next prev parent reply other threads:[~2026-03-20 6:07 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-19 17:45 [Question] check_repository_format_gently() is not side-effect-free Tian Yuchen
2026-03-19 18:07 ` Junio C Hamano
2026-03-20 0:24 ` Tian Yuchen
2026-03-20 6:07 ` Patrick Steinhardt [this message]
2026-03-20 15:56 ` Junio C Hamano
2026-03-20 16:26 ` Tian Yuchen
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=abzkC9uLwZz_nmgv@pks.im \
--to=ps@pks.im \
--cc=cat@malon.dev \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
/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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox