Feature request: ability to serialize & dehydrate patch changes
This isn't a bug - this is a feature request for an app I've written, using libgit2sharp: diff-buddy (https://github.com/fluffynuts/diff-buddy) which aims to help on larger reviews which are difficult to impossible on GitHub - the page just falls over.
diff-buddy is able to give an overview, show the diff for one file, or run in review mode where someone can go through the files of interest, store commentary, and copy that to the PR once done. diff-buddy stores state so a review doesn't have to be completed all at once.
Currently, for review purposes, the review UI steps through each file, applying exclusions (eg ignore files with a certain path, ignore files where the only changes are added / removed using statements, etc) to get the review down to the most interesting files. Stepping through files is slow, and the most time is spent, expecially on a really large diff, in re-diffing the tree every time we step - as the actual diff work is done in a sub-process. This is not a criticism of libgit2sharp - the whole reason for using diff-buddy is that the overall changes are vast - too vast for the GH web interface to provide a useful review interface to.
Yes, I could re-work the architecture a bit - call directly in and apply some in-memory caching, but a seemingly simple way was to just save a JSON blob of the Patch state somewhere in a cache folder & re-use that - however, I can't because Patch implements the read-only collection IEnumerable interface. I wouldn't even mind if I had to some of the lifting - enumerate through all diffs, store & re-hydrate manually, but I can't do that either as PatchEntryChanges aren't individually serializable.
The ability to serialize and deserialize this info may also be useful for other client-server operations (eg where a server could do the actual diffing and a client could do work with it) - which was another approach I considered, but, of course, if I can't serialize/deserialize, I can't pass that across the wire either.