libgit2 / libgit2/libgit2sharp
Feature request: ability to serialize & dehydrate patch changes
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 3.5k
- Forks
- 925
- PR merge metrics
- No merged PRs in 30d
Description
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.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
The request concerns the Patch and PatchEntryChanges types; begin by reviewing their public shape and current collection and serialization constraints. Define a round-trip representation for a Patch and its entries, then verify that serialized data can be restored with equivalent changes; no specific files or tests are named in the issue.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp, git
- Domain
- devtools
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100