{"thread":{"id":"39816","subject":"Different result with `git apply` and `patch`","startedAt":"2015-07-08T17:50:34Z","lastAt":"2015-07-08T17:50:34Z","messageCount":1,"participants":["Benjamin Poirier"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"265865","messageId":"20150708175034.GA16759@f1.synalogic.ca","threadId":"39816","inReplyTo":null,"subject":"Different result with `git apply` and `patch`","fromName":"Benjamin Poirier","fromEmail":"bpoirier@suse.com","sentAt":"2015-07-08T17:50:34Z","receivedAt":"2015-07-08T17:50:34Z","isPatch":false,"sender":{"key":"bpoirier@suse.com","avatar":null},"body":"Hi,\n\nIs it expected that `git apply` and `patch` produce a different result\nwhen given a patch that applies cleanly but with offsets?\n\nSpecifically, using the source file and patch file found here:\nhttps://gist.github.com/benthaman/d4e80e1e2e5e0273f874\nhttps://gist.github.com/benthaman/d48d017179a8292c3f75\n\nben@f1:/tmp/report$ mkdir p g\nben@f1:/tmp/report$ cp ib_isert.c p\nben@f1:/tmp/report$ cp ib_isert.c g\nben@f1:/tmp/report$ cd p/\nben@f1:/tmp/report/p$ patch -p5 < ../0123-IB-isert-pass-scatterlist-instead-of-cmd-to-fast_reg.patch\npatching file ib_isert.c\nHunk #1 succeeded at 2322 (offset 131 lines).\nHunk #2 succeeded at 2408 (offset 131 lines).\nHunk #3 succeeded at 2474 (offset 131 lines).\nben@f1:/tmp/report/p$ cd ../g\nben@f1:/tmp/report/g$ git apply -p5 -v < ../0123-IB-isert-pass-scatterlist-instead-of-cmd-to-fast_reg.patch\nChecking patch ib_isert.c...\nHunk #1 succeeded at 2322 (offset 131 lines).\nHunk #2 succeeded at 2199 (offset -78 lines).\nHunk #3 succeeded at 2474 (offset 131 lines).\nApplied patch ib_isert.c cleanly.\n\n\nben@f1:/tmp/report$ git --version\ngit version 2.4.3\nben@f1:/tmp/report$ patch --version\nGNU patch 2.7.1\n[...]\n\nI see why it happens, but I'd like the two tools to produce the same\nresult!\n\nThanks,\n-Benjamin\n"}]}