Signed-off-by: Christian Couder <chrisc...@tuxfamily.org>
---
 t/t6050-replace.sh | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/t/t6050-replace.sh b/t/t6050-replace.sh
index decdc33..8f631ac 100755
--- a/t/t6050-replace.sh
+++ b/t/t6050-replace.sh
@@ -263,4 +263,17 @@ test_expect_success 'not just commits' '
        test_cmp file.replaced file
 '
 
+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 &&
+       grep "replace ref '\''$HASH1'\'' is of type '\''commit'\''" err &&
+       test_must_fail git replace HEAD^{tree} HEAD~1 2>err &&
+       grep "Object ref '\''HEAD^{tree}'\'' is of type '\''tree'\''" err &&
+       grep "replace ref '\''HEAD~1'\'' is of type '\''commit'\''" err &&
+       BLOB=$(git rev-parse :file) &&
+       test_must_fail git replace HEAD^ $BLOB 2>err &&
+       grep "Object ref '\''HEAD^'\'' is of type '\''commit'\''" err &&
+       grep "replace ref '\''$BLOB'\'' is of type '\''blob'\''" err
+'
+
 test_done
-- 
1.8.4.rc1.24.g13dc82a


--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to