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