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 cat > expect.colors <<\EOF
363 * Merge branch 'side'
364 <BLUE>|<RESET><CYAN>\<RESET>
365 <BLUE>|<RESET> * side-2
366 <BLUE>|<RESET> * side-1
367 * <CYAN>|<RESET> Second
368 * <CYAN>|<RESET> sixth
369 * <CYAN>|<RESET> fifth
370 * <CYAN>|<RESET> fourth
371 <CYAN>|<RESET><CYAN>/<RESET>
377 test_expect_success 'log --graph with merge with log.graphColors' '
378 test_config log.graphColors " blue,invalid-color, cyan, red , " &&
379 git log --color=always --graph --date-order --pretty=tformat:%s |
380 test_decode_color | sed "s/ *\$//" >actual &&
381 test_cmp expect.colors actual
384 test_expect_success 'log --raw --graph -m with merge' '
385 git log --raw --graph --oneline -m master | head -n 500 >actual &&
386 grep "initial" actual
389 test_expect_success 'diff-tree --graph' '
390 git diff-tree --graph master^ | head -n 500 >actual &&
397 | | Author: A U Thor <author@example.com>
399 | | Merge branch 'side'
402 | | Author: A U Thor <author@example.com>
406 | * commit tags/side-1
407 | | Author: A U Thor <author@example.com>
412 | | Author: A U Thor <author@example.com>
417 | | Author: A U Thor <author@example.com>
422 | | Author: A U Thor <author@example.com>
427 |/ Author: A U Thor <author@example.com>
431 * commit tags/side-1~1
432 | Author: A U Thor <author@example.com>
436 * commit tags/side-1~2
437 | Author: A U Thor <author@example.com>
441 * commit tags/side-1~3
442 Author: A U Thor <author@example.com>
447 test_expect_success 'log --graph with full output' '
448 git log --graph --date-order --pretty=short |
449 git name-rev --name-only --stdin |
450 sed "s/Merge:.*/Merge: A B/;s/ *\$//" >actual &&
451 test_cmp expect actual
454 test_expect_success 'set up more tangled history' '
455 git checkout -b tangle HEAD~6 &&
456 test_commit tangle-a tangle-a a &&
457 git merge master~3 &&
459 git checkout master &&
461 git checkout -b reach &&
463 git checkout master &&
464 git checkout -b octopus-a &&
465 test_commit octopus-a &&
466 git checkout master &&
467 git checkout -b octopus-b &&
468 test_commit octopus-b &&
469 git checkout master &&
470 test_commit seventh &&
471 git merge octopus-a octopus-b &&
480 *-. \ Merge tags 'octopus-a' and 'octopus-b'
490 * Merge branch 'tangle'
492 | * Merge branch 'side' (early part) into tangle
494 | * \ Merge branch 'master' (early part) into tangle
497 * | | | Merge branch 'side'
516 test_expect_success 'log --graph with merge' '
517 git log --graph --date-order --pretty=tformat:%s |
518 sed "s/ *\$//" >actual &&
519 test_cmp expect actual
522 test_expect_success 'log.decorate configuration' '
523 git log --oneline >expect.none &&
524 git log --oneline --decorate >expect.short &&
525 git log --oneline --decorate=full >expect.full &&
527 echo "[log] decorate" >>.git/config &&
528 git log --oneline >actual &&
529 test_cmp expect.short actual &&
531 test_config log.decorate true &&
532 git log --oneline >actual &&
533 test_cmp expect.short actual &&
534 git log --oneline --decorate=full >actual &&
535 test_cmp expect.full actual &&
536 git log --oneline --decorate=no >actual &&
537 test_cmp expect.none actual &&
539 test_config log.decorate no &&
540 git log --oneline >actual &&
541 test_cmp expect.none actual &&
542 git log --oneline --decorate >actual &&
543 test_cmp expect.short actual &&
544 git log --oneline --decorate=full >actual &&
545 test_cmp expect.full actual &&
547 test_config log.decorate 1 &&
548 git log --oneline >actual &&
549 test_cmp expect.short actual &&
550 git log --oneline --decorate=full >actual &&
551 test_cmp expect.full actual &&
552 git log --oneline --decorate=no >actual &&
553 test_cmp expect.none actual &&
555 test_config log.decorate short &&
556 git log --oneline >actual &&
557 test_cmp expect.short actual &&
558 git log --oneline --no-decorate >actual &&
559 test_cmp expect.none actual &&
560 git log --oneline --decorate=full >actual &&
561 test_cmp expect.full actual &&
563 test_config log.decorate full &&
564 git log --oneline >actual &&
565 test_cmp expect.full actual &&
566 git log --oneline --no-decorate >actual &&
567 test_cmp expect.none actual &&
568 git log --oneline --decorate >actual &&
569 test_cmp expect.short actual &&
571 test_unconfig log.decorate &&
572 git log --pretty=raw >expect.raw &&
573 test_config log.decorate full &&
574 git log --pretty=raw >actual &&
575 test_cmp expect.raw actual
579 test_expect_success 'reflog is expected format' '
580 git log -g --abbrev-commit --pretty=oneline >expect &&
581 git reflog >actual &&
582 test_cmp expect actual
585 test_expect_success 'whatchanged is expected format' '
586 git log --no-merges --raw >expect &&
587 git whatchanged >actual &&
588 test_cmp expect actual
591 test_expect_success 'log.abbrevCommit configuration' '
592 git log --abbrev-commit >expect.log.abbrev &&
593 git log --no-abbrev-commit >expect.log.full &&
594 git log --pretty=raw >expect.log.raw &&
595 git reflog --abbrev-commit >expect.reflog.abbrev &&
596 git reflog --no-abbrev-commit >expect.reflog.full &&
597 git whatchanged --abbrev-commit >expect.whatchanged.abbrev &&
598 git whatchanged --no-abbrev-commit >expect.whatchanged.full &&
600 test_config log.abbrevCommit true &&
603 test_cmp expect.log.abbrev actual &&
604 git log --no-abbrev-commit >actual &&
605 test_cmp expect.log.full actual &&
607 git log --pretty=raw >actual &&
608 test_cmp expect.log.raw actual &&
610 git reflog >actual &&
611 test_cmp expect.reflog.abbrev actual &&
612 git reflog --no-abbrev-commit >actual &&
613 test_cmp expect.reflog.full actual &&
615 git whatchanged >actual &&
616 test_cmp expect.whatchanged.abbrev actual &&
617 git whatchanged --no-abbrev-commit >actual &&
618 test_cmp expect.whatchanged.full actual
621 test_expect_success 'show added path under "--follow -M"' '
622 # This tests for a regression introduced in v1.7.2-rc0~103^2~2
623 test_create_repo regression &&
626 test_commit needs-another-commit &&
627 test_commit foo.bar &&
628 git log -M --follow -p foo.bar.t &&
629 git log -M --follow --stat foo.bar.t &&
630 git log -M --follow --name-only foo.bar.t
634 test_expect_success 'git log -c --follow' '
635 test_create_repo follow-c &&
638 test_commit initial file original &&
640 test_commit rename file2 original &&
641 git reset --hard initial &&
642 test_commit modify file foo &&
643 git merge -m merge rename &&
644 git log -c --follow file2
649 * commit COMMIT_OBJECT_NAME
650 |\ Merge: MERGE_PARENTS
651 | | Author: A U Thor <author@example.com>
653 | | Merge HEADS DESCRIPTION
655 | * commit COMMIT_OBJECT_NAME
656 | | Author: A U Thor <author@example.com>
661 | | 1 file changed, 1 insertion(+)
663 | | diff --git a/reach.t b/reach.t
664 | | new file mode 100644
665 | | index 0000000..10c9591
672 *-. \ commit COMMIT_OBJECT_NAME
673 |\ \ \ Merge: MERGE_PARENTS
674 | | | | Author: A U Thor <author@example.com>
676 | | | | Merge HEADS DESCRIPTION
678 | | * | commit COMMIT_OBJECT_NAME
679 | | |/ Author: A U Thor <author@example.com>
683 | | | octopus-b.t | 1 +
684 | | | 1 file changed, 1 insertion(+)
686 | | | diff --git a/octopus-b.t b/octopus-b.t
687 | | | new file mode 100644
688 | | | index 0000000..d5fcad0
690 | | | +++ b/octopus-b.t
694 | * | commit COMMIT_OBJECT_NAME
695 | |/ Author: A U Thor <author@example.com>
699 | | octopus-a.t | 1 +
700 | | 1 file changed, 1 insertion(+)
702 | | diff --git a/octopus-a.t b/octopus-a.t
703 | | new file mode 100644
704 | | index 0000000..11ee015
706 | | +++ b/octopus-a.t
710 * | commit COMMIT_OBJECT_NAME
711 |/ Author: A U Thor <author@example.com>
716 | 1 file changed, 1 insertion(+)
718 | diff --git a/seventh.t b/seventh.t
719 | new file mode 100644
720 | index 0000000..9744ffc
726 * commit COMMIT_OBJECT_NAME
727 |\ Merge: MERGE_PARENTS
728 | | Author: A U Thor <author@example.com>
730 | | Merge branch 'tangle'
732 | * commit COMMIT_OBJECT_NAME
733 | |\ Merge: MERGE_PARENTS
734 | | | Author: A U Thor <author@example.com>
736 | | | Merge branch 'side' (early part) into tangle
738 | * | commit COMMIT_OBJECT_NAME
739 | |\ \ Merge: MERGE_PARENTS
740 | | | | Author: A U Thor <author@example.com>
742 | | | | Merge branch 'master' (early part) into tangle
744 | * | | commit COMMIT_OBJECT_NAME
745 | | | | Author: A U Thor <author@example.com>
749 | | | | tangle-a | 1 +
750 | | | | 1 file changed, 1 insertion(+)
752 | | | | diff --git a/tangle-a b/tangle-a
753 | | | | new file mode 100644
754 | | | | index 0000000..7898192
755 | | | | --- /dev/null
756 | | | | +++ b/tangle-a
757 | | | | @@ -0,0 +1 @@
760 * | | | commit COMMIT_OBJECT_NAME
761 |\ \ \ \ Merge: MERGE_PARENTS
762 | | | | | Author: A U Thor <author@example.com>
764 | | | | | Merge branch 'side'
766 | * | | | commit COMMIT_OBJECT_NAME
767 | | |_|/ Author: A U Thor <author@example.com>
772 | | | | 1 file changed, 1 insertion(+)
774 | | | | diff --git a/2 b/2
775 | | | | new file mode 100644
776 | | | | index 0000000..0cfbf08
777 | | | | --- /dev/null
779 | | | | @@ -0,0 +1 @@
782 | * | | commit COMMIT_OBJECT_NAME
783 | | | | Author: A U Thor <author@example.com>
788 | | | | 1 file changed, 1 insertion(+)
790 | | | | diff --git a/1 b/1
791 | | | | new file mode 100644
792 | | | | index 0000000..d00491f
793 | | | | --- /dev/null
795 | | | | @@ -0,0 +1 @@
798 * | | | commit COMMIT_OBJECT_NAME
799 | | | | Author: A U Thor <author@example.com>
804 | | | | 1 file changed, 1 insertion(+)
806 | | | | diff --git a/one b/one
807 | | | | new file mode 100644
808 | | | | index 0000000..9a33383
809 | | | | --- /dev/null
811 | | | | @@ -0,0 +1 @@
814 * | | | commit COMMIT_OBJECT_NAME
815 | |_|/ Author: A U Thor <author@example.com>
820 | | | 1 file changed, 1 deletion(-)
822 | | | diff --git a/a/two b/a/two
823 | | | deleted file mode 100644
824 | | | index 9245af5..0000000
830 * | | commit COMMIT_OBJECT_NAME
831 | | | Author: A U Thor <author@example.com>
836 | | | 1 file changed, 1 insertion(+)
838 | | | diff --git a/a/two b/a/two
839 | | | new file mode 100644
840 | | | index 0000000..9245af5
846 * | | commit COMMIT_OBJECT_NAME
847 |/ / Author: A U Thor <author@example.com>
852 | | 1 file changed, 1 insertion(+)
854 | | diff --git a/ein b/ein
855 | | new file mode 100644
856 | | index 0000000..9d7e69f
862 * | commit COMMIT_OBJECT_NAME
863 |/ Author: A U Thor <author@example.com>
869 | 2 files changed, 1 insertion(+), 1 deletion(-)
871 | diff --git a/ichi b/ichi
872 | new file mode 100644
873 | index 0000000..9d7e69f
878 | diff --git a/one b/one
879 | deleted file mode 100644
880 | index 9d7e69f..0000000
886 * commit COMMIT_OBJECT_NAME
887 | Author: A U Thor <author@example.com>
892 | 1 file changed, 1 insertion(+), 1 deletion(-)
894 | diff --git a/one b/one
895 | index 5626abf..9d7e69f 100644
902 * commit COMMIT_OBJECT_NAME
903 Author: A U Thor <author@example.com>
908 1 file changed, 1 insertion(+)
910 diff --git a/one b/one
912 index 0000000..5626abf
921 -e 's/commit [0-9a-f]*$/commit COMMIT_OBJECT_NAME/' \
922 -e 's/Merge: [ 0-9a-f]*$/Merge: MERGE_PARENTS/' \
923 -e 's/Merge tag.*/Merge HEADS DESCRIPTION/' \
924 -e 's/Merge commit.*/Merge HEADS DESCRIPTION/' \
925 -e 's/, 0 deletions(-)//' \
926 -e 's/, 0 insertions(+)//' \
927 -e 's/ 1 files changed, / 1 file changed, /' \
928 -e 's/, 1 deletions(-)/, 1 deletion(-)/' \
929 -e 's/, 1 insertions(+)/, 1 insertion(+)/'
932 test_expect_success 'log --graph with diff and stats' '
933 git log --no-renames --graph --pretty=short --stat -p >actual &&
934 sanitize_output >actual.sanitized <actual &&
935 test_i18ncmp expect actual.sanitized
939 *** * commit COMMIT_OBJECT_NAME
940 *** |\ Merge: MERGE_PARENTS
941 *** | | Author: A U Thor <author@example.com>
943 *** | | Merge HEADS DESCRIPTION
945 *** | * commit COMMIT_OBJECT_NAME
946 *** | | Author: A U Thor <author@example.com>
950 *** | | reach.t | 1 +
951 *** | | 1 file changed, 1 insertion(+)
953 *** | | diff --git a/reach.t b/reach.t
954 *** | | new file mode 100644
955 *** | | index 0000000..10c9591
956 *** | | --- /dev/null
957 *** | | +++ b/reach.t
958 *** | | @@ -0,0 +1 @@
962 *** *-. \ commit COMMIT_OBJECT_NAME
963 *** |\ \ \ Merge: MERGE_PARENTS
964 *** | | | | Author: A U Thor <author@example.com>
966 *** | | | | Merge HEADS DESCRIPTION
968 *** | | * | commit COMMIT_OBJECT_NAME
969 *** | | |/ Author: A U Thor <author@example.com>
973 *** | | | octopus-b.t | 1 +
974 *** | | | 1 file changed, 1 insertion(+)
976 *** | | | diff --git a/octopus-b.t b/octopus-b.t
977 *** | | | new file mode 100644
978 *** | | | index 0000000..d5fcad0
979 *** | | | --- /dev/null
980 *** | | | +++ b/octopus-b.t
981 *** | | | @@ -0,0 +1 @@
984 *** | * | commit COMMIT_OBJECT_NAME
985 *** | |/ Author: A U Thor <author@example.com>
989 *** | | octopus-a.t | 1 +
990 *** | | 1 file changed, 1 insertion(+)
992 *** | | diff --git a/octopus-a.t b/octopus-a.t
993 *** | | new file mode 100644
994 *** | | index 0000000..11ee015
995 *** | | --- /dev/null
996 *** | | +++ b/octopus-a.t
997 *** | | @@ -0,0 +1 @@
1000 *** * | commit COMMIT_OBJECT_NAME
1001 *** |/ Author: A U Thor <author@example.com>
1005 *** | seventh.t | 1 +
1006 *** | 1 file changed, 1 insertion(+)
1008 *** | diff --git a/seventh.t b/seventh.t
1009 *** | new file mode 100644
1010 *** | index 0000000..9744ffc
1012 *** | +++ b/seventh.t
1016 *** * commit COMMIT_OBJECT_NAME
1017 *** |\ Merge: MERGE_PARENTS
1018 *** | | Author: A U Thor <author@example.com>
1020 *** | | Merge branch 'tangle'
1022 *** | * commit COMMIT_OBJECT_NAME
1023 *** | |\ Merge: MERGE_PARENTS
1024 *** | | | Author: A U Thor <author@example.com>
1026 *** | | | Merge branch 'side' (early part) into tangle
1028 *** | * | commit COMMIT_OBJECT_NAME
1029 *** | |\ \ Merge: MERGE_PARENTS
1030 *** | | | | Author: A U Thor <author@example.com>
1032 *** | | | | Merge branch 'master' (early part) into tangle
1034 *** | * | | commit COMMIT_OBJECT_NAME
1035 *** | | | | Author: A U Thor <author@example.com>
1037 *** | | | | tangle-a
1039 *** | | | | tangle-a | 1 +
1040 *** | | | | 1 file changed, 1 insertion(+)
1042 *** | | | | diff --git a/tangle-a b/tangle-a
1043 *** | | | | new file mode 100644
1044 *** | | | | index 0000000..7898192
1045 *** | | | | --- /dev/null
1046 *** | | | | +++ b/tangle-a
1047 *** | | | | @@ -0,0 +1 @@
1050 *** * | | | commit COMMIT_OBJECT_NAME
1051 *** |\ \ \ \ Merge: MERGE_PARENTS
1052 *** | | | | | Author: A U Thor <author@example.com>
1054 *** | | | | | Merge branch 'side'
1056 *** | * | | | commit COMMIT_OBJECT_NAME
1057 *** | | |_|/ Author: A U Thor <author@example.com>
1062 *** | | | | 1 file changed, 1 insertion(+)
1064 *** | | | | diff --git a/2 b/2
1065 *** | | | | new file mode 100644
1066 *** | | | | index 0000000..0cfbf08
1067 *** | | | | --- /dev/null
1069 *** | | | | @@ -0,0 +1 @@
1072 *** | * | | commit COMMIT_OBJECT_NAME
1073 *** | | | | Author: A U Thor <author@example.com>
1078 *** | | | | 1 file changed, 1 insertion(+)
1080 *** | | | | diff --git a/1 b/1
1081 *** | | | | new file mode 100644
1082 *** | | | | index 0000000..d00491f
1083 *** | | | | --- /dev/null
1085 *** | | | | @@ -0,0 +1 @@
1088 *** * | | | commit COMMIT_OBJECT_NAME
1089 *** | | | | Author: A U Thor <author@example.com>
1093 *** | | | | one | 1 +
1094 *** | | | | 1 file changed, 1 insertion(+)
1096 *** | | | | diff --git a/one b/one
1097 *** | | | | new file mode 100644
1098 *** | | | | index 0000000..9a33383
1099 *** | | | | --- /dev/null
1100 *** | | | | +++ b/one
1101 *** | | | | @@ -0,0 +1 @@
1104 *** * | | | commit COMMIT_OBJECT_NAME
1105 *** | |_|/ Author: A U Thor <author@example.com>
1109 *** | | | a/two | 1 -
1110 *** | | | 1 file changed, 1 deletion(-)
1112 *** | | | diff --git a/a/two b/a/two
1113 *** | | | deleted file mode 100644
1114 *** | | | index 9245af5..0000000
1115 *** | | | --- a/a/two
1116 *** | | | +++ /dev/null
1117 *** | | | @@ -1 +0,0 @@
1120 *** * | | commit COMMIT_OBJECT_NAME
1121 *** | | | Author: A U Thor <author@example.com>
1125 *** | | | a/two | 1 +
1126 *** | | | 1 file changed, 1 insertion(+)
1128 *** | | | diff --git a/a/two b/a/two
1129 *** | | | new file mode 100644
1130 *** | | | index 0000000..9245af5
1131 *** | | | --- /dev/null
1132 *** | | | +++ b/a/two
1133 *** | | | @@ -0,0 +1 @@
1136 *** * | | commit COMMIT_OBJECT_NAME
1137 *** |/ / Author: A U Thor <author@example.com>
1142 *** | | 1 file changed, 1 insertion(+)
1144 *** | | diff --git a/ein b/ein
1145 *** | | new file mode 100644
1146 *** | | index 0000000..9d7e69f
1147 *** | | --- /dev/null
1149 *** | | @@ -0,0 +1 @@
1152 *** * | commit COMMIT_OBJECT_NAME
1153 *** |/ Author: A U Thor <author@example.com>
1159 *** | 2 files changed, 1 insertion(+), 1 deletion(-)
1161 *** | diff --git a/ichi b/ichi
1162 *** | new file mode 100644
1163 *** | index 0000000..9d7e69f
1168 *** | diff --git a/one b/one
1169 *** | deleted file mode 100644
1170 *** | index 9d7e69f..0000000
1176 *** * commit COMMIT_OBJECT_NAME
1177 *** | Author: A U Thor <author@example.com>
1182 *** | 1 file changed, 1 insertion(+), 1 deletion(-)
1184 *** | diff --git a/one b/one
1185 *** | index 5626abf..9d7e69f 100644
1192 *** * commit COMMIT_OBJECT_NAME
1193 *** Author: A U Thor <author@example.com>
1198 *** 1 file changed, 1 insertion(+)
1200 *** diff --git a/one b/one
1201 *** new file mode 100644
1202 *** index 0000000..5626abf
1209 test_expect_success 'log --line-prefix="*** " --graph with diff and stats' '
1210 git log --line-prefix="*** " --no-renames --graph --pretty=short --stat -p >actual &&
1211 sanitize_output >actual.sanitized <actual &&
1212 test_i18ncmp expect actual.sanitized
1219 * Merge branch 'tangle'
1220 * Merge branch 'side'
1233 test_expect_success 'log --graph with --name-status' '
1234 git log --graph --format=%s --name-status tangle..reach >actual &&
1235 sanitize_output <actual >actual.sanitized &&
1236 test_cmp expect actual.sanitized
1243 * Merge branch 'tangle'
1244 * Merge branch 'side'
1257 test_expect_success 'log --graph with --name-only' '
1258 git log --graph --format=%s --name-only tangle..reach >actual &&
1259 sanitize_output <actual >actual.sanitized &&
1260 test_cmp expect actual.sanitized
1263 test_expect_success 'dotdot is a parent directory' '
1265 ( echo sixth && echo fifth ) >expect &&
1266 ( cd a/b && git log --format=%s .. ) >actual &&
1267 test_cmp expect actual
1270 test_expect_success GPG 'setup signed branch' '
1271 test_when_finished "git reset --hard && git checkout master" &&
1272 git checkout -b signed master &&
1275 git commit -S -m signed_commit
1278 test_expect_success GPG 'log --graph --show-signature' '
1279 git log --graph --show-signature -n1 signed >actual &&
1280 grep "^| gpg: Signature made" actual &&
1281 grep "^| gpg: Good signature" actual
1284 test_expect_success GPG 'log --graph --show-signature for merged tag' '
1285 test_when_finished "git reset --hard && git checkout master" &&
1286 git checkout -b plain master &&
1289 git commit -m bar_commit &&
1290 git checkout -b tagged master &&
1293 git commit -m baz_commit &&
1294 git tag -s -m signed_tag_msg signed_tag &&
1295 git checkout plain &&
1296 git merge --no-ff -m msg signed_tag &&
1297 git log --graph --show-signature -n1 plain >actual &&
1298 grep "^|\\\ merged tag" actual &&
1299 grep "^| | gpg: Signature made" actual &&
1300 grep "^| | gpg: Good signature" actual
1303 test_expect_success GPG '--no-show-signature overrides --show-signature' '
1304 git log -1 --show-signature --no-show-signature signed >actual &&
1305 ! grep "^gpg:" actual
1308 test_expect_success GPG 'log.showsignature=true behaves like --show-signature' '
1309 test_config log.showsignature true &&
1310 git log -1 signed >actual &&
1311 grep "gpg: Signature made" actual &&
1312 grep "gpg: Good signature" actual
1315 test_expect_success GPG '--no-show-signature overrides log.showsignature=true' '
1316 test_config log.showsignature true &&
1317 git log -1 --no-show-signature signed >actual &&
1318 ! grep "^gpg:" actual
1321 test_expect_success GPG '--show-signature overrides log.showsignature=false' '
1322 test_config log.showsignature false &&
1323 git log -1 --show-signature signed >actual &&
1324 grep "gpg: Signature made" actual &&
1325 grep "gpg: Good signature" actual
1328 test_expect_success 'log --graph --no-walk is forbidden' '
1329 test_must_fail git log --graph --no-walk
1332 test_expect_success 'log diagnoses bogus HEAD' '
1334 test_must_fail git -C empty log 2>stderr &&
1335 test_i18ngrep does.not.have.any.commits stderr &&
1336 echo 1234abcd >empty/.git/refs/heads/master &&
1337 test_must_fail git -C empty log 2>stderr &&
1338 test_i18ngrep broken stderr &&
1339 echo "ref: refs/heads/invalid.lock" >empty/.git/HEAD &&
1340 test_must_fail git -C empty log 2>stderr &&
1341 test_i18ngrep broken stderr &&
1342 test_must_fail git -C empty log --default totally-bogus 2>stderr &&
1343 test_i18ngrep broken stderr
1346 test_expect_success 'set up --source tests' '
1347 git checkout --orphan source-a &&
1350 git checkout -b source-b HEAD^ &&
1354 test_expect_success 'log --source paints branch names' '
1355 cat >expect <<-\EOF &&
1356 09e12a9 source-b three
1357 8e393e1 source-a two
1358 1ac6c77 source-b one
1360 git log --oneline --source source-a source-b >actual &&
1361 test_cmp expect actual
1364 test_expect_success 'log --source paints tag names' '
1365 git tag -m tagged source-tag &&
1366 cat >expect <<-\EOF &&
1367 09e12a9 source-tag three
1368 8e393e1 source-a two
1369 1ac6c77 source-tag one
1371 git log --oneline --source source-tag source-a >actual &&
1372 test_cmp expect actual