From: Jeff King <peff@peff.net>
To: Duy Nguyen <pclouds@gmail.com>
Cc: Git Mailing List <git@vger.kernel.org>,
David Turner <dturner@twopensource.com>,
Michael Haggerty <mhagger@alum.mit.edu>
Subject: Re: [PATCH 03/10] lazily load core.sharedrepository
Date: Thu, 3 Mar 2016 13:23:44 -0500 [thread overview]
Message-ID: <20160303182343.GA24171@sigill.intra.peff.net> (raw)
In-Reply-To: <CACsJy8DM4sG5MztfQnZHpaj3NAveS9S4-qLtSCmLEWhFyfKwTw@mail.gmail.com>
On Thu, Mar 03, 2016 at 08:00:03PM +0700, Duy Nguyen wrote:
> On Tue, Mar 1, 2016 at 9:39 PM, Jeff King <peff@peff.net> wrote:
> > + if (need_shared_repository_from_config) {
> > + const char *var = "core.sharedrepository";
> > + const char *value;
> > + if (!git_config_get_value(var, &value))
> > + the_shared_repository = git_config_perm(var, value);
> > + need_shared_repository_from_config = 0;
> > + }
>
> If config cache is invalidated and reloaded by some crazy code (alias
> code, most likely, but I didn't check), we could be in trouble. Is
> there any clean way we could hook in git_config_clear() and reset
> need_shared.. back to 1 (or something of similar effect)? Or perhaps
> maintain a "clear counter", increased at every clear, and we keep a
> copy here, so we know if any more clear() has been called between
> get_shared..() calls.
Yeah, this caches forever. But I'm not sure that's really different from
the existing code, which sets it in check_repository_format_gently(),
which is only called during setup_git_directory(), which cannot be
called twice. So it was effectively static for the full program anyway
(modulo people tweaking the integer variable manually, which is
supported here).
I think something like the "clear counter" you describe is also not
quite sufficient. We have two sources for the variable: the config, and
manually setting it. Once it has been manually set, I think we don't
want to auto-read it from the config anymore (and stomp over what
somebody set). I'm not sure even git_config_clear() is enough of a
single to say "...and also reset everything that might have been set
from these config variables in the past". I think we'd want to do
per-variable invalidation, depending on what the caller wants.
So I'd rather punt on it for now, unless this is breaking a specific
case. I think it should behave the same as the status quo.
-Peff
next prev parent reply other threads:[~2016-03-03 18:23 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-01 14:35 [PATCH 0/10] cleaning up check_repository_format_gently Jeff King
2016-03-01 14:37 ` [PATCH 01/10] setup: document check_repository_format() Jeff King
2016-03-01 14:38 ` [PATCH 02/10] wrap shared_repository global in get/set accessors Jeff King
2016-03-01 14:39 ` [PATCH 03/10] lazily load core.sharedrepository Jeff King
2016-03-03 13:00 ` Duy Nguyen
2016-03-03 18:23 ` Jeff King [this message]
2016-03-01 14:40 ` [PATCH 04/10] check_repository_format_gently: stop using git_config_early Jeff King
2016-03-03 13:08 ` Duy Nguyen
2016-03-03 18:27 ` Jeff King
2016-03-01 14:40 ` [PATCH 05/10] config: drop git_config_early Jeff King
2016-03-01 14:42 ` [PATCH 06/10] setup: refactor repo format reading and verification Jeff King
2016-03-01 21:20 ` David Turner
2016-03-02 2:51 ` Jeff King
2016-03-03 13:19 ` Duy Nguyen
2016-03-03 18:28 ` Jeff King
2016-03-01 14:43 ` [PATCH 07/10] init: use setup.c's repo version verification Jeff King
2016-03-01 14:45 ` [PATCH 08/10] setup: unify repository version callbacks Jeff King
2016-03-01 14:45 ` [PATCH 09/10] setup: drop repository_format_version global Jeff King
2016-03-01 14:45 ` [PATCH 10/10] setup: drop GIT_REPO_VERSION constants Jeff King
2016-03-02 0:13 ` David Turner
2016-03-02 2:52 ` Jeff King
2016-03-02 0:42 ` [PATCH 0/10] cleaning up check_repository_format_gently David Turner
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=20160303182343.GA24171@sigill.intra.peff.net \
--to=peff@peff.net \
--cc=dturner@twopensource.com \
--cc=git@vger.kernel.org \
--cc=mhagger@alum.mit.edu \
--cc=pclouds@gmail.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;
as well as URLs for NNTP newsgroup(s).