Subject: [PATCH 05/24] t9300 (fast-import): check exit status from command substitutions

From: Jonathan Nieder <[email-masked]>
Date: Fri, 24 Sep 2010 02:11:56 -0500

If "git rev-parse" starts to crash or misbehave, we want to
notice.

Cc: Shawn O. Pearce <[email-masked]>
Signed-off-by: Jonathan Nieder <[email-masked]>
---
 t/t9300-fast-import.sh |   34 +++++++++++++++++++++-------------
 1 files changed, 21 insertions(+), 13 deletions(-)

diff --git a/t/t9300-fast-import.sh b/t/t9300-fast-import.sh
index 47339a3..c113ddf 100755
--- a/t/t9300-fast-import.sh
+++ b/t/t9300-fast-import.sh
@@ -127,24 +127,32 @@ test_expect_success \
 	'A: verify file4' \
 	'git cat-file blob master:file4 >actual && test_cmp expect actual'
 
-cat >expect <<EOF
-object $(git rev-parse refs/heads/master)
-type commit
-tag series-A
-
-An annotated tag without a tagger
-EOF
 test_expect_success 'A: verify tag/series-A' '
+	master=$(git rev-parse --verify refs/heads/master) &&
+	cat >expect <<-EOF &&
+	object $master
+	type commit
+	tag series-A
+
+	An annotated tag without a tagger
+	EOF
 	git cat-file tag tags/series-A >actual &&
 	test_cmp expect actual
 '
 
-cat >expect <<EOF
-:2 `git rev-parse --verify master:file2`
-:3 `git rev-parse --verify master:file3`
-:4 `git rev-parse --verify master:file4`
-:5 `git rev-parse --verify master^0`
-EOF
+test_expect_success 'setup: compute expected marks' '
+	{
+		printf ":2 " &&
+		git rev-parse --verify master:file2 &&
+		printf ":3 " &&
+		git rev-parse --verify master:file3 &&
+		printf ":4 " &&
+		git rev-parse --verify master:file4 &&
+		printf ":5 " &&
+		git rev-parse --verify master^0
+	} >expect
+'
+
 test_expect_success \
 	'A: verify marks output' \
 	'test_cmp expect marks.out'
-- 
1.7.2.3