Merge branch 'master' of github.com:git-l10n/git-po
[git.git] / t / t4202-log.sh
blob4694b6d0ce7170e141c17082285772730e499b3e
1 #!/bin/sh
3 test_description='git log'
5 . ./test-lib.sh
6 . "$TEST_DIRECTORY/lib-gpg.sh"
7 . "$TEST_DIRECTORY/lib-terminal.sh"
8 . "$TEST_DIRECTORY/lib-log-graph.sh"
10 test_cmp_graph () {
11 lib_test_cmp_graph --format=%s "$@"
14 test_expect_success setup '
16 echo one >one &&
17 git add one &&
18 test_tick &&
19 git commit -m initial &&
21 echo ichi >one &&
22 git add one &&
23 test_tick &&
24 git commit -m second &&
26 git mv one ichi &&
27 test_tick &&
28 git commit -m third &&
30 cp ichi ein &&
31 git add ein &&
32 test_tick &&
33 git commit -m fourth &&
35 mkdir a &&
36 echo ni >a/two &&
37 git add a/two &&
38 test_tick &&
39 git commit -m fifth &&
41 git rm a/two &&
42 test_tick &&
43 git commit -m sixth
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
73 cat > expect << EOF
74 This is
75 the sixth
76 commit.
77 This is
78 the fifth
79 commit.
80 EOF
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
94 cat > expect << EOF
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 &&
171 git log --
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) &&
177 expect="third" &&
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)"
183 cat > expect << EOF
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
198 cat > expect << EOF
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
208 cat > expect << EOF
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' '
224 echo case >one &&
225 test_tick &&
226 git add one &&
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
236 cat > expect << EOF
237 second
238 initial
240 test_expect_success 'log --invert-grep --grep' '
241 # Fixed
242 git -c grep.patternType=fixed log --pretty="tformat:%s" --invert-grep --grep=th --grep=Sec >actual &&
243 test_cmp expect actual &&
245 # POSIX basic
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 &&
249 # POSIX extended
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 &&
253 # PCRE
254 if test_have_prereq PCRE
255 then
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 &&
264 # Fixed
265 git -c grep.patternType=fixed log --pretty="tformat:%s" --invert-grep -i --grep=th --grep=Sec >actual &&
266 test_cmp expect actual &&
268 # POSIX basic
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 &&
272 # POSIX extended
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 &&
276 # PCRE
277 if test_have_prereq PCRE
278 then
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 &&
300 # Fixed
301 git log -1 --pretty="tformat:%s" --grep=sec -i >actual &&
302 test_cmp expect actual &&
304 # POSIX basic
305 git -c grep.patternType=basic log -1 --pretty="tformat:%s" --grep=s[e]c -i >actual &&
306 test_cmp expect actual &&
308 # POSIX extended
309 git -c grep.patternType=extended log -1 --pretty="tformat:%s" --grep=s[e]c -i >actual &&
310 test_cmp expect actual &&
312 # PCRE
313 if test_have_prereq PCRE
314 then
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 &&
331 cd num_commits &&
332 test_commit 1d &&
333 test_commit 2e
334 ) &&
336 # In PCRE \d in [\d] is like saying "0-9", and matches the 2
337 # in 2e...
338 echo 2e >expect &&
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.
344 echo 1d >expect &&
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 &&
365 cd 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
394 then
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
400 # match neither.
401 git -c grep.patternType=perl log --pretty=tformat:%s \
402 --grep="[\d]\|" >actual.perl &&
403 test_cmp expect.perl actual.perl
404 fi &&
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
414 then
415 git log --pretty=tformat:%s -P \
416 --grep="[\d]\|" >actual.perl.short-arg
417 else
418 test_must_fail git log -P \
419 --grep="[\d]\|"
420 fi &&
421 test_cmp expect.fixed actual.fixed.short-arg &&
422 test_cmp expect.extended actual.extended.short-arg &&
423 if test_have_prereq PCRE
424 then
425 test_cmp expect.perl actual.perl.short-arg
426 fi &&
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
435 then
436 git log --pretty=tformat:%s --perl-regexp \
437 --grep="[\d]\|" >actual.perl.long-arg &&
438 test_cmp expect.perl actual.perl.long-arg
439 else
440 test_must_fail git log --perl-regexp \
441 --grep="[\d]\|"
442 fi &&
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
449 cat > expect <<EOF
450 * Second
451 * sixth
452 * fifth
453 * fourth
454 * third
455 * second
456 * initial
459 test_expect_success 'simple log --graph' '
460 test_cmp_graph
463 cat > expect <<EOF
464 123 * Second
465 123 * sixth
466 123 * fifth
467 123 * fourth
468 123 * third
469 123 * second
470 123 * initial
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 &&
482 git merge side
485 cat > expect <<\EOF
486 * Merge branch 'side'
488 | * side-2
489 | * side-1
490 * | Second
491 * | sixth
492 * | fifth
493 * | fourth
495 * third
496 * second
497 * initial
500 test_expect_success 'log --graph with merge' '
501 test_cmp_graph --date-order
504 cat > expect <<\EOF
505 | | | * Merge branch 'side'
506 | | | |\
507 | | | | * side-2
508 | | | | * side-1
509 | | | * | Second
510 | | | * | sixth
511 | | | * | fifth
512 | | | * | fourth
513 | | | |/
514 | | | * third
515 | | | * second
516 | | | * initial
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>
533 * third
534 * second
535 * initial
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 &&
550 grep "one" actual
553 cat > expect <<\EOF
554 * commit master
555 |\ Merge: A B
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>
563 | | side-2
565 | * commit tags/side-1
566 | | Author: A U Thor <author@example.com>
568 | | side-1
570 * | commit master~1
571 | | Author: A U Thor <author@example.com>
573 | | Second
575 * | commit master~2
576 | | Author: A U Thor <author@example.com>
578 | | sixth
580 * | commit master~3
581 | | Author: A U Thor <author@example.com>
583 | | fifth
585 * | commit master~4
586 |/ Author: A U Thor <author@example.com>
588 | fourth
590 * commit tags/side-1~1
591 | Author: A U Thor <author@example.com>
593 | third
595 * commit tags/side-1~2
596 | Author: A U Thor <author@example.com>
598 | second
600 * commit tags/side-1~3
601 Author: A U Thor <author@example.com>
603 initial
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 &&
617 git merge side~1 &&
618 git checkout master &&
619 git merge tangle &&
620 git checkout -b reach &&
621 test_commit 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 &&
631 git merge reach
634 cat > expect <<\EOF
635 * Merge tag 'reach'
639 *-. \ Merge tags 'octopus-a' and 'octopus-b'
640 |\ \ \
641 * | | | seventh
642 | | * | octopus-b
643 | |/ /
644 |/| |
645 | * | octopus-a
646 |/ /
647 | * reach
649 * Merge branch 'tangle'
651 | * Merge branch 'side' (early part) into tangle
652 | |\
653 | * \ Merge branch 'master' (early part) into tangle
654 | |\ \
655 | * | | tangle-a
656 * | | | Merge branch 'side'
657 |\ \ \ \
658 | * | | | side-2
659 | | |_|/
660 | |/| |
661 | * | | side-1
662 * | | | Second
663 * | | | sixth
664 | |_|/
665 |/| |
666 * | | fifth
667 * | | fourth
668 |/ /
669 * / third
671 * second
672 * initial
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 &&
738 Merge-tag-reach
739 Merge-tags-octopus-a-and-octopus-b
740 seventh
741 octopus-b (octopus-b)
742 octopus-a (octopus-a)
743 reach
745 git log -n6 --decorate=short --pretty="tformat:%f%d" \
746 --decorate-refs="heads/octopus*" >actual &&
747 test_cmp expect.decorate actual
750 test_expect_success 'decorate-refs without globs' '
751 cat >expect.decorate <<-\EOF &&
752 Merge-tag-reach
753 Merge-tags-octopus-a-and-octopus-b
754 seventh
755 octopus-b
756 octopus-a
757 reach (tag: reach)
759 git log -n6 --decorate=short --pretty="tformat:%f%d" \
760 --decorate-refs="tags/reach" >actual &&
761 test_cmp expect.decorate actual
764 test_expect_success 'multiple decorate-refs' '
765 cat >expect.decorate <<-\EOF &&
766 Merge-tag-reach
767 Merge-tags-octopus-a-and-octopus-b
768 seventh
769 octopus-b (octopus-b)
770 octopus-a (octopus-a)
771 reach (tag: reach)
773 git log -n6 --decorate=short --pretty="tformat:%f%d" \
774 --decorate-refs="heads/octopus*" \
775 --decorate-refs="tags/reach" >actual &&
776 test_cmp expect.decorate actual
779 test_expect_success 'decorate-refs-exclude with glob' '
780 cat >expect.decorate <<-\EOF &&
781 Merge-tag-reach (HEAD -> master)
782 Merge-tags-octopus-a-and-octopus-b
783 seventh (tag: seventh)
784 octopus-b (tag: octopus-b)
785 octopus-a (tag: octopus-a)
786 reach (tag: reach, reach)
788 git log -n6 --decorate=short --pretty="tformat:%f%d" \
789 --decorate-refs-exclude="heads/octopus*" >actual &&
790 test_cmp expect.decorate actual
793 test_expect_success 'decorate-refs-exclude without globs' '
794 cat >expect.decorate <<-\EOF &&
795 Merge-tag-reach (HEAD -> master)
796 Merge-tags-octopus-a-and-octopus-b
797 seventh (tag: seventh)
798 octopus-b (tag: octopus-b, octopus-b)
799 octopus-a (tag: octopus-a, octopus-a)
800 reach (reach)
802 git log -n6 --decorate=short --pretty="tformat:%f%d" \
803 --decorate-refs-exclude="tags/reach" >actual &&
804 test_cmp expect.decorate actual
807 test_expect_success 'multiple decorate-refs-exclude' '
808 cat >expect.decorate <<-\EOF &&
809 Merge-tag-reach (HEAD -> master)
810 Merge-tags-octopus-a-and-octopus-b
811 seventh (tag: seventh)
812 octopus-b (tag: octopus-b)
813 octopus-a (tag: octopus-a)
814 reach (reach)
816 git log -n6 --decorate=short --pretty="tformat:%f%d" \
817 --decorate-refs-exclude="heads/octopus*" \
818 --decorate-refs-exclude="tags/reach" >actual &&
819 test_cmp expect.decorate actual
822 test_expect_success 'decorate-refs and decorate-refs-exclude' '
823 cat >expect.decorate <<-\EOF &&
824 Merge-tag-reach (master)
825 Merge-tags-octopus-a-and-octopus-b
826 seventh
827 octopus-b
828 octopus-a
829 reach (reach)
831 git log -n6 --decorate=short --pretty="tformat:%f%d" \
832 --decorate-refs="heads/*" \
833 --decorate-refs-exclude="heads/oc*" >actual &&
834 test_cmp expect.decorate actual
837 test_expect_success 'decorate-refs-exclude and simplify-by-decoration' '
838 cat >expect.decorate <<-\EOF &&
839 Merge-tag-reach (HEAD -> master)
840 reach (tag: reach, reach)
841 seventh (tag: seventh)
842 Merge-branch-tangle
843 Merge-branch-side-early-part-into-tangle (tangle)
844 tangle-a (tag: tangle-a)
846 git log -n6 --decorate=short --pretty="tformat:%f%d" \
847 --decorate-refs-exclude="*octopus*" \
848 --simplify-by-decoration >actual &&
849 test_cmp expect.decorate actual
852 test_expect_success 'log.decorate config parsing' '
853 git log --oneline --decorate=full >expect.full &&
854 git log --oneline --decorate=short >expect.short &&
856 test_config log.decorate full &&
857 test_config log.mailmap true &&
858 git log --oneline >actual &&
859 test_cmp expect.full actual &&
860 git log --oneline --decorate=short >actual &&
861 test_cmp expect.short actual
864 test_expect_success TTY 'log output on a TTY' '
865 git log --color --oneline --decorate >expect.short &&
867 test_terminal git log --oneline >actual &&
868 test_cmp expect.short actual
871 test_expect_success 'reflog is expected format' '
872 git log -g --abbrev-commit --pretty=oneline >expect &&
873 git reflog >actual &&
874 test_cmp expect actual
877 test_expect_success 'whatchanged is expected format' '
878 git log --no-merges --raw >expect &&
879 git whatchanged >actual &&
880 test_cmp expect actual
883 test_expect_success 'log.abbrevCommit configuration' '
884 git log --abbrev-commit >expect.log.abbrev &&
885 git log --no-abbrev-commit >expect.log.full &&
886 git log --pretty=raw >expect.log.raw &&
887 git reflog --abbrev-commit >expect.reflog.abbrev &&
888 git reflog --no-abbrev-commit >expect.reflog.full &&
889 git whatchanged --abbrev-commit >expect.whatchanged.abbrev &&
890 git whatchanged --no-abbrev-commit >expect.whatchanged.full &&
892 test_config log.abbrevCommit true &&
894 git log >actual &&
895 test_cmp expect.log.abbrev actual &&
896 git log --no-abbrev-commit >actual &&
897 test_cmp expect.log.full actual &&
899 git log --pretty=raw >actual &&
900 test_cmp expect.log.raw actual &&
902 git reflog >actual &&
903 test_cmp expect.reflog.abbrev actual &&
904 git reflog --no-abbrev-commit >actual &&
905 test_cmp expect.reflog.full actual &&
907 git whatchanged >actual &&
908 test_cmp expect.whatchanged.abbrev actual &&
909 git whatchanged --no-abbrev-commit >actual &&
910 test_cmp expect.whatchanged.full actual
913 test_expect_success 'show added path under "--follow -M"' '
914 # This tests for a regression introduced in v1.7.2-rc0~103^2~2
915 test_create_repo regression &&
917 cd regression &&
918 test_commit needs-another-commit &&
919 test_commit foo.bar &&
920 git log -M --follow -p foo.bar.t &&
921 git log -M --follow --stat foo.bar.t &&
922 git log -M --follow --name-only foo.bar.t
926 test_expect_success 'git log -c --follow' '
927 test_create_repo follow-c &&
929 cd follow-c &&
930 test_commit initial file original &&
931 git rm file &&
932 test_commit rename file2 original &&
933 git reset --hard initial &&
934 test_commit modify file foo &&
935 git merge -m merge rename &&
936 git log -c --follow file2
940 cat >expect <<\EOF
941 * commit COMMIT_OBJECT_NAME
942 |\ Merge: MERGE_PARENTS
943 | | Author: A U Thor <author@example.com>
945 | | Merge HEADS DESCRIPTION
947 | * commit COMMIT_OBJECT_NAME
948 | | Author: A U Thor <author@example.com>
950 | | reach
951 | | ---
952 | | reach.t | 1 +
953 | | 1 file changed, 1 insertion(+)
955 | | diff --git a/reach.t b/reach.t
956 | | new file mode 100644
957 | | index BEFORE..AFTER
958 | | --- /dev/null
959 | | +++ b/reach.t
960 | | @@ -0,0 +1 @@
961 | | +reach
964 *-. \ commit COMMIT_OBJECT_NAME
965 |\ \ \ Merge: MERGE_PARENTS
966 | | | | Author: A U Thor <author@example.com>
967 | | | |
968 | | | | Merge HEADS DESCRIPTION
969 | | | |
970 | | * | commit COMMIT_OBJECT_NAME
971 | | |/ Author: A U Thor <author@example.com>
972 | | |
973 | | | octopus-b
974 | | | ---
975 | | | octopus-b.t | 1 +
976 | | | 1 file changed, 1 insertion(+)
977 | | |
978 | | | diff --git a/octopus-b.t b/octopus-b.t
979 | | | new file mode 100644
980 | | | index BEFORE..AFTER
981 | | | --- /dev/null
982 | | | +++ b/octopus-b.t
983 | | | @@ -0,0 +1 @@
984 | | | +octopus-b
985 | | |
986 | * | commit COMMIT_OBJECT_NAME
987 | |/ Author: A U Thor <author@example.com>
989 | | octopus-a
990 | | ---
991 | | octopus-a.t | 1 +
992 | | 1 file changed, 1 insertion(+)
994 | | diff --git a/octopus-a.t b/octopus-a.t
995 | | new file mode 100644
996 | | index BEFORE..AFTER
997 | | --- /dev/null
998 | | +++ b/octopus-a.t
999 | | @@ -0,0 +1 @@
1000 | | +octopus-a
1002 * | commit COMMIT_OBJECT_NAME
1003 |/ Author: A U Thor <author@example.com>
1005 | seventh
1006 | ---
1007 | seventh.t | 1 +
1008 | 1 file changed, 1 insertion(+)
1010 | diff --git a/seventh.t b/seventh.t
1011 | new file mode 100644
1012 | index BEFORE..AFTER
1013 | --- /dev/null
1014 | +++ b/seventh.t
1015 | @@ -0,0 +1 @@
1016 | +seventh
1018 * commit COMMIT_OBJECT_NAME
1019 |\ Merge: MERGE_PARENTS
1020 | | Author: A U Thor <author@example.com>
1022 | | Merge branch 'tangle'
1024 | * commit COMMIT_OBJECT_NAME
1025 | |\ Merge: MERGE_PARENTS
1026 | | | Author: A U Thor <author@example.com>
1027 | | |
1028 | | | Merge branch 'side' (early part) into tangle
1029 | | |
1030 | * | commit COMMIT_OBJECT_NAME
1031 | |\ \ Merge: MERGE_PARENTS
1032 | | | | Author: A U Thor <author@example.com>
1033 | | | |
1034 | | | | Merge branch 'master' (early part) into tangle
1035 | | | |
1036 | * | | commit COMMIT_OBJECT_NAME
1037 | | | | Author: A U Thor <author@example.com>
1038 | | | |
1039 | | | | tangle-a
1040 | | | | ---
1041 | | | | tangle-a | 1 +
1042 | | | | 1 file changed, 1 insertion(+)
1043 | | | |
1044 | | | | diff --git a/tangle-a b/tangle-a
1045 | | | | new file mode 100644
1046 | | | | index BEFORE..AFTER
1047 | | | | --- /dev/null
1048 | | | | +++ b/tangle-a
1049 | | | | @@ -0,0 +1 @@
1050 | | | | +a
1051 | | | |
1052 * | | | commit COMMIT_OBJECT_NAME
1053 |\ \ \ \ Merge: MERGE_PARENTS
1054 | | | | | Author: A U Thor <author@example.com>
1055 | | | | |
1056 | | | | | Merge branch 'side'
1057 | | | | |
1058 | * | | | commit COMMIT_OBJECT_NAME
1059 | | |_|/ Author: A U Thor <author@example.com>
1060 | |/| |
1061 | | | | side-2
1062 | | | | ---
1063 | | | | 2 | 1 +
1064 | | | | 1 file changed, 1 insertion(+)
1065 | | | |
1066 | | | | diff --git a/2 b/2
1067 | | | | new file mode 100644
1068 | | | | index BEFORE..AFTER
1069 | | | | --- /dev/null
1070 | | | | +++ b/2
1071 | | | | @@ -0,0 +1 @@
1072 | | | | +2
1073 | | | |
1074 | * | | commit COMMIT_OBJECT_NAME
1075 | | | | Author: A U Thor <author@example.com>
1076 | | | |
1077 | | | | side-1
1078 | | | | ---
1079 | | | | 1 | 1 +
1080 | | | | 1 file changed, 1 insertion(+)
1081 | | | |
1082 | | | | diff --git a/1 b/1
1083 | | | | new file mode 100644
1084 | | | | index BEFORE..AFTER
1085 | | | | --- /dev/null
1086 | | | | +++ b/1
1087 | | | | @@ -0,0 +1 @@
1088 | | | | +1
1089 | | | |
1090 * | | | commit COMMIT_OBJECT_NAME
1091 | | | | Author: A U Thor <author@example.com>
1092 | | | |
1093 | | | | Second
1094 | | | | ---
1095 | | | | one | 1 +
1096 | | | | 1 file changed, 1 insertion(+)
1097 | | | |
1098 | | | | diff --git a/one b/one
1099 | | | | new file mode 100644
1100 | | | | index BEFORE..AFTER
1101 | | | | --- /dev/null
1102 | | | | +++ b/one
1103 | | | | @@ -0,0 +1 @@
1104 | | | | +case
1105 | | | |
1106 * | | | commit COMMIT_OBJECT_NAME
1107 | |_|/ Author: A U Thor <author@example.com>
1108 |/| |
1109 | | | sixth
1110 | | | ---
1111 | | | a/two | 1 -
1112 | | | 1 file changed, 1 deletion(-)
1113 | | |
1114 | | | diff --git a/a/two b/a/two
1115 | | | deleted file mode 100644
1116 | | | index BEFORE..AFTER
1117 | | | --- a/a/two
1118 | | | +++ /dev/null
1119 | | | @@ -1 +0,0 @@
1120 | | | -ni
1121 | | |
1122 * | | commit COMMIT_OBJECT_NAME
1123 | | | Author: A U Thor <author@example.com>
1124 | | |
1125 | | | fifth
1126 | | | ---
1127 | | | a/two | 1 +
1128 | | | 1 file changed, 1 insertion(+)
1129 | | |
1130 | | | diff --git a/a/two b/a/two
1131 | | | new file mode 100644
1132 | | | index BEFORE..AFTER
1133 | | | --- /dev/null
1134 | | | +++ b/a/two
1135 | | | @@ -0,0 +1 @@
1136 | | | +ni
1137 | | |
1138 * | | commit COMMIT_OBJECT_NAME
1139 |/ / Author: A U Thor <author@example.com>
1141 | | fourth
1142 | | ---
1143 | | ein | 1 +
1144 | | 1 file changed, 1 insertion(+)
1146 | | diff --git a/ein b/ein
1147 | | new file mode 100644
1148 | | index BEFORE..AFTER
1149 | | --- /dev/null
1150 | | +++ b/ein
1151 | | @@ -0,0 +1 @@
1152 | | +ichi
1154 * | commit COMMIT_OBJECT_NAME
1155 |/ Author: A U Thor <author@example.com>
1157 | third
1158 | ---
1159 | ichi | 1 +
1160 | one | 1 -
1161 | 2 files changed, 1 insertion(+), 1 deletion(-)
1163 | diff --git a/ichi b/ichi
1164 | new file mode 100644
1165 | index BEFORE..AFTER
1166 | --- /dev/null
1167 | +++ b/ichi
1168 | @@ -0,0 +1 @@
1169 | +ichi
1170 | diff --git a/one b/one
1171 | deleted file mode 100644
1172 | index BEFORE..AFTER
1173 | --- a/one
1174 | +++ /dev/null
1175 | @@ -1 +0,0 @@
1176 | -ichi
1178 * commit COMMIT_OBJECT_NAME
1179 | Author: A U Thor <author@example.com>
1181 | second
1182 | ---
1183 | one | 2 +-
1184 | 1 file changed, 1 insertion(+), 1 deletion(-)
1186 | diff --git a/one b/one
1187 | index BEFORE..AFTER 100644
1188 | --- a/one
1189 | +++ b/one
1190 | @@ -1 +1 @@
1191 | -one
1192 | +ichi
1194 * commit COMMIT_OBJECT_NAME
1195 Author: A U Thor <author@example.com>
1197 initial
1199 one | 1 +
1200 1 file changed, 1 insertion(+)
1202 diff --git a/one b/one
1203 new file mode 100644
1204 index BEFORE..AFTER
1205 --- /dev/null
1206 +++ b/one
1207 @@ -0,0 +1 @@
1208 +one
1211 test_expect_success 'log --graph with diff and stats' '
1212 lib_test_cmp_short_graph --no-renames --stat -p
1215 cat >expect <<\EOF
1216 *** * commit COMMIT_OBJECT_NAME
1217 *** |\ Merge: MERGE_PARENTS
1218 *** | | Author: A U Thor <author@example.com>
1219 *** | |
1220 *** | | Merge HEADS DESCRIPTION
1221 *** | |
1222 *** | * commit COMMIT_OBJECT_NAME
1223 *** | | Author: A U Thor <author@example.com>
1224 *** | |
1225 *** | | reach
1226 *** | | ---
1227 *** | | reach.t | 1 +
1228 *** | | 1 file changed, 1 insertion(+)
1229 *** | |
1230 *** | | diff --git a/reach.t b/reach.t
1231 *** | | new file mode 100644
1232 *** | | index BEFORE..AFTER
1233 *** | | --- /dev/null
1234 *** | | +++ b/reach.t
1235 *** | | @@ -0,0 +1 @@
1236 *** | | +reach
1237 *** | |
1238 *** | \
1239 *** *-. \ commit COMMIT_OBJECT_NAME
1240 *** |\ \ \ Merge: MERGE_PARENTS
1241 *** | | | | Author: A U Thor <author@example.com>
1242 *** | | | |
1243 *** | | | | Merge HEADS DESCRIPTION
1244 *** | | | |
1245 *** | | * | commit COMMIT_OBJECT_NAME
1246 *** | | |/ Author: A U Thor <author@example.com>
1247 *** | | |
1248 *** | | | octopus-b
1249 *** | | | ---
1250 *** | | | octopus-b.t | 1 +
1251 *** | | | 1 file changed, 1 insertion(+)
1252 *** | | |
1253 *** | | | diff --git a/octopus-b.t b/octopus-b.t
1254 *** | | | new file mode 100644
1255 *** | | | index BEFORE..AFTER
1256 *** | | | --- /dev/null
1257 *** | | | +++ b/octopus-b.t
1258 *** | | | @@ -0,0 +1 @@
1259 *** | | | +octopus-b
1260 *** | | |
1261 *** | * | commit COMMIT_OBJECT_NAME
1262 *** | |/ Author: A U Thor <author@example.com>
1263 *** | |
1264 *** | | octopus-a
1265 *** | | ---
1266 *** | | octopus-a.t | 1 +
1267 *** | | 1 file changed, 1 insertion(+)
1268 *** | |
1269 *** | | diff --git a/octopus-a.t b/octopus-a.t
1270 *** | | new file mode 100644
1271 *** | | index BEFORE..AFTER
1272 *** | | --- /dev/null
1273 *** | | +++ b/octopus-a.t
1274 *** | | @@ -0,0 +1 @@
1275 *** | | +octopus-a
1276 *** | |
1277 *** * | commit COMMIT_OBJECT_NAME
1278 *** |/ Author: A U Thor <author@example.com>
1279 *** |
1280 *** | seventh
1281 *** | ---
1282 *** | seventh.t | 1 +
1283 *** | 1 file changed, 1 insertion(+)
1284 *** |
1285 *** | diff --git a/seventh.t b/seventh.t
1286 *** | new file mode 100644
1287 *** | index BEFORE..AFTER
1288 *** | --- /dev/null
1289 *** | +++ b/seventh.t
1290 *** | @@ -0,0 +1 @@
1291 *** | +seventh
1292 *** |
1293 *** * commit COMMIT_OBJECT_NAME
1294 *** |\ Merge: MERGE_PARENTS
1295 *** | | Author: A U Thor <author@example.com>
1296 *** | |
1297 *** | | Merge branch 'tangle'
1298 *** | |
1299 *** | * commit COMMIT_OBJECT_NAME
1300 *** | |\ Merge: MERGE_PARENTS
1301 *** | | | Author: A U Thor <author@example.com>
1302 *** | | |
1303 *** | | | Merge branch 'side' (early part) into tangle
1304 *** | | |
1305 *** | * | commit COMMIT_OBJECT_NAME
1306 *** | |\ \ Merge: MERGE_PARENTS
1307 *** | | | | Author: A U Thor <author@example.com>
1308 *** | | | |
1309 *** | | | | Merge branch 'master' (early part) into tangle
1310 *** | | | |
1311 *** | * | | commit COMMIT_OBJECT_NAME
1312 *** | | | | Author: A U Thor <author@example.com>
1313 *** | | | |
1314 *** | | | | tangle-a
1315 *** | | | | ---
1316 *** | | | | tangle-a | 1 +
1317 *** | | | | 1 file changed, 1 insertion(+)
1318 *** | | | |
1319 *** | | | | diff --git a/tangle-a b/tangle-a
1320 *** | | | | new file mode 100644
1321 *** | | | | index BEFORE..AFTER
1322 *** | | | | --- /dev/null
1323 *** | | | | +++ b/tangle-a
1324 *** | | | | @@ -0,0 +1 @@
1325 *** | | | | +a
1326 *** | | | |
1327 *** * | | | commit COMMIT_OBJECT_NAME
1328 *** |\ \ \ \ Merge: MERGE_PARENTS
1329 *** | | | | | Author: A U Thor <author@example.com>
1330 *** | | | | |
1331 *** | | | | | Merge branch 'side'
1332 *** | | | | |
1333 *** | * | | | commit COMMIT_OBJECT_NAME
1334 *** | | |_|/ Author: A U Thor <author@example.com>
1335 *** | |/| |
1336 *** | | | | side-2
1337 *** | | | | ---
1338 *** | | | | 2 | 1 +
1339 *** | | | | 1 file changed, 1 insertion(+)
1340 *** | | | |
1341 *** | | | | diff --git a/2 b/2
1342 *** | | | | new file mode 100644
1343 *** | | | | index BEFORE..AFTER
1344 *** | | | | --- /dev/null
1345 *** | | | | +++ b/2
1346 *** | | | | @@ -0,0 +1 @@
1347 *** | | | | +2
1348 *** | | | |
1349 *** | * | | commit COMMIT_OBJECT_NAME
1350 *** | | | | Author: A U Thor <author@example.com>
1351 *** | | | |
1352 *** | | | | side-1
1353 *** | | | | ---
1354 *** | | | | 1 | 1 +
1355 *** | | | | 1 file changed, 1 insertion(+)
1356 *** | | | |
1357 *** | | | | diff --git a/1 b/1
1358 *** | | | | new file mode 100644
1359 *** | | | | index BEFORE..AFTER
1360 *** | | | | --- /dev/null
1361 *** | | | | +++ b/1
1362 *** | | | | @@ -0,0 +1 @@
1363 *** | | | | +1
1364 *** | | | |
1365 *** * | | | commit COMMIT_OBJECT_NAME
1366 *** | | | | Author: A U Thor <author@example.com>
1367 *** | | | |
1368 *** | | | | Second
1369 *** | | | | ---
1370 *** | | | | one | 1 +
1371 *** | | | | 1 file changed, 1 insertion(+)
1372 *** | | | |
1373 *** | | | | diff --git a/one b/one
1374 *** | | | | new file mode 100644
1375 *** | | | | index BEFORE..AFTER
1376 *** | | | | --- /dev/null
1377 *** | | | | +++ b/one
1378 *** | | | | @@ -0,0 +1 @@
1379 *** | | | | +case
1380 *** | | | |
1381 *** * | | | commit COMMIT_OBJECT_NAME
1382 *** | |_|/ Author: A U Thor <author@example.com>
1383 *** |/| |
1384 *** | | | sixth
1385 *** | | | ---
1386 *** | | | a/two | 1 -
1387 *** | | | 1 file changed, 1 deletion(-)
1388 *** | | |
1389 *** | | | diff --git a/a/two b/a/two
1390 *** | | | deleted file mode 100644
1391 *** | | | index BEFORE..AFTER
1392 *** | | | --- a/a/two
1393 *** | | | +++ /dev/null
1394 *** | | | @@ -1 +0,0 @@
1395 *** | | | -ni
1396 *** | | |
1397 *** * | | commit COMMIT_OBJECT_NAME
1398 *** | | | Author: A U Thor <author@example.com>
1399 *** | | |
1400 *** | | | fifth
1401 *** | | | ---
1402 *** | | | a/two | 1 +
1403 *** | | | 1 file changed, 1 insertion(+)
1404 *** | | |
1405 *** | | | diff --git a/a/two b/a/two
1406 *** | | | new file mode 100644
1407 *** | | | index BEFORE..AFTER
1408 *** | | | --- /dev/null
1409 *** | | | +++ b/a/two
1410 *** | | | @@ -0,0 +1 @@
1411 *** | | | +ni
1412 *** | | |
1413 *** * | | commit COMMIT_OBJECT_NAME
1414 *** |/ / Author: A U Thor <author@example.com>
1415 *** | |
1416 *** | | fourth
1417 *** | | ---
1418 *** | | ein | 1 +
1419 *** | | 1 file changed, 1 insertion(+)
1420 *** | |
1421 *** | | diff --git a/ein b/ein
1422 *** | | new file mode 100644
1423 *** | | index BEFORE..AFTER
1424 *** | | --- /dev/null
1425 *** | | +++ b/ein
1426 *** | | @@ -0,0 +1 @@
1427 *** | | +ichi
1428 *** | |
1429 *** * | commit COMMIT_OBJECT_NAME
1430 *** |/ Author: A U Thor <author@example.com>
1431 *** |
1432 *** | third
1433 *** | ---
1434 *** | ichi | 1 +
1435 *** | one | 1 -
1436 *** | 2 files changed, 1 insertion(+), 1 deletion(-)
1437 *** |
1438 *** | diff --git a/ichi b/ichi
1439 *** | new file mode 100644
1440 *** | index BEFORE..AFTER
1441 *** | --- /dev/null
1442 *** | +++ b/ichi
1443 *** | @@ -0,0 +1 @@
1444 *** | +ichi
1445 *** | diff --git a/one b/one
1446 *** | deleted file mode 100644
1447 *** | index BEFORE..AFTER
1448 *** | --- a/one
1449 *** | +++ /dev/null
1450 *** | @@ -1 +0,0 @@
1451 *** | -ichi
1452 *** |
1453 *** * commit COMMIT_OBJECT_NAME
1454 *** | Author: A U Thor <author@example.com>
1455 *** |
1456 *** | second
1457 *** | ---
1458 *** | one | 2 +-
1459 *** | 1 file changed, 1 insertion(+), 1 deletion(-)
1460 *** |
1461 *** | diff --git a/one b/one
1462 *** | index BEFORE..AFTER 100644
1463 *** | --- a/one
1464 *** | +++ b/one
1465 *** | @@ -1 +1 @@
1466 *** | -one
1467 *** | +ichi
1468 *** |
1469 *** * commit COMMIT_OBJECT_NAME
1470 *** Author: A U Thor <author@example.com>
1472 *** initial
1473 *** ---
1474 *** one | 1 +
1475 *** 1 file changed, 1 insertion(+)
1477 *** diff --git a/one b/one
1478 *** new file mode 100644
1479 *** index BEFORE..AFTER
1480 *** --- /dev/null
1481 *** +++ b/one
1482 *** @@ -0,0 +1 @@
1483 *** +one
1486 test_expect_success 'log --line-prefix="*** " --graph with diff and stats' '
1487 lib_test_cmp_short_graph --line-prefix="*** " --no-renames --stat -p
1490 cat >expect <<-\EOF
1491 * reach
1493 | A reach.t
1494 * Merge branch 'tangle'
1495 * Merge branch 'side'
1497 | * side-2
1499 | A 2
1500 * Second
1502 | A one
1503 * sixth
1505 D a/two
1508 test_expect_success 'log --graph with --name-status' '
1509 test_cmp_graph --name-status tangle..reach
1512 cat >expect <<-\EOF
1513 * reach
1515 | reach.t
1516 * Merge branch 'tangle'
1517 * Merge branch 'side'
1519 | * side-2
1522 * Second
1524 | one
1525 * sixth
1527 a/two
1530 test_expect_success 'log --graph with --name-only' '
1531 test_cmp_graph --name-only tangle..reach
1534 test_expect_success 'dotdot is a parent directory' '
1535 mkdir -p a/b &&
1536 ( echo sixth && echo fifth ) >expect &&
1537 ( cd a/b && git log --format=%s .. ) >actual &&
1538 test_cmp expect actual
1541 test_expect_success GPG 'setup signed branch' '
1542 test_when_finished "git reset --hard && git checkout master" &&
1543 git checkout -b signed master &&
1544 echo foo >foo &&
1545 git add foo &&
1546 git commit -S -m signed_commit
1549 test_expect_success GPG 'setup signed branch with subkey' '
1550 test_when_finished "git reset --hard && git checkout master" &&
1551 git checkout -b signed-subkey master &&
1552 echo foo >foo &&
1553 git add foo &&
1554 git commit -SB7227189 -m signed_commit
1557 test_expect_success GPGSM 'setup signed branch x509' '
1558 test_when_finished "git reset --hard && git checkout master" &&
1559 git checkout -b signed-x509 master &&
1560 echo foo >foo &&
1561 git add foo &&
1562 test_config gpg.format x509 &&
1563 test_config user.signingkey $GIT_COMMITTER_EMAIL &&
1564 git commit -S -m signed_commit
1567 test_expect_success GPGSM 'log x509 fingerprint' '
1568 echo "F8BF62E0693D0694816377099909C779FA23FD65 | " >expect &&
1569 git log -n1 --format="%GF | %GP" signed-x509 >actual &&
1570 test_cmp expect actual
1573 test_expect_success GPGSM 'log OpenPGP fingerprint' '
1574 echo "D4BE22311AD3131E5EDA29A461092E85B7227189" > expect &&
1575 git log -n1 --format="%GP" signed-subkey >actual &&
1576 test_cmp expect actual
1579 test_expect_success GPG 'log --graph --show-signature' '
1580 git log --graph --show-signature -n1 signed >actual &&
1581 grep "^| gpg: Signature made" actual &&
1582 grep "^| gpg: Good signature" actual
1585 test_expect_success GPGSM 'log --graph --show-signature x509' '
1586 git log --graph --show-signature -n1 signed-x509 >actual &&
1587 grep "^| gpgsm: Signature made" actual &&
1588 grep "^| gpgsm: Good signature" actual
1591 test_expect_success GPG 'log --graph --show-signature for merged tag' '
1592 test_when_finished "git reset --hard && git checkout master" &&
1593 git checkout -b plain master &&
1594 echo aaa >bar &&
1595 git add bar &&
1596 git commit -m bar_commit &&
1597 git checkout -b tagged master &&
1598 echo bbb >baz &&
1599 git add baz &&
1600 git commit -m baz_commit &&
1601 git tag -s -m signed_tag_msg signed_tag &&
1602 git checkout plain &&
1603 git merge --no-ff -m msg signed_tag &&
1604 git log --graph --show-signature -n1 plain >actual &&
1605 grep "^|\\\ merged tag" actual &&
1606 grep "^| | gpg: Signature made" actual &&
1607 grep "^| | gpg: Good signature" actual
1610 test_expect_success GPGSM 'log --graph --show-signature for merged tag x509' '
1611 test_when_finished "git reset --hard && git checkout master" &&
1612 test_config gpg.format x509 &&
1613 test_config user.signingkey $GIT_COMMITTER_EMAIL &&
1614 git checkout -b plain-x509 master &&
1615 echo aaa >bar &&
1616 git add bar &&
1617 git commit -m bar_commit &&
1618 git checkout -b tagged-x509 master &&
1619 echo bbb >baz &&
1620 git add baz &&
1621 git commit -m baz_commit &&
1622 git tag -s -m signed_tag_msg signed_tag_x509 &&
1623 git checkout plain-x509 &&
1624 git merge --no-ff -m msg signed_tag_x509 &&
1625 git log --graph --show-signature -n1 plain-x509 >actual &&
1626 grep "^|\\\ merged tag" actual &&
1627 grep "^| | gpgsm: Signature made" actual &&
1628 grep "^| | gpgsm: Good signature" actual
1631 test_expect_success GPG '--no-show-signature overrides --show-signature' '
1632 git log -1 --show-signature --no-show-signature signed >actual &&
1633 ! grep "^gpg:" actual
1636 test_expect_success GPG 'log.showsignature=true behaves like --show-signature' '
1637 test_config log.showsignature true &&
1638 git log -1 signed >actual &&
1639 grep "gpg: Signature made" actual &&
1640 grep "gpg: Good signature" actual
1643 test_expect_success GPG '--no-show-signature overrides log.showsignature=true' '
1644 test_config log.showsignature true &&
1645 git log -1 --no-show-signature signed >actual &&
1646 ! grep "^gpg:" actual
1649 test_expect_success GPG '--show-signature overrides log.showsignature=false' '
1650 test_config log.showsignature false &&
1651 git log -1 --show-signature signed >actual &&
1652 grep "gpg: Signature made" actual &&
1653 grep "gpg: Good signature" actual
1656 test_expect_success 'log --graph --no-walk is forbidden' '
1657 test_must_fail git log --graph --no-walk
1660 test_expect_success 'log diagnoses bogus HEAD' '
1661 git init empty &&
1662 test_must_fail git -C empty log 2>stderr &&
1663 test_i18ngrep does.not.have.any.commits stderr &&
1664 echo 1234abcd >empty/.git/refs/heads/master &&
1665 test_must_fail git -C empty log 2>stderr &&
1666 test_i18ngrep broken stderr &&
1667 echo "ref: refs/heads/invalid.lock" >empty/.git/HEAD &&
1668 test_must_fail git -C empty log 2>stderr &&
1669 test_i18ngrep broken stderr &&
1670 test_must_fail git -C empty log --default totally-bogus 2>stderr &&
1671 test_i18ngrep broken stderr
1674 test_expect_success 'log does not default to HEAD when rev input is given' '
1675 git log --branches=does-not-exist >actual &&
1676 test_must_be_empty actual
1679 test_expect_success 'set up --source tests' '
1680 git checkout --orphan source-a &&
1681 test_commit one &&
1682 test_commit two &&
1683 git checkout -b source-b HEAD^ &&
1684 test_commit three
1687 test_expect_success 'log --source paints branch names' '
1688 cat >expect <<-EOF &&
1689 $(git rev-parse --short :/three) source-b three
1690 $(git rev-parse --short :/two ) source-a two
1691 $(git rev-parse --short :/one ) source-b one
1693 git log --oneline --source source-a source-b >actual &&
1694 test_cmp expect actual
1697 test_expect_success 'log --source paints tag names' '
1698 git tag -m tagged source-tag &&
1699 cat >expect <<-EOF &&
1700 $(git rev-parse --short :/three) source-tag three
1701 $(git rev-parse --short :/two ) source-a two
1702 $(git rev-parse --short :/one ) source-tag one
1704 git log --oneline --source source-tag source-a >actual &&
1705 test_cmp expect actual
1708 test_expect_success 'log --source paints symmetric ranges' '
1709 cat >expect <<-EOF &&
1710 $(git rev-parse --short :/three) source-b three
1711 $(git rev-parse --short :/two ) source-a two
1713 git log --oneline --source source-a...source-b >actual &&
1714 test_cmp expect actual
1717 test_expect_success '--exclude-promisor-objects does not BUG-crash' '
1718 test_must_fail git log --exclude-promisor-objects source-a
1721 test_expect_success 'log --end-of-options' '
1722 git update-ref refs/heads/--source HEAD &&
1723 git log --end-of-options --source >actual &&
1724 git log >expect &&
1725 test_cmp expect actual
1728 test_done