t6050-replace: test that objects are of the same type
authorChristian Couder <chriscool@tuxfamily.org>
Fri, 6 Sep 2013 05:10:55 +0000 (07:10 +0200)
committerJunio C Hamano <gitster@pobox.com>
Fri, 6 Sep 2013 20:29:38 +0000 (13:29 -0700)
and that the -f option bypasses the type check

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t6050-replace.sh
index decdc33c522568e98346d085acdf873c995eb762..09bad9877f4d8d7877dee6dc35dc7e948148439e 100755 (executable)
@@ -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 &&
+       test_must_fail git replace HEAD^{tree} HEAD~1 &&
+       BLOB=$(git rev-parse :file) &&
+       test_must_fail git replace HEAD^ $BLOB
+'
+
+test_expect_success '-f option bypasses the type check' '
+       git replace -f mytag $HASH1 &&
+       git replace -f HEAD^{tree} HEAD~1 &&
+       git replace -f HEAD^ $BLOB
+'
+
 test_done