git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] bisect: avoid pipes to better catch "git rev-list" errors

From
Christian Couder <chriscool@tuxfamily.org>
Date
Mar 29, 2009, 09:58 UTC
Message-ID
<20090329115832.28acd74e.chriscool@tuxfamily.org>
When doing:
eval "git rev-list --bisect-vars ..." | {
        while read line
        do
                echo "$line &&"
        done
        echo ':'
}

the result code comes from the last "echo ':'", not from running "git rev-list --bisect-vars ...".

This means that we may miss errors from "git rev-list".

To fix that, this patch gets rid of the pipes by redirecting the output of "git rev-list" into a file, and then reading from this file.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
---
 git-bisect.sh |   16 ++++++++++------
 1 files changed, 10 insertions(+), 6 deletions(-)
This applies to master.
diff --git a/git-bisect.sh b/git-bisect.sh
index e313bde..45214ca 100755
--- a/git-bisect.sh
+++ b/git-bisect.sh
@@ -284,19 +284,22 @@ filter_skipped() {
 	_skip="$2"
 
 	if [ -z "$_skip" ]; then
-		eval "$_eval" | {
+		eval "$_eval" > "$GIT_DIR/BISECT_EVAL_TMP" &&
+		{
 			while read line
 			do
 				echo "$line &&"
-			done
+			done < "$GIT_DIR/BISECT_EVAL_TMP" &&
 			echo ':'
-		}
+		} &&
+		rm -f "$GIT_DIR/BISECT_EVAL_TMP"
 		return
 	fi
 
 	# Let's parse the output of:
 	# "git rev-list --bisect-vars --bisect-all ..."
-	eval "$_eval" | {
+	eval "$_eval" > "$GIT_DIR/BISECT_EVAL_TMP" &&
+	{
 		VARS= FOUND= TRIED=
 		while read hash line
 		do
@@ -349,9 +352,10 @@ filter_skipped() {
 				    "line: '$line'"
 				;;
 			esac
-		done
+		done < "$GIT_DIR/BISECT_EVAL_TMP" &&
 		echo ':'
-	}
+	} &&
+	rm -f "$GIT_DIR/BISECT_EVAL_TMP"
 }
 
 exit_if_skipped_commits () {
-- 
1.6.2.1.404.gb0085.dirty
Next: Nanako Shiraishi
Message 1 of 3 in “bisect: avoid pipes to better catch "git rev-list" errors”
  1. bisect: avoid pipes to better catch "git rev-list" errorsChristian Couder, Mar 29, 2009
  2. Nanako ShiraishiApr 10, 2009
  3. Junio C HamanoApr 11, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.