git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
To: "Git ML" <git@vger.kernel.org>
Cc: Jonathan Tan <jonathantanmy@google.com>
Subject: BUG: Various "advice.*" config doesn't work
Date: Fri, 28 Jan 2022 10:33:29 +0100	[thread overview]
Message-ID: <220128.867dakcgj0.gmgdl@evledraar.gmail.com> (raw)

$subject, which I started looking at because in 4f3e57ef13d
(submodule--helper: advise on fatal alternate error, 2019-12-02) the
scaffolding was set up to read config, but nothing actually did so. So
"advice.submoduleAlternateErrorStrategyDie=false" has never worked. That
can be tested with:

diff --git a/t/t7408-submodule-reference.sh b/t/t7408-submodule-reference.sh
index a3892f494b6..8918be9ef5c 100755
--- a/t/t7408-submodule-reference.sh
+++ b/t/t7408-submodule-reference.sh
@@ -193,7 +193,7 @@ test_expect_success 'missing nested submodule alternate fails clone and submodul
 		cd supersuper-clone &&
 		check_that_two_of_three_alternates_are_used &&
 		# update of the submodule fails
-		test_must_fail git submodule update --init --recursive
+		git -c advice.submoduleAlternateErrorStrategyDie=false submodule update --init --recursive
 	)
 '
 
More generally, the advice API should be made to panic in
advice_if_enabled() if nothing has read the advice config, which would
turns up a lot of other such issues. I can't think of an easy way to
check for that. We could add a BUG() on:

    if (!the_repository->config && !the_repository->config->hash_initialized)

In advice_enabled(), but that wouldn't catch things that have read the
config, but which aren't actually using it to check the advice config.

Probably the inverse would be a good approach, adding a
advice.default=false to turn them all off by default, and then BUG() if
we ever end up emitting advice anywhere (except if other specific config
told us to enable it).

             reply	other threads:[~2022-01-28 10:15 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-28  9:33 Ævar Arnfjörð Bjarmason [this message]
2022-01-31 16:16 ` BUG: Various "advice.*" config doesn't work Taylor Blau
2022-01-31 17:28   ` Junio C Hamano
2022-01-31 17:34     ` Taylor Blau
2022-01-31 17:46       ` Junio C Hamano

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=220128.867dakcgj0.gmgdl@evledraar.gmail.com \
    --to=avarab@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=jonathantanmy@google.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).