Merge branch 'dk/libsecret-unlock-to-load-fix' into maint
[git/gitweb.git] / t / t4202-log.sh
blob8f155da7a50a657db9fd092e24639f67cd03cd24
1 #!/bin/sh
3 test_description='git log'
5 . ./test-lib.sh
6 . "$TEST_DIRECTORY/lib-gpg.sh"
7 . "$TEST_DIRECTORY/lib-terminal.sh"
9 test_expect_success setup '
11 echo one >one &&
12 git add one &&
13 test_tick &&
14 git commit -m initial &&
16 echo ichi >one &&
17 git add one &&
18 test_tick &&
19 git commit -m second &&
21 git mv one ichi &&
22 test_tick &&
23 git commit -m third &&
25 cp ichi ein &&
26 git add ein &&
27 test_tick &&
28 git commit -m fourth &&
30 mkdir a &&
31 echo ni >a/two &&
32 git add a/two &&
33 test_tick &&
34 git commit -m fifth &&
36 git rm a/two &&
37 test_tick &&
38 git commit -m sixth
42 printf "sixth\nfifth\nfourth\nthird\nsecond\ninitial" > expect
43 test_expect_success 'pretty' '
45 git log --pretty="format:%s" > actual &&
46 test_cmp expect actual
49 printf "sixth\nfifth\nfourth\nthird\nsecond\ninitial\n" > expect
50 test_expect_success 'pretty (tformat)' '
52 git log --pretty="tformat:%s" > actual &&
53 test_cmp expect actual
56 test_expect_success 'pretty (shortcut)' '
58 git log --pretty="%s" > actual &&
59 test_cmp expect actual
62 test_expect_success 'format' '
64 git log --format="%s" > actual &&
65 test_cmp expect actual
68 cat > expect << EOF
69 This is
70 the sixth
71 commit.
72 This is
73 the fifth
74 commit.
75 EOF
77 test_expect_success 'format %w(11,1,2)' '
79 git log -2 --format="%w(11,1,2)This is the %s commit." > actual &&
80 test_cmp expect actual
83 test_expect_success 'format %w(,1,2)' '
85 git log -2 --format="%w(,1,2)This is%nthe %s%ncommit." > actual &&
86 test_cmp expect actual
89 cat > expect << EOF
90 804a787 sixth
91 394ef78 fifth
92 5d31159 fourth
93 2fbe8c0 third
94 f7dab8e second
95 3a2fdcb initial
96 EOF
97 test_expect_success 'oneline' '
99 git log --oneline > actual &&
100 test_cmp expect actual
103 test_expect_success 'diff-filter=A' '
105 git log --no-renames --pretty="format:%s" --diff-filter=A HEAD > actual &&
106 git log --no-renames --pretty="format:%s" --diff-filter A HEAD > actual-separate &&
107 printf "fifth\nfourth\nthird\ninitial" > expect &&
108 test_cmp expect actual &&
109 test_cmp expect actual-separate
113 test_expect_success 'diff-filter=M' '
115 actual=$(git log --pretty="format:%s" --diff-filter=M HEAD) &&
116 expect=$(echo second) &&
117 verbose test "$actual" = "$expect"
121 test_expect_success 'diff-filter=D' '
123 actual=$(git log --no-renames --pretty="format:%s" --diff-filter=D HEAD) &&
124 expect=$(echo sixth ; echo third) &&
125 verbose test "$actual" = "$expect"
129 test_expect_success 'diff-filter=R' '
131 actual=$(git log -M --pretty="format:%s" --diff-filter=R HEAD) &&
132 expect=$(echo third) &&
133 verbose test "$actual" = "$expect"
137 test_expect_success 'diff-filter=C' '
139 actual=$(git log -C -C --pretty="format:%s" --diff-filter=C HEAD) &&
140 expect=$(echo fourth) &&
141 verbose test "$actual" = "$expect"
145 test_expect_success 'git log --follow' '
147 actual=$(git log --follow --pretty="format:%s" ichi) &&
148 expect=$(echo third ; echo second ; echo initial) &&
149 verbose test "$actual" = "$expect"
152 test_expect_success 'git config log.follow works like --follow' '
153 test_config log.follow true &&
154 actual=$(git log --pretty="format:%s" ichi) &&
155 expect=$(echo third ; echo second ; echo initial) &&
156 verbose test "$actual" = "$expect"
159 test_expect_success 'git config log.follow does not die with multiple paths' '
160 test_config log.follow true &&
161 git log --pretty="format:%s" ichi ein
164 test_expect_success 'git config log.follow does not die with no paths' '
165 test_config log.follow true &&
166 git log --
169 test_expect_success 'git config log.follow is overridden by --no-follow' '
170 test_config log.follow true &&
171 actual=$(git log --no-follow --pretty="format:%s" ichi) &&
172 expect="third" &&
173 verbose test "$actual" = "$expect"
176 cat > expect << EOF
177 804a787 sixth
178 394ef78 fifth
179 5d31159 fourth
181 test_expect_success 'git log --no-walk <commits> sorts by commit time' '
182 git log --no-walk --oneline 5d31159 804a787 394ef78 > actual &&
183 test_cmp expect actual
186 test_expect_success 'git log --no-walk=sorted <commits> sorts by commit time' '
187 git log --no-walk=sorted --oneline 5d31159 804a787 394ef78 > actual &&
188 test_cmp expect actual
191 cat > expect << EOF
192 === 804a787 sixth
193 === 394ef78 fifth
194 === 5d31159 fourth
196 test_expect_success 'git log --line-prefix="=== " --no-walk <commits> sorts by commit time' '
197 git log --line-prefix="=== " --no-walk --oneline 5d31159 804a787 394ef78 > actual &&
198 test_cmp expect actual
201 cat > expect << EOF
202 5d31159 fourth
203 804a787 sixth
204 394ef78 fifth
206 test_expect_success 'git log --no-walk=unsorted <commits> leaves list of commits as given' '
207 git log --no-walk=unsorted --oneline 5d31159 804a787 394ef78 > actual &&
208 test_cmp expect actual
211 test_expect_success 'git show <commits> leaves list of commits as given' '
212 git show --oneline -s 5d31159 804a787 394ef78 > actual &&
213 test_cmp expect actual
216 test_expect_success 'setup case sensitivity tests' '
217 echo case >one &&
218 test_tick &&
219 git add one &&
220 git commit -a -m Second
223 test_expect_success 'log --grep' '
224 echo second >expect &&
225 git log -1 --pretty="tformat:%s" --grep=sec >actual &&
226 test_cmp expect actual
229 cat > expect << EOF
230 second
231 initial
233 test_expect_success 'log --invert-grep --grep' '
234 # Fixed
235 git -c grep.patternType=fixed log --pretty="tformat:%s" --invert-grep --grep=th --grep=Sec >actual &&
236 test_cmp expect actual &&
238 # POSIX basic
239 git -c grep.patternType=basic log --pretty="tformat:%s" --invert-grep --grep=t[h] --grep=S[e]c >actual &&
240 test_cmp expect actual &&
242 # POSIX extended
243 git -c grep.patternType=basic log --pretty="tformat:%s" --invert-grep --grep=t[h] --grep=S[e]c >actual &&
244 test_cmp expect actual &&
246 # PCRE
247 if test_have_prereq PCRE
248 then
249 git -c grep.patternType=perl log --pretty="tformat:%s" --invert-grep --grep=t[h] --grep=S[e]c >actual &&
250 test_cmp expect actual
254 test_expect_success 'log --invert-grep --grep -i' '
255 echo initial >expect &&
257 # Fixed
258 git -c grep.patternType=fixed log --pretty="tformat:%s" --invert-grep -i --grep=th --grep=Sec >actual &&
259 test_cmp expect actual &&
261 # POSIX basic
262 git -c grep.patternType=basic log --pretty="tformat:%s" --invert-grep -i --grep=t[h] --grep=S[e]c >actual &&
263 test_cmp expect actual &&
265 # POSIX extended
266 git -c grep.patternType=extended log --pretty="tformat:%s" --invert-grep -i --grep=t[h] --grep=S[e]c >actual &&
267 test_cmp expect actual &&
269 # PCRE
270 if test_have_prereq PCRE
271 then
272 git -c grep.patternType=perl log --pretty="tformat:%s" --invert-grep -i --grep=t[h] --grep=S[e]c >actual &&
273 test_cmp expect actual
277 test_expect_success 'log --grep option parsing' '
278 echo second >expect &&
279 git log -1 --pretty="tformat:%s" --grep sec >actual &&
280 test_cmp expect actual &&
281 test_must_fail git log -1 --pretty="tformat:%s" --grep
284 test_expect_success 'log -i --grep' '
285 echo Second >expect &&
286 git log -1 --pretty="tformat:%s" -i --grep=sec >actual &&
287 test_cmp expect actual
290 test_expect_success 'log --grep -i' '
291 echo Second >expect &&
293 # Fixed
294 git log -1 --pretty="tformat:%s" --grep=sec -i >actual &&
295 test_cmp expect actual &&
297 # POSIX basic
298 git -c grep.patternType=basic log -1 --pretty="tformat:%s" --grep=s[e]c -i >actual &&
299 test_cmp expect actual &&
301 # POSIX extended
302 git -c grep.patternType=extended log -1 --pretty="tformat:%s" --grep=s[e]c -i >actual &&
303 test_cmp expect actual &&
305 # PCRE
306 if test_have_prereq PCRE
307 then
308 git -c grep.patternType=perl log -1 --pretty="tformat:%s" --grep=s[e]c -i >actual &&
309 test_cmp expect actual
313 test_expect_success 'log -F -E --grep=<ere> uses ere' '
314 echo second >expect &&
315 # basic would need \(s\) to do the same
316 git log -1 --pretty="tformat:%s" -F -E --grep="(s).c.nd" >actual &&
317 test_cmp expect actual
320 test_expect_success PCRE 'log -F -E --perl-regexp --grep=<pcre> uses PCRE' '
321 test_when_finished "rm -rf num_commits" &&
322 git init num_commits &&
324 cd num_commits &&
325 test_commit 1d &&
326 test_commit 2e
327 ) &&
329 # In PCRE \d in [\d] is like saying "0-9", and matches the 2
330 # in 2e...
331 echo 2e >expect &&
332 git -C num_commits log -1 --pretty="tformat:%s" -F -E --perl-regexp --grep="[\d]" >actual &&
333 test_cmp expect actual &&
335 # ...in POSIX basic and extended it is the same as [d],
336 # i.e. "d", which matches 1d, but does not match 2e.
337 echo 1d >expect &&
338 git -C num_commits log -1 --pretty="tformat:%s" -F -E --grep="[\d]" >actual &&
339 test_cmp expect actual
342 test_expect_success 'log with grep.patternType configuration' '
343 >expect &&
344 git -c grep.patterntype=fixed \
345 log -1 --pretty=tformat:%s --grep=s.c.nd >actual &&
346 test_cmp expect actual
349 test_expect_success 'log with grep.patternType configuration and command line' '
350 echo second >expect &&
351 git -c grep.patterntype=fixed \
352 log -1 --pretty=tformat:%s --basic-regexp --grep=s.c.nd >actual &&
353 test_cmp expect actual
356 test_expect_success 'log with various grep.patternType configurations & command-lines' '
357 git init pattern-type &&
359 cd pattern-type &&
360 test_commit 1 file A &&
362 # The tagname is overridden here because creating a
363 # tag called "(1|2)" as test_commit would otherwise
364 # implicitly do would fail on e.g. MINGW.
365 test_commit "(1|2)" file B 2 &&
367 echo "(1|2)" >expect.fixed &&
368 cp expect.fixed expect.basic &&
369 cp expect.fixed expect.extended &&
370 cp expect.fixed expect.perl &&
372 # A strcmp-like match with fixed.
373 git -c grep.patternType=fixed log --pretty=tformat:%s \
374 --grep="(1|2)" >actual.fixed &&
376 # POSIX basic matches (, | and ) literally.
377 git -c grep.patternType=basic log --pretty=tformat:%s \
378 --grep="(.|.)" >actual.basic &&
380 # POSIX extended needs to have | escaped to match it
381 # literally, whereas under basic this is the same as
382 # (|2), i.e. it would also match "1". This test checks
383 # for extended by asserting that it is not matching
384 # what basic would match.
385 git -c grep.patternType=extended log --pretty=tformat:%s \
386 --grep="\|2" >actual.extended &&
387 if test_have_prereq PCRE
388 then
389 # Only PCRE would match [\d]\| with only
390 # "(1|2)" due to [\d]. POSIX basic would match
391 # both it and "1" since similarly to the
392 # extended match above it is the same as
393 # \([\d]\|\). POSIX extended would
394 # match neither.
395 git -c grep.patternType=perl log --pretty=tformat:%s \
396 --grep="[\d]\|" >actual.perl &&
397 test_cmp expect.perl actual.perl
398 fi &&
399 test_cmp expect.fixed actual.fixed &&
400 test_cmp expect.basic actual.basic &&
401 test_cmp expect.extended actual.extended &&
403 git log --pretty=tformat:%s -F \
404 --grep="(1|2)" >actual.fixed.short-arg &&
405 git log --pretty=tformat:%s -E \
406 --grep="\|2" >actual.extended.short-arg &&
407 if test_have_prereq PCRE
408 then
409 git log --pretty=tformat:%s -P \
410 --grep="[\d]\|" >actual.perl.short-arg
411 else
412 test_must_fail git log -P \
413 --grep="[\d]\|"
414 fi &&
415 test_cmp expect.fixed actual.fixed.short-arg &&
416 test_cmp expect.extended actual.extended.short-arg &&
417 if test_have_prereq PCRE
418 then
419 test_cmp expect.perl actual.perl.short-arg
420 fi &&
422 git log --pretty=tformat:%s --fixed-strings \
423 --grep="(1|2)" >actual.fixed.long-arg &&
424 git log --pretty=tformat:%s --basic-regexp \
425 --grep="(.|.)" >actual.basic.long-arg &&
426 git log --pretty=tformat:%s --extended-regexp \
427 --grep="\|2" >actual.extended.long-arg &&
428 if test_have_prereq PCRE
429 then
430 git log --pretty=tformat:%s --perl-regexp \
431 --grep="[\d]\|" >actual.perl.long-arg &&
432 test_cmp expect.perl actual.perl.long-arg
433 else
434 test_must_fail git log --perl-regexp \
435 --grep="[\d]\|"
436 fi &&
437 test_cmp expect.fixed actual.fixed.long-arg &&
438 test_cmp expect.basic actual.basic.long-arg &&
439 test_cmp expect.extended actual.extended.long-arg
443 cat > expect <<EOF
444 * Second
445 * sixth
446 * fifth
447 * fourth
448 * third
449 * second
450 * initial
453 test_expect_success 'simple log --graph' '
454 git log --graph --pretty=tformat:%s >actual &&
455 test_cmp expect actual
458 cat > expect <<EOF
459 123 * Second
460 123 * sixth
461 123 * fifth
462 123 * fourth
463 123 * third
464 123 * second
465 123 * initial
468 test_expect_success 'simple log --graph --line-prefix="123 "' '
469 git log --graph --line-prefix="123 " --pretty=tformat:%s >actual &&
470 test_cmp expect actual
473 test_expect_success 'set up merge history' '
474 git checkout -b side HEAD~4 &&
475 test_commit side-1 1 1 &&
476 test_commit side-2 2 2 &&
477 git checkout master &&
478 git merge side
481 cat > expect <<\EOF
482 * Merge branch 'side'
484 | * side-2
485 | * side-1
486 * | Second
487 * | sixth
488 * | fifth
489 * | fourth
491 * third
492 * second
493 * initial
496 test_expect_success 'log --graph with merge' '
497 git log --graph --date-order --pretty=tformat:%s |
498 sed "s/ *\$//" >actual &&
499 test_cmp expect actual
502 cat > expect <<\EOF
503 | | | * Merge branch 'side'
504 | | | |\
505 | | | | * side-2
506 | | | | * side-1
507 | | | * | Second
508 | | | * | sixth
509 | | | * | fifth
510 | | | * | fourth
511 | | | |/
512 | | | * third
513 | | | * second
514 | | | * initial
517 test_expect_success 'log --graph --line-prefix="| | | " with merge' '
518 git log --line-prefix="| | | " --graph --date-order --pretty=tformat:%s |
519 sed "s/ *\$//" >actual &&
520 test_cmp expect actual
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 git log --color=always --graph --date-order --pretty=tformat:%s |
541 test_decode_color | sed "s/ *\$//" >actual &&
542 test_cmp expect.colors actual
545 test_expect_success 'log --raw --graph -m with merge' '
546 git log --raw --graph --oneline -m master | head -n 500 >actual &&
547 grep "initial" actual
550 test_expect_success 'diff-tree --graph' '
551 git diff-tree --graph master^ | head -n 500 >actual &&
552 grep "one" actual
555 cat > expect <<\EOF
556 * commit master
557 |\ Merge: A B
558 | | Author: A U Thor <author@example.com>
560 | | Merge branch 'side'
562 | * commit tags/side-2
563 | | Author: A U Thor <author@example.com>
565 | | side-2
567 | * commit tags/side-1
568 | | Author: A U Thor <author@example.com>
570 | | side-1
572 * | commit master~1
573 | | Author: A U Thor <author@example.com>
575 | | Second
577 * | commit master~2
578 | | Author: A U Thor <author@example.com>
580 | | sixth
582 * | commit master~3
583 | | Author: A U Thor <author@example.com>
585 | | fifth
587 * | commit master~4
588 |/ Author: A U Thor <author@example.com>
590 | fourth
592 * commit tags/side-1~1
593 | Author: A U Thor <author@example.com>
595 | third
597 * commit tags/side-1~2
598 | Author: A U Thor <author@example.com>
600 | second
602 * commit tags/side-1~3
603 Author: A U Thor <author@example.com>
605 initial
608 test_expect_success 'log --graph with full output' '
609 git log --graph --date-order --pretty=short |
610 git name-rev --name-only --stdin |
611 sed "s/Merge:.*/Merge: A B/;s/ *\$//" >actual &&
612 test_cmp expect actual
615 test_expect_success 'set up more tangled history' '
616 git checkout -b tangle HEAD~6 &&
617 test_commit tangle-a tangle-a a &&
618 git merge master~3 &&
619 git merge side~1 &&
620 git checkout master &&
621 git merge tangle &&
622 git checkout -b reach &&
623 test_commit reach &&
624 git checkout master &&
625 git checkout -b octopus-a &&
626 test_commit octopus-a &&
627 git checkout master &&
628 git checkout -b octopus-b &&
629 test_commit octopus-b &&
630 git checkout master &&
631 test_commit seventh &&
632 git merge octopus-a octopus-b &&
633 git merge reach
636 cat > expect <<\EOF
637 * Merge tag 'reach'
641 *-. \ Merge tags 'octopus-a' and 'octopus-b'
642 |\ \ \
643 * | | | seventh
644 | | * | octopus-b
645 | |/ /
646 |/| |
647 | * | octopus-a
648 |/ /
649 | * reach
651 * Merge branch 'tangle'
653 | * Merge branch 'side' (early part) into tangle
654 | |\
655 | * \ Merge branch 'master' (early part) into tangle
656 | |\ \
657 | * | | tangle-a
658 * | | | Merge branch 'side'
659 |\ \ \ \
660 | * | | | side-2
661 | | |_|/
662 | |/| |
663 | * | | side-1
664 * | | | Second
665 * | | | sixth
666 | |_|/
667 |/| |
668 * | | fifth
669 * | | fourth
670 |/ /
671 * | third
673 * second
674 * initial
677 test_expect_success 'log --graph with merge' '
678 git log --graph --date-order --pretty=tformat:%s |
679 sed "s/ *\$//" >actual &&
680 test_cmp expect actual
683 test_expect_success 'log.decorate configuration' '
684 git log --oneline --no-decorate >expect.none &&
685 git log --oneline --decorate >expect.short &&
686 git log --oneline --decorate=full >expect.full &&
688 echo "[log] decorate" >>.git/config &&
689 git log --oneline >actual &&
690 test_cmp expect.short actual &&
692 test_config log.decorate true &&
693 git log --oneline >actual &&
694 test_cmp expect.short actual &&
695 git log --oneline --decorate=full >actual &&
696 test_cmp expect.full actual &&
697 git log --oneline --decorate=no >actual &&
698 test_cmp expect.none actual &&
700 test_config log.decorate no &&
701 git log --oneline >actual &&
702 test_cmp expect.none actual &&
703 git log --oneline --decorate >actual &&
704 test_cmp expect.short actual &&
705 git log --oneline --decorate=full >actual &&
706 test_cmp expect.full actual &&
708 test_config log.decorate 1 &&
709 git log --oneline >actual &&
710 test_cmp expect.short actual &&
711 git log --oneline --decorate=full >actual &&
712 test_cmp expect.full actual &&
713 git log --oneline --decorate=no >actual &&
714 test_cmp expect.none actual &&
716 test_config log.decorate short &&
717 git log --oneline >actual &&
718 test_cmp expect.short actual &&
719 git log --oneline --no-decorate >actual &&
720 test_cmp expect.none actual &&
721 git log --oneline --decorate=full >actual &&
722 test_cmp expect.full actual &&
724 test_config log.decorate full &&
725 git log --oneline >actual &&
726 test_cmp expect.full actual &&
727 git log --oneline --no-decorate >actual &&
728 test_cmp expect.none actual &&
729 git log --oneline --decorate >actual &&
730 test_cmp expect.short actual &&
732 test_unconfig log.decorate &&
733 git log --pretty=raw >expect.raw &&
734 test_config log.decorate full &&
735 git log --pretty=raw >actual &&
736 test_cmp expect.raw actual
740 test_expect_success 'log.decorate config parsing' '
741 git log --oneline --decorate=full >expect.full &&
742 git log --oneline --decorate=short >expect.short &&
744 test_config log.decorate full &&
745 test_config log.mailmap true &&
746 git log --oneline >actual &&
747 test_cmp expect.full actual &&
748 git log --oneline --decorate=short >actual &&
749 test_cmp expect.short actual
752 test_expect_success TTY 'log output on a TTY' '
753 git log --color --oneline --decorate >expect.short &&
755 test_terminal git log --oneline >actual &&
756 test_cmp expect.short actual
759 test_expect_success 'reflog is expected format' '
760 git log -g --abbrev-commit --pretty=oneline >expect &&
761 git reflog >actual &&
762 test_cmp expect actual
765 test_expect_success 'whatchanged is expected format' '
766 git log --no-merges --raw >expect &&
767 git whatchanged >actual &&
768 test_cmp expect actual
771 test_expect_success 'log.abbrevCommit configuration' '
772 git log --abbrev-commit >expect.log.abbrev &&
773 git log --no-abbrev-commit >expect.log.full &&
774 git log --pretty=raw >expect.log.raw &&
775 git reflog --abbrev-commit >expect.reflog.abbrev &&
776 git reflog --no-abbrev-commit >expect.reflog.full &&
777 git whatchanged --abbrev-commit >expect.whatchanged.abbrev &&
778 git whatchanged --no-abbrev-commit >expect.whatchanged.full &&
780 test_config log.abbrevCommit true &&
782 git log >actual &&
783 test_cmp expect.log.abbrev actual &&
784 git log --no-abbrev-commit >actual &&
785 test_cmp expect.log.full actual &&
787 git log --pretty=raw >actual &&
788 test_cmp expect.log.raw actual &&
790 git reflog >actual &&
791 test_cmp expect.reflog.abbrev actual &&
792 git reflog --no-abbrev-commit >actual &&
793 test_cmp expect.reflog.full actual &&
795 git whatchanged >actual &&
796 test_cmp expect.whatchanged.abbrev actual &&
797 git whatchanged --no-abbrev-commit >actual &&
798 test_cmp expect.whatchanged.full actual
801 test_expect_success 'show added path under "--follow -M"' '
802 # This tests for a regression introduced in v1.7.2-rc0~103^2~2
803 test_create_repo regression &&
805 cd regression &&
806 test_commit needs-another-commit &&
807 test_commit foo.bar &&
808 git log -M --follow -p foo.bar.t &&
809 git log -M --follow --stat foo.bar.t &&
810 git log -M --follow --name-only foo.bar.t
814 test_expect_success 'git log -c --follow' '
815 test_create_repo follow-c &&
817 cd follow-c &&
818 test_commit initial file original &&
819 git rm file &&
820 test_commit rename file2 original &&
821 git reset --hard initial &&
822 test_commit modify file foo &&
823 git merge -m merge rename &&
824 git log -c --follow file2
828 cat >expect <<\EOF
829 * commit COMMIT_OBJECT_NAME
830 |\ Merge: MERGE_PARENTS
831 | | Author: A U Thor <author@example.com>
833 | | Merge HEADS DESCRIPTION
835 | * commit COMMIT_OBJECT_NAME
836 | | Author: A U Thor <author@example.com>
838 | | reach
839 | | ---
840 | | reach.t | 1 +
841 | | 1 file changed, 1 insertion(+)
843 | | diff --git a/reach.t b/reach.t
844 | | new file mode 100644
845 | | index 0000000..10c9591
846 | | --- /dev/null
847 | | +++ b/reach.t
848 | | @@ -0,0 +1 @@
849 | | +reach
852 *-. \ commit COMMIT_OBJECT_NAME
853 |\ \ \ Merge: MERGE_PARENTS
854 | | | | Author: A U Thor <author@example.com>
855 | | | |
856 | | | | Merge HEADS DESCRIPTION
857 | | | |
858 | | * | commit COMMIT_OBJECT_NAME
859 | | |/ Author: A U Thor <author@example.com>
860 | | |
861 | | | octopus-b
862 | | | ---
863 | | | octopus-b.t | 1 +
864 | | | 1 file changed, 1 insertion(+)
865 | | |
866 | | | diff --git a/octopus-b.t b/octopus-b.t
867 | | | new file mode 100644
868 | | | index 0000000..d5fcad0
869 | | | --- /dev/null
870 | | | +++ b/octopus-b.t
871 | | | @@ -0,0 +1 @@
872 | | | +octopus-b
873 | | |
874 | * | commit COMMIT_OBJECT_NAME
875 | |/ Author: A U Thor <author@example.com>
877 | | octopus-a
878 | | ---
879 | | octopus-a.t | 1 +
880 | | 1 file changed, 1 insertion(+)
882 | | diff --git a/octopus-a.t b/octopus-a.t
883 | | new file mode 100644
884 | | index 0000000..11ee015
885 | | --- /dev/null
886 | | +++ b/octopus-a.t
887 | | @@ -0,0 +1 @@
888 | | +octopus-a
890 * | commit COMMIT_OBJECT_NAME
891 |/ Author: A U Thor <author@example.com>
893 | seventh
894 | ---
895 | seventh.t | 1 +
896 | 1 file changed, 1 insertion(+)
898 | diff --git a/seventh.t b/seventh.t
899 | new file mode 100644
900 | index 0000000..9744ffc
901 | --- /dev/null
902 | +++ b/seventh.t
903 | @@ -0,0 +1 @@
904 | +seventh
906 * commit COMMIT_OBJECT_NAME
907 |\ Merge: MERGE_PARENTS
908 | | Author: A U Thor <author@example.com>
910 | | Merge branch 'tangle'
912 | * commit COMMIT_OBJECT_NAME
913 | |\ Merge: MERGE_PARENTS
914 | | | Author: A U Thor <author@example.com>
915 | | |
916 | | | Merge branch 'side' (early part) into tangle
917 | | |
918 | * | commit COMMIT_OBJECT_NAME
919 | |\ \ Merge: MERGE_PARENTS
920 | | | | Author: A U Thor <author@example.com>
921 | | | |
922 | | | | Merge branch 'master' (early part) into tangle
923 | | | |
924 | * | | commit COMMIT_OBJECT_NAME
925 | | | | Author: A U Thor <author@example.com>
926 | | | |
927 | | | | tangle-a
928 | | | | ---
929 | | | | tangle-a | 1 +
930 | | | | 1 file changed, 1 insertion(+)
931 | | | |
932 | | | | diff --git a/tangle-a b/tangle-a
933 | | | | new file mode 100644
934 | | | | index 0000000..7898192
935 | | | | --- /dev/null
936 | | | | +++ b/tangle-a
937 | | | | @@ -0,0 +1 @@
938 | | | | +a
939 | | | |
940 * | | | commit COMMIT_OBJECT_NAME
941 |\ \ \ \ Merge: MERGE_PARENTS
942 | | | | | Author: A U Thor <author@example.com>
943 | | | | |
944 | | | | | Merge branch 'side'
945 | | | | |
946 | * | | | commit COMMIT_OBJECT_NAME
947 | | |_|/ Author: A U Thor <author@example.com>
948 | |/| |
949 | | | | side-2
950 | | | | ---
951 | | | | 2 | 1 +
952 | | | | 1 file changed, 1 insertion(+)
953 | | | |
954 | | | | diff --git a/2 b/2
955 | | | | new file mode 100644
956 | | | | index 0000000..0cfbf08
957 | | | | --- /dev/null
958 | | | | +++ b/2
959 | | | | @@ -0,0 +1 @@
960 | | | | +2
961 | | | |
962 | * | | commit COMMIT_OBJECT_NAME
963 | | | | Author: A U Thor <author@example.com>
964 | | | |
965 | | | | side-1
966 | | | | ---
967 | | | | 1 | 1 +
968 | | | | 1 file changed, 1 insertion(+)
969 | | | |
970 | | | | diff --git a/1 b/1
971 | | | | new file mode 100644
972 | | | | index 0000000..d00491f
973 | | | | --- /dev/null
974 | | | | +++ b/1
975 | | | | @@ -0,0 +1 @@
976 | | | | +1
977 | | | |
978 * | | | commit COMMIT_OBJECT_NAME
979 | | | | Author: A U Thor <author@example.com>
980 | | | |
981 | | | | Second
982 | | | | ---
983 | | | | one | 1 +
984 | | | | 1 file changed, 1 insertion(+)
985 | | | |
986 | | | | diff --git a/one b/one
987 | | | | new file mode 100644
988 | | | | index 0000000..9a33383
989 | | | | --- /dev/null
990 | | | | +++ b/one
991 | | | | @@ -0,0 +1 @@
992 | | | | +case
993 | | | |
994 * | | | commit COMMIT_OBJECT_NAME
995 | |_|/ Author: A U Thor <author@example.com>
996 |/| |
997 | | | sixth
998 | | | ---
999 | | | a/two | 1 -
1000 | | | 1 file changed, 1 deletion(-)
1001 | | |
1002 | | | diff --git a/a/two b/a/two
1003 | | | deleted file mode 100644
1004 | | | index 9245af5..0000000
1005 | | | --- a/a/two
1006 | | | +++ /dev/null
1007 | | | @@ -1 +0,0 @@
1008 | | | -ni
1009 | | |
1010 * | | commit COMMIT_OBJECT_NAME
1011 | | | Author: A U Thor <author@example.com>
1012 | | |
1013 | | | fifth
1014 | | | ---
1015 | | | a/two | 1 +
1016 | | | 1 file changed, 1 insertion(+)
1017 | | |
1018 | | | diff --git a/a/two b/a/two
1019 | | | new file mode 100644
1020 | | | index 0000000..9245af5
1021 | | | --- /dev/null
1022 | | | +++ b/a/two
1023 | | | @@ -0,0 +1 @@
1024 | | | +ni
1025 | | |
1026 * | | commit COMMIT_OBJECT_NAME
1027 |/ / Author: A U Thor <author@example.com>
1029 | | fourth
1030 | | ---
1031 | | ein | 1 +
1032 | | 1 file changed, 1 insertion(+)
1034 | | diff --git a/ein b/ein
1035 | | new file mode 100644
1036 | | index 0000000..9d7e69f
1037 | | --- /dev/null
1038 | | +++ b/ein
1039 | | @@ -0,0 +1 @@
1040 | | +ichi
1042 * | commit COMMIT_OBJECT_NAME
1043 |/ Author: A U Thor <author@example.com>
1045 | third
1046 | ---
1047 | ichi | 1 +
1048 | one | 1 -
1049 | 2 files changed, 1 insertion(+), 1 deletion(-)
1051 | diff --git a/ichi b/ichi
1052 | new file mode 100644
1053 | index 0000000..9d7e69f
1054 | --- /dev/null
1055 | +++ b/ichi
1056 | @@ -0,0 +1 @@
1057 | +ichi
1058 | diff --git a/one b/one
1059 | deleted file mode 100644
1060 | index 9d7e69f..0000000
1061 | --- a/one
1062 | +++ /dev/null
1063 | @@ -1 +0,0 @@
1064 | -ichi
1066 * commit COMMIT_OBJECT_NAME
1067 | Author: A U Thor <author@example.com>
1069 | second
1070 | ---
1071 | one | 2 +-
1072 | 1 file changed, 1 insertion(+), 1 deletion(-)
1074 | diff --git a/one b/one
1075 | index 5626abf..9d7e69f 100644
1076 | --- a/one
1077 | +++ b/one
1078 | @@ -1 +1 @@
1079 | -one
1080 | +ichi
1082 * commit COMMIT_OBJECT_NAME
1083 Author: A U Thor <author@example.com>
1085 initial
1087 one | 1 +
1088 1 file changed, 1 insertion(+)
1090 diff --git a/one b/one
1091 new file mode 100644
1092 index 0000000..5626abf
1093 --- /dev/null
1094 +++ b/one
1095 @@ -0,0 +1 @@
1096 +one
1099 sanitize_output () {
1100 sed -e 's/ *$//' \
1101 -e 's/commit [0-9a-f]*$/commit COMMIT_OBJECT_NAME/' \
1102 -e 's/Merge: [ 0-9a-f]*$/Merge: MERGE_PARENTS/' \
1103 -e 's/Merge tag.*/Merge HEADS DESCRIPTION/' \
1104 -e 's/Merge commit.*/Merge HEADS DESCRIPTION/' \
1105 -e 's/, 0 deletions(-)//' \
1106 -e 's/, 0 insertions(+)//' \
1107 -e 's/ 1 files changed, / 1 file changed, /' \
1108 -e 's/, 1 deletions(-)/, 1 deletion(-)/' \
1109 -e 's/, 1 insertions(+)/, 1 insertion(+)/'
1112 test_expect_success 'log --graph with diff and stats' '
1113 git log --no-renames --graph --pretty=short --stat -p >actual &&
1114 sanitize_output >actual.sanitized <actual &&
1115 test_i18ncmp expect actual.sanitized
1118 cat >expect <<\EOF
1119 *** * commit COMMIT_OBJECT_NAME
1120 *** |\ Merge: MERGE_PARENTS
1121 *** | | Author: A U Thor <author@example.com>
1122 *** | |
1123 *** | | Merge HEADS DESCRIPTION
1124 *** | |
1125 *** | * commit COMMIT_OBJECT_NAME
1126 *** | | Author: A U Thor <author@example.com>
1127 *** | |
1128 *** | | reach
1129 *** | | ---
1130 *** | | reach.t | 1 +
1131 *** | | 1 file changed, 1 insertion(+)
1132 *** | |
1133 *** | | diff --git a/reach.t b/reach.t
1134 *** | | new file mode 100644
1135 *** | | index 0000000..10c9591
1136 *** | | --- /dev/null
1137 *** | | +++ b/reach.t
1138 *** | | @@ -0,0 +1 @@
1139 *** | | +reach
1140 *** | |
1141 *** | \
1142 *** *-. \ commit COMMIT_OBJECT_NAME
1143 *** |\ \ \ Merge: MERGE_PARENTS
1144 *** | | | | Author: A U Thor <author@example.com>
1145 *** | | | |
1146 *** | | | | Merge HEADS DESCRIPTION
1147 *** | | | |
1148 *** | | * | commit COMMIT_OBJECT_NAME
1149 *** | | |/ Author: A U Thor <author@example.com>
1150 *** | | |
1151 *** | | | octopus-b
1152 *** | | | ---
1153 *** | | | octopus-b.t | 1 +
1154 *** | | | 1 file changed, 1 insertion(+)
1155 *** | | |
1156 *** | | | diff --git a/octopus-b.t b/octopus-b.t
1157 *** | | | new file mode 100644
1158 *** | | | index 0000000..d5fcad0
1159 *** | | | --- /dev/null
1160 *** | | | +++ b/octopus-b.t
1161 *** | | | @@ -0,0 +1 @@
1162 *** | | | +octopus-b
1163 *** | | |
1164 *** | * | commit COMMIT_OBJECT_NAME
1165 *** | |/ Author: A U Thor <author@example.com>
1166 *** | |
1167 *** | | octopus-a
1168 *** | | ---
1169 *** | | octopus-a.t | 1 +
1170 *** | | 1 file changed, 1 insertion(+)
1171 *** | |
1172 *** | | diff --git a/octopus-a.t b/octopus-a.t
1173 *** | | new file mode 100644
1174 *** | | index 0000000..11ee015
1175 *** | | --- /dev/null
1176 *** | | +++ b/octopus-a.t
1177 *** | | @@ -0,0 +1 @@
1178 *** | | +octopus-a
1179 *** | |
1180 *** * | commit COMMIT_OBJECT_NAME
1181 *** |/ Author: A U Thor <author@example.com>
1182 *** |
1183 *** | seventh
1184 *** | ---
1185 *** | seventh.t | 1 +
1186 *** | 1 file changed, 1 insertion(+)
1187 *** |
1188 *** | diff --git a/seventh.t b/seventh.t
1189 *** | new file mode 100644
1190 *** | index 0000000..9744ffc
1191 *** | --- /dev/null
1192 *** | +++ b/seventh.t
1193 *** | @@ -0,0 +1 @@
1194 *** | +seventh
1195 *** |
1196 *** * commit COMMIT_OBJECT_NAME
1197 *** |\ Merge: MERGE_PARENTS
1198 *** | | Author: A U Thor <author@example.com>
1199 *** | |
1200 *** | | Merge branch 'tangle'
1201 *** | |
1202 *** | * commit COMMIT_OBJECT_NAME
1203 *** | |\ Merge: MERGE_PARENTS
1204 *** | | | Author: A U Thor <author@example.com>
1205 *** | | |
1206 *** | | | Merge branch 'side' (early part) into tangle
1207 *** | | |
1208 *** | * | commit COMMIT_OBJECT_NAME
1209 *** | |\ \ Merge: MERGE_PARENTS
1210 *** | | | | Author: A U Thor <author@example.com>
1211 *** | | | |
1212 *** | | | | Merge branch 'master' (early part) into tangle
1213 *** | | | |
1214 *** | * | | commit COMMIT_OBJECT_NAME
1215 *** | | | | Author: A U Thor <author@example.com>
1216 *** | | | |
1217 *** | | | | tangle-a
1218 *** | | | | ---
1219 *** | | | | tangle-a | 1 +
1220 *** | | | | 1 file changed, 1 insertion(+)
1221 *** | | | |
1222 *** | | | | diff --git a/tangle-a b/tangle-a
1223 *** | | | | new file mode 100644
1224 *** | | | | index 0000000..7898192
1225 *** | | | | --- /dev/null
1226 *** | | | | +++ b/tangle-a
1227 *** | | | | @@ -0,0 +1 @@
1228 *** | | | | +a
1229 *** | | | |
1230 *** * | | | commit COMMIT_OBJECT_NAME
1231 *** |\ \ \ \ Merge: MERGE_PARENTS
1232 *** | | | | | Author: A U Thor <author@example.com>
1233 *** | | | | |
1234 *** | | | | | Merge branch 'side'
1235 *** | | | | |
1236 *** | * | | | commit COMMIT_OBJECT_NAME
1237 *** | | |_|/ Author: A U Thor <author@example.com>
1238 *** | |/| |
1239 *** | | | | side-2
1240 *** | | | | ---
1241 *** | | | | 2 | 1 +
1242 *** | | | | 1 file changed, 1 insertion(+)
1243 *** | | | |
1244 *** | | | | diff --git a/2 b/2
1245 *** | | | | new file mode 100644
1246 *** | | | | index 0000000..0cfbf08
1247 *** | | | | --- /dev/null
1248 *** | | | | +++ b/2
1249 *** | | | | @@ -0,0 +1 @@
1250 *** | | | | +2
1251 *** | | | |
1252 *** | * | | commit COMMIT_OBJECT_NAME
1253 *** | | | | Author: A U Thor <author@example.com>
1254 *** | | | |
1255 *** | | | | side-1
1256 *** | | | | ---
1257 *** | | | | 1 | 1 +
1258 *** | | | | 1 file changed, 1 insertion(+)
1259 *** | | | |
1260 *** | | | | diff --git a/1 b/1
1261 *** | | | | new file mode 100644
1262 *** | | | | index 0000000..d00491f
1263 *** | | | | --- /dev/null
1264 *** | | | | +++ b/1
1265 *** | | | | @@ -0,0 +1 @@
1266 *** | | | | +1
1267 *** | | | |
1268 *** * | | | commit COMMIT_OBJECT_NAME
1269 *** | | | | Author: A U Thor <author@example.com>
1270 *** | | | |
1271 *** | | | | Second
1272 *** | | | | ---
1273 *** | | | | one | 1 +
1274 *** | | | | 1 file changed, 1 insertion(+)
1275 *** | | | |
1276 *** | | | | diff --git a/one b/one
1277 *** | | | | new file mode 100644
1278 *** | | | | index 0000000..9a33383
1279 *** | | | | --- /dev/null
1280 *** | | | | +++ b/one
1281 *** | | | | @@ -0,0 +1 @@
1282 *** | | | | +case
1283 *** | | | |
1284 *** * | | | commit COMMIT_OBJECT_NAME
1285 *** | |_|/ Author: A U Thor <author@example.com>
1286 *** |/| |
1287 *** | | | sixth
1288 *** | | | ---
1289 *** | | | a/two | 1 -
1290 *** | | | 1 file changed, 1 deletion(-)
1291 *** | | |
1292 *** | | | diff --git a/a/two b/a/two
1293 *** | | | deleted file mode 100644
1294 *** | | | index 9245af5..0000000
1295 *** | | | --- a/a/two
1296 *** | | | +++ /dev/null
1297 *** | | | @@ -1 +0,0 @@
1298 *** | | | -ni
1299 *** | | |
1300 *** * | | commit COMMIT_OBJECT_NAME
1301 *** | | | Author: A U Thor <author@example.com>
1302 *** | | |
1303 *** | | | fifth
1304 *** | | | ---
1305 *** | | | a/two | 1 +
1306 *** | | | 1 file changed, 1 insertion(+)
1307 *** | | |
1308 *** | | | diff --git a/a/two b/a/two
1309 *** | | | new file mode 100644
1310 *** | | | index 0000000..9245af5
1311 *** | | | --- /dev/null
1312 *** | | | +++ b/a/two
1313 *** | | | @@ -0,0 +1 @@
1314 *** | | | +ni
1315 *** | | |
1316 *** * | | commit COMMIT_OBJECT_NAME
1317 *** |/ / Author: A U Thor <author@example.com>
1318 *** | |
1319 *** | | fourth
1320 *** | | ---
1321 *** | | ein | 1 +
1322 *** | | 1 file changed, 1 insertion(+)
1323 *** | |
1324 *** | | diff --git a/ein b/ein
1325 *** | | new file mode 100644
1326 *** | | index 0000000..9d7e69f
1327 *** | | --- /dev/null
1328 *** | | +++ b/ein
1329 *** | | @@ -0,0 +1 @@
1330 *** | | +ichi
1331 *** | |
1332 *** * | commit COMMIT_OBJECT_NAME
1333 *** |/ Author: A U Thor <author@example.com>
1334 *** |
1335 *** | third
1336 *** | ---
1337 *** | ichi | 1 +
1338 *** | one | 1 -
1339 *** | 2 files changed, 1 insertion(+), 1 deletion(-)
1340 *** |
1341 *** | diff --git a/ichi b/ichi
1342 *** | new file mode 100644
1343 *** | index 0000000..9d7e69f
1344 *** | --- /dev/null
1345 *** | +++ b/ichi
1346 *** | @@ -0,0 +1 @@
1347 *** | +ichi
1348 *** | diff --git a/one b/one
1349 *** | deleted file mode 100644
1350 *** | index 9d7e69f..0000000
1351 *** | --- a/one
1352 *** | +++ /dev/null
1353 *** | @@ -1 +0,0 @@
1354 *** | -ichi
1355 *** |
1356 *** * commit COMMIT_OBJECT_NAME
1357 *** | Author: A U Thor <author@example.com>
1358 *** |
1359 *** | second
1360 *** | ---
1361 *** | one | 2 +-
1362 *** | 1 file changed, 1 insertion(+), 1 deletion(-)
1363 *** |
1364 *** | diff --git a/one b/one
1365 *** | index 5626abf..9d7e69f 100644
1366 *** | --- a/one
1367 *** | +++ b/one
1368 *** | @@ -1 +1 @@
1369 *** | -one
1370 *** | +ichi
1371 *** |
1372 *** * commit COMMIT_OBJECT_NAME
1373 *** Author: A U Thor <author@example.com>
1375 *** initial
1376 *** ---
1377 *** one | 1 +
1378 *** 1 file changed, 1 insertion(+)
1380 *** diff --git a/one b/one
1381 *** new file mode 100644
1382 *** index 0000000..5626abf
1383 *** --- /dev/null
1384 *** +++ b/one
1385 *** @@ -0,0 +1 @@
1386 *** +one
1389 test_expect_success 'log --line-prefix="*** " --graph with diff and stats' '
1390 git log --line-prefix="*** " --no-renames --graph --pretty=short --stat -p >actual &&
1391 sanitize_output >actual.sanitized <actual &&
1392 test_i18ncmp expect actual.sanitized
1395 cat >expect <<-\EOF
1396 * reach
1398 | A reach.t
1399 * Merge branch 'tangle'
1400 * Merge branch 'side'
1402 | * side-2
1404 | A 2
1405 * Second
1407 | A one
1408 * sixth
1410 D a/two
1413 test_expect_success 'log --graph with --name-status' '
1414 git log --graph --format=%s --name-status tangle..reach >actual &&
1415 sanitize_output <actual >actual.sanitized &&
1416 test_cmp expect actual.sanitized
1419 cat >expect <<-\EOF
1420 * reach
1422 | reach.t
1423 * Merge branch 'tangle'
1424 * Merge branch 'side'
1426 | * side-2
1429 * Second
1431 | one
1432 * sixth
1434 a/two
1437 test_expect_success 'log --graph with --name-only' '
1438 git log --graph --format=%s --name-only tangle..reach >actual &&
1439 sanitize_output <actual >actual.sanitized &&
1440 test_cmp expect actual.sanitized
1443 test_expect_success 'dotdot is a parent directory' '
1444 mkdir -p a/b &&
1445 ( echo sixth && echo fifth ) >expect &&
1446 ( cd a/b && git log --format=%s .. ) >actual &&
1447 test_cmp expect actual
1450 test_expect_success GPG 'setup signed branch' '
1451 test_when_finished "git reset --hard && git checkout master" &&
1452 git checkout -b signed master &&
1453 echo foo >foo &&
1454 git add foo &&
1455 git commit -S -m signed_commit
1458 test_expect_success GPG 'log --graph --show-signature' '
1459 git log --graph --show-signature -n1 signed >actual &&
1460 grep "^| gpg: Signature made" actual &&
1461 grep "^| gpg: Good signature" actual
1464 test_expect_success GPG 'log --graph --show-signature for merged tag' '
1465 test_when_finished "git reset --hard && git checkout master" &&
1466 git checkout -b plain master &&
1467 echo aaa >bar &&
1468 git add bar &&
1469 git commit -m bar_commit &&
1470 git checkout -b tagged master &&
1471 echo bbb >baz &&
1472 git add baz &&
1473 git commit -m baz_commit &&
1474 git tag -s -m signed_tag_msg signed_tag &&
1475 git checkout plain &&
1476 git merge --no-ff -m msg signed_tag &&
1477 git log --graph --show-signature -n1 plain >actual &&
1478 grep "^|\\\ merged tag" actual &&
1479 grep "^| | gpg: Signature made" actual &&
1480 grep "^| | gpg: Good signature" actual
1483 test_expect_success GPG '--no-show-signature overrides --show-signature' '
1484 git log -1 --show-signature --no-show-signature signed >actual &&
1485 ! grep "^gpg:" actual
1488 test_expect_success GPG 'log.showsignature=true behaves like --show-signature' '
1489 test_config log.showsignature true &&
1490 git log -1 signed >actual &&
1491 grep "gpg: Signature made" actual &&
1492 grep "gpg: Good signature" actual
1495 test_expect_success GPG '--no-show-signature overrides log.showsignature=true' '
1496 test_config log.showsignature true &&
1497 git log -1 --no-show-signature signed >actual &&
1498 ! grep "^gpg:" actual
1501 test_expect_success GPG '--show-signature overrides log.showsignature=false' '
1502 test_config log.showsignature false &&
1503 git log -1 --show-signature signed >actual &&
1504 grep "gpg: Signature made" actual &&
1505 grep "gpg: Good signature" actual
1508 test_expect_success 'log --graph --no-walk is forbidden' '
1509 test_must_fail git log --graph --no-walk
1512 test_expect_success 'log diagnoses bogus HEAD' '
1513 git init empty &&
1514 test_must_fail git -C empty log 2>stderr &&
1515 test_i18ngrep does.not.have.any.commits stderr &&
1516 echo 1234abcd >empty/.git/refs/heads/master &&
1517 test_must_fail git -C empty log 2>stderr &&
1518 test_i18ngrep broken stderr &&
1519 echo "ref: refs/heads/invalid.lock" >empty/.git/HEAD &&
1520 test_must_fail git -C empty log 2>stderr &&
1521 test_i18ngrep broken stderr &&
1522 test_must_fail git -C empty log --default totally-bogus 2>stderr &&
1523 test_i18ngrep broken stderr
1526 test_expect_success 'log does not default to HEAD when rev input is given' '
1527 >expect &&
1528 git log --branches=does-not-exist >actual &&
1529 test_cmp expect actual
1532 test_expect_success 'set up --source tests' '
1533 git checkout --orphan source-a &&
1534 test_commit one &&
1535 test_commit two &&
1536 git checkout -b source-b HEAD^ &&
1537 test_commit three
1540 test_expect_success 'log --source paints branch names' '
1541 cat >expect <<-\EOF &&
1542 09e12a9 source-b three
1543 8e393e1 source-a two
1544 1ac6c77 source-b one
1546 git log --oneline --source source-a source-b >actual &&
1547 test_cmp expect actual
1550 test_expect_success 'log --source paints tag names' '
1551 git tag -m tagged source-tag &&
1552 cat >expect <<-\EOF &&
1553 09e12a9 source-tag three
1554 8e393e1 source-a two
1555 1ac6c77 source-tag one
1557 git log --oneline --source source-tag source-a >actual &&
1558 test_cmp expect actual
1561 test_expect_success 'log --source paints symmetric ranges' '
1562 cat >expect <<-\EOF &&
1563 09e12a9 source-b three
1564 8e393e1 source-a two
1566 git log --oneline --source source-a...source-b >actual &&
1567 test_cmp expect actual
1570 test_done