Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug parsing .gitignore #37

Closed
suy opened this issue Jun 9, 2017 · 3 comments
Closed

Bug parsing .gitignore #37

suy opened this issue Jun 9, 2017 · 3 comments

Comments

@suy
Copy link

suy commented Jun 9, 2017

Hi! I'm not entirely sure, but I think I've experienced a bug parsing a git ignore file. I did (with 1.1):

$ cd /tmp/
$ git clone --depth 1 http://code.qt.io/git/qt/qtbase
Cloning into 'qtbase'...
remote: Counting objects: 22136, done.
remote: Compressing objects: 100% (16582/16582), done.
remote: Total 22136 (delta 5296), reused 16146 (delta 3446)
Receiving objects: 100% (22136/22136), 55.12 MiB | 2.70 MiB/s, done.
Resolving deltas: 100% (5296/5296), done.
$ cd qtbase/examples/
$ fd regular
widgets/doc/images/regularexpression-example.png
widgets/doc/src/regularexpression.qdoc
$ fd --no-ignore regular
widgets/tools/regularexpression
widgets/tools/regularexpression/regularexpressiondialog.h
widgets/tools/regularexpression/regularexpression.qrc
widgets/tools/regularexpression/regularexpression.pro
widgets/tools/regularexpression/regularexpressiondialog.cpp
widgets/doc/images/regularexpression-example.png
widgets/doc/src/regularexpression.qdoc

The .gitignore file of that repository may be a bit complex since, if I understand it properly, it uses a glob to add some files that later on are removed with a negative glob. I'm not entirely sure of the rules for it, but to me that is a bug in fd, since the files shown with --no-ignore are not ignored by git.

Thank you!

@BurntSushi
Copy link

Your .gitignore contains the rule examples/*/*/*, which in turn causes any and all directories like examples/widgets/tools/regularexpression to be ignored. Namely, they are never descended into.

@sharkdp
Copy link
Owner

sharkdp commented Jun 9, 2017

Yes, there is also no ! pattern that overwrites this, as far as I can see. Those files (like widgets/tools/regularexpression/regularexpressiondialog.cpp) are still there because they have been git add-ed explicitly, but the .gitignore pattern matches. If you add a file like widgets/tools/regularexpression/regularexpressiondialog2.cpp, it is captured by the .gitignore file:

> git check-ignore -v widgets/tools/regularexpression/*
.gitignore:4:examples/*/*/*	widgets/tools/regularexpression/regularexpressiondialog2.cpp

@suy
Copy link
Author

suy commented Jun 9, 2017

I see, I was testing this now, and it's true, that gitignore rule is not appropiate. I'll see if I can fix the rule.

Thank you (specially for the mindblowingly fast response), and sorry for the trouble.

@suy suy closed this as completed Jun 9, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants