aboutsummaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorChristian Couder <chriscool@tuxfamily.org>2008-04-12 07:53:59 +0200
committerJunio C Hamano <gitster@pobox.com>2008-04-11 23:54:45 -0700
commite3389075c6160c46cf0e2a443deab1966628ed57 (patch)
tree6bde0483f777a8abcc86831997f661c599517adb /t
parenta710522bfc9ae6e27ce4bea573d1d223af6a6f8e (diff)
downloadgit-e3389075c6160c46cf0e2a443deab1966628ed57.tar.gz
git-e3389075c6160c46cf0e2a443deab1966628ed57.tar.xz
bisect: fix bad rev checking in "git bisect good"
It seems that "git bisect good" and "git bisect skip" have never properly checked arguments that have been passed to them. As soon as one of them can be parsed as a SHA1, no error or warning would be given. This is because 'git rev-parse --revs-only --no-flags "$@"' always "exit 0" and outputs all the SHA1 it can found from parsing "$@". This patch fix this by using, for each "bisect good" argument, the same logic as for the "bisect bad" argument. While at it, this patch teaches "bisect bad" to give a meaningfull error message when it is passed more than one argument. Note that if "git bisect good" or "git bisect skip" is given some proper revs and then something that is not a proper rev, then the first proper revs will still have been marked as "good" or "skip". Signed-off-by: Christian Couder <chriscool@tuxfamily.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't')
-rwxr-xr-xt/t6030-bisect-porcelain.sh13
1 files changed, 13 insertions, 0 deletions
diff --git a/t/t6030-bisect-porcelain.sh b/t/t6030-bisect-porcelain.sh
index 4908e878f..dc87f1355 100755
--- a/t/t6030-bisect-porcelain.sh
+++ b/t/t6030-bisect-porcelain.sh
@@ -71,6 +71,19 @@ test_expect_success 'bisect start with one bad and good' '
git bisect next
'
+test_expect_success 'bisect good and bad fails if not given only revs' '
+ git bisect reset &&
+ git bisect start &&
+ test_must_fail git bisect good foo $HASH1 &&
+ test_must_fail git bisect good $HASH1 bar &&
+ test_must_fail git bisect bad frotz &&
+ test_must_fail git bisect bad $HASH3 $HASH4 &&
+ test_must_fail git bisect skip bar $HASH3 &&
+ test_must_fail git bisect skip $HASH1 foo &&
+ git bisect good $HASH1 &&
+ git bisect bad $HASH4
+'
+
test_expect_success 'bisect reset: back in the master branch' '
git bisect reset &&
echo "* master" > branch.expect &&