Debian Codegraph @

src/handlers/diff_header_diff.rs

raw symbols SCIP
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#, InMergeConflictrust-analyzer cargo git-delta 0.19.2 delta/InMergeConflict#, MergeParentsrust-analyzer cargo git-delta 0.19.2 delta/MergeParents#, 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/::handlersrust-analyzer cargo git-delta 0.19.2 handlers/::diff_headerrust-analyzer cargo git-delta 0.19.2 handlers/diff_header/::{get_repeated_file_path_from_diff_linerust-analyzer cargo git-delta 0.19.2 handlers/diff_header/get_repeated_file_path_from_diff_line()., FileEventrust-analyzer cargo git-delta 0.19.2 handlers/diff_header/FileEvent#};
3
4 impl StateMachinerust-analyzer cargo git-delta 0.19.2 delta/StateMachine#<'_> {
5 #[inline]
6 fn test_diff_header_diff_linerust-analyzer cargo git-delta 0.19.2 handlers/diff_header_diff/impl#[`StateMachine<'_>`]test_diff_header_diff_line().(&self) -> bool {
7 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().("diff ")
8 }
9
10 #[allow(clippy::unnecessary_wraps)]
11 pub fn handle_diff_header_diff_linerust-analyzer cargo git-delta 0.19.2 handlers/diff_header_diff/impl#[`StateMachine<'_>`]handle_diff_header_diff_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> {
12 if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().self.test_diff_header_diff_linerust-analyzer cargo git-delta 0.19.2 handlers/diff_header_diff/impl#[`StateMachine<'_>`]test_diff_header_diff_line().() {
13 return Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(false);
14 }
15 self.painterrust-analyzer cargo git-delta 0.19.2 delta/StateMachine#painter..paint_buffered_minus_and_plus_linesrust-analyzer cargo git-delta 0.19.2 paint/impl#[`Painter<'p>`]paint_buffered_minus_and_plus_lines().();
16 self.painterrust-analyzer cargo git-delta 0.19.2 delta/StateMachine#painter..emitrust-analyzer cargo git-delta 0.19.2 paint/impl#[`Painter<'p>`]emit().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
17 self.staterust-analyzer cargo git-delta 0.19.2 delta/StateMachine#state. =
18 if 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().("diff --cc ") || 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().("diff --combined ") {
19 // We will determine the number of parents when we see the hunk header.
20 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#::Combinedrust-analyzer cargo git-delta 0.19.2 delta/DiffType#Combined#(
21 MergeParentsrust-analyzer cargo git-delta 0.19.2 delta/MergeParents#::Unknownrust-analyzer cargo git-delta 0.19.2 delta/MergeParents#Unknown#,
22 InMergeConflictrust-analyzer cargo git-delta 0.19.2 delta/InMergeConflict#::Norust-analyzer cargo git-delta 0.19.2 delta/InMergeConflict#No#,
23 ))
24 } else {
25 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#)
26 };
27 self.handle_pending_line_with_diff_namerust-analyzer cargo git-delta 0.19.2 handlers/diff_header/impl#[`StateMachine<'_>`]handle_pending_line_with_diff_name().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
28 self.handled_diff_header_header_line_file_pairrust-analyzer cargo git-delta 0.19.2 delta/StateMachine#handled_diff_header_header_line_file_pair. = Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#;
29 self.diff_linerust-analyzer cargo git-delta 0.19.2 delta/StateMachine#diff_line..clone_fromrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][Clone]clone_from().(&self.linerust-analyzer cargo git-delta 0.19.2 delta/StateMachine#line.);
30
31 // Pre-fill header fields from the diff line. For added, removed or renamed files
32 // these are updated precisely on actual header minus and header plus lines.
33 // But for modified binary files which are not added, removed or renamed, there
34 // are no minus and plus lines. Without the code below, in such cases the file names
35 // would remain unchanged from the previous diff, or empty for the very first diff.
36 let name = get_repeated_file_path_from_diff_linerust-analyzer cargo git-delta 0.19.2 handlers/diff_header/get_repeated_file_path_from_diff_line().(&self.linerust-analyzer cargo git-delta 0.19.2 delta/StateMachine#line.).unwrap_or_defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap_or_default().();
37 self.minus_filerust-analyzer cargo git-delta 0.19.2 delta/StateMachine#minus_file..clone_fromrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][Clone]clone_from().(&name);
38 self.plus_filerust-analyzer cargo git-delta 0.19.2 delta/StateMachine#plus_file..clone_fromrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][Clone]clone_from().(&name);
39 self.minus_file_eventrust-analyzer cargo git-delta 0.19.2 delta/StateMachine#minus_file_event. = FileEventrust-analyzer cargo git-delta 0.19.2 handlers/diff_header/FileEvent#::Changerust-analyzer cargo git-delta 0.19.2 handlers/diff_header/FileEvent#Change#;
40 self.plus_file_eventrust-analyzer cargo git-delta 0.19.2 delta/StateMachine#plus_file_event. = FileEventrust-analyzer cargo git-delta 0.19.2 handlers/diff_header/FileEvent#::Changerust-analyzer cargo git-delta 0.19.2 handlers/diff_header/FileEvent#Change#;
41 self.current_file_pairrust-analyzer cargo git-delta 0.19.2 delta/StateMachine#current_file_pair. = Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#((self.minus_filerust-analyzer cargo git-delta 0.19.2 delta/StateMachine#minus_file..clonerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][Clone]clone().(), self.plus_filerust-analyzer cargo git-delta 0.19.2 delta/StateMachine#plus_file..clonerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][Clone]clone().()));
42
43 if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().self.should_skip_linerust-analyzer cargo git-delta 0.19.2 delta/impl#[`StateMachine<'a>`]should_skip_line().() {
44 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().;
45 }
46 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(true)
47 }
48 }