Fix SparseFileContent for delete-only patches
If an edit list is only deletion regions, the B side will wind up with an empty range as there is no new content to include in the file. This is a corner case that means we have to always return false from contains(int) when there is no content. Change-Id: I745fa9ce2071acc2aa83bd84909477afeef0c3d4 Signed-off-by: Shawn O. Pearce <sop@google.com>
This commit is contained in:
@@ -170,6 +170,10 @@ public class SparseFileContent {
|
|||||||
|
|
||||||
// Binary search for the range, since we know its a sorted list.
|
// Binary search for the range, since we know its a sorted list.
|
||||||
//
|
//
|
||||||
|
if (ranges.isEmpty()) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
int low = 0;
|
int low = 0;
|
||||||
do {
|
do {
|
||||||
final int mid = (low + high) / 2;
|
final int mid = (low + high) / 2;
|
||||||
|
Reference in New Issue
Block a user