3 test_description='git log'
6 . "$TEST_DIRECTORY/lib-gpg.sh"
7 . "$TEST_DIRECTORY/lib-terminal.sh"
9 test_expect_success setup '
14 git commit -m initial &&
19 git commit -m second &&
23 git commit -m third &&
28 git commit -m fourth &&
34 git commit -m fifth &&
42 printf "sixth\nfifth\nfourth\nthird\nsecond\ninitial" > expect
43 test_expect_success 'pretty' '
45 git log --pretty="format:%s" > actual &&
46 test_cmp expect actual
49 printf "sixth\nfifth\nfourth\nthird\nsecond\ninitial\n" > expect
50 test_expect_success 'pretty (tformat)' '
52 git log --pretty="tformat:%s" > actual &&
53 test_cmp expect actual
56 test_expect_success 'pretty (shortcut)' '
58 git log --pretty="%s" > actual &&
59 test_cmp expect actual
62 test_expect_success 'format' '
64 git log --format="%s" > actual &&
65 test_cmp expect actual
77 test_expect_success 'format %w(11,1,2)' '
79 git log -2 --format="%w(11,1,2)This is the %s commit." > actual &&
80 test_cmp expect actual
83 test_expect_success 'format %w(,1,2)' '
85 git log -2 --format="%w(,1,2)This is%nthe %s%ncommit." > actual &&
86 test_cmp expect actual
97 test_expect_success 'oneline' '
99 git log --oneline > actual &&
100 test_cmp expect actual
103 test_expect_success 'diff-filter=A' '
105 git log --no-renames --pretty="format:%s" --diff-filter=A HEAD > actual &&
106 git log --no-renames --pretty="format:%s" --diff-filter A HEAD > actual-separate &&
107 printf "fifth\nfourth\nthird\ninitial" > expect &&
108 test_cmp expect actual &&
109 test_cmp expect actual-separate
113 test_expect_success 'diff-filter=M' '
115 actual=$(git log --pretty="format:%s" --diff-filter=M HEAD) &&
116 expect=$(echo second) &&
117 verbose test "$actual" = "$expect"
121 test_expect_success 'diff-filter=D' '
123 actual=$(git log --no-renames --pretty="format:%s" --diff-filter=D HEAD) &&
124 expect=$(echo sixth ; echo third) &&
125 verbose test "$actual" = "$expect"
129 test_expect_success 'diff-filter=R' '
131 actual=$(git log -M --pretty="format:%s" --diff-filter=R HEAD) &&
132 expect=$(echo third) &&
133 verbose test "$actual" = "$expect"
137 test_expect_success 'diff-filter=C' '
139 actual=$(git log -C -C --pretty="format:%s" --diff-filter=C HEAD) &&
140 expect=$(echo fourth) &&
141 verbose test "$actual" = "$expect"
145 test_expect_success 'git log --follow' '
147 actual=$(git log --follow --pretty="format:%s" ichi) &&
148 expect=$(echo third ; echo second ; echo initial) &&
149 verbose test "$actual" = "$expect"
152 test_expect_success 'git config log.follow works like --follow' '
153 test_config log.follow true &&
154 actual=$(git log --pretty="format:%s" ichi) &&
155 expect=$(echo third ; echo second ; echo initial) &&
156 verbose test "$actual" = "$expect"
159 test_expect_success 'git config log.follow does not die with multiple paths' '
160 test_config log.follow true &&
161 git log --pretty="format:%s" ichi ein
164 test_expect_success 'git config log.follow does not die with no paths' '
165 test_config log.follow true &&
169 test_expect_success 'git config log.follow is overridden by --no-follow' '
170 test_config log.follow true &&
171 actual=$(git log --no-follow --pretty="format:%s" ichi) &&
173 verbose test "$actual" = "$expect"
181 test_expect_success 'git log --no-walk <commits> sorts by commit time' '
182 git log --no-walk --oneline 5d31159 804a787 394ef78 > actual &&
183 test_cmp expect actual
186 test_expect_success 'git log --no-walk=sorted <commits> sorts by commit time' '
187 git log --no-walk=sorted --oneline 5d31159 804a787 394ef78 > actual &&
188 test_cmp expect actual
196 test_expect_success 'git log --line-prefix="=== " --no-walk <commits> sorts by commit time' '
197 git log --line-prefix="=== " --no-walk --oneline 5d31159 804a787 394ef78 > actual &&
198 test_cmp expect actual
206 test_expect_success 'git log --no-walk=unsorted <commits> leaves list of commits as given' '
207 git log --no-walk=unsorted --oneline 5d31159 804a787 394ef78 > actual &&
208 test_cmp expect actual
211 test_expect_success 'git show <commits> leaves list of commits as given' '
212 git show --oneline -s 5d31159 804a787 394ef78 > actual &&
213 test_cmp expect actual
216 test_expect_success 'setup case sensitivity tests' '
220 git commit -a -m Second
223 test_expect_success 'log --grep' '
224 echo second >expect &&
225 git log -1 --pretty="tformat:%s" --grep=sec >actual &&
226 test_cmp expect actual
233 test_expect_success 'log --invert-grep --grep' '
234 git log --pretty="tformat:%s" --invert-grep --grep=th --grep=Sec >actual &&
235 test_cmp expect actual
238 test_expect_success 'log --invert-grep --grep -i' '
239 echo initial >expect &&
240 git log --pretty="tformat:%s" --invert-grep -i --grep=th --grep=Sec >actual &&
241 test_cmp expect actual
244 test_expect_success 'log --grep option parsing' '
245 echo second >expect &&
246 git log -1 --pretty="tformat:%s" --grep sec >actual &&
247 test_cmp expect actual &&
248 test_must_fail git log -1 --pretty="tformat:%s" --grep
251 test_expect_success 'log -i --grep' '
252 echo Second >expect &&
253 git log -1 --pretty="tformat:%s" -i --grep=sec >actual &&
254 test_cmp expect actual
257 test_expect_success 'log --grep -i' '
258 echo Second >expect &&
259 git log -1 --pretty="tformat:%s" --grep=sec -i >actual &&
260 test_cmp expect actual
263 test_expect_success 'log -F -E --grep=<ere> uses ere' '
264 echo second >expect &&
265 git log -1 --pretty="tformat:%s" -F -E --grep=s.c.nd >actual &&
266 test_cmp expect actual
269 test_expect_success 'log with grep.patternType configuration' '
271 git -c grep.patterntype=fixed \
272 log -1 --pretty=tformat:%s --grep=s.c.nd >actual &&
273 test_cmp expect actual
276 test_expect_success 'log with grep.patternType configuration and command line' '
277 echo second >expect &&
278 git -c grep.patterntype=fixed \
279 log -1 --pretty=tformat:%s --basic-regexp --grep=s.c.nd >actual &&
280 test_cmp expect actual
293 test_expect_success 'simple log --graph' '
294 git log --graph --pretty=tformat:%s >actual &&
295 test_cmp expect actual
308 test_expect_success 'simple log --graph --line-prefix="123 "' '
309 git log --graph --line-prefix="123 " --pretty=tformat:%s >actual &&
310 test_cmp expect actual
313 test_expect_success 'set up merge history' '
314 git checkout -b side HEAD~4 &&
315 test_commit side-1 1 1 &&
316 test_commit side-2 2 2 &&
317 git checkout master &&
322 * Merge branch 'side'
336 test_expect_success 'log --graph with merge' '
337 git log --graph --date-order --pretty=tformat:%s |
338 sed "s/ *\$//" >actual &&
339 test_cmp expect actual
343 | | | * Merge branch 'side'
357 test_expect_success 'log --graph --line-prefix="| | | " with merge' '
358 git log --line-prefix="| | | " --graph --date-order --pretty=tformat:%s |
359 sed "s/ *\$//" >actual &&
360 test_cmp expect actual
363 cat > expect.colors <<\EOF
364 * Merge branch 'side'
365 <BLUE>|<RESET><CYAN>\<RESET>
366 <BLUE>|<RESET> * side-2
367 <BLUE>|<RESET> * side-1
368 * <CYAN>|<RESET> Second
369 * <CYAN>|<RESET> sixth
370 * <CYAN>|<RESET> fifth
371 * <CYAN>|<RESET> fourth
372 <CYAN>|<RESET><CYAN>/<RESET>
378 test_expect_success 'log --graph with merge with log.graphColors' '
379 test_config log.graphColors " blue,invalid-color, cyan, red , " &&
380 git log --color=always --graph --date-order --pretty=tformat:%s |
381 test_decode_color | sed "s/ *\$//" >actual &&
382 test_cmp expect.colors actual
385 test_expect_success 'log --raw --graph -m with merge' '
386 git log --raw --graph --oneline -m master | head -n 500 >actual &&
387 grep "initial" actual
390 test_expect_success 'diff-tree --graph' '
391 git diff-tree --graph master^ | head -n 500 >actual &&
398 | | Author: A U Thor <author@example.com>
400 | | Merge branch 'side'
403 | | Author: A U Thor <author@example.com>
407 | * commit tags/side-1
408 | | Author: A U Thor <author@example.com>
413 | | Author: A U Thor <author@example.com>
418 | | Author: A U Thor <author@example.com>
423 | | Author: A U Thor <author@example.com>
428 |/ Author: A U Thor <author@example.com>
432 * commit tags/side-1~1
433 | Author: A U Thor <author@example.com>
437 * commit tags/side-1~2
438 | Author: A U Thor <author@example.com>
442 * commit tags/side-1~3
443 Author: A U Thor <author@example.com>
448 test_expect_success 'log --graph with full output' '
449 git log --graph --date-order --pretty=short |
450 git name-rev --name-only --stdin |
451 sed "s/Merge:.*/Merge: A B/;s/ *\$//" >actual &&
452 test_cmp expect actual
455 test_expect_success 'set up more tangled history' '
456 git checkout -b tangle HEAD~6 &&
457 test_commit tangle-a tangle-a a &&
458 git merge master~3 &&
460 git checkout master &&
462 git checkout -b reach &&
464 git checkout master &&
465 git checkout -b octopus-a &&
466 test_commit octopus-a &&
467 git checkout master &&
468 git checkout -b octopus-b &&
469 test_commit octopus-b &&
470 git checkout master &&
471 test_commit seventh &&
472 git merge octopus-a octopus-b &&
481 *-. \ Merge tags 'octopus-a' and 'octopus-b'
491 * Merge branch 'tangle'
493 | * Merge branch 'side' (early part) into tangle
495 | * \ Merge branch 'master' (early part) into tangle
498 * | | | Merge branch 'side'
517 test_expect_success 'log --graph with merge' '
518 git log --graph --date-order --pretty=tformat:%s |
519 sed "s/ *\$//" >actual &&
520 test_cmp expect actual
523 test_expect_success 'log.decorate configuration' '
524 git log --oneline --no-decorate >expect.none &&
525 git log --oneline --decorate >expect.short &&
526 git log --oneline --decorate=full >expect.full &&
528 echo "[log] decorate" >>.git/config &&
529 git log --oneline >actual &&
530 test_cmp expect.short actual &&
532 test_config log.decorate true &&
533 git log --oneline >actual &&
534 test_cmp expect.short actual &&
535 git log --oneline --decorate=full >actual &&
536 test_cmp expect.full actual &&
537 git log --oneline --decorate=no >actual &&
538 test_cmp expect.none actual &&
540 test_config log.decorate no &&
541 git log --oneline >actual &&
542 test_cmp expect.none actual &&
543 git log --oneline --decorate >actual &&
544 test_cmp expect.short actual &&
545 git log --oneline --decorate=full >actual &&
546 test_cmp expect.full actual &&
548 test_config log.decorate 1 &&
549 git log --oneline >actual &&
550 test_cmp expect.short actual &&
551 git log --oneline --decorate=full >actual &&
552 test_cmp expect.full actual &&
553 git log --oneline --decorate=no >actual &&
554 test_cmp expect.none actual &&
556 test_config log.decorate short &&
557 git log --oneline >actual &&
558 test_cmp expect.short actual &&
559 git log --oneline --no-decorate >actual &&
560 test_cmp expect.none actual &&
561 git log --oneline --decorate=full >actual &&
562 test_cmp expect.full actual &&
564 test_config log.decorate full &&
565 git log --oneline >actual &&
566 test_cmp expect.full actual &&
567 git log --oneline --no-decorate >actual &&
568 test_cmp expect.none actual &&
569 git log --oneline --decorate >actual &&
570 test_cmp expect.short actual &&
572 test_unconfig log.decorate &&
573 git log --pretty=raw >expect.raw &&
574 test_config log.decorate full &&
575 git log --pretty=raw >actual &&
576 test_cmp expect.raw actual
580 test_expect_success TTY 'log output on a TTY' '
581 git log --oneline --decorate >expect.short &&
583 test_terminal git log --oneline >actual &&
584 test_cmp expect.short actual
587 test_expect_success 'reflog is expected format' '
588 git log -g --abbrev-commit --pretty=oneline >expect &&
589 git reflog >actual &&
590 test_cmp expect actual
593 test_expect_success 'whatchanged is expected format' '
594 git log --no-merges --raw >expect &&
595 git whatchanged >actual &&
596 test_cmp expect actual
599 test_expect_success 'log.abbrevCommit configuration' '
600 git log --abbrev-commit >expect.log.abbrev &&
601 git log --no-abbrev-commit >expect.log.full &&
602 git log --pretty=raw >expect.log.raw &&
603 git reflog --abbrev-commit >expect.reflog.abbrev &&
604 git reflog --no-abbrev-commit >expect.reflog.full &&
605 git whatchanged --abbrev-commit >expect.whatchanged.abbrev &&
606 git whatchanged --no-abbrev-commit >expect.whatchanged.full &&
608 test_config log.abbrevCommit true &&
611 test_cmp expect.log.abbrev actual &&
612 git log --no-abbrev-commit >actual &&
613 test_cmp expect.log.full actual &&
615 git log --pretty=raw >actual &&
616 test_cmp expect.log.raw actual &&
618 git reflog >actual &&
619 test_cmp expect.reflog.abbrev actual &&
620 git reflog --no-abbrev-commit >actual &&
621 test_cmp expect.reflog.full actual &&
623 git whatchanged >actual &&
624 test_cmp expect.whatchanged.abbrev actual &&
625 git whatchanged --no-abbrev-commit >actual &&
626 test_cmp expect.whatchanged.full actual
629 test_expect_success 'show added path under "--follow -M"' '
630 # This tests for a regression introduced in v1.7.2-rc0~103^2~2
631 test_create_repo regression &&
634 test_commit needs-another-commit &&
635 test_commit foo.bar &&
636 git log -M --follow -p foo.bar.t &&
637 git log -M --follow --stat foo.bar.t &&
638 git log -M --follow --name-only foo.bar.t
642 test_expect_success 'git log -c --follow' '
643 test_create_repo follow-c &&
646 test_commit initial file original &&
648 test_commit rename file2 original &&
649 git reset --hard initial &&
650 test_commit modify file foo &&
651 git merge -m merge rename &&
652 git log -c --follow file2
657 * commit COMMIT_OBJECT_NAME
658 |\ Merge: MERGE_PARENTS
659 | | Author: A U Thor <author@example.com>
661 | | Merge HEADS DESCRIPTION
663 | * commit COMMIT_OBJECT_NAME
664 | | Author: A U Thor <author@example.com>
669 | | 1 file changed, 1 insertion(+)
671 | | diff --git a/reach.t b/reach.t
672 | | new file mode 100644
673 | | index 0000000..10c9591
680 *-. \ commit COMMIT_OBJECT_NAME
681 |\ \ \ Merge: MERGE_PARENTS
682 | | | | Author: A U Thor <author@example.com>
684 | | | | Merge HEADS DESCRIPTION
686 | | * | commit COMMIT_OBJECT_NAME
687 | | |/ Author: A U Thor <author@example.com>
691 | | | octopus-b.t | 1 +
692 | | | 1 file changed, 1 insertion(+)
694 | | | diff --git a/octopus-b.t b/octopus-b.t
695 | | | new file mode 100644
696 | | | index 0000000..d5fcad0
698 | | | +++ b/octopus-b.t
702 | * | commit COMMIT_OBJECT_NAME
703 | |/ Author: A U Thor <author@example.com>
707 | | octopus-a.t | 1 +
708 | | 1 file changed, 1 insertion(+)
710 | | diff --git a/octopus-a.t b/octopus-a.t
711 | | new file mode 100644
712 | | index 0000000..11ee015
714 | | +++ b/octopus-a.t
718 * | commit COMMIT_OBJECT_NAME
719 |/ Author: A U Thor <author@example.com>
724 | 1 file changed, 1 insertion(+)
726 | diff --git a/seventh.t b/seventh.t
727 | new file mode 100644
728 | index 0000000..9744ffc
734 * commit COMMIT_OBJECT_NAME
735 |\ Merge: MERGE_PARENTS
736 | | Author: A U Thor <author@example.com>
738 | | Merge branch 'tangle'
740 | * commit COMMIT_OBJECT_NAME
741 | |\ Merge: MERGE_PARENTS
742 | | | Author: A U Thor <author@example.com>
744 | | | Merge branch 'side' (early part) into tangle
746 | * | commit COMMIT_OBJECT_NAME
747 | |\ \ Merge: MERGE_PARENTS
748 | | | | Author: A U Thor <author@example.com>
750 | | | | Merge branch 'master' (early part) into tangle
752 | * | | commit COMMIT_OBJECT_NAME
753 | | | | Author: A U Thor <author@example.com>
757 | | | | tangle-a | 1 +
758 | | | | 1 file changed, 1 insertion(+)
760 | | | | diff --git a/tangle-a b/tangle-a
761 | | | | new file mode 100644
762 | | | | index 0000000..7898192
763 | | | | --- /dev/null
764 | | | | +++ b/tangle-a
765 | | | | @@ -0,0 +1 @@
768 * | | | commit COMMIT_OBJECT_NAME
769 |\ \ \ \ Merge: MERGE_PARENTS
770 | | | | | Author: A U Thor <author@example.com>
772 | | | | | Merge branch 'side'
774 | * | | | commit COMMIT_OBJECT_NAME
775 | | |_|/ Author: A U Thor <author@example.com>
780 | | | | 1 file changed, 1 insertion(+)
782 | | | | diff --git a/2 b/2
783 | | | | new file mode 100644
784 | | | | index 0000000..0cfbf08
785 | | | | --- /dev/null
787 | | | | @@ -0,0 +1 @@
790 | * | | commit COMMIT_OBJECT_NAME
791 | | | | Author: A U Thor <author@example.com>
796 | | | | 1 file changed, 1 insertion(+)
798 | | | | diff --git a/1 b/1
799 | | | | new file mode 100644
800 | | | | index 0000000..d00491f
801 | | | | --- /dev/null
803 | | | | @@ -0,0 +1 @@
806 * | | | commit COMMIT_OBJECT_NAME
807 | | | | Author: A U Thor <author@example.com>
812 | | | | 1 file changed, 1 insertion(+)
814 | | | | diff --git a/one b/one
815 | | | | new file mode 100644
816 | | | | index 0000000..9a33383
817 | | | | --- /dev/null
819 | | | | @@ -0,0 +1 @@
822 * | | | commit COMMIT_OBJECT_NAME
823 | |_|/ Author: A U Thor <author@example.com>
828 | | | 1 file changed, 1 deletion(-)
830 | | | diff --git a/a/two b/a/two
831 | | | deleted file mode 100644
832 | | | index 9245af5..0000000
838 * | | commit COMMIT_OBJECT_NAME
839 | | | Author: A U Thor <author@example.com>
844 | | | 1 file changed, 1 insertion(+)
846 | | | diff --git a/a/two b/a/two
847 | | | new file mode 100644
848 | | | index 0000000..9245af5
854 * | | commit COMMIT_OBJECT_NAME
855 |/ / Author: A U Thor <author@example.com>
860 | | 1 file changed, 1 insertion(+)
862 | | diff --git a/ein b/ein
863 | | new file mode 100644
864 | | index 0000000..9d7e69f
870 * | commit COMMIT_OBJECT_NAME
871 |/ Author: A U Thor <author@example.com>
877 | 2 files changed, 1 insertion(+), 1 deletion(-)
879 | diff --git a/ichi b/ichi
880 | new file mode 100644
881 | index 0000000..9d7e69f
886 | diff --git a/one b/one
887 | deleted file mode 100644
888 | index 9d7e69f..0000000
894 * commit COMMIT_OBJECT_NAME
895 | Author: A U Thor <author@example.com>
900 | 1 file changed, 1 insertion(+), 1 deletion(-)
902 | diff --git a/one b/one
903 | index 5626abf..9d7e69f 100644
910 * commit COMMIT_OBJECT_NAME
911 Author: A U Thor <author@example.com>
916 1 file changed, 1 insertion(+)
918 diff --git a/one b/one
920 index 0000000..5626abf
929 -e 's/commit [0-9a-f]*$/commit COMMIT_OBJECT_NAME/' \
930 -e 's/Merge: [ 0-9a-f]*$/Merge: MERGE_PARENTS/' \
931 -e 's/Merge tag.*/Merge HEADS DESCRIPTION/' \
932 -e 's/Merge commit.*/Merge HEADS DESCRIPTION/' \
933 -e 's/, 0 deletions(-)//' \
934 -e 's/, 0 insertions(+)//' \
935 -e 's/ 1 files changed, / 1 file changed, /' \
936 -e 's/, 1 deletions(-)/, 1 deletion(-)/' \
937 -e 's/, 1 insertions(+)/, 1 insertion(+)/'
940 test_expect_success 'log --graph with diff and stats' '
941 git log --no-renames --graph --pretty=short --stat -p >actual &&
942 sanitize_output >actual.sanitized <actual &&
943 test_i18ncmp expect actual.sanitized
947 *** * commit COMMIT_OBJECT_NAME
948 *** |\ Merge: MERGE_PARENTS
949 *** | | Author: A U Thor <author@example.com>
951 *** | | Merge HEADS DESCRIPTION
953 *** | * commit COMMIT_OBJECT_NAME
954 *** | | Author: A U Thor <author@example.com>
958 *** | | reach.t | 1 +
959 *** | | 1 file changed, 1 insertion(+)
961 *** | | diff --git a/reach.t b/reach.t
962 *** | | new file mode 100644
963 *** | | index 0000000..10c9591
964 *** | | --- /dev/null
965 *** | | +++ b/reach.t
966 *** | | @@ -0,0 +1 @@
970 *** *-. \ commit COMMIT_OBJECT_NAME
971 *** |\ \ \ Merge: MERGE_PARENTS
972 *** | | | | Author: A U Thor <author@example.com>
974 *** | | | | Merge HEADS DESCRIPTION
976 *** | | * | commit COMMIT_OBJECT_NAME
977 *** | | |/ Author: A U Thor <author@example.com>
981 *** | | | octopus-b.t | 1 +
982 *** | | | 1 file changed, 1 insertion(+)
984 *** | | | diff --git a/octopus-b.t b/octopus-b.t
985 *** | | | new file mode 100644
986 *** | | | index 0000000..d5fcad0
987 *** | | | --- /dev/null
988 *** | | | +++ b/octopus-b.t
989 *** | | | @@ -0,0 +1 @@
992 *** | * | commit COMMIT_OBJECT_NAME
993 *** | |/ Author: A U Thor <author@example.com>
997 *** | | octopus-a.t | 1 +
998 *** | | 1 file changed, 1 insertion(+)
1000 *** | | diff --git a/octopus-a.t b/octopus-a.t
1001 *** | | new file mode 100644
1002 *** | | index 0000000..11ee015
1003 *** | | --- /dev/null
1004 *** | | +++ b/octopus-a.t
1005 *** | | @@ -0,0 +1 @@
1008 *** * | commit COMMIT_OBJECT_NAME
1009 *** |/ Author: A U Thor <author@example.com>
1013 *** | seventh.t | 1 +
1014 *** | 1 file changed, 1 insertion(+)
1016 *** | diff --git a/seventh.t b/seventh.t
1017 *** | new file mode 100644
1018 *** | index 0000000..9744ffc
1020 *** | +++ b/seventh.t
1024 *** * commit COMMIT_OBJECT_NAME
1025 *** |\ Merge: MERGE_PARENTS
1026 *** | | Author: A U Thor <author@example.com>
1028 *** | | Merge branch 'tangle'
1030 *** | * commit COMMIT_OBJECT_NAME
1031 *** | |\ Merge: MERGE_PARENTS
1032 *** | | | Author: A U Thor <author@example.com>
1034 *** | | | Merge branch 'side' (early part) into tangle
1036 *** | * | commit COMMIT_OBJECT_NAME
1037 *** | |\ \ Merge: MERGE_PARENTS
1038 *** | | | | Author: A U Thor <author@example.com>
1040 *** | | | | Merge branch 'master' (early part) into tangle
1042 *** | * | | commit COMMIT_OBJECT_NAME
1043 *** | | | | Author: A U Thor <author@example.com>
1045 *** | | | | tangle-a
1047 *** | | | | tangle-a | 1 +
1048 *** | | | | 1 file changed, 1 insertion(+)
1050 *** | | | | diff --git a/tangle-a b/tangle-a
1051 *** | | | | new file mode 100644
1052 *** | | | | index 0000000..7898192
1053 *** | | | | --- /dev/null
1054 *** | | | | +++ b/tangle-a
1055 *** | | | | @@ -0,0 +1 @@
1058 *** * | | | commit COMMIT_OBJECT_NAME
1059 *** |\ \ \ \ Merge: MERGE_PARENTS
1060 *** | | | | | Author: A U Thor <author@example.com>
1062 *** | | | | | Merge branch 'side'
1064 *** | * | | | commit COMMIT_OBJECT_NAME
1065 *** | | |_|/ Author: A U Thor <author@example.com>
1070 *** | | | | 1 file changed, 1 insertion(+)
1072 *** | | | | diff --git a/2 b/2
1073 *** | | | | new file mode 100644
1074 *** | | | | index 0000000..0cfbf08
1075 *** | | | | --- /dev/null
1077 *** | | | | @@ -0,0 +1 @@
1080 *** | * | | commit COMMIT_OBJECT_NAME
1081 *** | | | | Author: A U Thor <author@example.com>
1086 *** | | | | 1 file changed, 1 insertion(+)
1088 *** | | | | diff --git a/1 b/1
1089 *** | | | | new file mode 100644
1090 *** | | | | index 0000000..d00491f
1091 *** | | | | --- /dev/null
1093 *** | | | | @@ -0,0 +1 @@
1096 *** * | | | commit COMMIT_OBJECT_NAME
1097 *** | | | | Author: A U Thor <author@example.com>
1101 *** | | | | one | 1 +
1102 *** | | | | 1 file changed, 1 insertion(+)
1104 *** | | | | diff --git a/one b/one
1105 *** | | | | new file mode 100644
1106 *** | | | | index 0000000..9a33383
1107 *** | | | | --- /dev/null
1108 *** | | | | +++ b/one
1109 *** | | | | @@ -0,0 +1 @@
1112 *** * | | | commit COMMIT_OBJECT_NAME
1113 *** | |_|/ Author: A U Thor <author@example.com>
1117 *** | | | a/two | 1 -
1118 *** | | | 1 file changed, 1 deletion(-)
1120 *** | | | diff --git a/a/two b/a/two
1121 *** | | | deleted file mode 100644
1122 *** | | | index 9245af5..0000000
1123 *** | | | --- a/a/two
1124 *** | | | +++ /dev/null
1125 *** | | | @@ -1 +0,0 @@
1128 *** * | | commit COMMIT_OBJECT_NAME
1129 *** | | | Author: A U Thor <author@example.com>
1133 *** | | | a/two | 1 +
1134 *** | | | 1 file changed, 1 insertion(+)
1136 *** | | | diff --git a/a/two b/a/two
1137 *** | | | new file mode 100644
1138 *** | | | index 0000000..9245af5
1139 *** | | | --- /dev/null
1140 *** | | | +++ b/a/two
1141 *** | | | @@ -0,0 +1 @@
1144 *** * | | commit COMMIT_OBJECT_NAME
1145 *** |/ / Author: A U Thor <author@example.com>
1150 *** | | 1 file changed, 1 insertion(+)
1152 *** | | diff --git a/ein b/ein
1153 *** | | new file mode 100644
1154 *** | | index 0000000..9d7e69f
1155 *** | | --- /dev/null
1157 *** | | @@ -0,0 +1 @@
1160 *** * | commit COMMIT_OBJECT_NAME
1161 *** |/ Author: A U Thor <author@example.com>
1167 *** | 2 files changed, 1 insertion(+), 1 deletion(-)
1169 *** | diff --git a/ichi b/ichi
1170 *** | new file mode 100644
1171 *** | index 0000000..9d7e69f
1176 *** | diff --git a/one b/one
1177 *** | deleted file mode 100644
1178 *** | index 9d7e69f..0000000
1184 *** * commit COMMIT_OBJECT_NAME
1185 *** | Author: A U Thor <author@example.com>
1190 *** | 1 file changed, 1 insertion(+), 1 deletion(-)
1192 *** | diff --git a/one b/one
1193 *** | index 5626abf..9d7e69f 100644
1200 *** * commit COMMIT_OBJECT_NAME
1201 *** Author: A U Thor <author@example.com>
1206 *** 1 file changed, 1 insertion(+)
1208 *** diff --git a/one b/one
1209 *** new file mode 100644
1210 *** index 0000000..5626abf
1217 test_expect_success 'log --line-prefix="*** " --graph with diff and stats' '
1218 git log --line-prefix="*** " --no-renames --graph --pretty=short --stat -p >actual &&
1219 sanitize_output >actual.sanitized <actual &&
1220 test_i18ncmp expect actual.sanitized
1227 * Merge branch 'tangle'
1228 * Merge branch 'side'
1241 test_expect_success 'log --graph with --name-status' '
1242 git log --graph --format=%s --name-status tangle..reach >actual &&
1243 sanitize_output <actual >actual.sanitized &&
1244 test_cmp expect actual.sanitized
1251 * Merge branch 'tangle'
1252 * Merge branch 'side'
1265 test_expect_success 'log --graph with --name-only' '
1266 git log --graph --format=%s --name-only tangle..reach >actual &&
1267 sanitize_output <actual >actual.sanitized &&
1268 test_cmp expect actual.sanitized
1271 test_expect_success 'dotdot is a parent directory' '
1273 ( echo sixth && echo fifth ) >expect &&
1274 ( cd a/b && git log --format=%s .. ) >actual &&
1275 test_cmp expect actual
1278 test_expect_success GPG 'setup signed branch' '
1279 test_when_finished "git reset --hard && git checkout master" &&
1280 git checkout -b signed master &&
1283 git commit -S -m signed_commit
1286 test_expect_success GPG 'log --graph --show-signature' '
1287 git log --graph --show-signature -n1 signed >actual &&
1288 grep "^| gpg: Signature made" actual &&
1289 grep "^| gpg: Good signature" actual
1292 test_expect_success GPG 'log --graph --show-signature for merged tag' '
1293 test_when_finished "git reset --hard && git checkout master" &&
1294 git checkout -b plain master &&
1297 git commit -m bar_commit &&
1298 git checkout -b tagged master &&
1301 git commit -m baz_commit &&
1302 git tag -s -m signed_tag_msg signed_tag &&
1303 git checkout plain &&
1304 git merge --no-ff -m msg signed_tag &&
1305 git log --graph --show-signature -n1 plain >actual &&
1306 grep "^|\\\ merged tag" actual &&
1307 grep "^| | gpg: Signature made" actual &&
1308 grep "^| | gpg: Good signature" actual
1311 test_expect_success GPG '--no-show-signature overrides --show-signature' '
1312 git log -1 --show-signature --no-show-signature signed >actual &&
1313 ! grep "^gpg:" actual
1316 test_expect_success GPG 'log.showsignature=true behaves like --show-signature' '
1317 test_config log.showsignature true &&
1318 git log -1 signed >actual &&
1319 grep "gpg: Signature made" actual &&
1320 grep "gpg: Good signature" actual
1323 test_expect_success GPG '--no-show-signature overrides log.showsignature=true' '
1324 test_config log.showsignature true &&
1325 git log -1 --no-show-signature signed >actual &&
1326 ! grep "^gpg:" actual
1329 test_expect_success GPG '--show-signature overrides log.showsignature=false' '
1330 test_config log.showsignature false &&
1331 git log -1 --show-signature signed >actual &&
1332 grep "gpg: Signature made" actual &&
1333 grep "gpg: Good signature" actual
1336 test_expect_success 'log --graph --no-walk is forbidden' '
1337 test_must_fail git log --graph --no-walk
1340 test_expect_success 'log diagnoses bogus HEAD' '
1342 test_must_fail git -C empty log 2>stderr &&
1343 test_i18ngrep does.not.have.any.commits stderr &&
1344 echo 1234abcd >empty/.git/refs/heads/master &&
1345 test_must_fail git -C empty log 2>stderr &&
1346 test_i18ngrep broken stderr &&
1347 echo "ref: refs/heads/invalid.lock" >empty/.git/HEAD &&
1348 test_must_fail git -C empty log 2>stderr &&
1349 test_i18ngrep broken stderr &&
1350 test_must_fail git -C empty log --default totally-bogus 2>stderr &&
1351 test_i18ngrep broken stderr
1354 test_expect_success 'set up --source tests' '
1355 git checkout --orphan source-a &&
1358 git checkout -b source-b HEAD^ &&
1362 test_expect_success 'log --source paints branch names' '
1363 cat >expect <<-\EOF &&
1364 09e12a9 source-b three
1365 8e393e1 source-a two
1366 1ac6c77 source-b one
1368 git log --oneline --source source-a source-b >actual &&
1369 test_cmp expect actual
1372 test_expect_success 'log --source paints tag names' '
1373 git tag -m tagged source-tag &&
1374 cat >expect <<-\EOF &&
1375 09e12a9 source-tag three
1376 8e393e1 source-a two
1377 1ac6c77 source-tag one
1379 git log --oneline --source source-tag source-a >actual &&
1380 test_cmp expect actual