threads / patch / 47184

patchbisect run: die if no command is given

Subject: [PATCH] bisect run: die if no command is given

## tl;dr

2 messages between Nov 12, 2017 and Nov 13, 2017. Diffs are folded; open one to read it.

replies: 1people: 2as markdown or json

Stephan Beyer· Nov 12, 2017, 20:55 UTC · lore

It was possible to invoke "git bisect run" without any command. This considers all commits as good commits since "$@"'s return value for empty $@ is 0.

This is most probably not what a user wants (otherwise she would invoke "git bisect run true"), so not providing a command now results in an error.

Signed-off-by: Stephan Beyer <s-beyer@gmx.net>
---
 git-bisect.sh | 2 ++
 1 file changed, 2 insertions(+)
Show changes to git-bisect.sh +2 −0
diff --git a/git-bisect.sh b/git-bisect.sh
index 0138a8860..a69e43656 100755
--- a/git-bisect.sh
+++ b/git-bisect.sh
@@ -450,6 +450,8 @@ bisect_replay () {
 bisect_run () {
 	bisect_next_check fail
 
+	test -n "$*" || die "$(gettext "bisect run failed: no command provided.")"
+
 	while true
 	do
 		command="$@"
-- 
2.15.0.165.g0dc13a7db.dirty
Junio C Hamano· Nov 13, 2017, 03:59 UTC · re: Stephan Beyer · lore

Re: [PATCH] bisect run: die if no command is given

Stephan Beyer <s-beyer@gmx.net> writes:
Show 10 quoted lines
> It was possible to invoke "git bisect run" without any command.
> This considers all commits as good commits since "$@"'s return
> value for empty $@ is 0.
>
> This is most probably not what a user wants (otherwise she would
> invoke "git bisect run true"), so not providing a command now
> results in an error.
>
> Signed-off-by: Stephan Beyer <s-beyer@gmx.net>
> ---
Makes sense to me.  Thanks, will queue.
Show 16 quoted lines
>  git-bisect.sh | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/git-bisect.sh b/git-bisect.sh
> index 0138a8860..a69e43656 100755
> --- a/git-bisect.sh
> +++ b/git-bisect.sh
> @@ -450,6 +450,8 @@ bisect_replay () {
>  bisect_run () {
>  	bisect_next_check fail
>  
> +	test -n "$*" || die "$(gettext "bisect run failed: no command provided.")"
> +
>  	while true
>  	do
>  		command="$@"

← back to recent threads