From: Jon Seymour Date: Sun, 24 Jul 2011 05:57:46 GMT Subject: [PATCH 1/9] bisect: add tests to document expected behaviour in presence of broken trees. Message-ID: <1311487074-25070-2-git-send-email-jon.seymour@gmail.com> In-Reply-To: <1311487074-25070-1-git-send-email-jon.seymour@gmail.com> Signed-off-by: Jon Seymour --- t/t6030-bisect-porcelain.sh | 50 +++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 50 insertions(+), 0 deletions(-) diff --git a/t/t6030-bisect-porcelain.sh b/t/t6030-bisect-porcelain.sh index b5063b6..2c14fb0 100755 --- a/t/t6030-bisect-porcelain.sh +++ b/t/t6030-bisect-porcelain.sh @@ -573,5 +573,55 @@ 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 && + add_line_into_file "5(broken): first line on a broken branch" hello2 && + BROKEN_HASH5=$(git rev-parse --verify HEAD) && + mkdir missing && + :> missing/MISSING && + git add missing/MISSING && + git commit -m "Added file that will be deleted" + BROKEN_HASH6=$(git rev-parse --verify HEAD) && + add_line_into_file "6(broken): second line on a broken branch" hello2 && + BROKEN_HASH7=$(git rev-parse --verify HEAD) && + add_line_into_file "7(broken): third line on a broken branch" hello2 && + BROKEN_HASH8=$(git rev-parse --verify HEAD) && + git rm missing/MISSING && + git commit -m "Remove missing file" + BROKEN_HASH9=$(git rev-parse --verify HEAD) && + rm .git/objects/39/f7e61a724187ab767d2e08442d9b6b9dab587d +' + +echo "" > expected.ok +cat > expected.missing-tree.default < expected.missing-tree.ignored <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 $HASH4 2>error.txt && + git update-ref --no-deref HEAD broken && + test_cmp expected.missing-tree.default error.txt +' + test_done -- 1.7.6.347.g96e0b.dirty