]> git.ipfire.org Git - thirdparty/git.git/blame - t/t4202-log.sh
t: assume test_cmp produces verbose output
[thirdparty/git.git] / t / t4202-log.sh
CommitLineData
0faf2da7
AL
1#!/bin/sh
2
3test_description='git log'
4
5. ./test-lib.sh
cf3983d1 6. "$TEST_DIRECTORY/lib-gpg.sh"
0faf2da7
AL
7
8test_expect_success setup '
9
10 echo one >one &&
11 git add one &&
12 test_tick &&
13 git commit -m initial &&
14
15 echo ichi >one &&
16 git add one &&
17 test_tick &&
18 git commit -m second &&
19
d9305089 20 git mv one ichi &&
0faf2da7
AL
21 test_tick &&
22 git commit -m third &&
23
d9305089
AL
24 cp ichi ein &&
25 git add ein &&
0faf2da7
AL
26 test_tick &&
27 git commit -m fourth &&
28
d9305089
AL
29 mkdir a &&
30 echo ni >a/two &&
31 git add a/two &&
32 test_tick &&
33 git commit -m fifth &&
34
35 git rm a/two &&
0faf2da7 36 test_tick &&
d9305089 37 git commit -m sixth
0faf2da7
AL
38
39'
40
bb93afd5
FC
41printf "sixth\nfifth\nfourth\nthird\nsecond\ninitial" > expect
42test_expect_success 'pretty' '
43
44 git log --pretty="format:%s" > actual &&
45 test_cmp expect actual
46'
47
48printf "sixth\nfifth\nfourth\nthird\nsecond\ninitial\n" > expect
49test_expect_success 'pretty (tformat)' '
50
51 git log --pretty="tformat:%s" > actual &&
52 test_cmp expect actual
53'
54
55test_expect_success 'pretty (shortcut)' '
56
57 git log --pretty="%s" > actual &&
58 test_cmp expect actual
59'
60
61test_expect_success 'format' '
62
63 git log --format="%s" > actual &&
64 test_cmp expect actual
65'
66
37bb5d74
RS
67cat > expect << EOF
68 This is
69 the sixth
70 commit.
71 This is
72 the fifth
73 commit.
74EOF
75
14e1a4e1 76test_expect_success 'format %w(11,1,2)' '
37bb5d74 77
14e1a4e1 78 git log -2 --format="%w(11,1,2)This is the %s commit." > actual &&
37bb5d74
RS
79 test_cmp expect actual
80'
81
82test_expect_success 'format %w(,1,2)' '
83
84 git log -2 --format="%w(,1,2)This is%nthe %s%ncommit." > actual &&
85 test_cmp expect actual
86'
87
bb93afd5
FC
88cat > expect << EOF
89804a787 sixth
90394ef78 fifth
915d31159 fourth
922fbe8c0 third
93f7dab8e second
943a2fdcb initial
95EOF
96test_expect_success 'oneline' '
97
98 git log --oneline > actual &&
99 test_cmp expect actual
100'
101
0faf2da7
AL
102test_expect_success 'diff-filter=A' '
103
dea007fb
MM
104 git log --pretty="format:%s" --diff-filter=A HEAD > actual &&
105 git log --pretty="format:%s" --diff-filter A HEAD > actual-separate &&
106 printf "fifth\nfourth\nthird\ninitial" > expect &&
107 test_cmp expect actual &&
108 test_cmp expect actual-separate
0faf2da7
AL
109
110'
111
112test_expect_success 'diff-filter=M' '
113
114 actual=$(git log --pretty="format:%s" --diff-filter=M HEAD) &&
115 expect=$(echo second) &&
116 test "$actual" = "$expect" || {
117 echo Oops
118 echo "Actual: $actual"
119 false
120 }
121
122'
123
124test_expect_success 'diff-filter=D' '
125
126 actual=$(git log --pretty="format:%s" --diff-filter=D HEAD) &&
d9305089
AL
127 expect=$(echo sixth ; echo third) &&
128 test "$actual" = "$expect" || {
129 echo Oops
130 echo "Actual: $actual"
131 false
132 }
133
134'
135
136test_expect_success 'diff-filter=R' '
137
138 actual=$(git log -M --pretty="format:%s" --diff-filter=R HEAD) &&
139 expect=$(echo third) &&
140 test "$actual" = "$expect" || {
141 echo Oops
142 echo "Actual: $actual"
143 false
144 }
145
146'
147
148test_expect_success 'diff-filter=C' '
149
150 actual=$(git log -C -C --pretty="format:%s" --diff-filter=C HEAD) &&
151 expect=$(echo fourth) &&
152 test "$actual" = "$expect" || {
153 echo Oops
154 echo "Actual: $actual"
155 false
156 }
157
158'
159
160test_expect_success 'git log --follow' '
161
162 actual=$(git log --follow --pretty="format:%s" ichi) &&
163 expect=$(echo third ; echo second ; echo initial) &&
0faf2da7
AL
164 test "$actual" = "$expect" || {
165 echo Oops
166 echo "Actual: $actual"
167 false
168 }
169
170'
171
d5cee0f7
MG
172cat > expect << EOF
173804a787 sixth
174394ef78 fifth
1755d31159 fourth
176EOF
177test_expect_success 'git log --no-walk <commits> sorts by commit time' '
178 git log --no-walk --oneline 5d31159 804a787 394ef78 > actual &&
179 test_cmp expect actual
180'
181
ca92e59e
MZ
182test_expect_success 'git log --no-walk=sorted <commits> sorts by commit time' '
183 git log --no-walk=sorted --oneline 5d31159 804a787 394ef78 > actual &&
184 test_cmp expect actual
185'
186
d5cee0f7
MG
187cat > expect << EOF
1885d31159 fourth
189804a787 sixth
190394ef78 fifth
191EOF
ca92e59e
MZ
192test_expect_success 'git log --no-walk=unsorted <commits> leaves list of commits as given' '
193 git log --no-walk=unsorted --oneline 5d31159 804a787 394ef78 > actual &&
194 test_cmp expect actual
195'
196
d5cee0f7
MG
197test_expect_success 'git show <commits> leaves list of commits as given' '
198 git show --oneline -s 5d31159 804a787 394ef78 > actual &&
199 test_cmp expect actual
200'
201
0843acfd
JK
202test_expect_success 'setup case sensitivity tests' '
203 echo case >one &&
204 test_tick &&
a48fcd83 205 git add one &&
0843acfd
JK
206 git commit -a -m Second
207'
208
209test_expect_success 'log --grep' '
210 echo second >expect &&
211 git log -1 --pretty="tformat:%s" --grep=sec >actual &&
22dfa8a2
CJ
212 test_cmp expect actual
213'
214
215cat > expect << EOF
216second
217initial
218EOF
219test_expect_success 'log --invert-grep --grep' '
220 git log --pretty="tformat:%s" --invert-grep --grep=th --grep=Sec >actual &&
221 test_cmp expect actual
222'
223
224test_expect_success 'log --invert-grep --grep -i' '
225 echo initial >expect &&
226 git log --pretty="tformat:%s" --invert-grep -i --grep=th --grep=Sec >actual &&
0843acfd
JK
227 test_cmp expect actual
228'
0faf2da7 229
7d7b86f7
MM
230test_expect_success 'log --grep option parsing' '
231 echo second >expect &&
232 git log -1 --pretty="tformat:%s" --grep sec >actual &&
233 test_cmp expect actual &&
234 test_must_fail git log -1 --pretty="tformat:%s" --grep
235'
236
0843acfd
JK
237test_expect_success 'log -i --grep' '
238 echo Second >expect &&
239 git log -1 --pretty="tformat:%s" -i --grep=sec >actual &&
240 test_cmp expect actual
241'
242
243test_expect_success 'log --grep -i' '
244 echo Second >expect &&
245 git log -1 --pretty="tformat:%s" --grep=sec -i >actual &&
246 test_cmp expect actual
247'
0faf2da7 248
34a4ae55
JH
249test_expect_success 'log -F -E --grep=<ere> uses ere' '
250 echo second >expect &&
251 git log -1 --pretty="tformat:%s" -F -E --grep=s.c.nd >actual &&
252 test_cmp expect actual
253'
254
289e1623
TR
255cat > expect <<EOF
256* Second
257* sixth
258* fifth
259* fourth
260* third
261* second
262* initial
263EOF
264
265test_expect_success 'simple log --graph' '
266 git log --graph --pretty=tformat:%s >actual &&
267 test_cmp expect actual
268'
269
270test_expect_success 'set up merge history' '
271 git checkout -b side HEAD~4 &&
272 test_commit side-1 1 1 &&
273 test_commit side-2 2 2 &&
274 git checkout master &&
275 git merge side
276'
277
278cat > expect <<\EOF
279* Merge branch 'side'
280|\
281| * side-2
282| * side-1
283* | Second
284* | sixth
285* | fifth
286* | fourth
287|/
288* third
289* second
290* initial
291EOF
292
293test_expect_success 'log --graph with merge' '
294 git log --graph --date-order --pretty=tformat:%s |
9524cf29 295 sed "s/ *\$//" >actual &&
289e1623
TR
296 test_cmp expect actual
297'
298
656197ad
MK
299test_expect_success 'log --raw --graph -m with merge' '
300 git log --raw --graph --oneline -m master | head -n 500 >actual &&
301 grep "initial" actual
302'
303
304test_expect_success 'diff-tree --graph' '
305 git diff-tree --graph master^ | head -n 500 >actual &&
306 grep "one" actual
307'
308
289e1623
TR
309cat > expect <<\EOF
310* commit master
311|\ Merge: A B
312| | Author: A U Thor <author@example.com>
313| |
314| | Merge branch 'side'
315| |
316| * commit side
317| | Author: A U Thor <author@example.com>
318| |
319| | side-2
320| |
321| * commit tags/side-1
322| | Author: A U Thor <author@example.com>
323| |
324| | side-1
325| |
326* | commit master~1
327| | Author: A U Thor <author@example.com>
328| |
329| | Second
330| |
331* | commit master~2
332| | Author: A U Thor <author@example.com>
333| |
334| | sixth
335| |
336* | commit master~3
337| | Author: A U Thor <author@example.com>
338| |
339| | fifth
340| |
341* | commit master~4
342|/ Author: A U Thor <author@example.com>
343|
344| fourth
345|
346* commit tags/side-1~1
347| Author: A U Thor <author@example.com>
348|
349| third
350|
351* commit tags/side-1~2
352| Author: A U Thor <author@example.com>
353|
354| second
355|
356* commit tags/side-1~3
357 Author: A U Thor <author@example.com>
358
359 initial
360EOF
361
362test_expect_success 'log --graph with full output' '
363 git log --graph --date-order --pretty=short |
364 git name-rev --name-only --stdin |
9524cf29 365 sed "s/Merge:.*/Merge: A B/;s/ *\$//" >actual &&
289e1623
TR
366 test_cmp expect actual
367'
368
369test_expect_success 'set up more tangled history' '
370 git checkout -b tangle HEAD~6 &&
371 test_commit tangle-a tangle-a a &&
372 git merge master~3 &&
373 git merge side~1 &&
374 git checkout master &&
7b1d6269
AC
375 git merge tangle &&
376 git checkout -b reach &&
377 test_commit reach &&
378 git checkout master &&
379 git checkout -b octopus-a &&
380 test_commit octopus-a &&
381 git checkout master &&
382 git checkout -b octopus-b &&
383 test_commit octopus-b &&
384 git checkout master &&
385 test_commit seventh &&
a48fcd83 386 git merge octopus-a octopus-b &&
7b1d6269 387 git merge reach
289e1623
TR
388'
389
390cat > expect <<\EOF
57b58db7 391* Merge tag 'reach'
7b1d6269
AC
392|\
393| \
394| \
57b58db7 395*-. \ Merge tags 'octopus-a' and 'octopus-b'
7b1d6269
AC
396|\ \ \
397* | | | seventh
398| | * | octopus-b
399| |/ /
400|/| |
401| * | octopus-a
402|/ /
403| * reach
404|/
289e1623
TR
405* Merge branch 'tangle'
406|\
407| * Merge branch 'side' (early part) into tangle
408| |\
409| * \ Merge branch 'master' (early part) into tangle
410| |\ \
411| * | | tangle-a
412* | | | Merge branch 'side'
413|\ \ \ \
414| * | | | side-2
eaf158f8 415| | |_|/
289e1623
TR
416| |/| |
417| * | | side-1
418* | | | Second
419* | | | sixth
eaf158f8 420| |_|/
289e1623
TR
421|/| |
422* | | fifth
423* | | fourth
424|/ /
425* | third
426|/
427* second
428* initial
429EOF
430
95110d75 431test_expect_success 'log --graph with merge' '
289e1623 432 git log --graph --date-order --pretty=tformat:%s |
9524cf29 433 sed "s/ *\$//" >actual &&
289e1623
TR
434 test_cmp expect actual
435'
436
8a3d203b 437test_expect_success 'log.decorate configuration' '
4f62c2bc
JH
438 git log --oneline >expect.none &&
439 git log --oneline --decorate >expect.short &&
440 git log --oneline --decorate=full >expect.full &&
8a3d203b
JH
441
442 echo "[log] decorate" >>.git/config &&
635530a2 443 git log --oneline >actual &&
4f62c2bc 444 test_cmp expect.short actual &&
8a3d203b 445
90e76b70 446 test_config log.decorate true &&
4f62c2bc 447 git log --oneline >actual &&
8a3d203b 448 test_cmp expect.short actual &&
4f62c2bc 449 git log --oneline --decorate=full >actual &&
8a3d203b 450 test_cmp expect.full actual &&
4f62c2bc 451 git log --oneline --decorate=no >actual &&
8a3d203b
JH
452 test_cmp expect.none actual &&
453
90e76b70 454 test_config log.decorate no &&
4f62c2bc 455 git log --oneline >actual &&
8a3d203b 456 test_cmp expect.none actual &&
4f62c2bc 457 git log --oneline --decorate >actual &&
8a3d203b 458 test_cmp expect.short actual &&
4f62c2bc 459 git log --oneline --decorate=full >actual &&
8a3d203b
JH
460 test_cmp expect.full actual &&
461
90e76b70 462 test_config log.decorate 1 &&
b2be2f6a
JK
463 git log --oneline >actual &&
464 test_cmp expect.short actual &&
465 git log --oneline --decorate=full >actual &&
466 test_cmp expect.full actual &&
467 git log --oneline --decorate=no >actual &&
468 test_cmp expect.none actual &&
469
90e76b70 470 test_config log.decorate short &&
4f62c2bc 471 git log --oneline >actual &&
8a3d203b 472 test_cmp expect.short actual &&
4f62c2bc 473 git log --oneline --no-decorate >actual &&
8a3d203b 474 test_cmp expect.none actual &&
4f62c2bc 475 git log --oneline --decorate=full >actual &&
8a3d203b
JH
476 test_cmp expect.full actual &&
477
90e76b70 478 test_config log.decorate full &&
4f62c2bc 479 git log --oneline >actual &&
8a3d203b 480 test_cmp expect.full actual &&
4f62c2bc 481 git log --oneline --no-decorate >actual &&
8a3d203b 482 test_cmp expect.none actual &&
4f62c2bc 483 git log --oneline --decorate >actual &&
8fb26872 484 test_cmp expect.short actual &&
8a3d203b 485
90e76b70 486 test_unconfig log.decorate &&
0c47695a 487 git log --pretty=raw >expect.raw &&
90e76b70 488 test_config log.decorate full &&
0c47695a
JS
489 git log --pretty=raw >actual &&
490 test_cmp expect.raw actual
491
492'
493
494test_expect_success 'reflog is expected format' '
0c47695a
JS
495 git log -g --abbrev-commit --pretty=oneline >expect &&
496 git reflog >actual &&
497 test_cmp expect actual
498'
499
500test_expect_success 'whatchanged is expected format' '
501 git log --no-merges --raw >expect &&
502 git whatchanged >actual &&
503 test_cmp expect actual
504'
505
506test_expect_success 'log.abbrevCommit configuration' '
0c47695a
JS
507 git log --abbrev-commit >expect.log.abbrev &&
508 git log --no-abbrev-commit >expect.log.full &&
509 git log --pretty=raw >expect.log.raw &&
510 git reflog --abbrev-commit >expect.reflog.abbrev &&
511 git reflog --no-abbrev-commit >expect.reflog.full &&
512 git whatchanged --abbrev-commit >expect.whatchanged.abbrev &&
513 git whatchanged --no-abbrev-commit >expect.whatchanged.full &&
514
90e76b70 515 test_config log.abbrevCommit true &&
0c47695a
JS
516
517 git log >actual &&
518 test_cmp expect.log.abbrev actual &&
519 git log --no-abbrev-commit >actual &&
520 test_cmp expect.log.full actual &&
521
522 git log --pretty=raw >actual &&
523 test_cmp expect.log.raw actual &&
524
525 git reflog >actual &&
526 test_cmp expect.reflog.abbrev actual &&
527 git reflog --no-abbrev-commit >actual &&
528 test_cmp expect.reflog.full actual &&
529
530 git whatchanged >actual &&
531 test_cmp expect.whatchanged.abbrev actual &&
532 git whatchanged --no-abbrev-commit >actual &&
533 test_cmp expect.whatchanged.full actual
8a3d203b
JH
534'
535
65113121
ÆAB
536test_expect_success 'show added path under "--follow -M"' '
537 # This tests for a regression introduced in v1.7.2-rc0~103^2~2
538 test_create_repo regression &&
539 (
540 cd regression &&
541 test_commit needs-another-commit &&
542 test_commit foo.bar &&
543 git log -M --follow -p foo.bar.t &&
544 git log -M --follow --stat foo.bar.t &&
545 git log -M --follow --name-only foo.bar.t
546 )
547'
c65233fe 548
46ec510a
CB
549test_expect_success 'git log -c --follow' '
550 test_create_repo follow-c &&
551 (
552 cd follow-c &&
553 test_commit initial file original &&
554 git rm file &&
555 test_commit rename file2 original &&
556 git reset --hard initial &&
557 test_commit modify file foo &&
558 git merge -m merge rename &&
559 git log -c --follow file2
560 )
561'
562
e2c59667
LP
563cat >expect <<\EOF
564* commit COMMIT_OBJECT_NAME
565|\ Merge: MERGE_PARENTS
566| | Author: A U Thor <author@example.com>
567| |
568| | Merge HEADS DESCRIPTION
569| |
570| * commit COMMIT_OBJECT_NAME
571| | Author: A U Thor <author@example.com>
572| |
573| | reach
574| | ---
dc801e71 575| | reach.t | 1 +
e2c59667
LP
576| | 1 file changed, 1 insertion(+)
577| |
578| | diff --git a/reach.t b/reach.t
579| | new file mode 100644
580| | index 0000000..10c9591
581| | --- /dev/null
582| | +++ b/reach.t
583| | @@ -0,0 +1 @@
584| | +reach
585| |
586| \
587*-. \ commit COMMIT_OBJECT_NAME
588|\ \ \ Merge: MERGE_PARENTS
589| | | | Author: A U Thor <author@example.com>
590| | | |
591| | | | Merge HEADS DESCRIPTION
592| | | |
593| | * | commit COMMIT_OBJECT_NAME
594| | |/ Author: A U Thor <author@example.com>
595| | |
596| | | octopus-b
597| | | ---
dc801e71 598| | | octopus-b.t | 1 +
e2c59667
LP
599| | | 1 file changed, 1 insertion(+)
600| | |
601| | | diff --git a/octopus-b.t b/octopus-b.t
602| | | new file mode 100644
603| | | index 0000000..d5fcad0
604| | | --- /dev/null
605| | | +++ b/octopus-b.t
606| | | @@ -0,0 +1 @@
607| | | +octopus-b
608| | |
609| * | commit COMMIT_OBJECT_NAME
610| |/ Author: A U Thor <author@example.com>
611| |
612| | octopus-a
613| | ---
dc801e71 614| | octopus-a.t | 1 +
e2c59667
LP
615| | 1 file changed, 1 insertion(+)
616| |
617| | diff --git a/octopus-a.t b/octopus-a.t
618| | new file mode 100644
619| | index 0000000..11ee015
620| | --- /dev/null
621| | +++ b/octopus-a.t
622| | @@ -0,0 +1 @@
623| | +octopus-a
624| |
625* | commit COMMIT_OBJECT_NAME
626|/ Author: A U Thor <author@example.com>
627|
628| seventh
629| ---
dc801e71 630| seventh.t | 1 +
e2c59667
LP
631| 1 file changed, 1 insertion(+)
632|
633| diff --git a/seventh.t b/seventh.t
634| new file mode 100644
635| index 0000000..9744ffc
636| --- /dev/null
637| +++ b/seventh.t
638| @@ -0,0 +1 @@
639| +seventh
640|
641* commit COMMIT_OBJECT_NAME
642|\ Merge: MERGE_PARENTS
643| | Author: A U Thor <author@example.com>
644| |
645| | Merge branch 'tangle'
646| |
647| * commit COMMIT_OBJECT_NAME
648| |\ Merge: MERGE_PARENTS
649| | | Author: A U Thor <author@example.com>
650| | |
651| | | Merge branch 'side' (early part) into tangle
652| | |
653| * | commit COMMIT_OBJECT_NAME
654| |\ \ Merge: MERGE_PARENTS
655| | | | Author: A U Thor <author@example.com>
656| | | |
657| | | | Merge branch 'master' (early part) into tangle
658| | | |
659| * | | commit COMMIT_OBJECT_NAME
660| | | | Author: A U Thor <author@example.com>
661| | | |
662| | | | tangle-a
663| | | | ---
dc801e71 664| | | | tangle-a | 1 +
e2c59667
LP
665| | | | 1 file changed, 1 insertion(+)
666| | | |
667| | | | diff --git a/tangle-a b/tangle-a
668| | | | new file mode 100644
669| | | | index 0000000..7898192
670| | | | --- /dev/null
671| | | | +++ b/tangle-a
672| | | | @@ -0,0 +1 @@
673| | | | +a
674| | | |
675* | | | commit COMMIT_OBJECT_NAME
676|\ \ \ \ Merge: MERGE_PARENTS
677| | | | | Author: A U Thor <author@example.com>
678| | | | |
679| | | | | Merge branch 'side'
680| | | | |
681| * | | | commit COMMIT_OBJECT_NAME
682| | |_|/ Author: A U Thor <author@example.com>
683| |/| |
684| | | | side-2
685| | | | ---
dc801e71 686| | | | 2 | 1 +
e2c59667
LP
687| | | | 1 file changed, 1 insertion(+)
688| | | |
689| | | | diff --git a/2 b/2
690| | | | new file mode 100644
691| | | | index 0000000..0cfbf08
692| | | | --- /dev/null
693| | | | +++ b/2
694| | | | @@ -0,0 +1 @@
695| | | | +2
696| | | |
697| * | | commit COMMIT_OBJECT_NAME
698| | | | Author: A U Thor <author@example.com>
699| | | |
700| | | | side-1
701| | | | ---
dc801e71 702| | | | 1 | 1 +
e2c59667
LP
703| | | | 1 file changed, 1 insertion(+)
704| | | |
705| | | | diff --git a/1 b/1
706| | | | new file mode 100644
707| | | | index 0000000..d00491f
708| | | | --- /dev/null
709| | | | +++ b/1
710| | | | @@ -0,0 +1 @@
711| | | | +1
712| | | |
713* | | | commit COMMIT_OBJECT_NAME
714| | | | Author: A U Thor <author@example.com>
715| | | |
716| | | | Second
717| | | | ---
dc801e71 718| | | | one | 1 +
e2c59667
LP
719| | | | 1 file changed, 1 insertion(+)
720| | | |
721| | | | diff --git a/one b/one
722| | | | new file mode 100644
723| | | | index 0000000..9a33383
724| | | | --- /dev/null
725| | | | +++ b/one
726| | | | @@ -0,0 +1 @@
727| | | | +case
728| | | |
729* | | | commit COMMIT_OBJECT_NAME
730| |_|/ Author: A U Thor <author@example.com>
731|/| |
732| | | sixth
733| | | ---
dc801e71 734| | | a/two | 1 -
e2c59667
LP
735| | | 1 file changed, 1 deletion(-)
736| | |
737| | | diff --git a/a/two b/a/two
738| | | deleted file mode 100644
739| | | index 9245af5..0000000
740| | | --- a/a/two
741| | | +++ /dev/null
742| | | @@ -1 +0,0 @@
743| | | -ni
744| | |
745* | | commit COMMIT_OBJECT_NAME
746| | | Author: A U Thor <author@example.com>
747| | |
748| | | fifth
749| | | ---
dc801e71 750| | | a/two | 1 +
e2c59667
LP
751| | | 1 file changed, 1 insertion(+)
752| | |
753| | | diff --git a/a/two b/a/two
754| | | new file mode 100644
755| | | index 0000000..9245af5
756| | | --- /dev/null
757| | | +++ b/a/two
758| | | @@ -0,0 +1 @@
759| | | +ni
760| | |
761* | | commit COMMIT_OBJECT_NAME
762|/ / Author: A U Thor <author@example.com>
763| |
764| | fourth
765| | ---
dc801e71 766| | ein | 1 +
e2c59667
LP
767| | 1 file changed, 1 insertion(+)
768| |
769| | diff --git a/ein b/ein
770| | new file mode 100644
771| | index 0000000..9d7e69f
772| | --- /dev/null
773| | +++ b/ein
774| | @@ -0,0 +1 @@
775| | +ichi
776| |
777* | commit COMMIT_OBJECT_NAME
778|/ Author: A U Thor <author@example.com>
779|
780| third
781| ---
dc801e71
ZJS
782| ichi | 1 +
783| one | 1 -
e2c59667
LP
784| 2 files changed, 1 insertion(+), 1 deletion(-)
785|
786| diff --git a/ichi b/ichi
787| new file mode 100644
788| index 0000000..9d7e69f
789| --- /dev/null
790| +++ b/ichi
791| @@ -0,0 +1 @@
792| +ichi
793| diff --git a/one b/one
794| deleted file mode 100644
795| index 9d7e69f..0000000
796| --- a/one
797| +++ /dev/null
798| @@ -1 +0,0 @@
799| -ichi
800|
801* commit COMMIT_OBJECT_NAME
802| Author: A U Thor <author@example.com>
803|
804| second
805| ---
dc801e71 806| one | 2 +-
e2c59667
LP
807| 1 file changed, 1 insertion(+), 1 deletion(-)
808|
809| diff --git a/one b/one
810| index 5626abf..9d7e69f 100644
811| --- a/one
812| +++ b/one
813| @@ -1 +1 @@
814| -one
815| +ichi
816|
817* commit COMMIT_OBJECT_NAME
818 Author: A U Thor <author@example.com>
819
820 initial
821 ---
dc801e71 822 one | 1 +
e2c59667
LP
823 1 file changed, 1 insertion(+)
824
825 diff --git a/one b/one
826 new file mode 100644
827 index 0000000..5626abf
828 --- /dev/null
829 +++ b/one
830 @@ -0,0 +1 @@
831 +one
832EOF
833
834sanitize_output () {
835 sed -e 's/ *$//' \
836 -e 's/commit [0-9a-f]*$/commit COMMIT_OBJECT_NAME/' \
837 -e 's/Merge: [ 0-9a-f]*$/Merge: MERGE_PARENTS/' \
838 -e 's/Merge tag.*/Merge HEADS DESCRIPTION/' \
839 -e 's/Merge commit.*/Merge HEADS DESCRIPTION/' \
840 -e 's/, 0 deletions(-)//' \
841 -e 's/, 0 insertions(+)//' \
842 -e 's/ 1 files changed, / 1 file changed, /' \
843 -e 's/, 1 deletions(-)/, 1 deletion(-)/' \
844 -e 's/, 1 insertions(+)/, 1 insertion(+)/'
845}
846
847test_expect_success 'log --graph with diff and stats' '
848 git log --graph --pretty=short --stat -p >actual &&
849 sanitize_output >actual.sanitized <actual &&
b354f11b 850 test_i18ncmp expect actual.sanitized
e2c59667
LP
851'
852
003c84f6
JH
853test_expect_success 'dotdot is a parent directory' '
854 mkdir -p a/b &&
855 ( echo sixth && echo fifth ) >expect &&
856 ( cd a/b && git log --format=%s .. ) >actual &&
857 test_cmp expect actual
858'
859
cf3983d1
ZK
860test_expect_success GPG 'log --graph --show-signature' '
861 test_when_finished "git reset --hard && git checkout master" &&
862 git checkout -b signed master &&
863 echo foo >foo &&
864 git add foo &&
865 git commit -S -m signed_commit &&
866 git log --graph --show-signature -n1 signed >actual &&
867 grep "^| gpg: Signature made" actual &&
868 grep "^| gpg: Good signature" actual
869'
870
871test_expect_success GPG 'log --graph --show-signature for merged tag' '
872 test_when_finished "git reset --hard && git checkout master" &&
873 git checkout -b plain master &&
874 echo aaa >bar &&
875 git add bar &&
876 git commit -m bar_commit &&
877 git checkout -b tagged master &&
878 echo bbb >baz &&
879 git add baz &&
880 git commit -m baz_commit &&
881 git tag -s -m signed_tag_msg signed_tag &&
882 git checkout plain &&
883 git merge --no-ff -m msg signed_tag &&
884 git log --graph --show-signature -n1 plain >actual &&
885 grep "^|\\\ merged tag" actual &&
886 grep "^| | gpg: Signature made" actual &&
887 grep "^| | gpg: Good signature" actual
888'
889
65113121 890test_done