summaryrefslogtreecommitdiffstats
path: root/src/handlers/diff_header_misc.rs
blob: eb0833defc6d268781b65d36aa7937abbb59eaa1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
use crate::delta::{DiffType, Source, State, StateMachine};

impl<'a> StateMachine<'a> {
    #[inline]
    fn test_diff_header_misc_cases(&self) -> bool {
        self.source == Source::DiffUnified && self.line.starts_with("Only in ")
            || self.line.starts_with("Binary files ")
    }

    pub fn handle_diff_header_misc_line(&mut self) -> std::io::Result<bool> {
        if !self.test_diff_header_misc_cases() {
            return Ok(false);
        }
        self.handle_additional_cases(match self.state {
            State::DiffHeader(_) => self.state.clone(),
            _ => State::DiffHeader(DiffType::Unified),
        })
    }
}