Thread (5 messages) flat view 5 messages, 4 authors, 2021-06-03

Re: Request feature: –no-submodule

From: Jeff King <hidden>
Date: 2021-06-03 19:22:36

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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help