Skip to content

Commit a742f2a

Browse files
ashumkingitster
authored andcommitted
t4205 (log-pretty-formats): don't hardcode SHA-1 in expected outputs
The expected SHA-1 digests are always available in variables. Use them instead of hardcoding. Signed-off-by: Alexey Shumkin <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 375775b commit a742f2a

File tree

1 file changed

+26
-22
lines changed

1 file changed

+26
-22
lines changed

t/t4205-log-pretty-formats.sh

Lines changed: 26 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,11 @@ test_expect_failure 'NUL termination with --stat' '
101101

102102
test_expect_success 'setup more commits' '
103103
test_commit "message one" one one message-one &&
104-
test_commit "message two" two two message-two
104+
test_commit "message two" two two message-two &&
105+
head1=$(git rev-parse --verify --short HEAD~0) &&
106+
head2=$(git rev-parse --verify --short HEAD~1) &&
107+
head3=$(git rev-parse --verify --short HEAD~2) &&
108+
head4=$(git rev-parse --verify --short HEAD~3)
105109
'
106110

107111
test_expect_success 'left alignment formatting' '
@@ -117,18 +121,18 @@ EOF
117121
test_cmp expected actual
118122
'
119123

120-
test_expect_success 'left alignment formatting at the nth column' '
121-
git log --pretty="format:%h %<|(40)%s" >actual &&
124+
test_expect_success 'left alignment formatting at the nth column' "
125+
git log --pretty='format:%h %<|(40)%s' >actual &&
122126
# complete the incomplete line at the end
123127
echo >>actual &&
124128
qz_to_tab_space <<\EOF >expected &&
125-
fa33ab1 message two Z
126-
7cd6c63 message one Z
127-
1711bf9 add bar Z
128-
af20c06 initial Z
129+
$head1 message two Z
130+
$head2 message one Z
131+
$head3 add bar Z
132+
$head4 initial Z
129133
EOF
130134
test_cmp expected actual
131-
'
135+
"
132136

133137
test_expect_success 'left alignment formatting with no padding' '
134138
git log --pretty="format:%<(1)%s" >actual &&
@@ -195,18 +199,18 @@ EOF
195199
test_cmp expected actual
196200
'
197201

198-
test_expect_success 'right alignment formatting at the nth column' '
199-
git log --pretty="format:%h %>|(40)%s" >actual &&
202+
test_expect_success 'right alignment formatting at the nth column' "
203+
git log --pretty='format:%h %>|(40)%s' >actual &&
200204
# complete the incomplete line at the end
201205
echo >>actual &&
202206
qz_to_tab_space <<\EOF >expected &&
203-
fa33ab1 message two
204-
7cd6c63 message one
205-
1711bf9 add bar
206-
af20c06 initial
207+
$head1 message two
208+
$head2 message one
209+
$head3 add bar
210+
$head4 initial
207211
EOF
208212
test_cmp expected actual
209-
'
213+
"
210214

211215
test_expect_success 'right alignment formatting with no padding' '
212216
git log --pretty="format:%>(1)%s" >actual &&
@@ -234,18 +238,18 @@ EOF
234238
test_cmp expected actual
235239
'
236240

237-
test_expect_success 'center alignment formatting at the nth column' '
238-
git log --pretty="format:%h %><|(40)%s" >actual &&
241+
test_expect_success 'center alignment formatting at the nth column' "
242+
git log --pretty='format:%h %><|(40)%s' >actual &&
239243
# complete the incomplete line at the end
240244
echo >>actual &&
241245
qz_to_tab_space <<\EOF >expected &&
242-
fa33ab1 message two Z
243-
7cd6c63 message one Z
244-
1711bf9 add bar Z
245-
af20c06 initial Z
246+
$head1 message two Z
247+
$head2 message one Z
248+
$head3 add bar Z
249+
$head4 initial Z
246250
EOF
247251
test_cmp expected actual
248-
'
252+
"
249253

250254
test_expect_success 'center alignment formatting with no padding' '
251255
git log --pretty="format:%><(1)%s" >actual &&

0 commit comments

Comments
 (0)