From: 美纱Misha <mishanyo1001@gmail.com>
To: git@vger.kernel.org
Subject: Bug? of gitignore pattern matching
Date: Tue, 7 Jul 2020 20:19:23 +0800 [thread overview]
Message-ID: <CAMZHuz-Z2HGynUY0R5YDjkN1E12ZtD8h7OsZ9W6mawsxWQODgQ@mail.gmail.com> (raw)
In document of gitignore I found
An asterisk "*" matches anything except a slash.
This description well meets what if the asterisk is at the begging or
in the middle of the pattern.
```
~/Code/github/test on master! 20:01:11
$ git check-ignore -v data/a/b/1
~/Code/github/test on master! 20:01:18
$ git check-ignore -v data/a/b/2
.gitignore:2:data/**/2 data/a/b/2
~/Code/github/test on master! 20:01:19
$ git check-ignore -v data/a/b/3
.gitignore:3:data/***/3 data/a/b/3
~/Code/github/test on master! 20:01:20
$ cat .gitignore
data/*/1
data/**/2
data/***/3
~/Code/github/test on master! 20:01:21
$ vim .gitignore
~/Code/github/test on master! 20:01:46
$ git check-ignore -v a/b/3
.gitignore:3:***/3 a/b/3
~/Code/github/test on master! 20:01:51
$ git check-ignore -v a/b/2
.gitignore:2:**/2 a/b/2
~/Code/github/test on master! 20:01:53
$ git check-ignore -v a/b/1
~/Code/github/test on master! 20:01:54
$ cat .gitignore
*/1
**/2
***/3
```
```
~/Code/github/test on master! 20:00:13
$ git check-ignore -v data/1/a/b
.gitignore:1:data/1/* data/1/a/b
~/Code/github/test on master! 20:00:22
$ git check-ignore -v data/2/a/b
.gitignore:2:data/2/** data/2/a/b
~/Code/github/test on master! 20:00:25
$ git check-ignore -v data/3/a/b
.gitignore:3:data/3/*** data/3/a/b
~/Code/github/test on master! 20:00:26
$ cat .gitignore
data/1/*
data/2/**
data/3/***
```
But if this asterisk is at the end of the ignore pattern. Seems that
"*" equals to "**"
-----
And there is another question
Other consecutive asterisks are considered regular asterisks and will
match according to the previous rules.
And it seems that triple asterisks act like double ones. What do
regular asterisks mean, I used to believe they work as a single
asterisk before testing. Maybe there is some ambiguity?
Best,
Yanxiang Gao
reply other threads:[~2020-07-07 12:19 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAMZHuz-Z2HGynUY0R5YDjkN1E12ZtD8h7OsZ9W6mawsxWQODgQ@mail.gmail.com \
--to=mishanyo1001@gmail.com \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).