3 test_description='git log'
6 . "$TEST_DIRECTORY/lib-gpg.sh"
8 test_expect_success setup '
13 git commit -m initial &&
18 git commit -m second &&
22 git commit -m third &&
27 git commit -m fourth &&
33 git commit -m fifth &&
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
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
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 --no-renames --pretty="format:%s" --diff-filter=A HEAD > actual &&
105 git log --no-renames --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 --no-renames --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 &&
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) &&
172 verbose test "$actual" = "$expect"
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
195 test_expect_success 'git log --line-prefix="=== " --no-walk <commits> sorts by commit time' '
196 git log --line-prefix="=== " --no-walk --oneline 5d31159 804a787 394ef78 > actual &&
197 test_cmp expect actual
205 test_expect_success 'git log --no-walk=unsorted <commits> leaves list of commits as given' '
206 git log --no-walk=unsorted --oneline 5d31159 804a787 394ef78 > actual &&
207 test_cmp expect actual
210 test_expect_success 'git show <commits> leaves list of commits as given' '
211 git show --oneline -s 5d31159 804a787 394ef78 > actual &&
212 test_cmp expect actual
215 test_expect_success 'setup case sensitivity tests' '
219 git commit -a -m Second
222 test_expect_success 'log --grep' '
223 echo second >expect &&
224 git log -1 --pretty="tformat:%s" --grep=sec >actual &&
225 test_cmp expect actual
232 test_expect_success 'log --invert-grep --grep' '
233 git log --pretty="tformat:%s" --invert-grep --grep=th --grep=Sec >actual &&
234 test_cmp expect actual
237 test_expect_success 'log --invert-grep --grep -i' '
238 echo initial >expect &&
239 git log --pretty="tformat:%s" --invert-grep -i --grep=th --grep=Sec >actual &&
240 test_cmp expect actual
243 test_expect_success 'log --grep option parsing' '
244 echo second >expect &&
245 git log -1 --pretty="tformat:%s" --grep sec >actual &&
246 test_cmp expect actual &&
247 test_must_fail git log -1 --pretty="tformat:%s" --grep
250 test_expect_success 'log -i --grep' '
251 echo Second >expect &&
252 git log -1 --pretty="tformat:%s" -i --grep=sec >actual &&
253 test_cmp expect actual
256 test_expect_success 'log --grep -i' '
257 echo Second >expect &&
258 git log -1 --pretty="tformat:%s" --grep=sec -i >actual &&
259 test_cmp expect actual
262 test_expect_success 'log -F -E --grep=<ere> uses ere' '
263 echo second >expect &&
264 git log -1 --pretty="tformat:%s" -F -E --grep=s.c.nd >actual &&
265 test_cmp expect actual
268 test_expect_success 'log with grep.patternType configuration' '
270 git -c grep.patterntype=fixed \
271 log -1 --pretty=tformat:%s --grep=s.c.nd >actual &&
272 test_cmp expect actual
275 test_expect_success 'log with grep.patternType configuration and command line' '
276 echo second >expect &&
277 git -c grep.patterntype=fixed \
278 log -1 --pretty=tformat:%s --basic-regexp --grep=s.c.nd >actual &&
279 test_cmp expect actual
292 test_expect_success 'simple log --graph' '
293 git log --graph --pretty=tformat:%s >actual &&
294 test_cmp expect actual
307 test_expect_success 'simple log --graph --line-prefix="123 "' '
308 git log --graph --line-prefix="123 " --pretty=tformat:%s >actual &&
309 test_cmp expect actual
312 test_expect_success 'set up merge history' '
313 git checkout -b side HEAD~4 &&
314 test_commit side-1 1 1 &&
315 test_commit side-2 2 2 &&
316 git checkout master &&
321 * Merge branch 'side'
335 test_expect_success 'log --graph with merge' '
336 git log --graph --date-order --pretty=tformat:%s |
337 sed "s/ *\$//" >actual &&
338 test_cmp expect actual
342 | | | * Merge branch 'side'
356 test_expect_success 'log --graph --line-prefix="| | | " with merge' '
357 git log --line-prefix="| | | " --graph --date-order --pretty=tformat:%s |
358 sed "s/ *\$//" >actual &&
359 test_cmp expect actual
362 test_expect_success 'log --raw --graph -m with merge' '
363 git log --raw --graph --oneline -m master | head -n 500 >actual &&
364 grep "initial" actual
367 test_expect_success 'diff-tree --graph' '
368 git diff-tree --graph master^ | head -n 500 >actual &&
375 | | Author: A U Thor <author@example.com>
377 | | Merge branch 'side'
380 | | Author: A U Thor <author@example.com>
384 | * commit tags/side-1
385 | | Author: A U Thor <author@example.com>
390 | | Author: A U Thor <author@example.com>
395 | | Author: A U Thor <author@example.com>
400 | | Author: A U Thor <author@example.com>
405 |/ Author: A U Thor <author@example.com>
409 * commit tags/side-1~1
410 | Author: A U Thor <author@example.com>
414 * commit tags/side-1~2
415 | Author: A U Thor <author@example.com>
419 * commit tags/side-1~3
420 Author: A U Thor <author@example.com>
425 test_expect_success 'log --graph with full output' '
426 git log --graph --date-order --pretty=short |
427 git name-rev --name-only --stdin |
428 sed "s/Merge:.*/Merge: A B/;s/ *\$//" >actual &&
429 test_cmp expect actual
432 test_expect_success 'set up more tangled history' '
433 git checkout -b tangle HEAD~6 &&
434 test_commit tangle-a tangle-a a &&
435 git merge master~3 &&
437 git checkout master &&
439 git checkout -b reach &&
441 git checkout master &&
442 git checkout -b octopus-a &&
443 test_commit octopus-a &&
444 git checkout master &&
445 git checkout -b octopus-b &&
446 test_commit octopus-b &&
447 git checkout master &&
448 test_commit seventh &&
449 git merge octopus-a octopus-b &&
458 *-. \ Merge tags 'octopus-a' and 'octopus-b'
468 * Merge branch 'tangle'
470 | * Merge branch 'side' (early part) into tangle
472 | * \ Merge branch 'master' (early part) into tangle
475 * | | | Merge branch 'side'
494 test_expect_success 'log --graph with merge' '
495 git log --graph --date-order --pretty=tformat:%s |
496 sed "s/ *\$//" >actual &&
497 test_cmp expect actual
500 test_expect_success 'log.decorate configuration' '
501 git log --oneline >expect.none &&
502 git log --oneline --decorate >expect.short &&
503 git log --oneline --decorate=full >expect.full &&
505 echo "[log] decorate" >>.git/config &&
506 git log --oneline >actual &&
507 test_cmp expect.short actual &&
509 test_config log.decorate true &&
510 git log --oneline >actual &&
511 test_cmp expect.short actual &&
512 git log --oneline --decorate=full >actual &&
513 test_cmp expect.full actual &&
514 git log --oneline --decorate=no >actual &&
515 test_cmp expect.none actual &&
517 test_config log.decorate no &&
518 git log --oneline >actual &&
519 test_cmp expect.none actual &&
520 git log --oneline --decorate >actual &&
521 test_cmp expect.short actual &&
522 git log --oneline --decorate=full >actual &&
523 test_cmp expect.full actual &&
525 test_config log.decorate 1 &&
526 git log --oneline >actual &&
527 test_cmp expect.short actual &&
528 git log --oneline --decorate=full >actual &&
529 test_cmp expect.full actual &&
530 git log --oneline --decorate=no >actual &&
531 test_cmp expect.none actual &&
533 test_config log.decorate short &&
534 git log --oneline >actual &&
535 test_cmp expect.short actual &&
536 git log --oneline --no-decorate >actual &&
537 test_cmp expect.none actual &&
538 git log --oneline --decorate=full >actual &&
539 test_cmp expect.full actual &&
541 test_config log.decorate full &&
542 git log --oneline >actual &&
543 test_cmp expect.full actual &&
544 git log --oneline --no-decorate >actual &&
545 test_cmp expect.none actual &&
546 git log --oneline --decorate >actual &&
547 test_cmp expect.short actual &&
549 test_unconfig log.decorate &&
550 git log --pretty=raw >expect.raw &&
551 test_config log.decorate full &&
552 git log --pretty=raw >actual &&
553 test_cmp expect.raw actual
557 test_expect_success 'reflog is expected format' '
558 git log -g --abbrev-commit --pretty=oneline >expect &&
559 git reflog >actual &&
560 test_cmp expect actual
563 test_expect_success 'whatchanged is expected format' '
564 git log --no-merges --raw >expect &&
565 git whatchanged >actual &&
566 test_cmp expect actual
569 test_expect_success 'log.abbrevCommit configuration' '
570 git log --abbrev-commit >expect.log.abbrev &&
571 git log --no-abbrev-commit >expect.log.full &&
572 git log --pretty=raw >expect.log.raw &&
573 git reflog --abbrev-commit >expect.reflog.abbrev &&
574 git reflog --no-abbrev-commit >expect.reflog.full &&
575 git whatchanged --abbrev-commit >expect.whatchanged.abbrev &&
576 git whatchanged --no-abbrev-commit >expect.whatchanged.full &&
578 test_config log.abbrevCommit true &&
581 test_cmp expect.log.abbrev actual &&
582 git log --no-abbrev-commit >actual &&
583 test_cmp expect.log.full actual &&
585 git log --pretty=raw >actual &&
586 test_cmp expect.log.raw actual &&
588 git reflog >actual &&
589 test_cmp expect.reflog.abbrev actual &&
590 git reflog --no-abbrev-commit >actual &&
591 test_cmp expect.reflog.full actual &&
593 git whatchanged >actual &&
594 test_cmp expect.whatchanged.abbrev actual &&
595 git whatchanged --no-abbrev-commit >actual &&
596 test_cmp expect.whatchanged.full actual
599 test_expect_success 'show added path under "--follow -M"' '
600 # This tests for a regression introduced in v1.7.2-rc0~103^2~2
601 test_create_repo regression &&
604 test_commit needs-another-commit &&
605 test_commit foo.bar &&
606 git log -M --follow -p foo.bar.t &&
607 git log -M --follow --stat foo.bar.t &&
608 git log -M --follow --name-only foo.bar.t
612 test_expect_success 'git log -c --follow' '
613 test_create_repo follow-c &&
616 test_commit initial file original &&
618 test_commit rename file2 original &&
619 git reset --hard initial &&
620 test_commit modify file foo &&
621 git merge -m merge rename &&
622 git log -c --follow file2
627 * commit COMMIT_OBJECT_NAME
628 |\ Merge: MERGE_PARENTS
629 | | Author: A U Thor <author@example.com>
631 | | Merge HEADS DESCRIPTION
633 | * commit COMMIT_OBJECT_NAME
634 | | Author: A U Thor <author@example.com>
639 | | 1 file changed, 1 insertion(+)
641 | | diff --git a/reach.t b/reach.t
642 | | new file mode 100644
643 | | index 0000000..10c9591
650 *-. \ commit COMMIT_OBJECT_NAME
651 |\ \ \ Merge: MERGE_PARENTS
652 | | | | Author: A U Thor <author@example.com>
654 | | | | Merge HEADS DESCRIPTION
656 | | * | commit COMMIT_OBJECT_NAME
657 | | |/ Author: A U Thor <author@example.com>
661 | | | octopus-b.t | 1 +
662 | | | 1 file changed, 1 insertion(+)
664 | | | diff --git a/octopus-b.t b/octopus-b.t
665 | | | new file mode 100644
666 | | | index 0000000..d5fcad0
668 | | | +++ b/octopus-b.t
672 | * | commit COMMIT_OBJECT_NAME
673 | |/ Author: A U Thor <author@example.com>
677 | | octopus-a.t | 1 +
678 | | 1 file changed, 1 insertion(+)
680 | | diff --git a/octopus-a.t b/octopus-a.t
681 | | new file mode 100644
682 | | index 0000000..11ee015
684 | | +++ b/octopus-a.t
688 * | commit COMMIT_OBJECT_NAME
689 |/ Author: A U Thor <author@example.com>
694 | 1 file changed, 1 insertion(+)
696 | diff --git a/seventh.t b/seventh.t
697 | new file mode 100644
698 | index 0000000..9744ffc
704 * commit COMMIT_OBJECT_NAME
705 |\ Merge: MERGE_PARENTS
706 | | Author: A U Thor <author@example.com>
708 | | Merge branch 'tangle'
710 | * commit COMMIT_OBJECT_NAME
711 | |\ Merge: MERGE_PARENTS
712 | | | Author: A U Thor <author@example.com>
714 | | | Merge branch 'side' (early part) into tangle
716 | * | commit COMMIT_OBJECT_NAME
717 | |\ \ Merge: MERGE_PARENTS
718 | | | | Author: A U Thor <author@example.com>
720 | | | | Merge branch 'master' (early part) into tangle
722 | * | | commit COMMIT_OBJECT_NAME
723 | | | | Author: A U Thor <author@example.com>
727 | | | | tangle-a | 1 +
728 | | | | 1 file changed, 1 insertion(+)
730 | | | | diff --git a/tangle-a b/tangle-a
731 | | | | new file mode 100644
732 | | | | index 0000000..7898192
733 | | | | --- /dev/null
734 | | | | +++ b/tangle-a
735 | | | | @@ -0,0 +1 @@
738 * | | | commit COMMIT_OBJECT_NAME
739 |\ \ \ \ Merge: MERGE_PARENTS
740 | | | | | Author: A U Thor <author@example.com>
742 | | | | | Merge branch 'side'
744 | * | | | commit COMMIT_OBJECT_NAME
745 | | |_|/ Author: A U Thor <author@example.com>
750 | | | | 1 file changed, 1 insertion(+)
752 | | | | diff --git a/2 b/2
753 | | | | new file mode 100644
754 | | | | index 0000000..0cfbf08
755 | | | | --- /dev/null
757 | | | | @@ -0,0 +1 @@
760 | * | | commit COMMIT_OBJECT_NAME
761 | | | | Author: A U Thor <author@example.com>
766 | | | | 1 file changed, 1 insertion(+)
768 | | | | diff --git a/1 b/1
769 | | | | new file mode 100644
770 | | | | index 0000000..d00491f
771 | | | | --- /dev/null
773 | | | | @@ -0,0 +1 @@
776 * | | | commit COMMIT_OBJECT_NAME
777 | | | | Author: A U Thor <author@example.com>
782 | | | | 1 file changed, 1 insertion(+)
784 | | | | diff --git a/one b/one
785 | | | | new file mode 100644
786 | | | | index 0000000..9a33383
787 | | | | --- /dev/null
789 | | | | @@ -0,0 +1 @@
792 * | | | commit COMMIT_OBJECT_NAME
793 | |_|/ Author: A U Thor <author@example.com>
798 | | | 1 file changed, 1 deletion(-)
800 | | | diff --git a/a/two b/a/two
801 | | | deleted file mode 100644
802 | | | index 9245af5..0000000
808 * | | commit COMMIT_OBJECT_NAME
809 | | | Author: A U Thor <author@example.com>
814 | | | 1 file changed, 1 insertion(+)
816 | | | diff --git a/a/two b/a/two
817 | | | new file mode 100644
818 | | | index 0000000..9245af5
824 * | | commit COMMIT_OBJECT_NAME
825 |/ / Author: A U Thor <author@example.com>
830 | | 1 file changed, 1 insertion(+)
832 | | diff --git a/ein b/ein
833 | | new file mode 100644
834 | | index 0000000..9d7e69f
840 * | commit COMMIT_OBJECT_NAME
841 |/ Author: A U Thor <author@example.com>
847 | 2 files changed, 1 insertion(+), 1 deletion(-)
849 | diff --git a/ichi b/ichi
850 | new file mode 100644
851 | index 0000000..9d7e69f
856 | diff --git a/one b/one
857 | deleted file mode 100644
858 | index 9d7e69f..0000000
864 * commit COMMIT_OBJECT_NAME
865 | Author: A U Thor <author@example.com>
870 | 1 file changed, 1 insertion(+), 1 deletion(-)
872 | diff --git a/one b/one
873 | index 5626abf..9d7e69f 100644
880 * commit COMMIT_OBJECT_NAME
881 Author: A U Thor <author@example.com>
886 1 file changed, 1 insertion(+)
888 diff --git a/one b/one
890 index 0000000..5626abf
899 -e 's/commit [0-9a-f]*$/commit COMMIT_OBJECT_NAME/' \
900 -e 's/Merge: [ 0-9a-f]*$/Merge: MERGE_PARENTS/' \
901 -e 's/Merge tag.*/Merge HEADS DESCRIPTION/' \
902 -e 's/Merge commit.*/Merge HEADS DESCRIPTION/' \
903 -e 's/, 0 deletions(-)//' \
904 -e 's/, 0 insertions(+)//' \
905 -e 's/ 1 files changed, / 1 file changed, /' \
906 -e 's/, 1 deletions(-)/, 1 deletion(-)/' \
907 -e 's/, 1 insertions(+)/, 1 insertion(+)/'
910 test_expect_success 'log --graph with diff and stats' '
911 git log --no-renames --graph --pretty=short --stat -p >actual &&
912 sanitize_output >actual.sanitized <actual &&
913 test_i18ncmp expect actual.sanitized
917 *** * commit COMMIT_OBJECT_NAME
918 *** |\ Merge: MERGE_PARENTS
919 *** | | Author: A U Thor <author@example.com>
921 *** | | Merge HEADS DESCRIPTION
923 *** | * commit COMMIT_OBJECT_NAME
924 *** | | Author: A U Thor <author@example.com>
928 *** | | reach.t | 1 +
929 *** | | 1 file changed, 1 insertion(+)
931 *** | | diff --git a/reach.t b/reach.t
932 *** | | new file mode 100644
933 *** | | index 0000000..10c9591
934 *** | | --- /dev/null
935 *** | | +++ b/reach.t
936 *** | | @@ -0,0 +1 @@
940 *** *-. \ commit COMMIT_OBJECT_NAME
941 *** |\ \ \ Merge: MERGE_PARENTS
942 *** | | | | Author: A U Thor <author@example.com>
944 *** | | | | Merge HEADS DESCRIPTION
946 *** | | * | commit COMMIT_OBJECT_NAME
947 *** | | |/ Author: A U Thor <author@example.com>
951 *** | | | octopus-b.t | 1 +
952 *** | | | 1 file changed, 1 insertion(+)
954 *** | | | diff --git a/octopus-b.t b/octopus-b.t
955 *** | | | new file mode 100644
956 *** | | | index 0000000..d5fcad0
957 *** | | | --- /dev/null
958 *** | | | +++ b/octopus-b.t
959 *** | | | @@ -0,0 +1 @@
962 *** | * | commit COMMIT_OBJECT_NAME
963 *** | |/ Author: A U Thor <author@example.com>
967 *** | | octopus-a.t | 1 +
968 *** | | 1 file changed, 1 insertion(+)
970 *** | | diff --git a/octopus-a.t b/octopus-a.t
971 *** | | new file mode 100644
972 *** | | index 0000000..11ee015
973 *** | | --- /dev/null
974 *** | | +++ b/octopus-a.t
975 *** | | @@ -0,0 +1 @@
978 *** * | commit COMMIT_OBJECT_NAME
979 *** |/ Author: A U Thor <author@example.com>
983 *** | seventh.t | 1 +
984 *** | 1 file changed, 1 insertion(+)
986 *** | diff --git a/seventh.t b/seventh.t
987 *** | new file mode 100644
988 *** | index 0000000..9744ffc
990 *** | +++ b/seventh.t
994 *** * commit COMMIT_OBJECT_NAME
995 *** |\ Merge: MERGE_PARENTS
996 *** | | Author: A U Thor <author@example.com>
998 *** | | Merge branch 'tangle'
1000 *** | * commit COMMIT_OBJECT_NAME
1001 *** | |\ Merge: MERGE_PARENTS
1002 *** | | | Author: A U Thor <author@example.com>
1004 *** | | | Merge branch 'side' (early part) into tangle
1006 *** | * | commit COMMIT_OBJECT_NAME
1007 *** | |\ \ Merge: MERGE_PARENTS
1008 *** | | | | Author: A U Thor <author@example.com>
1010 *** | | | | Merge branch 'master' (early part) into tangle
1012 *** | * | | commit COMMIT_OBJECT_NAME
1013 *** | | | | Author: A U Thor <author@example.com>
1015 *** | | | | tangle-a
1017 *** | | | | tangle-a | 1 +
1018 *** | | | | 1 file changed, 1 insertion(+)
1020 *** | | | | diff --git a/tangle-a b/tangle-a
1021 *** | | | | new file mode 100644
1022 *** | | | | index 0000000..7898192
1023 *** | | | | --- /dev/null
1024 *** | | | | +++ b/tangle-a
1025 *** | | | | @@ -0,0 +1 @@
1028 *** * | | | commit COMMIT_OBJECT_NAME
1029 *** |\ \ \ \ Merge: MERGE_PARENTS
1030 *** | | | | | Author: A U Thor <author@example.com>
1032 *** | | | | | Merge branch 'side'
1034 *** | * | | | commit COMMIT_OBJECT_NAME
1035 *** | | |_|/ Author: A U Thor <author@example.com>
1040 *** | | | | 1 file changed, 1 insertion(+)
1042 *** | | | | diff --git a/2 b/2
1043 *** | | | | new file mode 100644
1044 *** | | | | index 0000000..0cfbf08
1045 *** | | | | --- /dev/null
1047 *** | | | | @@ -0,0 +1 @@
1050 *** | * | | commit COMMIT_OBJECT_NAME
1051 *** | | | | Author: A U Thor <author@example.com>
1056 *** | | | | 1 file changed, 1 insertion(+)
1058 *** | | | | diff --git a/1 b/1
1059 *** | | | | new file mode 100644
1060 *** | | | | index 0000000..d00491f
1061 *** | | | | --- /dev/null
1063 *** | | | | @@ -0,0 +1 @@
1066 *** * | | | commit COMMIT_OBJECT_NAME
1067 *** | | | | Author: A U Thor <author@example.com>
1071 *** | | | | one | 1 +
1072 *** | | | | 1 file changed, 1 insertion(+)
1074 *** | | | | diff --git a/one b/one
1075 *** | | | | new file mode 100644
1076 *** | | | | index 0000000..9a33383
1077 *** | | | | --- /dev/null
1078 *** | | | | +++ b/one
1079 *** | | | | @@ -0,0 +1 @@
1082 *** * | | | commit COMMIT_OBJECT_NAME
1083 *** | |_|/ Author: A U Thor <author@example.com>
1087 *** | | | a/two | 1 -
1088 *** | | | 1 file changed, 1 deletion(-)
1090 *** | | | diff --git a/a/two b/a/two
1091 *** | | | deleted file mode 100644
1092 *** | | | index 9245af5..0000000
1093 *** | | | --- a/a/two
1094 *** | | | +++ /dev/null
1095 *** | | | @@ -1 +0,0 @@
1098 *** * | | commit COMMIT_OBJECT_NAME
1099 *** | | | Author: A U Thor <author@example.com>
1103 *** | | | a/two | 1 +
1104 *** | | | 1 file changed, 1 insertion(+)
1106 *** | | | diff --git a/a/two b/a/two
1107 *** | | | new file mode 100644
1108 *** | | | index 0000000..9245af5
1109 *** | | | --- /dev/null
1110 *** | | | +++ b/a/two
1111 *** | | | @@ -0,0 +1 @@
1114 *** * | | commit COMMIT_OBJECT_NAME
1115 *** |/ / Author: A U Thor <author@example.com>
1120 *** | | 1 file changed, 1 insertion(+)
1122 *** | | diff --git a/ein b/ein
1123 *** | | new file mode 100644
1124 *** | | index 0000000..9d7e69f
1125 *** | | --- /dev/null
1127 *** | | @@ -0,0 +1 @@
1130 *** * | commit COMMIT_OBJECT_NAME
1131 *** |/ Author: A U Thor <author@example.com>
1137 *** | 2 files changed, 1 insertion(+), 1 deletion(-)
1139 *** | diff --git a/ichi b/ichi
1140 *** | new file mode 100644
1141 *** | index 0000000..9d7e69f
1146 *** | diff --git a/one b/one
1147 *** | deleted file mode 100644
1148 *** | index 9d7e69f..0000000
1154 *** * commit COMMIT_OBJECT_NAME
1155 *** | Author: A U Thor <author@example.com>
1160 *** | 1 file changed, 1 insertion(+), 1 deletion(-)
1162 *** | diff --git a/one b/one
1163 *** | index 5626abf..9d7e69f 100644
1170 *** * commit COMMIT_OBJECT_NAME
1171 *** Author: A U Thor <author@example.com>
1176 *** 1 file changed, 1 insertion(+)
1178 *** diff --git a/one b/one
1179 *** new file mode 100644
1180 *** index 0000000..5626abf
1187 test_expect_success 'log --line-prefix="*** " --graph with diff and stats' '
1188 git log --line-prefix="*** " --no-renames --graph --pretty=short --stat -p >actual &&
1189 sanitize_output >actual.sanitized <actual &&
1190 test_i18ncmp expect actual.sanitized
1193 test_expect_success 'dotdot is a parent directory' '
1195 ( echo sixth && echo fifth ) >expect &&
1196 ( cd a/b && git log --format=%s .. ) >actual &&
1197 test_cmp expect actual
1200 test_expect_success GPG 'setup signed branch' '
1201 test_when_finished "git reset --hard && git checkout master" &&
1202 git checkout -b signed master &&
1205 git commit -S -m signed_commit
1208 test_expect_success GPG 'log --graph --show-signature' '
1209 git log --graph --show-signature -n1 signed >actual &&
1210 grep "^| gpg: Signature made" actual &&
1211 grep "^| gpg: Good signature" actual
1214 test_expect_success GPG 'log --graph --show-signature for merged tag' '
1215 test_when_finished "git reset --hard && git checkout master" &&
1216 git checkout -b plain master &&
1219 git commit -m bar_commit &&
1220 git checkout -b tagged master &&
1223 git commit -m baz_commit &&
1224 git tag -s -m signed_tag_msg signed_tag &&
1225 git checkout plain &&
1226 git merge --no-ff -m msg signed_tag &&
1227 git log --graph --show-signature -n1 plain >actual &&
1228 grep "^|\\\ merged tag" actual &&
1229 grep "^| | gpg: Signature made" actual &&
1230 grep "^| | gpg: Good signature" actual
1233 test_expect_success GPG '--no-show-signature overrides --show-signature' '
1234 git log -1 --show-signature --no-show-signature signed >actual &&
1235 ! grep "^gpg:" actual
1238 test_expect_success GPG 'log.showsignature=true behaves like --show-signature' '
1239 test_config log.showsignature true &&
1240 git log -1 signed >actual &&
1241 grep "gpg: Signature made" actual &&
1242 grep "gpg: Good signature" actual
1245 test_expect_success GPG '--no-show-signature overrides log.showsignature=true' '
1246 test_config log.showsignature true &&
1247 git log -1 --no-show-signature signed >actual &&
1248 ! grep "^gpg:" actual
1251 test_expect_success GPG '--show-signature overrides log.showsignature=false' '
1252 test_config log.showsignature false &&
1253 git log -1 --show-signature signed >actual &&
1254 grep "gpg: Signature made" actual &&
1255 grep "gpg: Good signature" actual
1258 test_expect_success 'log --graph --no-walk is forbidden' '
1259 test_must_fail git log --graph --no-walk
1262 test_expect_success 'log diagnoses bogus HEAD' '
1264 test_must_fail git -C empty log 2>stderr &&
1265 test_i18ngrep does.not.have.any.commits stderr &&
1266 echo 1234abcd >empty/.git/refs/heads/master &&
1267 test_must_fail git -C empty log 2>stderr &&
1268 test_i18ngrep broken stderr &&
1269 echo "ref: refs/heads/invalid.lock" >empty/.git/HEAD &&
1270 test_must_fail git -C empty log 2>stderr &&
1271 test_i18ngrep broken stderr &&
1272 test_must_fail git -C empty log --default totally-bogus 2>stderr &&
1273 test_i18ngrep broken stderr
1276 test_expect_success 'set up --source tests' '
1277 git checkout --orphan source-a &&
1280 git checkout -b source-b HEAD^ &&
1284 test_expect_success 'log --source paints branch names' '
1285 cat >expect <<-\EOF &&
1286 09e12a9 source-b three
1287 8e393e1 source-a two
1288 1ac6c77 source-b one
1290 git log --oneline --source source-a source-b >actual &&
1291 test_cmp expect actual
1294 test_expect_success 'log --source paints tag names' '
1295 git tag -m tagged source-tag &&
1296 cat >expect <<-\EOF &&
1297 09e12a9 source-tag three
1298 8e393e1 source-a two
1299 1ac6c77 source-tag one
1301 git log --oneline --source source-tag source-a >actual &&
1302 test_cmp expect actual