{"action":"created","issue":{"url":"https://api.github.com/repos/kpdecker/jsdiff/issues/84","labels_url":"https://api.github.com/repos/kpdecker/jsdiff/issues/84/labels{/name}","comments_url":"https://api.github.com/repos/kpdecker/jsdiff/issues/84/comments","events_url":"https://api.github.com/repos/kpdecker/jsdiff/issues/84/events","html_url":"https://github.com/kpdecker/jsdiff/issues/84","id":111589952,"number":84,"title":"applyPatches don't use offsets","user":{"login":"piranna","id":532414,"avatar_url":"https://avatars.githubusercontent.com/u/532414?v=3","gravatar_id":"","url":"https://api.github.com/users/piranna","html_url":"https://github.com/piranna","followers_url":"https://api.github.com/users/piranna/followers","following_url":"https://api.github.com/users/piranna/following{/other_user}","gists_url":"https://api.github.com/users/piranna/gists{/gist_id}","starred_url":"https://api.github.com/users/piranna/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/piranna/subscriptions","organizations_url":"https://api.github.com/users/piranna/orgs","repos_url":"https://api.github.com/users/piranna/repos","events_url":"https://api.github.com/users/piranna/events{/privacy}","received_events_url":"https://api.github.com/users/piranna/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-10-15T10:39:45Z","updated_at":"2015-11-04T13:21:47Z","closed_at":"2015-11-04T13:21:47Z","body":"(Related to https://github.com/kpdecker/jsdiff/issues/82)\r\n\r\nWhile processing https://raw.githubusercontent.com/GregorR/musl-cross/master/patches/gcc-4.7.3-musl.diff with my [pull-request](https://github.com/kpdecker/jsdiff/pull/83) I get some index that couldn't be applied, getting `patched()` callback content equals to `false`. After processing the same file with `patch --verbose -Np1`, it show that this entries are correctly applied but with an offset:\r\n\r\n```\r\nHmm...  Looks like a unified diff to me...\r\nThe text leading up to this was:\r\n--------------------------\r\n|# HG changeset patch\r\n|# Parent f50bb54f331f73405131a30b4f353cfda1c70304\r\n|Use the generic implementation of libstdc++ primitives when we're on musl, not the glibc one.\r\n|\r\n|diff -r f50bb54f331f libstdc++-v3/configure.host\r\n|--- a/libstdc++-v3/configure.host\tFri Mar 29 16:38:52 2013 -0400\r\n|+++ b/libstdc++-v3/configure.host\tFri Mar 29 16:41:10 2013 -0400\r\n--------------------------\r\npatching file libstdc++-v3/configure.host\r\nUsing Plan A...\r\nHunk #1 succeeded at 243 (offset -21 lines).\r\nHunk #2 succeeded at 258 (offset -21 lines).\r\n```\r\n\r\nSeems `applyPatches()` should try to find the place where the context fit and apply that offset to the patched content, isn't it?\r\n\r\nP.D.: don't know if it's related, but at the end of processing the patch file, I get one call to `loadFile()` with `undefined` as index, but ignoring it don't make problems, so maybe it's an extra call that should not be there..."},"comment":{"url":"https://api.github.com/repos/kpdecker/jsdiff/issues/comments/153717792","html_url":"https://github.com/kpdecker/jsdiff/issues/84#issuecomment-153717792","issue_url":"https://api.github.com/repos/kpdecker/jsdiff/issues/84","id":153717792,"user":{"login":"piranna","id":532414,"avatar_url":"https://avatars.githubusercontent.com/u/532414?v=3","gravatar_id":"","url":"https://api.github.com/users/piranna","html_url":"https://github.com/piranna","followers_url":"https://api.github.com/users/piranna/followers","following_url":"https://api.github.com/users/piranna/following{/other_user}","gists_url":"https://api.github.com/users/piranna/gists{/gist_id}","starred_url":"https://api.github.com/users/piranna/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/piranna/subscriptions","organizations_url":"https://api.github.com/users/piranna/orgs","repos_url":"https://api.github.com/users/piranna/repos","events_url":"https://api.github.com/users/piranna/events{/privacy}","received_events_url":"https://api.github.com/users/piranna/received_events","type":"User","site_admin":false},"created_at":"2015-11-04T13:21:47Z","updated_at":"2015-11-04T13:21:47Z","body":"I'll close this since it got already merged."}}