Skip to content

Patch fails to apply (sometimes silently) when patch includes additions to the end of a file #357

@lukebatchelor

Description

@lukebatchelor

Hiya,

We stumbled across a bit of a weird edge case that we thought you might like to know about. After doing some digging, it appears the required steps to reproduce are:

  • the file you are patching has no newline at the end of it
  • you are adding another line to the end of that file (still with no newline)

I can't link the original patch we were working on, but I've reproduced it here: https://github.com/lukebatchelor/patch-package-repro

We had a brief look at trying to fix this (originally assuming patch-package was using git-apply under the hood and hoping we could just pass on the --inaccurate-eof flag but alas you weren't. It does look like you have explicit code for handling this so likely just a small edge case in that logic.

Hope this helps, thanks for making this package

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions