Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
modernize t9300: use test_when_finished for clean-up
author
Johannes Sixt
<j6t@kdbg.org>
Thu, 19 Nov 2015 19:09:47 +0000
(20:09 +0100)
committer
Jeff King
<peff@peff.net>
Fri, 20 Nov 2015 13:02:06 +0000
(08:02 -0500)
A number of clean-ups of test cases are performed outside of
test_expect_success. Replace these cases by using test_when_finished.
Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Jeff King <peff@peff.net>
t/t9300-fast-import.sh
patch
|
blob
|
history
raw
|
patch
|
inline
| side by side (parent:
ec2c10b
)
diff --git
a/t/t9300-fast-import.sh
b/t/t9300-fast-import.sh
index c36afdb8ffd9167fef6d799875db5bb8c2a5221c..adabd687d828b610692793cedd65532e77ea1dff 100755
(executable)
--- a/
t/t9300-fast-import.sh
+++ b/
t/t9300-fast-import.sh
@@
-344,9
+344,9
@@
M 755 0000000000000000000000000000000000000001 zero1
INPUT_END
test_expect_success 'B: fail on invalid blob sha1' '
INPUT_END
test_expect_success 'B: fail on invalid blob sha1' '
+ test_when_finished "rm -f .git/objects/pack_* .git/objects/index_*" &&
test_must_fail git fast-import <input
'
test_must_fail git fast-import <input
'
-rm -f .git/objects/pack_* .git/objects/index_*
cat >input <<INPUT_END
commit TEMP_TAG
cat >input <<INPUT_END
commit TEMP_TAG
@@
-359,14
+359,13
@@
from refs/heads/master
INPUT_END
test_expect_success 'B: accept branch name "TEMP_TAG"' '
INPUT_END
test_expect_success 'B: accept branch name "TEMP_TAG"' '
+ test_when_finished "rm -f .git/TEMP_TAG
+ git gc
+ git prune" &&
git fast-import <input &&
test -f .git/TEMP_TAG &&
test `git rev-parse master` = `git rev-parse TEMP_TAG^`
'
git fast-import <input &&
test -f .git/TEMP_TAG &&
test `git rev-parse master` = `git rev-parse TEMP_TAG^`
'
-rm -f .git/TEMP_TAG
-
-git gc 2>/dev/null >/dev/null
-git prune 2>/dev/null >/dev/null
cat >input <<INPUT_END
commit refs/heads/empty-committer-1
cat >input <<INPUT_END
commit refs/heads/empty-committer-1
@@
-376,15
+375,14
@@
empty commit
COMMIT
INPUT_END
test_expect_success 'B: accept empty committer' '
COMMIT
INPUT_END
test_expect_success 'B: accept empty committer' '
+ test_when_finished "git update-ref -d refs/heads/empty-committer-1
+ git gc
+ git prune" &&
git fast-import <input &&
out=$(git fsck) &&
echo "$out" &&
test -z "$out"
'
git fast-import <input &&
out=$(git fsck) &&
echo "$out" &&
test -z "$out"
'
-git update-ref -d refs/heads/empty-committer-1 || true
-
-git gc 2>/dev/null >/dev/null
-git prune 2>/dev/null >/dev/null
cat >input <<INPUT_END
commit refs/heads/empty-committer-2
cat >input <<INPUT_END
commit refs/heads/empty-committer-2
@@
-394,15
+392,14
@@
empty commit
COMMIT
INPUT_END
test_expect_success 'B: accept and fixup committer with no name' '
COMMIT
INPUT_END
test_expect_success 'B: accept and fixup committer with no name' '
+ test_when_finished "git update-ref -d refs/heads/empty-committer-2
+ git gc
+ git prune" &&
git fast-import <input &&
out=$(git fsck) &&
echo "$out" &&
test -z "$out"
'
git fast-import <input &&
out=$(git fsck) &&
echo "$out" &&
test -z "$out"
'
-git update-ref -d refs/heads/empty-committer-2 || true
-
-git gc 2>/dev/null >/dev/null
-git prune 2>/dev/null >/dev/null
cat >input <<INPUT_END
commit refs/heads/invalid-committer
cat >input <<INPUT_END
commit refs/heads/invalid-committer
@@
-412,9
+409,9
@@
empty commit
COMMIT
INPUT_END
test_expect_success 'B: fail on invalid committer (1)' '
COMMIT
INPUT_END
test_expect_success 'B: fail on invalid committer (1)' '
+ test_when_finished "git update-ref -d refs/heads/invalid-committer" &&
test_must_fail git fast-import <input
'
test_must_fail git fast-import <input
'
-git update-ref -d refs/heads/invalid-committer || true
cat >input <<INPUT_END
commit refs/heads/invalid-committer
cat >input <<INPUT_END
commit refs/heads/invalid-committer
@@
-424,9
+421,9
@@
empty commit
COMMIT
INPUT_END
test_expect_success 'B: fail on invalid committer (2)' '
COMMIT
INPUT_END
test_expect_success 'B: fail on invalid committer (2)' '
+ test_when_finished "git update-ref -d refs/heads/invalid-committer" &&
test_must_fail git fast-import <input
'
test_must_fail git fast-import <input
'
-git update-ref -d refs/heads/invalid-committer || true
cat >input <<INPUT_END
commit refs/heads/invalid-committer
cat >input <<INPUT_END
commit refs/heads/invalid-committer
@@
-436,9
+433,9
@@
empty commit
COMMIT
INPUT_END
test_expect_success 'B: fail on invalid committer (3)' '
COMMIT
INPUT_END
test_expect_success 'B: fail on invalid committer (3)' '
+ test_when_finished "git update-ref -d refs/heads/invalid-committer" &&
test_must_fail git fast-import <input
'
test_must_fail git fast-import <input
'
-git update-ref -d refs/heads/invalid-committer || true
cat >input <<INPUT_END
commit refs/heads/invalid-committer
cat >input <<INPUT_END
commit refs/heads/invalid-committer
@@
-448,9
+445,9
@@
empty commit
COMMIT
INPUT_END
test_expect_success 'B: fail on invalid committer (4)' '
COMMIT
INPUT_END
test_expect_success 'B: fail on invalid committer (4)' '
+ test_when_finished "git update-ref -d refs/heads/invalid-committer" &&
test_must_fail git fast-import <input
'
test_must_fail git fast-import <input
'
-git update-ref -d refs/heads/invalid-committer || true
cat >input <<INPUT_END
commit refs/heads/invalid-committer
cat >input <<INPUT_END
commit refs/heads/invalid-committer
@@
-460,9
+457,9
@@
empty commit
COMMIT
INPUT_END
test_expect_success 'B: fail on invalid committer (5)' '
COMMIT
INPUT_END
test_expect_success 'B: fail on invalid committer (5)' '
+ test_when_finished "git update-ref -d refs/heads/invalid-committer" &&
test_must_fail git fast-import <input
'
test_must_fail git fast-import <input
'
-git update-ref -d refs/heads/invalid-committer || true
###
### series C
###
### series C
@@
-914,6
+911,7
@@
g/b/h
EOF
test_expect_success 'L: nested tree copy does not corrupt deltas' '
EOF
test_expect_success 'L: nested tree copy does not corrupt deltas' '
+ test_when_finished "git update-ref -d refs/heads/L2" &&
git fast-import <input &&
git ls-tree L2 g/b/ >tmp &&
cat tmp | cut -f 2 >actual &&
git fast-import <input &&
git ls-tree L2 g/b/ >tmp &&
cat tmp | cut -f 2 >actual &&
@@
-921,8
+919,6
@@
test_expect_success 'L: nested tree copy does not corrupt deltas' '
git fsck `git rev-parse L2`
'
git fsck `git rev-parse L2`
'
-git update-ref -d refs/heads/L2
-
###
### series M
###
###
### series M
###