Make diff from staging view also work for files not in the workspace
commit25f9cbfb20416df65f36529714e9cdbad8124e77
authorThomas Wolf <thomas.wolf@paranor.ch>
Sun, 8 Nov 2015 23:00:38 +0000 (9 00:00 +0100)
committerAndrey Loskutov <loskutov@gmx.de>
Sat, 14 Nov 2015 22:28:08 +0000 (14 23:28 +0100)
tree79cedc723cb4cf0f7667567eccac3bf2b8382ebd
parentb6ff685c2405a0f322ac4c116d8b91af59ef68a1
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: Thomas Wolf <thomas.wolf@paranor.ch>
Signed-off-by: Andrey Loskutov <loskutov@gmx.de>
org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/CompareUtils.java
org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/revision/GitCompareFileRevisionEditorInput.java
org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/selection/SelectionUtils.java
org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/staging/StagingEntryAdapterFactory.java
org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/synchronize/action/GitOpenInCompareAction.java
org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/synchronize/compare/LocalNonWorkspaceTypedElement.java