summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.pgm/src/org/eclipse/jgit
diff options
context:
space:
mode:
authorRobin Rosenberg <robin.rosenberg@dewire.com>2014-06-29 22:31:26 +0200
committerRobin Rosenberg <robin.rosenberg@dewire.com>2014-07-06 18:45:48 +0200
commit89ad10ec2768d9957b16ead55e1bfd94f81146d2 (patch)
tree1c52d6f853a5ba52351e56f603ada37ce3fb0025 /org.eclipse.jgit.pgm/src/org/eclipse/jgit
parent71c18201c1d438cc048060b61e4a1777ae9f9c1f (diff)
downloadjgit-89ad10ec2768d9957b16ead55e1bfd94f81146d2.tar.gz
jgit-89ad10ec2768d9957b16ead55e1bfd94f81146d2.zip
Handle diff formatting when there is nothing to compare with
DiffFormatter now suports either side being null and the log program will output the diff for the first commit. Bug: 395791 Change-Id: I378957b57e9ad1f7195ba416f402178453f0ebd3
Diffstat (limited to 'org.eclipse.jgit.pgm/src/org/eclipse/jgit')
-rw-r--r--org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Log.java5
1 files changed, 3 insertions, 2 deletions
diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Log.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Log.java
index ae0c954157..048526ee8a 100644
--- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Log.java
+++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Log.java
@@ -272,7 +272,7 @@ class Log extends RevWalkTextBuiltin {
if (showNotes(c))
outw.println();
- if (c.getParentCount() == 1 && (showNameAndStatusOnly || showPatch))
+ if (c.getParentCount() <= 1 && (showNameAndStatusOnly || showPatch))
showDiff(c);
outw.flush();
}
@@ -345,7 +345,8 @@ class Log extends RevWalkTextBuiltin {
}
private void showDiff(RevCommit c) throws IOException {
- final RevTree a = c.getParent(0).getTree();
+ final RevTree a = c.getParentCount() > 0 ? c.getParent(0).getTree()
+ : null;
final RevTree b = c.getTree();
if (showNameAndStatusOnly)