~/selfhut

selfhut/src/git/diffs.rs -rw-r--r-- 741 B
76d4fa6d — Arthur Melton log This is kinda a test but this adds the log tab and others 2 years ago
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
pub fn diffs<'a>(commit: git2::Commit<'a>, repo: &'a git2::Repository) -> Option<git2::Diff<'a>> {    
    match commit.tree() {
        Ok(tree) => match commit.parent(0) {
            Ok(parent) => match parent.tree() {
                Ok(parent_tree) => {
                    match repo.diff_tree_to_tree(
                        Some(&tree),
                        Some(&parent_tree),
                        None,
                    ) {
                        Ok(diff) => {
                            Some(diff)
                        }
                        Err(_) => None
                    }
                }
                Err(_) => None
            },
            Err(_) => None
        },
        Err(_) => None
    }
}