-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add line Modification for diffs #137
Conversation
When source code changes (patches) are proposed to a project, the review process tends to result in iterations on the patch. It is helpful to reviewers to show only the changes between the iterations on a patch, the diff between each Patch revision's diff. Add a new line modification type, similar to the `Modification` type, which describes a line change between diffs. Signed-off-by: Slack Coder <slackcoder@server.ky>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few things:
- Why are we writing the serde code directly?
- Could we put this in another module and maybe re-export through
diff
? - Could we add tests to prove the functionality?
https://github.com/radicle-dev/radicle-git/blob/main/radicle-surf/src/diff.rs#L468-L504
👍
👍 |
This brings up the question of is radicle-surf a good home for it? We have the problem of generating data for the test. The way moving forward could be to (something like) implement a |
Ah yes, that was after much debate around encoding the enum type I believe. Fair enough 👌 |
This sounds reasonable. What are the alternatives? What would it look like if it didn't live in surf? |
One alternative is to build code to diff diffs into Radicle-surf, heavy handed in my opinion. Though Surf is advertised as a way to surf git repositories, and maybe diffing diffs is a way to surf? If the code lived elsewhere, we would be able to handle DDiffs on the Hunk level thanks to Surf's abstraction. This ends on the file level. DiffContent enforces a certain Hunk type, which makes sense. Or allow consumers to define their own |
Right, I wouldn't say it's a top priority -- but being able to parse a range-diff definitely fits :) On a side note: can we call this a
Could we continue with the abstraction in surf and then export |
They are slightly different, 'collection' vs. 'element'. Range-diff, as per git-range-diff, is about ordering and matching commits between git histories. In code a 'diff of diff' would be Diff. The term is for discussion only :).
👍
Stepping back, how about opening up DiffContent's contents to be defined by downstream? Surf defines an encapsulating Diff type and its file associated types (FileDiff + diff::Modified). Then there are the modification between files (currently Hunks). Could the FileDiff and diff::Modified types be parameterized? Downstream applications could use this to define custom types for describing differences suited to a format's domain (images, word documents, etc.?). |
Oh so you're essentially getting two diffs and then diff them? Like if you were to save the two diffs as blobs you would then diff those two blobs?
I'm doubtful about the data types being flexible enough to describe diffs other than text files 😅 |
That's it, but using a diff format for diffs.
Fair enough. These types are being included as a Patch into heartwood. Let's see how they go there, we can eventually bubble up parts to radicle-surf as things mature. I'm closing the PR for now. Thanks for the help 👍 |
When source code changes (patches) are proposed to a project, the review process tends to result in iterations on the patch. It is helpful to reviews to show only the changes between the iterations on a patch, the diff of the Patch diff.
Add a new line modification type, similar to the
Modification
type, which describes a line change between diffs.