From: Thomas Bachem via GitGitGadget Date: Sat, 07 Nov 2026 08:42:38 GMT Subject: [PATCH 06/15] remote: handle NULL value for remote..tagOpt Message-ID: In-Reply-To: From: Thomas Bachem A remote..tagOpt without a value makes "git fetch", "git remote" and "git status" segfault: handle_config() passes the NULL value to strcmp(). Reject a missing value with config_error_nonbool(), as handle_config() already does for remote..url and remote..pushurl. Assisted-by: Claude Fable 5.1 Signed-off-by: Thomas Bachem --- remote.c | 2 ++ t/t5505-remote.sh | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/remote.c b/remote.c index 71170f36a9..024cfc547d 100644 --- a/remote.c +++ b/remote.c @@ -556,6 +556,8 @@ static int handle_config(const char *key, const char *value, else error(_("more than one uploadpack given, using the first")); } else if (!strcmp(subkey, "tagopt")) { + if (!value) + return config_error_nonbool(key); if (!strcmp(value, "--no-tags")) remote->fetch_tags = -1; else if (!strcmp(value, "--tags")) diff --git a/t/t5505-remote.sh b/t/t5505-remote.sh index 5fbfcb0848..bec2e51afa 100755 --- a/t/t5505-remote.sh +++ b/t/t5505-remote.sh @@ -90,6 +90,11 @@ test_expect_success 'remote information for the origin' ' ) ' +test_expect_success 'tagOpt needs a value' ' + test_must_fail git -C test -c remote.origin.tagOpt remote 2>err && + test_grep "missing value for .remote.origin.tagopt." err +' + test_expect_success 'add another remote' ' ( cd test && -- gitgitgadget