| 1 | use craterust-analyzer cargo git-delta 0.19.2 crate/::deltarust-analyzer cargo git-delta 0.19.2 delta/::{DiffTyperust-analyzer cargo git-delta 0.19.2 delta/DiffType#, Sourcerust-analyzer cargo git-delta 0.19.2 delta/Source#, Staterust-analyzer cargo git-delta 0.19.2 delta/State#, StateMachinerust-analyzer cargo git-delta 0.19.2 delta/StateMachine#}; |
| 2 | use craterust-analyzer cargo git-delta 0.19.2 crate/::utilsrust-analyzer cargo git-delta 0.19.2 utils/::pathrust-analyzer cargo git-delta 0.19.2 utils/path/::relativize_path_mayberust-analyzer cargo git-delta 0.19.2 utils/path/relativize_path_maybe().; |
| 3 | |
| 4 | impl StateMachinerust-analyzer cargo git-delta 0.19.2 delta/StateMachine#<'_> { |
| 5 | #[inline] |
| 6 | fn test_diff_file_missingrust-analyzer cargo git-delta 0.19.2 handlers/diff_header_misc/impl#[`StateMachine<'_>`]test_diff_file_missing().(&self) -> bool { |
| 7 | self.sourcerust-analyzer cargo git-delta 0.19.2 delta/StateMachine#source. rust-analyzer cargo git-delta 0.19.2 delta/impl#[Source][`PartialEq<Self>`]eq().==rust-analyzer cargo git-delta 0.19.2 delta/impl#[Source][`PartialEq<Self>`]eq(). rust-analyzer cargo git-delta 0.19.2 delta/impl#[Source][`PartialEq<Self>`]eq().Sourcerust-analyzer cargo git-delta 0.19.2 delta/Source#::DiffUnifiedrust-analyzer cargo git-delta 0.19.2 delta/Source#DiffUnified# && self.linerust-analyzer cargo git-delta 0.19.2 delta/StateMachine#line..starts_withrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]starts_with().("Only in ") |
| 8 | } |
| 9 | |
| 10 | #[inline] |
| 11 | fn test_diff_is_binaryrust-analyzer cargo git-delta 0.19.2 handlers/diff_header_misc/impl#[`StateMachine<'_>`]test_diff_is_binary().(&self) -> bool { |
| 12 | self.linerust-analyzer cargo git-delta 0.19.2 delta/StateMachine#line..starts_withrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]starts_with().("Binary files ") |
| 13 | } |
| 14 | |
| 15 | pub fn handle_diff_header_misc_linerust-analyzer cargo git-delta 0.19.2 handlers/diff_header_misc/impl#[`StateMachine<'_>`]handle_diff_header_misc_line().(&mut self) -> stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<bool> { |
| 16 | if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().self.test_diff_file_missingrust-analyzer cargo git-delta 0.19.2 handlers/diff_header_misc/impl#[`StateMachine<'_>`]test_diff_file_missing().() && !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().self.test_diff_is_binaryrust-analyzer cargo git-delta 0.19.2 handlers/diff_header_misc/impl#[`StateMachine<'_>`]test_diff_is_binary().() { |
| 17 | return Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(false); |
| 18 | } |
| 19 | |
| 20 | // Preserve the "Binary files" line when diff lines should be kept unchanged. |
| 21 | if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().self.configrust-analyzer cargo git-delta 0.19.2 delta/StateMachine#config..color_onlyrust-analyzer cargo git-delta 0.19.2 config/Config#color_only. && self.test_diff_is_binaryrust-analyzer cargo git-delta 0.19.2 handlers/diff_header_misc/impl#[`StateMachine<'_>`]test_diff_is_binary().() { |
| 22 | // Print the "Binary files" line verbatim, if there was no "diff" line, or it |
| 23 | // listed different files but was not followed by header minus and plus lines. |
| 24 | // This can happen in output of standalone diff or git diff --no-index. |
| 25 | if self.minus_filerust-analyzer cargo git-delta 0.19.2 delta/StateMachine#minus_file..is_emptyrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]is_empty().() && self.plus_filerust-analyzer cargo git-delta 0.19.2 delta/StateMachine#plus_file..is_emptyrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]is_empty().() { |
| 26 | self.emit_line_unchangedrust-analyzer cargo git-delta 0.19.2 delta/impl#[`StateMachine<'a>`]emit_line_unchanged().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 27 | self.handled_diff_header_header_line_file_pairrust-analyzer cargo git-delta 0.19.2 delta/StateMachine#handled_diff_header_header_line_file_pair. |
| 28 | .clone_fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`][Clone]clone_from().(&self.current_file_pairrust-analyzer cargo git-delta 0.19.2 delta/StateMachine#current_file_pair.); |
| 29 | return Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(true); |
| 30 | } |
| 31 | |
| 32 | if self.minus_filerust-analyzer cargo git-delta 0.19.2 delta/StateMachine#minus_file. rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`PartialEq<&str>`]ne().!=rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`PartialEq<&str>`]ne(). rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`PartialEq<&str>`]ne()."/dev/null" { |
| 33 | relativize_path_mayberust-analyzer cargo git-delta 0.19.2 utils/path/relativize_path_maybe().(&mut self.minus_filerust-analyzer cargo git-delta 0.19.2 delta/StateMachine#minus_file., self.configrust-analyzer cargo git-delta 0.19.2 delta/StateMachine#config.); |
| 34 | self.minus_filerust-analyzer cargo git-delta 0.19.2 delta/StateMachine#minus_file..push_strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]push_str().(" (binary file)"); |
| 35 | } |
| 36 | if self.plus_filerust-analyzer cargo git-delta 0.19.2 delta/StateMachine#plus_file. rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`PartialEq<&str>`]ne().!=rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`PartialEq<&str>`]ne(). rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`PartialEq<&str>`]ne()."/dev/null" { |
| 37 | relativize_path_mayberust-analyzer cargo git-delta 0.19.2 utils/path/relativize_path_maybe().(&mut self.plus_filerust-analyzer cargo git-delta 0.19.2 delta/StateMachine#plus_file., self.configrust-analyzer cargo git-delta 0.19.2 delta/StateMachine#config.); |
| 38 | self.plus_filerust-analyzer cargo git-delta 0.19.2 delta/StateMachine#plus_file..push_strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]push_str().(" (binary file)"); |
| 39 | } |
| 40 | return Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(true); |
| 41 | } |
| 42 | |
| 43 | self.handle_additional_casesrust-analyzer cargo git-delta 0.19.2 handlers/impl#[`StateMachine<'_>`]handle_additional_cases().(match self.staterust-analyzer cargo git-delta 0.19.2 delta/StateMachine#state. { |
| 44 | Staterust-analyzer cargo git-delta 0.19.2 delta/State#::DiffHeaderrust-analyzer cargo git-delta 0.19.2 delta/State#DiffHeader#(_) => self.staterust-analyzer cargo git-delta 0.19.2 delta/StateMachine#state..clonerust-analyzer cargo git-delta 0.19.2 delta/impl#[State][Clone]clone().(), |
| 45 | _ => Staterust-analyzer cargo git-delta 0.19.2 delta/State#::DiffHeaderrust-analyzer cargo git-delta 0.19.2 delta/State#DiffHeader#(DiffTyperust-analyzer cargo git-delta 0.19.2 delta/DiffType#::Unifiedrust-analyzer cargo git-delta 0.19.2 delta/DiffType#Unified#), |
| 46 | }) |
| 47 | } |
| 48 | } |