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

Masking or hiding directories and files during a git submodule checkout

From
PWPeter Waller <p@pwaller.net>
Date
Apr 1, 2016, 11:56 UTC
Message-ID
<56FE61FE.2020700@pwaller.net>
Hi All,
My constraints are as follows:
* I use submodules to reference other people's code.
* I don't like to have to send commits to those authors of those 
submodules, they might not be accepted.
* I don't want to maintain my own fork of the submodule.
* Some submodules may contain lots of stuff I don't want to check out.
* I want other people (and existing tooling, such as `go get`) to be 
able to do an ordinary git clone --recursive and not get specific 
directories within some submodules checked not.
In my specific use case, I have:

/myfile /submodule1/directory/nestedsubmodule2

That is, submodule1 itself uses submodules and contains a directory with nestedsubmodule2.

What I would like to achieve is to be able to specify in my repository configuration that I don't want anything living in /submodule1/directory/ to be checked out. But I want to check out everything else as normal.

Ideally, this would happen automatically during a git clone --recursive, probably by being specified somewhere such as .gitattributes. I envisage it this way so that it would work automatically with existing tooling.

* Is this possible now via any means?
* Is this against some fundamental philosophy?
* Is it conceivable that patches would be accepted to make this happen?
Thanks,
- Peter

For further information, this is a follow on from a mega-thread about vendoring packages in go [*]. I'm seeking a minimal solution where little additional tooling is required, and this is just one avenue I'm pursuing. One such solution (considered in this email) could be to avoid checking out specific directories which live in submodules. Of course if it requires changes to git, I'd have to wait for it to update before I can use that feature, but I'm OK with that, so long as we have a solution which works eventually.

[*] https://groups.google.com/d/topic/golang-nuts/AnMr9NL6dtc/discussion
Message 1 of 1 in “Masking or hiding directories and files during a git submodule checkout”
  1. Peter WallerApr 1, 2016

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.