Skip to content

Commit 3e625c8

Browse files
chriscoolgitster
authored andcommitted
t6050-replace: test that objects are of the same type
and that the -f option bypasses the type check Signed-off-by: Christian Couder <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 160df71 commit 3e625c8

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

t/t6050-replace.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,4 +263,17 @@ test_expect_success 'not just commits' '
263263
test_cmp file.replaced file
264264
'
265265

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+
266279
test_done

0 commit comments

Comments
 (0)