+test_expect_success 'replaced and replacement objects must be of the same type' '+ test_must_fail git replace mytag $HASH1 2>err &&+ grep "Object ref '\''mytag'\'' is of type '\''tag'\''" err &&
Uh, this hurts in the eye! Please write this as
grep "Object ref .mytag. is of type .tag" err &&
-- Hannes