DESCRIPTION

Fix recognition of submodules in folders.

Most of the basic plumbing for this was already in place, but it looks
as if the implementation was never really finished. For instance,
GitProjectData is prepared to record RepositoryMApping on container
level, not just for projects. The feature was just not used, and many
places in EGit make assumptions that imply that a project is fully
within one repository. This is a first commit to get rid of this
assumption, and to properly deal with submodules that exist only as
folders in the Eclipse workspace.

Augment the already existing resource change listener in GitProjectData
to also handle additions of DOT_GIT resources. In that way it'll pick
up submodules as they appear in the Eclipse resource tree.

RepositoryMapping.getMapping(IResource) must consider mappings
entered for folders below the project level. One mustn't jump directly
to project level; that will skip any submodules that might have been
applicable.

StagingView: no need anymore to use a submodule walk. The
RepositoryMapping for any resource will point to the correct
repository, even if it's a submodule. Not using a submodule walk also
avoids problem with the walk returning non-normalized git directory
paths that may contain ".." segments, while our RepositoryCache uses
normalized paths. This might lead to us having two versions of the
same repo in the cache, and listening for index diff changes on one
wouldn't trigger on the other.

GitResourceDeltaVisitor: must descend into folders even if the
repository doesn't match on project level. Otherwise submodules are not
updated.

For scheduling rule calculation, it is not sufficient to search for
projects in the repository's working directory. One also needs to
include projects containing the repository working directory.

Deprecated:
* RepositoryMapping.getSubmoduleRepository(IResource)

Also changed some uses of RepositoryMapping.getMapping(IProject) to
RepositoryMapping.getMapping(IResource). I'd like to have deprecated
the project variant, but this needs more careful analysis of the
remaining places its used.

Properly adding submodule mappings and considering them fixes at least
bug 446344, comment 11. Also related is bug 401556, though that was
reported for the behavior in the Repositories view, which isn't fixed by
this commit yet. However, a selection in the project explorer for a
folder belonging to a submodule showed the same erroneous behavior.

New tests added.

Bug: 446344
Bug: 401556
Change-Id: I4caa06113b5280114a7816f2c3932711b2fedf08
Signed-off-by: Alayna Houston xxx@xxx.xxx


COMMENTS

author: Douglas Trujillo
date: 2016-02-24 08:10:48.000000000

Uploaded patch set 4: Patch Set 3 was rebased.

-------------------------------------
author: Brenden Conley
date: 2016-02-24 08:10:54.000000000

Patch Set 4:

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

-------------------------------------
author: Alayna Houston
date: 2016-02-24 08:32:23.000000000

Patch Set 4:

> (4 comments)
 > 
 > this is a great improvement, thanks for working on this
 > 
 > decorators (e.g. in package explorer and dirty marker in
 > repositories view) don't get updated when modifying a class located
 > in a submodule, refreshing the staging view fixes that, looks like
 > some event goes unnoticed

Will have to double-check. This patch is actually something I had extracted from a whole series of commits that I have in work locally; perhaps I forgot to include something. I distinctly remember having had that issue, but also having fixed it. (I had not planned actually to go public with this so soon; but decided to do so because of https://bugs.eclipse.org/bugs/show_bug.cgi?id=446344#c15 . I wanted to give Andre a chance to see what I was up to... and since my local "submodule" branch seemed good enough, I took the risk.)

Follow-up commits will:
* decorate folders that are submodule working tree roots using the project decorations, so they show the repo & branch
* complete the enablement of action handlers (push & pull still only work on project level after this change)
* fix auto-sharing importing projects from submodules (use case: import existing project from the filesystem's working directory of a submodule diretly: auto-sharing currently won't recognize it)
* tie up a number of minor loose ends all around.
* I also plan to do something about other submodule bugs, such as 401556 or 405629.

BTW, you wouldn't have any idea what's up with the tests? They seems to fail willy-nilly in most unpredicatable ways all utterly unrelated to this change. I'm a bit at a loss as to what was going on.

-------------------------------------
author: Brenden Conley
date: 2016-02-24 08:36:28.000000000

Patch Set 4: Verified+1

Build Successful 

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

-------------------------------------
author: Douglas Trujillo
date: 2016-02-24 10:21:56.000000000

Patch Set 4:

> > (4 comments)
 > >
 > > this is a great improvement, thanks for working on this
 > >
 > > decorators (e.g. in package explorer and dirty marker in
 > > repositories view) don't get updated when modifying a class
 > located
 > > in a submodule, refreshing the staging view fixes that, looks
 > like
 > > some event goes unnoticed
 > 
 > Will have to double-check. This patch is actually something I had
 > extracted from a whole series of commits that I have in work
 > locally; perhaps I forgot to include something. I distinctly
 > remember having had that issue, but also having fixed it. (I had
 > not planned actually to go public with this so soon; but decided to
 > do so because of https://bugs.eclipse.org/bugs/show_bug.cgi?id=446344#c15
 > . I wanted to give Andre a chance to see what I was up to... and
 > since my local "submodule" branch seemed good enough, I took the
 > risk.)
 
With this change submodule support already feels a lot better than what we had so far
since submodules not having matching Eclipse projects at the level of the submodules weren't supported at all.

I tried this change with the gerrit repository which has 6 submodules for the core gerrit plugins.
So far I only played with editing files and checking if status/decorators are updated correctly
and if history view and staging view are always displaying the correct repo matching the current selection

The only disturbing problem I found so far was this refresh issue.

 > Follow-up commits will:
 > * decorate folders that are submodule working tree roots using the
 > project decorations, so they show the repo & branch
 > * complete the enablement of action handlers (push & pull still
 > only work on project level after this change)
 > * fix auto-sharing importing projects from submodules (use case:
 > import existing project from the filesystem's working directory of
 > a submodule diretly: auto-sharing currently won't recognize it)
 > * tie up a number of minor loose ends all around.
 > * I also plan to do something about other submodule bugs, such as
 > 401556 or 405629.
 
nice, looking forward to these fixes :-)

 > BTW, you wouldn't have any idea what's up with the tests? They
 > seems to fail willy-nilly in most unpredicatable ways all utterly
 > unrelated to this change. I'm a bit at a loss as to what was going
 > on.

no idea yet, one strangeness I observed is that the egit job fails a lot more frequently than the egit.gerrit job

-------------------------------------
author: Gerrit Johnathan Pham
date: 2016-02-25 23:41:39.000000000

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

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