use strpbrk(3) to search for characters from a given set
[git/debian.git] / t / t4202-log.sh
blob2c9489484a922b03afb8249631e8d30ad53dcbd5
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 git -c grep.patterntype=fixed \
344 log -1 --pretty=tformat:%s --grep=s.c.nd >actual &&
345 test_must_be_empty actual
348 test_expect_success 'log with grep.patternType configuration and command line' '
349 echo second >expect &&
350 git -c grep.patterntype=fixed \
351 log -1 --pretty=tformat:%s --basic-regexp --grep=s.c.nd >actual &&
352 test_cmp expect actual
355 test_expect_success !FAIL_PREREQS 'log with various grep.patternType configurations & command-lines' '
356 git init pattern-type &&
358 cd pattern-type &&
359 test_commit 1 file A &&
361 # The tagname is overridden here because creating a
362 # tag called "(1|2)" as test_commit would otherwise
363 # implicitly do would fail on e.g. MINGW.
364 test_commit "(1|2)" file B 2 &&
366 echo "(1|2)" >expect.fixed &&
367 cp expect.fixed expect.basic &&
368 cp expect.fixed expect.extended &&
369 cp expect.fixed expect.perl &&
371 # A strcmp-like match with fixed.
372 git -c grep.patternType=fixed log --pretty=tformat:%s \
373 --grep="(1|2)" >actual.fixed &&
375 # POSIX basic matches (, | and ) literally.
376 git -c grep.patternType=basic log --pretty=tformat:%s \
377 --grep="(.|.)" >actual.basic &&
379 # POSIX extended needs to have | escaped to match it
380 # literally, whereas under basic this is the same as
381 # (|2), i.e. it would also match "1". This test checks
382 # for extended by asserting that it is not matching
383 # what basic would match.
384 git -c grep.patternType=extended log --pretty=tformat:%s \
385 --grep="\|2" >actual.extended &&
386 if test_have_prereq PCRE
387 then
388 # Only PCRE would match [\d]\| with only
389 # "(1|2)" due to [\d]. POSIX basic would match
390 # both it and "1" since similarly to the
391 # extended match above it is the same as
392 # \([\d]\|\). POSIX extended would
393 # match neither.
394 git -c grep.patternType=perl log --pretty=tformat:%s \
395 --grep="[\d]\|" >actual.perl &&
396 test_cmp expect.perl actual.perl
397 fi &&
398 test_cmp expect.fixed actual.fixed &&
399 test_cmp expect.basic actual.basic &&
400 test_cmp expect.extended actual.extended &&
402 git log --pretty=tformat:%s -F \
403 --grep="(1|2)" >actual.fixed.short-arg &&
404 git log --pretty=tformat:%s -E \
405 --grep="\|2" >actual.extended.short-arg &&
406 if test_have_prereq PCRE
407 then
408 git log --pretty=tformat:%s -P \
409 --grep="[\d]\|" >actual.perl.short-arg
410 else
411 test_must_fail git log -P \
412 --grep="[\d]\|"
413 fi &&
414 test_cmp expect.fixed actual.fixed.short-arg &&
415 test_cmp expect.extended actual.extended.short-arg &&
416 if test_have_prereq PCRE
417 then
418 test_cmp expect.perl actual.perl.short-arg
419 fi &&
421 git log --pretty=tformat:%s --fixed-strings \
422 --grep="(1|2)" >actual.fixed.long-arg &&
423 git log --pretty=tformat:%s --basic-regexp \
424 --grep="(.|.)" >actual.basic.long-arg &&
425 git log --pretty=tformat:%s --extended-regexp \
426 --grep="\|2" >actual.extended.long-arg &&
427 if test_have_prereq PCRE
428 then
429 git log --pretty=tformat:%s --perl-regexp \
430 --grep="[\d]\|" >actual.perl.long-arg &&
431 test_cmp expect.perl actual.perl.long-arg
432 else
433 test_must_fail git log --perl-regexp \
434 --grep="[\d]\|"
435 fi &&
436 test_cmp expect.fixed actual.fixed.long-arg &&
437 test_cmp expect.basic actual.basic.long-arg &&
438 test_cmp expect.extended actual.extended.long-arg
442 cat > expect <<EOF
443 * Second
444 * sixth
445 * fifth
446 * fourth
447 * third
448 * second
449 * initial
452 test_expect_success 'simple log --graph' '
453 git log --graph --pretty=tformat:%s >actual &&
454 test_cmp expect actual
457 cat > expect <<EOF
458 123 * Second
459 123 * sixth
460 123 * fifth
461 123 * fourth
462 123 * third
463 123 * second
464 123 * initial
467 test_expect_success 'simple log --graph --line-prefix="123 "' '
468 git log --graph --line-prefix="123 " --pretty=tformat:%s >actual &&
469 test_cmp expect actual
472 test_expect_success 'set up merge history' '
473 git checkout -b side HEAD~4 &&
474 test_commit side-1 1 1 &&
475 test_commit side-2 2 2 &&
476 git checkout master &&
477 git merge side
480 cat > expect <<\EOF
481 * Merge branch 'side'
483 | * side-2
484 | * side-1
485 * | Second
486 * | sixth
487 * | fifth
488 * | fourth
490 * third
491 * second
492 * initial
495 test_expect_success 'log --graph with merge' '
496 git log --graph --date-order --pretty=tformat:%s |
497 sed "s/ *\$//" >actual &&
498 test_cmp expect actual
501 cat > expect <<\EOF
502 | | | * Merge branch 'side'
503 | | | |\
504 | | | | * side-2
505 | | | | * side-1
506 | | | * | Second
507 | | | * | sixth
508 | | | * | fifth
509 | | | * | fourth
510 | | | |/
511 | | | * third
512 | | | * second
513 | | | * initial
516 test_expect_success 'log --graph --line-prefix="| | | " with merge' '
517 git log --line-prefix="| | | " --graph --date-order --pretty=tformat:%s |
518 sed "s/ *\$//" >actual &&
519 test_cmp expect actual
522 cat > expect.colors <<\EOF
523 * Merge branch 'side'
524 <BLUE>|<RESET><CYAN>\<RESET>
525 <BLUE>|<RESET> * side-2
526 <BLUE>|<RESET> * side-1
527 * <CYAN>|<RESET> Second
528 * <CYAN>|<RESET> sixth
529 * <CYAN>|<RESET> fifth
530 * <CYAN>|<RESET> fourth
531 <CYAN>|<RESET><CYAN>/<RESET>
532 * third
533 * second
534 * initial
537 test_expect_success 'log --graph with merge with log.graphColors' '
538 test_config log.graphColors " blue,invalid-color, cyan, red , " &&
539 git log --color=always --graph --date-order --pretty=tformat:%s |
540 test_decode_color | sed "s/ *\$//" >actual &&
541 test_cmp expect.colors actual
544 test_expect_success 'log --raw --graph -m with merge' '
545 git log --raw --graph --oneline -m master | head -n 500 >actual &&
546 grep "initial" actual
549 test_expect_success 'diff-tree --graph' '
550 git diff-tree --graph master^ | head -n 500 >actual &&
551 grep "one" actual
554 cat > expect <<\EOF
555 * commit master
556 |\ Merge: A B
557 | | Author: A U Thor <author@example.com>
559 | | Merge branch 'side'
561 | * commit tags/side-2
562 | | Author: A U Thor <author@example.com>
564 | | side-2
566 | * commit tags/side-1
567 | | Author: A U Thor <author@example.com>
569 | | side-1
571 * | commit master~1
572 | | Author: A U Thor <author@example.com>
574 | | Second
576 * | commit master~2
577 | | Author: A U Thor <author@example.com>
579 | | sixth
581 * | commit master~3
582 | | Author: A U Thor <author@example.com>
584 | | fifth
586 * | commit master~4
587 |/ Author: A U Thor <author@example.com>
589 | fourth
591 * commit tags/side-1~1
592 | Author: A U Thor <author@example.com>
594 | third
596 * commit tags/side-1~2
597 | Author: A U Thor <author@example.com>
599 | second
601 * commit tags/side-1~3
602 Author: A U Thor <author@example.com>
604 initial
607 test_expect_success 'log --graph with full output' '
608 git log --graph --date-order --pretty=short |
609 git name-rev --name-only --stdin |
610 sed "s/Merge:.*/Merge: A B/;s/ *\$//" >actual &&
611 test_cmp expect actual
614 test_expect_success 'set up more tangled history' '
615 git checkout -b tangle HEAD~6 &&
616 test_commit tangle-a tangle-a a &&
617 git merge master~3 &&
618 git merge side~1 &&
619 git checkout master &&
620 git merge tangle &&
621 git checkout -b reach &&
622 test_commit reach &&
623 git checkout master &&
624 git checkout -b octopus-a &&
625 test_commit octopus-a &&
626 git checkout master &&
627 git checkout -b octopus-b &&
628 test_commit octopus-b &&
629 git checkout master &&
630 test_commit seventh &&
631 git merge octopus-a octopus-b &&
632 git merge reach
635 cat > expect <<\EOF
636 * Merge tag 'reach'
640 *-. \ Merge tags 'octopus-a' and 'octopus-b'
641 |\ \ \
642 * | | | seventh
643 | | * | octopus-b
644 | |/ /
645 |/| |
646 | * | octopus-a
647 |/ /
648 | * reach
650 * Merge branch 'tangle'
652 | * Merge branch 'side' (early part) into tangle
653 | |\
654 | * \ Merge branch 'master' (early part) into tangle
655 | |\ \
656 | * | | tangle-a
657 * | | | Merge branch 'side'
658 |\ \ \ \
659 | * | | | side-2
660 | | |_|/
661 | |/| |
662 | * | | side-1
663 * | | | Second
664 * | | | sixth
665 | |_|/
666 |/| |
667 * | | fifth
668 * | | fourth
669 |/ /
670 * / third
672 * second
673 * initial
676 test_expect_success 'log --graph with merge' '
677 git log --graph --date-order --pretty=tformat:%s |
678 sed "s/ *\$//" >actual &&
679 test_cmp expect actual
682 test_expect_success 'log.decorate configuration' '
683 git log --oneline --no-decorate >expect.none &&
684 git log --oneline --decorate >expect.short &&
685 git log --oneline --decorate=full >expect.full &&
687 echo "[log] decorate" >>.git/config &&
688 git log --oneline >actual &&
689 test_cmp expect.short actual &&
691 test_config log.decorate true &&
692 git log --oneline >actual &&
693 test_cmp expect.short actual &&
694 git log --oneline --decorate=full >actual &&
695 test_cmp expect.full actual &&
696 git log --oneline --decorate=no >actual &&
697 test_cmp expect.none actual &&
699 test_config log.decorate no &&
700 git log --oneline >actual &&
701 test_cmp expect.none actual &&
702 git log --oneline --decorate >actual &&
703 test_cmp expect.short actual &&
704 git log --oneline --decorate=full >actual &&
705 test_cmp expect.full actual &&
707 test_config log.decorate 1 &&
708 git log --oneline >actual &&
709 test_cmp expect.short actual &&
710 git log --oneline --decorate=full >actual &&
711 test_cmp expect.full actual &&
712 git log --oneline --decorate=no >actual &&
713 test_cmp expect.none actual &&
715 test_config log.decorate short &&
716 git log --oneline >actual &&
717 test_cmp expect.short actual &&
718 git log --oneline --no-decorate >actual &&
719 test_cmp expect.none actual &&
720 git log --oneline --decorate=full >actual &&
721 test_cmp expect.full actual &&
723 test_config log.decorate full &&
724 git log --oneline >actual &&
725 test_cmp expect.full actual &&
726 git log --oneline --no-decorate >actual &&
727 test_cmp expect.none actual &&
728 git log --oneline --decorate >actual &&
729 test_cmp expect.short actual &&
731 test_unconfig log.decorate &&
732 git log --pretty=raw >expect.raw &&
733 test_config log.decorate full &&
734 git log --pretty=raw >actual &&
735 test_cmp expect.raw actual
739 test_expect_success 'decorate-refs with glob' '
740 cat >expect.decorate <<-\EOF &&
741 Merge-tag-reach
742 Merge-tags-octopus-a-and-octopus-b
743 seventh
744 octopus-b (octopus-b)
745 octopus-a (octopus-a)
746 reach
748 git log -n6 --decorate=short --pretty="tformat:%f%d" \
749 --decorate-refs="heads/octopus*" >actual &&
750 test_cmp expect.decorate actual
753 test_expect_success 'decorate-refs without globs' '
754 cat >expect.decorate <<-\EOF &&
755 Merge-tag-reach
756 Merge-tags-octopus-a-and-octopus-b
757 seventh
758 octopus-b
759 octopus-a
760 reach (tag: reach)
762 git log -n6 --decorate=short --pretty="tformat:%f%d" \
763 --decorate-refs="tags/reach" >actual &&
764 test_cmp expect.decorate actual
767 test_expect_success 'multiple decorate-refs' '
768 cat >expect.decorate <<-\EOF &&
769 Merge-tag-reach
770 Merge-tags-octopus-a-and-octopus-b
771 seventh
772 octopus-b (octopus-b)
773 octopus-a (octopus-a)
774 reach (tag: reach)
776 git log -n6 --decorate=short --pretty="tformat:%f%d" \
777 --decorate-refs="heads/octopus*" \
778 --decorate-refs="tags/reach" >actual &&
779 test_cmp expect.decorate actual
782 test_expect_success 'decorate-refs-exclude with glob' '
783 cat >expect.decorate <<-\EOF &&
784 Merge-tag-reach (HEAD -> master)
785 Merge-tags-octopus-a-and-octopus-b
786 seventh (tag: seventh)
787 octopus-b (tag: octopus-b)
788 octopus-a (tag: octopus-a)
789 reach (tag: reach, reach)
791 git log -n6 --decorate=short --pretty="tformat:%f%d" \
792 --decorate-refs-exclude="heads/octopus*" >actual &&
793 test_cmp expect.decorate actual
796 test_expect_success 'decorate-refs-exclude without globs' '
797 cat >expect.decorate <<-\EOF &&
798 Merge-tag-reach (HEAD -> master)
799 Merge-tags-octopus-a-and-octopus-b
800 seventh (tag: seventh)
801 octopus-b (tag: octopus-b, octopus-b)
802 octopus-a (tag: octopus-a, octopus-a)
803 reach (reach)
805 git log -n6 --decorate=short --pretty="tformat:%f%d" \
806 --decorate-refs-exclude="tags/reach" >actual &&
807 test_cmp expect.decorate actual
810 test_expect_success 'multiple decorate-refs-exclude' '
811 cat >expect.decorate <<-\EOF &&
812 Merge-tag-reach (HEAD -> master)
813 Merge-tags-octopus-a-and-octopus-b
814 seventh (tag: seventh)
815 octopus-b (tag: octopus-b)
816 octopus-a (tag: octopus-a)
817 reach (reach)
819 git log -n6 --decorate=short --pretty="tformat:%f%d" \
820 --decorate-refs-exclude="heads/octopus*" \
821 --decorate-refs-exclude="tags/reach" >actual &&
822 test_cmp expect.decorate actual
825 test_expect_success 'decorate-refs and decorate-refs-exclude' '
826 cat >expect.decorate <<-\EOF &&
827 Merge-tag-reach (master)
828 Merge-tags-octopus-a-and-octopus-b
829 seventh
830 octopus-b
831 octopus-a
832 reach (reach)
834 git log -n6 --decorate=short --pretty="tformat:%f%d" \
835 --decorate-refs="heads/*" \
836 --decorate-refs-exclude="heads/oc*" >actual &&
837 test_cmp expect.decorate actual
840 test_expect_success 'decorate-refs-exclude and simplify-by-decoration' '
841 cat >expect.decorate <<-\EOF &&
842 Merge-tag-reach (HEAD -> master)
843 reach (tag: reach, reach)
844 seventh (tag: seventh)
845 Merge-branch-tangle
846 Merge-branch-side-early-part-into-tangle (tangle)
847 tangle-a (tag: tangle-a)
849 git log -n6 --decorate=short --pretty="tformat:%f%d" \
850 --decorate-refs-exclude="*octopus*" \
851 --simplify-by-decoration >actual &&
852 test_cmp expect.decorate actual
855 test_expect_success 'log.decorate config parsing' '
856 git log --oneline --decorate=full >expect.full &&
857 git log --oneline --decorate=short >expect.short &&
859 test_config log.decorate full &&
860 test_config log.mailmap true &&
861 git log --oneline >actual &&
862 test_cmp expect.full actual &&
863 git log --oneline --decorate=short >actual &&
864 test_cmp expect.short actual
867 test_expect_success TTY 'log output on a TTY' '
868 git log --color --oneline --decorate >expect.short &&
870 test_terminal git log --oneline >actual &&
871 test_cmp expect.short actual
874 test_expect_success 'reflog is expected format' '
875 git log -g --abbrev-commit --pretty=oneline >expect &&
876 git reflog >actual &&
877 test_cmp expect actual
880 test_expect_success 'whatchanged is expected format' '
881 git log --no-merges --raw >expect &&
882 git whatchanged >actual &&
883 test_cmp expect actual
886 test_expect_success 'log.abbrevCommit configuration' '
887 git log --abbrev-commit >expect.log.abbrev &&
888 git log --no-abbrev-commit >expect.log.full &&
889 git log --pretty=raw >expect.log.raw &&
890 git reflog --abbrev-commit >expect.reflog.abbrev &&
891 git reflog --no-abbrev-commit >expect.reflog.full &&
892 git whatchanged --abbrev-commit >expect.whatchanged.abbrev &&
893 git whatchanged --no-abbrev-commit >expect.whatchanged.full &&
895 test_config log.abbrevCommit true &&
897 git log >actual &&
898 test_cmp expect.log.abbrev actual &&
899 git log --no-abbrev-commit >actual &&
900 test_cmp expect.log.full actual &&
902 git log --pretty=raw >actual &&
903 test_cmp expect.log.raw actual &&
905 git reflog >actual &&
906 test_cmp expect.reflog.abbrev actual &&
907 git reflog --no-abbrev-commit >actual &&
908 test_cmp expect.reflog.full actual &&
910 git whatchanged >actual &&
911 test_cmp expect.whatchanged.abbrev actual &&
912 git whatchanged --no-abbrev-commit >actual &&
913 test_cmp expect.whatchanged.full actual
916 test_expect_success 'show added path under "--follow -M"' '
917 # This tests for a regression introduced in v1.7.2-rc0~103^2~2
918 test_create_repo regression &&
920 cd regression &&
921 test_commit needs-another-commit &&
922 test_commit foo.bar &&
923 git log -M --follow -p foo.bar.t &&
924 git log -M --follow --stat foo.bar.t &&
925 git log -M --follow --name-only foo.bar.t
929 test_expect_success 'git log -c --follow' '
930 test_create_repo follow-c &&
932 cd follow-c &&
933 test_commit initial file original &&
934 git rm file &&
935 test_commit rename file2 original &&
936 git reset --hard initial &&
937 test_commit modify file foo &&
938 git merge -m merge rename &&
939 git log -c --follow file2
943 cat >expect <<\EOF
944 * commit COMMIT_OBJECT_NAME
945 |\ Merge: MERGE_PARENTS
946 | | Author: A U Thor <author@example.com>
948 | | Merge HEADS DESCRIPTION
950 | * commit COMMIT_OBJECT_NAME
951 | | Author: A U Thor <author@example.com>
953 | | reach
954 | | ---
955 | | reach.t | 1 +
956 | | 1 file changed, 1 insertion(+)
958 | | diff --git a/reach.t b/reach.t
959 | | new file mode 100644
960 | | index 0000000..10c9591
961 | | --- /dev/null
962 | | +++ b/reach.t
963 | | @@ -0,0 +1 @@
964 | | +reach
967 *-. \ commit COMMIT_OBJECT_NAME
968 |\ \ \ Merge: MERGE_PARENTS
969 | | | | Author: A U Thor <author@example.com>
970 | | | |
971 | | | | Merge HEADS DESCRIPTION
972 | | | |
973 | | * | commit COMMIT_OBJECT_NAME
974 | | |/ Author: A U Thor <author@example.com>
975 | | |
976 | | | octopus-b
977 | | | ---
978 | | | octopus-b.t | 1 +
979 | | | 1 file changed, 1 insertion(+)
980 | | |
981 | | | diff --git a/octopus-b.t b/octopus-b.t
982 | | | new file mode 100644
983 | | | index 0000000..d5fcad0
984 | | | --- /dev/null
985 | | | +++ b/octopus-b.t
986 | | | @@ -0,0 +1 @@
987 | | | +octopus-b
988 | | |
989 | * | commit COMMIT_OBJECT_NAME
990 | |/ Author: A U Thor <author@example.com>
992 | | octopus-a
993 | | ---
994 | | octopus-a.t | 1 +
995 | | 1 file changed, 1 insertion(+)
997 | | diff --git a/octopus-a.t b/octopus-a.t
998 | | new file mode 100644
999 | | index 0000000..11ee015
1000 | | --- /dev/null
1001 | | +++ b/octopus-a.t
1002 | | @@ -0,0 +1 @@
1003 | | +octopus-a
1005 * | commit COMMIT_OBJECT_NAME
1006 |/ Author: A U Thor <author@example.com>
1008 | seventh
1009 | ---
1010 | seventh.t | 1 +
1011 | 1 file changed, 1 insertion(+)
1013 | diff --git a/seventh.t b/seventh.t
1014 | new file mode 100644
1015 | index 0000000..9744ffc
1016 | --- /dev/null
1017 | +++ b/seventh.t
1018 | @@ -0,0 +1 @@
1019 | +seventh
1021 * commit COMMIT_OBJECT_NAME
1022 |\ Merge: MERGE_PARENTS
1023 | | Author: A U Thor <author@example.com>
1025 | | Merge branch 'tangle'
1027 | * commit COMMIT_OBJECT_NAME
1028 | |\ Merge: MERGE_PARENTS
1029 | | | Author: A U Thor <author@example.com>
1030 | | |
1031 | | | Merge branch 'side' (early part) into tangle
1032 | | |
1033 | * | commit COMMIT_OBJECT_NAME
1034 | |\ \ Merge: MERGE_PARENTS
1035 | | | | Author: A U Thor <author@example.com>
1036 | | | |
1037 | | | | Merge branch 'master' (early part) into tangle
1038 | | | |
1039 | * | | commit COMMIT_OBJECT_NAME
1040 | | | | Author: A U Thor <author@example.com>
1041 | | | |
1042 | | | | tangle-a
1043 | | | | ---
1044 | | | | tangle-a | 1 +
1045 | | | | 1 file changed, 1 insertion(+)
1046 | | | |
1047 | | | | diff --git a/tangle-a b/tangle-a
1048 | | | | new file mode 100644
1049 | | | | index 0000000..7898192
1050 | | | | --- /dev/null
1051 | | | | +++ b/tangle-a
1052 | | | | @@ -0,0 +1 @@
1053 | | | | +a
1054 | | | |
1055 * | | | commit COMMIT_OBJECT_NAME
1056 |\ \ \ \ Merge: MERGE_PARENTS
1057 | | | | | Author: A U Thor <author@example.com>
1058 | | | | |
1059 | | | | | Merge branch 'side'
1060 | | | | |
1061 | * | | | commit COMMIT_OBJECT_NAME
1062 | | |_|/ Author: A U Thor <author@example.com>
1063 | |/| |
1064 | | | | side-2
1065 | | | | ---
1066 | | | | 2 | 1 +
1067 | | | | 1 file changed, 1 insertion(+)
1068 | | | |
1069 | | | | diff --git a/2 b/2
1070 | | | | new file mode 100644
1071 | | | | index 0000000..0cfbf08
1072 | | | | --- /dev/null
1073 | | | | +++ b/2
1074 | | | | @@ -0,0 +1 @@
1075 | | | | +2
1076 | | | |
1077 | * | | commit COMMIT_OBJECT_NAME
1078 | | | | Author: A U Thor <author@example.com>
1079 | | | |
1080 | | | | side-1
1081 | | | | ---
1082 | | | | 1 | 1 +
1083 | | | | 1 file changed, 1 insertion(+)
1084 | | | |
1085 | | | | diff --git a/1 b/1
1086 | | | | new file mode 100644
1087 | | | | index 0000000..d00491f
1088 | | | | --- /dev/null
1089 | | | | +++ b/1
1090 | | | | @@ -0,0 +1 @@
1091 | | | | +1
1092 | | | |
1093 * | | | commit COMMIT_OBJECT_NAME
1094 | | | | Author: A U Thor <author@example.com>
1095 | | | |
1096 | | | | Second
1097 | | | | ---
1098 | | | | one | 1 +
1099 | | | | 1 file changed, 1 insertion(+)
1100 | | | |
1101 | | | | diff --git a/one b/one
1102 | | | | new file mode 100644
1103 | | | | index 0000000..9a33383
1104 | | | | --- /dev/null
1105 | | | | +++ b/one
1106 | | | | @@ -0,0 +1 @@
1107 | | | | +case
1108 | | | |
1109 * | | | commit COMMIT_OBJECT_NAME
1110 | |_|/ Author: A U Thor <author@example.com>
1111 |/| |
1112 | | | sixth
1113 | | | ---
1114 | | | a/two | 1 -
1115 | | | 1 file changed, 1 deletion(-)
1116 | | |
1117 | | | diff --git a/a/two b/a/two
1118 | | | deleted file mode 100644
1119 | | | index 9245af5..0000000
1120 | | | --- a/a/two
1121 | | | +++ /dev/null
1122 | | | @@ -1 +0,0 @@
1123 | | | -ni
1124 | | |
1125 * | | commit COMMIT_OBJECT_NAME
1126 | | | Author: A U Thor <author@example.com>
1127 | | |
1128 | | | fifth
1129 | | | ---
1130 | | | a/two | 1 +
1131 | | | 1 file changed, 1 insertion(+)
1132 | | |
1133 | | | diff --git a/a/two b/a/two
1134 | | | new file mode 100644
1135 | | | index 0000000..9245af5
1136 | | | --- /dev/null
1137 | | | +++ b/a/two
1138 | | | @@ -0,0 +1 @@
1139 | | | +ni
1140 | | |
1141 * | | commit COMMIT_OBJECT_NAME
1142 |/ / Author: A U Thor <author@example.com>
1144 | | fourth
1145 | | ---
1146 | | ein | 1 +
1147 | | 1 file changed, 1 insertion(+)
1149 | | diff --git a/ein b/ein
1150 | | new file mode 100644
1151 | | index 0000000..9d7e69f
1152 | | --- /dev/null
1153 | | +++ b/ein
1154 | | @@ -0,0 +1 @@
1155 | | +ichi
1157 * | commit COMMIT_OBJECT_NAME
1158 |/ Author: A U Thor <author@example.com>
1160 | third
1161 | ---
1162 | ichi | 1 +
1163 | one | 1 -
1164 | 2 files changed, 1 insertion(+), 1 deletion(-)
1166 | diff --git a/ichi b/ichi
1167 | new file mode 100644
1168 | index 0000000..9d7e69f
1169 | --- /dev/null
1170 | +++ b/ichi
1171 | @@ -0,0 +1 @@
1172 | +ichi
1173 | diff --git a/one b/one
1174 | deleted file mode 100644
1175 | index 9d7e69f..0000000
1176 | --- a/one
1177 | +++ /dev/null
1178 | @@ -1 +0,0 @@
1179 | -ichi
1181 * commit COMMIT_OBJECT_NAME
1182 | Author: A U Thor <author@example.com>
1184 | second
1185 | ---
1186 | one | 2 +-
1187 | 1 file changed, 1 insertion(+), 1 deletion(-)
1189 | diff --git a/one b/one
1190 | index 5626abf..9d7e69f 100644
1191 | --- a/one
1192 | +++ b/one
1193 | @@ -1 +1 @@
1194 | -one
1195 | +ichi
1197 * commit COMMIT_OBJECT_NAME
1198 Author: A U Thor <author@example.com>
1200 initial
1202 one | 1 +
1203 1 file changed, 1 insertion(+)
1205 diff --git a/one b/one
1206 new file mode 100644
1207 index 0000000..5626abf
1208 --- /dev/null
1209 +++ b/one
1210 @@ -0,0 +1 @@
1211 +one
1214 sanitize_output () {
1215 sed -e 's/ *$//' \
1216 -e 's/commit [0-9a-f]*$/commit COMMIT_OBJECT_NAME/' \
1217 -e 's/Merge: [ 0-9a-f]*$/Merge: MERGE_PARENTS/' \
1218 -e 's/Merge tag.*/Merge HEADS DESCRIPTION/' \
1219 -e 's/Merge commit.*/Merge HEADS DESCRIPTION/' \
1220 -e 's/, 0 deletions(-)//' \
1221 -e 's/, 0 insertions(+)//' \
1222 -e 's/ 1 files changed, / 1 file changed, /' \
1223 -e 's/, 1 deletions(-)/, 1 deletion(-)/' \
1224 -e 's/, 1 insertions(+)/, 1 insertion(+)/'
1227 test_expect_success 'log --graph with diff and stats' '
1228 git log --no-renames --graph --pretty=short --stat -p >actual &&
1229 sanitize_output >actual.sanitized <actual &&
1230 test_i18ncmp expect actual.sanitized
1233 cat >expect <<\EOF
1234 *** * commit COMMIT_OBJECT_NAME
1235 *** |\ Merge: MERGE_PARENTS
1236 *** | | Author: A U Thor <author@example.com>
1237 *** | |
1238 *** | | Merge HEADS DESCRIPTION
1239 *** | |
1240 *** | * commit COMMIT_OBJECT_NAME
1241 *** | | Author: A U Thor <author@example.com>
1242 *** | |
1243 *** | | reach
1244 *** | | ---
1245 *** | | reach.t | 1 +
1246 *** | | 1 file changed, 1 insertion(+)
1247 *** | |
1248 *** | | diff --git a/reach.t b/reach.t
1249 *** | | new file mode 100644
1250 *** | | index 0000000..10c9591
1251 *** | | --- /dev/null
1252 *** | | +++ b/reach.t
1253 *** | | @@ -0,0 +1 @@
1254 *** | | +reach
1255 *** | |
1256 *** | \
1257 *** *-. \ commit COMMIT_OBJECT_NAME
1258 *** |\ \ \ Merge: MERGE_PARENTS
1259 *** | | | | Author: A U Thor <author@example.com>
1260 *** | | | |
1261 *** | | | | Merge HEADS DESCRIPTION
1262 *** | | | |
1263 *** | | * | commit COMMIT_OBJECT_NAME
1264 *** | | |/ Author: A U Thor <author@example.com>
1265 *** | | |
1266 *** | | | octopus-b
1267 *** | | | ---
1268 *** | | | octopus-b.t | 1 +
1269 *** | | | 1 file changed, 1 insertion(+)
1270 *** | | |
1271 *** | | | diff --git a/octopus-b.t b/octopus-b.t
1272 *** | | | new file mode 100644
1273 *** | | | index 0000000..d5fcad0
1274 *** | | | --- /dev/null
1275 *** | | | +++ b/octopus-b.t
1276 *** | | | @@ -0,0 +1 @@
1277 *** | | | +octopus-b
1278 *** | | |
1279 *** | * | commit COMMIT_OBJECT_NAME
1280 *** | |/ Author: A U Thor <author@example.com>
1281 *** | |
1282 *** | | octopus-a
1283 *** | | ---
1284 *** | | octopus-a.t | 1 +
1285 *** | | 1 file changed, 1 insertion(+)
1286 *** | |
1287 *** | | diff --git a/octopus-a.t b/octopus-a.t
1288 *** | | new file mode 100644
1289 *** | | index 0000000..11ee015
1290 *** | | --- /dev/null
1291 *** | | +++ b/octopus-a.t
1292 *** | | @@ -0,0 +1 @@
1293 *** | | +octopus-a
1294 *** | |
1295 *** * | commit COMMIT_OBJECT_NAME
1296 *** |/ Author: A U Thor <author@example.com>
1297 *** |
1298 *** | seventh
1299 *** | ---
1300 *** | seventh.t | 1 +
1301 *** | 1 file changed, 1 insertion(+)
1302 *** |
1303 *** | diff --git a/seventh.t b/seventh.t
1304 *** | new file mode 100644
1305 *** | index 0000000..9744ffc
1306 *** | --- /dev/null
1307 *** | +++ b/seventh.t
1308 *** | @@ -0,0 +1 @@
1309 *** | +seventh
1310 *** |
1311 *** * commit COMMIT_OBJECT_NAME
1312 *** |\ Merge: MERGE_PARENTS
1313 *** | | Author: A U Thor <author@example.com>
1314 *** | |
1315 *** | | Merge branch 'tangle'
1316 *** | |
1317 *** | * commit COMMIT_OBJECT_NAME
1318 *** | |\ Merge: MERGE_PARENTS
1319 *** | | | Author: A U Thor <author@example.com>
1320 *** | | |
1321 *** | | | Merge branch 'side' (early part) into tangle
1322 *** | | |
1323 *** | * | commit COMMIT_OBJECT_NAME
1324 *** | |\ \ Merge: MERGE_PARENTS
1325 *** | | | | Author: A U Thor <author@example.com>
1326 *** | | | |
1327 *** | | | | Merge branch 'master' (early part) into tangle
1328 *** | | | |
1329 *** | * | | commit COMMIT_OBJECT_NAME
1330 *** | | | | Author: A U Thor <author@example.com>
1331 *** | | | |
1332 *** | | | | tangle-a
1333 *** | | | | ---
1334 *** | | | | tangle-a | 1 +
1335 *** | | | | 1 file changed, 1 insertion(+)
1336 *** | | | |
1337 *** | | | | diff --git a/tangle-a b/tangle-a
1338 *** | | | | new file mode 100644
1339 *** | | | | index 0000000..7898192
1340 *** | | | | --- /dev/null
1341 *** | | | | +++ b/tangle-a
1342 *** | | | | @@ -0,0 +1 @@
1343 *** | | | | +a
1344 *** | | | |
1345 *** * | | | commit COMMIT_OBJECT_NAME
1346 *** |\ \ \ \ Merge: MERGE_PARENTS
1347 *** | | | | | Author: A U Thor <author@example.com>
1348 *** | | | | |
1349 *** | | | | | Merge branch 'side'
1350 *** | | | | |
1351 *** | * | | | commit COMMIT_OBJECT_NAME
1352 *** | | |_|/ Author: A U Thor <author@example.com>
1353 *** | |/| |
1354 *** | | | | side-2
1355 *** | | | | ---
1356 *** | | | | 2 | 1 +
1357 *** | | | | 1 file changed, 1 insertion(+)
1358 *** | | | |
1359 *** | | | | diff --git a/2 b/2
1360 *** | | | | new file mode 100644
1361 *** | | | | index 0000000..0cfbf08
1362 *** | | | | --- /dev/null
1363 *** | | | | +++ b/2
1364 *** | | | | @@ -0,0 +1 @@
1365 *** | | | | +2
1366 *** | | | |
1367 *** | * | | commit COMMIT_OBJECT_NAME
1368 *** | | | | Author: A U Thor <author@example.com>
1369 *** | | | |
1370 *** | | | | side-1
1371 *** | | | | ---
1372 *** | | | | 1 | 1 +
1373 *** | | | | 1 file changed, 1 insertion(+)
1374 *** | | | |
1375 *** | | | | diff --git a/1 b/1
1376 *** | | | | new file mode 100644
1377 *** | | | | index 0000000..d00491f
1378 *** | | | | --- /dev/null
1379 *** | | | | +++ b/1
1380 *** | | | | @@ -0,0 +1 @@
1381 *** | | | | +1
1382 *** | | | |
1383 *** * | | | commit COMMIT_OBJECT_NAME
1384 *** | | | | Author: A U Thor <author@example.com>
1385 *** | | | |
1386 *** | | | | Second
1387 *** | | | | ---
1388 *** | | | | one | 1 +
1389 *** | | | | 1 file changed, 1 insertion(+)
1390 *** | | | |
1391 *** | | | | diff --git a/one b/one
1392 *** | | | | new file mode 100644
1393 *** | | | | index 0000000..9a33383
1394 *** | | | | --- /dev/null
1395 *** | | | | +++ b/one
1396 *** | | | | @@ -0,0 +1 @@
1397 *** | | | | +case
1398 *** | | | |
1399 *** * | | | commit COMMIT_OBJECT_NAME
1400 *** | |_|/ Author: A U Thor <author@example.com>
1401 *** |/| |
1402 *** | | | sixth
1403 *** | | | ---
1404 *** | | | a/two | 1 -
1405 *** | | | 1 file changed, 1 deletion(-)
1406 *** | | |
1407 *** | | | diff --git a/a/two b/a/two
1408 *** | | | deleted file mode 100644
1409 *** | | | index 9245af5..0000000
1410 *** | | | --- a/a/two
1411 *** | | | +++ /dev/null
1412 *** | | | @@ -1 +0,0 @@
1413 *** | | | -ni
1414 *** | | |
1415 *** * | | commit COMMIT_OBJECT_NAME
1416 *** | | | Author: A U Thor <author@example.com>
1417 *** | | |
1418 *** | | | fifth
1419 *** | | | ---
1420 *** | | | a/two | 1 +
1421 *** | | | 1 file changed, 1 insertion(+)
1422 *** | | |
1423 *** | | | diff --git a/a/two b/a/two
1424 *** | | | new file mode 100644
1425 *** | | | index 0000000..9245af5
1426 *** | | | --- /dev/null
1427 *** | | | +++ b/a/two
1428 *** | | | @@ -0,0 +1 @@
1429 *** | | | +ni
1430 *** | | |
1431 *** * | | commit COMMIT_OBJECT_NAME
1432 *** |/ / Author: A U Thor <author@example.com>
1433 *** | |
1434 *** | | fourth
1435 *** | | ---
1436 *** | | ein | 1 +
1437 *** | | 1 file changed, 1 insertion(+)
1438 *** | |
1439 *** | | diff --git a/ein b/ein
1440 *** | | new file mode 100644
1441 *** | | index 0000000..9d7e69f
1442 *** | | --- /dev/null
1443 *** | | +++ b/ein
1444 *** | | @@ -0,0 +1 @@
1445 *** | | +ichi
1446 *** | |
1447 *** * | commit COMMIT_OBJECT_NAME
1448 *** |/ Author: A U Thor <author@example.com>
1449 *** |
1450 *** | third
1451 *** | ---
1452 *** | ichi | 1 +
1453 *** | one | 1 -
1454 *** | 2 files changed, 1 insertion(+), 1 deletion(-)
1455 *** |
1456 *** | diff --git a/ichi b/ichi
1457 *** | new file mode 100644
1458 *** | index 0000000..9d7e69f
1459 *** | --- /dev/null
1460 *** | +++ b/ichi
1461 *** | @@ -0,0 +1 @@
1462 *** | +ichi
1463 *** | diff --git a/one b/one
1464 *** | deleted file mode 100644
1465 *** | index 9d7e69f..0000000
1466 *** | --- a/one
1467 *** | +++ /dev/null
1468 *** | @@ -1 +0,0 @@
1469 *** | -ichi
1470 *** |
1471 *** * commit COMMIT_OBJECT_NAME
1472 *** | Author: A U Thor <author@example.com>
1473 *** |
1474 *** | second
1475 *** | ---
1476 *** | one | 2 +-
1477 *** | 1 file changed, 1 insertion(+), 1 deletion(-)
1478 *** |
1479 *** | diff --git a/one b/one
1480 *** | index 5626abf..9d7e69f 100644
1481 *** | --- a/one
1482 *** | +++ b/one
1483 *** | @@ -1 +1 @@
1484 *** | -one
1485 *** | +ichi
1486 *** |
1487 *** * commit COMMIT_OBJECT_NAME
1488 *** Author: A U Thor <author@example.com>
1490 *** initial
1491 *** ---
1492 *** one | 1 +
1493 *** 1 file changed, 1 insertion(+)
1495 *** diff --git a/one b/one
1496 *** new file mode 100644
1497 *** index 0000000..5626abf
1498 *** --- /dev/null
1499 *** +++ b/one
1500 *** @@ -0,0 +1 @@
1501 *** +one
1504 test_expect_success 'log --line-prefix="*** " --graph with diff and stats' '
1505 git log --line-prefix="*** " --no-renames --graph --pretty=short --stat -p >actual &&
1506 sanitize_output >actual.sanitized <actual &&
1507 test_i18ncmp expect actual.sanitized
1510 cat >expect <<-\EOF
1511 * reach
1513 | A reach.t
1514 * Merge branch 'tangle'
1515 * Merge branch 'side'
1517 | * side-2
1519 | A 2
1520 * Second
1522 | A one
1523 * sixth
1525 D a/two
1528 test_expect_success 'log --graph with --name-status' '
1529 git log --graph --format=%s --name-status tangle..reach >actual &&
1530 sanitize_output <actual >actual.sanitized &&
1531 test_cmp expect actual.sanitized
1534 cat >expect <<-\EOF
1535 * reach
1537 | reach.t
1538 * Merge branch 'tangle'
1539 * Merge branch 'side'
1541 | * side-2
1544 * Second
1546 | one
1547 * sixth
1549 a/two
1552 test_expect_success 'log --graph with --name-only' '
1553 git log --graph --format=%s --name-only tangle..reach >actual &&
1554 sanitize_output <actual >actual.sanitized &&
1555 test_cmp expect actual.sanitized
1558 test_expect_success 'dotdot is a parent directory' '
1559 mkdir -p a/b &&
1560 ( echo sixth && echo fifth ) >expect &&
1561 ( cd a/b && git log --format=%s .. ) >actual &&
1562 test_cmp expect actual
1565 test_expect_success GPG 'setup signed branch' '
1566 test_when_finished "git reset --hard && git checkout master" &&
1567 git checkout -b signed master &&
1568 echo foo >foo &&
1569 git add foo &&
1570 git commit -S -m signed_commit
1573 test_expect_success GPG 'setup signed branch with subkey' '
1574 test_when_finished "git reset --hard && git checkout master" &&
1575 git checkout -b signed-subkey master &&
1576 echo foo >foo &&
1577 git add foo &&
1578 git commit -SB7227189 -m signed_commit
1581 test_expect_success GPGSM 'setup signed branch x509' '
1582 test_when_finished "git reset --hard && git checkout master" &&
1583 git checkout -b signed-x509 master &&
1584 echo foo >foo &&
1585 git add foo &&
1586 test_config gpg.format x509 &&
1587 test_config user.signingkey $GIT_COMMITTER_EMAIL &&
1588 git commit -S -m signed_commit
1591 test_expect_success GPGSM 'log x509 fingerprint' '
1592 echo "F8BF62E0693D0694816377099909C779FA23FD65 | " >expect &&
1593 git log -n1 --format="%GF | %GP" signed-x509 >actual &&
1594 test_cmp expect actual
1597 test_expect_success GPGSM 'log OpenPGP fingerprint' '
1598 echo "D4BE22311AD3131E5EDA29A461092E85B7227189" > expect &&
1599 git log -n1 --format="%GP" signed-subkey >actual &&
1600 test_cmp expect actual
1603 test_expect_success GPG 'log --graph --show-signature' '
1604 git log --graph --show-signature -n1 signed >actual &&
1605 grep "^| gpg: Signature made" actual &&
1606 grep "^| gpg: Good signature" actual
1609 test_expect_success GPGSM 'log --graph --show-signature x509' '
1610 git log --graph --show-signature -n1 signed-x509 >actual &&
1611 grep "^| gpgsm: Signature made" actual &&
1612 grep "^| gpgsm: Good signature" actual
1615 test_expect_success GPG 'log --graph --show-signature for merged tag' '
1616 test_when_finished "git reset --hard && git checkout master" &&
1617 git checkout -b plain master &&
1618 echo aaa >bar &&
1619 git add bar &&
1620 git commit -m bar_commit &&
1621 git checkout -b tagged master &&
1622 echo bbb >baz &&
1623 git add baz &&
1624 git commit -m baz_commit &&
1625 git tag -s -m signed_tag_msg signed_tag &&
1626 git checkout plain &&
1627 git merge --no-ff -m msg signed_tag &&
1628 git log --graph --show-signature -n1 plain >actual &&
1629 grep "^|\\\ merged tag" actual &&
1630 grep "^| | gpg: Signature made" actual &&
1631 grep "^| | gpg: Good signature" actual
1634 test_expect_success GPGSM 'log --graph --show-signature for merged tag x509' '
1635 test_when_finished "git reset --hard && git checkout master" &&
1636 test_config gpg.format x509 &&
1637 test_config user.signingkey $GIT_COMMITTER_EMAIL &&
1638 git checkout -b plain-x509 master &&
1639 echo aaa >bar &&
1640 git add bar &&
1641 git commit -m bar_commit &&
1642 git checkout -b tagged-x509 master &&
1643 echo bbb >baz &&
1644 git add baz &&
1645 git commit -m baz_commit &&
1646 git tag -s -m signed_tag_msg signed_tag_x509 &&
1647 git checkout plain-x509 &&
1648 git merge --no-ff -m msg signed_tag_x509 &&
1649 git log --graph --show-signature -n1 plain-x509 >actual &&
1650 grep "^|\\\ merged tag" actual &&
1651 grep "^| | gpgsm: Signature made" actual &&
1652 grep "^| | gpgsm: Good signature" actual
1655 test_expect_success GPG '--no-show-signature overrides --show-signature' '
1656 git log -1 --show-signature --no-show-signature signed >actual &&
1657 ! grep "^gpg:" actual
1660 test_expect_success GPG 'log.showsignature=true behaves like --show-signature' '
1661 test_config log.showsignature true &&
1662 git log -1 signed >actual &&
1663 grep "gpg: Signature made" actual &&
1664 grep "gpg: Good signature" actual
1667 test_expect_success GPG '--no-show-signature overrides log.showsignature=true' '
1668 test_config log.showsignature true &&
1669 git log -1 --no-show-signature signed >actual &&
1670 ! grep "^gpg:" actual
1673 test_expect_success GPG '--show-signature overrides log.showsignature=false' '
1674 test_config log.showsignature false &&
1675 git log -1 --show-signature signed >actual &&
1676 grep "gpg: Signature made" actual &&
1677 grep "gpg: Good signature" actual
1680 test_expect_success 'log --graph --no-walk is forbidden' '
1681 test_must_fail git log --graph --no-walk
1684 test_expect_success 'log diagnoses bogus HEAD' '
1685 git init empty &&
1686 test_must_fail git -C empty log 2>stderr &&
1687 test_i18ngrep does.not.have.any.commits stderr &&
1688 echo 1234abcd >empty/.git/refs/heads/master &&
1689 test_must_fail git -C empty log 2>stderr &&
1690 test_i18ngrep broken stderr &&
1691 echo "ref: refs/heads/invalid.lock" >empty/.git/HEAD &&
1692 test_must_fail git -C empty log 2>stderr &&
1693 test_i18ngrep broken stderr &&
1694 test_must_fail git -C empty log --default totally-bogus 2>stderr &&
1695 test_i18ngrep broken stderr
1698 test_expect_success 'log does not default to HEAD when rev input is given' '
1699 git log --branches=does-not-exist >actual &&
1700 test_must_be_empty actual
1703 test_expect_success 'set up --source tests' '
1704 git checkout --orphan source-a &&
1705 test_commit one &&
1706 test_commit two &&
1707 git checkout -b source-b HEAD^ &&
1708 test_commit three
1711 test_expect_success 'log --source paints branch names' '
1712 cat >expect <<-\EOF &&
1713 09e12a9 source-b three
1714 8e393e1 source-a two
1715 1ac6c77 source-b one
1717 git log --oneline --source source-a source-b >actual &&
1718 test_cmp expect actual
1721 test_expect_success 'log --source paints tag names' '
1722 git tag -m tagged source-tag &&
1723 cat >expect <<-\EOF &&
1724 09e12a9 source-tag three
1725 8e393e1 source-a two
1726 1ac6c77 source-tag one
1728 git log --oneline --source source-tag source-a >actual &&
1729 test_cmp expect actual
1732 test_expect_success 'log --source paints symmetric ranges' '
1733 cat >expect <<-\EOF &&
1734 09e12a9 source-b three
1735 8e393e1 source-a two
1737 git log --oneline --source source-a...source-b >actual &&
1738 test_cmp expect actual
1741 test_expect_success '--exclude-promisor-objects does not BUG-crash' '
1742 test_must_fail git log --exclude-promisor-objects source-a
1745 test_expect_success 'log --end-of-options' '
1746 git update-ref refs/heads/--source HEAD &&
1747 git log --end-of-options --source >actual &&
1748 git log >expect &&
1749 test_cmp expect actual
1752 test_done