-
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
surf: Add DiffFile
to FileDiff::Copied
and FileDiff::Moved
#143
surf: Add DiffFile
to FileDiff::Copied
and FileDiff::Moved
#143
Conversation
e4454d1
to
194721e
Compare
radicle-surf/src/diff/git.rs
Outdated
|
||
diff.insert_copied(old.to_path_buf(), new.to_path_buf()); | ||
diff.insert_copied(old.to_path_buf(), new.to_path_buf(), copy); |
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.
I feel like this logic should be the same as
radicle-git/radicle-surf/src/diff/git.rs
Lines 346 to 352 in 194721e
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); | |
} |
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.
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.
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.
Ya, I think it's good that they would have the same behaviour 👍 Thanks!
ffe91f1
to
a60343e
Compare
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>
a60343e
to
9582160
Compare
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.
Amazing, thanks!
This allows us to know the blob oid of a moved or copied file, even when no diff is available.