-
Notifications
You must be signed in to change notification settings - Fork 14
Open
Description
The crate this program relies on to parse diffs:
- panics when a patch generated by git ends with a change to whether or not a file ends with a newline
- panics when it tries to parse a patch with renames in the way git does it
- fails to parse diffs generated by
git format-patch
Which, I guess, is understandable considering that none of this is part of the Unified Format specification.
A feature to strip the file path prefixes from git diffs is already present, but these issues persist. Some options to fix this:
- Preprocess the diff similarly to how it's done for stripping the file path prefixes. For this, you'd have to: 1. remove all
\ No newline at end of file
lines for git diffs, 2. replacerename from
andrename to
lines with respective hunks for adding and removing all the lines from each of the files (not sure if this will properly remove the old files?) for git diffs, and 3. add a newPatchSource
variant calledGitMailbox
or something, which does everything thatGithubPrDiff
does (which could use a rename to justGitDiff
or something btw) in addition to removing, from a given patch file, all lines before thediff --git
one, and the last three lines respectively containing--
, the version of git used to generate the patch, and nothing. - Fork the upstream crate, call it
gitpatch
or something, and add proper support for all of this stuff. (You could probably remove thePatchSource
thing altogether if you add proper autodetection for these kinds of diffs) Not sure if the upstream person will respond to any PRs, or if they care to add this sort of thing. - Just don't fix it and add a note to the readme to use
diff -u
instead of git. Which I would recommend against as most people will probably want to use git diffs, but, not my crate. I guess you could also not add support forgit format-patch
diffs but fix the other stuff, though those kinds of diffs are what I'm more interested in personally.
Metadata
Metadata
Assignees
Labels
No labels