git_x/
since.rs

1use std::process::Command;
2
3pub fn run(reference: String) {
4    let output = Command::new("git")
5        .args([
6            "log",
7            &format!("{reference}..HEAD"),
8            "--pretty=format:- %h %s",
9        ])
10        .output()
11        .expect("Failed to run git log");
12
13    if !output.status.success() {
14        eprintln!("❌ Failed to retrieve commits since '{reference}'");
15        return;
16    }
17
18    let log = String::from_utf8_lossy(&output.stdout);
19    if log.trim().is_empty() {
20        println!("✅ No new commits since {reference}");
21    } else {
22        println!("🔍 Commits since {reference}:");
23        println!("{log}");
24    }
25}