diff options
author | Christian Couder <chriscool@tuxfamily.org> | 2008-04-12 07:53:59 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2008-04-11 23:54:45 -0700 |
commit | e3389075c6160c46cf0e2a443deab1966628ed57 (patch) | |
tree | 6bde0483f777a8abcc86831997f661c599517adb /git-bisect.sh | |
parent | a710522bfc9ae6e27ce4bea573d1d223af6a6f8e (diff) | |
download | git-e3389075c6160c46cf0e2a443deab1966628ed57.tar.gz |
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 'git-bisect.sh')
-rwxr-xr-x | git-bisect.sh | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/git-bisect.sh b/git-bisect.sh index f8857747c4..c8be9f7e8a 100755 --- a/git-bisect.sh +++ b/git-bisect.sh @@ -151,20 +151,16 @@ bisect_state() { rev=$(git rev-parse --verify HEAD) || die "Bad rev input: HEAD" bisect_write "$state" "$rev" ;; - 2,bad) - rev=$(git rev-parse --verify "$2^{commit}") || - die "Bad rev input: $2" - bisect_write "$state" "$rev" ;; - *,good|*,skip) + 2,bad|*,good|*,skip) shift - revs=$(git rev-parse --revs-only --no-flags "$@") && - test '' != "$revs" || die "Bad rev input: $@" - for rev in $revs + for rev in "$@" do rev=$(git rev-parse --verify "$rev^{commit}") || - die "Bad rev commit: $rev^{commit}" + die "Bad rev input: $rev" bisect_write "$state" "$rev" done ;; + *,bad) + die "'git bisect bad' can take only one argument." ;; *) usage ;; esac |