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

IDE (PhpStorm) does not recognize path started by dot in gitignore file #66

Closed
m00nk opened this issue Nov 27, 2014 · 2 comments
Closed

Comments

@m00nk
Copy link

m00nk commented Nov 27, 2014

If I use < somedir >/< file > in .gitignore, IDE ignores that file.
But if I use ./< file > format, IDE does not see that line.

image

@hsz
Copy link
Member

hsz commented Dec 1, 2014

@m00nk Thank you for your bug report, but git's ignore rules does not allow relative paths (for example you cannot ignore something in upper directory ../foo.txt).

Quick example:

cat .gitignore

*.iml
.idea
./foo.tex

git check-ignore -v *

.gitignore:1:*.iml  Hello.iml

After removing relative path ./:

cat .gitignore

*.iml
.idea
./foo.tex

git check-ignore -v *

.gitignore:4:foo.tex    foo.tex
.gitignore:1:*.iml  Hello.iml

As you can see - relative paths are not taken into account.

@hsz
Copy link
Member

hsz commented Dec 1, 2014

With the latest commit 233dc51 I've pushed a new inspection tool that marks relative entries and suggest to fix them.

As described above, relative paths are invalid for pure gitignore rules. Example of invalid entries and their quick fixes made by QuickFix tool (Just press Alt + Enter when you're in proper entry line).

foo/./bar      >    foo/bar
foo/../bar     >    bar
/../bar        >    bar
./foobar       >    foobar

It will be released with the next update soon.

@hsz hsz added the enhancement label Dec 1, 2014
@hsz hsz closed this as completed Dec 5, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants