From: Alexey Izbyshev Date: Tue, 24 Aug 2021 15:49:46 GMT Subject: Re: [BUG] git commit -a doesn't ignore inactive/ignore-all submodules Message-ID: <128d535af65ec58af9a26b9d0e13de8e@ispras.ru> In-Reply-To: <1be1e064559578a190f32dddb8ad39a0@ispras.ru> On 2021-08-20 20:02, Alexey Izbyshev wrote: > Reproduced on 2.33 and 2.17.1. Does not reproduce on 2.7.4 (Ubuntu > 16.04). Bisected to: commit 5556808690ea245708fb80383be5c1afee2fb3eb Author: Brandon Williams Date: Tue Jul 25 14:39:16 2017 -0700 add, reset: ensure submodules can be added or reset Commit aee9c7d65 (Submodules: Add the new "ignore" config option for diff and status) introduced the ignore configuration option for submodules so that configured submodules could be omitted from the status and diff commands. Because this flag is respected in the diff machinery it has the unintended consequence of potentially prohibiting users from adding or resetting a submodule, even when a path to the submodule is explicitly given. Ensure that submodules can be added or set, even if they are configured to be ignored, by setting the `DIFF_OPT_OVERRIDE_SUBMODULE_CONFIG` diff flag. Was the change of "git commit -a" behavior intended? To be clear, I don't understand what problem this patch solves exactly. The commit message mentions issues with "adding or resetting a submodule", but with git 2.7.4 (older than this patch) I can explicitly "git add" and "git commit" a submodule which has "ignore = all" set without problems, though "git status" and "git commit -a" ignore it, as I would expect. I've also performed another test uncovering that "submodule.active" appears to have never been honored by "git commit -a" at all. Is this intended behavior? From my perspective, it's surprising that "git status" and "git commit -a" take inactive submodules into account. Given that "git help config" says that "submodule.active" is a "Boolean value indicating if the submodule is of interest to git commands", it would seem to me that "active = false" should beat everything else, making git behave as if submodule were not initialized. Is there a way to keep a submodule checked out but make "git commit -a" ignore it? Alexey