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 <Alex.Crezoff@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Alexey Shumkin committed
Jun 26, 2013 at 14:19 UTC
a742f2a0a7e57bb7d3f55cb8312c3f4cc4dc68fb
1 file changed
+26
-22
t/t4205-log-pretty-formats.sh
+26
-22
@@ -101,7 +101,11 @@ test_expect_failure 'NUL termination with --stat' '
101
102
test_expect_success 'setup more commits' '
103
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)
109
'
110
111
test_expect_success 'left alignment formatting' '
@@ -117,18 +121,18 @@ EOF
121
test_cmp expected actual
122
'
123
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 &&
126
# complete the incomplete line at the end
127
echo >>actual &&
128
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
133
EOF
134
test_cmp expected actual
131
-'
135
+"
136
137
test_expect_success 'left alignment formatting with no padding' '
138
git log --pretty="format:%<(1)%s" >actual &&
@@ -195,18 +199,18 @@ EOF
199
test_cmp expected actual
200
'
201
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 &&
204
# complete the incomplete line at the end
205
echo >>actual &&
206
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
211
EOF
212
test_cmp expected actual
209
-'
213
+"
214
215
test_expect_success 'right alignment formatting with no padding' '
216
git log --pretty="format:%>(1)%s" >actual &&
@@ -234,18 +238,18 @@ EOF
238
test_cmp expected actual
239
'
240
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 &&
243
# complete the incomplete line at the end
244
echo >>actual &&
245
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
250
EOF
251
test_cmp expected actual
248
-'
252
+"
253
254
test_expect_success 'center alignment formatting with no padding' '
255
git log --pretty="format:%><(1)%s" >actual &&