From: Jeff King <peff@peff.net>
To: Duy Nguyen <pclouds@gmail.com>
Cc: Matheus Tavares Bernardino <matheus.bernardino@usp.br>,
Git Mailing List <git@vger.kernel.org>,
Brandon Williams <bwilliams.eng@gmail.com>,
Denton Liu <liu.denton@gmail.com>,
Junio C Hamano <gitster@pobox.com>,
"brian m. carlson" <sandals@crustytoothpaste.net>
Subject: Re: [PATCH 1/2] config: allow config_with_options() to handle any repo
Date: Thu, 29 Aug 2019 10:00:13 -0400 [thread overview]
Message-ID: <20190829140013.GC1797@sigill.intra.peff.net> (raw)
In-Reply-To: <CACsJy8DpTxpejkOHCYPnt3saC-h-3Ez0TthAPnPvHHThaG64bQ@mail.gmail.com>
On Thu, Aug 29, 2019 at 04:31:34PM +0700, Duy Nguyen wrote:
> > If so, how could we get R there? I mean, we could pass it through this
> > chain, but the chain already passes a "struct config_options", which
> > carries the "commondir" and "git_dir" fields. So it would probably be
> > confusing to have them and an extra repository parameter (which also
> > has "commondir" and "git_dir"), right? Any ideas on how to better
> > approach this?
>
> I would change 'struct config_options' to carry 'struct repository'
> which also contains git_dir and other info inside. Though I have no
> idea how big that change would be (didn't check the code). Config code
> relies on plenty callbacks without "void *cb_data" so relying on
> global state is the only way in some cases.
I'm not sure about that, at least for this particular git_pathdup(). We
pass along the git_dir because we might not have a repository struct yet
(i.e., when reading config before repo discovery has happened).
So it might be that this case should actually be making a path out of
$git_dir/config.worktree (but I'm not 100% sure, as I don't know the ins
and outs of worktree config files).
I'm sure there are other gotchas in the config code, though, related to
things for which we _do_ need a repository. E.g., include_by_branch()
looks at the_repository, and should use a repository struct matching the
git_dir we're looking at (though it may be acceptable to bail during
early pre-repo-initialization config and just disallow branch includes,
which is what happens now).
-Peff
next prev parent reply other threads:[~2019-08-29 14:00 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-26 23:57 [PATCH 0/2] config: make config_with_options() handle any repo Matheus Tavares
2019-08-26 23:57 ` [PATCH 1/2] config: allow config_with_options() to " Matheus Tavares
2019-08-27 9:26 ` Duy Nguyen
2019-08-27 23:46 ` Matheus Tavares Bernardino
2019-08-29 4:24 ` Matheus Tavares Bernardino
2019-08-29 9:31 ` Duy Nguyen
2019-08-29 14:00 ` Jeff King [this message]
2019-08-29 16:44 ` Matheus Tavares Bernardino
2019-08-30 9:09 ` Duy Nguyen
2019-08-26 23:57 ` [PATCH 2/2] submodule: pass repo instead of adding to alternates list Matheus Tavares
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=20190829140013.GC1797@sigill.intra.peff.net \
--to=peff@peff.net \
--cc=bwilliams.eng@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=liu.denton@gmail.com \
--cc=matheus.bernardino@usp.br \
--cc=pclouds@gmail.com \
--cc=sandals@crustytoothpaste.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.
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).