Σταύρος Ντέντος <stdedos@xxxxxxxxx> writes: > git archive HEAD -o p.zip --prefix=p/ -- ':!(glob)**/.gitignore' > > Which lead to **both of the .gitignores** to be included. And then I > was baffled. > Now I know (I guess) that the pathspec magic was `:!`, and I tried to > match against a `(glob)**/.gitignore`, i.e. `(glob)*/.gitignore`, > which, of course, it doesn't exist in any form. You correctly guessed. The section on pathspec in "git help glossary" may need to be clarified so that ":!(exclude,glob)" is the right way to spell what you meant, I think. > And I wonder: > Why doesn't `git archive ... -- ` understand `:!.gitignore` as a > .gitignore file would do (minus the `:`)? At this point, asking "why" is fruitless. They are spelled differently, because pathspecs and .gitignore patterns are simply different. > Is there some reason that `git archive ... -- ` doesn't understand > `:!(glob)**/.gitignore`? It doesn't sound awfully complicated, or > risking a lot of regression (a folder starting with `(`, and > containing valid pathspec long forms IMHO is rare), It was probably OK back in 2006 when the number of users and projects that are using Git were smaller, but these days, whatever anybody would think "rare" are used by somebody and it would hurt many people (in absolute terms---they may be a tiny minority of the population) if you make a backward incompatible change that breaks these "rare" cases. > Is there some reason that `git archive ... -- ` doesn't warn me that > `:!(glob)**/.gitignore` is invalid (and maybe I meant > `(exclude,glob)`)? This one does have merit. Patches are very much welcomed. Thanks.