# [PATCH 2/2] bisect: string commands emited by "filter_skipped" together with "&&"

2 messages from 2009-02-27 to 2009-02-27. Participants: Christian Couder, Junio C Hamano.
Thread: https://gitlist.dev/t/18041

## Christian Couder, 2009-02-27 06:31

Subject: [PATCH 2/2] bisect: string commands emited by "filter_skipped" together with "&&"
Message-ID: <20090227073146.6699964f.chriscool@tuxfamily.org>
URL: https://gitlist.dev/e/20090227073146.6699964f.chriscool%40tuxfamily.org

```
So that when they are evaled and there is an error, the result from
the eval is an error.

This way we should be protected from errors in the output emited by
"filter_skipped".

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
---
 git-bisect.sh |   29 ++++++++++++++++-------------
 1 files changed, 16 insertions(+), 13 deletions(-)

diff --git a/git-bisect.sh b/git-bisect.sh
index a9324b2..08e31d6 100755
--- a/git-bisect.sh
+++ b/git-bisect.sh
@@ -296,14 +296,14 @@ filter_skipped() {
 	do
 		case "$VARS,$FOUND,$TRIED,$hash" in
 			# We display some vars.
-			1,*,*,*) echo "$hash $line" ;;
+			1,*,*,*) echo "$hash $line &&" ;;
 
 			# Split line.
 			,*,*,---*) ;;
 
 			# We had nothing to search.
 			,,,bisect_rev*)
-				echo "bisect_rev="
+				echo "bisect_rev= &&"
 				VARS=1
 				;;
 
@@ -311,7 +311,7 @@ filter_skipped() {
 			# This should happen only if the "bad"
 			# commit is also a "skip" commit.
 			,,*,bisect_rev*)
-				echo "bisect_rev='$TRIED'"
+				echo "bisect_rev='$TRIED' &&"
 				VARS=1
 				;;
 
@@ -321,8 +321,8 @@ filter_skipped() {
 				case "$_skip" in
 				*$hash*) ;;
 				*)
-					echo "bisect_rev=$hash"
-					echo "bisect_tried='$TRIED'"
+					echo "bisect_rev=$hash &&"
+					echo "bisect_tried='$TRIED' &&"
 					FOUND=1
 					;;
 				esac
@@ -332,16 +332,19 @@ filter_skipped() {
 			,1,*,bisect_rev*) VARS=1 ;;
 			,1,*,*) ;;
 
-			# ???
-			*) die "filter_skipped error " \
-			    "VARS: '$VARS' " \
-			    "FOUND: '$FOUND' " \
-			    "TRIED: '$TRIED' " \
-			    "hash: '$hash' " \
-			    "line: '$line'"
-			;;
+			# Unexpected input
+			*)
+				echo "die 'filter_skipped error'"
+				die "filter_skipped error " \
+				    "VARS: '$VARS' " \
+				    "FOUND: '$FOUND' " \
+				    "TRIED: '$TRIED' " \
+				    "hash: '$hash' " \
+				    "line: '$line'"
+				;;
 		esac
 	done
+	echo ':'
 }
 
 exit_if_skipped_commits () {
-- 
1.6.2.rc1.257.g6c75

```

## Junio C Hamano, 2009-02-27 07:01

Subject: Re: [PATCH 2/2] bisect: string commands emited by "filter_skipped" together with "&&"
Message-ID: <7v4oygnz29.fsf@gitster.siamese.dyndns.org>
URL: https://gitlist.dev/e/7v4oygnz29.fsf%40gitster.siamese.dyndns.org
In-Reply-To: <20090227073146.6699964f.chriscool@tuxfamily.org>

```
Christian Couder <chriscool@tuxfamily.org> writes:

> diff --git a/git-bisect.sh b/git-bisect.sh
> index a9324b2..08e31d6 100755
> --- a/git-bisect.sh
> +++ b/git-bisect.sh
> @@ -296,14 +296,14 @@ filter_skipped() {
>  	do
> ...
>  	done
> +	echo ':'

Is there a particular reason you moved this echo ':' out of the downstream
of the pipe as I wrote in my response?

It logically belongs to the downstream in this pattern:

        producer of the list of items | {
                preparatory steps
                while read one item
                do
                        process one item
                        echo "something &&"
                done
                echo ":" ;# to conclude the && chain
        }

But you changed it to:

        preparatory step that does not concern producer

        producer of the list of items |
                while read one item
                do
                        process one item
                        echo "something &&"
                done

        echo ":"

which looks to me a lot less logical code structure.

```
