Title: Fuzzy patching does not account for earlier changes in line count · Issue #237 · java-diff-utils/java-diff-utils · GitHub
Open Graph Title: Fuzzy patching does not account for earlier changes in line count · Issue #237 · java-diff-utils/java-diff-utils
X Title: Fuzzy patching does not account for earlier changes in line count · Issue #237 · java-diff-utils/java-diff-utils
Description: applyFuzzy(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 cla...
Open Graph Description: applyFuzzy(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.A...
X Description: applyFuzzy(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.A...
Opengraph URL: https://github.com/java-diff-utils/java-diff-utils/issues/237
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Fuzzy patching does not account for earlier changes in line count","articleBody":"applyFuzzy(source, 0) can fail on the unchanged source after an earlier change reduces the line count:\n\n```java\nimport com.github.difflib.DiffUtils;\nimport com.github.difflib.patch.Patch;\nimport java.util.Arrays;\nimport java.util.List;\npublic class Reproduce {\n public static void main(String[] args) throws Exception {\n List\u003cString> source=Arrays.asList(\"a\",\"b\",\"c\",\"d\",\"e\");\n List\u003cString> target=Arrays.asList(\"x\",\"d\",\"y\");\n Patch\u003cString> patch=DiffUtils.diff(source,target);\n System.out.println(patch.getDeltas());\n System.out.println(\"exact=\"+patch.applyTo(source));\n System.out.println(\"fuzzy=\"+patch.applyFuzzy(source,0));\n }\n}\n```\n\napplyTo returns [x, d, y]. applyFuzzy throws IndexOutOfBoundsException with 4.17 and PatchFailedException with current master instead of returning the same result.\n\nAn 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.\n","author":{"url":"https://github.com/PHJ2000","@type":"Person","name":"PHJ2000"},"datePublished":"2026-10-05T07:52:45Z","url":"https://github.com/java-diff-utils/java-diff-utils/issues/237"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:0a35cf39-eece-f34c-5b44-ec07c19255d6 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | BC4C:3DCA81:2AF67:3BFBC:6AFBC35C |
| html-safe-nonce | 01a4bbda8fb0b2dbbce4b049c69263c721d470d8c3e1e7123ab5c8a1ed8b8ab0 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCQzRDOjNEQ0E4MToyQUY2NzozQkZCQzo2QUZCQzM1QyIsInZpc2l0b3JfaWQiOiI5OTA2Mzk1NjQ0NDE1MDI1NTYiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | ca8ebc6599702d84ea4eb1d340a6397b919afb2b941104dd4d70c022039ed7dc |
| hovercard-subject-tag | issue:5708406988 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/java-diff-utils/java-diff-utils/237/issue_layout |
| twitter:image | https://opengraph.githubassets.com/365472211c7802e7c27a1d09eb5b575aa83a650f280a8b55d0bdb493d94ae1f3/java-diff-utils/java-diff-utils/issues/237 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/365472211c7802e7c27a1d09eb5b575aa83a650f280a8b55d0bdb493d94ae1f3/java-diff-utils/java-diff-utils/issues/237 |
| og:image:alt | applyFuzzy(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.A... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | PHJ2000 |
| hostname | github.com |
| expected-hostname | github.com |
| None | d440bda0d812801778b27bfe9f7c1ce9ff22420c73f6f95150c4fcbca311c50b |
| turbo-cache-control | no-preview |
| go-import | github.com/java-diff-utils/java-diff-utils git https://github.com/java-diff-utils/java-diff-utils.git |
| octolytics-dimension-user_id | 40540835 |
| octolytics-dimension-user_login | java-diff-utils |
| octolytics-dimension-repository_id | 86663812 |
| octolytics-dimension-repository_nwo | java-diff-utils/java-diff-utils |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 86663812 |
| octolytics-dimension-repository_network_root_nwo | java-diff-utils/java-diff-utils |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 2c43021aed8695990c86c0eaaedc600bfeffec36 |
| ui-target | canary-1 |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width