Skip to content

Split apply logic by fragment type #11

Closed
@bluekeyes

Description

@bluekeyes

The single Applier type does some messy internal state tracking to avoid mixing ApplyFile, ApplyTextFragment, and ApplyBinaryFragment. I think the following would be better:

  1. Create a TextApplier (in apply_text.go) and BinaryApplier (in apply_binary.go). Each of these has methods to apply single fragments (and multiple fragments, in the case of TextApplier.)
  2. Remove the Reset method and rename Flush to Close to better indicate that apply types are single-use
  3. Remove the Applier type and the ApplyFile method
  4. Move the logic for ApplyFile to the global Apply function. This is the convenience function to select an applier based on the file type and execute it.

This should reduce confusion and provides an obvious place for the eventual text-only options for fuzzy apply.

Metadata

Metadata

Assignees

No one assigned

    Labels

    applyingIssues related to applying patches

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions