summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2018-11-13 13:37:20 (GMT)
committerJunio C Hamano <gitster@pobox.com>2018-11-13 13:37:20 (GMT)
commitbce4fc60caca82af9e02983abcbbc348d2aadfe4 (patch)
treed42a084d047ddcd6298cfccb223aa3ba4b3f812f /t
parent5fb9263295b425c7acfde66c8abe5d53fa55d2c3 (diff)
parentaa984dbe5ea51462a826e3697506c41b6c6c43fb (diff)
downloadgit-bce4fc60caca82af9e02983abcbbc348d2aadfe4.zip
git-bce4fc60caca82af9e02983abcbbc348d2aadfe4.tar.gz
git-bce4fc60caca82af9e02983abcbbc348d2aadfe4.tar.bz2
Merge branch 'ab/pack-tests-cleanup'
A couple of tests used to leave the repository in a state that is deliberately corrupt, which have been corrected. * ab/pack-tests-cleanup: index-pack tests: don't leave test repo dirty at end pack-objects tests: don't leave test .git corrupt at end pack-objects test: modernize style
Diffstat (limited to 't')
-rwxr-xr-xt/t1060-object-corruption.sh4
-rwxr-xr-xt/t5300-pack-object.sh47
2 files changed, 28 insertions, 23 deletions
diff --git a/t/t1060-object-corruption.sh b/t/t1060-object-corruption.sh
index ac1f189..4feb651 100755
--- a/t/t1060-object-corruption.sh
+++ b/t/t1060-object-corruption.sh
@@ -117,8 +117,10 @@ test_expect_failure 'clone --local detects misnamed objects' '
'
test_expect_success 'fetch into corrupted repo with index-pack' '
+ cp -R bit-error bit-error-cp &&
+ test_when_finished "rm -rf bit-error-cp" &&
(
- cd bit-error &&
+ cd bit-error-cp &&
test_must_fail git -c transfer.unpackLimit=1 \
fetch ../no-bit-error 2>stderr &&
test_i18ngrep ! -i collision stderr
diff --git a/t/t5300-pack-object.sh b/t/t5300-pack-object.sh
index 6c620cd..410a09b 100755
--- a/t/t5300-pack-object.sh
+++ b/t/t5300-pack-object.sh
@@ -468,29 +468,32 @@ test_expect_success 'pack-objects in too-many-packs mode' '
git fsck
'
-#
-# WARNING!
-#
-# The following test is destructive. Please keep the next
-# two tests at the end of this file.
-#
-
-test_expect_success \
- 'fake a SHA1 hash collision' \
- 'long_a=$(git hash-object a | sed -e "s!^..!&/!") &&
- long_b=$(git hash-object b | sed -e "s!^..!&/!") &&
- test -f .git/objects/$long_b &&
- cp -f .git/objects/$long_a \
- .git/objects/$long_b'
+test_expect_success 'setup: fake a SHA1 hash collision' '
+ git init corrupt &&
+ (
+ cd corrupt &&
+ long_a=$(git hash-object -w ../a | sed -e "s!^..!&/!") &&
+ long_b=$(git hash-object -w ../b | sed -e "s!^..!&/!") &&
+ test -f .git/objects/$long_b &&
+ cp -f .git/objects/$long_a \
+ .git/objects/$long_b
+ )
+'
-test_expect_success \
- 'make sure index-pack detects the SHA1 collision' \
- 'test_must_fail git index-pack -o bad.idx test-3.pack 2>msg &&
- test_i18ngrep "SHA1 COLLISION FOUND" msg'
+test_expect_success 'make sure index-pack detects the SHA1 collision' '
+ (
+ cd corrupt &&
+ test_must_fail git index-pack -o ../bad.idx ../test-3.pack 2>msg &&
+ test_i18ngrep "SHA1 COLLISION FOUND" msg
+ )
+'
-test_expect_success \
- 'make sure index-pack detects the SHA1 collision (large blobs)' \
- 'test_must_fail git -c core.bigfilethreshold=1 index-pack -o bad.idx test-3.pack 2>msg &&
- test_i18ngrep "SHA1 COLLISION FOUND" msg'
+test_expect_success 'make sure index-pack detects the SHA1 collision (large blobs)' '
+ (
+ cd corrupt &&
+ test_must_fail git -c core.bigfilethreshold=1 index-pack -o ../bad.idx ../test-3.pack 2>msg &&
+ test_i18ngrep "SHA1 COLLISION FOUND" msg
+ )
+'
test_done