use std::process::Command;
use second_brain_adapters::git::Checkout;
#[test]
fn missing_git_binary_is_an_error_or_none() {
let tmp = tempfile::tempdir().unwrap();
let out = Command::new("git")
.arg("-C")
.arg(tmp.path())
.args(["init", "-q"])
.output()
.unwrap();
assert!(out.status.success());
let checkout = Checkout::containing(tmp.path()).unwrap();
unsafe { std::env::set_var("PATH", tmp.path().join("no-bin")) };
assert!(checkout.head().is_err());
assert!(checkout.commits_since(None, 10).is_err());
assert_eq!(checkout.github_remote(), None);
assert_eq!(Checkout::containing(tmp.path()), None);
}