git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [BUG] git commit -a doesn't ignore inactive/ignore-all submodules

From
AIAlexey Izbyshev <izbyshev@ispras.ru>
Date
Aug 24, 2021, 15:49 UTC
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 <bmwill@google.com>
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
Previous: Alexey Izbyshev
Message 2 of 2 in “[BUG] git commit -a doesn't ignore inactive/ignore-all submodules”
  1. Alexey IzbyshevAug 20, 2021
  2. Alexey IzbyshevAug 24, 2021

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.