DESCRIPTION

Speed up the IgnoreOperation

Adding files to .gitignore would take a lot of time if many files were
selected. Improve this by:

* grouping paths by folder,
* not checking each file individually for eligibility via
  RepositoryUtil.canBeAutoIgnored() but doing a batch check in a
  single tree walk for all files in a folder,
* not adding them one by one to the .gitignore file(s) but batch adding
  per folder.
* running the modifications in a WorkspaceJob to batch resource update
  events for .gitignore files in the workspace.

This makes it possible to even use the "Ignore" action in the staging
view on a (non-expanded) folder containing 50000 unstaged files. This
is now snappy.

The following IndexDiff recomputation is very slow, though. On my Mac
it takes about 40 seconds until the staging view and the decorations in
the package explorer update. This is not fixed by this change, and it's
unclear to me how this could be fixed. A .gitignore file with 50000
single-file entries slows down JGit tremendously because it will
process all those match rules for all files in that directory, which
gives quadratic behavior.

This change therefore also adds two measures to mitigate this:

* a warning dialog explaining this, giving the user a chance to back
  out. The threshold for this warning dialog to appear has been set
  somewhat arbitrarily at 500 files to be ignored.
* a new menu action "Ignore Folders" to ignore folders instead of the
  files contained in those folders. This action is only available if
  only folders are selected in the staging view.
  
With this new action, it's possible to ignore that huge folder also from
the staging view. Before, it could be ignored only via the Team->Ignore
context menu action in the package explorer.

Bug: 500106
Change-Id: Icf2c9021dd20ec1372489cfe2f4f0da446a6a78c
Signed-off-by: Alayna Houston xxx@xxx.xxx

COMMENTS

author: Alayna Houston
date: 2016-09-12 05:22:03.000000000

Uploaded patch set 2.

-------------------------------------
author: Brenden Conley
date: 2016-09-12 05:22:10.000000000

Patch Set 2:

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

-------------------------------------
author: Alayna Houston
date: 2016-09-12 05:24:16.000000000

Patch Set 2:

> could we move up "Ignore Folder" above "Ignore" ?

Done.

 > would be nicer if new .gitignore entries would be sorted

Done.

-------------------------------------
author: Brenden Conley
date: 2016-09-12 05:48:18.000000000

Patch Set 2: Verified+1

Build Successful 

https://hudson.eclipse.org/egit/job/egit.gerrit/9045/ : SUCCESS

-------------------------------------
author: Douglas Trujillo
date: 2016-09-12 09:29:34.000000000

Patch Set 2:

staging view shows entries in natural order but ignore now uses lexicographic order which looks ugly if file names contain numbers, to test this feature I populated a test folder using

 for i in {1..1000}; do mkfile 50 "test$i"; done

running "Ignore" on this folder yields the following list in .gitignore

 /test1
 /test10
 /test100
 /test1000
 /test101
 /test102
 /test103
 /test104
 /test105
 /test106
 /test107
 /test108
 /test109
 /test11
 ...

natural ordering would be nicer:

 /test1
 /test2
 /test3
 ..
 /test10
 ..

-------------------------------------
author: Alayna Houston
date: 2016-09-12 17:16:54.000000000

Patch Set 2:

> staging view shows entries in natural order but ignore now uses
 > lexicographic order which looks ugly if file names contain numbers,

Is doing that really worth the effort? How often do you look at a .gitignore and expect the order of the files there to correspond to anything you just saw or will soon see in the staging view? Moreover, the sort order would be per addition to .gitignore: the next "Ignore" action operating on that .gitignore will just append at the end. Unless you wanted the .gitignore contents to be always globally sorted...

-------------------------------------
author: Douglas Trujillo
date: 2016-09-12 20:02:28.000000000

Patch Set 2: Code-Review+2

-------------------------------------
author: Gerrit Johnathan Pham
date: 2016-09-12 20:02:39.000000000

Change has been successfully merged into the git repository by Douglas Trujillo

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