use super::super::apply;
use super::{git, init_repo, make_child, write};
use crate::template::GitRunner;
#[test]
fn apply_never_carries_a_childs_name_back_over_its_parents() {
let dir = init_repo();
let wt = dir.path();
let g = git();
write(wt, "name", "pale-otter\n");
g.run(wt, &["add", "-A"]).unwrap();
g.run(wt, &["commit", "-m", "settle name"]).unwrap();
let terminal = make_child(wt, &[("name", ""), ("feature.txt", "f\n")]);
apply(wt, "p-child", &terminal, &git()).unwrap();
assert_eq!(
std::fs::read_to_string(wt.join("feature.txt")).unwrap(),
"f\n",
"the work product still transfers"
);
assert_eq!(
std::fs::read_to_string(wt.join("name")).unwrap(),
"pale-otter\n",
"a child's name never reaches its parent's tree (§2.6)"
);
}