diff options
| author | Robin Stocker | 2010-07-25 12:22:32 +0000 |
|---|---|---|
| committer | Stefan Lay | 2010-07-28 15:22:04 +0000 |
| commit | 6a9379f45d2e5f563d6f0730a9fcd5e76c633641 (patch) | |
| tree | faedf484c1ae24739631578b6c1ca616b57a86a3 | |
| parent | 1cc6c07e67e2e07e00aa86cd05dc5ada12964ba2 (diff) | |
| download | egit-6a9379f45d2e5f563d6f0730a9fcd5e76c633641.tar.gz egit-6a9379f45d2e5f563d6f0730a9fcd5e76c633641.tar.xz egit-6a9379f45d2e5f563d6f0730a9fcd5e76c633641.zip | |
History: Enable showing diff for files of root commit
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.java | 12 |
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 d2014a4998..d643ee49c1 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); |
