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

Fuzz factor for applyPatch #42

Closed
stuartpb opened this issue Jan 11, 2015 · 2 comments
Closed

Fuzz factor for applyPatch #42

stuartpb opened this issue Jan 11, 2015 · 2 comments
Milestone

Comments

@stuartpb
Copy link

Oh my. If I'm reading this code correctly, it looks like applyPatch currently ignores context lines altogether. Oh, no. Oh, deary dear.

From the original patch man page:

-F  max-fuzz, --fuzz max-fuzz
     Sets the maximum fuzz factor.  This option only applies to con-
     text diffs, and causes patch to ignore up to that many lines in
     looking for places to install a hunk.  Note that a larger fuzz
     factor increases the odds of a faulty patch.  The default fuzz
     factor is 2, and it may not be set to more than the number of
     lines of context in the context diff, ordinarily 3.

The applyPatch function should have some smarts over determining where to apply the patch (or if the patch should even apply at all). I'd actually kind of like a fuzzFactor that can be specified in units other than lines, too (so, for example, it's OK to match when 80% of the line is the same, or when there are only two word differences, or no instances where lines are added/removed or a word is replaced with multiple words or vice versa, or something like that).

@kpdecker
Copy link
Owner

kpdecker commented Aug 7, 2015

I'm looking at reworking the patch implementation for 2.1. I'm thinking that there should be a callback to allow the caller to approve or reject in case of the line being different. Will update here as that idea evolves.

@kpdecker
Copy link
Owner

Released in 2.1.0

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