diff options
author | Shawn O. Pearce <spearce@spearce.org> | 2010-07-20 07:52:35 -0700 |
---|---|---|
committer | Shawn O. Pearce <spearce@spearce.org> | 2010-07-20 07:52:35 -0700 |
commit | 395d2360582e2c11c9d4418f925860b5484d7a98 (patch) | |
tree | 6b23c500c8f13b0e3762a7d57a6dc7dec9514e65 /org.eclipse.jgit/src/org/eclipse/jgit/diff | |
parent | b518189b5c580e21c5f6d8a3b59e7f1538f0110e (diff) | |
download | jgit-395d2360582e2c11c9d4418f925860b5484d7a98.tar.gz jgit-395d2360582e2c11c9d4418f925860b5484d7a98.zip |
Fix NPE in RenameDetector
If we have two adds of the same object but no deletes the detector
threw an NPE because the entry that came back from the deleted map
was null (no matching objects). In this case we need to put the
adds all back onto the list of left over additions since they did
not match a delete.
Change-Id: Ie68fbe7426b4dc0cb571a08911c7adbffff755d5
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
CC: Jeffrey Schumacher" <jeffschu@google.com>
Diffstat (limited to 'org.eclipse.jgit/src/org/eclipse/jgit/diff')
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/diff/RenameDetector.java | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/diff/RenameDetector.java b/org.eclipse.jgit/src/org/eclipse/jgit/diff/RenameDetector.java index bc23940535..cf5615a1cb 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/diff/RenameDetector.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/diff/RenameDetector.java @@ -383,7 +383,7 @@ public class RenameDetector { } else { left.addAll(adds); } - } else { + } else if (o != null) { // We have many adds to many deletes: score all the adds against // all the deletes by path name, take the best matches, pair // them as renames, then call the rest copies @@ -432,6 +432,8 @@ public class RenameDetector { adds.set(addIdx, null); // Claim the destination was matched. pm.update(1); } + } else { + left.addAll(adds); } } added = left; |