GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — Fuzzy patching does not account for earlier changes in line count · Issue #237 · java-diff-utils/java-diff-utils Closed DescriptionapplyFuzzy(source, 0) can fail on the unchanged source after an earlier change reduces the line count: import com.github.difflib.DiffUtils; import com.github.difflib.patch.Patch; import java.util.Arrays; import java.util.List; public class Reproduce { public static void main(String[] args) throws Exception { List<String> source=Arrays.asList("a","b","c","d","e"); List<String> target=Arrays.asList("x","d","y"); Patch<String> patch=DiffUtils.diff(source,target); System.out.println(patch.getDeltas()); System.out.println("exact="+patch.applyTo(source)); System.out.println("fuzzy="+patch.applyFuzzy(source,0)); } } applyTo returns [x, d, y]. applyFuzzy throws IndexOutOfBoundsException with 4.17 and PatchFailedException with current master instead of returning the same result. An expanding earlier change can also cause a later delta to modify a newly inserted matching line. lastPatchDelta only records the found position; it needs to include the difference between the target and source chunk sizes as well. ActivityMetadataMetadataAssigneesLabelsNo labels TypeProjectsMilestoneRelationshipsDevelopmentIssue actions |
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |