diff options
author | Matthias Sohn <matthias.sohn@sap.com> | 2013-05-16 18:41:52 -0400 |
---|---|---|
committer | Gerrit Code Review @ Eclipse.org <gerrit@eclipse.org> | 2013-05-16 18:41:52 -0400 |
commit | 84ad4957c6a1479032ad24a216904f87f1e02f40 (patch) | |
tree | 2ea3525650efef8e4dab3d18e664930a1a3f0efa /org.eclipse.jgit | |
parent | e7fc19fc0c8099a7076d883798d3439403bdbb6e (diff) | |
parent | 92189b2df42e3eb9ba651b7f9d989ab556f49396 (diff) | |
download | jgit-84ad4957c6a1479032ad24a216904f87f1e02f40.tar.gz jgit-84ad4957c6a1479032ad24a216904f87f1e02f40.zip |
Merge "Fix DiffFormatter NPEs for DiffEntry without content change" into stable-3.0
Diffstat (limited to 'org.eclipse.jgit')
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/diff/DiffFormatter.java | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/diff/DiffFormatter.java b/org.eclipse.jgit/src/org/eclipse/jgit/diff/DiffFormatter.java index 11848e2c99..f660d6bbd9 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/diff/DiffFormatter.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/diff/DiffFormatter.java @@ -912,6 +912,11 @@ public class DiffFormatter { editList = new EditList(); type = PatchType.UNIFIED; + } else if (ent.getOldId() == null || ent.getNewId() == null) { + // Content not changed (e.g. only mode, pure rename) + editList = new EditList(); + type = PatchType.UNIFIED; + } else { assertHaveRepository(); @@ -1106,7 +1111,7 @@ public class DiffFormatter { o.write('\n'); } - if (!ent.getOldId().equals(ent.getNewId())) { + if (ent.getOldId() != null && !ent.getOldId().equals(ent.getNewId())) { formatIndexLine(o, ent); } } |