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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

Cc: Shawn O. Pearce <spearce@xxxxxxxxxxx>
Signed-off-by: Jonathan Nieder <jrnieder@xxxxxxxxx>
---
 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

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]