use super::*;
#[test]
fn a_duplicate_sub_id_surfaces_as_worktree_add() {
struct FixedClock;
impl Clock for FixedClock {
fn now_iso8601(&self) -> String {
"2026-01-01T00:00:00Z".into()
}
fn now_compact(&self) -> String {
"ct9".into()
}
}
struct FixedIdGen;
impl IdGen for FixedIdGen {
fn short(&self) -> String {
"feedface".into()
}
}
let (_h, ws) = fixture::workspace();
let parent_wt = fixture::spawn_root(&ws, "20260101-p1");
let g = crate::template::RealGit::new();
let launcher = RecordingLauncher::ok();
run(
&req(&ws, "20260101-p1", &parent_wt, "g"),
&g,
&FixedClock,
&FixedIdGen,
&launcher,
&test_rng(),
)
.unwrap();
let err = run(
&req(&ws, "20260101-p1", &parent_wt, "g"),
&g,
&FixedClock,
&FixedIdGen,
&launcher,
&test_rng(),
)
.unwrap_err();
assert!(
matches!(
err,
Error::Git {
op: "worktree add",
..
}
),
"got {err:?}"
);
}