git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH] bisect run: die if no command is given
@ 2017-11-12 20:55 Stephan Beyer
  2017-11-13  3:59 ` Junio C Hamano
  0 siblings, 1 reply; 2+ messages in thread
From: Stephan Beyer @ 2017-11-12 20:55 UTC (permalink / raw)
  To: git; +Cc: Stephan Beyer, Christian Couder, Junio C Hamano

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(+)

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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] bisect run: die if no command is given
  2017-11-12 20:55 [PATCH] bisect run: die if no command is given Stephan Beyer
@ 2017-11-13  3:59 ` Junio C Hamano
  0 siblings, 0 replies; 2+ messages in thread
From: Junio C Hamano @ 2017-11-13  3:59 UTC (permalink / raw)
  To: Stephan Beyer; +Cc: git, Christian Couder

Stephan Beyer <s-beyer@gmx.net> writes:

> 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.

>  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="$@"

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-11-13  3:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-12 20:55 [PATCH] bisect run: die if no command is given Stephan Beyer
2017-11-13  3:59 ` Junio C Hamano

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).