test: avoid pipes in git related commands for test
Avoid using pipes downstream of Git commands since the exit codes of commands upstream of pipes get swallowed, thus potentially hiding failure of those commands. Instead, capture Git command output to a file and apply the downstream command(s) to that file. Signed-off-by: Pratik Karki <predatoramigo@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Pratik Karki committed
Mar 27, 2018 at 23:16 UTC
a4d4e32a700df92ca576ce89110c075b8ce6da75
15 files changed
+179
-159
t/t5300-pack-object.sh
+4
-4
@@ -311,8 +311,8 @@ test_expect_success 'unpacking with --strict' '
311
rm -f .git/index &&
312
tail -n 10 LIST | git update-index --index-info &&
313
ST=$(git write-tree) &&
314
- PACK5=$( git rev-list --objects "$LIST" "$LI" "$ST" | \
315
- git pack-objects test-5 ) &&
314
+ git rev-list --objects "$LIST" "$LI" "$ST" >actual &&
315
+ PACK5=$( git pack-objects test-5 <actual ) &&
316
PACK6=$( (
317
echo "$LIST"
318
echo "$LI"
@@ -358,8 +358,8 @@ test_expect_success 'index-pack with --strict' '
358
rm -f .git/index &&
359
tail -n 10 LIST | git update-index --index-info &&
360
ST=$(git write-tree) &&
361
- PACK5=$( git rev-list --objects "$LIST" "$LI" "$ST" | \
362
- git pack-objects test-5 ) &&
361
+ git rev-list --objects "$LIST" "$LI" "$ST" >actual &&
362
+ PACK5=$( git pack-objects test-5 <actual ) &&
363
PACK6=$( (
364
echo "$LIST"
365
echo "$LI"
t/t5510-fetch.sh
+4
-4
@@ -690,8 +690,8 @@ test_expect_success C_LOCALE_OUTPUT 'fetch aligned output' '
690
test_commit looooooooooooong-tag &&
691
(
692
cd full-output &&
693
- git -c fetch.output=full fetch origin 2>&1 | \
694
- grep -e "->" | cut -c 22- >../actual
693
+ git -c fetch.output=full fetch origin >actual 2>&1 &&
694
+ grep -e "->" actual | cut -c 22- >../actual
695
) &&
696
cat >expect <<-\EOF &&
697
master -> origin/master
@@ -705,8 +705,8 @@ test_expect_success C_LOCALE_OUTPUT 'fetch compact output' '
705
test_commit extraaa &&
706
(
707
cd compact &&
708
- git -c fetch.output=compact fetch origin 2>&1 | \
709
- grep -e "->" | cut -c 22- >../actual
708
+ git -c fetch.output=compact fetch origin >actual 2>&1 &&
709
+ grep -e "->" actual | cut -c 22- >../actual
710
) &&
711
cat >expect <<-\EOF &&
712
master -> origin/*
t/t7001-mv.sh
+10
-12
@@ -21,8 +21,8 @@ test_expect_success \
21
22
test_expect_success \
23
'checking the commit' \
24
- 'git diff-tree -r -M --name-status HEAD^ HEAD | \
25
- grep "^R100..*path0/COPYING..*path1/COPYING"'
24
+ 'git diff-tree -r -M --name-status HEAD^ HEAD >actual &&
25
+ grep "^R100..*path0/COPYING..*path1/COPYING" actual'
26
27
test_expect_success \
28
'moving the file back into subdirectory' \
@@ -35,8 +35,8 @@ test_expect_success \
35
36
test_expect_success \
37
'checking the commit' \
38
- 'git diff-tree -r -M --name-status HEAD^ HEAD | \
39
- grep "^R100..*path1/COPYING..*path0/COPYING"'
38
+ 'git diff-tree -r -M --name-status HEAD^ HEAD >actual &&
39
+ grep "^R100..*path1/COPYING..*path0/COPYING" actual'
40
41
test_expect_success \
42
'mv --dry-run does not move file' \
@@ -122,10 +122,9 @@ test_expect_success \
122
123
test_expect_success \
124
'checking the commit' \
125
- 'git diff-tree -r -M --name-status HEAD^ HEAD | \
126
- grep "^R100..*path0/COPYING..*path2/COPYING" &&
127
- git diff-tree -r -M --name-status HEAD^ HEAD | \
128
- grep "^R100..*path0/README..*path2/README"'
125
+ 'git diff-tree -r -M --name-status HEAD^ HEAD >actual &&
126
+ grep "^R100..*path0/COPYING..*path2/COPYING" actual &&
127
+ grep "^R100..*path0/README..*path2/README" actual'
128
129
test_expect_success \
130
'succeed when source is a prefix of destination' \
@@ -141,10 +140,9 @@ test_expect_success \
140
141
test_expect_success \
142
'checking the commit' \
144
- 'git diff-tree -r -M --name-status HEAD^ HEAD | \
145
- grep "^R100..*path2/COPYING..*path1/path2/COPYING" &&
146
- git diff-tree -r -M --name-status HEAD^ HEAD | \
147
- grep "^R100..*path2/README..*path1/path2/README"'
143
+ 'git diff-tree -r -M --name-status HEAD^ HEAD >actual &&
144
+ grep "^R100..*path2/COPYING..*path1/path2/COPYING" actual &&
145
+ grep "^R100..*path2/README..*path1/path2/README" actual'
146
147
test_expect_success \
148
'do not move directory over existing directory' \
t/t7003-filter-branch.sh
+6
-3
@@ -187,7 +187,8 @@ test_expect_success 'author information is preserved' '
187
test \$GIT_COMMIT != $(git rev-parse master) || \
188
echo Hallo" \
189
preserved-author) &&
190
- test 1 = $(git rev-list --author="B V Uips" preserved-author | wc -l)
190
+ git rev-list --author="B V Uips" preserved-author >actual &&
191
+ test_line_count = 1 actual
192
'
193
194
test_expect_success "remove a certain author's commits" '
@@ -205,7 +206,8 @@ test_expect_success "remove a certain author's commits" '
206
cnt1=$(git rev-list master | wc -l) &&
207
cnt2=$(git rev-list removed-author | wc -l) &&
208
test $cnt1 -eq $(($cnt2 + 1)) &&
208
- test 0 = $(git rev-list --author="B V Uips" removed-author | wc -l)
209
+ git rev-list --author="B V Uips" removed-author >actual &&
210
+ test_line_count = 0 actual
211
'
212
213
test_expect_success 'barf on invalid name' '
@@ -258,7 +260,8 @@ test_expect_success 'Subdirectory filter with disappearing trees' '
260
git commit -m "Re-adding foo" &&
261
262
git filter-branch -f --subdirectory-filter foo &&
261
- test $(git rev-list master | wc -l) = 3
263
+ git rev-list master >actual &&
264
+ test_line_count = 3 actual
265
'
266
267
test_expect_success 'Tag name filtering retains tag message' '
t/t9104-git-svn-follow-parent.sh
+9
-7
@@ -33,8 +33,8 @@ test_expect_success 'init and fetch a moved directory' '
33
git svn fetch -i thunk &&
34
test "$(git rev-parse --verify refs/remotes/thunk@2)" \
35
= "$(git rev-parse --verify refs/remotes/thunk~1)" &&
36
- test "$(git cat-file blob refs/remotes/thunk:readme |\
37
- sed -n -e "3p")" = goodbye &&
36
+ git cat-file blob refs/remotes/thunk:readme >actual &&
37
+ test "$(sed -n -e "3p" actual)" = goodbye &&
38
test -z "$(git config --get svn-remote.svn.fetch \
39
"^trunk:refs/remotes/thunk@2$")"
40
'
@@ -48,8 +48,8 @@ test_expect_success 'init and fetch from one svn-remote' '
48
git svn fetch -i svn/thunk &&
49
test "$(git rev-parse --verify refs/remotes/svn/trunk)" \
50
= "$(git rev-parse --verify refs/remotes/svn/thunk~1)" &&
51
- test "$(git cat-file blob refs/remotes/svn/thunk:readme |\
52
- sed -n -e "3p")" = goodbye
51
+ git cat-file blob refs/remotes/svn/thunk:readme >actual &&
52
+ test "$(sed -n -e "3p" actual)" = goodbye
53
'
54
55
test_expect_success 'follow deleted parent' '
@@ -107,7 +107,8 @@ test_expect_success 'follow deleted directory' '
107
git svn init --minimize-url -i glob "$svnrepo"/glob &&
108
git svn fetch -i glob &&
109
test "$(git cat-file blob refs/remotes/glob:blob/bye)" = hi &&
110
- test "$(git ls-tree refs/remotes/glob | wc -l )" -eq 1
110
+ git ls-tree refs/remotes/glob >actual &&
111
+ test_line_count = 1 actual
112
'
113
114
# ref: r9270 of the Subversion repository: (http://svn.collab.net/repos/svn)
@@ -204,8 +205,9 @@ test_expect_success "follow-parent is atomic" '
205
test_expect_success "track multi-parent paths" '
206
svn_cmd cp -m "resurrect /glob" "$svnrepo"/r9270 "$svnrepo"/glob &&
207
git svn multi-fetch &&
207
- test $(git cat-file commit refs/remotes/glob | \
208
- grep "^parent " | wc -l) -eq 2
208
+ git cat-file commit refs/remotes/glob >actual &&
209
+ grep "^parent " actual >actual2 &&
210
+ test_line_count = 2 actual2
211
'
212
213
test_expect_success "multi-fetch continues to work" "
t/t9108-git-svn-glob.sh
+8
-6
@@ -47,8 +47,8 @@ test_expect_success 'test refspec globbing' '
47
git config --add svn-remote.svn.tags\
48
"tags/*/src/a:refs/remotes/tags/*" &&
49
git svn multi-fetch &&
50
- git log --pretty=oneline refs/remotes/tags/end | \
51
- sed -e "s/^.\{41\}//" > output.end &&
50
+ git log --pretty=oneline refs/remotes/tags/end >actual &&
51
+ sed -e "s/^.\{41\}//" actual >output.end &&
52
test_cmp expect.end output.end &&
53
test "$(git rev-parse refs/remotes/tags/end~1)" = \
54
"$(git rev-parse refs/remotes/branches/start)" &&
@@ -75,14 +75,16 @@ test_expect_success 'test left-hand-side only globbing' '
75
svn_cmd commit -m "try to try"
76
) &&
77
git svn fetch two &&
78
- test $(git rev-list refs/remotes/two/tags/end | wc -l) -eq 6 &&
79
- test $(git rev-list refs/remotes/two/branches/start | wc -l) -eq 3 &&
78
+ git rev-list refs/remotes/two/tags/end >actual &&
79
+ test_line_count = 6 actual &&
80
+ git rev-list refs/remotes/two/branches/start >actual &&
81
+ test_line_count = 3 actual &&
82
test $(git rev-parse refs/remotes/two/branches/start~2) = \
83
$(git rev-parse refs/remotes/two/trunk) &&
84
test $(git rev-parse refs/remotes/two/tags/end~3) = \
85
$(git rev-parse refs/remotes/two/branches/start) &&
84
- git log --pretty=oneline refs/remotes/two/tags/end | \
85
- sed -e "s/^.\{41\}//" > output.two &&
86
+ git log --pretty=oneline refs/remotes/two/tags/end >actual &&
87
+ sed -e "s/^.\{41\}//" actual >output.two &&
88
test_cmp expect.two output.two
89
'
90
t/t9109-git-svn-multi-glob.sh
+14
-10
@@ -47,8 +47,8 @@ test_expect_success 'test refspec globbing' '
47
git config --add svn-remote.svn.tags\
48
"tags/*/src/a:refs/remotes/tags/*" &&
49
git svn multi-fetch &&
50
- git log --pretty=oneline refs/remotes/tags/end | \
51
- sed -e "s/^.\{41\}//" > output.end &&
50
+ git log --pretty=oneline refs/remotes/tags/end >actual &&
51
+ sed -e "s/^.\{41\}//" actual >output.end &&
52
test_cmp expect.end output.end &&
53
test "$(git rev-parse refs/remotes/tags/end~1)" = \
54
"$(git rev-parse refs/remotes/branches/v1/start)" &&
@@ -75,14 +75,16 @@ test_expect_success 'test left-hand-side only globbing' '
75
svn_cmd commit -m "try to try"
76
) &&
77
git svn fetch two &&
78
- test $(git rev-list refs/remotes/two/tags/end | wc -l) -eq 6 &&
79
- test $(git rev-list refs/remotes/two/branches/v1/start | wc -l) -eq 3 &&
78
+ git rev-list refs/remotes/two/tags/end >actual &&
79
+ test_line_count = 6 actual &&
80
+ git rev-list refs/remotes/two/branches/v1/start >actual &&
81
+ test_line_count = 3 actual &&
82
test $(git rev-parse refs/remotes/two/branches/v1/start~2) = \
83
$(git rev-parse refs/remotes/two/trunk) &&
84
test $(git rev-parse refs/remotes/two/tags/end~3) = \
85
$(git rev-parse refs/remotes/two/branches/v1/start) &&
84
- git log --pretty=oneline refs/remotes/two/tags/end | \
85
- sed -e "s/^.\{41\}//" > output.two &&
86
+ git log --pretty=oneline refs/remotes/two/tags/end >actual &&
87
+ sed -e "s/^.\{41\}//" actual >output.two &&
88
test_cmp expect.two output.two
89
'
90
cat > expect.four <<EOF
@@ -124,14 +126,16 @@ test_expect_success 'test another branch' '
126
git config --add svn-remote.four.tags \
127
"tags/*:refs/remotes/four/tags/*" &&
128
git svn fetch four &&
127
- test $(git rev-list refs/remotes/four/tags/next | wc -l) -eq 5 &&
128
- test $(git rev-list refs/remotes/four/branches/v2/start | wc -l) -eq 3 &&
129
+ git rev-list refs/remotes/four/tags/next >actual &&
130
+ test_line_count = 5 actual &&
131
+ git rev-list refs/remotes/four/branches/v2/start >actual &&
132
+ test_line_count = 3 actual &&
133
test $(git rev-parse refs/remotes/four/branches/v2/start~2) = \
134
$(git rev-parse refs/remotes/four/trunk) &&
135
test $(git rev-parse refs/remotes/four/tags/next~2) = \
136
$(git rev-parse refs/remotes/four/branches/v2/start) &&
133
- git log --pretty=oneline refs/remotes/four/tags/next | \
134
- sed -e "s/^.\{41\}//" > output.four &&
137
+ git log --pretty=oneline refs/remotes/four/tags/next >actual &&
138
+ sed -e "s/^.\{41\}//" actual >output.four &&
139
test_cmp expect.four output.four
140
'
141
t/t9110-git-svn-use-svm-props.sh
+20
-20
@@ -21,37 +21,37 @@ uuid=161ce429-a9dd-4828-af4a-52023f968c89
21
22
bar_url=http://mayonaise/svnrepo/bar
23
test_expect_success 'verify metadata for /bar' "
24
- git cat-file commit refs/remotes/bar | \
25
- grep '^git-svn-id: $bar_url@12 $uuid$' &&
26
- git cat-file commit refs/remotes/bar~1 | \
27
- grep '^git-svn-id: $bar_url@11 $uuid$' &&
28
- git cat-file commit refs/remotes/bar~2 | \
29
- grep '^git-svn-id: $bar_url@10 $uuid$' &&
30
- git cat-file commit refs/remotes/bar~3 | \
31
- grep '^git-svn-id: $bar_url@9 $uuid$' &&
32
- git cat-file commit refs/remotes/bar~4 | \
33
- grep '^git-svn-id: $bar_url@6 $uuid$' &&
34
- git cat-file commit refs/remotes/bar~5 | \
35
- grep '^git-svn-id: $bar_url@1 $uuid$'
24
+ git cat-file commit refs/remotes/bar >actual &&
25
+ grep '^git-svn-id: $bar_url@12 $uuid$' actual &&
26
+ git cat-file commit refs/remotes/bar~1 >actual &&
27
+ grep '^git-svn-id: $bar_url@11 $uuid$' actual &&
28
+ git cat-file commit refs/remotes/bar~2 >actual &&
29
+ grep '^git-svn-id: $bar_url@10 $uuid$' actual &&
30
+ git cat-file commit refs/remotes/bar~3 >actual &&
31
+ grep '^git-svn-id: $bar_url@9 $uuid$' actual &&
32
+ git cat-file commit refs/remotes/bar~4 >actual &&
33
+ grep '^git-svn-id: $bar_url@6 $uuid$' actual &&
34
+ git cat-file commit refs/remotes/bar~5 >actual &&
35
+ grep '^git-svn-id: $bar_url@1 $uuid$' actual
36
"
37
38
e_url=http://mayonaise/svnrepo/dir/a/b/c/d/e
39
test_expect_success 'verify metadata for /dir/a/b/c/d/e' "
40
- git cat-file commit refs/remotes/e | \
41
- grep '^git-svn-id: $e_url@1 $uuid$'
40
+ git cat-file commit refs/remotes/e >actual &&
41
+ grep '^git-svn-id: $e_url@1 $uuid$' actual
42
"
43
44
dir_url=http://mayonaise/svnrepo/dir
45
test_expect_success 'verify metadata for /dir' "
46
- git cat-file commit refs/remotes/dir | \
47
- grep '^git-svn-id: $dir_url@2 $uuid$' &&
48
- git cat-file commit refs/remotes/dir~1 | \
49
- grep '^git-svn-id: $dir_url@1 $uuid$'
46
+ git cat-file commit refs/remotes/dir >actual &&
47
+ grep '^git-svn-id: $dir_url@2 $uuid$' actual &&
48
+ git cat-file commit refs/remotes/dir~1 >actual &&
49
+ grep '^git-svn-id: $dir_url@1 $uuid$' actual
50
"
51
52
test_expect_success 'find commit based on SVN revision number' "
53
- git svn find-rev r12 |
54
- grep $(git rev-parse HEAD)
53
+ git svn find-rev r12 >actual &&
54
+ grep $(git rev-parse HEAD) actual
55
"
56
57
test_expect_success 'empty rebase' "
t/t9111-git-svn-use-svnsync-props.sh
+18
-18
@@ -20,32 +20,32 @@ uuid=161ce429-a9dd-4828-af4a-52023f968c89
20
21
bar_url=http://mayonaise/svnrepo/bar
22
test_expect_success 'verify metadata for /bar' "
23
- git cat-file commit refs/remotes/bar | \
24
- grep '^git-svn-id: $bar_url@12 $uuid$' &&
25
- git cat-file commit refs/remotes/bar~1 | \
26
- grep '^git-svn-id: $bar_url@11 $uuid$' &&
27
- git cat-file commit refs/remotes/bar~2 | \
28
- grep '^git-svn-id: $bar_url@10 $uuid$' &&
29
- git cat-file commit refs/remotes/bar~3 | \
30
- grep '^git-svn-id: $bar_url@9 $uuid$' &&
31
- git cat-file commit refs/remotes/bar~4 | \
32
- grep '^git-svn-id: $bar_url@6 $uuid$' &&
33
- git cat-file commit refs/remotes/bar~5 | \
34
- grep '^git-svn-id: $bar_url@1 $uuid$'
23
+ git cat-file commit refs/remotes/bar >actual &&
24
+ grep '^git-svn-id: $bar_url@12 $uuid$' actual &&
25
+ git cat-file commit refs/remotes/bar~1 >actual &&
26
+ grep '^git-svn-id: $bar_url@11 $uuid$' actual &&
27
+ git cat-file commit refs/remotes/bar~2 >actual &&
28
+ grep '^git-svn-id: $bar_url@10 $uuid$' actual &&
29
+ git cat-file commit refs/remotes/bar~3 >actual &&
30
+ grep '^git-svn-id: $bar_url@9 $uuid$' actual &&
31
+ git cat-file commit refs/remotes/bar~4 >actual &&
32
+ grep '^git-svn-id: $bar_url@6 $uuid$' actual &&
33
+ git cat-file commit refs/remotes/bar~5 >actual &&
34
+ grep '^git-svn-id: $bar_url@1 $uuid$' actual
35
"
36
37
e_url=http://mayonaise/svnrepo/dir/a/b/c/d/e
38
test_expect_success 'verify metadata for /dir/a/b/c/d/e' "
39
- git cat-file commit refs/remotes/e | \
40
- grep '^git-svn-id: $e_url@1 $uuid$'
39
+ git cat-file commit refs/remotes/e >actual &&
40
+ grep '^git-svn-id: $e_url@1 $uuid$' actual
41
"
42
43
dir_url=http://mayonaise/svnrepo/dir
44
test_expect_success 'verify metadata for /dir' "
45
- git cat-file commit refs/remotes/dir | \
46
- grep '^git-svn-id: $dir_url@2 $uuid$' &&
47
- git cat-file commit refs/remotes/dir~1 | \
48
- grep '^git-svn-id: $dir_url@1 $uuid$'
45
+ git cat-file commit refs/remotes/dir >actual &&
46
+ grep '^git-svn-id: $dir_url@2 $uuid$' actual &&
47
+ git cat-file commit refs/remotes/dir~1 >actual &&
48
+ grep '^git-svn-id: $dir_url@1 $uuid$' actual
49
"
50
51
test_done
t/t9114-git-svn-dcommit-merge.sh
+6
-4
@@ -68,7 +68,8 @@ test_debug 'gitk --all & sleep 1'
68
test_expect_success 'verify pre-merge ancestry' "
69
test x\$(git rev-parse --verify refs/heads/svn^2) = \
70
x\$(git rev-parse --verify refs/heads/merge) &&
71
- git cat-file commit refs/heads/svn^ | grep '^friend$'
71
+ git cat-file commit refs/heads/svn^ >actual &&
72
+ grep '^friend$' actual
73
"
74
75
test_expect_success 'git svn dcommit merges' "
@@ -82,12 +83,13 @@ test_expect_success 'verify post-merge ancestry' "
83
x\$(git rev-parse --verify refs/remotes/origin/trunk) &&
84
test x\$(git rev-parse --verify refs/heads/svn^2) = \
85
x\$(git rev-parse --verify refs/heads/merge) &&
85
- git cat-file commit refs/heads/svn^ | grep '^friend$'
86
+ git cat-file commit refs/heads/svn^ >actual &&
87
+ grep '^friend$' actual
88
"
89
90
test_expect_success 'verify merge commit message' "
89
- git rev-list --pretty=raw -1 refs/heads/svn | \
90
- grep \" Merge branch 'merge' into svn\"
91
+ git rev-list --pretty=raw -1 refs/heads/svn >actual &&
92
+ grep \" Merge branch 'merge' into svn\" actual
93
"
94
95
test_done
t/t9130-git-svn-authors-file.sh
+16
-12
@@ -26,11 +26,12 @@ test_expect_success 'start import with incomplete authors file' '
26
test_expect_success 'imported 2 revisions successfully' '
27
(
28
cd x
29
- test "$(git rev-list refs/remotes/git-svn | wc -l)" -eq 2 &&
30
- git rev-list -1 --pretty=raw refs/remotes/git-svn | \
31
- grep "^author BBBBBBB BBBBBBB <bb@example\.com> " &&
32
- git rev-list -1 --pretty=raw refs/remotes/git-svn~1 | \
33
- grep "^author AAAAAAA AAAAAAA <aa@example\.com> "
29
+ git rev-list refs/remotes/git-svn >actual &&
30
+ test_line_count = 2 actual &&
31
+ git rev-list -1 --pretty=raw refs/remotes/git-svn >actual &&
32
+ grep "^author BBBBBBB BBBBBBB <bb@example\.com> " actual &&
33
+ git rev-list -1 --pretty=raw refs/remotes/git-svn~1 >actual &&
34
+ grep "^author AAAAAAA AAAAAAA <aa@example\.com> " actual
35
)
36
'
37
@@ -43,11 +44,12 @@ test_expect_success 'continues to import once authors have been added' '
44
(
45
cd x
46
git svn fetch --authors-file=../svn-authors &&
46
- test "$(git rev-list refs/remotes/git-svn | wc -l)" -eq 4 &&
47
- git rev-list -1 --pretty=raw refs/remotes/git-svn | \
48
- grep "^author DDDDDDD DDDDDDD <dd@example\.com> " &&
49
- git rev-list -1 --pretty=raw refs/remotes/git-svn~1 | \
50
- grep "^author CCCCCCC CCCCCCC <cc@example\.com> "
47
+ git rev-list refs/remotes/git-svn >actual &&
48
+ test_line_count = 4 actual &&
49
+ git rev-list -1 --pretty=raw refs/remotes/git-svn >actual &&
50
+ grep "^author DDDDDDD DDDDDDD <dd@example\.com> " actual &&
51
+ git rev-list -1 --pretty=raw refs/remotes/git-svn~1 >actual &&
52
+ grep "^author CCCCCCC CCCCCCC <cc@example\.com> " actual
53
)
54
'
55
@@ -102,8 +104,10 @@ test_expect_success !MINGW 'fresh clone with svn.authors-file in config' '
104
test x"$HOME"/svn-authors = x"$(git config svn.authorsfile)" &&
105
git svn clone "$svnrepo" gitconfig.clone &&
106
cd gitconfig.clone &&
105
- nr_ex=$(git log | grep "^Author:.*example.com" | wc -l) &&
106
- nr_rev=$(git rev-list HEAD | wc -l) &&
107
+ git log >actual &&
108
+ nr_ex=$(grep "^Author:.*example.com" actual | wc -l) &&
109
+ git rev-list HEAD >actual &&
110
+ nr_rev=$(wc -l <actual) &&
111
test $nr_rev -eq $nr_ex
112
)
113
'
t/t9138-git-svn-authors-prog.sh
+16
-15
@@ -37,31 +37,32 @@ test_expect_success 'import authors with prog and file' '
37
test_expect_success 'imported 6 revisions successfully' '
38
(
39
cd x
40
- test "$(git rev-list refs/remotes/git-svn | wc -l)" -eq 6
40
+ git rev-list refs/remotes/git-svn >actual &&
41
+ test_line_count = 6 actual
42
)
43
'
44
45
test_expect_success 'authors-prog ran correctly' '
46
(
47
cd x
47
- git rev-list -1 --pretty=raw refs/remotes/git-svn~1 | \
48
- grep "^author ee-foo <ee-foo@example\.com> " &&
49
- git rev-list -1 --pretty=raw refs/remotes/git-svn~2 | \
50
- grep "^author dd <dd@sub\.example\.com> " &&
51
- git rev-list -1 --pretty=raw refs/remotes/git-svn~3 | \
52
- grep "^author cc <cc@sub\.example\.com> " &&
53
- git rev-list -1 --pretty=raw refs/remotes/git-svn~4 | \
54
- grep "^author bb <bb@example\.com> " &&
55
- git rev-list -1 --pretty=raw refs/remotes/git-svn~5 | \
56
- grep "^author aa <aa@example\.com> "
48
+ git rev-list -1 --pretty=raw refs/remotes/git-svn~1 >actual &&
49
+ grep "^author ee-foo <ee-foo@example\.com> " actual &&
50
+ git rev-list -1 --pretty=raw refs/remotes/git-svn~2 >actual &&
51
+ grep "^author dd <dd@sub\.example\.com> " actual &&
52
+ git rev-list -1 --pretty=raw refs/remotes/git-svn~3 >actual &&
53
+ grep "^author cc <cc@sub\.example\.com> " actual &&
54
+ git rev-list -1 --pretty=raw refs/remotes/git-svn~4 >actual &&
55
+ grep "^author bb <bb@example\.com> " actual &&
56
+ git rev-list -1 --pretty=raw refs/remotes/git-svn~5 >actual &&
57
+ grep "^author aa <aa@example\.com> " actual
58
)
59
'
60
61
test_expect_success 'authors-file overrode authors-prog' '
62
(
63
cd x
63
- git rev-list -1 --pretty=raw refs/remotes/git-svn | \
64
- grep "^author FFFFFFF FFFFFFF <fFf@other\.example\.com> "
64
+ git rev-list -1 --pretty=raw refs/remotes/git-svn >actual &&
65
+ grep "^author FFFFFFF FFFFFFF <fFf@other\.example\.com> " actual
66
)
67
'
68
@@ -73,8 +74,8 @@ test_expect_success 'authors-prog handled special characters in username' '
74
(
75
cd x &&
76
git svn --authors-prog=../svn-authors-prog fetch &&
76
- git rev-list -1 --pretty=raw refs/remotes/git-svn |
77
- grep "^author xyz; touch evil <xyz; touch evil@example\.com> " &&
77
+ git rev-list -1 --pretty=raw refs/remotes/git-svn >actual &&
78
+ grep "^author xyz; touch evil <xyz; touch evil@example\.com> " actual &&
79
! test -f evil
80
)
81
'
t/t9153-git-svn-rewrite-uuid.sh
+4
-4
@@ -16,10 +16,10 @@ test_expect_success 'load svn repo' "
16
"
17
18
test_expect_success 'verify uuid' "
19
- git cat-file commit refs/remotes/git-svn~0 | \
20
- grep '^git-svn-id: .*@2 $uuid$' &&
21
- git cat-file commit refs/remotes/git-svn~1 | \
22
- grep '^git-svn-id: .*@1 $uuid$'
19
+ git cat-file commit refs/remotes/git-svn~0 >actual &&
20
+ grep '^git-svn-id: .*@2 $uuid$' actual &&
21
+ git cat-file commit refs/remotes/git-svn~1 >actual &&
22
+ grep '^git-svn-id: .*@1 $uuid$' actual
23
"
24
25
test_done
t/t9168-git-svn-partially-globbed-names.sh
+20
-14
@@ -48,8 +48,8 @@ test_expect_success 'test refspec prefixed globbing' '
48
git config --add svn-remote.svn.tags\
49
"tags/t_*/src/a:refs/remotes/tags/t_*" &&
50
git svn multi-fetch &&
51
- git log --pretty=oneline refs/remotes/tags/t_end | \
52
- sed -e "s/^.\{41\}//" >output.end &&
51
+ git log --pretty=oneline refs/remotes/tags/t_end >actual &&
52
+ sed -e "s/^.\{41\}//" actual >output.end &&
53
test_cmp expect.end output.end &&
54
test "$(git rev-parse refs/remotes/tags/t_end~1)" = \
55
"$(git rev-parse refs/remotes/branches/b_start)" &&
@@ -78,14 +78,16 @@ test_expect_success 'test left-hand-side only prefixed globbing' '
78
svn_cmd commit -m "try to try"
79
) &&
80
git svn fetch two &&
81
- test $(git rev-list refs/remotes/two/tags/t_end | wc -l) -eq 6 &&
82
- test $(git rev-list refs/remotes/two/branches/b_start | wc -l) -eq 3 &&
81
+ git rev-list refs/remotes/two/tags/t_end >actual &&
82
+ test_line_count = 6 actual &&
83
+ git rev-list refs/remotes/two/branches/b_start >actual &&
84
+ test_line_count = 3 actual &&
85
test $(git rev-parse refs/remotes/two/branches/b_start~2) = \
86
$(git rev-parse refs/remotes/two/trunk) &&
87
test $(git rev-parse refs/remotes/two/tags/t_end~3) = \
88
$(git rev-parse refs/remotes/two/branches/b_start) &&
87
- git log --pretty=oneline refs/remotes/two/tags/t_end | \
88
- sed -e "s/^.\{41\}//" >output.two &&
89
+ git log --pretty=oneline refs/remotes/two/tags/t_end >actual &&
90
+ sed -e "s/^.\{41\}//" actual >output.two &&
91
test_cmp expect.two output.two
92
'
93
@@ -118,14 +120,16 @@ test_expect_success 'test prefixed globs match just prefix' '
120
svn_cmd up
121
) &&
122
git svn fetch three &&
121
- test $(git rev-list refs/remotes/three/branches/b_ | wc -l) -eq 2 &&
122
- test $(git rev-list refs/remotes/three/tags/t_ | wc -l) -eq 3 &&
123
+ git rev-list refs/remotes/three/branches/b_ >actual &&
124
+ test_line_count = 2 actual &&
125
+ git rev-list refs/remotes/three/tags/t_ >actual &&
126
+ test_line_count = 3 actual &&
127
test $(git rev-parse refs/remotes/three/branches/b_~1) = \
128
$(git rev-parse refs/remotes/three/trunk) &&
129
test $(git rev-parse refs/remotes/three/tags/t_~1) = \
130
$(git rev-parse refs/remotes/three/branches/b_) &&
127
- git log --pretty=oneline refs/remotes/three/tags/t_ | \
128
- sed -e "s/^.\{41\}//" >output.three &&
131
+ git log --pretty=oneline refs/remotes/three/tags/t_ >actual &&
132
+ sed -e "s/^.\{41\}//" actual >output.three &&
133
test_cmp expect.three output.three
134
'
135
@@ -186,14 +190,16 @@ test_expect_success 'test globbing in the middle of the word' '
190
svn_cmd up
191
) &&
192
git svn fetch five &&
189
- test $(git rev-list refs/remotes/five/branches/abcde | wc -l) -eq 2 &&
190
- test $(git rev-list refs/remotes/five/tags/fghij | wc -l) -eq 3 &&
193
+ git rev-list refs/remotes/five/branches/abcde >actual &&
194
+ test_line_count = 2 actual &&
195
+ git rev-list refs/remotes/five/tags/fghij >actual &&
196
+ test_line_count = 3 actual &&
197
test $(git rev-parse refs/remotes/five/branches/abcde~1) = \
198
$(git rev-parse refs/remotes/five/trunk) &&
199
test $(git rev-parse refs/remotes/five/tags/fghij~1) = \
200
$(git rev-parse refs/remotes/five/branches/abcde) &&
195
- git log --pretty=oneline refs/remotes/five/tags/fghij | \
196
- sed -e "s/^.\{41\}//" >output.five &&
201
+ git log --pretty=oneline refs/remotes/five/tags/fghij >actual &&
202
+ sed -e "s/^.\{41\}//" actual >output.five &&
203
test_cmp expect.five output.five
204
'
205
t/t9350-fast-export.sh
+24
-26
@@ -43,20 +43,20 @@ test_expect_success 'fast-export | fast-import' '
43
MUSS=$(git rev-parse --verify muss) &&
44
mkdir new &&
45
git --git-dir=new/.git init &&
46
- git fast-export --all |
46
+ git fast-export --all >actual &&
47
(cd new &&
48
git fast-import &&
49
test $MASTER = $(git rev-parse --verify refs/heads/master) &&
50
test $REIN = $(git rev-parse --verify refs/tags/rein) &&
51
test $WER = $(git rev-parse --verify refs/heads/wer) &&
52
- test $MUSS = $(git rev-parse --verify refs/tags/muss))
52
+ test $MUSS = $(git rev-parse --verify refs/tags/muss)) <actual
53
54
'
55
56
test_expect_success 'fast-export master~2..master' '
57
58
- git fast-export master~2..master |
59
- sed "s/master/partial/" |
58
+ git fast-export master~2..master >actual &&
59
+ sed "s/master/partial/" actual |
60
(cd new &&
61
git fast-import &&
62
test $MASTER != $(git rev-parse --verify refs/heads/partial) &&
@@ -74,11 +74,12 @@ test_expect_success 'iso-8859-1' '
74
test_tick &&
75
echo rosten >file &&
76
git commit -s -m den file &&
77
- git fast-export wer^..wer |
78
- sed "s/wer/i18n/" |
77
+ git fast-export wer^..wer >iso8859-1.fi &&
78
+ sed "s/wer/i18n/" iso8859-1.fi |
79
(cd new &&
80
git fast-import &&
81
- git cat-file commit i18n | grep "Áéí óú")
81
+ git cat-file commit i18n >actual &&
82
+ grep "Áéí óú" actual)
83
84
'
85
test_expect_success 'import/export-marks' '
@@ -87,20 +88,14 @@ test_expect_success 'import/export-marks' '
88
git fast-export --export-marks=tmp-marks HEAD &&
89
test -s tmp-marks &&
90
test_line_count = 3 tmp-marks &&
90
- test $(
91
- git fast-export --import-marks=tmp-marks\
92
- --export-marks=tmp-marks HEAD |
93
- grep ^commit |
94
- wc -l) \
95
- -eq 0 &&
91
+ git fast-export --import-marks=tmp-marks \
92
+ --export-marks=tmp-marks HEAD >actual &&
93
+ test $(grep ^commit actual | wc -l) -eq 0 &&
94
echo change > file &&
95
git commit -m "last commit" file &&
98
- test $(
99
- git fast-export --import-marks=tmp-marks \
100
- --export-marks=tmp-marks HEAD |
101
- grep ^commit\ |
102
- wc -l) \
103
- -eq 1 &&
96
+ git fast-export --import-marks=tmp-marks \
97
+ --export-marks=tmp-marks HEAD >actual &&
98
+ test $(grep ^commit\ actual | wc -l) -eq 1 &&
99
test_line_count = 4 tmp-marks
100
101
'
@@ -184,7 +179,7 @@ test_expect_success 'submodule fast-export | fast-import' '
179
rm -rf new &&
180
mkdir new &&
181
git --git-dir=new/.git init &&
187
- git fast-export --signed-tags=strip --all |
182
+ git fast-export --signed-tags=strip --all >actual &&
183
(cd new &&
184
git fast-import &&
185
test "$SUBENT1" = "$(git ls-tree refs/heads/master^ sub)" &&
@@ -192,7 +187,7 @@ test_expect_success 'submodule fast-export | fast-import' '
187
git checkout master &&
188
git submodule init &&
189
git submodule update &&
195
- cmp sub/file ../sub/file)
190
+ cmp sub/file ../sub/file) <actual
191
192
'
193
@@ -367,12 +362,14 @@ test_expect_success 'path limiting with import-marks does not lose unmodified fi
362
echo more content >> file &&
363
test_tick &&
364
git commit -mnext file &&
370
- git fast-export --import-marks=marks simple -- file file0 | grep file0
365
+ git fast-export --import-marks=marks simple -- file file0 >actual &&
366
+ grep file0 actual
367
'
368
369
test_expect_success 'full-tree re-shows unmodified files' '
370
git checkout -f simple &&
375
- test $(git fast-export --full-tree simple | grep -c file0) -eq 3
371
+ git fast-export --full-tree simple >actual &&
372
+ test $(grep -c file0 actual) -eq 3
373
'
374
375
test_expect_success 'set-up a few more tags for tag export tests' '
@@ -505,8 +502,8 @@ test_expect_success 'refs are updated even if no commits need to be exported' '
502
'
503
504
test_expect_success 'use refspec' '
508
- git fast-export --refspec refs/heads/master:refs/heads/foobar master | \
509
- grep "^commit " | sort | uniq > actual &&
505
+ git fast-export --refspec refs/heads/master:refs/heads/foobar master >actual2 &&
506
+ grep "^commit " actual2 | sort | uniq >actual &&
507
echo "commit refs/heads/foobar" > expected &&
508
test_cmp expected actual
509
'
@@ -534,7 +531,8 @@ test_expect_success 'when using -C, do not declare copy when source of copy is a
531
git -C src commit -m 2nd_commit &&
532
533
test_create_repo dst &&
537
- git -C src fast-export --all -C | git -C dst fast-import &&
534
+ git -C src fast-export --all -C >actual &&
535
+ git -C dst fast-import <actual &&
536
git -C src show >expected &&
537
git -C dst show >actual &&
538
test_cmp expected actual