Re: Request feature: –no-submodule
From: Junio C Hamano <hidden>
Date: 2021-06-03 21:54:13
Jeff King [off-list ref] writes:
It doesn't seem outrageous to me for Git to automatically populate "pseudo-attributes" that connect properties of paths to the attribute system.
Sounds sensible. The attribute assignment was designed to purely depend on paths and not contents, so it might be a bit awkwarad to implement, but it should be doable.
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 :) ).
The original request, as I understand the clarification posted
upthread, is not "submodules are uninteresting", but is "we want
regular files" (and we postprocess further the output), so such a
"mode" (pseudo-)attribute that is automatically populated would be a
better fit anyway. With the current system, they can already do:
git ls-files -s ':(exclude)*.png' ':(exclude)*.ico)' |
sed -n -e 's/^100[76][54][54] [0-9a-f]* 0 //p' |
xargs dos2unix
(cf. [ref])
and with such an auto-pseudo-attribute, presumably something along
this line would work, removing the need for the intermediate filter:
git ls-files \
':(attr:mode=100755)' ':(attr:mode=100644)' \
':(exclude)*.png' ':(exclude)*.ico' |
xargs dos2unix