Skip to content

Commit fed877c

Browse files
committed
Merge branch 'th/t8003-unhide-git-failures'
Test clean-up. * th/t8003-unhide-git-failures: t8003: modernise style t8003: avoid suppressing git's exit code
2 parents e0613d2 + 699248d commit fed877c

1 file changed

Lines changed: 31 additions & 44 deletions

File tree

t/t8003-blame-corner-cases.sh

Lines changed: 31 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -49,92 +49,79 @@ test_expect_success setup '
4949
'
5050

5151
test_expect_success 'straight copy without -C' '
52-
53-
git blame uno | grep Second
54-
52+
git blame uno >actual &&
53+
test_grep Second actual
5554
'
5655

5756
test_expect_success 'straight move without -C' '
58-
59-
git blame dos | grep Initial
60-
57+
git blame dos >actual &&
58+
test_grep Initial actual
6159
'
6260

6361
test_expect_success 'straight copy with -C' '
64-
65-
git blame -C1 uno | grep Second
66-
62+
git blame -C1 uno >actual &&
63+
test_grep Second actual
6764
'
6865

6966
test_expect_success 'straight move with -C' '
70-
71-
git blame -C1 dos | grep Initial
72-
67+
git blame -C1 dos >actual &&
68+
test_grep Initial actual
7369
'
7470

7571
test_expect_success 'straight copy with -C -C' '
76-
77-
git blame -C -C1 uno | grep Initial
78-
72+
git blame -C -C1 uno >actual &&
73+
test_grep Initial actual
7974
'
8075

8176
test_expect_success 'straight move with -C -C' '
82-
83-
git blame -C -C1 dos | grep Initial
84-
77+
git blame -C -C1 dos >actual &&
78+
test_grep Initial actual
8579
'
8680

8781
test_expect_success 'append without -C' '
88-
89-
git blame -L2 tres | grep Second
90-
82+
git blame -L2 tres >actual &&
83+
test_grep Second actual
9184
'
9285

9386
test_expect_success 'append with -C' '
94-
95-
git blame -L2 -C1 tres | grep Second
96-
87+
git blame -L2 -C1 tres >actual &&
88+
test_grep Second actual
9789
'
9890

9991
test_expect_success 'append with -C -C' '
100-
101-
git blame -L2 -C -C1 tres | grep Second
102-
92+
git blame -L2 -C -C1 tres >actual &&
93+
test_grep Second actual
10394
'
10495

10596
test_expect_success 'append with -C -C -C' '
106-
107-
git blame -L2 -C -C -C1 tres | grep Initial
108-
97+
git blame -L2 -C -C -C1 tres >actual &&
98+
test_grep Initial actual
10999
'
110100

111101
test_expect_success 'blame wholesale copy' '
112-
113-
git blame -f -C -C1 HEAD^ -- cow | sed -e "$pick_fc" >current &&
102+
git blame -f -C -C1 HEAD^ -- cow >actual &&
103+
sed -e "$pick_fc" actual >current &&
114104
cat >expected <<-\EOF &&
115105
mouse-Initial
116106
mouse-Second
117107
mouse-Third
118108
EOF
119109
test_cmp expected current
120-
121110
'
122111

123112
test_expect_success 'blame wholesale copy and more' '
124-
125-
git blame -f -C -C1 HEAD -- cow | sed -e "$pick_fc" >current &&
113+
git blame -f -C -C1 HEAD -- cow >actual &&
114+
sed -e "$pick_fc" actual >current &&
126115
cat >expected <<-\EOF &&
127116
mouse-Initial
128117
mouse-Second
129118
cow-Fifth
130119
mouse-Third
131120
EOF
132121
test_cmp expected current
133-
134122
'
135123

136124
test_expect_success 'blame wholesale copy and more in the index' '
137-
138125
cat >horse <<-\EOF &&
139126
ABC
140127
DEF
@@ -144,7 +131,8 @@ test_expect_success 'blame wholesale copy and more in the index' '
144131
EOF
145132
git add horse &&
146133
test_when_finished "git rm -f horse" &&
147-
git blame -f -C -C1 -- horse | sed -e "$pick_fc" >current &&
134+
git blame -f -C -C1 -- horse >actual &&
135+
sed -e "$pick_fc" actual >current &&
148136
cat >expected <<-\EOF &&
149137
mouse-Initial
150138
mouse-Second
@@ -153,11 +141,9 @@ test_expect_success 'blame wholesale copy and more in the index' '
153141
mouse-Third
154142
EOF
155143
test_cmp expected current
156-
157144
'
158145

159146
test_expect_success 'blame during cherry-pick with file rename conflict' '
160-
161147
test_when_finished "git reset --hard && git checkout main" &&
162148
git checkout HEAD~3 &&
163149
echo MOUSE >> mouse &&
@@ -168,7 +154,8 @@ test_expect_success 'blame during cherry-pick with file rename conflict' '
168154
(git cherry-pick HEAD@{1} || test $? -eq 1) &&
169155
git show HEAD@{1}:rodent > rodent &&
170156
git add rodent &&
171-
git blame -f -C -C1 rodent | sed -e "$pick_fc" >current &&
157+
git blame -f -C -C1 rodent >actual &&
158+
sed -e "$pick_fc" actual >current &&
172159
cat >expected <<-\EOF &&
173160
mouse-Initial
174161
mouse-Second
@@ -246,14 +233,14 @@ test_expect_success 'setup file with CRLF newlines' '
246233
test_expect_success 'blame file with CRLF core.autocrlf true' '
247234
git config core.autocrlf true &&
248235
git blame crlffile >actual &&
249-
grep "A U Thor" actual
236+
test_grep "A U Thor" actual
250237
'
251238

252239
test_expect_success 'blame file with CRLF attributes text' '
253240
git config core.autocrlf false &&
254241
echo "crlffile text" >.gitattributes &&
255242
git blame crlffile >actual &&
256-
grep "A U Thor" actual
243+
test_grep "A U Thor" actual
257244
'
258245

259246
test_expect_success 'blame file with CRLF core.autocrlf=true' '
@@ -267,7 +254,7 @@ test_expect_success 'blame file with CRLF core.autocrlf=true' '
267254
git checkout crlfinrepo &&
268255
rm tmp &&
269256
git blame crlfinrepo >actual &&
270-
grep "A U Thor" actual
257+
test_grep "A U Thor" actual
271258
'
272259

273260
test_expect_success 'setup coalesce tests' '

0 commit comments

Comments
 (0)