提交 8232dc42 编写于 作者: S Shawn O. Pearce

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: NShawn O. Pearce <spearce@spearce.org>
上级 50aee995
...@@ -7,6 +7,16 @@ test_description='test git-fast-import utility' ...@@ -7,6 +7,16 @@ test_description='test git-fast-import utility'
. ./test-lib.sh . ./test-lib.sh
. ../diff-lib.sh ;# test-lib chdir's into trash . ../diff-lib.sh ;# test-lib chdir's into trash
file2_data='file2
second line of EOF'
file3_data='EOF
in 3rd file
END'
file4_data=abcd
file4_len=4
### ###
### series A ### series A
### ###
...@@ -16,22 +26,19 @@ cat >input <<INPUT_END ...@@ -16,22 +26,19 @@ cat >input <<INPUT_END
blob blob
mark :2 mark :2
data <<EOF data <<EOF
file2 $file2_data
second line of EOF
EOF EOF
blob blob
mark :3 mark :3
data <<END data <<END
EOF $file3_data
in 3rd file
END
END END
blob blob
mark :4 mark :4
data 4 data $file4_len
abcd $file4_data
commit refs/heads/master commit refs/heads/master
mark :5 mark :5
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
...@@ -73,24 +80,17 @@ test_expect_success \ ...@@ -73,24 +80,17 @@ test_expect_success \
'git-cat-file -p master^{tree} | sed "s/ [0-9a-f]* / /" >actual && 'git-cat-file -p master^{tree} | sed "s/ [0-9a-f]* / /" >actual &&
diff -u expect actual' diff -u expect actual'
cat >expect <<EOF echo "$file2_data" >expect
file2
second line of EOF
EOF
test_expect_success \ test_expect_success \
'A: verify file2' \ 'A: verify file2' \
'git-cat-file blob master:file2 >actual && diff -u expect actual' 'git-cat-file blob master:file2 >actual && diff -u expect actual'
cat >expect <<END echo "$file3_data" >expect
EOF
in 3rd file
END
END
test_expect_success \ test_expect_success \
'A: verify file3' \ 'A: verify file3' \
'git-cat-file blob master:file3 >actual && diff -u expect actual' 'git-cat-file blob master:file3 >actual && diff -u expect actual'
printf abcd >expect printf "$file4_data" >expect
test_expect_success \ test_expect_success \
'A: verify file4' \ 'A: verify file4' \
'git-cat-file blob master:file4 >actual && diff -u expect actual' 'git-cat-file blob master:file4 >actual && diff -u expect actual'
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册