Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

applyPatches don't use offsets #84

Closed
piranna opened this issue Oct 15, 2015 · 4 comments
Closed

applyPatches don't use offsets #84

piranna opened this issue Oct 15, 2015 · 4 comments

Comments

@piranna
Copy link
Contributor

piranna commented Oct 15, 2015

(Related to #82)

While processing https://raw.githubusercontent.com/GregorR/musl-cross/master/patches/gcc-4.7.3-musl.diff with my pull-request 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:

Hmm...  Looks like a unified diff to me...
The text leading up to this was:
--------------------------
|# HG changeset patch
|# Parent f50bb54f331f73405131a30b4f353cfda1c70304
|Use the generic implementation of libstdc++ primitives when we're on musl, not the glibc one.
|
|diff -r f50bb54f331f libstdc++-v3/configure.host
|--- a/libstdc++-v3/configure.host  Fri Mar 29 16:38:52 2013 -0400
|+++ b/libstdc++-v3/configure.host  Fri Mar 29 16:41:10 2013 -0400
--------------------------
patching file libstdc++-v3/configure.host
Using Plan A...
Hunk #1 succeeded at 243 (offset -21 lines).
Hunk #2 succeeded at 258 (offset -21 lines).

Seems applyPatches() should try to find the place where the context fit and apply that offset to the patched content, isn't it?

P.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...

@piranna
Copy link
Contributor Author

piranna commented Oct 15, 2015

P.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...

Found and fixed!!! :-D

@kpdecker
Copy link
Owner

Have you tried different fuzzFactor values?

@piranna
Copy link
Contributor Author

piranna commented Oct 16, 2015

No, I didn't, but according to the source code, seems more related about allowing lines on the context to not be exactly as expected, for example to be able to aply a patch on top of some commits after of the one where it was created.

@piranna
Copy link
Contributor Author

piranna commented Nov 4, 2015

I'll close this since it got already merged.

@piranna piranna closed this as completed Nov 4, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants