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

Re: Request feature: –no-submodule

From
Jeff King <peff@peff.net>
Date
Jun 3, 2021, 19:22 UTC
Message-ID
<YLkr+kLdjmHyPjgl@coredump.intra.peff.net>
In-Reply-To
<xmqq7dja6e46.fsf@gitster.g>
On Fri, Jun 04, 2021 at 02:40:25AM +0900, Junio C Hamano wrote:
> Besides, you can iterate over the available submodules with "git
> submodule foreach" fairly mechanically, and maintaining the
> attribute per path shouldn't be all that hard, I would imagine.

It doesn't seem outrageous to me for Git to automatically populate "pseudo-attributes" that connect properties of paths to the attribute system. I.e., could we just act as if every path that is a gitlink has the "gitlink" attribute set to true, and let people do:

  git ls-files ':(attr:-gitlink)'

That uses the existing generic mechanism, so it supports complex situations, but it also makes the "easy" case of "just ignore submodules" easy, with no attribute maintenance.

I didn't look at the code, though, so I'm not sure how awkward it would be to implement (usually we decide on attributes only from looking at the attribute files, not the trees/index themselves, but I think most code asking about a path would be iterating a list of files in the first place, and could feed the mode information).

An alternative view is allowing a pathspec that asks about the mode:
  git ls-files ':(mode=160000)'
That also lets you ask about other things, like:
  git ls-files ':(mode=100755)'

but it is probably unnecessarily arcane (even I had to look up the correct mode for a gitlink just now :) ).

-Peff
Previous: Junio C HamanoNext: Junio C Hamano
Message 8 of 12 in “Request feature: –no-submodule”
  1. Ilias ApostolouJun 2, 2021
  2. Taylor BlauJun 2, 2021
  3. Junio C HamanoJun 3, 2021
  4. Taylor BlauJun 3, 2021
  5. Ilias ApostolouJun 3, 2021
  6. Junio C HamanoJun 3, 2021
  7. Junio C HamanoJun 3, 2021
  8. Jeff KingJun 3, 2021
  9. Junio C HamanoJun 3, 2021
  10. Jeff KingJun 4, 2021
  11. Junio C HamanoJun 4, 2021
  12. Ilias ApostolouJun 5, 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.