Fix exception due to duplicate keys in EditTransformer
As copies are treated as additions in the current version of JGit, having multiple PatchListEntries referring to the same file path didn't seem possible. However, when a file is renamed alongside those copies, JGit identifies the copies as such. The logic which transforms the edits from the parents' trees to the children's trees assumed that one edit was only mapped to a transformed edit. With the existence of copies, we need to map one edit to several ones instead. All in all, we compute the cross product of all possible combinations. When computing a real diff between two trees, not all of them would be present at the same time. As it seems difficult to figure out exactly which edits are 'necessary' to keep, we rather keep all of them for the moment and accept that we possibly waste some resources. Change-Id: I6d57fb6a49b8dea58aab9565ac41301c7365159f
This commit is contained in:
@@ -16,6 +16,7 @@ package com.google.gerrit.extensions.common;
|
||||
|
||||
import static com.google.common.truth.Truth.assertAbout;
|
||||
|
||||
import com.google.common.truth.ComparableSubject;
|
||||
import com.google.common.truth.FailureStrategy;
|
||||
import com.google.common.truth.IntegerSubject;
|
||||
import com.google.common.truth.Subject;
|
||||
@@ -51,4 +52,10 @@ public class FileInfoSubject extends Subject<FileInfoSubject, FileInfo> {
|
||||
FileInfo fileInfo = actual();
|
||||
return Truth.assertThat(fileInfo.linesDeleted).named("linesDeleted");
|
||||
}
|
||||
|
||||
public ComparableSubject<?, Character> status() {
|
||||
isNotNull();
|
||||
FileInfo fileInfo = actual();
|
||||
return Truth.assertThat(fileInfo.status).named("status");
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user