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

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

From
AIAlexey Izbyshev <izbyshev@ispras.ru>
Date
Aug 20, 2021, 17:02 UTC
Message-ID
<1be1e064559578a190f32dddb8ad39a0@ispras.ru>
Hi,

I've been surprised to discover that "git commit -a" stages submodules that have been explicitly made inactive via "submodule.NAME.active=false" and/or hidden from status/diff via "submodule.NAME.ignore=all":

git init repo git -C repo commit --allow-empty -m "initial" git -C repo submodule add "$PWD"/repo git -C repo commit -m "add sm" git -C repo config submodule.repo.ignore all git -C repo config submodule.repo.active false git -C repo/repo pull

After executing the above commands, "git -C repo commit -a" will show "repo" in "Changes to be committed" list. I think this behavior is dangerous because it makes it easy to accidentally "update" the submodule commit in the main repo while committing other changes. Does this qualify as a bug?

Reproduced on 2.33 and 2.17.1. Does not reproduce on 2.7.4 (Ubuntu 16.04). This discussion[1] and this question[2] also indicate that "git commit -a" honored at least "ignore all" setting in older git.

Alexey

[1] https://public-inbox.org/git/CABxC_L92v=cV=+e_DNa0L6f21LB0BRP5duai2h_heGJN_PRoUQ@mail.gmail.com/#t [2] https://superuser.com/questions/1301581/get-git-commit-a-to-ignore-submodules

Next: Alexey Izbyshev
Message 1 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.