From: Usman Akinyemi <usmanakinyemi202@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org, christian.couder@gmail.com,
johncai86@gmail.com, me@ttaylorr.com, ps@pks.im,
shejialuo@gmail.com, Christian Couder <chriscool@tuxfamily.org>
Subject: Re: [PATCH v3 1/8] config: teach repo_config to allow `repo` to be NULL
Date: Fri, 7 Mar 2025 07:03:47 +0530 [thread overview]
Message-ID: <CAPSxiM8m7oeQ+DNPjzZzve4F510RYhWTfM-wsg5RabJ9fSF7Yg@mail.gmail.com> (raw)
In-Reply-To: <xmqqcyeuhwqb.fsf@gitster.g>
On Thu, Mar 6, 2025 at 11:23 PM Junio C Hamano <gitster@pobox.com> wrote:
>
> Usman Akinyemi <usmanakinyemi202@gmail.com> writes:
>
> > void repo_config(struct repository *repo, config_fn_t fn, void *data)
> > {
> > + if (!repo) {
> > + read_very_early_config(fn, data);
> > + return;
> > + }
> > git_config_check_init(repo);
> > configset_iter(repo->config, fn, data);
> > }
> > diff --git a/config.h b/config.h
> > index 5c730c4f89..1e5b22dfc4 100644
> > --- a/config.h
> > +++ b/config.h
> > @@ -219,6 +219,9 @@ void read_very_early_config(config_fn_t cb, void *data);
> > * repo-specific one; by overwriting, the higher-priority repo-specific
> > * value is left at the end).
> > *
> > + * In cases where the repository variable is NULL, repo_config() will
> > + * call read_early_config().
> > + *
>
> early or very early?
>
> I am wondering if we should describe the effect we want out of the
> design more prominently than the way we try to obtain the effect
> here. In other words, instead of (rather, in addition to) saying
> that we call helper X, wouldn't it be more helpful to future
> developers why we call X, to convey the intent, so that they know
> how to adjust when for example what X does change or X even
> disappears? E.g.,
>
> When repo==NULL, skip reading the per-repository
> configuration file but still use the system- and globa-
> configuration, by calling X. Note that this ignores
> one-time configuration override "git -c var=val" given from
> the command line. The only use case the feature to allow
> passing repo==NULL was designed for is to support handling
> "git foo -h" (which lets git.c:run_builtin() to pass NULL
> and have the cmd_foo() call repo_config() before calling
> parse_options() to notice "-h", give help and exit) for a
> command that ordinarily require a repository, so this
> limitation may be OK (but if needed you are welcome to fix
> it).
>
> That way, folks who are planning to update read_veriy_early_config()
> so that it pays attention to the "git -c var=val" in the future will
> be rest assured that they won't be breaking this caller with their
> planned change.
>
> Of course I didn't spend enough brainpower to make the above comment
> more concise and to the point, which the final version should be,
> but hopefully you got the idea.
Yeah, thanks Junio, I understand clearly. Your comment is well explained also.
I will refine it and add it in an updated patch.
Thank you.
>
> Thanks.
>
next prev parent reply other threads:[~2025-03-07 1:33 UTC|newest]
Thread overview: 63+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-14 22:57 [PATCH 0/7][Outreachy] stop using the_repository global variable Usman Akinyemi
2025-02-14 22:57 ` [PATCH 1/7] builtin/verify-tag: stop using `the_repository` Usman Akinyemi
2025-02-17 6:55 ` Patrick Steinhardt
2025-02-17 10:05 ` Usman Akinyemi
2025-02-17 10:22 ` Patrick Steinhardt
2025-02-17 10:42 ` Usman Akinyemi
2025-02-17 15:47 ` Patrick Steinhardt
2025-02-14 22:57 ` [PATCH 2/7] builtin/verify-commit.c: " Usman Akinyemi
2025-02-16 5:32 ` shejialuo
2025-02-17 8:55 ` Usman Akinyemi
2025-02-14 22:57 ` [PATCH 3/7] builtin/send-pack.c: " Usman Akinyemi
2025-02-14 22:57 ` [PATCH 4/7] builtin/pack-refs: " Usman Akinyemi
2025-02-14 22:57 ` [PATCH 5/7] builtin/ls-files: " Usman Akinyemi
2025-02-17 6:55 ` Patrick Steinhardt
2025-02-17 8:57 ` Usman Akinyemi
2025-02-14 22:57 ` [PATCH 6/7] builtin/for-each-ref: " Usman Akinyemi
2025-02-14 22:57 ` [PATCH 7/7] builtin/checkout-index.c: " Usman Akinyemi
2025-02-16 5:41 ` [PATCH 0/7][Outreachy] stop using the_repository global variable shejialuo
2025-02-17 8:56 ` Usman Akinyemi
2025-02-19 20:32 ` [PATCH v2 00/12][Outreachy] " Usman Akinyemi
2025-02-19 20:32 ` [PATCH v2 01/12] builtin/verify-tag: refactor `cmd_verify_tag()` Usman Akinyemi
2025-02-20 15:32 ` Junio C Hamano
2025-02-19 20:32 ` [PATCH v2 02/12] builtin/verify-tag: stop using `the_repository` Usman Akinyemi
2025-02-20 15:43 ` Junio C Hamano
2025-02-27 17:56 ` Usman Akinyemi
2025-02-27 22:39 ` Junio C Hamano
2025-02-19 20:32 ` [PATCH v2 03/12] builtin/verify-commit: refactor `cmd_verify_commit()` Usman Akinyemi
2025-02-19 20:32 ` [PATCH v2 04/12] builtin/verify-commit: stop using `the_repository` Usman Akinyemi
2025-02-19 20:32 ` [PATCH v2 05/12] builtin/send-pack: refactor `cmd_send_pack()` Usman Akinyemi
2025-02-19 20:32 ` [PATCH v2 06/12] builtin/send-pack: stop using `the_repository` Usman Akinyemi
2025-02-19 20:32 ` [PATCH v2 07/12] builtin/pack-refs: refactor `cmd_pack_refs()` Usman Akinyemi
2025-02-19 20:32 ` [PATCH v2 08/12] builtin/pack-refs: stop using `the_repository` Usman Akinyemi
2025-02-19 20:32 ` [PATCH v2 09/12] builtin/ls-files: " Usman Akinyemi
2025-02-19 20:32 ` [PATCH v2 10/12] builtin/for-each-ref: refactor `cmd_for_each_ref()` Usman Akinyemi
2025-02-19 20:32 ` [PATCH v2 11/12] builtin/for-each-ref: stop using `the_repository` Usman Akinyemi
2025-02-19 20:33 ` [PATCH v2 12/12] builtin/checkout-index: " Usman Akinyemi
2025-03-06 14:35 ` [Outreachy PATCH v3 0/8] stop using the_repository global variable Usman Akinyemi
2025-03-06 14:35 ` [PATCH v3 1/8] config: teach repo_config to allow `repo` to be NULL Usman Akinyemi
2025-03-06 17:53 ` Junio C Hamano
2025-03-07 1:33 ` Usman Akinyemi [this message]
2025-03-07 10:37 ` Phillip Wood
2025-03-06 14:35 ` [PATCH v3 2/8] builtin/verify-tag: stop using `the_repository` Usman Akinyemi
2025-03-06 17:56 ` Junio C Hamano
2025-03-06 14:35 ` [PATCH v3 3/8] builtin/verify-commit: " Usman Akinyemi
2025-03-06 14:35 ` [PATCH v3 4/8] builtin/send-pack: " Usman Akinyemi
2025-03-06 14:35 ` [PATCH v3 5/8] builtin/pack-refs: " Usman Akinyemi
2025-03-06 14:35 ` [PATCH v3 6/8] builtin/ls-files: " Usman Akinyemi
2025-03-06 17:59 ` Junio C Hamano
2025-03-06 14:35 ` [PATCH v3 7/8] builtin/for-each-ref: " Usman Akinyemi
2025-03-06 14:35 ` [PATCH v3 8/8] builtin/checkout-index: " Usman Akinyemi
2025-03-06 18:18 ` Junio C Hamano
2025-03-07 1:15 ` Usman Akinyemi
2025-03-07 14:15 ` Junio C Hamano
2025-03-07 19:41 ` Usman Akinyemi
2025-03-07 23:34 ` [Outreachy PATCH v4 0/8] stop using the_repository global variable Usman Akinyemi
2025-03-07 23:35 ` [PATCH v4 1/8] config: teach repo_config to allow `repo` to be NULL Usman Akinyemi
2025-03-07 23:35 ` [PATCH v4 2/8] builtin/verify-tag: stop using `the_repository` Usman Akinyemi
2025-03-07 23:35 ` [PATCH v4 3/8] builtin/verify-commit: " Usman Akinyemi
2025-03-07 23:35 ` [PATCH v4 4/8] builtin/send-pack: " Usman Akinyemi
2025-03-07 23:35 ` [PATCH v4 5/8] builtin/pack-refs: " Usman Akinyemi
2025-03-07 23:35 ` [PATCH v4 6/8] builtin/ls-files: " Usman Akinyemi
2025-03-07 23:35 ` [PATCH v4 7/8] builtin/for-each-ref: " Usman Akinyemi
2025-03-07 23:35 ` [PATCH v4 8/8] builtin/checkout-index: " Usman Akinyemi
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=CAPSxiM8m7oeQ+DNPjzZzve4F510RYhWTfM-wsg5RabJ9fSF7Yg@mail.gmail.com \
--to=usmanakinyemi202@gmail.com \
--cc=chriscool@tuxfamily.org \
--cc=christian.couder@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=johncai86@gmail.com \
--cc=me@ttaylorr.com \
--cc=ps@pks.im \
--cc=shejialuo@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).