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

Plugin is saying that I'm tracking ignored files but it's wrong #523

Closed
2 of 3 tasks
kevincam3 opened this issue Mar 7, 2018 · 7 comments
Closed
2 of 3 tasks

Plugin is saying that I'm tracking ignored files but it's wrong #523

kevincam3 opened this issue Mar 7, 2018 · 7 comments

Comments

@kevincam3
Copy link

Prerequisites

  • Plugin is in the latest version
  • Issue was not reported yet
  • Stack trace (if provided) contains mobi.hsz.idea.gitignore package name

Description

After I open a project the plugin presents a popup in the lower right corner that tells me "Ignored files found that are tracked" I click the "Show details" button to see the files and I notice that it's listing files that while they are listed in the .gitignore file they are being excluded from being ignored so they should not be counted as files that are being ignored in .gitignore

Stack trace if available.

Steps to Reproduce

Just logging in produces the pop up. I've proved a screenshot so you can see the problem

Expected behavior: What you expect to happen
To not display this popup message

Actual behavior: What actually happens
Displays this popup message

Reproduces how often: What percentage of the time does it reproduce?
100%

Versions

Plugin:
Version: 2.4.0

Can be found in Settings > Plugins > .ignore

IDE:
2017.3.4

Can be found in Help > About. Click on the copy icon on the left.

OS:
Windows 10 Pro

Information about operation system - type, version.

Additional Information

Any additional information, configuration or data that might be necessary to reproduce the issue.
image

@chaimleib
Copy link

I'm having the same issue on macOS.

Plugin: 2.6.1
IDE: 2018.1.2
OS: macOS 10.12.6

image

@chaimleib
Copy link

Maybe related: #513

@chaimleib
Copy link

I tried deleting .idea/ and launching IntelliJ again (as in #478), but that did not help.

@kevincam3
Copy link
Author

I think the line you have in your gitignore file "experiments/bin/gen/" ignores the whole folder so the line after it "!experiments/bin/gen/init_.py" doesn't do anything and that's why it's still being ignored.

I would suggest changing "experiments/bin/gen/" to "experiments/bin/gen/*" and that might fix the problem.

@mlsquires
Copy link

Same issue. Easy to repo:
mkdir out
touch out/ignored
touch out/.keep

create a .gitignore with the following content:
out/
!.keep

Git (correctly) shows that out/ignored is ignored and out/.keep is not ignored. The plugin appears to not process the "exclusion" operation ("!")

@jpickwell
Copy link

jpickwell commented May 16, 2018

I don't know when this may have changed, but the issue is caused by Git.

gitignore Pattern Format

An optional prefix "!" which negates the pattern; any matching file excluded by a previous pattern will become included again. It is not possible to re-include a file if a parent directory of that file is excluded. Git doesn’t list excluded directories for performance reasons, so any patterns on contained files have no effect, no matter where they are defined. Put a backslash ("") in front of the first "!" for patterns that begin with a literal "!", for example, "!important!.txt".

So the following doesn't work:

out/
# nope
!.keep
# also nope
!out/.keep

Running git status won't show out/ under "Untracked files:". If you try git add out/.keep you'll get this message:

The following paths are ignored by one of your .gitignore files:
out/.keep
Use -f if you really want to add them.

To correct this you have to stop excluding the directory, and only exclude the contents.

out/*
# works, but only for patterns like the above
!.keep
# works
!out/.keep

Running git status will now show out/ directory under "Untracked files:". Running git add out/.keep will succeed.

There's a small caveat to this though. If there are any files inside ignored subdirectories that you want to track, then you have to do a bit more:

/tmp/*
!/tmp/.keep

# to track a subdirectory, but ignore its contents (except for .keep)
# 1. include (unignore) the subdirectory
!/tmp/pids
# 2. exclude (ignore) the contents of the subdirectory
/tmp/pids/*
# 3. include (unignore) the .keep file; optional if there's a `!.keep` at the end of the .gitignore file
!/tmp/pids/.keep

@hsz
Copy link
Member

hsz commented May 7, 2019

This feature will be disabled with v3.1.0

@hsz hsz added this to the v3.1.0 milestone May 7, 2019
@hsz hsz closed this as completed May 13, 2019
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

5 participants