-
Notifications
You must be signed in to change notification settings - Fork 23
implemented diff3 functionality #148
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
base: main
Are you sure you want to change the base?
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #148 +/- ##
==========================================
+ Coverage 86.26% 87.66% +1.39%
==========================================
Files 13 14 +1
Lines 6203 8835 +2632
Branches 514 674 +160
==========================================
+ Hits 5351 7745 +2394
- Misses 851 1078 +227
- Partials 1 12 +11
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
src/diff3.rs
Outdated
| // Handle options | ||
| if param_str.starts_with('-') && param_str != "-" { | ||
| // Check for combined short options | ||
| let param_str = param_str.as_ref(); |
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.
param_str is already a reference, no ?
is as_ref() necessary ?
src/diff3.rs
Outdated
| } | ||
| } | ||
|
|
||
| // Collect remaining arguments |
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.
lot of duplication from line 179
src/diff3.rs
Outdated
|
|
||
| /// Fast content hash for quick equality checks on large files | ||
| /// Uses a simple FNV-1a hash for performance optimization | ||
| #[allow(dead_code)] |
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.
why keep it if it is dead code ?
src/diff3.rs
Outdated
| } | ||
|
|
||
| #[derive(Debug, Clone)] | ||
| #[allow(dead_code)] |
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.
same, if it is dead code, why keep it ?
src/diff3.rs
Outdated
|
|
||
| for &byte in &content[..sample_size] { | ||
| // Non-text bytes are control characters (0-8, 14-31, 127) except common ones (9=tab, 10=LF, 13=CR) | ||
| if (byte < 9 || (byte > 13 && byte < 32) || byte == 127) |
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.
can be simplified to matches!(byte, 0..=8 | 14..=31 | 127)
no ?
src/diff3.rs
Outdated
| writeln!( | ||
| &mut output, | ||
| "Binary files {} and {} differ", | ||
| params.mine.to_string_lossy(), |
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.
Multiple to_string_lossy() calls - convert once and reuse for efficiency"
| output_mode: Diff3OutputMode::All, | ||
| text: false, | ||
| labels: [None, None, None], | ||
| strip_trailing_cr: false, |
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.
strip_trailing_cr parameter is defined but never implemented in the processing logic
| pub text: bool, | ||
| pub labels: [Option<String>; 3], | ||
| pub strip_trailing_cr: bool, | ||
| pub initial_tab: bool, |
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.
initial_tab parameter is defined but never used in output formatting
|
i did a first pass but many things needs to be improved before i spend more time on it :) |
…trailing-cr and -T / --initial-tab logic.
…perly implement three-wat merge semantics.
src/diff3.rs
Outdated
| output | ||
| } | ||
|
|
||
| #[allow(clippy::too_many_arguments)] |
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.
Please refactor to avoid this warning
src/diff3.rs
Outdated
| output | ||
| } | ||
|
|
||
| #[allow(clippy::too_many_arguments)] |
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.
Same
src/diff3.rs
Outdated
| let mut yours = None; | ||
| let mut label_count = 0; | ||
|
|
||
| #[allow(clippy::while_let_on_iterator)] |
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.
Please fix this
…rs parameters from output generation functions
…compatibility issues.
…ormal format conflict behavior
…h BSD diff3 which has different exit code behavior for the -E flag compared to GNU diff3. Added is_gnu_diff3() helper and modified gnu_compat_ed_with_overlap test to skip on BSD diff3 systems.
This PR adds a Rust implementation of diff3.
Fixes #15