From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=103.168.172.149 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795966979; b=O8yFb1HcrngD6Z5Q/OObHizb37DqQgsqbka9UzZY1ppyOy6ayR3XhDbISbRxlQeW/GQv ok4lWvA6kGltFkrzLKv5F9vDrm8oYNkRI2/6gL70iUXOHjCwwWLhZ/QBZqJZQuBfLYY4o 575nLRCa3W7u5oi5VDxCiCXhOF3GP9zEXi81AVH/rQEgjiduPSM+JJPKwycwapcJs24X3 1Ccvq0PbdTRZKUmfoSCqR8CiDAm78PmBO5bhGHctzF9QEHbT0fhgbnCsqWB58CWpOOh2/ SDpjofABb11w/HalOmnX7RxqzYwmI3pTuopkSY2FgM6wVLAs6U3HueN+qSDHdJQQ9ig== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795966979; h=DMARC-Filter:Received:Received:DKIM-Signature:DKIM-Signature: X-DKIM2-Info:DKIM2-Signature:X-DKIM2-Info:Message-Instance: X-ME-Sender:X-ME-Received:X-ME-Proxy-Cause:X-ME-Proxy:Feedback-ID: Received:From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: User-Agent:MIME-Version:Content-Type; bh=WnERynpG8zDfbr/jDes0L3R2PlSyY9vx19fyUbKuZKs=; b=mtRUfccx6K+ErGfsl0IwbRpPwhNdaeZy0vWT7tLAObuPJnVmS8nZ8w8prLwAClILZ97E gyJtXMZoQ2/4ZU/EBagmf84O81KUmY9hvGoiRT32inEguCFor0X6mZb+IPGeyfS4kT1HH KSwfNuOu+xAwi56ATFhhRA3kXrb0D1BRqHGf4v8F967Vn3k1+ezM6vLT0wt8VmxRJwHGa Hxn61FI/EUMzyA7G0UsCnP+/292mJD5KVvLPRU1I8hf/Eta70AevIRTTpUFZvfLVZINQ5 GgZAihBdMaXOAbtGBQOH5BDjZIKmgymn/P8zXiYtEADaHeO/hecNqTnfitaaUFDTihA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=pobox.com; spf=pass smtp.mailfrom=pobox.com; dkim=pass header.d=pobox.com header.i=@pobox.com header.a=rsa-sha256 header.s=fm2 header.b=l3wg4DwR; dkim=pass header.d=messagingengine.com header.i=@messagingengine.com header.a=rsa-sha256 header.s=fm3 header.b=eJzpGipx; arc=none smtp.remote-ip=103.168.172.149 Received: from fout-a6-smtp.messagingengine.com (fout-a6-smtp.messagingengine.com [103.168.172.149]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 37991606A31C for ; Sun, 29 Nov 2026 15:42:59 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 37991606A31C Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=pobox.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pobox.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=pobox.com header.i=@pobox.com header.a=rsa-sha256 header.s=fm2 header.b=l3wg4DwR; dkim=pass (2048-bit key, unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.a=rsa-sha256 header.s=fm3 header.b=eJzpGipx Received: from phl-compute-07.internal (phl-compute-07.internal [10.202.2.47]) by mailfout.phl.internal (Postfix) with ESMTP id 4876FEC08F2 for ; Sun, 29 Nov 2026 10:42:58 -0500 (EST) Received: from phl-frontend-01 ([10.202.2.160]) by phl-compute-07.internal (MEProxy); Sun, 29 Nov 2026 10:42:58 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pobox.com; h=cc :cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm2; t=1795966978; x=1796053378; bh=WnERynpG8z Dfbr/jDes0L3R2PlSyY9vx19fyUbKuZKs=; b=l3wg4DwR/UJf1VoU1hv4lLGVVw HutOeGVFiHPkQXe8GLO2qaKA3k1UPSQHAhd/hIAaTJvsjPuBjm1RBA0AEOYM27Nq Lyq9bfRDvE/jV8Gtlv0qm0Xqm3XjO31L1toNe0pzw4a/ogTaYvKV73CmqV7R1Gis ccDIsNWKPW5ZMeHWZEr6yv5EzcavznQwTVBagVsTW5OB6uyeUcUvUgC3fSIuqfA7 mQ6xYRcrO/P4Z7ONjKeZK4MdHQzWHMbp0bTw3ru/cpKpb007DeAVOkk6bPrk5yJN QvIbvuhP1WqjHttkTnby9mL/cHxmI4DCfy35AcvvuFLYUZoE0w7dQzYGwiug== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t= 1795966978; x=1796053378; bh=WnERynpG8zDfbr/jDes0L3R2PlSyY9vx19f yUbKuZKs=; b=eJzpGipxZBdoyCs6hj/FShsSCWFJdqO6Igmf3PnSFHuu1l7VEAe 0A+5vwMNbqeicfisD9cF6oIW/mKUD3xg/0YNQk69LlYHJJkeLAtSjnRxnVgIY2cJ e98KaNsqGoD0CbJB+kNfEFjfInpe4Dng2sS516JBO7JBMd5lDpuQN/+wezOsaVVd Zj+Y8M4Re3F7oRU9/lpbVwftWUCzXs9xB+e7k1qsWk3wKbIH7jwj+bISejcaW+7I gyVqVSMY/50oWQHk8xu8NbIb++Gs6VUnPE5IQ4vVBslOyQA2tZYVM0+z5U8oC6bp zKsT2dZB0u+ZiWC5eDvpcoSRYyoaV+HAGzQ== X-DKIM2-Info: draft=ietf-dkim-dkim2-spec-09; repo=github.com/dkim2wg/interop; date=2026-11-03; sw=lmtpprox; action=sign d=pobox.com a=rsa-sha256; DKIM2-Signature: i=1; m=1; t=1795966978; d=pobox.com; mf=PGdpdHN0ZXJAcG9ib3guY29tPg==; rt=PGdpdEB2Z2VyLmtlcm5lbC5vcmc+; s=fm2:rsa-sha256:OJf/jY8Z5M8Ww32bT7SSDMHrH5kzinJePnjGnzEf4gnEuUV FkMwjaI3/L/QjLZkEDvBGtb50vcZVlJ8pimbEY/s27Th7ylWzRv1Dzx8DxTKQ51/ tQtYrfw92h2Ca8yw4fSppgRVRl8niMaSLPtkpsy1sy+O/Rv07X3wxckieWf9Voaz tFZdsbyBAFRVrg7buQxtizDVbE6YFNCvPeyVZ2AevY/PtFKf02vrYxYMtlEeAf0B zDHl67ieJ0Bk/7hoyyKiRCyvPItFrdp3b83iY5tDgEjp5YmmX4ImJmUeQ0PJrusR GhH5TLYxCrjLsZqkAw9QV4WIDc94eWyFLw5fdZg==; X-DKIM2-Info: draft=ietf-dkim-dkim2-spec-09; repo=github.com/dkim2wg/interop; date=2026-11-03; sw=lmtpprox; action=mi-m=1; hc=12; hn=cc,content-type,date,feedback-id,from,in-reply-to,message-id, mime-version,references,subject,to,user-agent; Message-Instance: m=1; h=sha256:S9Cxle8lj1zdEVh5n5nh2dmb/7PnOZFzQ/rptzGFj6Y=:Bk7mbgdXcxgtPQUpiML9jU9wSErl+noItDOETZyKd9g=; X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: dmFkZTGPyMQyykZ1QGP4F+ZCH70H6c/vYdGQ7kIkGCnUlPkmlaDnJNwrQj3ndAfDho4lUX Hf6h1GZQmuqtM/pui/MF/vP5HzXKzV9pxxcK+S8MnOFSERY+sGIVHl/QApzERs4meLooSQ 7fdckO6dopeZYa4bNF+9+kWXKFfvWpIiHspaAigory1SwQFqHojdaBV66zgkpqd6lIfkki 2XxI6rZiPgFuikLm1pfWtJv4eFjKcNedtIgaxZVpENCoiMIl5OraYMV/p18M+WdZ3UyNkr mqgQibxQUi494Cuy6G/QD6q4IJyWUVgnTRH1vvTn3k+rZQAGJmiYcieDArYQecxs8GxaEJ P37mkelNruhWkQT0nOkSdIHAH8t7f91Ykam8rrkOVkMw7gb4yiycq9kTk+sxqnkC2vtTPz RtgHCrGOugup7GU445h76LCZzazgXZ8uoYNULHqxmggf6qETqgfOf4Yi0FGgiMkcitpM8n BNGjImgXF/blkXl7SkjA0tO2ZZhkidSH66Dr7NLNDzD2umXpG52ZvP6bDCLjM1yWGL0wrC 7QHcLZUh4bsKS8f6oZ5as77c5ZH3P21JbOpJ/2KPreIBW+/9rpR//Hf79kGmR7thX4/JcU ptX3U8T5myRGFQMYWAJ3ro41W+rJDxqpelYpEqfiUmmTnOjQ4UlXhBerkqvw X-ME-Proxy: Feedback-ID: if26b431b:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sun, 29 Nov 2026 10:42:57 -0500 (EST) From: Junio C Hamano To: "Alessio Attilio via GitGitGadget" Cc: git@vger.kernel.org, Alessio Attilio Subject: Re: [PATCH v4 3/3] status: report when submodule URLs are out of sync In-Reply-To: <619101d5e124115a43faf51c84655b7b99a431dd.1795884822.git.gitgitgadget@gmail.com> (Alessio Attilio via GitGitGadget's message of "Sat, 28 Nov 2026 16:53:42 +0000") References: <619101d5e124115a43faf51c84655b7b99a431dd.1795884822.git.gitgitgadget@gmail.com> Date: Sun, 29 Nov 2026 07:42:56 -0800 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) X-Mailing-List: git@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain "Alessio Attilio via GitGitGadget" writes: > diff --git a/builtin/commit.c b/builtin/commit.c > index 36e47e18ed..577b097aa0 100644 > --- a/builtin/commit.c > +++ b/builtin/commit.c > @@ -1636,6 +1636,7 @@ struct repository *repo UNUSED) > > s.ignore_submodule_arg = ignore_submodule_arg; > s.status_format = status_format; > + s.check_submodule_urls = 1; The hunk header unfortunately is hard to read but this is inside cmd_status(). Now whichever format wt_status_print() is triggered with, we will show the submodule changes but only when the top-level command is "git status". Good. > diff --git a/wt-status.c b/wt-status.c > ... > +static int submodule_has_custom_remote_url(struct repository *repo, > + const char *path, > + const char *gitmodules_url, > + const char *config_url) > +{ > + struct repository subrepo = { 0 }; > + const struct string_list *remote_urls = NULL; > + const char *remote; > + const char *remote_url; > + char *key, *up_path, *config_remote_url, *gitmodules_remote_url; > + int error_code, ret = 0; > + > + if (!is_submodule_populated_gently(path, &error_code)) > + return 0; > + > + if (repo_submodule_init(&subrepo, repo, path, > + null_oid(repo->hash_algo)) < 0) { > + repo_clear(&subrepo); > + return 0; > + } > + > + remote = repo_default_remote(&subrepo); > + > + key = xstrfmt("remote.%s.url", remote); > + if (!repo_config_get_value_multi(&subrepo, key, &remote_urls) && > + remote_urls->nr == 1 && > + (remote_url = remote_urls->items[0].string)) { The third condition being a non-NULL check of the value and not a comparison can easily become confusing. GNU toolchains seem to encourage putting such a "var = value" assignment that is also used for a non-NULL/0 check inside an extra pair of parentheses, which is the convention the above code also uses. Use of the _get_value_ variant and checking the NULL-ness of .string allows us to cope with a valueless truth "[remote "frotz"] url;" cleanly. > +static int submodule_has_custom_remote_url(struct repository *repo, > + const char *path, > + const char *gitmodules_url, > + const char *config_url) > +{ > + struct repository subrepo = { 0 }; > + const struct string_list *remote_urls = NULL; > + const char *remote; > + const char *remote_url; > + char *key, *up_path, *config_remote_url, *gitmodules_remote_url; > + int error_code, ret = 0; > + > + if (!is_submodule_populated_gently(path, &error_code)) > + return 0; > + > + if (repo_submodule_init(&subrepo, repo, path, > + null_oid(repo->hash_algo)) < 0) { > + repo_clear(&subrepo); > + return 0; > + } Do we see a small inconsistency with the repository-aware design from the previous patch here? This function takes 'repo' and passes it to repo_submodule_init() and resolve_submodule_url(), yet is_submodule_populated_gently() inspects "%s/.git" relative to the current working directory rather than the '.worktree' member of 'repo'. That may be harmless today because cmd_status() runs with NEED_WORK_TREE and repo == the_repository, so we are always at the worktree root. It might be worth a comment near the call to is_submodule_populated_gently() though. > +static void wt_status_check_submodule_urls(struct wt_status *s) > +{ > + int i; > + > + if (s->ignore_submodule_arg && > + !strcmp(s->ignore_submodule_arg, "all")) > + return; > + > + if (is_gitmodules_unmerged(s->repo->index)) > + return; > + > + for (i = 0; i < s->repo->index->cache_nr; i++) { > + struct cache_entry *ce = s->repo->index->cache[i]; Because cmd_status() sets '.command_requires_full_index' to 0, you need to be careful when iterating '.cache' directly like the above loop when sparse-index is in effect. In sparse-index.c, convert_to_sparse_rec() refuses to collapse any directory containing S_ISGITLINK entries, so I _think_ gitlinks remain visible even in a sparse index, but please double check. Overall, this iteration was a very pleasant read. Thanks for working on it.