Re: [PATCH 3/5] t6050-replace: test that objects are of the same type

2013-08-25 Thread Johannes Sixt
Am 25.08.2013 15:06, schrieb Christian Couder:
> +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 &&

Uh, this hurts in the eye! Please write this as

grep "Object ref .mytag. is of type .tag" err &&

-- Hannes

--
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


[PATCH 3/5] t6050-replace: test that objects are of the same type

2013-08-25 Thread Christian Couder
Signed-off-by: Christian Couder 
---
 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