t6050-replace: test that objects are of the same type

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>

Christian Couder committed Sep 6, 2013 at 07:10 UTC 3e625c8fec8a2ec49352e8f0a3862ccbfca11d3a
1 file changed +13
t/t6050-replace.sh
+13
@@ -263,4 +263,17 @@ test_expect_success 'not just commits' '
263 test_cmp file.replaced file
264 '
265
266 +test_expect_success 'replaced and replacement objects must be of the same type' '
267 + test_must_fail git replace mytag $HASH1 &&
268 + test_must_fail git replace HEAD^{tree} HEAD~1 &&
269 + BLOB=$(git rev-parse :file) &&
270 + test_must_fail git replace HEAD^ $BLOB
271 +'
272 +
273 +test_expect_success '-f option bypasses the type check' '
274 + git replace -f mytag $HASH1 &&
275 + git replace -f HEAD^{tree} HEAD~1 &&
276 + git replace -f HEAD^ $BLOB
277 +'
278 +
279 test_done