threads / patch / 18041

patch, 2 partsbisect: string commands emited by "filter_skipped" together with "&&"

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

## tl;dr

2 messages between Feb 27, 2009 and Feb 27, 2009. Diffs are folded; open one to read it.

replies: 1people: 2as markdown or json

Christian Couder· Feb 27, 2009, 06:31 UTC · lore

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(-)
Show changes to git-bisect.sh +16 −13
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· Feb 27, 2009, 07:01 UTC · re: Christian Couder · lore

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

Christian Couder <chriscool@tuxfamily.org> writes:
Show 9 quoted lines
> 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.

← back to recent threads