3 test_description
='git log'
6 .
"$TEST_DIRECTORY/lib-gpg.sh"
7 .
"$TEST_DIRECTORY/lib-terminal.sh"
8 .
"$TEST_DIRECTORY/lib-log-graph.sh"
11 lib_test_cmp_graph
--format=%s
"$@"
14 test_expect_success setup
'
19 git commit -m initial &&
24 git commit -m second &&
28 git commit -m third &&
33 git commit -m fourth &&
39 git commit -m fifth &&
47 printf "sixth\nfifth\nfourth\nthird\nsecond\ninitial" > expect
48 test_expect_success
'pretty' '
50 git log --pretty="format:%s" > actual &&
51 test_cmp expect actual
54 printf "sixth\nfifth\nfourth\nthird\nsecond\ninitial\n" > expect
55 test_expect_success
'pretty (tformat)' '
57 git log --pretty="tformat:%s" > actual &&
58 test_cmp expect actual
61 test_expect_success
'pretty (shortcut)' '
63 git log --pretty="%s" > actual &&
64 test_cmp expect actual
67 test_expect_success
'format' '
69 git log --format="%s" > actual &&
70 test_cmp expect actual
82 test_expect_success
'format %w(11,1,2)' '
84 git log -2 --format="%w(11,1,2)This is the %s commit." > actual &&
85 test_cmp expect actual
88 test_expect_success
'format %w(,1,2)' '
90 git log -2 --format="%w(,1,2)This is%nthe %s%ncommit." > actual &&
91 test_cmp expect actual
95 $(git rev-parse --short :/sixth ) sixth
96 $(git rev-parse --short :/fifth ) fifth
97 $(git rev-parse --short :/fourth ) fourth
98 $(git rev-parse --short :/third ) third
99 $(git rev-parse --short :/second ) second
100 $(git rev-parse --short :/initial) initial
102 test_expect_success
'oneline' '
104 git log --oneline > actual &&
105 test_cmp expect actual
108 test_expect_success
'diff-filter=A' '
110 git log --no-renames --pretty="format:%s" --diff-filter=A HEAD > actual &&
111 git log --no-renames --pretty="format:%s" --diff-filter A HEAD > actual-separate &&
112 printf "fifth\nfourth\nthird\ninitial" > expect &&
113 test_cmp expect actual &&
114 test_cmp expect actual-separate
118 test_expect_success
'diff-filter=M' '
120 actual=$(git log --pretty="format:%s" --diff-filter=M HEAD) &&
121 expect=$(echo second) &&
122 verbose test "$actual" = "$expect"
126 test_expect_success
'diff-filter=D' '
128 actual=$(git log --no-renames --pretty="format:%s" --diff-filter=D HEAD) &&
129 expect=$(echo sixth ; echo third) &&
130 verbose test "$actual" = "$expect"
134 test_expect_success
'diff-filter=R' '
136 actual=$(git log -M --pretty="format:%s" --diff-filter=R HEAD) &&
137 expect=$(echo third) &&
138 verbose test "$actual" = "$expect"
142 test_expect_success
'diff-filter=C' '
144 actual=$(git log -C -C --pretty="format:%s" --diff-filter=C HEAD) &&
145 expect=$(echo fourth) &&
146 verbose test "$actual" = "$expect"
150 test_expect_success
'git log --follow' '
152 actual=$(git log --follow --pretty="format:%s" ichi) &&
153 expect=$(echo third ; echo second ; echo initial) &&
154 verbose test "$actual" = "$expect"
157 test_expect_success
'git config log.follow works like --follow' '
158 test_config log.follow true &&
159 actual=$(git log --pretty="format:%s" ichi) &&
160 expect=$(echo third ; echo second ; echo initial) &&
161 verbose test "$actual" = "$expect"
164 test_expect_success
'git config log.follow does not die with multiple paths' '
165 test_config log.follow true &&
166 git log --pretty="format:%s" ichi ein
169 test_expect_success
'git config log.follow does not die with no paths' '
170 test_config log.follow true &&
174 test_expect_success
'git config log.follow is overridden by --no-follow' '
175 test_config log.follow true &&
176 actual=$(git log --no-follow --pretty="format:%s" ichi) &&
178 verbose test "$actual" = "$expect"
181 # Note that these commits are intentionally listed out of order.
182 last_three
="$(git rev-parse :/fourth :/sixth :/fifth)"
184 $(git rev-parse --short :/sixth ) sixth
185 $(git rev-parse --short :/fifth ) fifth
186 $(git rev-parse --short :/fourth) fourth
188 test_expect_success
'git log --no-walk <commits> sorts by commit time' '
189 git log --no-walk --oneline $last_three > actual &&
190 test_cmp expect actual
193 test_expect_success
'git log --no-walk=sorted <commits> sorts by commit time' '
194 git log --no-walk=sorted --oneline $last_three > actual &&
195 test_cmp expect actual
199 === $(git rev-parse --short :/sixth ) sixth
200 === $(git rev-parse --short :/fifth ) fifth
201 === $(git rev-parse --short :/fourth) fourth
203 test_expect_success
'git log --line-prefix="=== " --no-walk <commits> sorts by commit time' '
204 git log --line-prefix="=== " --no-walk --oneline $last_three > actual &&
205 test_cmp expect actual
209 $(git rev-parse --short :/fourth) fourth
210 $(git rev-parse --short :/sixth ) sixth
211 $(git rev-parse --short :/fifth ) fifth
213 test_expect_success
'git log --no-walk=unsorted <commits> leaves list of commits as given' '
214 git log --no-walk=unsorted --oneline $last_three > actual &&
215 test_cmp expect actual
218 test_expect_success
'git show <commits> leaves list of commits as given' '
219 git show --oneline -s $last_three > actual &&
220 test_cmp expect actual
223 test_expect_success
'setup case sensitivity tests' '
227 git commit -a -m Second
230 test_expect_success
'log --grep' '
231 echo second >expect &&
232 git log -1 --pretty="tformat:%s" --grep=sec >actual &&
233 test_cmp expect actual
240 test_expect_success
'log --invert-grep --grep' '
242 git -c grep.patternType=fixed log --pretty="tformat:%s" --invert-grep --grep=th --grep=Sec >actual &&
243 test_cmp expect actual &&
246 git -c grep.patternType=basic log --pretty="tformat:%s" --invert-grep --grep=t[h] --grep=S[e]c >actual &&
247 test_cmp expect actual &&
250 git -c grep.patternType=basic log --pretty="tformat:%s" --invert-grep --grep=t[h] --grep=S[e]c >actual &&
251 test_cmp expect actual &&
254 if test_have_prereq PCRE
256 git -c grep.patternType=perl log --pretty="tformat:%s" --invert-grep --grep=t[h] --grep=S[e]c >actual &&
257 test_cmp expect actual
261 test_expect_success
'log --invert-grep --grep -i' '
262 echo initial >expect &&
265 git -c grep.patternType=fixed log --pretty="tformat:%s" --invert-grep -i --grep=th --grep=Sec >actual &&
266 test_cmp expect actual &&
269 git -c grep.patternType=basic log --pretty="tformat:%s" --invert-grep -i --grep=t[h] --grep=S[e]c >actual &&
270 test_cmp expect actual &&
273 git -c grep.patternType=extended log --pretty="tformat:%s" --invert-grep -i --grep=t[h] --grep=S[e]c >actual &&
274 test_cmp expect actual &&
277 if test_have_prereq PCRE
279 git -c grep.patternType=perl log --pretty="tformat:%s" --invert-grep -i --grep=t[h] --grep=S[e]c >actual &&
280 test_cmp expect actual
284 test_expect_success
'log --grep option parsing' '
285 echo second >expect &&
286 git log -1 --pretty="tformat:%s" --grep sec >actual &&
287 test_cmp expect actual &&
288 test_must_fail git log -1 --pretty="tformat:%s" --grep
291 test_expect_success
'log -i --grep' '
292 echo Second >expect &&
293 git log -1 --pretty="tformat:%s" -i --grep=sec >actual &&
294 test_cmp expect actual
297 test_expect_success
'log --grep -i' '
298 echo Second >expect &&
301 git log -1 --pretty="tformat:%s" --grep=sec -i >actual &&
302 test_cmp expect actual &&
305 git -c grep.patternType=basic log -1 --pretty="tformat:%s" --grep=s[e]c -i >actual &&
306 test_cmp expect actual &&
309 git -c grep.patternType=extended log -1 --pretty="tformat:%s" --grep=s[e]c -i >actual &&
310 test_cmp expect actual &&
313 if test_have_prereq PCRE
315 git -c grep.patternType=perl log -1 --pretty="tformat:%s" --grep=s[e]c -i >actual &&
316 test_cmp expect actual
320 test_expect_success
'log -F -E --grep=<ere> uses ere' '
321 echo second >expect &&
322 # basic would need \(s\) to do the same
323 git log -1 --pretty="tformat:%s" -F -E --grep="(s).c.nd" >actual &&
324 test_cmp expect actual
327 test_expect_success PCRE
'log -F -E --perl-regexp --grep=<pcre> uses PCRE' '
328 test_when_finished "rm -rf num_commits" &&
329 git init num_commits &&
336 # In PCRE \d in [\d] is like saying "0-9", and matches the 2
339 git -C num_commits log -1 --pretty="tformat:%s" -F -E --perl-regexp --grep="[\d]" >actual &&
340 test_cmp expect actual &&
342 # ...in POSIX basic and extended it is the same as [d],
343 # i.e. "d", which matches 1d, but does not match 2e.
345 git -C num_commits log -1 --pretty="tformat:%s" -F -E --grep="[\d]" >actual &&
346 test_cmp expect actual
349 test_expect_success
'log with grep.patternType configuration' '
350 git -c grep.patterntype=fixed \
351 log -1 --pretty=tformat:%s --grep=s.c.nd >actual &&
352 test_must_be_empty actual
355 test_expect_success
'log with grep.patternType configuration and command line' '
356 echo second >expect &&
357 git -c grep.patterntype=fixed \
358 log -1 --pretty=tformat:%s --basic-regexp --grep=s.c.nd >actual &&
359 test_cmp expect actual
362 test_expect_success
!FAIL_PREREQS
'log with various grep.patternType configurations & command-lines' '
363 git init pattern-type &&
366 test_commit 1 file A &&
368 # The tagname is overridden here because creating a
369 # tag called "(1|2)" as test_commit would otherwise
370 # implicitly do would fail on e.g. MINGW.
371 test_commit "(1|2)" file B 2 &&
373 echo "(1|2)" >expect.fixed &&
374 cp expect.fixed expect.basic &&
375 cp expect.fixed expect.extended &&
376 cp expect.fixed expect.perl &&
378 # A strcmp-like match with fixed.
379 git -c grep.patternType=fixed log --pretty=tformat:%s \
380 --grep="(1|2)" >actual.fixed &&
382 # POSIX basic matches (, | and ) literally.
383 git -c grep.patternType=basic log --pretty=tformat:%s \
384 --grep="(.|.)" >actual.basic &&
386 # POSIX extended needs to have | escaped to match it
387 # literally, whereas under basic this is the same as
388 # (|2), i.e. it would also match "1". This test checks
389 # for extended by asserting that it is not matching
390 # what basic would match.
391 git -c grep.patternType=extended log --pretty=tformat:%s \
392 --grep="\|2" >actual.extended &&
393 if test_have_prereq PCRE
395 # Only PCRE would match [\d]\| with only
396 # "(1|2)" due to [\d]. POSIX basic would match
397 # both it and "1" since similarly to the
398 # extended match above it is the same as
399 # \([\d]\|\). POSIX extended would
401 git -c grep.patternType=perl log --pretty=tformat:%s \
402 --grep="[\d]\|" >actual.perl &&
403 test_cmp expect.perl actual.perl
405 test_cmp expect.fixed actual.fixed &&
406 test_cmp expect.basic actual.basic &&
407 test_cmp expect.extended actual.extended &&
409 git log --pretty=tformat:%s -F \
410 --grep="(1|2)" >actual.fixed.short-arg &&
411 git log --pretty=tformat:%s -E \
412 --grep="\|2" >actual.extended.short-arg &&
413 if test_have_prereq PCRE
415 git log --pretty=tformat:%s -P \
416 --grep="[\d]\|" >actual.perl.short-arg
418 test_must_fail git log -P \
421 test_cmp expect.fixed actual.fixed.short-arg &&
422 test_cmp expect.extended actual.extended.short-arg &&
423 if test_have_prereq PCRE
425 test_cmp expect.perl actual.perl.short-arg
428 git log --pretty=tformat:%s --fixed-strings \
429 --grep="(1|2)" >actual.fixed.long-arg &&
430 git log --pretty=tformat:%s --basic-regexp \
431 --grep="(.|.)" >actual.basic.long-arg &&
432 git log --pretty=tformat:%s --extended-regexp \
433 --grep="\|2" >actual.extended.long-arg &&
434 if test_have_prereq PCRE
436 git log --pretty=tformat:%s --perl-regexp \
437 --grep="[\d]\|" >actual.perl.long-arg &&
438 test_cmp expect.perl actual.perl.long-arg
440 test_must_fail git log --perl-regexp \
443 test_cmp expect.fixed actual.fixed.long-arg &&
444 test_cmp expect.basic actual.basic.long-arg &&
445 test_cmp expect.extended actual.extended.long-arg
459 test_expect_success
'simple log --graph' '
473 test_expect_success
'simple log --graph --line-prefix="123 "' '
474 test_cmp_graph --line-prefix="123 "
477 test_expect_success
'set up merge history' '
478 git checkout -b side HEAD~4 &&
479 test_commit side-1 1 1 &&
480 test_commit side-2 2 2 &&
481 git checkout master &&
486 * Merge branch
'side'
500 test_expect_success
'log --graph with merge' '
501 test_cmp_graph --date-order
505 | | |
* Merge branch
'side'
519 test_expect_success
'log --graph --line-prefix="| | | " with merge' '
520 test_cmp_graph --line-prefix="| | | " --date-order
523 cat > expect.colors
<<\EOF
524 * Merge branch
'side'
525 <BLUE
>|
<RESET
><CYAN
>\
<RESET
>
526 <BLUE
>|
<RESET
> * side-2
527 <BLUE
>|
<RESET
> * side-1
528 * <CYAN
>|
<RESET
> Second
529 * <CYAN
>|
<RESET
> sixth
530 * <CYAN
>|
<RESET
> fifth
531 * <CYAN
>|
<RESET
> fourth
532 <CYAN
>|
<RESET
><CYAN
>/<RESET
>
538 test_expect_success
'log --graph with merge with log.graphColors' '
539 test_config log.graphColors " blue,invalid-color, cyan, red , " &&
540 lib_test_cmp_colored_graph --date-order --format=%s
543 test_expect_success
'log --raw --graph -m with merge' '
544 git log --raw --graph --oneline -m master | head -n 500 >actual &&
545 grep "initial" actual
548 test_expect_success
'diff-tree --graph' '
549 git diff-tree --graph master^ | head -n 500 >actual &&
556 | | Author
: A U Thor
<author@example.com
>
558 | | Merge branch
'side'
560 |
* commit tags
/side-2
561 | | Author
: A U Thor
<author@example.com
>
565 |
* commit tags
/side-1
566 | | Author
: A U Thor
<author@example.com
>
571 | | Author
: A U Thor
<author@example.com
>
576 | | Author
: A U Thor
<author@example.com
>
581 | | Author
: A U Thor
<author@example.com
>
586 |
/ Author
: A U Thor
<author@example.com
>
590 * commit tags
/side-1~
1
591 | Author
: A U Thor
<author@example.com
>
595 * commit tags
/side-1~
2
596 | Author
: A U Thor
<author@example.com
>
600 * commit tags
/side-1~
3
601 Author
: A U Thor
<author@example.com
>
606 test_expect_success
'log --graph with full output' '
607 git log --graph --date-order --pretty=short |
608 git name-rev --name-only --stdin |
609 sed "s/Merge:.*/Merge: A B/;s/ *\$//" >actual &&
610 test_cmp expect actual
613 test_expect_success
'set up more tangled history' '
614 git checkout -b tangle HEAD~6 &&
615 test_commit tangle-a tangle-a a &&
616 git merge master~3 &&
618 git checkout master &&
620 git checkout -b reach &&
622 git checkout master &&
623 git checkout -b octopus-a &&
624 test_commit octopus-a &&
625 git checkout master &&
626 git checkout -b octopus-b &&
627 test_commit octopus-b &&
628 git checkout master &&
629 test_commit seventh &&
630 git merge octopus-a octopus-b &&
639 *-. \ Merge tags
'octopus-a' and
'octopus-b'
649 * Merge branch
'tangle'
651 |
* Merge branch
'side' (early part
) into tangle
653 |
* \ Merge branch
'master' (early part
) into tangle
656 * | | | Merge branch
'side'
675 test_expect_success
'log --graph with merge' '
676 test_cmp_graph --date-order
679 test_expect_success
'log.decorate configuration' '
680 git log --oneline --no-decorate >expect.none &&
681 git log --oneline --decorate >expect.short &&
682 git log --oneline --decorate=full >expect.full &&
684 echo "[log] decorate" >>.git/config &&
685 git log --oneline >actual &&
686 test_cmp expect.short actual &&
688 test_config log.decorate true &&
689 git log --oneline >actual &&
690 test_cmp expect.short actual &&
691 git log --oneline --decorate=full >actual &&
692 test_cmp expect.full actual &&
693 git log --oneline --decorate=no >actual &&
694 test_cmp expect.none actual &&
696 test_config log.decorate no &&
697 git log --oneline >actual &&
698 test_cmp expect.none actual &&
699 git log --oneline --decorate >actual &&
700 test_cmp expect.short actual &&
701 git log --oneline --decorate=full >actual &&
702 test_cmp expect.full actual &&
704 test_config log.decorate 1 &&
705 git log --oneline >actual &&
706 test_cmp expect.short actual &&
707 git log --oneline --decorate=full >actual &&
708 test_cmp expect.full actual &&
709 git log --oneline --decorate=no >actual &&
710 test_cmp expect.none actual &&
712 test_config log.decorate short &&
713 git log --oneline >actual &&
714 test_cmp expect.short actual &&
715 git log --oneline --no-decorate >actual &&
716 test_cmp expect.none actual &&
717 git log --oneline --decorate=full >actual &&
718 test_cmp expect.full actual &&
720 test_config log.decorate full &&
721 git log --oneline >actual &&
722 test_cmp expect.full actual &&
723 git log --oneline --no-decorate >actual &&
724 test_cmp expect.none actual &&
725 git log --oneline --decorate >actual &&
726 test_cmp expect.short actual &&
728 test_unconfig log.decorate &&
729 git log --pretty=raw >expect.raw &&
730 test_config log.decorate full &&
731 git log --pretty=raw >actual &&
732 test_cmp expect.raw actual
736 test_expect_success
'decorate-refs with glob' '
737 cat >expect.decorate <<-\EOF &&
739 Merge-tags-octopus-a-and-octopus-b
741 octopus-b (octopus-b)
742 octopus-a (octopus-a)
745 cat >expect.no-decorate <<-\EOF &&
747 Merge-tags-octopus-a-and-octopus-b
753 git log -n6 --decorate=short --pretty="tformat:%f%d" \
754 --decorate-refs="heads/octopus*" >actual &&
755 test_cmp expect.decorate actual &&
756 git log -n6 --decorate=short --pretty="tformat:%f%d" \
757 --decorate-refs-exclude="heads/octopus*" \
758 --decorate-refs="heads/octopus*" >actual &&
759 test_cmp expect.no-decorate actual &&
760 git -c log.excludeDecoration="heads/octopus*" log \
761 -n6 --decorate=short --pretty="tformat:%f%d" \
762 --decorate-refs="heads/octopus*" >actual &&
763 test_cmp expect.decorate actual
766 test_expect_success
'decorate-refs without globs' '
767 cat >expect.decorate <<-\EOF &&
769 Merge-tags-octopus-a-and-octopus-b
775 git log -n6 --decorate=short --pretty="tformat:%f%d" \
776 --decorate-refs="tags/reach" >actual &&
777 test_cmp expect.decorate actual
780 test_expect_success
'multiple decorate-refs' '
781 cat >expect.decorate <<-\EOF &&
783 Merge-tags-octopus-a-and-octopus-b
785 octopus-b (octopus-b)
786 octopus-a (octopus-a)
789 git log -n6 --decorate=short --pretty="tformat:%f%d" \
790 --decorate-refs="heads/octopus*" \
791 --decorate-refs="tags/reach" >actual &&
792 test_cmp expect.decorate actual
795 test_expect_success
'decorate-refs-exclude with glob' '
796 cat >expect.decorate <<-\EOF &&
797 Merge-tag-reach (HEAD -> master)
798 Merge-tags-octopus-a-and-octopus-b
799 seventh (tag: seventh)
800 octopus-b (tag: octopus-b)
801 octopus-a (tag: octopus-a)
802 reach (tag: reach, reach)
804 git log -n6 --decorate=short --pretty="tformat:%f%d" \
805 --decorate-refs-exclude="heads/octopus*" >actual &&
806 test_cmp expect.decorate actual &&
807 git -c log.excludeDecoration="heads/octopus*" log \
808 -n6 --decorate=short --pretty="tformat:%f%d" >actual &&
809 test_cmp expect.decorate actual
812 test_expect_success
'decorate-refs-exclude without globs' '
813 cat >expect.decorate <<-\EOF &&
814 Merge-tag-reach (HEAD -> master)
815 Merge-tags-octopus-a-and-octopus-b
816 seventh (tag: seventh)
817 octopus-b (tag: octopus-b, octopus-b)
818 octopus-a (tag: octopus-a, octopus-a)
821 git log -n6 --decorate=short --pretty="tformat:%f%d" \
822 --decorate-refs-exclude="tags/reach" >actual &&
823 test_cmp expect.decorate actual &&
824 git -c log.excludeDecoration="tags/reach" log \
825 -n6 --decorate=short --pretty="tformat:%f%d" >actual &&
826 test_cmp expect.decorate actual
829 test_expect_success
'multiple decorate-refs-exclude' '
830 cat >expect.decorate <<-\EOF &&
831 Merge-tag-reach (HEAD -> master)
832 Merge-tags-octopus-a-and-octopus-b
833 seventh (tag: seventh)
834 octopus-b (tag: octopus-b)
835 octopus-a (tag: octopus-a)
838 git log -n6 --decorate=short --pretty="tformat:%f%d" \
839 --decorate-refs-exclude="heads/octopus*" \
840 --decorate-refs-exclude="tags/reach" >actual &&
841 test_cmp expect.decorate actual &&
842 git -c log.excludeDecoration="heads/octopus*" \
843 -c log.excludeDecoration="tags/reach" log \
844 -n6 --decorate=short --pretty="tformat:%f%d" >actual &&
845 test_cmp expect.decorate actual &&
846 git -c log.excludeDecoration="heads/octopus*" log \
847 --decorate-refs-exclude="tags/reach" \
848 -n6 --decorate=short --pretty="tformat:%f%d" >actual &&
849 test_cmp expect.decorate actual
852 test_expect_success
'decorate-refs and decorate-refs-exclude' '
853 cat >expect.no-decorate <<-\EOF &&
854 Merge-tag-reach (master)
855 Merge-tags-octopus-a-and-octopus-b
861 git log -n6 --decorate=short --pretty="tformat:%f%d" \
862 --decorate-refs="heads/*" \
863 --decorate-refs-exclude="heads/oc*" >actual &&
864 test_cmp expect.no-decorate actual
867 test_expect_success
'deocrate-refs and log.excludeDecoration' '
868 cat >expect.decorate <<-\EOF &&
869 Merge-tag-reach (master)
870 Merge-tags-octopus-a-and-octopus-b
872 octopus-b (octopus-b)
873 octopus-a (octopus-a)
876 git -c log.excludeDecoration="heads/oc*" log \
877 --decorate-refs="heads/*" \
878 -n6 --decorate=short --pretty="tformat:%f%d" >actual &&
879 test_cmp expect.decorate actual
882 test_expect_success
'decorate-refs-exclude and simplify-by-decoration' '
883 cat >expect.decorate <<-\EOF &&
884 Merge-tag-reach (HEAD -> master)
885 reach (tag: reach, reach)
886 seventh (tag: seventh)
888 Merge-branch-side-early-part-into-tangle (tangle)
889 tangle-a (tag: tangle-a)
891 git log -n6 --decorate=short --pretty="tformat:%f%d" \
892 --decorate-refs-exclude="*octopus*" \
893 --simplify-by-decoration >actual &&
894 test_cmp expect.decorate actual &&
895 git -c log.excludeDecoration="*octopus*" log \
896 -n6 --decorate=short --pretty="tformat:%f%d" \
897 --simplify-by-decoration >actual &&
898 test_cmp expect.decorate actual
901 test_expect_success
'log.decorate config parsing' '
902 git log --oneline --decorate=full >expect.full &&
903 git log --oneline --decorate=short >expect.short &&
905 test_config log.decorate full &&
906 test_config log.mailmap true &&
907 git log --oneline >actual &&
908 test_cmp expect.full actual &&
909 git log --oneline --decorate=short >actual &&
910 test_cmp expect.short actual
913 test_expect_success TTY
'log output on a TTY' '
914 git log --color --oneline --decorate >expect.short &&
916 test_terminal git log --oneline >actual &&
917 test_cmp expect.short actual
920 test_expect_success
'reflog is expected format' '
921 git log -g --abbrev-commit --pretty=oneline >expect &&
922 git reflog >actual &&
923 test_cmp expect actual
926 test_expect_success
'whatchanged is expected format' '
927 git log --no-merges --raw >expect &&
928 git whatchanged >actual &&
929 test_cmp expect actual
932 test_expect_success
'log.abbrevCommit configuration' '
933 git log --abbrev-commit >expect.log.abbrev &&
934 git log --no-abbrev-commit >expect.log.full &&
935 git log --pretty=raw >expect.log.raw &&
936 git reflog --abbrev-commit >expect.reflog.abbrev &&
937 git reflog --no-abbrev-commit >expect.reflog.full &&
938 git whatchanged --abbrev-commit >expect.whatchanged.abbrev &&
939 git whatchanged --no-abbrev-commit >expect.whatchanged.full &&
941 test_config log.abbrevCommit true &&
944 test_cmp expect.log.abbrev actual &&
945 git log --no-abbrev-commit >actual &&
946 test_cmp expect.log.full actual &&
948 git log --pretty=raw >actual &&
949 test_cmp expect.log.raw actual &&
951 git reflog >actual &&
952 test_cmp expect.reflog.abbrev actual &&
953 git reflog --no-abbrev-commit >actual &&
954 test_cmp expect.reflog.full actual &&
956 git whatchanged >actual &&
957 test_cmp expect.whatchanged.abbrev actual &&
958 git whatchanged --no-abbrev-commit >actual &&
959 test_cmp expect.whatchanged.full actual
962 test_expect_success
'show added path under "--follow -M"' '
963 # This tests for a regression introduced in v1.7.2-rc0~103^2~2
964 test_create_repo regression &&
967 test_commit needs-another-commit &&
968 test_commit foo.bar &&
969 git log -M --follow -p foo.bar.t &&
970 git log -M --follow --stat foo.bar.t &&
971 git log -M --follow --name-only foo.bar.t
975 test_expect_success
'git log -c --follow' '
976 test_create_repo follow-c &&
979 test_commit initial file original &&
981 test_commit rename file2 original &&
982 git reset --hard initial &&
983 test_commit modify file foo &&
984 git merge -m merge rename &&
985 git log -c --follow file2
990 * commit COMMIT_OBJECT_NAME
991 |\ Merge
: MERGE_PARENTS
992 | | Author
: A U Thor
<author@example.com
>
994 | | Merge HEADS DESCRIPTION
996 |
* commit COMMIT_OBJECT_NAME
997 | | Author
: A U Thor
<author@example.com
>
1002 | |
1 file changed
, 1 insertion
(+)
1004 | |
diff --git a
/reach.t b
/reach.t
1005 | | new
file mode
100644
1006 | | index BEFORE..AFTER
1013 *-. \ commit COMMIT_OBJECT_NAME
1014 |\ \ \ Merge
: MERGE_PARENTS
1015 | | | | Author
: A U Thor
<author@example.com
>
1017 | | | | Merge HEADS DESCRIPTION
1019 | |
* | commit COMMIT_OBJECT_NAME
1020 | | |
/ Author
: A U Thor
<author@example.com
>
1024 | | | octopus-b.t |
1 +
1025 | | |
1 file changed
, 1 insertion
(+)
1027 | | |
diff --git a
/octopus-b.t b
/octopus-b.t
1028 | | | new
file mode
100644
1029 | | | index BEFORE..AFTER
1031 | | |
+++ b
/octopus-b.t
1035 |
* | commit COMMIT_OBJECT_NAME
1036 | |
/ Author
: A U Thor
<author@example.com
>
1040 | | octopus-a.t |
1 +
1041 | |
1 file changed
, 1 insertion
(+)
1043 | |
diff --git a
/octopus-a.t b
/octopus-a.t
1044 | | new
file mode
100644
1045 | | index BEFORE..AFTER
1047 | |
+++ b
/octopus-a.t
1051 * | commit COMMIT_OBJECT_NAME
1052 |
/ Author
: A U Thor
<author@example.com
>
1057 |
1 file changed
, 1 insertion
(+)
1059 |
diff --git a
/seventh.t b
/seventh.t
1060 | new
file mode
100644
1061 | index BEFORE..AFTER
1067 * commit COMMIT_OBJECT_NAME
1068 |\ Merge
: MERGE_PARENTS
1069 | | Author
: A U Thor
<author@example.com
>
1071 | | Merge branch
'tangle'
1073 |
* commit COMMIT_OBJECT_NAME
1074 | |\ Merge
: MERGE_PARENTS
1075 | | | Author
: A U Thor
<author@example.com
>
1077 | | | Merge branch
'side' (early part
) into tangle
1079 |
* | commit COMMIT_OBJECT_NAME
1080 | |\ \ Merge
: MERGE_PARENTS
1081 | | | | Author
: A U Thor
<author@example.com
>
1083 | | | | Merge branch
'master' (early part
) into tangle
1085 |
* | | commit COMMIT_OBJECT_NAME
1086 | | | | Author
: A U Thor
<author@example.com
>
1090 | | | | tangle-a |
1 +
1091 | | | |
1 file changed
, 1 insertion
(+)
1093 | | | |
diff --git a
/tangle-a b
/tangle-a
1094 | | | | new
file mode
100644
1095 | | | | index BEFORE..AFTER
1096 | | | |
--- /dev
/null
1097 | | | |
+++ b
/tangle-a
1098 | | | | @@
-0,0 +1 @@
1101 * | | | commit COMMIT_OBJECT_NAME
1102 |\ \ \ \ Merge
: MERGE_PARENTS
1103 | | | | | Author
: A U Thor
<author@example.com
>
1105 | | | | | Merge branch
'side'
1107 |
* | | | commit COMMIT_OBJECT_NAME
1108 | | |_|
/ Author
: A U Thor
<author@example.com
>
1113 | | | |
1 file changed
, 1 insertion
(+)
1115 | | | |
diff --git a
/2 b
/2
1116 | | | | new
file mode
100644
1117 | | | | index BEFORE..AFTER
1118 | | | |
--- /dev
/null
1120 | | | | @@
-0,0 +1 @@
1123 |
* | | commit COMMIT_OBJECT_NAME
1124 | | | | Author
: A U Thor
<author@example.com
>
1129 | | | |
1 file changed
, 1 insertion
(+)
1131 | | | |
diff --git a
/1 b
/1
1132 | | | | new
file mode
100644
1133 | | | | index BEFORE..AFTER
1134 | | | |
--- /dev
/null
1136 | | | | @@
-0,0 +1 @@
1139 * | | | commit COMMIT_OBJECT_NAME
1140 | | | | Author
: A U Thor
<author@example.com
>
1145 | | | |
1 file changed
, 1 insertion
(+)
1147 | | | |
diff --git a
/one b
/one
1148 | | | | new
file mode
100644
1149 | | | | index BEFORE..AFTER
1150 | | | |
--- /dev
/null
1152 | | | | @@
-0,0 +1 @@
1155 * | | | commit COMMIT_OBJECT_NAME
1156 | |_|
/ Author
: A U Thor
<author@example.com
>
1161 | | |
1 file changed
, 1 deletion
(-)
1163 | | |
diff --git a
/a
/two b
/a
/two
1164 | | | deleted
file mode
100644
1165 | | | index BEFORE..AFTER
1171 * | | commit COMMIT_OBJECT_NAME
1172 | | | Author
: A U Thor
<author@example.com
>
1177 | | |
1 file changed
, 1 insertion
(+)
1179 | | |
diff --git a
/a
/two b
/a
/two
1180 | | | new
file mode
100644
1181 | | | index BEFORE..AFTER
1187 * | | commit COMMIT_OBJECT_NAME
1188 |
/ / Author
: A U Thor
<author@example.com
>
1193 | |
1 file changed
, 1 insertion
(+)
1195 | |
diff --git a
/ein b
/ein
1196 | | new
file mode
100644
1197 | | index BEFORE..AFTER
1203 * | commit COMMIT_OBJECT_NAME
1204 |
/ Author
: A U Thor
<author@example.com
>
1210 |
2 files changed
, 1 insertion
(+), 1 deletion
(-)
1212 |
diff --git a
/ichi b
/ichi
1213 | new
file mode
100644
1214 | index BEFORE..AFTER
1219 |
diff --git a
/one b
/one
1220 | deleted
file mode
100644
1221 | index BEFORE..AFTER
1227 * commit COMMIT_OBJECT_NAME
1228 | Author
: A U Thor
<author@example.com
>
1233 |
1 file changed
, 1 insertion
(+), 1 deletion
(-)
1235 |
diff --git a
/one b
/one
1236 | index BEFORE..AFTER
100644
1243 * commit COMMIT_OBJECT_NAME
1244 Author
: A U Thor
<author@example.com
>
1249 1 file changed
, 1 insertion
(+)
1251 diff --git a
/one b
/one
1252 new
file mode
100644
1260 test_expect_success
'log --graph with diff and stats' '
1261 lib_test_cmp_short_graph --no-renames --stat -p
1265 *** * commit COMMIT_OBJECT_NAME
1266 *** |\ Merge
: MERGE_PARENTS
1267 *** | | Author
: A U Thor
<author@example.com
>
1269 *** | | Merge HEADS DESCRIPTION
1271 *** |
* commit COMMIT_OBJECT_NAME
1272 *** | | Author
: A U Thor
<author@example.com
>
1276 *** | | reach.t |
1 +
1277 *** | |
1 file changed
, 1 insertion
(+)
1279 *** | |
diff --git a
/reach.t b
/reach.t
1280 *** | | new
file mode
100644
1281 *** | | index BEFORE..AFTER
1282 *** | |
--- /dev
/null
1283 *** | |
+++ b
/reach.t
1284 *** | | @@
-0,0 +1 @@
1288 *** *-. \ commit COMMIT_OBJECT_NAME
1289 *** |\ \ \ Merge
: MERGE_PARENTS
1290 *** | | | | Author
: A U Thor
<author@example.com
>
1292 *** | | | | Merge HEADS DESCRIPTION
1294 *** | |
* | commit COMMIT_OBJECT_NAME
1295 *** | | |
/ Author
: A U Thor
<author@example.com
>
1299 *** | | | octopus-b.t |
1 +
1300 *** | | |
1 file changed
, 1 insertion
(+)
1302 *** | | |
diff --git a
/octopus-b.t b
/octopus-b.t
1303 *** | | | new
file mode
100644
1304 *** | | | index BEFORE..AFTER
1305 *** | | |
--- /dev
/null
1306 *** | | |
+++ b
/octopus-b.t
1307 *** | | | @@
-0,0 +1 @@
1308 *** | | |
+octopus-b
1310 *** |
* | commit COMMIT_OBJECT_NAME
1311 *** | |
/ Author
: A U Thor
<author@example.com
>
1315 *** | | octopus-a.t |
1 +
1316 *** | |
1 file changed
, 1 insertion
(+)
1318 *** | |
diff --git a
/octopus-a.t b
/octopus-a.t
1319 *** | | new
file mode
100644
1320 *** | | index BEFORE..AFTER
1321 *** | |
--- /dev
/null
1322 *** | |
+++ b
/octopus-a.t
1323 *** | | @@
-0,0 +1 @@
1326 *** * | commit COMMIT_OBJECT_NAME
1327 *** |
/ Author
: A U Thor
<author@example.com
>
1331 *** | seventh.t |
1 +
1332 *** |
1 file changed
, 1 insertion
(+)
1334 *** |
diff --git a
/seventh.t b
/seventh.t
1335 *** | new
file mode
100644
1336 *** | index BEFORE..AFTER
1338 *** |
+++ b
/seventh.t
1342 *** * commit COMMIT_OBJECT_NAME
1343 *** |\ Merge
: MERGE_PARENTS
1344 *** | | Author
: A U Thor
<author@example.com
>
1346 *** | | Merge branch
'tangle'
1348 *** |
* commit COMMIT_OBJECT_NAME
1349 *** | |\ Merge
: MERGE_PARENTS
1350 *** | | | Author
: A U Thor
<author@example.com
>
1352 *** | | | Merge branch
'side' (early part
) into tangle
1354 *** |
* | commit COMMIT_OBJECT_NAME
1355 *** | |\ \ Merge
: MERGE_PARENTS
1356 *** | | | | Author
: A U Thor
<author@example.com
>
1358 *** | | | | Merge branch
'master' (early part
) into tangle
1360 *** |
* | | commit COMMIT_OBJECT_NAME
1361 *** | | | | Author
: A U Thor
<author@example.com
>
1363 *** | | | | tangle-a
1365 *** | | | | tangle-a |
1 +
1366 *** | | | |
1 file changed
, 1 insertion
(+)
1368 *** | | | |
diff --git a
/tangle-a b
/tangle-a
1369 *** | | | | new
file mode
100644
1370 *** | | | | index BEFORE..AFTER
1371 *** | | | |
--- /dev
/null
1372 *** | | | |
+++ b
/tangle-a
1373 *** | | | | @@
-0,0 +1 @@
1376 *** * | | | commit COMMIT_OBJECT_NAME
1377 *** |\ \ \ \ Merge
: MERGE_PARENTS
1378 *** | | | | | Author
: A U Thor
<author@example.com
>
1380 *** | | | | | Merge branch
'side'
1382 *** |
* | | | commit COMMIT_OBJECT_NAME
1383 *** | | |_|
/ Author
: A U Thor
<author@example.com
>
1388 *** | | | |
1 file changed
, 1 insertion
(+)
1390 *** | | | |
diff --git a
/2 b
/2
1391 *** | | | | new
file mode
100644
1392 *** | | | | index BEFORE..AFTER
1393 *** | | | |
--- /dev
/null
1395 *** | | | | @@
-0,0 +1 @@
1398 *** |
* | | commit COMMIT_OBJECT_NAME
1399 *** | | | | Author
: A U Thor
<author@example.com
>
1404 *** | | | |
1 file changed
, 1 insertion
(+)
1406 *** | | | |
diff --git a
/1 b
/1
1407 *** | | | | new
file mode
100644
1408 *** | | | | index BEFORE..AFTER
1409 *** | | | |
--- /dev
/null
1411 *** | | | | @@
-0,0 +1 @@
1414 *** * | | | commit COMMIT_OBJECT_NAME
1415 *** | | | | Author
: A U Thor
<author@example.com
>
1419 *** | | | | one |
1 +
1420 *** | | | |
1 file changed
, 1 insertion
(+)
1422 *** | | | |
diff --git a
/one b
/one
1423 *** | | | | new
file mode
100644
1424 *** | | | | index BEFORE..AFTER
1425 *** | | | |
--- /dev
/null
1426 *** | | | |
+++ b
/one
1427 *** | | | | @@
-0,0 +1 @@
1430 *** * | | | commit COMMIT_OBJECT_NAME
1431 *** | |_|
/ Author
: A U Thor
<author@example.com
>
1435 *** | | | a
/two |
1 -
1436 *** | | |
1 file changed
, 1 deletion
(-)
1438 *** | | |
diff --git a
/a
/two b
/a
/two
1439 *** | | | deleted
file mode
100644
1440 *** | | | index BEFORE..AFTER
1441 *** | | |
--- a
/a
/two
1442 *** | | |
+++ /dev
/null
1443 *** | | | @@
-1 +0,0 @@
1446 *** * | | commit COMMIT_OBJECT_NAME
1447 *** | | | Author
: A U Thor
<author@example.com
>
1451 *** | | | a
/two |
1 +
1452 *** | | |
1 file changed
, 1 insertion
(+)
1454 *** | | |
diff --git a
/a
/two b
/a
/two
1455 *** | | | new
file mode
100644
1456 *** | | | index BEFORE..AFTER
1457 *** | | |
--- /dev
/null
1458 *** | | |
+++ b
/a
/two
1459 *** | | | @@
-0,0 +1 @@
1462 *** * | | commit COMMIT_OBJECT_NAME
1463 *** |
/ / Author
: A U Thor
<author@example.com
>
1468 *** | |
1 file changed
, 1 insertion
(+)
1470 *** | |
diff --git a
/ein b
/ein
1471 *** | | new
file mode
100644
1472 *** | | index BEFORE..AFTER
1473 *** | |
--- /dev
/null
1475 *** | | @@
-0,0 +1 @@
1478 *** * | commit COMMIT_OBJECT_NAME
1479 *** |
/ Author
: A U Thor
<author@example.com
>
1485 *** |
2 files changed
, 1 insertion
(+), 1 deletion
(-)
1487 *** |
diff --git a
/ichi b
/ichi
1488 *** | new
file mode
100644
1489 *** | index BEFORE..AFTER
1494 *** |
diff --git a
/one b
/one
1495 *** | deleted
file mode
100644
1496 *** | index BEFORE..AFTER
1502 *** * commit COMMIT_OBJECT_NAME
1503 *** | Author
: A U Thor
<author@example.com
>
1508 *** |
1 file changed
, 1 insertion
(+), 1 deletion
(-)
1510 *** |
diff --git a
/one b
/one
1511 *** | index BEFORE..AFTER
100644
1518 *** * commit COMMIT_OBJECT_NAME
1519 *** Author
: A U Thor
<author@example.com
>
1524 *** 1 file changed
, 1 insertion
(+)
1526 *** diff --git a
/one b
/one
1527 *** new
file mode
100644
1528 *** index BEFORE..AFTER
1535 test_expect_success
'log --line-prefix="*** " --graph with diff and stats' '
1536 lib_test_cmp_short_graph --line-prefix="*** " --no-renames --stat -p
1543 * Merge branch 'tangle'
1544 * Merge branch 'side'
1557 test_expect_success 'log --graph with --name-status' '
1558 test_cmp_graph --name-status tangle..reach
1565 * Merge branch 'tangle'
1566 * Merge branch 'side'
1579 test_expect_success 'log --graph with --name-only' '
1580 test_cmp_graph --name-only tangle..reach
1583 test_expect_success 'dotdot is a parent directory' '
1585 ( echo sixth && echo fifth ) >expect &&
1586 ( cd a/b && git log --format=%s .. ) >actual &&
1587 test_cmp expect actual
1590 test_expect_success GPG 'setup signed branch' '
1591 test_when_finished "git reset --hard && git checkout master" &&
1592 git checkout -b signed master &&
1595 git commit -S -m signed_commit
1598 test_expect_success GPG 'setup signed branch with subkey' '
1599 test_when_finished "git reset --hard && git checkout master" &&
1600 git checkout -b signed-subkey master &&
1603 git commit -SB7227189 -m signed_commit
1606 test_expect_success GPGSM 'setup signed branch x509' '
1607 test_when_finished "git reset --hard && git checkout master" &&
1608 git checkout -b signed-x509 master &&
1611 test_config gpg.format x509 &&
1612 test_config user.signingkey $GIT_COMMITTER_EMAIL &&
1613 git commit -S -m signed_commit
1616 test_expect_success GPGSM 'log x509 fingerprint' '
1617 echo "F8BF62E0693D0694816377099909C779FA23FD65 | " >expect &&
1618 git log -n1 --format="%GF | %GP" signed-x509 >actual &&
1619 test_cmp expect actual
1622 test_expect_success GPGSM 'log OpenPGP fingerprint' '
1623 echo "D4BE22311AD3131E5EDA29A461092E85B7227189" > expect &&
1624 git log -n1 --format="%GP" signed-subkey >actual &&
1625 test_cmp expect actual
1628 test_expect_success GPG 'log --graph --show-signature' '
1629 git log --graph --show-signature -n1 signed >actual &&
1630 grep "^| gpg: Signature made" actual &&
1631 grep "^| gpg: Good signature" actual
1634 test_expect_success GPGSM 'log --graph --show-signature x509' '
1635 git log --graph --show-signature -n1 signed-x509 >actual &&
1636 grep "^| gpgsm: Signature made" actual &&
1637 grep "^| gpgsm: Good signature" actual
1640 test_expect_success GPG 'log --graph --show-signature for merged tag' '
1641 test_when_finished "git reset --hard && git checkout master" &&
1642 git checkout -b plain master &&
1645 git commit -m bar_commit &&
1646 git checkout -b tagged master &&
1649 git commit -m baz_commit &&
1650 git tag -s -m signed_tag_msg signed_tag &&
1651 git checkout plain &&
1652 git merge --no-ff -m msg signed_tag &&
1653 git log --graph --show-signature -n1 plain >actual &&
1654 grep "^|\\\ merged tag" actual &&
1655 grep "^| | gpg: Signature made" actual &&
1656 grep "^| | gpg: Good signature" actual
1659 test_expect_success GPG 'log --graph --show-signature for merged tag in shallow clone' '
1660 test_when_finished "git reset --hard && git checkout master" &&
1661 git checkout -b plain-shallow master &&
1664 git commit -m bar_commit &&
1665 git checkout --detach master &&
1668 git commit -m baz_commit &&
1669 git tag -s -m signed_tag_msg signed_tag_shallow &&
1670 hash=$(git rev-parse HEAD) &&
1671 git checkout plain-shallow &&
1672 git merge --no-ff -m msg signed_tag_shallow &&
1673 git clone --depth 1 --no-local . shallow &&
1674 test_when_finished "rm -rf shallow" &&
1675 git -C shallow log --graph --show-signature -n1 plain-shallow >actual &&
1676 grep "tag signed_tag_shallow names a non-parent $hash" actual
1679 test_expect_success GPG 'log --graph --show-signature for merged tag with missing key' '
1680 test_when_finished "git reset --hard && git checkout master" &&
1681 git checkout -b plain-nokey master &&
1684 git commit -m bar_commit &&
1685 git checkout -b tagged-nokey master &&
1688 git commit -m baz_commit &&
1689 git tag -s -m signed_tag_msg signed_tag_nokey &&
1690 git checkout plain-nokey &&
1691 git merge --no-ff -m msg signed_tag_nokey &&
1692 GNUPGHOME=. git log --graph --show-signature -n1 plain-nokey >actual &&
1693 grep "^|\\\ merged tag" actual &&
1694 grep "^| | gpg: Signature made" actual &&
1695 grep -E "^| | gpg: Can'"'"'t check signature: (public key not found|No public key)" actual
1698 test_expect_success GPG 'log --graph --show-signature for merged tag with bad signature' '
1699 test_when_finished "git reset --hard && git checkout master" &&
1700 git checkout -b plain-bad master &&
1703 git commit -m bar_commit &&
1704 git checkout -b tagged-bad master &&
1707 git commit -m baz_commit &&
1708 git tag -s -m signed_tag_msg signed_tag_bad &&
1709 git cat-file tag signed_tag_bad >raw &&
1710 sed -e "s/signed_tag_msg/forged/" raw >forged &&
1711 git hash-object -w -t tag forged >forged.tag &&
1712 git checkout plain-bad &&
1713 git merge --no-ff -m msg "$(cat forged.tag)" &&
1714 git log --graph --show-signature -n1 plain-bad >actual &&
1715 grep "^|\\\ merged tag" actual &&
1716 grep "^| | gpg: Signature made" actual &&
1717 grep "^| | gpg: BAD signature from" actual
1720 test_expect_success GPG 'log --show-signature for merged tag with GPG failure' '
1721 test_when_finished "git reset --hard && git checkout master" &&
1722 git checkout -b plain-fail master &&
1725 git commit -m bar_commit &&
1726 git checkout -b tagged-fail master &&
1729 git commit -m baz_commit &&
1730 git tag -s -m signed_tag_msg signed_tag_fail &&
1731 git checkout plain-fail &&
1732 git merge --no-ff -m msg signed_tag_fail &&
1733 TMPDIR="$(pwd)/bogus" git log --show-signature -n1 plain-fail >actual &&
1734 grep "^merged tag" actual &&
1735 grep "^No signature" actual &&
1736 ! grep "^gpg: Signature made" actual
1739 test_expect_success GPGSM 'log --graph --show-signature for merged tag x509' '
1740 test_when_finished "git reset --hard && git checkout master" &&
1741 test_config gpg.format x509 &&
1742 test_config user.signingkey $GIT_COMMITTER_EMAIL &&
1743 git checkout -b plain-x509 master &&
1746 git commit -m bar_commit &&
1747 git checkout -b tagged-x509 master &&
1750 git commit -m baz_commit &&
1751 git tag -s -m signed_tag_msg signed_tag_x509 &&
1752 git checkout plain-x509 &&
1753 git merge --no-ff -m msg signed_tag_x509 &&
1754 git log --graph --show-signature -n1 plain-x509 >actual &&
1755 grep "^|\\\ merged tag" actual &&
1756 grep "^| | gpgsm: Signature made" actual &&
1757 grep "^| | gpgsm: Good signature" actual
1760 test_expect_success GPGSM 'log --graph --show-signature for merged tag x509 missing key' '
1761 test_when_finished "git reset --hard && git checkout master" &&
1762 test_config gpg.format x509 &&
1763 test_config user.signingkey $GIT_COMMITTER_EMAIL &&
1764 git checkout -b plain-x509-nokey master &&
1767 git commit -m bar_commit &&
1768 git checkout -b tagged-x509-nokey master &&
1771 git commit -m baz_commit &&
1772 git tag -s -m signed_tag_msg signed_tag_x509_nokey &&
1773 git checkout plain-x509-nokey &&
1774 git merge --no-ff -m msg signed_tag_x509_nokey &&
1775 GNUPGHOME=. git log --graph --show-signature -n1 plain-x509-nokey >actual &&
1776 grep "^|\\\ merged tag" actual &&
1777 grep "^| | gpgsm: certificate not found" actual
1780 test_expect_success GPGSM 'log --graph --show-signature for merged tag x509 bad signature' '
1781 test_when_finished "git reset --hard && git checkout master" &&
1782 test_config gpg.format x509 &&
1783 test_config user.signingkey $GIT_COMMITTER_EMAIL &&
1784 git checkout -b plain-x509-bad master &&
1787 git commit -m bar_commit &&
1788 git checkout -b tagged-x509-bad master &&
1791 git commit -m baz_commit &&
1792 git tag -s -m signed_tag_msg signed_tag_x509_bad &&
1793 git cat-file tag signed_tag_x509_bad >raw &&
1794 sed -e "s/signed_tag_msg/forged/" raw >forged &&
1795 git hash-object -w -t tag forged >forged.tag &&
1796 git checkout plain-x509-bad &&
1797 git merge --no-ff -m msg "$(cat forged.tag)" &&
1798 git log --graph --show-signature -n1 plain-x509-bad >actual &&
1799 grep "^|\\\ merged tag" actual &&
1800 grep "^| | gpgsm: Signature made" actual &&
1801 grep "^| | gpgsm: invalid signature" actual
1805 test_expect_success GPG '--no-show-signature overrides --show-signature' '
1806 git log -1 --show-signature --no-show-signature signed >actual &&
1807 ! grep "^gpg:" actual
1810 test_expect_success GPG 'log.showsignature=true behaves like --show-signature' '
1811 test_config log.showsignature true &&
1812 git log -1 signed >actual &&
1813 grep "gpg: Signature made" actual &&
1814 grep "gpg: Good signature" actual
1817 test_expect_success GPG '--no-show-signature overrides log.showsignature=true' '
1818 test_config log.showsignature true &&
1819 git log -1 --no-show-signature signed >actual &&
1820 ! grep "^gpg:" actual
1823 test_expect_success GPG '--show-signature overrides log.showsignature=false' '
1824 test_config log.showsignature false &&
1825 git log -1 --show-signature signed >actual &&
1826 grep "gpg: Signature made" actual &&
1827 grep "gpg: Good signature" actual
1830 test_expect_success 'log --graph --no-walk is forbidden' '
1831 test_must_fail git log --graph --no-walk
1834 test_expect_success 'log diagnoses bogus HEAD' '
1836 test_must_fail git -C empty log 2>stderr &&
1837 test_i18ngrep does.not.have.any.commits stderr &&
1838 echo 1234abcd >empty/.git/refs/heads/master &&
1839 test_must_fail git -C empty log 2>stderr &&
1840 test_i18ngrep broken stderr &&
1841 echo "ref: refs/heads/invalid.lock" >empty/.git/HEAD &&
1842 test_must_fail git -C empty log 2>stderr &&
1843 test_i18ngrep broken stderr &&
1844 test_must_fail git -C empty log --default totally-bogus 2>stderr &&
1845 test_i18ngrep broken stderr
1848 test_expect_success 'log does not default to HEAD when rev input is given' '
1849 git log --branches=does-not-exist >actual &&
1850 test_must_be_empty actual
1853 test_expect_success 'do not default to HEAD with ignored object on cmdline' '
1854 git log --ignore-missing $ZERO_OID >actual &&
1855 test_must_be_empty actual
1858 test_expect_success 'do not default to HEAD with ignored object on stdin' '
1859 echo $ZERO_OID | git log --ignore-missing --stdin >actual &&
1860 test_must_be_empty actual
1863 test_expect_success 'set up --source tests' '
1864 git checkout --orphan source-a &&
1867 git checkout -b source-b HEAD^ &&
1871 test_expect_success 'log --source paints branch names' '
1872 cat >expect <<-EOF &&
1873 $(git rev-parse --short :/three) source-b three
1874 $(git rev-parse --short :/two ) source-a two
1875 $(git rev-parse --short :/one ) source-b one
1877 git log --oneline --source source-a source-b >actual &&
1878 test_cmp expect actual
1881 test_expect_success 'log --source paints tag names' '
1882 git tag -m tagged source-tag &&
1883 cat >expect <<-EOF &&
1884 $(git rev-parse --short :/three) source-tag three
1885 $(git rev-parse --short :/two ) source-a two
1886 $(git rev-parse --short :/one ) source-tag one
1888 git log --oneline --source source-tag source-a >actual &&
1889 test_cmp expect actual
1892 test_expect_success 'log --source paints symmetric ranges' '
1893 cat >expect <<-EOF &&
1894 $(git rev-parse --short :/three) source-b three
1895 $(git rev-parse --short :/two ) source-a two
1897 git log --oneline --source source-a...source-b >actual &&
1898 test_cmp expect actual
1901 test_expect_success '--exclude-promisor-objects does not BUG-crash' '
1902 test_must_fail git log --exclude-promisor-objects source-a
1905 test_expect_success 'log --end-of-options' '
1906 git update-ref refs/heads/--source HEAD &&
1907 git log --end-of-options --source >actual &&
1909 test_cmp expect actual