Open sebastinez opened 2 years ago
Ya, that makes sense to me. So we would actually move the source::commit::Stats
type into surf::diff
. I'm wondering if it would make sense to calculate the Stats
while building the Diff
, so it just becomes associated data rather than an associated computation. The proposed function would just be an accessor then :)
I'm wondering if it would make sense to calculate the Stats while building the Diff.
Yeah that sounds great to me 👍 Would provide a PR for that
Thanks, @sebastinez! Appreciate the suggestion and the follow-up :blush:
I'm wondering if it would make sense to calculate the
Stats
while building theDiff
, so it just becomes associated data rather than an associated computation.
I did some more thinking maybe if we leave it as an associated computation, one could opt in if needed.
Also I like the structure of the surf::diff::Diff
and wouldn't change it.
I did some more thinking maybe if we leave it as an associated computation, one could opt in if needed.
What's the con of not having it?
I would think it's cheap to carry in the diff itself as a sub-struct since it's only two u64
's. Is there something I'm missing?
Yeah since it's really cheap I don't think it's so useful to be able to opt-out?
Hello everyone,
So I wanted to propose here, that we should add an associated function to
surf::diff::Diff
that would allow us to generate asource::commit::Stats
.Currently it is possible to generate a
surf::diff::Diff
through e.g. https://github.com/radicle-dev/radicle-surf/blob/77b1905ba38fc9c95c01c0ed09d4d495548eacc2/surf/src/vcs/git.rs#L543 But we don't have any function that would calculate the amount of additions and deletions that happened between those commits.I'm thinking we should be able to convert the additions, deletions loops from here https://github.com/radicle-dev/radicle-surf/blob/77b1905ba38fc9c95c01c0ed09d4d495548eacc2/source/src/commit.rs#L135 into the mentioned associated function.