Skip to content
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

surf: Add DiffFile to FileDiff::Copied and FileDiff::Moved #143

Merged

Conversation

sebastinez
Copy link
Member

This allows us to know the blob oid of a moved or copied file, even when no diff is available.


diff.insert_copied(old.to_path_buf(), new.to_path_buf());
diff.insert_copied(old.to_path_buf(), new.to_path_buf(), copy);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like this logic should be the same as

if let Some(patch) = patch {
diff.insert_moved(old_path, new_path, old, new, DiffContent::try_from(patch)?);
} else if delta.new_file().is_binary() {
diff.insert_moved(old_path, new_path, old, new, DiffContent::Binary);
} else {
diff.insert_moved(old_path, new_path, old, new, DiffContent::Empty);
}
, but perhaps I'm wrong. Can you explain why you chose to do it this way?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My goal with this PR was to add an oid to the copied files, which currently just had old and new path.
There could also be a diff be part of a copied file, as is with a moved file, so I think I'll add your suggestion, adapted for copied files.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ya, I think it's good that they would have the same behaviour 👍 Thanks!

@sebastinez sebastinez force-pushed the sebastinez/add-current-oid-to-filediff branch from ffe91f1 to a60343e Compare September 21, 2023 13:46
This allows us to know the blob oid of a moved or copied file, even when
no diff is available.

Also changes the structure of a copied file to be the same as a moved or
renamed file.

Signed-off-by: Sebastian Martinez <me@sebastinez.dev>
@sebastinez sebastinez force-pushed the sebastinez/add-current-oid-to-filediff branch from a60343e to 9582160 Compare September 21, 2023 13:49
Copy link
Collaborator

@FintanH FintanH left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Amazing, thanks!

@FintanH FintanH merged commit 80ac22a into radicle-dev:main Sep 21, 2023
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants