This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 207700 - Incorrect display of ignored files (.gitignore)
Summary: Incorrect display of ignored files (.gitignore)
Status: RESOLVED DUPLICATE of bug 242551
Alias: None
Product: versioncontrol
Classification: Unclassified
Component: Git (show other bugs)
Version: 7.3
Hardware: All All
: P4 normal with 12 votes (vote)
Assignee: Ondrej Vrabec
URL: https://bugs.eclipse.org/bugs/show_bu...
Keywords:
: 208984 (view as bug list)
Depends on:
Blocks:
 
Reported: 2012-01-25 02:52 UTC by okonomiyaki3000
Modified: 2014-06-11 14:00 UTC (History)
6 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
unit test for netbeans (2.52 KB, patch)
2013-12-02 14:03 UTC, Ondrej Vrabec
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description okonomiyaki3000 2012-01-25 02:52:25 UTC
Let's say you have a line in your .gitignore file like this:
/logs/*
You intend to ignore all (uncommitted) contents of the 'logs' directory but not the directory itself. If 'logs' actually contains (uncommitted) files, there is no problem. Those files are shown grayed out (in the 'projects' pane, for example) and there are no apparent side-effects.

However, if 'logs' does not contain any (uncommitted) contents, the next sibling of 'logs' will be grayed out instead. So maybe my directory structure is something like this:
...
libs/
logs/
myimportantstuff/
...

Then 'myimportantstuff' will actually be grayed out, at least until logs contains (uncommitted) items. 

The workaround is, of course, to put some uncommitted dummy file in directories like this.
Comment 1 tombart 2012-01-26 09:40:09 UTC
All my files in src directory are being ignored and marked grey eventhough I completly removed .gitignore files. Just changes in working dir are now marked with green color. Command line git works as expected, I guess this behaviour is quite easy to reproduce.
Comment 2 Ondrej Vrabec 2012-04-02 13:18:27 UTC
*** Bug 208984 has been marked as a duplicate of this bug. ***
Comment 3 meisacoda 2012-07-26 09:58:59 UTC
Hmm...I  have another example, which seems to be an incorrect behaviour regarding .gitignore:

Assume a project we have:
foo/bar/_file.txt
foo/bar/file.txt

My .gitignore has this line:
foo/bar/[^_]*.txt

This should lead to git ignoring the file.txt, but not the _file.txt in foo/bar.

It works correctly on gitbash, but not in NB 7.2 on OS WIN.
Comment 4 okonomiyaki3000 2012-07-27 01:26:15 UTC
Seems like others have found a few bugs related to this issue (or maybe they are all just different manifestations of the same) so I just want to confirm that the original bug still exists in Netbeans 7.2. 

Again, it's easy to work around so I understand if fixing it is not a high priority.
Comment 5 polesz 2013-02-26 19:21:40 UTC
It seems that this bug still exists in 7.3
Comment 6 talesmetal 2013-03-26 19:01:04 UTC
Now I can reproduce the problem, what I do is edit nbproject/project.properties file changing the property dist.dir to target another directory, after that I run the action clean and build, then all my source and test files get the mark [I] indicating as Ignored files, and if I see my .gitignore file is empty, I really would like you can solve the problem whit this information, thank you
Comment 7 Ondrej Vrabec 2013-03-26 19:16:48 UTC
(In reply to comment #6)
> and if I see my .gitignore file is empty
Your .gitignore is empty? Then it's a different issue. This one is about incorrectly handling /folder/* records in the .gitignore file.
I suggest you file another issue and attach the content of your nbproject/project.properties
Comment 8 _ wadechandler 2013-06-19 01:33:32 UTC
This doesn't seem purely related to git. I'm using mercurial and seeing this exact same issue where things are grayed out for no valid reason. I rollover files in the IDE and part of the description says "Ignored" when that is incorrect. Any clue on this yet? What information do you need? Has an NB developer been able to replicate? I'm using 7.3.1; this was also happening in 7.3.
Comment 9 Ondrej Vrabec 2013-06-19 07:19:31 UTC
(In reply to comment #8)
> This doesn't seem purely related to git.
It is. Because it is the result of improperly parsed .gitignore file.
> I'm using mercurial and seeing this exact same issue where things are grayed out for no valid reason.
Then file an issue against Mercurial
> files in the IDE and part of the description says "Ignored" when that is
> incorrect.
It may be caused by your project setup - some folders are marked as ignore/private by your project (as build, dist folders etc.)
> What information do you need?
messages.log, screenshot of the projects view, content of .hgignore file, and a test project (at best) demonstrating the problem. I am not interested in source files. Because i assume you're talking about ignoring folders, pure folders structure would suffice.
> Has an NB developer been able to replicate?
Probably not.
Comment 10 paulo_ferraz_oliveira 2013-07-15 17:01:49 UTC
I've been using the git plugin (v1.8.2.1) on NetBeans (7.3) with success, but I came across a situation which seems to be related to the title of this issue.

I have a folder I want to ignore next a folder I don't want ignored, like so
    /parent/
    /parent/child1/ < I want to ignore this one
    /parent/child2/

I don't want to use a specific .gitignore rule, such as:
    /parent/child1/
but rather a generic rule like
    /parent/
    !/parent/child2/
    !/parent/child2/*
because the "sibling" folders are out of my control (they are client-specific) but due to architecture reasons must be kept there.

I am doing this as documented in https://www.kernel.org/pub/software/scm/git/docs/gitignore.html.

The problem is that using the current plugin version, in NetBeans 7.3, I'm unable to do this correctly. I am apparently using the correct syntax, as on the CLI git correctly identifies the files to commit (and the ones that were modified, etc.), but on the IDE I get nothing.

Basically it seems as though (these rules)
    !/parent/child2/
    !/parent/child2/*
aren't even being taken into account.

Is this a bug?
Is this intentional? What would be a workaround if the answer to this question is 'yes'?
Comment 11 AE56 2013-09-26 15:19:39 UTC
My project is under mercurial control, not git, but I seem to have the same issue, i.e. Netbeans incorrectly marks project files as ignored.
Comment 12 enzo4 2013-12-01 11:36:55 UTC
I'm also encountering this bug (I definitely think it comes from Netbeans)
I'm using Netbeans 7.4

Here is how to reproduce the bug:
Create a new dir XX and jump into it, and execute then those commands:

#..........................................
mkdir build
touch build/phpcs.xml
mkdir src
touch src/foo.php
mkdir vendor

echo '/build/*'         >  .gitignore
echo '!build/phpcs.xml' >> .gitignore
echo '/nbproject/'      >> .gitignore

git init
git add .
git commit -am "initial commit"
#..........................................


Then create a Netbeans PHP project with existing source, with this new dir XX as source path
Wait some seconds, and the "src" directory should be greyed

However, if I modify, in a console, the src/foo.php file, then `git status` tells me this file has changed (normal)

However NB will keep on greying src and also src/foo.php, it won't scan them for changes

As a result, git in console works as expected, but not Netbeans I guess

Further more, I've ended in only having those 2 lines in the .gitignore:
/build/*
/nbproject/

and the bug still occurs

As a conclusion, I don't think this bug comes from git whitelisting (!foo), but from the inclusion of /nbproject/ with another wildcard (like /build/*)

I hope NB developers will be able to reproduce now
Comment 13 Ondrej Vrabec 2013-12-02 14:03:08 UTC
Created attachment 142781 [details]
unit test for netbeans
Comment 14 Ondrej Vrabec 2013-12-02 14:06:51 UTC
this is a bug in JGit most likely, i cannot fix it and i cannot make any workaround. Looking at JGit's code it seems to me the line 201 should be preceded by matcher.reset() (http://git.eclipse.org/c/jgit/jgit.git/tree/org.eclipse.jgit/src/org/eclipse/jgit/ignore/IgnoreRule.java#n201), after that it starts working for me.
Comment 15 enzo4 2013-12-03 08:42:44 UTC
Nice for having found the root cause Ondrej,

Next step is to post an issue on:
http://www.eclipse.org/jgit/support/

You can do it Ondrej?
it would have more weight coming from a NB developer :)

Thanks
Comment 16 enzo4 2013-12-04 08:34:46 UTC
Thanks Ondrej for your bug report on JGit and diagnostic

Bug has been fixed very quickly!

Lastly, I guess you could mark this issue as resolved

Waiting for 7.4.1 now ;)

Good job
Comment 17 Ondrej Vrabec 2013-12-04 08:41:53 UTC
(In reply to enzo4 from comment #16)
> Lastly, I guess you could mark this issue as resolved
> Waiting for 7.4.1 now ;)
Unfortunately it's fixed in JGit's 3.2 release only and NetBeans bundles only 3.1. We'll need to upgrade soon.
Comment 18 okonomiyaki3000 2013-12-04 08:43:48 UTC
Can I unsubscribe from this list? At some point during the 2 years since I submitted this bug report, I have quit using Netbeans so I don't care about this issue at all.
Comment 19 enzo4 2013-12-04 08:45:00 UTC
Ok

and fmi, in which NB release do you schedule to upgrade to JGit 3.2 ?
Comment 20 psxlover 2013-12-05 19:14:43 UTC
I'm having the same problem.
In my .gitignore there is a line:
ompi
Which is there to ignore an executable. But Netbeans shows all the files in a folder named "ompi" as ignored even though they are tracked.
Comment 21 H0w4rd 2013-12-10 14:05:37 UTC
Same problem here - NetBeans 7.4 in Linux.
There is "csv" entry in my gitignore, but because there are some uncommited files in "csv" folder, the next alphabetical sibling "data" is being ignored when commiting in Netbeans, which is the most unpleasant, because I have to commit files in this folder manually and I'm still forgeting it.
Comment 22 Ondrej Vrabec 2013-12-19 12:40:49 UTC
JGit upgraded to 3.2.0 in NetBeans dev builds (and eventually 8.0 release) so it should fix most of the problems described here - at least those when .gitignore contains entries with wildcards and IDE then ignoring different folders/files. 
Other problems when users ignore a folder and yet keep files under such folders as versioned/committed and IDE ignores them => WONTFIX for performance reasons.
Comment 23 reinouts 2014-06-11 13:42:57 UTC
(In reply to Ondrej Vrabec from comment #22)
> JGit upgraded to 3.2.0 in NetBeans dev builds (and eventually 8.0 release)
> so it should fix most of the problems described here - at least those when
> .gitignore contains entries with wildcards and IDE then ignoring different
> folders/files. 

This is supposed to be fixed in 8.0? I'm still having the problem that **/target entries in .gitignore are, well, ignored...
Comment 24 Ondrej Vrabec 2014-06-11 14:00:28 UTC

*** This bug has been marked as a duplicate of bug 242551 ***