From ee831f7ddfc40e9144208c93e24d20ff0ad69194 Mon Sep 17 00:00:00 2001 From: Gerrit Pape Date: Mon, 5 May 2008 07:43:00 +0000 Subject: git-bisect.sh: don't accidentally override existing branch "bisect" If a branch named "bisect" or "new-bisect" already was created in the repo by other means than git bisect, doing a git bisect used to override the branch without a warning. Now if the branch "bisect" or "new-bisect" already exists, and it was not created by git bisect itself, git bisect start fails with an appropriate error message. Additionally, if checking out a new bisect state fails due to a merge problem, git bisect cleans up the temporary branch "new-bisect". The accidental override has been noticed by Andres Salomon, reported through http://bugs.debian.org/478647 Signed-off-by: Gerrit Pape Signed-off-by: Junio C Hamano --- t/t6030-bisect-porcelain.sh | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 't') diff --git a/t/t6030-bisect-porcelain.sh b/t/t6030-bisect-porcelain.sh index 5e3e5445c..05f1e15c3 100755 --- a/t/t6030-bisect-porcelain.sh +++ b/t/t6030-bisect-porcelain.sh @@ -284,6 +284,24 @@ test_expect_success 'bisect starting with a detached HEAD' ' ' +test_expect_success 'bisect refuses to start if branch bisect exists' ' + git bisect reset && + git branch bisect && + test_must_fail git bisect start && + git branch -d bisect && + git checkout -b bisect && + test_must_fail git bisect start && + git checkout master && + git branch -d bisect +' + +test_expect_success 'bisect refuses to start if branch new-bisect exists' ' + git bisect reset && + git branch new-bisect && + test_must_fail git bisect start && + git branch -d new-bisect +' + # # test_done -- cgit v1.2.1 From 42ba5ee776c00369ca72b76537ae622611a7b545 Mon Sep 17 00:00:00 2001 From: Christian Couder Date: Wed, 7 May 2008 23:54:28 +0200 Subject: bisect: print an error message when "git rev-list --bisect-vars" fails Before this patch no error was printed when "git rev-list --bisect-vars" failed. This can happen when bad and good revs are mistaken. This patch prints an error message on stderr that describe the likely failure cause. Signed-off-by: Christian Couder Signed-off-by: Junio C Hamano --- t/t6030-bisect-porcelain.sh | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 't') diff --git a/t/t6030-bisect-porcelain.sh b/t/t6030-bisect-porcelain.sh index 05f1e15c3..933f56798 100755 --- a/t/t6030-bisect-porcelain.sh +++ b/t/t6030-bisect-porcelain.sh @@ -302,6 +302,13 @@ test_expect_success 'bisect refuses to start if branch new-bisect exists' ' git branch -d new-bisect ' +test_expect_success 'bisect errors out if bad and good are mistaken' ' + git bisect reset && + test_must_fail git bisect start $HASH2 $HASH4 2> rev_list_error && + grep "mistake good and bad" rev_list_error && + git bisect reset +' + # # test_done -- cgit v1.2.1