bisect: add tests to document expected behaviour in presence of broken trees.
If the repo is broken, we expect bisect to fail. Signed-off-by: Jon Seymour <jon.seymour@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
6ba7acffdd
commit
d3dfeedf2e
@ -581,5 +581,53 @@ test_expect_success 'erroring out when using bad path parameters' '
|
||||
'
|
||||
|
||||
#
|
||||
# This creates a broken branch which cannot be checked out because
|
||||
# the tree created has been deleted.
|
||||
#
|
||||
# H1-H2-H3-H4-H5-H6-H7 <--other
|
||||
# \
|
||||
# S5-S6'-S7'-S8'-S9 <--broken
|
||||
#
|
||||
# Commits marked with ' have a missing tree.
|
||||
#
|
||||
test_expect_success 'broken branch creation' '
|
||||
git bisect reset &&
|
||||
git checkout -b broken $HASH4 &&
|
||||
git tag BROKEN_HASH4 $HASH4 &&
|
||||
add_line_into_file "5(broken): first line on a broken branch" hello2 &&
|
||||
git tag BROKEN_HASH5 &&
|
||||
mkdir missing &&
|
||||
:> missing/MISSING &&
|
||||
git add missing/MISSING &&
|
||||
git commit -m "6(broken): Added file that will be deleted"
|
||||
git tag BROKEN_HASH6 &&
|
||||
add_line_into_file "7(broken): second line on a broken branch" hello2 &&
|
||||
git tag BROKEN_HASH7 &&
|
||||
add_line_into_file "8(broken): third line on a broken branch" hello2 &&
|
||||
git tag BROKEN_HASH8 &&
|
||||
git rm missing/MISSING &&
|
||||
git commit -m "9(broken): Remove missing file"
|
||||
git tag BROKEN_HASH9 &&
|
||||
rm .git/objects/39/f7e61a724187ab767d2e08442d9b6b9dab587d
|
||||
'
|
||||
|
||||
echo "" > expected.ok
|
||||
cat > expected.missing-tree.default <<EOF
|
||||
fatal: unable to read tree 39f7e61a724187ab767d2e08442d9b6b9dab587d
|
||||
EOF
|
||||
|
||||
test_expect_success 'bisect fails if tree is broken on start commit' '
|
||||
git bisect reset &&
|
||||
test_must_fail git bisect start BROKEN_HASH7 BROKEN_HASH4 2>error.txt &&
|
||||
test_cmp expected.missing-tree.default error.txt
|
||||
'
|
||||
|
||||
test_expect_success 'bisect fails if tree is broken on trial commit' '
|
||||
git bisect reset &&
|
||||
test_must_fail git bisect start BROKEN_HASH9 BROKEN_HASH4 2>error.txt &&
|
||||
git reset --hard broken &&
|
||||
git checkout broken &&
|
||||
test_cmp expected.missing-tree.default error.txt
|
||||
'
|
||||
|
||||
test_done
|
||||
|
Loading…
Reference in New Issue
Block a user