Skip to content

Fuzz factor for applyPatch #42

@stuartpb

Description

@stuartpb

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions