Revision 89a70b80ebabd237bb407f9321f24677f4f1d16d authored by Johannes Schindelin on 03 January 2018, 16:54:54 UTC, committed by Junio C Hamano on 03 January 2018, 23:55:50 UTC
When cleaning up files in the $HOME directory, it really makes sense to quote the path, especially in Git's test suite, where the HOME directory is *guaranteed* to contain spaces in its name. It would appear that those two tests pass even without cleaning up the files, but really more by pure chance than by design (the cleanup seems not actually to be necessary). However, if anybody would have a left-over `trash/` directory in Git's `t/` directory, these tests would fail, because they would all of a sudden try to delete that directory, but without the `-r` (recursive) flag. That is how this issue was found. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Reviewed-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent 567c53d
t6011-rev-list-with-bad-commit.sh
#!/bin/sh
test_description='git rev-list should notice bad commits'
. ./test-lib.sh
# Note:
# - compression level is set to zero to make "corruptions" easier to perform
# - reflog is disabled to avoid extra references which would twart the test
test_expect_success 'setup' \
'
git init &&
git config core.compression 0 &&
git config core.logallrefupdates false &&
echo "foo" > foo &&
git add foo &&
git commit -m "first commit" &&
echo "bar" > bar &&
git add bar &&
git commit -m "second commit" &&
echo "baz" > baz &&
git add baz &&
git commit -m "third commit" &&
echo "foo again" >> foo &&
git add foo &&
git commit -m "fourth commit" &&
git repack -a -f -d
'
test_expect_success 'verify number of revisions' \
'
revs=$(git rev-list --all | wc -l) &&
test $revs -eq 4 &&
first_commit=$(git rev-parse HEAD~3)
'
test_expect_success 'corrupt second commit object' \
'
perl -i.bak -pe "s/second commit/socond commit/" .git/objects/pack/*.pack &&
test_must_fail git fsck --full
'
test_expect_success 'rev-list should fail' \
'
test_must_fail git rev-list --all > /dev/null
'
test_expect_success 'git repack _MUST_ fail' \
'
test_must_fail git repack -a -f -d
'
test_expect_success 'first commit is still available' \
'
git log $first_commit
'
test_done
![swh spinner](/static/img/swh-spinner.gif)
Computing file changes ...