DESCRIPTION

Don't let ignored resources cause index update jobs.

There are three different scenarios where ignored resources will now no
longer cause index update (or full re-index) jobs to run:

 1) change to .gitignore file - this caused a full re-index. This is
    extremely bad, as the Eclipse compiler copies .gitignore files from
    /src/ to /bin/ directories (and deletes them on clean). These deltas
    should be filtered out and never cause a full re-index.
    This means that EGit will no longer (automatically) recognize the 
    addition of a .gitignore file to an already ignored path and update
    the index. Manual full re-index is required in that case.
 2) change to a directory that lies within an ignored path - no longer
    triggers an update of the index. Also, resource delta investigation
    will stop for all sub-resources at this level.
 3) change to a file that lies within an ignored path - no longer
    triggers an update of the index.

Change-Id: Ic8ab3a93cb877a7a896c9bd88a878eb35c29d046
Signed-off-by: Bryanna Douglas xxx@xxx.xxx

COMMENTS

author: Bryanna Douglas
date: 2014-12-09 16:12:55.000000000

Uploaded patch set 1.

-------------------------------------
author: Brenden Conley
date: 2014-12-09 16:13:02.000000000

Patch Set 1:

Build Started https://hudson.eclipse.org/egit/job/egit.gerrit/6537/

-------------------------------------
author: Brenden Conley
date: 2014-12-09 16:17:28.000000000

Patch Set 1: Verified-1

Build Failed 

https://hudson.eclipse.org/egit/job/egit.gerrit/6537/ : FAILURE

-------------------------------------
author: Jayvion Booth
date: 2014-12-09 16:38:15.000000000

Patch Set 1:

Your eclipse setup should be fixed: you can tell eclipse builder not to copy .gitignore files to /bin.

Git can't know why a .gitignore file was added - and because .gitignore files *can* "undo" parent ignore rules, git has to re-index at least that part of the tree.

-------------------------------------
author: Jayvion Booth
date: 2014-12-09 17:32:00.000000000

Patch Set 1: Code-Review-1

(3 comments)

First of all I would propose to change your project setup.

If this will not help, create a bug describing the problem, and an example + test which reproduces the bad behavior and makes sure do not introduce a possible new regression.

Also see the comments on the patch below.

Line:96, org.eclipse.egit.core/src/org/eclipse/egit/core/internal/indexdiff/GitResourceDeltaVisitor.java -> The new folder could contain new .gitignore file somewhere, which *must* be included in the update. So returning "false" here is wrong - children of the new folder has to be visited!

Line:119, org.eclipse.egit.core/src/org/eclipse/egit/core/internal/indexdiff/GitResourceDeltaVisitor.java -> The assumption in the comment regarding the .gitignore file handling is wrong and is only true for the specific case of bad eclipse project setup where .gitignore files are located on the source path and copied to build path.
The problem is that .gitignore rules are hierarchical and rules in subfolders can invert rules in any parent folders.

For your concrete issue:
move .gitignore files from the source path to the project root or level higher OR add .settings/org.eclipse.jdt.core.prefs
file with this line: org.eclipse.jdt.core.builder.resourceCopyExclusionFilter=.gitignore
to prevent copying of .giignore files around.

Line:122, org.eclipse.egit.core/src/org/eclipse/egit/core/internal/indexdiff/GitResourceDeltaVisitor.java -> One can return here only if the file is NOT .gitignore.

-------------------------------------
author: Bryanna Douglas
date: 2014-12-10 08:12:28.000000000

Patch Set 1:

(3 comments)

First of all: thanks for the review :)

I did change our project setup now, and all the .gitignore related full-reloads are gone now.

Still, the rest of the code does improve the situation a lot (tried out without it once more).

I will work on an updated version :)

Line:96, org.eclipse.egit.core/src/org/eclipse/egit/core/internal/indexdiff/GitResourceDeltaVisitor.java -> OK. I will keep up the recursion to catch .gitignore files. I will still not add ignored folders here though, OK?

Line:119, org.eclipse.egit.core/src/org/eclipse/egit/core/internal/indexdiff/GitResourceDeltaVisitor.java -> OK, I will remove that one also, and only do the check on other files.

Line:122, org.eclipse.egit.core/src/org/eclipse/egit/core/internal/indexdiff/GitResourceDeltaVisitor.java -> I will move the check down to the case where only files are left, so this should not be a problem

-------------------------------------
author: Brenden Conley
date: 2014-12-10 21:27:00.000000000

Patch Set 1: -Verified

Build Started https://hudson.eclipse.org/egit/job/egit.gerrit/6544/

-------------------------------------
author: Brenden Conley
date: 2014-12-10 21:31:36.000000000

Patch Set 1: Verified-1

Build Failed 

https://hudson.eclipse.org/egit/job/egit.gerrit/6544/ : FAILURE

-------------------------------------
