Reduce value duplication in t9300-fast-import.
It is error prone to list the value of each file twice, instead we should list the value only once early in the script and reuse the shell variable when we need to access it. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Shawn O. Pearce committed
Jan 18, 2007 at 14:49 UTC
8232dc427fb4b92b38e74e9e93b52231a67e354f
1 file changed
+17
-17
t/t9300-fast-import.sh
+17
-17
@@ -7,6 +7,16 @@ test_description='test git-fast-import utility'
7
. ./test-lib.sh
8
. ../diff-lib.sh ;# test-lib chdir's into trash
9
10
+file2_data='file2
11
+second line of EOF'
12
+
13
+file3_data='EOF
14
+in 3rd file
15
+ END'
16
+
17
+file4_data=abcd
18
+file4_len=4
19
+
20
###
21
### series A
22
###
@@ -16,22 +26,19 @@ cat >input <<INPUT_END
26
blob
27
mark :2
28
data <<EOF
19
-file2
20
-second line of EOF
29
+$file2_data
30
EOF
31
32
blob
33
mark :3
34
data <<END
26
-EOF
27
-in 3rd file
28
- END
35
+$file3_data
36
END
37
38
blob
39
mark :4
33
-data 4
34
-abcd
40
+data $file4_len
41
+$file4_data
42
commit refs/heads/master
43
mark :5
44
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
@@ -73,24 +80,17 @@ test_expect_success \
80
'git-cat-file -p master^{tree} | sed "s/ [0-9a-f]* / /" >actual &&
81
diff -u expect actual'
82
76
-cat >expect <<EOF
77
-file2
78
-second line of EOF
79
-EOF
83
+echo "$file2_data" >expect
84
test_expect_success \
85
'A: verify file2' \
86
'git-cat-file blob master:file2 >actual && diff -u expect actual'
87
84
-cat >expect <<END
85
-EOF
86
-in 3rd file
87
- END
88
-END
88
+echo "$file3_data" >expect
89
test_expect_success \
90
'A: verify file3' \
91
'git-cat-file blob master:file3 >actual && diff -u expect actual'
92
93
-printf abcd >expect
93
+printf "$file4_data" >expect
94
test_expect_success \
95
'A: verify file4' \
96
'git-cat-file blob master:file4 >actual && diff -u expect actual'