summaryrefslogtreecommitdiffstatsabout
diff options
context:
space:
mode:
authorRobin Stocker2010-07-25 08:22:32 (EDT)
committer Stefan Lay2010-07-28 11:22:04 (EDT)
commit6a9379f45d2e5f563d6f0730a9fcd5e76c633641 (patch)
treefaedf484c1ae24739631578b6c1ca616b57a86a3
parent1cc6c07e67e2e07e00aa86cd05dc5ada12964ba2 (diff)
downloadegit-6a9379f45d2e5f563d6f0730a9fcd5e76c633641.zip
egit-6a9379f45d2e5f563d6f0730a9fcd5e76c633641.tar.gz
egit-6a9379f45d2e5f563d6f0730a9fcd5e76c633641.tar.bz2
History: Enable showing diff for files of root commitrefs/changes/75/1175/2
In the revision details of the history view, the paths can be double-clicked to show the diff. For the root commit, the diff of the added files can now be shown too (the base side is just empty). Change-Id: Ife24a73da514fdd53b2a255b76fab1301130b9e7
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/CommitFileDiffViewer.java12
1 files changed, 9 insertions, 3 deletions
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/CommitFileDiffViewer.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/CommitFileDiffViewer.java
index d2014a4..d643ee4 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/CommitFileDiffViewer.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/CommitFileDiffViewer.java
@@ -66,7 +66,7 @@ class CommitFileDiffViewer extends TableViewer {
return;
final IStructuredSelection iss = (IStructuredSelection) s;
final FileDiff d = (FileDiff) iss.getFirstElement();
- if (walker != null && d.blobs.length == 2)
+ if (walker != null && d.blobs.length <= 2)
showTwoWayFileDiff(d);
}
});
@@ -87,8 +87,14 @@ class CommitFileDiffViewer extends TableViewer {
final ITypedElement base;
final ITypedElement next;
- base = CompareUtils.getFileRevisionTypedElement(p, c.getParent(0), db, d.blobs[0]);
- next = CompareUtils.getFileRevisionTypedElement(p, c, db, d.blobs[1]);
+ if (d.blobs.length == 2) {
+ base = CompareUtils.getFileRevisionTypedElement(p, c.getParent(0), db, d.blobs[0]);
+ next = CompareUtils.getFileRevisionTypedElement(p, c, db, d.blobs[1]);
+ } else {
+ // Initial import
+ base = new GitCompareFileRevisionEditorInput.EmptyTypedElement(""); //$NON-NLS-1$
+ next = CompareUtils.getFileRevisionTypedElement(p, c, db, d.blobs[0]);
+ }
in = new GitCompareFileRevisionEditorInput(base, next, null);
CompareUI.openCompareEditor(in);