diff options
author | Christian Couder <chriscool@tuxfamily.org> | 2008-05-23 02:39:22 +0400 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2008-05-23 09:24:16 +0400 |
commit | ba963de859e76a63d447345eeb3e134116d02433 (patch) | |
tree | 29b0a9aec6aa7320c1b024f333419695c8ab31e9 /t/t6030-bisect-porcelain.sh | |
parent | 9d0cd91c4e497192e89177847d1511acea5793cd (diff) |
bisect: trap critical errors in "bisect_start"
Before this patch, when using "git bisect start" with mistaken revs
or when the checkout of the branch we want to test failed, we exited
after having written files like ".git/BISECT_START",
".git/BISECT_NAMES" and after having written "refs/bisect/bad" and
"refs/bisect/good-*" refs.
With this patch we trap all errors that can happen when writing the
new state and when we are in "bisect_next". So that we can try to
clean up everything in case of problems, using "bisect_clean_state".
This patch also contains a "bisect_write" cleanup to make it exit
on error and return 0 otherwise.
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t6030-bisect-porcelain.sh')
-rwxr-xr-x | t/t6030-bisect-porcelain.sh | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/t/t6030-bisect-porcelain.sh b/t/t6030-bisect-porcelain.sh index 68b5440917..c4f074d738 100755 --- a/t/t6030-bisect-porcelain.sh +++ b/t/t6030-bisect-porcelain.sh @@ -147,7 +147,7 @@ test_expect_success 'bisect start: no ".git/BISECT_START" if junk rev' ' test_must_fail test -e .git/BISECT_START ' -test_expect_failure 'bisect start: no ".git/BISECT_START" if mistaken rev' ' +test_expect_success 'bisect start: no ".git/BISECT_START" if mistaken rev' ' git bisect start $HASH4 $HASH1 -- && git bisect good && test_must_fail git bisect start $HASH1 $HASH4 -- && @@ -156,19 +156,17 @@ test_expect_failure 'bisect start: no ".git/BISECT_START" if mistaken rev' ' test_must_fail test -e .git/BISECT_START ' -test_expect_failure 'bisect start: no ".git/BISECT_START" if checkout error' ' +test_expect_success 'bisect start: no ".git/BISECT_START" if checkout error' ' echo "temp stuff" > hello && test_must_fail git bisect start $HASH4 $HASH1 -- && git branch && git branch > branch.output && grep "* other" branch.output > /dev/null && test_must_fail test -e .git/BISECT_START && - test -z "$(git for-each-ref "refs/bisect/*")" + test -z "$(git for-each-ref "refs/bisect/*")" && + git checkout HEAD hello ' -# This cleanup is needed whatever the result of the above test. -git checkout HEAD hello - # $HASH1 is good, $HASH4 is bad, we skip $HASH3 # but $HASH2 is bad, # so we should find $HASH2 as the first bad commit |