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