git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Taylor Blau <me@ttaylorr.com>
To: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
Cc: git@vger.kernel.org, Junio C Hamano <gitster@pobox.com>,
	Jeff King <peff@peff.net>
Subject: Re: [PATCH] config.c: remove unused git_config_key_is_valid()
Date: Wed, 29 Sep 2021 14:25:15 -0400	[thread overview]
Message-ID: <YVSvix9mY/jOz5K9@nand.local> (raw)
In-Reply-To: <patch-1.1-ba40601a511-20210928T125516Z-avarab@gmail.com>

On Tue, Sep 28, 2021 at 02:56:03PM +0200, Ævar Arnfjörð Bjarmason wrote:
> The git_config_key_is_valid() function got left behind in a
> refactoring in a9bcf6586d1 (alias: use the early config machinery to
> expand aliases, 2017-06-14),
>
> It previously had two users when it was added in 9e9de18f1ad (config:
> silence warnings for command names with invalid keys, 2015-08-24), and
> after 6a1e1bc0a15 (pager: use callbacks instead of configset,
> 2016-09-12) only one remained.
>
> By removing it we can get rid of the "quiet" branches in this
> function, as well as cases where "store_key" is NULL, for which there
> are no other users.

This was the part that I paid most attention to. The only caller which
passed "quiet == 1" was git_config_key_is_valid(), which is gone. So all
of those "if (!quiet)" conditionals can go away. And the remaining
callers all pass a non-null pointer to store_key, so those guard can go
away too.

> Out of the 5 callers of git_config_parse_key() only one needs to pass
> a non-NULL "size_t *baselen_", so we could remove the third parameter
> from the public interface. I did not find that potential
> simplification to be worthwhile.

But the guard for baselen being NULL needs to stay, and it does. I agree
with you (and Peff) that stopping here is fine.

Thanks,
Taylor

      parent reply	other threads:[~2021-09-29 18:25 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-28 12:56 [PATCH] config.c: remove unused git_config_key_is_valid() Ævar Arnfjörð Bjarmason
2021-09-28 18:03 ` Jeff King
2021-09-29 18:25 ` Taylor Blau [this message]

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=YVSvix9mY/jOz5K9@nand.local \
    --to=me@ttaylorr.com \
    --cc=avarab@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.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).