DESCRIPTION

Let staging view use submodule repos

If the staging view is linked to the selected resource and if that
resource belongs to a submodule then staging view should also run in
the context of the submodule repo. This allows to work with submodules
in a similar manner than with native git. If I want to do a commit in a
submodule repo then select a resource in that submodule repo and you can
use Staging view to prepare the commit in the submodule repo. In native
git you would "cd" to a folder containing a file from the submodule to
switch context from the containing repo to the submodule repo. In Egit
you have to select a resource from the submodule to achieve the same.

RepositoryMapping is enhanced by one method which can return a submodule
repository. In future RepositoryMapping could be further enhanced to 
support git submodules in general.

Bug: 382093
Bug: 446344
Change-Id: I6cbd5d5f4d0f57e93ce40a9dfb54e7b7c67e2e3a


COMMENTS

author: Carlie Harper
date: 2014-12-15 14:38:23.000000000

Uploaded patch set 3.

-------------------------------------
author: Brenden Conley
date: 2014-12-15 14:47:20.000000000

Patch Set 3:

Build Started https://hudson.eclipse.org/egit/job/egit-stable.gerrit/481/

-------------------------------------
author: Brenden Conley
date: 2014-12-15 15:00:23.000000000

Patch Set 3: Code-Review-1

Build Unstable 

https://hudson.eclipse.org/egit/job/egit-stable.gerrit/481/ : UNSTABLE

-------------------------------------
author: Zachary Orozco
date: 2014-12-15 15:41:07.000000000

Patch Set 3:

(2 comments)

Line:154, org.eclipse.egit.core/src/org/eclipse/egit/core/project/RepositoryMapping.java -> Are you thinking about multiple levels of submodules? If you have a workingtree
  
  /.git
  /.git/...
  /src
  /src/plugins
  /src/plugins/a
  /src/plugins/a/.git -> /.git/modules/plugins/a
  /src/plugins/a/src1
  /src/plugins/a/sub/
  /src/plugins/a/sub/.git -> /.git/modules/plugins/a/modules/sub
  /src/plugins/a/sub/src2


getRepositoryOrNestedSubmoduleRepository("/src/plugins/a/sub/src2") would return 
/.git/modules/plugins/a . We could leave this as feature request to a follow up commit - but we should document.

Line:166, org.eclipse.egit.core/src/org/eclipse/egit/core/project/RepositoryMapping.java -> We may run into trouble here because the caller of this method doesn't know whether a submodule repos is returned or not. In case this method has triggered the opening of a new repository the caller might want to close this repository after he has done his work. If this method returned "db" the caller maybe don't want to close this repo. I think the root problem is that this method hides whether it has opened a new repo or not. (That was of cause also a problem with my first proposal).
Solution could be to return only submodulerepositories or null. If null is returned the caller calls getRepository().

-------------------------------------
author: Carlie Harper
date: 2014-12-16 09:54:37.000000000

Patch Set 3: Code-Review-1

(1 comment)

Line:166, org.eclipse.egit.core/src/org/eclipse/egit/core/project/RepositoryMapping.java -> Yes, right. We even do not make use of EGit's Repository Cache here. When we only return submodulerepositories, we still should check how such instances are handled e.g. in the Git Repositories View.

The staging View e.g. doesn't close a repository. So if we created a submodule repository each time the selection is changed in eclipse we would get a lot of instances.

-------------------------------------
author: Douglas Trujillo
date: 2015-01-17 01:41:39.000000000

Patch Set 3:

(3 comments)

Line:154, org.eclipse.egit.core/src/org/eclipse/egit/core/project/RepositoryMapping.java -> added a TODO

Line:166, org.eclipse.egit.core/src/org/eclipse/egit/core/project/RepositoryMapping.java -> Done

Line:166, org.eclipse.egit.core/src/org/eclipse/egit/core/project/RepositoryMapping.java -> Done

-------------------------------------
author: Douglas Trujillo
date: 2015-01-17 01:45:56.000000000

Abandoned

moved to master as Ie61c597c87a68da16a92cd52fea0bc5a4ff5ec28

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