[zsh] How to test whether a glob has any matches?





I would like to do something, in essence, like this (zsh globs):

[[ -n .*~.git ]] && git add .*~.git

In words, the *intent* of the above is something like "if there
are in the current directory any dot-items (other than .git), then
add them to the git index."

Of course, the test above is basically nonsense; it certainly does
not do what is intended.

I thought that zsh offered a mechanism for performing this sort of
test, but I can't find it. Is my memory tricking me?

Thanks!

PS: One way to achieve the desired result would be something like

[[ -n $(echo .*~.git) ]] && git add .*~.git
.