-
Notifications
You must be signed in to change notification settings - Fork 6
Description
It's not uncommon for unix diffs to be embedded within text that's not part of the diff, and it's common in other tools to just skip this text.
For example https://man7.org/linux/man-pages/man1/patch.1.html:
patch tries to skip any leading garbage, apply the diff, and then skip any trailing garbage. Thus you could feed an email message containing a diff listing to patch, and it should work...
Since part of the point of this tool is to turn the patch into an AST, we could and perhaps should just return this text as part of the parsed format. That might require adding a higher level concept of "a sequence of patches with garbage between them", whereas today from_multiple just returns a Vec<Patch>. Perhaps for now it's enough to just skip the garbage. That would handle cases like #11 index ... without needing to specifically recognize it, and any other metadata potentially inserted by other VCSes or tools.
...
Actually, it seems in at least some cases but not all, it will skip garbage lines...