path_changed/
path_changed.rs

1// """
2// $ git diff --name-only 9c6c5e65c3590e299316d34718674de333bdd9c8  c097ad2a8c07bf2e3df64e6e603eee0473ad8133
3// CHANGELOG.md
4// Cargo.toml
5// README.md
6// src/clone.rs
7// src/info.rs
8// src/lib.rs
9// src/types.rs
10// """
11
12use color_eyre::eyre::Result;
13use git_meta::GitRepo;
14
15use std::env;
16
17fn main() -> Result<()> {
18    let current_dir = env::current_dir()?;
19
20    let repo = GitRepo::open(current_dir, None, None)?;
21
22    println!(
23        "Files that have changes at commit: a7cf222c46ad32f2802e79e1935f753a27adc9e8\n{:?}",
24        repo.to_info()
25            .list_files_changed_at("a7cf222c46ad32f2802e79e1935f753a27adc9e8")
26    );
27
28    println!(
29        "Files that have changed:\n{:?}",
30        repo.to_info().list_files_changed_between(
31            "9c6c5e65c3590e299316d34718674de333bdd9c8",
32            "c097ad2a8c07bf2e3df64e6e603eee0473ad8133"
33        )
34    );
35
36    println!(
37        "Has Cargo.toml changed?: {:?}",
38        repo.to_info().has_path_changed("Cargo.toml")
39    );
40
41    println!(
42        "Has src changed?: {:?}",
43        repo.to_info().has_path_changed("src")
44    );
45
46    println!(
47        "Has LICENSE changed?: {:?}",
48        repo.to_info().has_path_changed("LICENSE")
49    );
50
51    Ok(())
52}