Merge branch 'stable-2.15'

* stable-2.15:
  Detect RawInput correctly
  Remove unnecessary 'algorithm' parameter of PatchListKey
  Remove some more false negatives for edits due to rebase
  Remove some false negatives for edits due to rebase

Change-Id: I1a95b209c2091d4993e7cc590f5177a877136be5
This commit is contained in:
Alice Kober-Sotzek
2018-04-04 10:13:45 +02:00
11 changed files with 223 additions and 66 deletions

View File

@@ -16,8 +16,10 @@ package com.google.gerrit.server.patch;
import com.google.auto.value.AutoValue;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
import com.google.gerrit.reviewdb.client.Project;
import java.util.List;
import java.util.Set;
import org.eclipse.jgit.diff.Edit;
import org.eclipse.jgit.lib.ObjectId;
@@ -27,17 +29,22 @@ public abstract class IntraLineDiffArgs {
Text aText,
Text bText,
List<Edit> edits,
Set<Edit> editsDueToRebase,
Project.NameKey project,
ObjectId commit,
String path) {
return new AutoValue_IntraLineDiffArgs(
aText, bText, deepCopyEdits(edits), project, commit, path);
aText, bText, deepCopyEdits(edits), deepCopyEdits(editsDueToRebase), project, commit, path);
}
private static ImmutableList<Edit> deepCopyEdits(List<Edit> edits) {
return edits.stream().map(IntraLineDiffArgs::copy).collect(ImmutableList.toImmutableList());
}
private static ImmutableSet<Edit> deepCopyEdits(Set<Edit> edits) {
return edits.stream().map(IntraLineDiffArgs::copy).collect(ImmutableSet.toImmutableSet());
}
private static Edit copy(Edit edit) {
return new Edit(edit.getBeginA(), edit.getEndA(), edit.getBeginB(), edit.getEndB());
}
@@ -48,6 +55,8 @@ public abstract class IntraLineDiffArgs {
public abstract ImmutableList<Edit> edits();
public abstract ImmutableSet<Edit> editsDueToRebase();
public abstract Project.NameKey project();
public abstract ObjectId commit();