Skip to contentSkip to conversation

t9001, t9116: avoid pipes

PATCH New Johannes Schindelin via GitGitGadget 1 participant 1 message Feb 14, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 t9001, t9116: avoid pipes

From: Johannes Schindelin <[email protected]>

When grepping through the output of a command in the test suite, there is always a chance that something goes wrong, in which case there would not be anything useful to debug.

Let's redirect the output into a file instead, and grep that file, so that the log can be inspected easily if the grep fails.

---
Avoid pipes in git-svn tests

This is one more of those patches that convert the pattern a | b to a >file && b<file so that failures in a are caught, too.

Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-709%2Fdscho%2Favoid-pipes-in-svn-tests-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-709/dscho/avoid-pipes-in-svn-tests-v1
Pull-Request: https://github.com/git/git/pull/709

 t/t9001-send-email.sh  |  4 ++--
 t/t9116-git-svn-log.sh | 12 ++++++++----
 2 files changed, 10 insertions(+), 6 deletions(-)
t/t9001-send-email.sh +2 -2
index a834afab4d7..90f61c34009 100755
@@ -1194,8 +1194,8 @@ test_expect_success $PREREQ 'in-reply-to but no threading' '
 		[email protected] \
 		--in-reply-to="<[email protected]>" \
 		--no-thread \
-		$patches |
-	grep "In-Reply-To: <[email protected]>"
+		$patches >out &&
+	grep "In-Reply-To: <[email protected]>" out
 '
 
 test_expect_success $PREREQ 'no in-reply-to and no threading' '
t/t9116-git-svn-log.sh +8 -4
index 45773ee560d..0a9f1ef366d 100755
@@ -43,14 +43,18 @@ test_expect_success 'setup repository and import' '
 
 test_expect_success 'run log' "
 	git reset --hard origin/a &&
-	git svn log -r2 origin/trunk | grep ^r2 &&
-	git svn log -r4 origin/trunk | grep ^r4 &&
-	git svn log -r3 | grep ^r3
+	git svn log -r2 origin/trunk >out &&
+	grep ^r2 out &&
+	git svn log -r4 origin/trunk >out &&
+	grep ^r4 out &&
+	git svn log -r3 >out &&
+	grep ^r3 out
 	"
 
 test_expect_success 'run log against a from trunk' "
 	git reset --hard origin/trunk &&
-	git svn log -r3 origin/a | grep ^r3
+	git svn log -r3 origin/a >out &&
+	grep ^r3 out
 	"
 
 printf 'r1 \nr2 \nr4 \n' > expected-range-r1-r2-r4

base-commit: d8437c57fa0752716dde2d3747e7c22bf7ce2e41

Signature · 1 line
gitgitgadget