summaryrefslogtreecommitdiff
path: root/t/t6050-replace.sh
diff options
context:
space:
mode:
authorChristian Couder <chriscool@tuxfamily.org>2013-09-06 05:10:55 (GMT)
committerJunio C Hamano <gitster@pobox.com>2013-09-06 20:29:38 (GMT)
commit3e625c8fec8a2ec49352e8f0a3862ccbfca11d3a (patch)
treef4edc36b74e200f9affc765d3396dcccfde3838b /t/t6050-replace.sh
parent160df71ef53b0ad645391ec7d5525eda33871d09 (diff)
downloadgit-3e625c8fec8a2ec49352e8f0a3862ccbfca11d3a.zip
git-3e625c8fec8a2ec49352e8f0a3862ccbfca11d3a.tar.gz
git-3e625c8fec8a2ec49352e8f0a3862ccbfca11d3a.tar.bz2
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>
Diffstat (limited to 't/t6050-replace.sh')
-rwxr-xr-xt/t6050-replace.sh13
1 files changed, 13 insertions, 0 deletions
diff --git a/t/t6050-replace.sh b/t/t6050-replace.sh
index decdc33..09bad98 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 &&
+ 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