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

Git excludes fails to avoid git submodule warning

From
KKlaatu <klaatu@member.fsf.org>
Date
Mar 24, 2019, 18:15 UTC
Message-ID
<5352115.zUM9HkL6VV@beast>
Working with Git 2.21.0 on Linux:
The git-add(1) man page says:

"The optional configuration variable core.excludesFile indicates a path to a file containing patterns of file names to exclude from git-add"

But if I do this:
$ echo "docs/themes/*/.git >> .gitexcludes
$ git config core.excludeFiles .gitexcludes
$ git add docs
 warning: adding embedded git repository: docs/themes/foo
It seems to me that this goes against what the git-add(1) man page says.

A workaround I found on stackoverflow is to add any file within the target directory:

$ git add docs/themes/foo/README
And then add everything:
$ git add docs

In which case the contents of .gitexcludes is honoured. But that seems like a hack.

Am I experiencing the intended result of Git's exclude function? If so, I'll happily submit a patch to the man page to clarify this behaviour. If not, I guess I'm submitting a bug report here.

Thanks for all the amazing work.
Cheers.
 
Next: Duy Nguyen
Message 1 of 2 in “Git excludes fails to avoid git submodule warning”
  1. KlaatuMar 24, 2019
  2. Duy NguyenMar 24, 2019

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.