git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christian Couder <chriscool@tuxfamily.org>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org, John Tapsell <johnflux@gmail.com>,
	Johannes Schindelin <Johannes.Schindelin@gmx.de>
Subject: [PATCH] bisect: avoid pipes to better catch "git rev-list" errors
Date: Sun, 29 Mar 2009 11:58:32 +0200	[thread overview]
Message-ID: <20090329115832.28acd74e.chriscool@tuxfamily.org> (raw)

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

             reply	other threads:[~2009-03-29 10:01 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-29  9:58 Christian Couder [this message]
2009-04-10  0:34 ` [PATCH] bisect: avoid pipes to better catch "git rev-list" errors Nanako Shiraishi
2009-04-11  0:52   ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090329115832.28acd74e.chriscool@tuxfamily.org \
    --to=chriscool@tuxfamily.org \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=johnflux@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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 NNTP newsgroup(s).