Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 336744

Summary: Eclipse Projects with certain Project names do not show Git decorations and can not be Added or Committed to repo
Product: [Technology] EGit Reporter: <h1055071>
Component: CoreAssignee: Philipp Thun <philipp.thun>
Status: RESOLVED FIXED QA Contact:
Severity: major    
Priority: P3 CC: awanthika, caniszczyk, manuel.doninger, mathias.kinzler, matthias.sohn, pwebster, robin.rosenberg, stefan.lay
Version: 0.11   
Target Milestone: 0.11-M2   
Hardware: PC   
OS: Windows 7   
Whiteboard:
Attachments:
Description Flags
Test Projects
none
Simpler Test Case none

Description CLA 2011-02-09 13:23:05 EST
EGit build: 0.11.0.201102081906

Steps to reproduce:

1. Create a folder C:\test

2. In Eclipse create three Java projects in that folder with project names "com.foo.project", "com.foo.project.old", and "com.foo.project.tests.old" in folders with the same folder names as the project names, thus:

C:\test
   |-----com.foo.project
   |-----com.foo.project.old
   |-----com.foo.project.tests.old

3. In Eclipse Project Explorer select all 3 projects and choose "Team->Share Project->Git"

4. In the wizard select all 3 projects and click "Create Repository" so that the .git repo is created in the "C:\test" folder.

5. Click "Finish".

In Package Explorer notice how only the project "com.foo.project" has git decorations. Also if you attempt to "Commit" any of these projects only files from the project "com.foo.project" show up in the Commit dialog.
Comment 1 CLA 2011-02-09 13:28:15 EST
Created attachment 188613 [details]
Test Projects

Here's the three test projects in a "test" folder zipped up.
Comment 2 CLA 2011-02-09 14:13:00 EST
Further testing shows that it doesn't matter about the project folder names being the same as the project names, as it's the project names that cause this problem. You can name the folders "f1", "f2" and "f3" if you like.
Comment 3 Chris Aniszczyk CLA 2011-02-09 14:20:58 EST
This isn't good.

However, we should still ship 0.11 with this issues.

Workarounds would be cloning via CLI and importing.
Comment 4 CLA 2011-02-09 15:02:51 EST
(In reply to comment #3)
> This isn't good.
> 
> However, we should still ship 0.11 with this issues.
> 
> Workarounds would be cloning via CLI and importing.

I tested this workaround, and the problem is still there, I'm afraid.
Comment 5 Manuel Doninger CLA 2011-02-09 16:27:49 EST
One workaround is, if you just select one project from that folder and create the repository. If you then select the other projects and share them, the repository created before is recognized and selected and the projects are correctly shared and decorated.
Comment 6 Manuel Doninger CLA 2011-02-09 16:29:21 EST
In my eyes this bug has nothing to do with the name of the projects but only with the fact, that we don't recognize a repository, that was created in the same "Share Project Wizard" session.
Comment 7 CLA 2011-02-09 16:53:18 EST
Further testing boils this down to an even simpler case of having only two
projects with names "com.foo.project.old" and "com.foo.project.tests.old"

C:\test
   |-----com.foo.project.old
   |-----com.foo.project.tests.old

Select both of these in Package Explorer and do steps 3-5 - no projects at all
have got decorations and no "Add" or "Commit" operations are available.

I am trying to find a pattern here and the simplest case I can find so far is:

2 projects in sibling folders sharing the same parent folder:

Project 1 name         Project 2 name         Result
----------------------------------------------------
c.f.p.o                c.f.p.t.o              NOT OK
a.b.c.d                a.b.c.e.d              OK

Strange.
Comment 8 CLA 2011-02-09 17:12:50 EST
OK, I've experimented with this all evening and discovered the simplest test case:

1. Create a folder C:\test\f1

2. Create a Java project in that folder with the project name of c.f.p.o

3. In Eclipse Project Explorer select this and choose "Team->Share
Project->Git"

4. In the wizard select the project and edit the repo path so that
the .git repo is created in the parent "C:\test" folder and click "Create Repository" 

Result - no decorations and cannot add or commit.
Comment 9 CLA 2011-02-09 17:15:16 EST
Created attachment 188631 [details]
Simpler Test Case

And here is the simpler test case attached.
Comment 10 CLA 2011-02-09 17:31:13 EST
Another simple test case:

Simply create a Java project called "c.f.p.o" (without the quote marks) anywhere you like and then share it and create the git repo in teh wizard in its own folder (default). Result is that there are no decorations in Project Explorer but at least this time you can do an "Add" followed by "Commit".

Now try it with a project called "a.b.c.d" (without the quote marks) and everything is fine.

So - a project called "c.f.p.o" vs. a project called "a.b.c.d". Strange.
Comment 11 Manuel Doninger CLA 2011-02-09 17:42:21 EST
Yes, i can confirm that. A project named "a.b.c.d" works perfect, a project named "c.f.p.o" shows the behaviour you described. Very strange. Maybe i have the time to debug that tomorrow evening.
Comment 12 CLA 2011-02-09 17:58:11 EST
Some more tests with project names:

Project name          Result
----------------------------
a.b.c.d               OK
c.f.p.q               OK
d.g.q.p               OK
m.n.o.p               OK
f.f.f.f               OK
c.f.p.o               NOT OK
w.x.y.z               NOT OK
c.d.r.o               NOT OK
Comment 13 CLA 2011-02-10 05:33:58 EST
I edited the title of this bug to make it accurate. It has nothing to do with Project name prefixes, only certain combinations of letters in a Project name.
Comment 14 Mathias Kinzler CLA 2011-02-11 04:26:25 EST
Hmmm. I debugged this and it seems this is simply working as designed: under Window > Preferences > Team > Ignored Resources, there is are entries telling Eclipse to ignore *.Z and *.o resources. If these are unticked, the projects are decorated fine.
Comment 15 CLA 2011-02-11 04:37:29 EST
(In reply to comment #14)
> Hmmm. I debugged this and it seems this is simply working as designed: under
> Window > Preferences > Team > Ignored Resources, there is are entries telling
> Eclipse to ignore *.Z and *.o resources. If these are unticked, the projects
> are decorated fine.

Not here. If I create a project called "com.dang.redkite.old" I don't see the decorators, if it's called "com.dang.redkite" I do.
Comment 16 Mathias Kinzler CLA 2011-02-11 04:42:12 EST
(In reply to comment #15)
> (In reply to comment #14)
> > Hmmm. I debugged this and it seems this is simply working as designed: under
> > Window > Preferences > Team > Ignored Resources, there is are entries telling
> > Eclipse to ignore *.Z and *.o resources. If these are unticked, the projects
> > are decorated fine.
> 
> Not here. If I create a project called "com.dang.redkite.old" I don't see the
> decorators, if it's called "com.dang.redkite" I do.

In this case, you have to untick the entry ".old" in the ignored resources preference page.
Comment 17 CLA 2011-02-11 04:43:22 EST
(In reply to comment #16)
> (In reply to comment #15)
> > (In reply to comment #14)
> > > Hmmm. I debugged this and it seems this is simply working as designed: under
> > > Window > Preferences > Team > Ignored Resources, there is are entries telling
> > > Eclipse to ignore *.Z and *.o resources. If these are unticked, the projects
> > > are decorated fine.
> > 
> > Not here. If I create a project called "com.dang.redkite.old" I don't see the
> > decorators, if it's called "com.dang.redkite" I do.
> 
> In this case, you have to untick the entry ".old" in the ignored resources
> preference page.

Dang! Yes...it could be the Preferences > Team > Ignored Resources that's cause all this.  I'll check this out now.
Comment 18 CLA 2011-02-11 04:51:03 EST
OK, it's as you say because these patterns are set to be ignored in Window > Preferences > Team > Ignored Resources.

But I think this is still problem to apply the ignored resources pattern to the project name. This doesn't happen if I share the project with CVS, for example. Surely the Ignored Resources pattern should only be applied to the child files of the Project?
Comment 19 CLA 2011-02-13 09:28:45 EST
(In reply to comment #18)
> OK, it's as you say because these patterns are set to be ignored in Window >
> Preferences > Team > Ignored Resources.
> 
> But I think this is still problem to apply the ignored resources pattern to the
> project name. This doesn't happen if I share the project with CVS, for example.
> Surely the Ignored Resources pattern should only be applied to the child files
> of the Project?

Would the developers consider it a bug/unwanted behaviour that the ignored resources pattern is applied to the project name?  This does not happen to the CVS Team provider.

Of course, the workaround is to disable the pattern in Window > Preferences > Team > Ignored Resources and add it to a .gitignore file where needed.
Comment 20 Robin Rosenberg CLA 2011-02-13 19:28:44 EST
(In reply to comment #19)
> Would the developers consider it a bug/unwanted behaviour that the ignored
> resources pattern is applied to the project name?  This does not happen to the
> CVS Team provider.
> 
> Of course, the workaround is to disable the pattern in Window > Preferences >
> Team > Ignored Resources and add it to a .gitignore file where needed.

Since the project are imported they are obviously not ignored. So, yes, it's a bug.
Comment 21 CLA 2011-02-13 19:33:02 EST
(In reply to comment #20)
> (In reply to comment #19)
> > Would the developers consider it a bug/unwanted behaviour that the ignored
> > resources pattern is applied to the project name?  This does not happen to the
> > CVS Team provider.
> > 
> > Of course, the workaround is to disable the pattern in Window > Preferences >
> > Team > Ignored Resources and add it to a .gitignore file where needed.
> 
> Since the project are imported they are obviously not ignored. So, yes, it's a
> bug.

OK, should I rename this bug to a more accurate title or open a new bug?
Comment 22 Robin Rosenberg CLA 2011-02-13 19:39:18 EST
(In reply to comment #21)
> OK, should I rename this bug to a more accurate title or open a new bug?

No, I think this is an example of a good bug report.

The only thing missing is a patch :)
Comment 23 Mathias Kinzler CLA 2011-02-14 10:11:20 EST
Fix proposed at

http://egit.eclipse.org/r/#change,2496
Comment 24 CLA 2011-02-14 10:16:35 EST
(In reply to comment #23)
> Fix proposed at
> 
> http://egit.eclipse.org/r/#change,2496

I looked at the code this morning and came up with exactly the same check:

if (!(resource instanceof IProject) && Team.isIgnoredHint(resource)) 
                       return;

Unfortunately, this only takes care of the Project node, the child resources still remain undecorated.
Comment 25 CLA 2011-02-14 11:07:20 EST
(In reply to comment #24)
> (In reply to comment #23)
> > Fix proposed at
> > 
> > http://egit.eclipse.org/r/#change,2496
> 
> I looked at the code this morning and came up with exactly the same check:
> 
> if (!(resource instanceof IProject) && Team.isIgnoredHint(resource)) 
>                        return;
> 
> Unfortunately, this only takes care of the Project node, the child resources
> still remain undecorated.

I think that check is part of the solution, though. This is the first time I looked at the EGit code but I also found some clues in DecoratableResourceAdapter. Then I got lost in the code...
Comment 26 Philipp Thun CLA 2011-04-04 05:01:31 EDT
Fix proposed: http://egit.eclipse.org/r/3001
Comment 27 Matthias Sohn CLA 2011-04-04 19:20:50 EDT
merged as 6da9779fb769ea50b59e88553ad3bbf604a7c499