mingw: skip test in t1508 that fails due to path conversion
[alt-git.git] / t / t4202-log.sh
blobcb82eb7e66b4feb24086407019a812f46b715a34
1 #!/bin/sh
3 test_description='git log'
5 . ./test-lib.sh
6 . "$TEST_DIRECTORY/lib-gpg.sh"
8 test_expect_success setup '
10 echo one >one &&
11 git add one &&
12 test_tick &&
13 git commit -m initial &&
15 echo ichi >one &&
16 git add one &&
17 test_tick &&
18 git commit -m second &&
20 git mv one ichi &&
21 test_tick &&
22 git commit -m third &&
24 cp ichi ein &&
25 git add ein &&
26 test_tick &&
27 git commit -m fourth &&
29 mkdir a &&
30 echo ni >a/two &&
31 git add a/two &&
32 test_tick &&
33 git commit -m fifth &&
35 git rm a/two &&
36 test_tick &&
37 git commit -m sixth
41 printf "sixth\nfifth\nfourth\nthird\nsecond\ninitial" > expect
42 test_expect_success 'pretty' '
44 git log --pretty="format:%s" > actual &&
45 test_cmp expect actual
48 printf "sixth\nfifth\nfourth\nthird\nsecond\ninitial\n" > expect
49 test_expect_success 'pretty (tformat)' '
51 git log --pretty="tformat:%s" > actual &&
52 test_cmp expect actual
55 test_expect_success 'pretty (shortcut)' '
57 git log --pretty="%s" > actual &&
58 test_cmp expect actual
61 test_expect_success 'format' '
63 git log --format="%s" > actual &&
64 test_cmp expect actual
67 cat > expect << EOF
68 This is
69 the sixth
70 commit.
71 This is
72 the fifth
73 commit.
74 EOF
76 test_expect_success 'format %w(11,1,2)' '
78 git log -2 --format="%w(11,1,2)This is the %s commit." > actual &&
79 test_cmp expect actual
82 test_expect_success 'format %w(,1,2)' '
84 git log -2 --format="%w(,1,2)This is%nthe %s%ncommit." > actual &&
85 test_cmp expect actual
88 cat > expect << EOF
89 804a787 sixth
90 394ef78 fifth
91 5d31159 fourth
92 2fbe8c0 third
93 f7dab8e second
94 3a2fdcb initial
95 EOF
96 test_expect_success 'oneline' '
98 git log --oneline > actual &&
99 test_cmp expect actual
102 test_expect_success 'diff-filter=A' '
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
112 test_expect_success 'diff-filter=M' '
114 actual=$(git log --pretty="format:%s" --diff-filter=M HEAD) &&
115 expect=$(echo second) &&
116 verbose test "$actual" = "$expect"
120 test_expect_success 'diff-filter=D' '
122 actual=$(git log --pretty="format:%s" --diff-filter=D HEAD) &&
123 expect=$(echo sixth ; echo third) &&
124 verbose test "$actual" = "$expect"
128 test_expect_success 'diff-filter=R' '
130 actual=$(git log -M --pretty="format:%s" --diff-filter=R HEAD) &&
131 expect=$(echo third) &&
132 verbose test "$actual" = "$expect"
136 test_expect_success 'diff-filter=C' '
138 actual=$(git log -C -C --pretty="format:%s" --diff-filter=C HEAD) &&
139 expect=$(echo fourth) &&
140 verbose test "$actual" = "$expect"
144 test_expect_success 'git log --follow' '
146 actual=$(git log --follow --pretty="format:%s" ichi) &&
147 expect=$(echo third ; echo second ; echo initial) &&
148 verbose test "$actual" = "$expect"
151 test_expect_success 'git config log.follow works like --follow' '
152 test_config log.follow true &&
153 actual=$(git log --pretty="format:%s" ichi) &&
154 expect=$(echo third ; echo second ; echo initial) &&
155 verbose test "$actual" = "$expect"
158 test_expect_success 'git config log.follow does not die with multiple paths' '
159 test_config log.follow true &&
160 git log --pretty="format:%s" ichi ein
163 test_expect_success 'git config log.follow does not die with no paths' '
164 test_config log.follow true &&
165 git log --
168 test_expect_success 'git config log.follow is overridden by --no-follow' '
169 test_config log.follow true &&
170 actual=$(git log --no-follow --pretty="format:%s" ichi) &&
171 expect="third" &&
172 verbose test "$actual" = "$expect"
175 cat > expect << EOF
176 804a787 sixth
177 394ef78 fifth
178 5d31159 fourth
180 test_expect_success 'git log --no-walk <commits> sorts by commit time' '
181 git log --no-walk --oneline 5d31159 804a787 394ef78 > actual &&
182 test_cmp expect actual
185 test_expect_success 'git log --no-walk=sorted <commits> sorts by commit time' '
186 git log --no-walk=sorted --oneline 5d31159 804a787 394ef78 > actual &&
187 test_cmp expect actual
190 cat > expect << EOF
191 5d31159 fourth
192 804a787 sixth
193 394ef78 fifth
195 test_expect_success 'git log --no-walk=unsorted <commits> leaves list of commits as given' '
196 git log --no-walk=unsorted --oneline 5d31159 804a787 394ef78 > actual &&
197 test_cmp expect actual
200 test_expect_success 'git show <commits> leaves list of commits as given' '
201 git show --oneline -s 5d31159 804a787 394ef78 > actual &&
202 test_cmp expect actual
205 test_expect_success 'setup case sensitivity tests' '
206 echo case >one &&
207 test_tick &&
208 git add one &&
209 git commit -a -m Second
212 test_expect_success 'log --grep' '
213 echo second >expect &&
214 git log -1 --pretty="tformat:%s" --grep=sec >actual &&
215 test_cmp expect actual
218 cat > expect << EOF
219 second
220 initial
222 test_expect_success 'log --invert-grep --grep' '
223 git log --pretty="tformat:%s" --invert-grep --grep=th --grep=Sec >actual &&
224 test_cmp expect actual
227 test_expect_success 'log --invert-grep --grep -i' '
228 echo initial >expect &&
229 git log --pretty="tformat:%s" --invert-grep -i --grep=th --grep=Sec >actual &&
230 test_cmp expect actual
233 test_expect_success 'log --grep option parsing' '
234 echo second >expect &&
235 git log -1 --pretty="tformat:%s" --grep sec >actual &&
236 test_cmp expect actual &&
237 test_must_fail git log -1 --pretty="tformat:%s" --grep
240 test_expect_success 'log -i --grep' '
241 echo Second >expect &&
242 git log -1 --pretty="tformat:%s" -i --grep=sec >actual &&
243 test_cmp expect actual
246 test_expect_success 'log --grep -i' '
247 echo Second >expect &&
248 git log -1 --pretty="tformat:%s" --grep=sec -i >actual &&
249 test_cmp expect actual
252 test_expect_success 'log -F -E --grep=<ere> uses ere' '
253 echo second >expect &&
254 git log -1 --pretty="tformat:%s" -F -E --grep=s.c.nd >actual &&
255 test_cmp expect actual
258 cat > expect <<EOF
259 * Second
260 * sixth
261 * fifth
262 * fourth
263 * third
264 * second
265 * initial
268 test_expect_success 'simple log --graph' '
269 git log --graph --pretty=tformat:%s >actual &&
270 test_cmp expect actual
273 test_expect_success 'set up merge history' '
274 git checkout -b side HEAD~4 &&
275 test_commit side-1 1 1 &&
276 test_commit side-2 2 2 &&
277 git checkout master &&
278 git merge side
281 cat > expect <<\EOF
282 * Merge branch 'side'
284 | * side-2
285 | * side-1
286 * | Second
287 * | sixth
288 * | fifth
289 * | fourth
291 * third
292 * second
293 * initial
296 test_expect_success 'log --graph with merge' '
297 git log --graph --date-order --pretty=tformat:%s |
298 sed "s/ *\$//" >actual &&
299 test_cmp expect actual
302 test_expect_success 'log --raw --graph -m with merge' '
303 git log --raw --graph --oneline -m master | head -n 500 >actual &&
304 grep "initial" actual
307 test_expect_success 'diff-tree --graph' '
308 git diff-tree --graph master^ | head -n 500 >actual &&
309 grep "one" actual
312 cat > expect <<\EOF
313 * commit master
314 |\ Merge: A B
315 | | Author: A U Thor <author@example.com>
317 | | Merge branch 'side'
319 | * commit side
320 | | Author: A U Thor <author@example.com>
322 | | side-2
324 | * commit tags/side-1
325 | | Author: A U Thor <author@example.com>
327 | | side-1
329 * | commit master~1
330 | | Author: A U Thor <author@example.com>
332 | | Second
334 * | commit master~2
335 | | Author: A U Thor <author@example.com>
337 | | sixth
339 * | commit master~3
340 | | Author: A U Thor <author@example.com>
342 | | fifth
344 * | commit master~4
345 |/ Author: A U Thor <author@example.com>
347 | fourth
349 * commit tags/side-1~1
350 | Author: A U Thor <author@example.com>
352 | third
354 * commit tags/side-1~2
355 | Author: A U Thor <author@example.com>
357 | second
359 * commit tags/side-1~3
360 Author: A U Thor <author@example.com>
362 initial
365 test_expect_success 'log --graph with full output' '
366 git log --graph --date-order --pretty=short |
367 git name-rev --name-only --stdin |
368 sed "s/Merge:.*/Merge: A B/;s/ *\$//" >actual &&
369 test_cmp expect actual
372 test_expect_success 'set up more tangled history' '
373 git checkout -b tangle HEAD~6 &&
374 test_commit tangle-a tangle-a a &&
375 git merge master~3 &&
376 git merge side~1 &&
377 git checkout master &&
378 git merge tangle &&
379 git checkout -b reach &&
380 test_commit reach &&
381 git checkout master &&
382 git checkout -b octopus-a &&
383 test_commit octopus-a &&
384 git checkout master &&
385 git checkout -b octopus-b &&
386 test_commit octopus-b &&
387 git checkout master &&
388 test_commit seventh &&
389 git merge octopus-a octopus-b &&
390 git merge reach
393 cat > expect <<\EOF
394 * Merge tag 'reach'
398 *-. \ Merge tags 'octopus-a' and 'octopus-b'
399 |\ \ \
400 * | | | seventh
401 | | * | octopus-b
402 | |/ /
403 |/| |
404 | * | octopus-a
405 |/ /
406 | * reach
408 * Merge branch 'tangle'
410 | * Merge branch 'side' (early part) into tangle
411 | |\
412 | * \ Merge branch 'master' (early part) into tangle
413 | |\ \
414 | * | | tangle-a
415 * | | | Merge branch 'side'
416 |\ \ \ \
417 | * | | | side-2
418 | | |_|/
419 | |/| |
420 | * | | side-1
421 * | | | Second
422 * | | | sixth
423 | |_|/
424 |/| |
425 * | | fifth
426 * | | fourth
427 |/ /
428 * | third
430 * second
431 * initial
434 test_expect_success 'log --graph with merge' '
435 git log --graph --date-order --pretty=tformat:%s |
436 sed "s/ *\$//" >actual &&
437 test_cmp expect actual
440 test_expect_success 'log.decorate configuration' '
441 git log --oneline >expect.none &&
442 git log --oneline --decorate >expect.short &&
443 git log --oneline --decorate=full >expect.full &&
445 echo "[log] decorate" >>.git/config &&
446 git log --oneline >actual &&
447 test_cmp expect.short actual &&
449 test_config log.decorate true &&
450 git log --oneline >actual &&
451 test_cmp expect.short actual &&
452 git log --oneline --decorate=full >actual &&
453 test_cmp expect.full actual &&
454 git log --oneline --decorate=no >actual &&
455 test_cmp expect.none actual &&
457 test_config log.decorate no &&
458 git log --oneline >actual &&
459 test_cmp expect.none actual &&
460 git log --oneline --decorate >actual &&
461 test_cmp expect.short actual &&
462 git log --oneline --decorate=full >actual &&
463 test_cmp expect.full actual &&
465 test_config log.decorate 1 &&
466 git log --oneline >actual &&
467 test_cmp expect.short actual &&
468 git log --oneline --decorate=full >actual &&
469 test_cmp expect.full actual &&
470 git log --oneline --decorate=no >actual &&
471 test_cmp expect.none actual &&
473 test_config log.decorate short &&
474 git log --oneline >actual &&
475 test_cmp expect.short actual &&
476 git log --oneline --no-decorate >actual &&
477 test_cmp expect.none actual &&
478 git log --oneline --decorate=full >actual &&
479 test_cmp expect.full actual &&
481 test_config log.decorate full &&
482 git log --oneline >actual &&
483 test_cmp expect.full actual &&
484 git log --oneline --no-decorate >actual &&
485 test_cmp expect.none actual &&
486 git log --oneline --decorate >actual &&
487 test_cmp expect.short actual &&
489 test_unconfig log.decorate &&
490 git log --pretty=raw >expect.raw &&
491 test_config log.decorate full &&
492 git log --pretty=raw >actual &&
493 test_cmp expect.raw actual
497 test_expect_success 'reflog is expected format' '
498 git log -g --abbrev-commit --pretty=oneline >expect &&
499 git reflog >actual &&
500 test_cmp expect actual
503 test_expect_success 'whatchanged is expected format' '
504 git log --no-merges --raw >expect &&
505 git whatchanged >actual &&
506 test_cmp expect actual
509 test_expect_success 'log.abbrevCommit configuration' '
510 git log --abbrev-commit >expect.log.abbrev &&
511 git log --no-abbrev-commit >expect.log.full &&
512 git log --pretty=raw >expect.log.raw &&
513 git reflog --abbrev-commit >expect.reflog.abbrev &&
514 git reflog --no-abbrev-commit >expect.reflog.full &&
515 git whatchanged --abbrev-commit >expect.whatchanged.abbrev &&
516 git whatchanged --no-abbrev-commit >expect.whatchanged.full &&
518 test_config log.abbrevCommit true &&
520 git log >actual &&
521 test_cmp expect.log.abbrev actual &&
522 git log --no-abbrev-commit >actual &&
523 test_cmp expect.log.full actual &&
525 git log --pretty=raw >actual &&
526 test_cmp expect.log.raw actual &&
528 git reflog >actual &&
529 test_cmp expect.reflog.abbrev actual &&
530 git reflog --no-abbrev-commit >actual &&
531 test_cmp expect.reflog.full actual &&
533 git whatchanged >actual &&
534 test_cmp expect.whatchanged.abbrev actual &&
535 git whatchanged --no-abbrev-commit >actual &&
536 test_cmp expect.whatchanged.full actual
539 test_expect_success 'show added path under "--follow -M"' '
540 # This tests for a regression introduced in v1.7.2-rc0~103^2~2
541 test_create_repo regression &&
543 cd regression &&
544 test_commit needs-another-commit &&
545 test_commit foo.bar &&
546 git log -M --follow -p foo.bar.t &&
547 git log -M --follow --stat foo.bar.t &&
548 git log -M --follow --name-only foo.bar.t
552 test_expect_success 'git log -c --follow' '
553 test_create_repo follow-c &&
555 cd follow-c &&
556 test_commit initial file original &&
557 git rm file &&
558 test_commit rename file2 original &&
559 git reset --hard initial &&
560 test_commit modify file foo &&
561 git merge -m merge rename &&
562 git log -c --follow file2
566 cat >expect <<\EOF
567 * commit COMMIT_OBJECT_NAME
568 |\ Merge: MERGE_PARENTS
569 | | Author: A U Thor <author@example.com>
571 | | Merge HEADS DESCRIPTION
573 | * commit COMMIT_OBJECT_NAME
574 | | Author: A U Thor <author@example.com>
576 | | reach
577 | | ---
578 | | reach.t | 1 +
579 | | 1 file changed, 1 insertion(+)
581 | | diff --git a/reach.t b/reach.t
582 | | new file mode 100644
583 | | index 0000000..10c9591
584 | | --- /dev/null
585 | | +++ b/reach.t
586 | | @@ -0,0 +1 @@
587 | | +reach
590 *-. \ commit COMMIT_OBJECT_NAME
591 |\ \ \ Merge: MERGE_PARENTS
592 | | | | Author: A U Thor <author@example.com>
593 | | | |
594 | | | | Merge HEADS DESCRIPTION
595 | | | |
596 | | * | commit COMMIT_OBJECT_NAME
597 | | |/ Author: A U Thor <author@example.com>
598 | | |
599 | | | octopus-b
600 | | | ---
601 | | | octopus-b.t | 1 +
602 | | | 1 file changed, 1 insertion(+)
603 | | |
604 | | | diff --git a/octopus-b.t b/octopus-b.t
605 | | | new file mode 100644
606 | | | index 0000000..d5fcad0
607 | | | --- /dev/null
608 | | | +++ b/octopus-b.t
609 | | | @@ -0,0 +1 @@
610 | | | +octopus-b
611 | | |
612 | * | commit COMMIT_OBJECT_NAME
613 | |/ Author: A U Thor <author@example.com>
615 | | octopus-a
616 | | ---
617 | | octopus-a.t | 1 +
618 | | 1 file changed, 1 insertion(+)
620 | | diff --git a/octopus-a.t b/octopus-a.t
621 | | new file mode 100644
622 | | index 0000000..11ee015
623 | | --- /dev/null
624 | | +++ b/octopus-a.t
625 | | @@ -0,0 +1 @@
626 | | +octopus-a
628 * | commit COMMIT_OBJECT_NAME
629 |/ Author: A U Thor <author@example.com>
631 | seventh
632 | ---
633 | seventh.t | 1 +
634 | 1 file changed, 1 insertion(+)
636 | diff --git a/seventh.t b/seventh.t
637 | new file mode 100644
638 | index 0000000..9744ffc
639 | --- /dev/null
640 | +++ b/seventh.t
641 | @@ -0,0 +1 @@
642 | +seventh
644 * commit COMMIT_OBJECT_NAME
645 |\ Merge: MERGE_PARENTS
646 | | Author: A U Thor <author@example.com>
648 | | Merge branch 'tangle'
650 | * commit COMMIT_OBJECT_NAME
651 | |\ Merge: MERGE_PARENTS
652 | | | Author: A U Thor <author@example.com>
653 | | |
654 | | | Merge branch 'side' (early part) into tangle
655 | | |
656 | * | commit COMMIT_OBJECT_NAME
657 | |\ \ Merge: MERGE_PARENTS
658 | | | | Author: A U Thor <author@example.com>
659 | | | |
660 | | | | Merge branch 'master' (early part) into tangle
661 | | | |
662 | * | | commit COMMIT_OBJECT_NAME
663 | | | | Author: A U Thor <author@example.com>
664 | | | |
665 | | | | tangle-a
666 | | | | ---
667 | | | | tangle-a | 1 +
668 | | | | 1 file changed, 1 insertion(+)
669 | | | |
670 | | | | diff --git a/tangle-a b/tangle-a
671 | | | | new file mode 100644
672 | | | | index 0000000..7898192
673 | | | | --- /dev/null
674 | | | | +++ b/tangle-a
675 | | | | @@ -0,0 +1 @@
676 | | | | +a
677 | | | |
678 * | | | commit COMMIT_OBJECT_NAME
679 |\ \ \ \ Merge: MERGE_PARENTS
680 | | | | | Author: A U Thor <author@example.com>
681 | | | | |
682 | | | | | Merge branch 'side'
683 | | | | |
684 | * | | | commit COMMIT_OBJECT_NAME
685 | | |_|/ Author: A U Thor <author@example.com>
686 | |/| |
687 | | | | side-2
688 | | | | ---
689 | | | | 2 | 1 +
690 | | | | 1 file changed, 1 insertion(+)
691 | | | |
692 | | | | diff --git a/2 b/2
693 | | | | new file mode 100644
694 | | | | index 0000000..0cfbf08
695 | | | | --- /dev/null
696 | | | | +++ b/2
697 | | | | @@ -0,0 +1 @@
698 | | | | +2
699 | | | |
700 | * | | commit COMMIT_OBJECT_NAME
701 | | | | Author: A U Thor <author@example.com>
702 | | | |
703 | | | | side-1
704 | | | | ---
705 | | | | 1 | 1 +
706 | | | | 1 file changed, 1 insertion(+)
707 | | | |
708 | | | | diff --git a/1 b/1
709 | | | | new file mode 100644
710 | | | | index 0000000..d00491f
711 | | | | --- /dev/null
712 | | | | +++ b/1
713 | | | | @@ -0,0 +1 @@
714 | | | | +1
715 | | | |
716 * | | | commit COMMIT_OBJECT_NAME
717 | | | | Author: A U Thor <author@example.com>
718 | | | |
719 | | | | Second
720 | | | | ---
721 | | | | one | 1 +
722 | | | | 1 file changed, 1 insertion(+)
723 | | | |
724 | | | | diff --git a/one b/one
725 | | | | new file mode 100644
726 | | | | index 0000000..9a33383
727 | | | | --- /dev/null
728 | | | | +++ b/one
729 | | | | @@ -0,0 +1 @@
730 | | | | +case
731 | | | |
732 * | | | commit COMMIT_OBJECT_NAME
733 | |_|/ Author: A U Thor <author@example.com>
734 |/| |
735 | | | sixth
736 | | | ---
737 | | | a/two | 1 -
738 | | | 1 file changed, 1 deletion(-)
739 | | |
740 | | | diff --git a/a/two b/a/two
741 | | | deleted file mode 100644
742 | | | index 9245af5..0000000
743 | | | --- a/a/two
744 | | | +++ /dev/null
745 | | | @@ -1 +0,0 @@
746 | | | -ni
747 | | |
748 * | | commit COMMIT_OBJECT_NAME
749 | | | Author: A U Thor <author@example.com>
750 | | |
751 | | | fifth
752 | | | ---
753 | | | a/two | 1 +
754 | | | 1 file changed, 1 insertion(+)
755 | | |
756 | | | diff --git a/a/two b/a/two
757 | | | new file mode 100644
758 | | | index 0000000..9245af5
759 | | | --- /dev/null
760 | | | +++ b/a/two
761 | | | @@ -0,0 +1 @@
762 | | | +ni
763 | | |
764 * | | commit COMMIT_OBJECT_NAME
765 |/ / Author: A U Thor <author@example.com>
767 | | fourth
768 | | ---
769 | | ein | 1 +
770 | | 1 file changed, 1 insertion(+)
772 | | diff --git a/ein b/ein
773 | | new file mode 100644
774 | | index 0000000..9d7e69f
775 | | --- /dev/null
776 | | +++ b/ein
777 | | @@ -0,0 +1 @@
778 | | +ichi
780 * | commit COMMIT_OBJECT_NAME
781 |/ Author: A U Thor <author@example.com>
783 | third
784 | ---
785 | ichi | 1 +
786 | one | 1 -
787 | 2 files changed, 1 insertion(+), 1 deletion(-)
789 | diff --git a/ichi b/ichi
790 | new file mode 100644
791 | index 0000000..9d7e69f
792 | --- /dev/null
793 | +++ b/ichi
794 | @@ -0,0 +1 @@
795 | +ichi
796 | diff --git a/one b/one
797 | deleted file mode 100644
798 | index 9d7e69f..0000000
799 | --- a/one
800 | +++ /dev/null
801 | @@ -1 +0,0 @@
802 | -ichi
804 * commit COMMIT_OBJECT_NAME
805 | Author: A U Thor <author@example.com>
807 | second
808 | ---
809 | one | 2 +-
810 | 1 file changed, 1 insertion(+), 1 deletion(-)
812 | diff --git a/one b/one
813 | index 5626abf..9d7e69f 100644
814 | --- a/one
815 | +++ b/one
816 | @@ -1 +1 @@
817 | -one
818 | +ichi
820 * commit COMMIT_OBJECT_NAME
821 Author: A U Thor <author@example.com>
823 initial
825 one | 1 +
826 1 file changed, 1 insertion(+)
828 diff --git a/one b/one
829 new file mode 100644
830 index 0000000..5626abf
831 --- /dev/null
832 +++ b/one
833 @@ -0,0 +1 @@
834 +one
837 sanitize_output () {
838 sed -e 's/ *$//' \
839 -e 's/commit [0-9a-f]*$/commit COMMIT_OBJECT_NAME/' \
840 -e 's/Merge: [ 0-9a-f]*$/Merge: MERGE_PARENTS/' \
841 -e 's/Merge tag.*/Merge HEADS DESCRIPTION/' \
842 -e 's/Merge commit.*/Merge HEADS DESCRIPTION/' \
843 -e 's/, 0 deletions(-)//' \
844 -e 's/, 0 insertions(+)//' \
845 -e 's/ 1 files changed, / 1 file changed, /' \
846 -e 's/, 1 deletions(-)/, 1 deletion(-)/' \
847 -e 's/, 1 insertions(+)/, 1 insertion(+)/'
850 test_expect_success 'log --graph with diff and stats' '
851 git log --graph --pretty=short --stat -p >actual &&
852 sanitize_output >actual.sanitized <actual &&
853 test_i18ncmp expect actual.sanitized
856 test_expect_success 'dotdot is a parent directory' '
857 mkdir -p a/b &&
858 ( echo sixth && echo fifth ) >expect &&
859 ( cd a/b && git log --format=%s .. ) >actual &&
860 test_cmp expect actual
863 test_expect_success GPG 'log --graph --show-signature' '
864 test_when_finished "git reset --hard && git checkout master" &&
865 git checkout -b signed master &&
866 echo foo >foo &&
867 git add foo &&
868 git commit -S -m signed_commit &&
869 git log --graph --show-signature -n1 signed >actual &&
870 grep "^| gpg: Signature made" actual &&
871 grep "^| gpg: Good signature" actual
874 test_expect_success GPG 'log --graph --show-signature for merged tag' '
875 test_when_finished "git reset --hard && git checkout master" &&
876 git checkout -b plain master &&
877 echo aaa >bar &&
878 git add bar &&
879 git commit -m bar_commit &&
880 git checkout -b tagged master &&
881 echo bbb >baz &&
882 git add baz &&
883 git commit -m baz_commit &&
884 git tag -s -m signed_tag_msg signed_tag &&
885 git checkout plain &&
886 git merge --no-ff -m msg signed_tag &&
887 git log --graph --show-signature -n1 plain >actual &&
888 grep "^|\\\ merged tag" actual &&
889 grep "^| | gpg: Signature made" actual &&
890 grep "^| | gpg: Good signature" actual
893 test_expect_success 'log --graph --no-walk is forbidden' '
894 test_must_fail git log --graph --no-walk
897 test_expect_success 'log diagnoses bogus HEAD' '
898 git init empty &&
899 test_must_fail git -C empty log 2>stderr &&
900 test_i18ngrep does.not.have.any.commits stderr &&
901 echo 1234abcd >empty/.git/refs/heads/master &&
902 test_must_fail git -C empty log 2>stderr &&
903 test_i18ngrep broken stderr &&
904 echo "ref: refs/heads/invalid.lock" >empty/.git/HEAD &&
905 test_must_fail git -C empty log 2>stderr &&
906 test_i18ngrep broken stderr &&
907 test_must_fail git -C empty log --default totally-bogus 2>stderr &&
908 test_i18ngrep broken stderr
911 test_expect_success 'set up --source tests' '
912 git checkout --orphan source-a &&
913 test_commit one &&
914 test_commit two &&
915 git checkout -b source-b HEAD^ &&
916 test_commit three
919 test_expect_success 'log --source paints branch names' '
920 cat >expect <<-\EOF &&
921 09e12a9 source-b three
922 8e393e1 source-a two
923 1ac6c77 source-b one
925 git log --oneline --source source-a source-b >actual &&
926 test_cmp expect actual
929 test_expect_success 'log --source paints tag names' '
930 git tag -m tagged source-tag &&
931 cat >expect <<-\EOF &&
932 09e12a9 source-tag three
933 8e393e1 source-a two
934 1ac6c77 source-tag one
936 git log --oneline --source source-tag source-a >actual &&
937 test_cmp expect actual
940 test_done