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 'log.decorate config parsing' '
581 git log --oneline --decorate=full >expect.full &&
582 git log --oneline --decorate=short >expect.short &&
584 test_config log.decorate full &&
585 test_config log.mailmap true &&
586 git log --oneline >actual &&
587 test_cmp expect.full actual &&
588 git log --oneline --decorate=short >actual &&
589 test_cmp expect.short actual
592 test_expect_success TTY 'log output on a TTY' '
593 git log --oneline --decorate >expect.short &&
595 test_terminal git log --oneline >actual &&
596 test_cmp expect.short actual
599 test_expect_success 'reflog is expected format' '
600 git log -g --abbrev-commit --pretty=oneline >expect &&
601 git reflog >actual &&
602 test_cmp expect actual
605 test_expect_success 'whatchanged is expected format' '
606 git log --no-merges --raw >expect &&
607 git whatchanged >actual &&
608 test_cmp expect actual
611 test_expect_success 'log.abbrevCommit configuration' '
612 git log --abbrev-commit >expect.log.abbrev &&
613 git log --no-abbrev-commit >expect.log.full &&
614 git log --pretty=raw >expect.log.raw &&
615 git reflog --abbrev-commit >expect.reflog.abbrev &&
616 git reflog --no-abbrev-commit >expect.reflog.full &&
617 git whatchanged --abbrev-commit >expect.whatchanged.abbrev &&
618 git whatchanged --no-abbrev-commit >expect.whatchanged.full &&
620 test_config log.abbrevCommit true &&
623 test_cmp expect.log.abbrev actual &&
624 git log --no-abbrev-commit >actual &&
625 test_cmp expect.log.full actual &&
627 git log --pretty=raw >actual &&
628 test_cmp expect.log.raw actual &&
630 git reflog >actual &&
631 test_cmp expect.reflog.abbrev actual &&
632 git reflog --no-abbrev-commit >actual &&
633 test_cmp expect.reflog.full actual &&
635 git whatchanged >actual &&
636 test_cmp expect.whatchanged.abbrev actual &&
637 git whatchanged --no-abbrev-commit >actual &&
638 test_cmp expect.whatchanged.full actual
641 test_expect_success 'show added path under "--follow -M"' '
642 # This tests for a regression introduced in v1.7.2-rc0~103^2~2
643 test_create_repo regression &&
646 test_commit needs-another-commit &&
647 test_commit foo.bar &&
648 git log -M --follow -p foo.bar.t &&
649 git log -M --follow --stat foo.bar.t &&
650 git log -M --follow --name-only foo.bar.t
654 test_expect_success 'git log -c --follow' '
655 test_create_repo follow-c &&
658 test_commit initial file original &&
660 test_commit rename file2 original &&
661 git reset --hard initial &&
662 test_commit modify file foo &&
663 git merge -m merge rename &&
664 git log -c --follow file2
669 * commit COMMIT_OBJECT_NAME
670 |\ Merge: MERGE_PARENTS
671 | | Author: A U Thor <author@example.com>
673 | | Merge HEADS DESCRIPTION
675 | * commit COMMIT_OBJECT_NAME
676 | | Author: A U Thor <author@example.com>
681 | | 1 file changed, 1 insertion(+)
683 | | diff --git a/reach.t b/reach.t
684 | | new file mode 100644
685 | | index 0000000..10c9591
692 *-. \ commit COMMIT_OBJECT_NAME
693 |\ \ \ Merge: MERGE_PARENTS
694 | | | | Author: A U Thor <author@example.com>
696 | | | | Merge HEADS DESCRIPTION
698 | | * | commit COMMIT_OBJECT_NAME
699 | | |/ Author: A U Thor <author@example.com>
703 | | | octopus-b.t | 1 +
704 | | | 1 file changed, 1 insertion(+)
706 | | | diff --git a/octopus-b.t b/octopus-b.t
707 | | | new file mode 100644
708 | | | index 0000000..d5fcad0
710 | | | +++ b/octopus-b.t
714 | * | commit COMMIT_OBJECT_NAME
715 | |/ Author: A U Thor <author@example.com>
719 | | octopus-a.t | 1 +
720 | | 1 file changed, 1 insertion(+)
722 | | diff --git a/octopus-a.t b/octopus-a.t
723 | | new file mode 100644
724 | | index 0000000..11ee015
726 | | +++ b/octopus-a.t
730 * | commit COMMIT_OBJECT_NAME
731 |/ Author: A U Thor <author@example.com>
736 | 1 file changed, 1 insertion(+)
738 | diff --git a/seventh.t b/seventh.t
739 | new file mode 100644
740 | index 0000000..9744ffc
746 * commit COMMIT_OBJECT_NAME
747 |\ Merge: MERGE_PARENTS
748 | | Author: A U Thor <author@example.com>
750 | | Merge branch 'tangle'
752 | * commit COMMIT_OBJECT_NAME
753 | |\ Merge: MERGE_PARENTS
754 | | | Author: A U Thor <author@example.com>
756 | | | Merge branch 'side' (early part) into tangle
758 | * | commit COMMIT_OBJECT_NAME
759 | |\ \ Merge: MERGE_PARENTS
760 | | | | Author: A U Thor <author@example.com>
762 | | | | Merge branch 'master' (early part) into tangle
764 | * | | commit COMMIT_OBJECT_NAME
765 | | | | Author: A U Thor <author@example.com>
769 | | | | tangle-a | 1 +
770 | | | | 1 file changed, 1 insertion(+)
772 | | | | diff --git a/tangle-a b/tangle-a
773 | | | | new file mode 100644
774 | | | | index 0000000..7898192
775 | | | | --- /dev/null
776 | | | | +++ b/tangle-a
777 | | | | @@ -0,0 +1 @@
780 * | | | commit COMMIT_OBJECT_NAME
781 |\ \ \ \ Merge: MERGE_PARENTS
782 | | | | | Author: A U Thor <author@example.com>
784 | | | | | Merge branch 'side'
786 | * | | | commit COMMIT_OBJECT_NAME
787 | | |_|/ Author: A U Thor <author@example.com>
792 | | | | 1 file changed, 1 insertion(+)
794 | | | | diff --git a/2 b/2
795 | | | | new file mode 100644
796 | | | | index 0000000..0cfbf08
797 | | | | --- /dev/null
799 | | | | @@ -0,0 +1 @@
802 | * | | commit COMMIT_OBJECT_NAME
803 | | | | Author: A U Thor <author@example.com>
808 | | | | 1 file changed, 1 insertion(+)
810 | | | | diff --git a/1 b/1
811 | | | | new file mode 100644
812 | | | | index 0000000..d00491f
813 | | | | --- /dev/null
815 | | | | @@ -0,0 +1 @@
818 * | | | commit COMMIT_OBJECT_NAME
819 | | | | Author: A U Thor <author@example.com>
824 | | | | 1 file changed, 1 insertion(+)
826 | | | | diff --git a/one b/one
827 | | | | new file mode 100644
828 | | | | index 0000000..9a33383
829 | | | | --- /dev/null
831 | | | | @@ -0,0 +1 @@
834 * | | | commit COMMIT_OBJECT_NAME
835 | |_|/ Author: A U Thor <author@example.com>
840 | | | 1 file changed, 1 deletion(-)
842 | | | diff --git a/a/two b/a/two
843 | | | deleted file mode 100644
844 | | | index 9245af5..0000000
850 * | | commit COMMIT_OBJECT_NAME
851 | | | Author: A U Thor <author@example.com>
856 | | | 1 file changed, 1 insertion(+)
858 | | | diff --git a/a/two b/a/two
859 | | | new file mode 100644
860 | | | index 0000000..9245af5
866 * | | commit COMMIT_OBJECT_NAME
867 |/ / Author: A U Thor <author@example.com>
872 | | 1 file changed, 1 insertion(+)
874 | | diff --git a/ein b/ein
875 | | new file mode 100644
876 | | index 0000000..9d7e69f
882 * | commit COMMIT_OBJECT_NAME
883 |/ Author: A U Thor <author@example.com>
889 | 2 files changed, 1 insertion(+), 1 deletion(-)
891 | diff --git a/ichi b/ichi
892 | new file mode 100644
893 | index 0000000..9d7e69f
898 | diff --git a/one b/one
899 | deleted file mode 100644
900 | index 9d7e69f..0000000
906 * commit COMMIT_OBJECT_NAME
907 | Author: A U Thor <author@example.com>
912 | 1 file changed, 1 insertion(+), 1 deletion(-)
914 | diff --git a/one b/one
915 | index 5626abf..9d7e69f 100644
922 * commit COMMIT_OBJECT_NAME
923 Author: A U Thor <author@example.com>
928 1 file changed, 1 insertion(+)
930 diff --git a/one b/one
932 index 0000000..5626abf
941 -e 's/commit [0-9a-f]*$/commit COMMIT_OBJECT_NAME/' \
942 -e 's/Merge: [ 0-9a-f]*$/Merge: MERGE_PARENTS/' \
943 -e 's/Merge tag.*/Merge HEADS DESCRIPTION/' \
944 -e 's/Merge commit.*/Merge HEADS DESCRIPTION/' \
945 -e 's/, 0 deletions(-)//' \
946 -e 's/, 0 insertions(+)//' \
947 -e 's/ 1 files changed, / 1 file changed, /' \
948 -e 's/, 1 deletions(-)/, 1 deletion(-)/' \
949 -e 's/, 1 insertions(+)/, 1 insertion(+)/'
952 test_expect_success 'log --graph with diff and stats' '
953 git log --no-renames --graph --pretty=short --stat -p >actual &&
954 sanitize_output >actual.sanitized <actual &&
955 test_i18ncmp expect actual.sanitized
959 *** * commit COMMIT_OBJECT_NAME
960 *** |\ Merge: MERGE_PARENTS
961 *** | | Author: A U Thor <author@example.com>
963 *** | | Merge HEADS DESCRIPTION
965 *** | * commit COMMIT_OBJECT_NAME
966 *** | | Author: A U Thor <author@example.com>
970 *** | | reach.t | 1 +
971 *** | | 1 file changed, 1 insertion(+)
973 *** | | diff --git a/reach.t b/reach.t
974 *** | | new file mode 100644
975 *** | | index 0000000..10c9591
976 *** | | --- /dev/null
977 *** | | +++ b/reach.t
978 *** | | @@ -0,0 +1 @@
982 *** *-. \ commit COMMIT_OBJECT_NAME
983 *** |\ \ \ Merge: MERGE_PARENTS
984 *** | | | | Author: A U Thor <author@example.com>
986 *** | | | | Merge HEADS DESCRIPTION
988 *** | | * | commit COMMIT_OBJECT_NAME
989 *** | | |/ Author: A U Thor <author@example.com>
993 *** | | | octopus-b.t | 1 +
994 *** | | | 1 file changed, 1 insertion(+)
996 *** | | | diff --git a/octopus-b.t b/octopus-b.t
997 *** | | | new file mode 100644
998 *** | | | index 0000000..d5fcad0
999 *** | | | --- /dev/null
1000 *** | | | +++ b/octopus-b.t
1001 *** | | | @@ -0,0 +1 @@
1002 *** | | | +octopus-b
1004 *** | * | commit COMMIT_OBJECT_NAME
1005 *** | |/ Author: A U Thor <author@example.com>
1009 *** | | octopus-a.t | 1 +
1010 *** | | 1 file changed, 1 insertion(+)
1012 *** | | diff --git a/octopus-a.t b/octopus-a.t
1013 *** | | new file mode 100644
1014 *** | | index 0000000..11ee015
1015 *** | | --- /dev/null
1016 *** | | +++ b/octopus-a.t
1017 *** | | @@ -0,0 +1 @@
1020 *** * | commit COMMIT_OBJECT_NAME
1021 *** |/ Author: A U Thor <author@example.com>
1025 *** | seventh.t | 1 +
1026 *** | 1 file changed, 1 insertion(+)
1028 *** | diff --git a/seventh.t b/seventh.t
1029 *** | new file mode 100644
1030 *** | index 0000000..9744ffc
1032 *** | +++ b/seventh.t
1036 *** * commit COMMIT_OBJECT_NAME
1037 *** |\ Merge: MERGE_PARENTS
1038 *** | | Author: A U Thor <author@example.com>
1040 *** | | Merge branch 'tangle'
1042 *** | * commit COMMIT_OBJECT_NAME
1043 *** | |\ Merge: MERGE_PARENTS
1044 *** | | | Author: A U Thor <author@example.com>
1046 *** | | | Merge branch 'side' (early part) into tangle
1048 *** | * | commit COMMIT_OBJECT_NAME
1049 *** | |\ \ Merge: MERGE_PARENTS
1050 *** | | | | Author: A U Thor <author@example.com>
1052 *** | | | | Merge branch 'master' (early part) into tangle
1054 *** | * | | commit COMMIT_OBJECT_NAME
1055 *** | | | | Author: A U Thor <author@example.com>
1057 *** | | | | tangle-a
1059 *** | | | | tangle-a | 1 +
1060 *** | | | | 1 file changed, 1 insertion(+)
1062 *** | | | | diff --git a/tangle-a b/tangle-a
1063 *** | | | | new file mode 100644
1064 *** | | | | index 0000000..7898192
1065 *** | | | | --- /dev/null
1066 *** | | | | +++ b/tangle-a
1067 *** | | | | @@ -0,0 +1 @@
1070 *** * | | | commit COMMIT_OBJECT_NAME
1071 *** |\ \ \ \ Merge: MERGE_PARENTS
1072 *** | | | | | Author: A U Thor <author@example.com>
1074 *** | | | | | Merge branch 'side'
1076 *** | * | | | commit COMMIT_OBJECT_NAME
1077 *** | | |_|/ Author: A U Thor <author@example.com>
1082 *** | | | | 1 file changed, 1 insertion(+)
1084 *** | | | | diff --git a/2 b/2
1085 *** | | | | new file mode 100644
1086 *** | | | | index 0000000..0cfbf08
1087 *** | | | | --- /dev/null
1089 *** | | | | @@ -0,0 +1 @@
1092 *** | * | | commit COMMIT_OBJECT_NAME
1093 *** | | | | Author: A U Thor <author@example.com>
1098 *** | | | | 1 file changed, 1 insertion(+)
1100 *** | | | | diff --git a/1 b/1
1101 *** | | | | new file mode 100644
1102 *** | | | | index 0000000..d00491f
1103 *** | | | | --- /dev/null
1105 *** | | | | @@ -0,0 +1 @@
1108 *** * | | | commit COMMIT_OBJECT_NAME
1109 *** | | | | Author: A U Thor <author@example.com>
1113 *** | | | | one | 1 +
1114 *** | | | | 1 file changed, 1 insertion(+)
1116 *** | | | | diff --git a/one b/one
1117 *** | | | | new file mode 100644
1118 *** | | | | index 0000000..9a33383
1119 *** | | | | --- /dev/null
1120 *** | | | | +++ b/one
1121 *** | | | | @@ -0,0 +1 @@
1124 *** * | | | commit COMMIT_OBJECT_NAME
1125 *** | |_|/ Author: A U Thor <author@example.com>
1129 *** | | | a/two | 1 -
1130 *** | | | 1 file changed, 1 deletion(-)
1132 *** | | | diff --git a/a/two b/a/two
1133 *** | | | deleted file mode 100644
1134 *** | | | index 9245af5..0000000
1135 *** | | | --- a/a/two
1136 *** | | | +++ /dev/null
1137 *** | | | @@ -1 +0,0 @@
1140 *** * | | commit COMMIT_OBJECT_NAME
1141 *** | | | Author: A U Thor <author@example.com>
1145 *** | | | a/two | 1 +
1146 *** | | | 1 file changed, 1 insertion(+)
1148 *** | | | diff --git a/a/two b/a/two
1149 *** | | | new file mode 100644
1150 *** | | | index 0000000..9245af5
1151 *** | | | --- /dev/null
1152 *** | | | +++ b/a/two
1153 *** | | | @@ -0,0 +1 @@
1156 *** * | | commit COMMIT_OBJECT_NAME
1157 *** |/ / Author: A U Thor <author@example.com>
1162 *** | | 1 file changed, 1 insertion(+)
1164 *** | | diff --git a/ein b/ein
1165 *** | | new file mode 100644
1166 *** | | index 0000000..9d7e69f
1167 *** | | --- /dev/null
1169 *** | | @@ -0,0 +1 @@
1172 *** * | commit COMMIT_OBJECT_NAME
1173 *** |/ Author: A U Thor <author@example.com>
1179 *** | 2 files changed, 1 insertion(+), 1 deletion(-)
1181 *** | diff --git a/ichi b/ichi
1182 *** | new file mode 100644
1183 *** | index 0000000..9d7e69f
1188 *** | diff --git a/one b/one
1189 *** | deleted file mode 100644
1190 *** | index 9d7e69f..0000000
1196 *** * commit COMMIT_OBJECT_NAME
1197 *** | Author: A U Thor <author@example.com>
1202 *** | 1 file changed, 1 insertion(+), 1 deletion(-)
1204 *** | diff --git a/one b/one
1205 *** | index 5626abf..9d7e69f 100644
1212 *** * commit COMMIT_OBJECT_NAME
1213 *** Author: A U Thor <author@example.com>
1218 *** 1 file changed, 1 insertion(+)
1220 *** diff --git a/one b/one
1221 *** new file mode 100644
1222 *** index 0000000..5626abf
1229 test_expect_success 'log --line-prefix="*** " --graph with diff and stats' '
1230 git log --line-prefix="*** " --no-renames --graph --pretty=short --stat -p >actual &&
1231 sanitize_output >actual.sanitized <actual &&
1232 test_i18ncmp expect actual.sanitized
1239 * Merge branch 'tangle'
1240 * Merge branch 'side'
1253 test_expect_success 'log --graph with --name-status' '
1254 git log --graph --format=%s --name-status tangle..reach >actual &&
1255 sanitize_output <actual >actual.sanitized &&
1256 test_cmp expect actual.sanitized
1263 * Merge branch 'tangle'
1264 * Merge branch 'side'
1277 test_expect_success 'log --graph with --name-only' '
1278 git log --graph --format=%s --name-only tangle..reach >actual &&
1279 sanitize_output <actual >actual.sanitized &&
1280 test_cmp expect actual.sanitized
1283 test_expect_success 'dotdot is a parent directory' '
1285 ( echo sixth && echo fifth ) >expect &&
1286 ( cd a/b && git log --format=%s .. ) >actual &&
1287 test_cmp expect actual
1290 test_expect_success GPG 'setup signed branch' '
1291 test_when_finished "git reset --hard && git checkout master" &&
1292 git checkout -b signed master &&
1295 git commit -S -m signed_commit
1298 test_expect_success GPG 'log --graph --show-signature' '
1299 git log --graph --show-signature -n1 signed >actual &&
1300 grep "^| gpg: Signature made" actual &&
1301 grep "^| gpg: Good signature" actual
1304 test_expect_success GPG 'log --graph --show-signature for merged tag' '
1305 test_when_finished "git reset --hard && git checkout master" &&
1306 git checkout -b plain master &&
1309 git commit -m bar_commit &&
1310 git checkout -b tagged master &&
1313 git commit -m baz_commit &&
1314 git tag -s -m signed_tag_msg signed_tag &&
1315 git checkout plain &&
1316 git merge --no-ff -m msg signed_tag &&
1317 git log --graph --show-signature -n1 plain >actual &&
1318 grep "^|\\\ merged tag" actual &&
1319 grep "^| | gpg: Signature made" actual &&
1320 grep "^| | gpg: Good signature" actual
1323 test_expect_success GPG '--no-show-signature overrides --show-signature' '
1324 git log -1 --show-signature --no-show-signature signed >actual &&
1325 ! grep "^gpg:" actual
1328 test_expect_success GPG 'log.showsignature=true behaves like --show-signature' '
1329 test_config log.showsignature true &&
1330 git log -1 signed >actual &&
1331 grep "gpg: Signature made" actual &&
1332 grep "gpg: Good signature" actual
1335 test_expect_success GPG '--no-show-signature overrides log.showsignature=true' '
1336 test_config log.showsignature true &&
1337 git log -1 --no-show-signature signed >actual &&
1338 ! grep "^gpg:" actual
1341 test_expect_success GPG '--show-signature overrides log.showsignature=false' '
1342 test_config log.showsignature false &&
1343 git log -1 --show-signature signed >actual &&
1344 grep "gpg: Signature made" actual &&
1345 grep "gpg: Good signature" actual
1348 test_expect_success 'log --graph --no-walk is forbidden' '
1349 test_must_fail git log --graph --no-walk
1352 test_expect_success 'log diagnoses bogus HEAD' '
1354 test_must_fail git -C empty log 2>stderr &&
1355 test_i18ngrep does.not.have.any.commits stderr &&
1356 echo 1234abcd >empty/.git/refs/heads/master &&
1357 test_must_fail git -C empty log 2>stderr &&
1358 test_i18ngrep broken stderr &&
1359 echo "ref: refs/heads/invalid.lock" >empty/.git/HEAD &&
1360 test_must_fail git -C empty log 2>stderr &&
1361 test_i18ngrep broken stderr &&
1362 test_must_fail git -C empty log --default totally-bogus 2>stderr &&
1363 test_i18ngrep broken stderr
1366 test_expect_success 'set up --source tests' '
1367 git checkout --orphan source-a &&
1370 git checkout -b source-b HEAD^ &&
1374 test_expect_success 'log --source paints branch names' '
1375 cat >expect <<-\EOF &&
1376 09e12a9 source-b three
1377 8e393e1 source-a two
1378 1ac6c77 source-b one
1380 git log --oneline --source source-a source-b >actual &&
1381 test_cmp expect actual
1384 test_expect_success 'log --source paints tag names' '
1385 git tag -m tagged source-tag &&
1386 cat >expect <<-\EOF &&
1387 09e12a9 source-tag three
1388 8e393e1 source-a two
1389 1ac6c77 source-tag one
1391 git log --oneline --source source-tag source-a >actual &&
1392 test_cmp expect actual