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' '
235 git -c grep.patternType=fixed log --pretty="tformat:%s" --invert-grep --grep=th --grep=Sec >actual &&
236 test_cmp expect actual &&
239 git -c grep.patternType=basic log --pretty="tformat:%s" --invert-grep --grep=t[h] --grep=S[e]c >actual &&
240 test_cmp expect actual &&
243 git -c grep.patternType=basic log --pretty="tformat:%s" --invert-grep --grep=t[h] --grep=S[e]c >actual &&
244 test_cmp expect actual &&
247 if test_have_prereq PCRE
249 git -c grep.patternType=perl log --pretty="tformat:%s" --invert-grep --grep=t[h] --grep=S[e]c >actual &&
250 test_cmp expect actual
254 test_expect_success
'log --invert-grep --grep -i' '
255 echo initial >expect &&
258 git -c grep.patternType=fixed log --pretty="tformat:%s" --invert-grep -i --grep=th --grep=Sec >actual &&
259 test_cmp expect actual &&
262 git -c grep.patternType=basic log --pretty="tformat:%s" --invert-grep -i --grep=t[h] --grep=S[e]c >actual &&
263 test_cmp expect actual &&
266 git -c grep.patternType=extended log --pretty="tformat:%s" --invert-grep -i --grep=t[h] --grep=S[e]c >actual &&
267 test_cmp expect actual &&
270 if test_have_prereq PCRE
272 git -c grep.patternType=perl log --pretty="tformat:%s" --invert-grep -i --grep=t[h] --grep=S[e]c >actual &&
273 test_cmp expect actual
277 test_expect_success
'log --grep option parsing' '
278 echo second >expect &&
279 git log -1 --pretty="tformat:%s" --grep sec >actual &&
280 test_cmp expect actual &&
281 test_must_fail git log -1 --pretty="tformat:%s" --grep
284 test_expect_success
'log -i --grep' '
285 echo Second >expect &&
286 git log -1 --pretty="tformat:%s" -i --grep=sec >actual &&
287 test_cmp expect actual
290 test_expect_success
'log --grep -i' '
291 echo Second >expect &&
294 git log -1 --pretty="tformat:%s" --grep=sec -i >actual &&
295 test_cmp expect actual &&
298 git -c grep.patternType=basic log -1 --pretty="tformat:%s" --grep=s[e]c -i >actual &&
299 test_cmp expect actual &&
302 git -c grep.patternType=extended log -1 --pretty="tformat:%s" --grep=s[e]c -i >actual &&
303 test_cmp expect actual &&
306 if test_have_prereq PCRE
308 git -c grep.patternType=perl log -1 --pretty="tformat:%s" --grep=s[e]c -i >actual &&
309 test_cmp expect actual
313 test_expect_success
'log -F -E --grep=<ere> uses ere' '
314 echo second >expect &&
315 # basic would need \(s\) to do the same
316 git log -1 --pretty="tformat:%s" -F -E --grep="(s).c.nd" >actual &&
317 test_cmp expect actual
320 test_expect_success PCRE
'log -F -E --perl-regexp --grep=<pcre> uses PCRE' '
321 test_when_finished "rm -rf num_commits" &&
322 git init num_commits &&
329 # In PCRE \d in [\d] is like saying "0-9", and matches the 2
332 git -C num_commits log -1 --pretty="tformat:%s" -F -E --perl-regexp --grep="[\d]" >actual &&
333 test_cmp expect actual &&
335 # ...in POSIX basic and extended it is the same as [d],
336 # i.e. "d", which matches 1d, but does not match 2e.
338 git -C num_commits log -1 --pretty="tformat:%s" -F -E --grep="[\d]" >actual &&
339 test_cmp expect actual
342 test_expect_success
'log with grep.patternType configuration' '
343 git -c grep.patterntype=fixed \
344 log -1 --pretty=tformat:%s --grep=s.c.nd >actual &&
345 test_must_be_empty actual
348 test_expect_success
'log with grep.patternType configuration and command line' '
349 echo second >expect &&
350 git -c grep.patterntype=fixed \
351 log -1 --pretty=tformat:%s --basic-regexp --grep=s.c.nd >actual &&
352 test_cmp expect actual
355 test_expect_success
!FAIL_PREREQS
'log with various grep.patternType configurations & command-lines' '
356 git init pattern-type &&
359 test_commit 1 file A &&
361 # The tagname is overridden here because creating a
362 # tag called "(1|2)" as test_commit would otherwise
363 # implicitly do would fail on e.g. MINGW.
364 test_commit "(1|2)" file B 2 &&
366 echo "(1|2)" >expect.fixed &&
367 cp expect.fixed expect.basic &&
368 cp expect.fixed expect.extended &&
369 cp expect.fixed expect.perl &&
371 # A strcmp-like match with fixed.
372 git -c grep.patternType=fixed log --pretty=tformat:%s \
373 --grep="(1|2)" >actual.fixed &&
375 # POSIX basic matches (, | and ) literally.
376 git -c grep.patternType=basic log --pretty=tformat:%s \
377 --grep="(.|.)" >actual.basic &&
379 # POSIX extended needs to have | escaped to match it
380 # literally, whereas under basic this is the same as
381 # (|2), i.e. it would also match "1". This test checks
382 # for extended by asserting that it is not matching
383 # what basic would match.
384 git -c grep.patternType=extended log --pretty=tformat:%s \
385 --grep="\|2" >actual.extended &&
386 if test_have_prereq PCRE
388 # Only PCRE would match [\d]\| with only
389 # "(1|2)" due to [\d]. POSIX basic would match
390 # both it and "1" since similarly to the
391 # extended match above it is the same as
392 # \([\d]\|\). POSIX extended would
394 git -c grep.patternType=perl log --pretty=tformat:%s \
395 --grep="[\d]\|" >actual.perl &&
396 test_cmp expect.perl actual.perl
398 test_cmp expect.fixed actual.fixed &&
399 test_cmp expect.basic actual.basic &&
400 test_cmp expect.extended actual.extended &&
402 git log --pretty=tformat:%s -F \
403 --grep="(1|2)" >actual.fixed.short-arg &&
404 git log --pretty=tformat:%s -E \
405 --grep="\|2" >actual.extended.short-arg &&
406 if test_have_prereq PCRE
408 git log --pretty=tformat:%s -P \
409 --grep="[\d]\|" >actual.perl.short-arg
411 test_must_fail git log -P \
414 test_cmp expect.fixed actual.fixed.short-arg &&
415 test_cmp expect.extended actual.extended.short-arg &&
416 if test_have_prereq PCRE
418 test_cmp expect.perl actual.perl.short-arg
421 git log --pretty=tformat:%s --fixed-strings \
422 --grep="(1|2)" >actual.fixed.long-arg &&
423 git log --pretty=tformat:%s --basic-regexp \
424 --grep="(.|.)" >actual.basic.long-arg &&
425 git log --pretty=tformat:%s --extended-regexp \
426 --grep="\|2" >actual.extended.long-arg &&
427 if test_have_prereq PCRE
429 git log --pretty=tformat:%s --perl-regexp \
430 --grep="[\d]\|" >actual.perl.long-arg &&
431 test_cmp expect.perl actual.perl.long-arg
433 test_must_fail git log --perl-regexp \
436 test_cmp expect.fixed actual.fixed.long-arg &&
437 test_cmp expect.basic actual.basic.long-arg &&
438 test_cmp expect.extended actual.extended.long-arg
452 test_expect_success
'simple log --graph' '
453 git log --graph --pretty=tformat:%s >actual &&
454 test_cmp expect actual
467 test_expect_success
'simple log --graph --line-prefix="123 "' '
468 git log --graph --line-prefix="123 " --pretty=tformat:%s >actual &&
469 test_cmp expect actual
472 test_expect_success
'set up merge history' '
473 git checkout -b side HEAD~4 &&
474 test_commit side-1 1 1 &&
475 test_commit side-2 2 2 &&
476 git checkout master &&
481 * Merge branch
'side'
495 test_expect_success
'log --graph with merge' '
496 git log --graph --date-order --pretty=tformat:%s |
497 sed "s/ *\$//" >actual &&
498 test_cmp expect actual
502 | | |
* Merge branch
'side'
516 test_expect_success
'log --graph --line-prefix="| | | " with merge' '
517 git log --line-prefix="| | | " --graph --date-order --pretty=tformat:%s |
518 sed "s/ *\$//" >actual &&
519 test_cmp expect actual
522 cat > expect.colors
<<\EOF
523 * Merge branch
'side'
524 <BLUE
>|
<RESET
><CYAN
>\
<RESET
>
525 <BLUE
>|
<RESET
> * side-2
526 <BLUE
>|
<RESET
> * side-1
527 * <CYAN
>|
<RESET
> Second
528 * <CYAN
>|
<RESET
> sixth
529 * <CYAN
>|
<RESET
> fifth
530 * <CYAN
>|
<RESET
> fourth
531 <CYAN
>|
<RESET
><CYAN
>/<RESET
>
537 test_expect_success
'log --graph with merge with log.graphColors' '
538 test_config log.graphColors " blue,invalid-color, cyan, red , " &&
539 git log --color=always --graph --date-order --pretty=tformat:%s |
540 test_decode_color | sed "s/ *\$//" >actual &&
541 test_cmp expect.colors actual
544 test_expect_success
'log --raw --graph -m with merge' '
545 git log --raw --graph --oneline -m master | head -n 500 >actual &&
546 grep "initial" actual
549 test_expect_success
'diff-tree --graph' '
550 git diff-tree --graph master^ | head -n 500 >actual &&
557 | | Author
: A U Thor
<author@example.com
>
559 | | Merge branch
'side'
561 |
* commit tags
/side-2
562 | | Author
: A U Thor
<author@example.com
>
566 |
* commit tags
/side-1
567 | | Author
: A U Thor
<author@example.com
>
572 | | Author
: A U Thor
<author@example.com
>
577 | | Author
: A U Thor
<author@example.com
>
582 | | Author
: A U Thor
<author@example.com
>
587 |
/ Author
: A U Thor
<author@example.com
>
591 * commit tags
/side-1~
1
592 | Author
: A U Thor
<author@example.com
>
596 * commit tags
/side-1~
2
597 | Author
: A U Thor
<author@example.com
>
601 * commit tags
/side-1~
3
602 Author
: A U Thor
<author@example.com
>
607 test_expect_success
'log --graph with full output' '
608 git log --graph --date-order --pretty=short |
609 git name-rev --name-only --stdin |
610 sed "s/Merge:.*/Merge: A B/;s/ *\$//" >actual &&
611 test_cmp expect actual
614 test_expect_success
'set up more tangled history' '
615 git checkout -b tangle HEAD~6 &&
616 test_commit tangle-a tangle-a a &&
617 git merge master~3 &&
619 git checkout master &&
621 git checkout -b reach &&
623 git checkout master &&
624 git checkout -b octopus-a &&
625 test_commit octopus-a &&
626 git checkout master &&
627 git checkout -b octopus-b &&
628 test_commit octopus-b &&
629 git checkout master &&
630 test_commit seventh &&
631 git merge octopus-a octopus-b &&
640 *-. \ Merge tags
'octopus-a' and
'octopus-b'
650 * Merge branch
'tangle'
652 |
* Merge branch
'side' (early part
) into tangle
654 |
* \ Merge branch
'master' (early part
) into tangle
657 * | | | Merge branch
'side'
676 test_expect_success
'log --graph with merge' '
677 git log --graph --date-order --pretty=tformat:%s |
678 sed "s/ *\$//" >actual &&
679 test_cmp expect actual
682 test_expect_success
'log.decorate configuration' '
683 git log --oneline --no-decorate >expect.none &&
684 git log --oneline --decorate >expect.short &&
685 git log --oneline --decorate=full >expect.full &&
687 echo "[log] decorate" >>.git/config &&
688 git log --oneline >actual &&
689 test_cmp expect.short actual &&
691 test_config log.decorate true &&
692 git log --oneline >actual &&
693 test_cmp expect.short actual &&
694 git log --oneline --decorate=full >actual &&
695 test_cmp expect.full actual &&
696 git log --oneline --decorate=no >actual &&
697 test_cmp expect.none actual &&
699 test_config log.decorate no &&
700 git log --oneline >actual &&
701 test_cmp expect.none actual &&
702 git log --oneline --decorate >actual &&
703 test_cmp expect.short actual &&
704 git log --oneline --decorate=full >actual &&
705 test_cmp expect.full actual &&
707 test_config log.decorate 1 &&
708 git log --oneline >actual &&
709 test_cmp expect.short actual &&
710 git log --oneline --decorate=full >actual &&
711 test_cmp expect.full actual &&
712 git log --oneline --decorate=no >actual &&
713 test_cmp expect.none actual &&
715 test_config log.decorate short &&
716 git log --oneline >actual &&
717 test_cmp expect.short actual &&
718 git log --oneline --no-decorate >actual &&
719 test_cmp expect.none actual &&
720 git log --oneline --decorate=full >actual &&
721 test_cmp expect.full actual &&
723 test_config log.decorate full &&
724 git log --oneline >actual &&
725 test_cmp expect.full actual &&
726 git log --oneline --no-decorate >actual &&
727 test_cmp expect.none actual &&
728 git log --oneline --decorate >actual &&
729 test_cmp expect.short actual &&
731 test_unconfig log.decorate &&
732 git log --pretty=raw >expect.raw &&
733 test_config log.decorate full &&
734 git log --pretty=raw >actual &&
735 test_cmp expect.raw actual
739 test_expect_success
'decorate-refs with glob' '
740 cat >expect.decorate <<-\EOF &&
742 Merge-tags-octopus-a-and-octopus-b
744 octopus-b (octopus-b)
745 octopus-a (octopus-a)
748 git log -n6 --decorate=short --pretty="tformat:%f%d" \
749 --decorate-refs="heads/octopus*" >actual &&
750 test_cmp expect.decorate actual
753 test_expect_success
'decorate-refs without globs' '
754 cat >expect.decorate <<-\EOF &&
756 Merge-tags-octopus-a-and-octopus-b
762 git log -n6 --decorate=short --pretty="tformat:%f%d" \
763 --decorate-refs="tags/reach" >actual &&
764 test_cmp expect.decorate actual
767 test_expect_success
'multiple decorate-refs' '
768 cat >expect.decorate <<-\EOF &&
770 Merge-tags-octopus-a-and-octopus-b
772 octopus-b (octopus-b)
773 octopus-a (octopus-a)
776 git log -n6 --decorate=short --pretty="tformat:%f%d" \
777 --decorate-refs="heads/octopus*" \
778 --decorate-refs="tags/reach" >actual &&
779 test_cmp expect.decorate actual
782 test_expect_success
'decorate-refs-exclude with glob' '
783 cat >expect.decorate <<-\EOF &&
784 Merge-tag-reach (HEAD -> master)
785 Merge-tags-octopus-a-and-octopus-b
786 seventh (tag: seventh)
787 octopus-b (tag: octopus-b)
788 octopus-a (tag: octopus-a)
789 reach (tag: reach, reach)
791 git log -n6 --decorate=short --pretty="tformat:%f%d" \
792 --decorate-refs-exclude="heads/octopus*" >actual &&
793 test_cmp expect.decorate actual
796 test_expect_success
'decorate-refs-exclude without globs' '
797 cat >expect.decorate <<-\EOF &&
798 Merge-tag-reach (HEAD -> master)
799 Merge-tags-octopus-a-and-octopus-b
800 seventh (tag: seventh)
801 octopus-b (tag: octopus-b, octopus-b)
802 octopus-a (tag: octopus-a, octopus-a)
805 git log -n6 --decorate=short --pretty="tformat:%f%d" \
806 --decorate-refs-exclude="tags/reach" >actual &&
807 test_cmp expect.decorate actual
810 test_expect_success
'multiple decorate-refs-exclude' '
811 cat >expect.decorate <<-\EOF &&
812 Merge-tag-reach (HEAD -> master)
813 Merge-tags-octopus-a-and-octopus-b
814 seventh (tag: seventh)
815 octopus-b (tag: octopus-b)
816 octopus-a (tag: octopus-a)
819 git log -n6 --decorate=short --pretty="tformat:%f%d" \
820 --decorate-refs-exclude="heads/octopus*" \
821 --decorate-refs-exclude="tags/reach" >actual &&
822 test_cmp expect.decorate actual
825 test_expect_success
'decorate-refs and decorate-refs-exclude' '
826 cat >expect.decorate <<-\EOF &&
827 Merge-tag-reach (master)
828 Merge-tags-octopus-a-and-octopus-b
834 git log -n6 --decorate=short --pretty="tformat:%f%d" \
835 --decorate-refs="heads/*" \
836 --decorate-refs-exclude="heads/oc*" >actual &&
837 test_cmp expect.decorate actual
840 test_expect_success
'decorate-refs-exclude and simplify-by-decoration' '
841 cat >expect.decorate <<-\EOF &&
842 Merge-tag-reach (HEAD -> master)
843 reach (tag: reach, reach)
844 seventh (tag: seventh)
846 Merge-branch-side-early-part-into-tangle (tangle)
847 tangle-a (tag: tangle-a)
849 git log -n6 --decorate=short --pretty="tformat:%f%d" \
850 --decorate-refs-exclude="*octopus*" \
851 --simplify-by-decoration >actual &&
852 test_cmp expect.decorate actual
855 test_expect_success
'log.decorate config parsing' '
856 git log --oneline --decorate=full >expect.full &&
857 git log --oneline --decorate=short >expect.short &&
859 test_config log.decorate full &&
860 test_config log.mailmap true &&
861 git log --oneline >actual &&
862 test_cmp expect.full actual &&
863 git log --oneline --decorate=short >actual &&
864 test_cmp expect.short actual
867 test_expect_success TTY
'log output on a TTY' '
868 git log --color --oneline --decorate >expect.short &&
870 test_terminal git log --oneline >actual &&
871 test_cmp expect.short actual
874 test_expect_success
'reflog is expected format' '
875 git log -g --abbrev-commit --pretty=oneline >expect &&
876 git reflog >actual &&
877 test_cmp expect actual
880 test_expect_success
'whatchanged is expected format' '
881 git log --no-merges --raw >expect &&
882 git whatchanged >actual &&
883 test_cmp expect actual
886 test_expect_success
'log.abbrevCommit configuration' '
887 git log --abbrev-commit >expect.log.abbrev &&
888 git log --no-abbrev-commit >expect.log.full &&
889 git log --pretty=raw >expect.log.raw &&
890 git reflog --abbrev-commit >expect.reflog.abbrev &&
891 git reflog --no-abbrev-commit >expect.reflog.full &&
892 git whatchanged --abbrev-commit >expect.whatchanged.abbrev &&
893 git whatchanged --no-abbrev-commit >expect.whatchanged.full &&
895 test_config log.abbrevCommit true &&
898 test_cmp expect.log.abbrev actual &&
899 git log --no-abbrev-commit >actual &&
900 test_cmp expect.log.full actual &&
902 git log --pretty=raw >actual &&
903 test_cmp expect.log.raw actual &&
905 git reflog >actual &&
906 test_cmp expect.reflog.abbrev actual &&
907 git reflog --no-abbrev-commit >actual &&
908 test_cmp expect.reflog.full actual &&
910 git whatchanged >actual &&
911 test_cmp expect.whatchanged.abbrev actual &&
912 git whatchanged --no-abbrev-commit >actual &&
913 test_cmp expect.whatchanged.full actual
916 test_expect_success
'show added path under "--follow -M"' '
917 # This tests for a regression introduced in v1.7.2-rc0~103^2~2
918 test_create_repo regression &&
921 test_commit needs-another-commit &&
922 test_commit foo.bar &&
923 git log -M --follow -p foo.bar.t &&
924 git log -M --follow --stat foo.bar.t &&
925 git log -M --follow --name-only foo.bar.t
929 test_expect_success
'git log -c --follow' '
930 test_create_repo follow-c &&
933 test_commit initial file original &&
935 test_commit rename file2 original &&
936 git reset --hard initial &&
937 test_commit modify file foo &&
938 git merge -m merge rename &&
939 git log -c --follow file2
944 * commit COMMIT_OBJECT_NAME
945 |\ Merge
: MERGE_PARENTS
946 | | Author
: A U Thor
<author@example.com
>
948 | | Merge HEADS DESCRIPTION
950 |
* commit COMMIT_OBJECT_NAME
951 | | Author
: A U Thor
<author@example.com
>
956 | |
1 file changed
, 1 insertion
(+)
958 | |
diff --git a
/reach.t b
/reach.t
959 | | new
file mode
100644
960 | | index
0000000.
.10c9591
967 *-. \ commit COMMIT_OBJECT_NAME
968 |\ \ \ Merge
: MERGE_PARENTS
969 | | | | Author
: A U Thor
<author@example.com
>
971 | | | | Merge HEADS DESCRIPTION
973 | |
* | commit COMMIT_OBJECT_NAME
974 | | |
/ Author
: A U Thor
<author@example.com
>
978 | | | octopus-b.t |
1 +
979 | | |
1 file changed
, 1 insertion
(+)
981 | | |
diff --git a
/octopus-b.t b
/octopus-b.t
982 | | | new
file mode
100644
983 | | | index
0000000..d5fcad0
985 | | |
+++ b
/octopus-b.t
989 |
* | commit COMMIT_OBJECT_NAME
990 | |
/ Author
: A U Thor
<author@example.com
>
994 | | octopus-a.t |
1 +
995 | |
1 file changed
, 1 insertion
(+)
997 | |
diff --git a
/octopus-a.t b
/octopus-a.t
998 | | new
file mode
100644
999 | | index
0000000.
.11ee015
1001 | |
+++ b
/octopus-a.t
1005 * | commit COMMIT_OBJECT_NAME
1006 |
/ Author
: A U Thor
<author@example.com
>
1011 |
1 file changed
, 1 insertion
(+)
1013 |
diff --git a
/seventh.t b
/seventh.t
1014 | new
file mode
100644
1015 | index
0000000.
.9744ffc
1021 * commit COMMIT_OBJECT_NAME
1022 |\ Merge
: MERGE_PARENTS
1023 | | Author
: A U Thor
<author@example.com
>
1025 | | Merge branch
'tangle'
1027 |
* commit COMMIT_OBJECT_NAME
1028 | |\ Merge
: MERGE_PARENTS
1029 | | | Author
: A U Thor
<author@example.com
>
1031 | | | Merge branch
'side' (early part
) into tangle
1033 |
* | commit COMMIT_OBJECT_NAME
1034 | |\ \ Merge
: MERGE_PARENTS
1035 | | | | Author
: A U Thor
<author@example.com
>
1037 | | | | Merge branch
'master' (early part
) into tangle
1039 |
* | | commit COMMIT_OBJECT_NAME
1040 | | | | Author
: A U Thor
<author@example.com
>
1044 | | | | tangle-a |
1 +
1045 | | | |
1 file changed
, 1 insertion
(+)
1047 | | | |
diff --git a
/tangle-a b
/tangle-a
1048 | | | | new
file mode
100644
1049 | | | | index
0000000.
.7898192
1050 | | | |
--- /dev
/null
1051 | | | |
+++ b
/tangle-a
1052 | | | | @@
-0,0 +1 @@
1055 * | | | commit COMMIT_OBJECT_NAME
1056 |\ \ \ \ Merge
: MERGE_PARENTS
1057 | | | | | Author
: A U Thor
<author@example.com
>
1059 | | | | | Merge branch
'side'
1061 |
* | | | commit COMMIT_OBJECT_NAME
1062 | | |_|
/ Author
: A U Thor
<author@example.com
>
1067 | | | |
1 file changed
, 1 insertion
(+)
1069 | | | |
diff --git a
/2 b
/2
1070 | | | | new
file mode
100644
1071 | | | | index
0000000.
.0cfbf08
1072 | | | |
--- /dev
/null
1074 | | | | @@
-0,0 +1 @@
1077 |
* | | commit COMMIT_OBJECT_NAME
1078 | | | | Author
: A U Thor
<author@example.com
>
1083 | | | |
1 file changed
, 1 insertion
(+)
1085 | | | |
diff --git a
/1 b
/1
1086 | | | | new
file mode
100644
1087 | | | | index
0000000..d00491f
1088 | | | |
--- /dev
/null
1090 | | | | @@
-0,0 +1 @@
1093 * | | | commit COMMIT_OBJECT_NAME
1094 | | | | Author
: A U Thor
<author@example.com
>
1099 | | | |
1 file changed
, 1 insertion
(+)
1101 | | | |
diff --git a
/one b
/one
1102 | | | | new
file mode
100644
1103 | | | | index
0000000.
.9a33383
1104 | | | |
--- /dev
/null
1106 | | | | @@
-0,0 +1 @@
1109 * | | | commit COMMIT_OBJECT_NAME
1110 | |_|
/ Author
: A U Thor
<author@example.com
>
1115 | | |
1 file changed
, 1 deletion
(-)
1117 | | |
diff --git a
/a
/two b
/a
/two
1118 | | | deleted
file mode
100644
1119 | | | index
9245af5.
.0000000
1125 * | | commit COMMIT_OBJECT_NAME
1126 | | | Author
: A U Thor
<author@example.com
>
1131 | | |
1 file changed
, 1 insertion
(+)
1133 | | |
diff --git a
/a
/two b
/a
/two
1134 | | | new
file mode
100644
1135 | | | index
0000000.
.9245af5
1141 * | | commit COMMIT_OBJECT_NAME
1142 |
/ / Author
: A U Thor
<author@example.com
>
1147 | |
1 file changed
, 1 insertion
(+)
1149 | |
diff --git a
/ein b
/ein
1150 | | new
file mode
100644
1151 | | index
0000000.
.9d7e69f
1157 * | commit COMMIT_OBJECT_NAME
1158 |
/ Author
: A U Thor
<author@example.com
>
1164 |
2 files changed
, 1 insertion
(+), 1 deletion
(-)
1166 |
diff --git a
/ichi b
/ichi
1167 | new
file mode
100644
1168 | index
0000000.
.9d7e69f
1173 |
diff --git a
/one b
/one
1174 | deleted
file mode
100644
1175 | index
9d7e69f.
.0000000
1181 * commit COMMIT_OBJECT_NAME
1182 | Author
: A U Thor
<author@example.com
>
1187 |
1 file changed
, 1 insertion
(+), 1 deletion
(-)
1189 |
diff --git a
/one b
/one
1190 | index
5626abf.
.9d7e69f
100644
1197 * commit COMMIT_OBJECT_NAME
1198 Author
: A U Thor
<author@example.com
>
1203 1 file changed
, 1 insertion
(+)
1205 diff --git a
/one b
/one
1206 new
file mode
100644
1207 index
0000000.
.5626abf
1214 sanitize_output
() {
1216 -e 's/commit [0-9a-f]*$/commit COMMIT_OBJECT_NAME/' \
1217 -e 's/Merge: [ 0-9a-f]*$/Merge: MERGE_PARENTS/' \
1218 -e 's/Merge tag.*/Merge HEADS DESCRIPTION/' \
1219 -e 's/Merge commit.*/Merge HEADS DESCRIPTION/' \
1220 -e 's/, 0 deletions(-)//' \
1221 -e 's/, 0 insertions(+)//' \
1222 -e 's/ 1 files changed, / 1 file changed, /' \
1223 -e 's/, 1 deletions(-)/, 1 deletion(-)/' \
1224 -e 's/, 1 insertions(+)/, 1 insertion(+)/'
1227 test_expect_success
'log --graph with diff and stats' '
1228 git log --no-renames --graph --pretty=short --stat -p >actual &&
1229 sanitize_output >actual.sanitized <actual &&
1230 test_i18ncmp expect actual.sanitized
1234 *** * commit COMMIT_OBJECT_NAME
1235 *** |\ Merge
: MERGE_PARENTS
1236 *** | | Author
: A U Thor
<author@example.com
>
1238 *** | | Merge HEADS DESCRIPTION
1240 *** |
* commit COMMIT_OBJECT_NAME
1241 *** | | Author
: A U Thor
<author@example.com
>
1245 *** | | reach.t |
1 +
1246 *** | |
1 file changed
, 1 insertion
(+)
1248 *** | |
diff --git a
/reach.t b
/reach.t
1249 *** | | new
file mode
100644
1250 *** | | index
0000000.
.10c9591
1251 *** | |
--- /dev
/null
1252 *** | |
+++ b
/reach.t
1253 *** | | @@
-0,0 +1 @@
1257 *** *-. \ commit COMMIT_OBJECT_NAME
1258 *** |\ \ \ Merge
: MERGE_PARENTS
1259 *** | | | | Author
: A U Thor
<author@example.com
>
1261 *** | | | | Merge HEADS DESCRIPTION
1263 *** | |
* | commit COMMIT_OBJECT_NAME
1264 *** | | |
/ Author
: A U Thor
<author@example.com
>
1268 *** | | | octopus-b.t |
1 +
1269 *** | | |
1 file changed
, 1 insertion
(+)
1271 *** | | |
diff --git a
/octopus-b.t b
/octopus-b.t
1272 *** | | | new
file mode
100644
1273 *** | | | index
0000000..d5fcad0
1274 *** | | |
--- /dev
/null
1275 *** | | |
+++ b
/octopus-b.t
1276 *** | | | @@
-0,0 +1 @@
1277 *** | | |
+octopus-b
1279 *** |
* | commit COMMIT_OBJECT_NAME
1280 *** | |
/ Author
: A U Thor
<author@example.com
>
1284 *** | | octopus-a.t |
1 +
1285 *** | |
1 file changed
, 1 insertion
(+)
1287 *** | |
diff --git a
/octopus-a.t b
/octopus-a.t
1288 *** | | new
file mode
100644
1289 *** | | index
0000000.
.11ee015
1290 *** | |
--- /dev
/null
1291 *** | |
+++ b
/octopus-a.t
1292 *** | | @@
-0,0 +1 @@
1295 *** * | commit COMMIT_OBJECT_NAME
1296 *** |
/ Author
: A U Thor
<author@example.com
>
1300 *** | seventh.t |
1 +
1301 *** |
1 file changed
, 1 insertion
(+)
1303 *** |
diff --git a
/seventh.t b
/seventh.t
1304 *** | new
file mode
100644
1305 *** | index
0000000.
.9744ffc
1307 *** |
+++ b
/seventh.t
1311 *** * commit COMMIT_OBJECT_NAME
1312 *** |\ Merge
: MERGE_PARENTS
1313 *** | | Author
: A U Thor
<author@example.com
>
1315 *** | | Merge branch
'tangle'
1317 *** |
* commit COMMIT_OBJECT_NAME
1318 *** | |\ Merge
: MERGE_PARENTS
1319 *** | | | Author
: A U Thor
<author@example.com
>
1321 *** | | | Merge branch
'side' (early part
) into tangle
1323 *** |
* | commit COMMIT_OBJECT_NAME
1324 *** | |\ \ Merge
: MERGE_PARENTS
1325 *** | | | | Author
: A U Thor
<author@example.com
>
1327 *** | | | | Merge branch
'master' (early part
) into tangle
1329 *** |
* | | commit COMMIT_OBJECT_NAME
1330 *** | | | | Author
: A U Thor
<author@example.com
>
1332 *** | | | | tangle-a
1334 *** | | | | tangle-a |
1 +
1335 *** | | | |
1 file changed
, 1 insertion
(+)
1337 *** | | | |
diff --git a
/tangle-a b
/tangle-a
1338 *** | | | | new
file mode
100644
1339 *** | | | | index
0000000.
.7898192
1340 *** | | | |
--- /dev
/null
1341 *** | | | |
+++ b
/tangle-a
1342 *** | | | | @@
-0,0 +1 @@
1345 *** * | | | commit COMMIT_OBJECT_NAME
1346 *** |\ \ \ \ Merge
: MERGE_PARENTS
1347 *** | | | | | Author
: A U Thor
<author@example.com
>
1349 *** | | | | | Merge branch
'side'
1351 *** |
* | | | commit COMMIT_OBJECT_NAME
1352 *** | | |_|
/ Author
: A U Thor
<author@example.com
>
1357 *** | | | |
1 file changed
, 1 insertion
(+)
1359 *** | | | |
diff --git a
/2 b
/2
1360 *** | | | | new
file mode
100644
1361 *** | | | | index
0000000.
.0cfbf08
1362 *** | | | |
--- /dev
/null
1364 *** | | | | @@
-0,0 +1 @@
1367 *** |
* | | commit COMMIT_OBJECT_NAME
1368 *** | | | | Author
: A U Thor
<author@example.com
>
1373 *** | | | |
1 file changed
, 1 insertion
(+)
1375 *** | | | |
diff --git a
/1 b
/1
1376 *** | | | | new
file mode
100644
1377 *** | | | | index
0000000..d00491f
1378 *** | | | |
--- /dev
/null
1380 *** | | | | @@
-0,0 +1 @@
1383 *** * | | | commit COMMIT_OBJECT_NAME
1384 *** | | | | Author
: A U Thor
<author@example.com
>
1388 *** | | | | one |
1 +
1389 *** | | | |
1 file changed
, 1 insertion
(+)
1391 *** | | | |
diff --git a
/one b
/one
1392 *** | | | | new
file mode
100644
1393 *** | | | | index
0000000.
.9a33383
1394 *** | | | |
--- /dev
/null
1395 *** | | | |
+++ b
/one
1396 *** | | | | @@
-0,0 +1 @@
1399 *** * | | | commit COMMIT_OBJECT_NAME
1400 *** | |_|
/ Author
: A U Thor
<author@example.com
>
1404 *** | | | a
/two |
1 -
1405 *** | | |
1 file changed
, 1 deletion
(-)
1407 *** | | |
diff --git a
/a
/two b
/a
/two
1408 *** | | | deleted
file mode
100644
1409 *** | | | index
9245af5.
.0000000
1410 *** | | |
--- a
/a
/two
1411 *** | | |
+++ /dev
/null
1412 *** | | | @@
-1 +0,0 @@
1415 *** * | | commit COMMIT_OBJECT_NAME
1416 *** | | | Author
: A U Thor
<author@example.com
>
1420 *** | | | a
/two |
1 +
1421 *** | | |
1 file changed
, 1 insertion
(+)
1423 *** | | |
diff --git a
/a
/two b
/a
/two
1424 *** | | | new
file mode
100644
1425 *** | | | index
0000000.
.9245af5
1426 *** | | |
--- /dev
/null
1427 *** | | |
+++ b
/a
/two
1428 *** | | | @@
-0,0 +1 @@
1431 *** * | | commit COMMIT_OBJECT_NAME
1432 *** |
/ / Author
: A U Thor
<author@example.com
>
1437 *** | |
1 file changed
, 1 insertion
(+)
1439 *** | |
diff --git a
/ein b
/ein
1440 *** | | new
file mode
100644
1441 *** | | index
0000000.
.9d7e69f
1442 *** | |
--- /dev
/null
1444 *** | | @@
-0,0 +1 @@
1447 *** * | commit COMMIT_OBJECT_NAME
1448 *** |
/ Author
: A U Thor
<author@example.com
>
1454 *** |
2 files changed
, 1 insertion
(+), 1 deletion
(-)
1456 *** |
diff --git a
/ichi b
/ichi
1457 *** | new
file mode
100644
1458 *** | index
0000000.
.9d7e69f
1463 *** |
diff --git a
/one b
/one
1464 *** | deleted
file mode
100644
1465 *** | index
9d7e69f.
.0000000
1471 *** * commit COMMIT_OBJECT_NAME
1472 *** | Author
: A U Thor
<author@example.com
>
1477 *** |
1 file changed
, 1 insertion
(+), 1 deletion
(-)
1479 *** |
diff --git a
/one b
/one
1480 *** | index
5626abf.
.9d7e69f
100644
1487 *** * commit COMMIT_OBJECT_NAME
1488 *** Author
: A U Thor
<author@example.com
>
1493 *** 1 file changed
, 1 insertion
(+)
1495 *** diff --git a
/one b
/one
1496 *** new
file mode
100644
1497 *** index
0000000.
.5626abf
1504 test_expect_success
'log --line-prefix="*** " --graph with diff and stats' '
1505 git log --line-prefix="*** " --no-renames --graph --pretty=short --stat -p >actual &&
1506 sanitize_output >actual.sanitized <actual &&
1507 test_i18ncmp expect actual.sanitized
1514 * Merge branch 'tangle'
1515 * Merge branch 'side'
1528 test_expect_success 'log --graph with --name-status' '
1529 git log --graph --format=%s --name-status tangle..reach >actual &&
1530 sanitize_output <actual >actual.sanitized &&
1531 test_cmp expect actual.sanitized
1538 * Merge branch 'tangle'
1539 * Merge branch 'side'
1552 test_expect_success 'log --graph with --name-only' '
1553 git log --graph --format=%s --name-only tangle..reach >actual &&
1554 sanitize_output <actual >actual.sanitized &&
1555 test_cmp expect actual.sanitized
1558 test_expect_success 'dotdot is a parent directory' '
1560 ( echo sixth && echo fifth ) >expect &&
1561 ( cd a/b && git log --format=%s .. ) >actual &&
1562 test_cmp expect actual
1565 test_expect_success GPG 'setup signed branch' '
1566 test_when_finished "git reset --hard && git checkout master" &&
1567 git checkout -b signed master &&
1570 git commit -S -m signed_commit
1573 test_expect_success GPG 'setup signed branch with subkey' '
1574 test_when_finished "git reset --hard && git checkout master" &&
1575 git checkout -b signed-subkey master &&
1578 git commit -SB7227189 -m signed_commit
1581 test_expect_success GPGSM 'setup signed branch x509' '
1582 test_when_finished "git reset --hard && git checkout master" &&
1583 git checkout -b signed-x509 master &&
1586 test_config gpg.format x509 &&
1587 test_config user.signingkey $GIT_COMMITTER_EMAIL &&
1588 git commit -S -m signed_commit
1591 test_expect_success GPGSM 'log x509 fingerprint' '
1592 echo "F8BF62E0693D0694816377099909C779FA23FD65 | " >expect &&
1593 git log -n1 --format="%GF | %GP" signed-x509 >actual &&
1594 test_cmp expect actual
1597 test_expect_success GPGSM 'log OpenPGP fingerprint' '
1598 echo "D4BE22311AD3131E5EDA29A461092E85B7227189" > expect &&
1599 git log -n1 --format="%GP" signed-subkey >actual &&
1600 test_cmp expect actual
1603 test_expect_success GPG 'log --graph --show-signature' '
1604 git log --graph --show-signature -n1 signed >actual &&
1605 grep "^| gpg: Signature made" actual &&
1606 grep "^| gpg: Good signature" actual
1609 test_expect_success GPGSM 'log --graph --show-signature x509' '
1610 git log --graph --show-signature -n1 signed-x509 >actual &&
1611 grep "^| gpgsm: Signature made" actual &&
1612 grep "^| gpgsm: Good signature" actual
1615 test_expect_success GPG 'log --graph --show-signature for merged tag' '
1616 test_when_finished "git reset --hard && git checkout master" &&
1617 git checkout -b plain master &&
1620 git commit -m bar_commit &&
1621 git checkout -b tagged master &&
1624 git commit -m baz_commit &&
1625 git tag -s -m signed_tag_msg signed_tag &&
1626 git checkout plain &&
1627 git merge --no-ff -m msg signed_tag &&
1628 git log --graph --show-signature -n1 plain >actual &&
1629 grep "^|\\\ merged tag" actual &&
1630 grep "^| | gpg: Signature made" actual &&
1631 grep "^| | gpg: Good signature" actual
1634 test_expect_success GPGSM 'log --graph --show-signature for merged tag x509' '
1635 test_when_finished "git reset --hard && git checkout master" &&
1636 test_config gpg.format x509 &&
1637 test_config user.signingkey $GIT_COMMITTER_EMAIL &&
1638 git checkout -b plain-x509 master &&
1641 git commit -m bar_commit &&
1642 git checkout -b tagged-x509 master &&
1645 git commit -m baz_commit &&
1646 git tag -s -m signed_tag_msg signed_tag_x509 &&
1647 git checkout plain-x509 &&
1648 git merge --no-ff -m msg signed_tag_x509 &&
1649 git log --graph --show-signature -n1 plain-x509 >actual &&
1650 grep "^|\\\ merged tag" actual &&
1651 grep "^| | gpgsm: Signature made" actual &&
1652 grep "^| | gpgsm: Good signature" actual
1655 test_expect_success GPG '--no-show-signature overrides --show-signature' '
1656 git log -1 --show-signature --no-show-signature signed >actual &&
1657 ! grep "^gpg:" actual
1660 test_expect_success GPG 'log.showsignature=true behaves like --show-signature' '
1661 test_config log.showsignature true &&
1662 git log -1 signed >actual &&
1663 grep "gpg: Signature made" actual &&
1664 grep "gpg: Good signature" actual
1667 test_expect_success GPG '--no-show-signature overrides log.showsignature=true' '
1668 test_config log.showsignature true &&
1669 git log -1 --no-show-signature signed >actual &&
1670 ! grep "^gpg:" actual
1673 test_expect_success GPG '--show-signature overrides log.showsignature=false' '
1674 test_config log.showsignature false &&
1675 git log -1 --show-signature signed >actual &&
1676 grep "gpg: Signature made" actual &&
1677 grep "gpg: Good signature" actual
1680 test_expect_success 'log --graph --no-walk is forbidden' '
1681 test_must_fail git log --graph --no-walk
1684 test_expect_success 'log diagnoses bogus HEAD' '
1686 test_must_fail git -C empty log 2>stderr &&
1687 test_i18ngrep does.not.have.any.commits stderr &&
1688 echo 1234abcd >empty/.git/refs/heads/master &&
1689 test_must_fail git -C empty log 2>stderr &&
1690 test_i18ngrep broken stderr &&
1691 echo "ref: refs/heads/invalid.lock" >empty/.git/HEAD &&
1692 test_must_fail git -C empty log 2>stderr &&
1693 test_i18ngrep broken stderr &&
1694 test_must_fail git -C empty log --default totally-bogus 2>stderr &&
1695 test_i18ngrep broken stderr
1698 test_expect_success 'log does not default to HEAD when rev input is given' '
1699 git log --branches=does-not-exist >actual &&
1700 test_must_be_empty actual
1703 test_expect_success 'set up --source tests' '
1704 git checkout --orphan source-a &&
1707 git checkout -b source-b HEAD^ &&
1711 test_expect_success 'log --source paints branch names' '
1712 cat >expect <<-\EOF &&
1713 09e12a9 source-b three
1714 8e393e1 source-a two
1715 1ac6c77 source-b one
1717 git log --oneline --source source-a source-b >actual &&
1718 test_cmp expect actual
1721 test_expect_success 'log --source paints tag names' '
1722 git tag -m tagged source-tag &&
1723 cat >expect <<-\EOF &&
1724 09e12a9 source-tag three
1725 8e393e1 source-a two
1726 1ac6c77 source-tag one
1728 git log --oneline --source source-tag source-a >actual &&
1729 test_cmp expect actual
1732 test_expect_success 'log --source paints symmetric ranges' '
1733 cat >expect <<-\EOF &&
1734 09e12a9 source-b three
1735 8e393e1 source-a two
1737 git log --oneline --source source-a...source-b >actual &&
1738 test_cmp expect actual
1741 test_expect_success '--exclude-promisor-objects does not BUG-crash' '
1742 test_must_fail git log --exclude-promisor-objects source-a
1745 test_expect_success 'log --end-of-options' '
1746 git update-ref refs/heads/--source HEAD &&
1747 git log --end-of-options --source >actual &&
1749 test_cmp expect actual