]>
Commit | Line | Data |
---|---|---|
fa21b602 JK |
1 | #!/bin/sh |
2 | ||
de6029a2 AS |
3 | # Copyright (c) 2009 Jens Lehmann |
4 | # Copyright (c) 2011 Alexey Shumkin (+ non-UTF-8 commit encoding tests) | |
5 | ||
5be60078 | 6 | test_description='git rev-list --pretty=format test' |
fa21b602 JK |
7 | |
8 | . ./test-lib.sh | |
30825178 | 9 | . "$TEST_DIRECTORY"/lib-terminal.sh |
fa21b602 JK |
10 | |
11 | test_tick | |
ee3efaf6 AS |
12 | # Tested non-UTF-8 encoding |
13 | test_encoding="ISO8859-1" | |
14 | ||
17cc2ef1 AS |
15 | # String "added" in German |
16 | # (translated with Google Translate), | |
17 | # encoded in UTF-8, used as a commit log message below. | |
d928d810 AS |
18 | added_utf8_part=$(printf "\303\274") |
19 | added_utf8_part_iso88591=$(echo "$added_utf8_part" | iconv -f utf-8 -t $test_encoding) | |
20 | added=$(printf "added (hinzugef${added_utf8_part}gt) foo") | |
ee3efaf6 | 21 | added_iso88591=$(echo "$added" | iconv -f utf-8 -t $test_encoding) |
de6029a2 | 22 | # same but "changed" |
d928d810 AS |
23 | changed_utf8_part=$(printf "\303\244") |
24 | changed_utf8_part_iso88591=$(echo "$changed_utf8_part" | iconv -f utf-8 -t $test_encoding) | |
25 | changed=$(printf "changed (ge${changed_utf8_part}ndert) foo") | |
ee3efaf6 | 26 | changed_iso88591=$(echo "$changed" | iconv -f utf-8 -t $test_encoding) |
de6029a2 | 27 | |
d928d810 AS |
28 | # Count of char to truncate |
29 | # Number is chosen so, that non-ACSII characters | |
30 | # (see $added_utf8_part and $changed_utf8_part) | |
31 | # fall into truncated parts of appropriate words both from left and right | |
32 | truncate_count=20 | |
33 | ||
fa21b602 | 34 | test_expect_success 'setup' ' |
77a6815d AS |
35 | : >foo && |
36 | git add foo && | |
ee3efaf6 | 37 | git config i18n.commitEncoding $test_encoding && |
e6ce2be2 | 38 | echo "$added_iso88591" | git commit -F - && |
77a6815d AS |
39 | head1=$(git rev-parse --verify HEAD) && |
40 | head1_short=$(git rev-parse --verify --short $head1) && | |
41 | tree1=$(git rev-parse --verify HEAD:) && | |
42 | tree1_short=$(git rev-parse --verify --short $tree1) && | |
de6029a2 | 43 | echo "$changed" > foo && |
e6ce2be2 | 44 | echo "$changed_iso88591" | git commit -a -F - && |
77a6815d AS |
45 | head2=$(git rev-parse --verify HEAD) && |
46 | head2_short=$(git rev-parse --verify --short $head2) && | |
47 | tree2=$(git rev-parse --verify HEAD:) && | |
99094a7a | 48 | tree2_short=$(git rev-parse --verify --short $tree2) && |
de6029a2 | 49 | git config --unset i18n.commitEncoding |
fa21b602 JK |
50 | ' |
51 | ||
17cc2ef1 | 52 | # usage: test_format name format_string [failure] <expected_output |
2581ad5e | 53 | test_format () { |
fa21b602 | 54 | cat >expect.$1 |
17cc2ef1 AS |
55 | test_expect_${3:-success} "format $1" " |
56 | git rev-list --pretty=format:'$2' master >output.$1 && | |
57 | test_cmp expect.$1 output.$1 | |
58 | " | |
fa21b602 JK |
59 | } |
60 | ||
30825178 JH |
61 | # Feed to --format to provide predictable colored sequences. |
62 | AUTO_COLOR='%C(auto,red)foo%C(auto,reset)' | |
63 | has_color () { | |
097b681b JK |
64 | test_decode_color <"$1" >decoded && |
65 | echo "<RED>foo<RESET>" >expect && | |
66 | test_cmp expect decoded | |
30825178 JH |
67 | } |
68 | ||
69 | has_no_color () { | |
70 | echo foo >expect && | |
71 | test_cmp expect "$1" | |
72 | } | |
73 | ||
77a6815d AS |
74 | test_format percent %%h <<EOF |
75 | commit $head2 | |
0a0416a3 | 76 | %h |
77a6815d | 77 | commit $head1 |
0a0416a3 JK |
78 | %h |
79 | EOF | |
80 | ||
77a6815d AS |
81 | test_format hash %H%n%h <<EOF |
82 | commit $head2 | |
83 | $head2 | |
84 | $head2_short | |
85 | commit $head1 | |
86 | $head1 | |
87 | $head1_short | |
fa21b602 JK |
88 | EOF |
89 | ||
77a6815d AS |
90 | test_format tree %T%n%t <<EOF |
91 | commit $head2 | |
92 | $tree2 | |
93 | $tree2_short | |
94 | commit $head1 | |
95 | $tree1 | |
96 | $tree1_short | |
fa21b602 JK |
97 | EOF |
98 | ||
77a6815d AS |
99 | test_format parents %P%n%p <<EOF |
100 | commit $head2 | |
101 | $head1 | |
102 | $head1_short | |
103 | commit $head1 | |
542e165c JH |
104 | |
105 | ||
fa21b602 JK |
106 | EOF |
107 | ||
108 | # we don't test relative here | |
77a6815d AS |
109 | test_format author %an%n%ae%n%ad%n%aD%n%at <<EOF |
110 | commit $head2 | |
fa21b602 JK |
111 | A U Thor |
112 | author@example.com | |
113 | Thu Apr 7 15:13:13 2005 -0700 | |
114 | Thu, 7 Apr 2005 15:13:13 -0700 | |
115 | 1112911993 | |
77a6815d | 116 | commit $head1 |
fa21b602 JK |
117 | A U Thor |
118 | author@example.com | |
119 | Thu Apr 7 15:13:13 2005 -0700 | |
120 | Thu, 7 Apr 2005 15:13:13 -0700 | |
121 | 1112911993 | |
122 | EOF | |
123 | ||
77a6815d AS |
124 | test_format committer %cn%n%ce%n%cd%n%cD%n%ct <<EOF |
125 | commit $head2 | |
fa21b602 JK |
126 | C O Mitter |
127 | committer@example.com | |
128 | Thu Apr 7 15:13:13 2005 -0700 | |
129 | Thu, 7 Apr 2005 15:13:13 -0700 | |
130 | 1112911993 | |
77a6815d | 131 | commit $head1 |
fa21b602 JK |
132 | C O Mitter |
133 | committer@example.com | |
134 | Thu Apr 7 15:13:13 2005 -0700 | |
135 | Thu, 7 Apr 2005 15:13:13 -0700 | |
136 | 1112911993 | |
137 | EOF | |
138 | ||
77a6815d AS |
139 | test_format encoding %e <<EOF |
140 | commit $head2 | |
ee3efaf6 | 141 | $test_encoding |
77a6815d | 142 | commit $head1 |
ee3efaf6 | 143 | $test_encoding |
fa21b602 JK |
144 | EOF |
145 | ||
ecaee805 | 146 | test_format subject %s <<EOF |
77a6815d | 147 | commit $head2 |
de6029a2 | 148 | $changed |
77a6815d | 149 | commit $head1 |
de6029a2 | 150 | $added |
fa21b602 JK |
151 | EOF |
152 | ||
d928d810 AS |
153 | test_format subject-truncated "%<($truncate_count,trunc)%s" <<EOF |
154 | commit $head2 | |
155 | changed (ge${changed_utf8_part}ndert).. | |
156 | commit $head1 | |
157 | added (hinzugef${added_utf8_part}gt.. | |
158 | EOF | |
159 | ||
77a6815d AS |
160 | test_format body %b <<EOF |
161 | commit $head2 | |
162 | commit $head1 | |
fa21b602 JK |
163 | EOF |
164 | ||
ecaee805 | 165 | test_format raw-body %B <<EOF |
77a6815d | 166 | commit $head2 |
de6029a2 | 167 | $changed |
1367b12a | 168 | |
77a6815d | 169 | commit $head1 |
de6029a2 | 170 | $added |
1367b12a EB |
171 | |
172 | EOF | |
173 | ||
097b681b JK |
174 | test_expect_success 'basic colors' ' |
175 | cat >expect <<-EOF && | |
176 | commit $head2 | |
177 | <RED>foo<GREEN>bar<BLUE>baz<RESET>xyzzy | |
178 | EOF | |
179 | format="%Credfoo%Cgreenbar%Cbluebaz%Cresetxyzzy" && | |
180 | git rev-list --format="$format" -1 master >actual.raw && | |
181 | test_decode_color <actual.raw >actual && | |
182 | test_cmp expect actual | |
183 | ' | |
fa21b602 | 184 | |
097b681b JK |
185 | test_expect_success 'advanced colors' ' |
186 | cat >expect <<-EOF && | |
187 | commit $head2 | |
188 | <BOLD;RED;BYELLOW>foo<RESET> | |
189 | EOF | |
190 | format="%C(red yellow bold)foo%C(reset)" && | |
191 | git rev-list --format="$format" -1 master >actual.raw && | |
192 | test_decode_color <actual.raw >actual && | |
193 | test_cmp expect actual | |
194 | ' | |
c002922a | 195 | |
b15a3e00 | 196 | test_expect_success '%C(auto,...) does not enable color by default' ' |
30825178 JH |
197 | git log --format=$AUTO_COLOR -1 >actual && |
198 | has_no_color actual | |
199 | ' | |
200 | ||
b15a3e00 | 201 | test_expect_success '%C(auto,...) enables colors for color.diff' ' |
30825178 JH |
202 | git -c color.diff=always log --format=$AUTO_COLOR -1 >actual && |
203 | has_color actual | |
204 | ' | |
205 | ||
b15a3e00 | 206 | test_expect_success '%C(auto,...) enables colors for color.ui' ' |
30825178 JH |
207 | git -c color.ui=always log --format=$AUTO_COLOR -1 >actual && |
208 | has_color actual | |
209 | ' | |
210 | ||
b15a3e00 | 211 | test_expect_success '%C(auto,...) respects --color' ' |
30825178 JH |
212 | git log --format=$AUTO_COLOR -1 --color >actual && |
213 | has_color actual | |
214 | ' | |
215 | ||
b15a3e00 | 216 | test_expect_success '%C(auto,...) respects --no-color' ' |
30825178 JH |
217 | git -c color.ui=always log --format=$AUTO_COLOR -1 --no-color >actual && |
218 | has_no_color actual | |
219 | ' | |
220 | ||
b15a3e00 | 221 | test_expect_success TTY '%C(auto,...) respects --color=auto (stdout is tty)' ' |
512477b1 DT |
222 | test_terminal env TERM=vt100 \ |
223 | git log --format=$AUTO_COLOR -1 --color=auto >actual && | |
224 | has_color actual | |
30825178 JH |
225 | ' |
226 | ||
b15a3e00 | 227 | test_expect_success '%C(auto,...) respects --color=auto (stdout not tty)' ' |
30825178 JH |
228 | ( |
229 | TERM=vt100 && export TERM && | |
230 | git log --format=$AUTO_COLOR -1 --color=auto >actual && | |
231 | has_no_color actual | |
232 | ) | |
233 | ' | |
234 | ||
b15a3e00 | 235 | test_expect_success '%C(auto) respects --color' ' |
097b681b JK |
236 | git log --color --format="%C(auto)%H" -1 >actual.raw && |
237 | test_decode_color <actual.raw >actual && | |
238 | echo "<YELLOW>$(git rev-parse HEAD)<RESET>" >expect && | |
b15a3e00 ET |
239 | test_cmp expect actual |
240 | ' | |
241 | ||
242 | test_expect_success '%C(auto) respects --no-color' ' | |
243 | git log --no-color --format="%C(auto)%H" -1 >actual && | |
244 | git rev-parse HEAD >expect && | |
245 | test_cmp expect actual | |
246 | ' | |
247 | ||
d75dfb10 JK |
248 | test_expect_success 'rev-list %C(auto,...) respects --color' ' |
249 | git rev-list --color --format="%C(auto,green)foo%C(auto,reset)" \ | |
250 | -1 HEAD >actual.raw && | |
251 | test_decode_color <actual.raw >actual && | |
252 | cat >expect <<-EOF && | |
253 | commit $(git rev-parse HEAD) | |
254 | <GREEN>foo<RESET> | |
255 | EOF | |
256 | test_cmp expect actual | |
257 | ' | |
258 | ||
ee3efaf6 | 259 | iconv -f utf-8 -t $test_encoding > commit-msg <<EOF |
03bcaaca JK |
260 | Test printing of complex bodies |
261 | ||
262 | This commit message is much longer than the others, | |
ee3efaf6 AS |
263 | and it will be encoded in $test_encoding. We should therefore |
264 | include an ISO8859 character: ¡bueno! | |
03bcaaca | 265 | EOF |
77a6815d | 266 | |
03bcaaca | 267 | test_expect_success 'setup complex body' ' |
ee3efaf6 | 268 | git config i18n.commitencoding $test_encoding && |
77a6815d AS |
269 | echo change2 >foo && git commit -a -F commit-msg && |
270 | head3=$(git rev-parse --verify HEAD) && | |
0fe6df3c | 271 | head3_short=$(git rev-parse --short $head3) |
03bcaaca JK |
272 | ' |
273 | ||
77a6815d AS |
274 | test_format complex-encoding %e <<EOF |
275 | commit $head3 | |
ee3efaf6 | 276 | $test_encoding |
77a6815d | 277 | commit $head2 |
ee3efaf6 | 278 | $test_encoding |
77a6815d | 279 | commit $head1 |
ee3efaf6 | 280 | $test_encoding |
03bcaaca JK |
281 | EOF |
282 | ||
ecaee805 | 283 | test_format complex-subject %s <<EOF |
77a6815d | 284 | commit $head3 |
03bcaaca | 285 | Test printing of complex bodies |
77a6815d | 286 | commit $head2 |
0fe6df3c | 287 | $changed_iso88591 |
77a6815d | 288 | commit $head1 |
0fe6df3c | 289 | $added_iso88591 |
03bcaaca JK |
290 | EOF |
291 | ||
7d509878 | 292 | test_format complex-subject-trunc "%<($truncate_count,trunc)%s" <<EOF |
d928d810 AS |
293 | commit $head3 |
294 | Test printing of c.. | |
295 | commit $head2 | |
296 | changed (ge${changed_utf8_part_iso88591}ndert).. | |
297 | commit $head1 | |
298 | added (hinzugef${added_utf8_part_iso88591}gt.. | |
299 | EOF | |
300 | ||
7d509878 | 301 | test_format complex-subject-mtrunc "%<($truncate_count,mtrunc)%s" <<EOF |
d928d810 AS |
302 | commit $head3 |
303 | Test prin..ex bodies | |
304 | commit $head2 | |
305 | changed (..dert) foo | |
306 | commit $head1 | |
307 | added (hi..f${added_utf8_part_iso88591}gt) foo | |
308 | EOF | |
309 | ||
7d509878 | 310 | test_format complex-subject-ltrunc "%<($truncate_count,ltrunc)%s" <<EOF |
d928d810 AS |
311 | commit $head3 |
312 | .. of complex bodies | |
313 | commit $head2 | |
314 | ..ged (ge${changed_utf8_part_iso88591}ndert) foo | |
315 | commit $head1 | |
316 | .. (hinzugef${added_utf8_part_iso88591}gt) foo | |
317 | EOF | |
318 | ||
0fe6df3c AS |
319 | test_expect_success 'prepare expected messages (for test %b)' ' |
320 | cat <<-EOF >expected.utf-8 && | |
321 | commit $head3 | |
322 | This commit message is much longer than the others, | |
ee3efaf6 AS |
323 | and it will be encoded in $test_encoding. We should therefore |
324 | include an ISO8859 character: ¡bueno! | |
0fe6df3c AS |
325 | |
326 | commit $head2 | |
327 | commit $head1 | |
328 | EOF | |
ee3efaf6 | 329 | iconv -f utf-8 -t $test_encoding expected.utf-8 >expected.ISO8859-1 |
0fe6df3c AS |
330 | ' |
331 | ||
ee3efaf6 | 332 | test_format complex-body %b <expected.ISO8859-1 |
03bcaaca | 333 | |
0fe6df3c AS |
334 | # Git uses i18n.commitEncoding if no i18n.logOutputEncoding set |
335 | # so unset i18n.commitEncoding to test encoding conversion | |
336 | git config --unset i18n.commitEncoding | |
337 | ||
338 | test_format complex-subject-commitencoding-unset %s <<EOF | |
339 | commit $head3 | |
340 | Test printing of complex bodies | |
77a6815d | 341 | commit $head2 |
0fe6df3c | 342 | $changed |
77a6815d | 343 | commit $head1 |
0fe6df3c | 344 | $added |
03bcaaca JK |
345 | EOF |
346 | ||
d928d810 AS |
347 | test_format complex-subject-commitencoding-unset-trunc "%<($truncate_count,trunc)%s" <<EOF |
348 | commit $head3 | |
349 | Test printing of c.. | |
350 | commit $head2 | |
351 | changed (ge${changed_utf8_part}ndert).. | |
352 | commit $head1 | |
353 | added (hinzugef${added_utf8_part}gt.. | |
354 | EOF | |
355 | ||
356 | test_format complex-subject-commitencoding-unset-mtrunc "%<($truncate_count,mtrunc)%s" <<EOF | |
357 | commit $head3 | |
358 | Test prin..ex bodies | |
359 | commit $head2 | |
360 | changed (..dert) foo | |
361 | commit $head1 | |
362 | added (hi..f${added_utf8_part}gt) foo | |
363 | EOF | |
364 | ||
365 | test_format complex-subject-commitencoding-unset-ltrunc "%<($truncate_count,ltrunc)%s" <<EOF | |
366 | commit $head3 | |
367 | .. of complex bodies | |
368 | commit $head2 | |
369 | ..ged (ge${changed_utf8_part}ndert) foo | |
370 | commit $head1 | |
371 | .. (hinzugef${added_utf8_part}gt) foo | |
372 | EOF | |
373 | ||
0fe6df3c AS |
374 | test_format complex-body-commitencoding-unset %b <expected.utf-8 |
375 | ||
9130ac9f | 376 | test_expect_success '%x00 shows NUL' ' |
77a6815d | 377 | echo >expect commit $head3 && |
9130ac9f JK |
378 | echo >>expect fooQbar && |
379 | git rev-list -1 --format=foo%x00bar HEAD >actual.nul && | |
380 | nul_to_q <actual.nul >actual && | |
381 | test_cmp expect actual | |
382 | ' | |
383 | ||
d36f8679 JK |
384 | test_expect_success '%ad respects --date=' ' |
385 | echo 2005-04-07 >expect.ad-short && | |
386 | git log -1 --date=short --pretty=tformat:%ad >output.ad-short master && | |
387 | test_cmp expect.ad-short output.ad-short | |
388 | ' | |
389 | ||
f7ab5c79 JH |
390 | test_expect_success 'empty email' ' |
391 | test_tick && | |
392 | C=$(GIT_AUTHOR_EMAIL= git commit-tree HEAD^{tree} </dev/null) && | |
393 | A=$(git show --pretty=format:%an,%ae,%ad%n -s $C) && | |
a167ece0 | 394 | verbose test "$A" = "A U Thor,,Thu Apr 7 15:14:13 2005 -0700" |
f7ab5c79 JH |
395 | ' |
396 | ||
9fa708da JH |
397 | test_expect_success 'del LF before empty (1)' ' |
398 | git show -s --pretty=format:"%s%n%-b%nThanks%n" HEAD^^ >actual && | |
3fb0459b | 399 | test_line_count = 2 actual |
9fa708da JH |
400 | ' |
401 | ||
402 | test_expect_success 'del LF before empty (2)' ' | |
403 | git show -s --pretty=format:"%s%n%-b%nThanks%n" HEAD >actual && | |
3fb0459b | 404 | test_line_count = 6 actual && |
9fa708da JH |
405 | grep "^$" actual |
406 | ' | |
407 | ||
408 | test_expect_success 'add LF before non-empty (1)' ' | |
409 | git show -s --pretty=format:"%s%+b%nThanks%n" HEAD^^ >actual && | |
3fb0459b | 410 | test_line_count = 2 actual |
9fa708da JH |
411 | ' |
412 | ||
413 | test_expect_success 'add LF before non-empty (2)' ' | |
414 | git show -s --pretty=format:"%s%+b%nThanks%n" HEAD >actual && | |
3fb0459b | 415 | test_line_count = 6 actual && |
9fa708da JH |
416 | grep "^$" actual |
417 | ' | |
418 | ||
7b88176e MG |
419 | test_expect_success 'add SP before non-empty (1)' ' |
420 | git show -s --pretty=format:"%s% bThanks" HEAD^^ >actual && | |
de6029a2 | 421 | test $(wc -w <actual) = 3 |
7b88176e MG |
422 | ' |
423 | ||
424 | test_expect_success 'add SP before non-empty (2)' ' | |
425 | git show -s --pretty=format:"%s% sThanks" HEAD^^ >actual && | |
de6029a2 | 426 | test $(wc -w <actual) = 6 |
7b88176e MG |
427 | ' |
428 | ||
c1977021 WP |
429 | test_expect_success '--abbrev' ' |
430 | echo SHORT SHORT SHORT >expect2 && | |
431 | echo LONG LONG LONG >expect3 && | |
432 | git log -1 --format="%h %h %h" HEAD >actual1 && | |
433 | git log -1 --abbrev=5 --format="%h %h %h" HEAD >actual2 && | |
434 | git log -1 --abbrev=5 --format="%H %H %H" HEAD >actual3 && | |
435 | sed -e "s/$_x40/LONG/g" -e "s/$_x05/SHORT/g" <actual2 >fuzzy2 && | |
436 | sed -e "s/$_x40/LONG/g" -e "s/$_x05/SHORT/g" <actual3 >fuzzy3 && | |
437 | test_cmp expect2 fuzzy2 && | |
438 | test_cmp expect3 fuzzy3 && | |
439 | ! test_cmp actual1 actual2 | |
440 | ' | |
441 | ||
442 | test_expect_success '%H is not affected by --abbrev-commit' ' | |
443 | git log -1 --format=%H --abbrev-commit --abbrev=20 HEAD >actual && | |
444 | len=$(wc -c <actual) && | |
445 | test $len = 41 | |
446 | ' | |
447 | ||
448 | test_expect_success '%h is not affected by --abbrev-commit' ' | |
449 | git log -1 --format=%h --abbrev-commit --abbrev=20 HEAD >actual && | |
450 | len=$(wc -c <actual) && | |
451 | test $len = 21 | |
452 | ' | |
453 | ||
8f8f5476 TR |
454 | test_expect_success '"%h %gD: %gs" is same as git-reflog' ' |
455 | git reflog >expect && | |
456 | git log -g --format="%h %gD: %gs" >actual && | |
457 | test_cmp expect actual | |
458 | ' | |
459 | ||
460 | test_expect_success '"%h %gD: %gs" is same as git-reflog (with date)' ' | |
461 | git reflog --date=raw >expect && | |
462 | git log -g --format="%h %gD: %gs" --date=raw >actual && | |
463 | test_cmp expect actual | |
464 | ' | |
465 | ||
c1977021 WP |
466 | test_expect_success '"%h %gD: %gs" is same as git-reflog (with --abbrev)' ' |
467 | git reflog --abbrev=13 --date=raw >expect && | |
468 | git log -g --abbrev=13 --format="%h %gD: %gs" --date=raw >actual && | |
469 | test_cmp expect actual | |
470 | ' | |
471 | ||
8f8f5476 TR |
472 | test_expect_success '%gd shortens ref name' ' |
473 | echo "master@{0}" >expect.gd-short && | |
474 | git log -g -1 --format=%gd refs/heads/master >actual.gd-short && | |
475 | test_cmp expect.gd-short actual.gd-short | |
476 | ' | |
477 | ||
cd1957f5 JK |
478 | test_expect_success 'reflog identity' ' |
479 | echo "C O Mitter:committer@example.com" >expect && | |
480 | git log -g -1 --format="%gn:%ge" >actual && | |
481 | test_cmp expect actual | |
482 | ' | |
483 | ||
1fb5fdd2 EFL |
484 | test_expect_success 'oneline with empty message' ' |
485 | git commit -m "dummy" --allow-empty && | |
486 | git commit -m "dummy" --allow-empty && | |
487 | git filter-branch --msg-filter "sed -e s/dummy//" HEAD^^.. && | |
f02dd06e | 488 | git rev-list --oneline HEAD >test.txt && |
3fb0459b SL |
489 | test_line_count = 5 test.txt && |
490 | git rev-list --oneline --graph HEAD >testg.txt && | |
491 | test_line_count = 5 testg.txt | |
1fb5fdd2 EFL |
492 | ' |
493 | ||
d9955fd6 JK |
494 | test_expect_success 'single-character name is parsed correctly' ' |
495 | git commit --author="a <a@example.com>" --allow-empty -m foo && | |
496 | echo "a <a@example.com>" >expect && | |
497 | git log -1 --format="%an <%ae>" >actual && | |
498 | test_cmp expect actual | |
499 | ' | |
500 | ||
958b2eb2 JK |
501 | test_expect_success 'unused %G placeholders are passed through' ' |
502 | echo "%GX %G" >expect && | |
503 | git log -1 --format="%GX %G" >actual && | |
504 | test_cmp expect actual | |
505 | ' | |
506 | ||
fa21b602 | 507 | test_done |