DESCRIPTION

Make diff from staging view also work for files not in the workspace

* Make SelectionUtils.getRepository() keep going as long as all
  RepositorMappings are null, so that it does consider adapters.
  Previously, it returned null upon the first null mapping.
  (RepositoryMapping assumes paths to correspond to an accessible
  workspace IResource -- i.e., works only for files in open Eclipse
  projects.)
* Since RepositoryMapping.getMapping() only returns something for
  resources in open projects, give the LocalNonWorkspaceTypedElement
  the known repository directly. Also, StagingEntry must adapt to
  accessible resources only.
* Fix dirty state handling in GitCompareFileRevisionEditorInput.

This makes diffs from the staging view work even for files
that are in closed projects, or in no project at all (i.e., Eclipse
project removed from workspace, or a file in the git repo outside of
any project, such as a global .gitignore).

Bug: 481682
Change-Id: I84ca034f6f5c01eeeb889b1e898cb0dba6039b80
Signed-off-by: Alayna Houston xxx@xxx.xxx


COMMENTS

author: Jayvion Booth
date: 2015-11-14 21:18:13.000000000

Uploaded patch set 4.

-------------------------------------
author: Brenden Conley
date: 2015-11-14 21:21:56.000000000

Patch Set 4:

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

-------------------------------------
author: Jayvion Booth
date: 2015-11-14 21:24:04.000000000

Patch Set 4:

(2 comments)

Line:225, org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/selection/SelectionUtils.java -> I must confess I still trying to understand what is the desired outcome of this method and why shouldn't we use RepositoryCache in case we don't find a resource mapping.

Line:188, org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/synchronize/compare/LocalNonWorkspaceTypedElement.java -> Looking at the code here I wonder why do we do this at all? I mean, we should *always* use the else branch, because it will make sure the *dedicated* change event will be sent for a single path and not for the entire repository.

This is of course not caused by your change, but I wonder if we should better always use the "else" branch.

-------------------------------------
author: Brenden Conley
date: 2015-11-14 21:46:09.000000000

Patch Set 4: Code-Review-1

Build Unstable 

https://hudson.eclipse.org/egit/job/egit.gerrit/7801/ : UNSTABLE

-------------------------------------
author: Alayna Houston
date: 2015-11-14 23:27:11.000000000

Patch Set 4:

(2 comments)

Line:225, org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/selection/SelectionUtils.java -> I didn't mean to say we shouldn't use the RepositoryCache. I think it makes sense. I just didn't like the early exit, because the operation clearly tries to make sure that all items in the selection belong to the same repository. Your later change is good; like it very much.

Line:188, org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/synchronize/compare/LocalNonWorkspaceTypedElement.java -> I was wondering about that, too, but I wasn't bold enough to change that.

-------------------------------------
author: Gerrit Johnathan Pham
date: 2015-11-14 23:34:42.000000000

Change has been successfully merged into the git repository by Jayvion Booth

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