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

Supporting `git add -a <exclude submodules>`

From
JWJoanna Wang <jojwang@chromium.org>
Date
Sep 28, 2023, 17:06 UTC
Message-ID
<CAL-HyEbxGqxid3vsvDk3Z0Gd3swbNP4qcXhApadu8ZgvRkr3WA@mail.gmail.com>

Hi, We're looking for feedback on the idea of adding git support for users to express `git add -a <exclude submodules>`.

We recently added submodules to our project. A lot of our users don't like that when their submodules are on commits that do not match what is pinned in the root superproject, running `git add -a` and `git commit -a` (which they are so used to), will now include those submodules that 99% of the time they do not want to include.

So we think supporting `git add -a <exclude submodules>` and `git commit -a <exclude submodules>` might be good to do. (We know `git -c diff.ignoreSubmodules=all commit -a` is an option, but this does not work for `git add`. However this support gets implemented for `git add`, I assume it's ideal for the UX of "don't include submodules" to be the same for both `git commit` and `git add`, though I don't think this is a requirement)

In a separate high-level conversation, Junio brought up going about
this with magic pathsepc.
So the work would entail:
- adding 'native' submodule attribute support, so `git add -a
':(exclude,attr:submodule)' can work without having to add 'submodule'
for every submodule path in .gitattributes
- add magic pathspec support to `git add`

(It looks like `git commit -a` does not work with pathspec. In this case I think that would be fine, we can just tell users they can set aliases for `git -c diff.ignoreSubmodules=all commit -a` and `git add -a ':(exclude,attr:submodule)' if they want)

Any thoughts from folks on all of the above? Thanks!

Next: Junio C Hamano
Message 1 of 4 in “Supporting `git add -a <exclude submodules>`”
  1. Joanna WangSep 28, 2023
  2. Junio C HamanoSep 28, 2023
  3. Junio C HamanoSep 28, 2023
  4. Junio C HamanoSep 28, 2023

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.