Pathspec does not accept / does not warn for specific pathspecs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello there,

as I was trying to use git-archive to ... well, archive some
artifacts. So I called:
git archive HEAD -o p.zip --prefix=p/

Then, I noticed that .gitignore files from the repo were packed (and a
couple of others, but we don't care about that right now).
I wanted to exclude all .gitignore files (there is `/.gitignore` and
`/resources/.gitignore`). So I did:
git archive HEAD -o p.zip --prefix=p/ -- ':!.gitignore'

I noticed that the second-level .gitignore file was still included. I
started thinking that this is not a .gitignore pathspec, but it
matches a literal file.
I don't know why at-the-time I accepted that, since, if I write
`.ignoreFile` at a `.gitignore`, it would exclude any `.ignoreFile` at
any level. So I did:
git archive HEAD -o p.zip --prefix=p/ -- ':!/.gitignore'

Which, as expected, did not change anything; and I followed up with:
git archive HEAD -o p.zip --prefix=p/ -- ':!**/.gitignore'

Then, I noticed some weird behavior. The second-level `.gitignore` was
getting ignored, but not the first one!
Someone at the chat indicated that, the `**` was _magically_
interpreted as `*`, which is obvious to me why it won't help. So, they
suggested:
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.

And I wonder:
Why doesn't `git archive ... -- ` understand `:!.gitignore` as a
.gitignore file would do (minus the `:`)?
Why doesn't `git archive ... -- ` understand `:!**/.gitignore` as a
.gitignore file would do (minus the `:`)?
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), or
Is there some reason that `git archive ... -- ` doesn't warn me that
`:!(glob)**/.gitignore` is invalid (and maybe I meant
`(exclude,glob)`)?

With regards,
Ntentos Stavros



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux