Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 359052 - EGit differs from CGit in handling of derived and ignored resources
Summary: EGit differs from CGit in handling of derived and ignored resources
Status: VERIFIED FIXED
Alias: None
Product: EGit
Classification: Technology
Component: UI (show other bugs)
Version: 1.1   Edit
Hardware: All All
: P3 major with 1 vote (vote)
Target Milestone: 2.1   Edit
Assignee: Matthias Sohn CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 330917
  Show dependency tree
 
Reported: 2011-09-27 09:04 EDT by Markus Keller CLA
Modified: 2012-10-08 10:06 EDT (History)
9 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Markus Keller CLA 2011-09-27 09:04:22 EDT
1.1.0.201109151100-r

EGit considers derived resources as if they were mentioned in .gitignore. This looks like a nice Eclipse integration on first sight, but it causes trouble when git is used on the command line (since derived resources are not ignored there).

The special handling for derived resources must be removed. The only help EGit could offer is to ask if it should add derived resources to the .gitignore when a project is added to a repository.

Looks like bug 341502 introduced this bug.
Comment 1 Markus Keller CLA 2012-01-12 12:35:08 EST
This is highly confusing.

I was working on a .gitignore file, and I really couldn't explain why an untracked xxx.log file didn't get a decoration (i.e. looked like ignored). It turned out that this is because GitLightweightDecorator#decorate(..) calls Team.isIgnoredHint(resource). That method excludes derived resources and those whose name matches a pattern from Preferences > Team > Ignored Resources.

Neither the derived bit nor the "Ignored Resources" list should be silently applied in EGit. As a first step, EGit should stop calling Team#isIgnoredHint(..).

As a later enhancement, you could use that method to automatically add untracked files to .gitignore.


This is not only about decorators. E.g. "Team > Add to Index" also doesn't work for such files, but adding them in the Git Staging view works fine.
Comment 2 Bernhard Buss CLA 2012-07-24 05:07:45 EDT
Please add a workspace preference setting whether derived sources should be ignored or not.

In our project we like the derived sources to be checked in and versioned as well.

It is inconvenient to always having to use the git console to add a derived source, because EGit is not capable of that.
Comment 3 Dani Megert CLA 2012-07-24 05:39:07 EDT
I second this request.
Comment 4 Markus Keller CLA 2012-07-24 08:48:26 EDT
> Please add a workspace preference setting whether derived sources should be
> ignored or not.

I don't think a preference is necessary. To fix this bug, EGit should just stop calling Team#isIgnoredHint(..).
Comment 5 Robin Stocker CLA 2012-07-24 09:20:45 EDT
Jens, could you please have a look at this?

The change to use Team.isIgnoredHint in GitLightweightDecorator was done in this commit:

http://git.eclipse.org/c/egit/egit.git/commit/?id=74510d09b9c5b18f4f7e273941d305d7f1ced95e

And the change in ContainerTreeIterator:

http://git.eclipse.org/c/egit/egit.git/commit/?id=df27ebc65d7eb50b3c8eae96155e58c865241b7e
Comment 6 Matthias Sohn CLA 2012-09-07 17:46:53 EDT
pushed fix for review
https://git.eclipse.org/r/#/c/7681
Comment 8 Robin Rosenberg CLA 2012-09-08 19:39:11 EDT
I don't think you should have done this without also fixing 297674.
Comment 9 Gunnar Wagenknecht CLA 2012-09-20 13:48:10 EDT
I'm confused.

Forever Eclipse CVS ignored resources in ".cvsignore" file as well as derived resources (eg. "bin" folders) even though any CVS command line client didn't know about derived resources. This rule has been followed in many other team integrations (eg. SVN and ClearCase).

The concept of "derived resources" is from Eclipse applied independent from the actual team provider's own concepts (such as .gitignore or .cvsignore). For example, the JDT compiler calls #setDerived to mark generated class files.

So why is this confusing for Git?
Comment 10 Markus Keller CLA 2012-09-20 14:08:09 EDT
> So why is this confusing for Git?

It was wrong from the beginning, and it sounds like other team providers just copied the wrong behavior of the Eclipse CVS client.

With the Eclipse CVS client, it was not even possible to use a command line CVS client to perform operations on an Eclipse project (because "extssh" was not a standard protocol). And AFAIK, nobody really wanted to use CVS from the command line.

In contrast, the EGit UI doesn't give you all the functionality of command line Git, so there's a much higher chance that people use both the command line and EGit.
Comment 11 Gunnar Wagenknecht CLA 2012-09-20 14:20:33 EDT
(In reply to comment #10)
> It was wrong from the beginning, and it sounds like other team providers
> just copied the wrong behavior of the Eclipse CVS client.

Sounds valid. Is this written down somewhere? Shouldn't this be documented in the Team APIs (eg., via @deprecated)?
Comment 12 Markus Keller CLA 2012-09-21 06:16:40 EDT
I think the "Hint" in org.eclipse.team.core.Team#isIgnoredHint(IResource) already tells that this is not a definitive answer. You could file a bug for Team to mention that this should not be silently applied, but that is should serve as a starting point for the team-provider specific ignore mechanism.

In EGit, that would be bug 297674.
Comment 13 Jens Baumgart CLA 2012-09-21 06:56:08 EDT
(In reply to comment #5)
> Jens, could you please have a look at this?
> 
> The change to use Team.isIgnoredHint in GitLightweightDecorator was done in
> this commit:
> 
> http://git.eclipse.org/c/egit/egit.git/commit/
> ?id=74510d09b9c5b18f4f7e273941d305d7f1ced95e
> 
> And the change in ContainerTreeIterator:
> 
> http://git.eclipse.org/c/egit/egit.git/commit/
> ?id=df27ebc65d7eb50b3c8eae96155e58c865241b7e

We introduced the ignore handling due to some user demand but I think it is the better solution not to consider Team ignore hints to be consistent with the command line.
Comment 14 Robin Rosenberg CLA 2012-09-21 07:38:57 EDT
EGit used Team.isIgnoredHint from the very first incarnation, long before there was .gitignore support.