Merge branch 'rs/log-invert-grep-with-headers'
[git/debian.git] / t / t4202-log.sh
blob504955986197224ecc41c15e52fea98a021b9f00
1 #!/bin/sh
3 test_description='git log'
5 GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
6 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
8 . ./test-lib.sh
9 . "$TEST_DIRECTORY/lib-gpg.sh"
10 . "$TEST_DIRECTORY/lib-terminal.sh"
11 . "$TEST_DIRECTORY/lib-log-graph.sh"
13 test_cmp_graph () {
14 lib_test_cmp_graph --format=%s "$@"
17 test_expect_success setup '
19 echo one >one &&
20 git add one &&
21 test_tick &&
22 git commit -m initial &&
24 echo ichi >one &&
25 git add one &&
26 test_tick &&
27 git commit -m second &&
29 git mv one ichi &&
30 test_tick &&
31 git commit -m third &&
33 cp ichi ein &&
34 git add ein &&
35 test_tick &&
36 git commit -m fourth &&
38 mkdir a &&
39 echo ni >a/two &&
40 git add a/two &&
41 test_tick &&
42 git commit -m fifth &&
44 git rm a/two &&
45 test_tick &&
46 git commit -m sixth
50 printf "sixth\nfifth\nfourth\nthird\nsecond\ninitial" > expect
51 test_expect_success 'pretty' '
53 git log --pretty="format:%s" > actual &&
54 test_cmp expect actual
57 printf "sixth\nfifth\nfourth\nthird\nsecond\ninitial\n" > expect
58 test_expect_success 'pretty (tformat)' '
60 git log --pretty="tformat:%s" > actual &&
61 test_cmp expect actual
64 test_expect_success 'pretty (shortcut)' '
66 git log --pretty="%s" > actual &&
67 test_cmp expect actual
70 test_expect_success 'format' '
72 git log --format="%s" > actual &&
73 test_cmp expect actual
76 cat > expect << EOF
77 This is
78 the sixth
79 commit.
80 This is
81 the fifth
82 commit.
83 EOF
85 test_expect_success 'format %w(11,1,2)' '
87 git log -2 --format="%w(11,1,2)This is the %s commit." > actual &&
88 test_cmp expect actual
91 test_expect_success 'format %w(,1,2)' '
93 git log -2 --format="%w(,1,2)This is%nthe %s%ncommit." > actual &&
94 test_cmp expect actual
97 cat > expect << EOF
98 $(git rev-parse --short :/sixth ) sixth
99 $(git rev-parse --short :/fifth ) fifth
100 $(git rev-parse --short :/fourth ) fourth
101 $(git rev-parse --short :/third ) third
102 $(git rev-parse --short :/second ) second
103 $(git rev-parse --short :/initial) initial
105 test_expect_success 'oneline' '
107 git log --oneline > actual &&
108 test_cmp expect actual
111 test_expect_success 'diff-filter=A' '
113 git log --no-renames --pretty="format:%s" --diff-filter=A HEAD > actual &&
114 git log --no-renames --pretty="format:%s" --diff-filter A HEAD > actual-separate &&
115 printf "fifth\nfourth\nthird\ninitial" > expect &&
116 test_cmp expect actual &&
117 test_cmp expect actual-separate
121 test_expect_success 'diff-filter=M' '
123 git log --pretty="format:%s" --diff-filter=M HEAD >actual &&
124 printf "second" >expect &&
125 test_cmp expect actual
129 test_expect_success 'diff-filter=D' '
131 git log --no-renames --pretty="format:%s" --diff-filter=D HEAD >actual &&
132 printf "sixth\nthird" >expect &&
133 test_cmp expect actual
137 test_expect_success 'diff-filter=R' '
139 git log -M --pretty="format:%s" --diff-filter=R HEAD >actual &&
140 printf "third" >expect &&
141 test_cmp expect actual
145 test_expect_success 'diff-filter=C' '
147 git log -C -C --pretty="format:%s" --diff-filter=C HEAD >actual &&
148 printf "fourth" >expect &&
149 test_cmp expect actual
153 test_expect_success 'git log --follow' '
155 git log --follow --pretty="format:%s" ichi >actual &&
156 printf "third\nsecond\ninitial" >expect &&
157 test_cmp expect actual
160 test_expect_success 'git config log.follow works like --follow' '
161 test_config log.follow true &&
162 git log --pretty="format:%s" ichi >actual &&
163 printf "third\nsecond\ninitial" >expect &&
164 test_cmp expect actual
167 test_expect_success 'git config log.follow does not die with multiple paths' '
168 test_config log.follow true &&
169 git log --pretty="format:%s" ichi ein
172 test_expect_success 'git config log.follow does not die with no paths' '
173 test_config log.follow true &&
174 git log --
177 test_expect_success 'git config log.follow is overridden by --no-follow' '
178 test_config log.follow true &&
179 git log --no-follow --pretty="format:%s" ichi >actual &&
180 printf "third" >expect &&
181 test_cmp expect actual
184 # Note that these commits are intentionally listed out of order.
185 last_three="$(git rev-parse :/fourth :/sixth :/fifth)"
186 cat > expect << EOF
187 $(git rev-parse --short :/sixth ) sixth
188 $(git rev-parse --short :/fifth ) fifth
189 $(git rev-parse --short :/fourth) fourth
191 test_expect_success 'git log --no-walk <commits> sorts by commit time' '
192 git log --no-walk --oneline $last_three > actual &&
193 test_cmp expect actual
196 test_expect_success 'git log --no-walk=sorted <commits> sorts by commit time' '
197 git log --no-walk=sorted --oneline $last_three > actual &&
198 test_cmp expect actual
201 cat > expect << EOF
202 === $(git rev-parse --short :/sixth ) sixth
203 === $(git rev-parse --short :/fifth ) fifth
204 === $(git rev-parse --short :/fourth) fourth
206 test_expect_success 'git log --line-prefix="=== " --no-walk <commits> sorts by commit time' '
207 git log --line-prefix="=== " --no-walk --oneline $last_three > actual &&
208 test_cmp expect actual
211 cat > expect << EOF
212 $(git rev-parse --short :/fourth) fourth
213 $(git rev-parse --short :/sixth ) sixth
214 $(git rev-parse --short :/fifth ) fifth
216 test_expect_success 'git log --no-walk=unsorted <commits> leaves list of commits as given' '
217 git log --no-walk=unsorted --oneline $last_three > actual &&
218 test_cmp expect actual
221 test_expect_success 'git show <commits> leaves list of commits as given' '
222 git show --oneline -s $last_three > actual &&
223 test_cmp expect actual
226 test_expect_success 'setup case sensitivity tests' '
227 echo case >one &&
228 test_tick &&
229 git add one &&
230 git commit -a -m Second
233 test_expect_success 'log --grep' '
234 echo second >expect &&
235 git log -1 --pretty="tformat:%s" --grep=sec >actual &&
236 test_cmp expect actual
239 cat > expect << EOF
240 second
241 initial
243 test_expect_success 'log --invert-grep --grep' '
244 # Fixed
245 git -c grep.patternType=fixed log --pretty="tformat:%s" --invert-grep --grep=th --grep=Sec >actual &&
246 test_cmp expect actual &&
248 # POSIX basic
249 git -c grep.patternType=basic log --pretty="tformat:%s" --invert-grep --grep=t[h] --grep=S[e]c >actual &&
250 test_cmp expect actual &&
252 # POSIX extended
253 git -c grep.patternType=extended log --pretty="tformat:%s" --invert-grep --grep=t[h] --grep=S[e]c >actual &&
254 test_cmp expect actual &&
256 # PCRE
257 if test_have_prereq PCRE
258 then
259 git -c grep.patternType=perl log --pretty="tformat:%s" --invert-grep --grep=t[h] --grep=S[e]c >actual &&
260 test_cmp expect actual
264 test_expect_success 'log --invert-grep --grep -i' '
265 echo initial >expect &&
267 # Fixed
268 git -c grep.patternType=fixed log --pretty="tformat:%s" --invert-grep -i --grep=th --grep=Sec >actual &&
269 test_cmp expect actual &&
271 # POSIX basic
272 git -c grep.patternType=basic log --pretty="tformat:%s" --invert-grep -i --grep=t[h] --grep=S[e]c >actual &&
273 test_cmp expect actual &&
275 # POSIX extended
276 git -c grep.patternType=extended log --pretty="tformat:%s" --invert-grep -i --grep=t[h] --grep=S[e]c >actual &&
277 test_cmp expect actual &&
279 # PCRE
280 if test_have_prereq PCRE
281 then
282 git -c grep.patternType=perl log --pretty="tformat:%s" --invert-grep -i --grep=t[h] --grep=S[e]c >actual &&
283 test_cmp expect actual
287 test_expect_success 'log --grep option parsing' '
288 echo second >expect &&
289 git log -1 --pretty="tformat:%s" --grep sec >actual &&
290 test_cmp expect actual &&
291 test_must_fail git log -1 --pretty="tformat:%s" --grep
294 test_expect_success 'log -i --grep' '
295 echo Second >expect &&
296 git log -1 --pretty="tformat:%s" -i --grep=sec >actual &&
297 test_cmp expect actual
300 test_expect_success 'log --grep -i' '
301 echo Second >expect &&
303 # Fixed
304 git log -1 --pretty="tformat:%s" --grep=sec -i >actual &&
305 test_cmp expect actual &&
307 # POSIX basic
308 git -c grep.patternType=basic log -1 --pretty="tformat:%s" --grep=s[e]c -i >actual &&
309 test_cmp expect actual &&
311 # POSIX extended
312 git -c grep.patternType=extended log -1 --pretty="tformat:%s" --grep=s[e]c -i >actual &&
313 test_cmp expect actual &&
315 # PCRE
316 if test_have_prereq PCRE
317 then
318 git -c grep.patternType=perl log -1 --pretty="tformat:%s" --grep=s[e]c -i >actual &&
319 test_cmp expect actual
323 test_expect_success 'log -F -E --grep=<ere> uses ere' '
324 echo second >expect &&
325 # basic would need \(s\) to do the same
326 git log -1 --pretty="tformat:%s" -F -E --grep="(s).c.nd" >actual &&
327 test_cmp expect actual
330 test_expect_success PCRE 'log -F -E --perl-regexp --grep=<pcre> uses PCRE' '
331 test_when_finished "rm -rf num_commits" &&
332 git init num_commits &&
334 cd num_commits &&
335 test_commit 1d &&
336 test_commit 2e
337 ) &&
339 # In PCRE \d in [\d] is like saying "0-9", and matches the 2
340 # in 2e...
341 echo 2e >expect &&
342 git -C num_commits log -1 --pretty="tformat:%s" -F -E --perl-regexp --grep="[\d]" >actual &&
343 test_cmp expect actual &&
345 # ...in POSIX basic and extended it is the same as [d],
346 # i.e. "d", which matches 1d, but does not match 2e.
347 echo 1d >expect &&
348 git -C num_commits log -1 --pretty="tformat:%s" -F -E --grep="[\d]" >actual &&
349 test_cmp expect actual
352 test_expect_success 'log with grep.patternType configuration' '
353 git -c grep.patterntype=fixed \
354 log -1 --pretty=tformat:%s --grep=s.c.nd >actual &&
355 test_must_be_empty actual
358 test_expect_success 'log with grep.patternType configuration and command line' '
359 echo second >expect &&
360 git -c grep.patterntype=fixed \
361 log -1 --pretty=tformat:%s --basic-regexp --grep=s.c.nd >actual &&
362 test_cmp expect actual
365 test_expect_success !FAIL_PREREQS 'log with various grep.patternType configurations & command-lines' '
366 git init pattern-type &&
368 cd pattern-type &&
369 test_commit 1 file A &&
371 # The tagname is overridden here because creating a
372 # tag called "(1|2)" as test_commit would otherwise
373 # implicitly do would fail on e.g. MINGW.
374 test_commit "(1|2)" file B 2 &&
376 echo "(1|2)" >expect.fixed &&
377 cp expect.fixed expect.basic &&
378 cp expect.fixed expect.extended &&
379 cp expect.fixed expect.perl &&
381 # A strcmp-like match with fixed.
382 git -c grep.patternType=fixed log --pretty=tformat:%s \
383 --grep="(1|2)" >actual.fixed &&
385 # POSIX basic matches (, | and ) literally.
386 git -c grep.patternType=basic log --pretty=tformat:%s \
387 --grep="(.|.)" >actual.basic &&
389 # POSIX extended needs to have | escaped to match it
390 # literally, whereas under basic this is the same as
391 # (|2), i.e. it would also match "1". This test checks
392 # for extended by asserting that it is not matching
393 # what basic would match.
394 git -c grep.patternType=extended log --pretty=tformat:%s \
395 --grep="\|2" >actual.extended &&
396 if test_have_prereq PCRE
397 then
398 # Only PCRE would match [\d]\| with only
399 # "(1|2)" due to [\d]. POSIX basic would match
400 # both it and "1" since similarly to the
401 # extended match above it is the same as
402 # \([\d]\|\). POSIX extended would
403 # match neither.
404 git -c grep.patternType=perl log --pretty=tformat:%s \
405 --grep="[\d]\|" >actual.perl &&
406 test_cmp expect.perl actual.perl
407 fi &&
408 test_cmp expect.fixed actual.fixed &&
409 test_cmp expect.basic actual.basic &&
410 test_cmp expect.extended actual.extended &&
412 git log --pretty=tformat:%s -F \
413 --grep="(1|2)" >actual.fixed.short-arg &&
414 git log --pretty=tformat:%s -E \
415 --grep="\|2" >actual.extended.short-arg &&
416 if test_have_prereq PCRE
417 then
418 git log --pretty=tformat:%s -P \
419 --grep="[\d]\|" >actual.perl.short-arg
420 else
421 test_must_fail git log -P \
422 --grep="[\d]\|"
423 fi &&
424 test_cmp expect.fixed actual.fixed.short-arg &&
425 test_cmp expect.extended actual.extended.short-arg &&
426 if test_have_prereq PCRE
427 then
428 test_cmp expect.perl actual.perl.short-arg
429 fi &&
431 git log --pretty=tformat:%s --fixed-strings \
432 --grep="(1|2)" >actual.fixed.long-arg &&
433 git log --pretty=tformat:%s --basic-regexp \
434 --grep="(.|.)" >actual.basic.long-arg &&
435 git log --pretty=tformat:%s --extended-regexp \
436 --grep="\|2" >actual.extended.long-arg &&
437 if test_have_prereq PCRE
438 then
439 git log --pretty=tformat:%s --perl-regexp \
440 --grep="[\d]\|" >actual.perl.long-arg &&
441 test_cmp expect.perl actual.perl.long-arg
442 else
443 test_must_fail git log --perl-regexp \
444 --grep="[\d]\|"
445 fi &&
446 test_cmp expect.fixed actual.fixed.long-arg &&
447 test_cmp expect.basic actual.basic.long-arg &&
448 test_cmp expect.extended actual.extended.long-arg
452 test_expect_success 'log --author' '
453 cat >expect <<-\EOF &&
454 Author: <BOLD;RED>A U<RESET> Thor <author@example.com>
456 git log -1 --color=always --author="A U" >log &&
457 grep Author log >actual.raw &&
458 test_decode_color <actual.raw >actual &&
459 test_cmp expect actual
462 test_expect_success 'log --committer' '
463 cat >expect <<-\EOF &&
464 Commit: C O Mitter <committer@<BOLD;RED>example<RESET>.com>
466 git log -1 --color=always --pretty=fuller --committer="example" >log &&
467 grep "Commit:" log >actual.raw &&
468 test_decode_color <actual.raw >actual &&
469 test_cmp expect actual
472 test_expect_success 'log -i --grep with color' '
473 cat >expect <<-\EOF &&
474 <BOLD;RED>Sec<RESET>ond
475 <BOLD;RED>sec<RESET>ond
477 git log --color=always -i --grep=^sec >log &&
478 grep -i sec log >actual.raw &&
479 test_decode_color <actual.raw >actual &&
480 test_cmp expect actual
483 test_expect_success '-c color.grep.selected log --grep' '
484 cat >expect <<-\EOF &&
485 <GREEN>th<RESET><BOLD;RED>ir<RESET><GREEN>d<RESET>
487 git -c color.grep.selected="green" log --color=always --grep=ir >log &&
488 grep ir log >actual.raw &&
489 test_decode_color <actual.raw >actual &&
490 test_cmp expect actual
493 test_expect_success '-c color.grep.matchSelected log --grep' '
494 cat >expect <<-\EOF &&
495 <BLUE>i<RESET>n<BLUE>i<RESET>t<BLUE>i<RESET>al
497 git -c color.grep.matchSelected="blue" log --color=always --grep=i >log &&
498 grep al log >actual.raw &&
499 test_decode_color <actual.raw >actual &&
500 test_cmp expect actual
503 cat > expect <<EOF
504 * Second
505 * sixth
506 * fifth
507 * fourth
508 * third
509 * second
510 * initial
513 test_expect_success 'simple log --graph' '
514 test_cmp_graph
517 cat > expect <<EOF
518 123 * Second
519 123 * sixth
520 123 * fifth
521 123 * fourth
522 123 * third
523 123 * second
524 123 * initial
527 test_expect_success 'simple log --graph --line-prefix="123 "' '
528 test_cmp_graph --line-prefix="123 "
531 test_expect_success 'set up merge history' '
532 git checkout -b side HEAD~4 &&
533 test_commit side-1 1 1 &&
534 test_commit side-2 2 2 &&
535 git checkout main &&
536 git merge side
539 cat > expect <<\EOF
540 * Merge branch 'side'
542 | * side-2
543 | * side-1
544 * | Second
545 * | sixth
546 * | fifth
547 * | fourth
549 * third
550 * second
551 * initial
554 test_expect_success 'log --graph with merge' '
555 test_cmp_graph --date-order
558 cat > expect <<\EOF
559 | | | * Merge branch 'side'
560 | | | |\
561 | | | | * side-2
562 | | | | * side-1
563 | | | * | Second
564 | | | * | sixth
565 | | | * | fifth
566 | | | * | fourth
567 | | | |/
568 | | | * third
569 | | | * second
570 | | | * initial
573 test_expect_success 'log --graph --line-prefix="| | | " with merge' '
574 test_cmp_graph --line-prefix="| | | " --date-order
577 cat > expect.colors <<\EOF
578 * Merge branch 'side'
579 <BLUE>|<RESET><CYAN>\<RESET>
580 <BLUE>|<RESET> * side-2
581 <BLUE>|<RESET> * side-1
582 * <CYAN>|<RESET> Second
583 * <CYAN>|<RESET> sixth
584 * <CYAN>|<RESET> fifth
585 * <CYAN>|<RESET> fourth
586 <CYAN>|<RESET><CYAN>/<RESET>
587 * third
588 * second
589 * initial
592 test_expect_success 'log --graph with merge with log.graphColors' '
593 test_config log.graphColors " blue,invalid-color, cyan, red , " &&
594 lib_test_cmp_colored_graph --date-order --format=%s
597 test_expect_success 'log --raw --graph -m with merge' '
598 git log --raw --graph --oneline -m main | head -n 500 >actual &&
599 grep "initial" actual
602 test_expect_success 'diff-tree --graph' '
603 git diff-tree --graph main^ | head -n 500 >actual &&
604 grep "one" actual
607 cat > expect <<\EOF
608 * commit main
609 |\ Merge: A B
610 | | Author: A U Thor <author@example.com>
612 | | Merge branch 'side'
614 | * commit tags/side-2
615 | | Author: A U Thor <author@example.com>
617 | | side-2
619 | * commit tags/side-1
620 | | Author: A U Thor <author@example.com>
622 | | side-1
624 * | commit main~1
625 | | Author: A U Thor <author@example.com>
627 | | Second
629 * | commit main~2
630 | | Author: A U Thor <author@example.com>
632 | | sixth
634 * | commit main~3
635 | | Author: A U Thor <author@example.com>
637 | | fifth
639 * | commit main~4
640 |/ Author: A U Thor <author@example.com>
642 | fourth
644 * commit tags/side-1~1
645 | Author: A U Thor <author@example.com>
647 | third
649 * commit tags/side-1~2
650 | Author: A U Thor <author@example.com>
652 | second
654 * commit tags/side-1~3
655 Author: A U Thor <author@example.com>
657 initial
660 test_expect_success 'log --graph with full output' '
661 git log --graph --date-order --pretty=short |
662 git name-rev --name-only --stdin |
663 sed "s/Merge:.*/Merge: A B/;s/ *\$//" >actual &&
664 test_cmp expect actual
667 test_expect_success 'set up more tangled history' '
668 git checkout -b tangle HEAD~6 &&
669 test_commit tangle-a tangle-a a &&
670 git merge main~3 &&
671 git merge side~1 &&
672 git checkout main &&
673 git merge tangle &&
674 git checkout -b reach &&
675 test_commit reach &&
676 git checkout main &&
677 git checkout -b octopus-a &&
678 test_commit octopus-a &&
679 git checkout main &&
680 git checkout -b octopus-b &&
681 test_commit octopus-b &&
682 git checkout main &&
683 test_commit seventh &&
684 git merge octopus-a octopus-b &&
685 git merge reach
688 cat > expect <<\EOF
689 * Merge tag 'reach'
693 *-. \ Merge tags 'octopus-a' and 'octopus-b'
694 |\ \ \
695 * | | | seventh
696 | | * | octopus-b
697 | |/ /
698 |/| |
699 | * | octopus-a
700 |/ /
701 | * reach
703 * Merge branch 'tangle'
705 | * Merge branch 'side' (early part) into tangle
706 | |\
707 | * \ Merge branch 'main' (early part) into tangle
708 | |\ \
709 | * | | tangle-a
710 * | | | Merge branch 'side'
711 |\ \ \ \
712 | * | | | side-2
713 | | |_|/
714 | |/| |
715 | * | | side-1
716 * | | | Second
717 * | | | sixth
718 | |_|/
719 |/| |
720 * | | fifth
721 * | | fourth
722 |/ /
723 * / third
725 * second
726 * initial
729 test_expect_success 'log --graph with merge' '
730 test_cmp_graph --date-order
733 test_expect_success 'log.decorate configuration' '
734 git log --oneline --no-decorate >expect.none &&
735 git log --oneline --decorate >expect.short &&
736 git log --oneline --decorate=full >expect.full &&
738 echo "[log] decorate" >>.git/config &&
739 git log --oneline >actual &&
740 test_cmp expect.short actual &&
742 test_config log.decorate true &&
743 git log --oneline >actual &&
744 test_cmp expect.short actual &&
745 git log --oneline --decorate=full >actual &&
746 test_cmp expect.full actual &&
747 git log --oneline --decorate=no >actual &&
748 test_cmp expect.none actual &&
750 test_config log.decorate no &&
751 git log --oneline >actual &&
752 test_cmp expect.none actual &&
753 git log --oneline --decorate >actual &&
754 test_cmp expect.short actual &&
755 git log --oneline --decorate=full >actual &&
756 test_cmp expect.full actual &&
758 test_config log.decorate 1 &&
759 git log --oneline >actual &&
760 test_cmp expect.short actual &&
761 git log --oneline --decorate=full >actual &&
762 test_cmp expect.full actual &&
763 git log --oneline --decorate=no >actual &&
764 test_cmp expect.none actual &&
766 test_config log.decorate short &&
767 git log --oneline >actual &&
768 test_cmp expect.short actual &&
769 git log --oneline --no-decorate >actual &&
770 test_cmp expect.none actual &&
771 git log --oneline --decorate=full >actual &&
772 test_cmp expect.full actual &&
774 test_config log.decorate full &&
775 git log --oneline >actual &&
776 test_cmp expect.full actual &&
777 git log --oneline --no-decorate >actual &&
778 test_cmp expect.none actual &&
779 git log --oneline --decorate >actual &&
780 test_cmp expect.short actual &&
782 test_unconfig log.decorate &&
783 git log --pretty=raw >expect.raw &&
784 test_config log.decorate full &&
785 git log --pretty=raw >actual &&
786 test_cmp expect.raw actual
790 test_expect_success 'decorate-refs with glob' '
791 cat >expect.decorate <<-\EOF &&
792 Merge-tag-reach
793 Merge-tags-octopus-a-and-octopus-b
794 seventh
795 octopus-b (octopus-b)
796 octopus-a (octopus-a)
797 reach
799 cat >expect.no-decorate <<-\EOF &&
800 Merge-tag-reach
801 Merge-tags-octopus-a-and-octopus-b
802 seventh
803 octopus-b
804 octopus-a
805 reach
807 git log -n6 --decorate=short --pretty="tformat:%f%d" \
808 --decorate-refs="heads/octopus*" >actual &&
809 test_cmp expect.decorate actual &&
810 git log -n6 --decorate=short --pretty="tformat:%f%d" \
811 --decorate-refs-exclude="heads/octopus*" \
812 --decorate-refs="heads/octopus*" >actual &&
813 test_cmp expect.no-decorate actual &&
814 git -c log.excludeDecoration="heads/octopus*" log \
815 -n6 --decorate=short --pretty="tformat:%f%d" \
816 --decorate-refs="heads/octopus*" >actual &&
817 test_cmp expect.decorate actual
820 test_expect_success 'decorate-refs without globs' '
821 cat >expect.decorate <<-\EOF &&
822 Merge-tag-reach
823 Merge-tags-octopus-a-and-octopus-b
824 seventh
825 octopus-b
826 octopus-a
827 reach (tag: reach)
829 git log -n6 --decorate=short --pretty="tformat:%f%d" \
830 --decorate-refs="tags/reach" >actual &&
831 test_cmp expect.decorate actual
834 test_expect_success 'multiple decorate-refs' '
835 cat >expect.decorate <<-\EOF &&
836 Merge-tag-reach
837 Merge-tags-octopus-a-and-octopus-b
838 seventh
839 octopus-b (octopus-b)
840 octopus-a (octopus-a)
841 reach (tag: reach)
843 git log -n6 --decorate=short --pretty="tformat:%f%d" \
844 --decorate-refs="heads/octopus*" \
845 --decorate-refs="tags/reach" >actual &&
846 test_cmp expect.decorate actual
849 test_expect_success 'decorate-refs-exclude with glob' '
850 cat >expect.decorate <<-\EOF &&
851 Merge-tag-reach (HEAD -> main)
852 Merge-tags-octopus-a-and-octopus-b
853 seventh (tag: seventh)
854 octopus-b (tag: octopus-b)
855 octopus-a (tag: octopus-a)
856 reach (tag: reach, reach)
858 git log -n6 --decorate=short --pretty="tformat:%f%d" \
859 --decorate-refs-exclude="heads/octopus*" >actual &&
860 test_cmp expect.decorate actual &&
861 git -c log.excludeDecoration="heads/octopus*" log \
862 -n6 --decorate=short --pretty="tformat:%f%d" >actual &&
863 test_cmp expect.decorate actual
866 test_expect_success 'decorate-refs-exclude without globs' '
867 cat >expect.decorate <<-\EOF &&
868 Merge-tag-reach (HEAD -> main)
869 Merge-tags-octopus-a-and-octopus-b
870 seventh (tag: seventh)
871 octopus-b (tag: octopus-b, octopus-b)
872 octopus-a (tag: octopus-a, octopus-a)
873 reach (reach)
875 git log -n6 --decorate=short --pretty="tformat:%f%d" \
876 --decorate-refs-exclude="tags/reach" >actual &&
877 test_cmp expect.decorate actual &&
878 git -c log.excludeDecoration="tags/reach" log \
879 -n6 --decorate=short --pretty="tformat:%f%d" >actual &&
880 test_cmp expect.decorate actual
883 test_expect_success 'multiple decorate-refs-exclude' '
884 cat >expect.decorate <<-\EOF &&
885 Merge-tag-reach (HEAD -> main)
886 Merge-tags-octopus-a-and-octopus-b
887 seventh (tag: seventh)
888 octopus-b (tag: octopus-b)
889 octopus-a (tag: octopus-a)
890 reach (reach)
892 git log -n6 --decorate=short --pretty="tformat:%f%d" \
893 --decorate-refs-exclude="heads/octopus*" \
894 --decorate-refs-exclude="tags/reach" >actual &&
895 test_cmp expect.decorate actual &&
896 git -c log.excludeDecoration="heads/octopus*" \
897 -c log.excludeDecoration="tags/reach" log \
898 -n6 --decorate=short --pretty="tformat:%f%d" >actual &&
899 test_cmp expect.decorate actual &&
900 git -c log.excludeDecoration="heads/octopus*" log \
901 --decorate-refs-exclude="tags/reach" \
902 -n6 --decorate=short --pretty="tformat:%f%d" >actual &&
903 test_cmp expect.decorate actual
906 test_expect_success 'decorate-refs and decorate-refs-exclude' '
907 cat >expect.no-decorate <<-\EOF &&
908 Merge-tag-reach (main)
909 Merge-tags-octopus-a-and-octopus-b
910 seventh
911 octopus-b
912 octopus-a
913 reach (reach)
915 git log -n6 --decorate=short --pretty="tformat:%f%d" \
916 --decorate-refs="heads/*" \
917 --decorate-refs-exclude="heads/oc*" >actual &&
918 test_cmp expect.no-decorate actual
921 test_expect_success 'deocrate-refs and log.excludeDecoration' '
922 cat >expect.decorate <<-\EOF &&
923 Merge-tag-reach (main)
924 Merge-tags-octopus-a-and-octopus-b
925 seventh
926 octopus-b (octopus-b)
927 octopus-a (octopus-a)
928 reach (reach)
930 git -c log.excludeDecoration="heads/oc*" log \
931 --decorate-refs="heads/*" \
932 -n6 --decorate=short --pretty="tformat:%f%d" >actual &&
933 test_cmp expect.decorate actual
936 test_expect_success 'decorate-refs-exclude and simplify-by-decoration' '
937 cat >expect.decorate <<-\EOF &&
938 Merge-tag-reach (HEAD -> main)
939 reach (tag: reach, reach)
940 seventh (tag: seventh)
941 Merge-branch-tangle
942 Merge-branch-side-early-part-into-tangle (tangle)
943 tangle-a (tag: tangle-a)
945 git log -n6 --decorate=short --pretty="tformat:%f%d" \
946 --decorate-refs-exclude="*octopus*" \
947 --simplify-by-decoration >actual &&
948 test_cmp expect.decorate actual &&
949 git -c log.excludeDecoration="*octopus*" log \
950 -n6 --decorate=short --pretty="tformat:%f%d" \
951 --simplify-by-decoration >actual &&
952 test_cmp expect.decorate actual
955 test_expect_success 'decorate-refs with implied decorate from format' '
956 cat >expect <<-\EOF &&
957 side-2 (tag: side-2)
958 side-1
960 git log --no-walk --format="%s%d" \
961 --decorate-refs="*side-2" side-1 side-2 \
962 >actual &&
963 test_cmp expect actual
966 test_expect_success 'implied decorate does not override option' '
967 cat >expect <<-\EOF &&
968 side-2 (tag: refs/tags/side-2, refs/heads/side)
969 side-1 (tag: refs/tags/side-1)
971 git log --no-walk --format="%s%d" \
972 --decorate=full side-1 side-2 \
973 >actual &&
974 test_cmp expect actual
977 test_expect_success 'decorate-refs and simplify-by-decoration without output' '
978 cat >expect <<-\EOF &&
979 side-2
980 initial
982 # Do not just use a --format without %d here; we want to
983 # make sure that we did not accidentally turn on displaying
984 # the decorations, too. And that requires one of the regular
985 # formats.
986 git log --decorate-refs="*side-2" --oneline \
987 --simplify-by-decoration >actual.raw &&
988 sed "s/^[0-9a-f]* //" <actual.raw >actual &&
989 test_cmp expect actual
992 test_expect_success 'log.decorate config parsing' '
993 git log --oneline --decorate=full >expect.full &&
994 git log --oneline --decorate=short >expect.short &&
996 test_config log.decorate full &&
997 test_config log.mailmap true &&
998 git log --oneline >actual &&
999 test_cmp expect.full actual &&
1000 git log --oneline --decorate=short >actual &&
1001 test_cmp expect.short actual
1004 test_expect_success TTY 'log output on a TTY' '
1005 git log --color --oneline --decorate >expect.short &&
1007 test_terminal git log --oneline >actual &&
1008 test_cmp expect.short actual
1011 test_expect_success 'reflog is expected format' '
1012 git log -g --abbrev-commit --pretty=oneline >expect &&
1013 git reflog >actual &&
1014 test_cmp expect actual
1017 test_expect_success 'whatchanged is expected format' '
1018 git log --no-merges --raw >expect &&
1019 git whatchanged >actual &&
1020 test_cmp expect actual
1023 test_expect_success 'log.abbrevCommit configuration' '
1024 git log --abbrev-commit >expect.log.abbrev &&
1025 git log --no-abbrev-commit >expect.log.full &&
1026 git log --pretty=raw >expect.log.raw &&
1027 git reflog --abbrev-commit >expect.reflog.abbrev &&
1028 git reflog --no-abbrev-commit >expect.reflog.full &&
1029 git whatchanged --abbrev-commit >expect.whatchanged.abbrev &&
1030 git whatchanged --no-abbrev-commit >expect.whatchanged.full &&
1032 test_config log.abbrevCommit true &&
1034 git log >actual &&
1035 test_cmp expect.log.abbrev actual &&
1036 git log --no-abbrev-commit >actual &&
1037 test_cmp expect.log.full actual &&
1039 git log --pretty=raw >actual &&
1040 test_cmp expect.log.raw actual &&
1042 git reflog >actual &&
1043 test_cmp expect.reflog.abbrev actual &&
1044 git reflog --no-abbrev-commit >actual &&
1045 test_cmp expect.reflog.full actual &&
1047 git whatchanged >actual &&
1048 test_cmp expect.whatchanged.abbrev actual &&
1049 git whatchanged --no-abbrev-commit >actual &&
1050 test_cmp expect.whatchanged.full actual
1053 test_expect_success 'show added path under "--follow -M"' '
1054 # This tests for a regression introduced in v1.7.2-rc0~103^2~2
1055 test_create_repo regression &&
1057 cd regression &&
1058 test_commit needs-another-commit &&
1059 test_commit foo.bar &&
1060 git log -M --follow -p foo.bar.t &&
1061 git log -M --follow --stat foo.bar.t &&
1062 git log -M --follow --name-only foo.bar.t
1066 test_expect_success 'git log -c --follow' '
1067 test_create_repo follow-c &&
1069 cd follow-c &&
1070 test_commit initial file original &&
1071 git rm file &&
1072 test_commit rename file2 original &&
1073 git reset --hard initial &&
1074 test_commit modify file foo &&
1075 git merge -m merge rename &&
1076 git log -c --follow file2
1080 cat >expect <<\EOF
1081 * commit COMMIT_OBJECT_NAME
1082 |\ Merge: MERGE_PARENTS
1083 | | Author: A U Thor <author@example.com>
1085 | | Merge HEADS DESCRIPTION
1087 | * commit COMMIT_OBJECT_NAME
1088 | | Author: A U Thor <author@example.com>
1090 | | reach
1091 | | ---
1092 | | reach.t | 1 +
1093 | | 1 file changed, 1 insertion(+)
1095 | | diff --git a/reach.t b/reach.t
1096 | | new file mode 100644
1097 | | index BEFORE..AFTER
1098 | | --- /dev/null
1099 | | +++ b/reach.t
1100 | | @@ -0,0 +1 @@
1101 | | +reach
1104 *-. \ commit COMMIT_OBJECT_NAME
1105 |\ \ \ Merge: MERGE_PARENTS
1106 | | | | Author: A U Thor <author@example.com>
1107 | | | |
1108 | | | | Merge HEADS DESCRIPTION
1109 | | | |
1110 | | * | commit COMMIT_OBJECT_NAME
1111 | | |/ Author: A U Thor <author@example.com>
1112 | | |
1113 | | | octopus-b
1114 | | | ---
1115 | | | octopus-b.t | 1 +
1116 | | | 1 file changed, 1 insertion(+)
1117 | | |
1118 | | | diff --git a/octopus-b.t b/octopus-b.t
1119 | | | new file mode 100644
1120 | | | index BEFORE..AFTER
1121 | | | --- /dev/null
1122 | | | +++ b/octopus-b.t
1123 | | | @@ -0,0 +1 @@
1124 | | | +octopus-b
1125 | | |
1126 | * | commit COMMIT_OBJECT_NAME
1127 | |/ Author: A U Thor <author@example.com>
1129 | | octopus-a
1130 | | ---
1131 | | octopus-a.t | 1 +
1132 | | 1 file changed, 1 insertion(+)
1134 | | diff --git a/octopus-a.t b/octopus-a.t
1135 | | new file mode 100644
1136 | | index BEFORE..AFTER
1137 | | --- /dev/null
1138 | | +++ b/octopus-a.t
1139 | | @@ -0,0 +1 @@
1140 | | +octopus-a
1142 * | commit COMMIT_OBJECT_NAME
1143 |/ Author: A U Thor <author@example.com>
1145 | seventh
1146 | ---
1147 | seventh.t | 1 +
1148 | 1 file changed, 1 insertion(+)
1150 | diff --git a/seventh.t b/seventh.t
1151 | new file mode 100644
1152 | index BEFORE..AFTER
1153 | --- /dev/null
1154 | +++ b/seventh.t
1155 | @@ -0,0 +1 @@
1156 | +seventh
1158 * commit COMMIT_OBJECT_NAME
1159 |\ Merge: MERGE_PARENTS
1160 | | Author: A U Thor <author@example.com>
1162 | | Merge branch 'tangle'
1164 | * commit COMMIT_OBJECT_NAME
1165 | |\ Merge: MERGE_PARENTS
1166 | | | Author: A U Thor <author@example.com>
1167 | | |
1168 | | | Merge branch 'side' (early part) into tangle
1169 | | |
1170 | * | commit COMMIT_OBJECT_NAME
1171 | |\ \ Merge: MERGE_PARENTS
1172 | | | | Author: A U Thor <author@example.com>
1173 | | | |
1174 | | | | Merge branch 'main' (early part) into tangle
1175 | | | |
1176 | * | | commit COMMIT_OBJECT_NAME
1177 | | | | Author: A U Thor <author@example.com>
1178 | | | |
1179 | | | | tangle-a
1180 | | | | ---
1181 | | | | tangle-a | 1 +
1182 | | | | 1 file changed, 1 insertion(+)
1183 | | | |
1184 | | | | diff --git a/tangle-a b/tangle-a
1185 | | | | new file mode 100644
1186 | | | | index BEFORE..AFTER
1187 | | | | --- /dev/null
1188 | | | | +++ b/tangle-a
1189 | | | | @@ -0,0 +1 @@
1190 | | | | +a
1191 | | | |
1192 * | | | commit COMMIT_OBJECT_NAME
1193 |\ \ \ \ Merge: MERGE_PARENTS
1194 | | | | | Author: A U Thor <author@example.com>
1195 | | | | |
1196 | | | | | Merge branch 'side'
1197 | | | | |
1198 | * | | | commit COMMIT_OBJECT_NAME
1199 | | |_|/ Author: A U Thor <author@example.com>
1200 | |/| |
1201 | | | | side-2
1202 | | | | ---
1203 | | | | 2 | 1 +
1204 | | | | 1 file changed, 1 insertion(+)
1205 | | | |
1206 | | | | diff --git a/2 b/2
1207 | | | | new file mode 100644
1208 | | | | index BEFORE..AFTER
1209 | | | | --- /dev/null
1210 | | | | +++ b/2
1211 | | | | @@ -0,0 +1 @@
1212 | | | | +2
1213 | | | |
1214 | * | | commit COMMIT_OBJECT_NAME
1215 | | | | Author: A U Thor <author@example.com>
1216 | | | |
1217 | | | | side-1
1218 | | | | ---
1219 | | | | 1 | 1 +
1220 | | | | 1 file changed, 1 insertion(+)
1221 | | | |
1222 | | | | diff --git a/1 b/1
1223 | | | | new file mode 100644
1224 | | | | index BEFORE..AFTER
1225 | | | | --- /dev/null
1226 | | | | +++ b/1
1227 | | | | @@ -0,0 +1 @@
1228 | | | | +1
1229 | | | |
1230 * | | | commit COMMIT_OBJECT_NAME
1231 | | | | Author: A U Thor <author@example.com>
1232 | | | |
1233 | | | | Second
1234 | | | | ---
1235 | | | | one | 1 +
1236 | | | | 1 file changed, 1 insertion(+)
1237 | | | |
1238 | | | | diff --git a/one b/one
1239 | | | | new file mode 100644
1240 | | | | index BEFORE..AFTER
1241 | | | | --- /dev/null
1242 | | | | +++ b/one
1243 | | | | @@ -0,0 +1 @@
1244 | | | | +case
1245 | | | |
1246 * | | | commit COMMIT_OBJECT_NAME
1247 | |_|/ Author: A U Thor <author@example.com>
1248 |/| |
1249 | | | sixth
1250 | | | ---
1251 | | | a/two | 1 -
1252 | | | 1 file changed, 1 deletion(-)
1253 | | |
1254 | | | diff --git a/a/two b/a/two
1255 | | | deleted file mode 100644
1256 | | | index BEFORE..AFTER
1257 | | | --- a/a/two
1258 | | | +++ /dev/null
1259 | | | @@ -1 +0,0 @@
1260 | | | -ni
1261 | | |
1262 * | | commit COMMIT_OBJECT_NAME
1263 | | | Author: A U Thor <author@example.com>
1264 | | |
1265 | | | fifth
1266 | | | ---
1267 | | | a/two | 1 +
1268 | | | 1 file changed, 1 insertion(+)
1269 | | |
1270 | | | diff --git a/a/two b/a/two
1271 | | | new file mode 100644
1272 | | | index BEFORE..AFTER
1273 | | | --- /dev/null
1274 | | | +++ b/a/two
1275 | | | @@ -0,0 +1 @@
1276 | | | +ni
1277 | | |
1278 * | | commit COMMIT_OBJECT_NAME
1279 |/ / Author: A U Thor <author@example.com>
1281 | | fourth
1282 | | ---
1283 | | ein | 1 +
1284 | | 1 file changed, 1 insertion(+)
1286 | | diff --git a/ein b/ein
1287 | | new file mode 100644
1288 | | index BEFORE..AFTER
1289 | | --- /dev/null
1290 | | +++ b/ein
1291 | | @@ -0,0 +1 @@
1292 | | +ichi
1294 * | commit COMMIT_OBJECT_NAME
1295 |/ Author: A U Thor <author@example.com>
1297 | third
1298 | ---
1299 | ichi | 1 +
1300 | one | 1 -
1301 | 2 files changed, 1 insertion(+), 1 deletion(-)
1303 | diff --git a/ichi b/ichi
1304 | new file mode 100644
1305 | index BEFORE..AFTER
1306 | --- /dev/null
1307 | +++ b/ichi
1308 | @@ -0,0 +1 @@
1309 | +ichi
1310 | diff --git a/one b/one
1311 | deleted file mode 100644
1312 | index BEFORE..AFTER
1313 | --- a/one
1314 | +++ /dev/null
1315 | @@ -1 +0,0 @@
1316 | -ichi
1318 * commit COMMIT_OBJECT_NAME
1319 | Author: A U Thor <author@example.com>
1321 | second
1322 | ---
1323 | one | 2 +-
1324 | 1 file changed, 1 insertion(+), 1 deletion(-)
1326 | diff --git a/one b/one
1327 | index BEFORE..AFTER 100644
1328 | --- a/one
1329 | +++ b/one
1330 | @@ -1 +1 @@
1331 | -one
1332 | +ichi
1334 * commit COMMIT_OBJECT_NAME
1335 Author: A U Thor <author@example.com>
1337 initial
1339 one | 1 +
1340 1 file changed, 1 insertion(+)
1342 diff --git a/one b/one
1343 new file mode 100644
1344 index BEFORE..AFTER
1345 --- /dev/null
1346 +++ b/one
1347 @@ -0,0 +1 @@
1348 +one
1351 test_expect_success 'log --graph with diff and stats' '
1352 lib_test_cmp_short_graph --no-renames --stat -p
1355 cat >expect <<\EOF
1356 *** * commit COMMIT_OBJECT_NAME
1357 *** |\ Merge: MERGE_PARENTS
1358 *** | | Author: A U Thor <author@example.com>
1359 *** | |
1360 *** | | Merge HEADS DESCRIPTION
1361 *** | |
1362 *** | * commit COMMIT_OBJECT_NAME
1363 *** | | Author: A U Thor <author@example.com>
1364 *** | |
1365 *** | | reach
1366 *** | | ---
1367 *** | | reach.t | 1 +
1368 *** | | 1 file changed, 1 insertion(+)
1369 *** | |
1370 *** | | diff --git a/reach.t b/reach.t
1371 *** | | new file mode 100644
1372 *** | | index BEFORE..AFTER
1373 *** | | --- /dev/null
1374 *** | | +++ b/reach.t
1375 *** | | @@ -0,0 +1 @@
1376 *** | | +reach
1377 *** | |
1378 *** | \
1379 *** *-. \ commit COMMIT_OBJECT_NAME
1380 *** |\ \ \ Merge: MERGE_PARENTS
1381 *** | | | | Author: A U Thor <author@example.com>
1382 *** | | | |
1383 *** | | | | Merge HEADS DESCRIPTION
1384 *** | | | |
1385 *** | | * | commit COMMIT_OBJECT_NAME
1386 *** | | |/ Author: A U Thor <author@example.com>
1387 *** | | |
1388 *** | | | octopus-b
1389 *** | | | ---
1390 *** | | | octopus-b.t | 1 +
1391 *** | | | 1 file changed, 1 insertion(+)
1392 *** | | |
1393 *** | | | diff --git a/octopus-b.t b/octopus-b.t
1394 *** | | | new file mode 100644
1395 *** | | | index BEFORE..AFTER
1396 *** | | | --- /dev/null
1397 *** | | | +++ b/octopus-b.t
1398 *** | | | @@ -0,0 +1 @@
1399 *** | | | +octopus-b
1400 *** | | |
1401 *** | * | commit COMMIT_OBJECT_NAME
1402 *** | |/ Author: A U Thor <author@example.com>
1403 *** | |
1404 *** | | octopus-a
1405 *** | | ---
1406 *** | | octopus-a.t | 1 +
1407 *** | | 1 file changed, 1 insertion(+)
1408 *** | |
1409 *** | | diff --git a/octopus-a.t b/octopus-a.t
1410 *** | | new file mode 100644
1411 *** | | index BEFORE..AFTER
1412 *** | | --- /dev/null
1413 *** | | +++ b/octopus-a.t
1414 *** | | @@ -0,0 +1 @@
1415 *** | | +octopus-a
1416 *** | |
1417 *** * | commit COMMIT_OBJECT_NAME
1418 *** |/ Author: A U Thor <author@example.com>
1419 *** |
1420 *** | seventh
1421 *** | ---
1422 *** | seventh.t | 1 +
1423 *** | 1 file changed, 1 insertion(+)
1424 *** |
1425 *** | diff --git a/seventh.t b/seventh.t
1426 *** | new file mode 100644
1427 *** | index BEFORE..AFTER
1428 *** | --- /dev/null
1429 *** | +++ b/seventh.t
1430 *** | @@ -0,0 +1 @@
1431 *** | +seventh
1432 *** |
1433 *** * commit COMMIT_OBJECT_NAME
1434 *** |\ Merge: MERGE_PARENTS
1435 *** | | Author: A U Thor <author@example.com>
1436 *** | |
1437 *** | | Merge branch 'tangle'
1438 *** | |
1439 *** | * commit COMMIT_OBJECT_NAME
1440 *** | |\ Merge: MERGE_PARENTS
1441 *** | | | Author: A U Thor <author@example.com>
1442 *** | | |
1443 *** | | | Merge branch 'side' (early part) into tangle
1444 *** | | |
1445 *** | * | commit COMMIT_OBJECT_NAME
1446 *** | |\ \ Merge: MERGE_PARENTS
1447 *** | | | | Author: A U Thor <author@example.com>
1448 *** | | | |
1449 *** | | | | Merge branch 'main' (early part) into tangle
1450 *** | | | |
1451 *** | * | | commit COMMIT_OBJECT_NAME
1452 *** | | | | Author: A U Thor <author@example.com>
1453 *** | | | |
1454 *** | | | | tangle-a
1455 *** | | | | ---
1456 *** | | | | tangle-a | 1 +
1457 *** | | | | 1 file changed, 1 insertion(+)
1458 *** | | | |
1459 *** | | | | diff --git a/tangle-a b/tangle-a
1460 *** | | | | new file mode 100644
1461 *** | | | | index BEFORE..AFTER
1462 *** | | | | --- /dev/null
1463 *** | | | | +++ b/tangle-a
1464 *** | | | | @@ -0,0 +1 @@
1465 *** | | | | +a
1466 *** | | | |
1467 *** * | | | commit COMMIT_OBJECT_NAME
1468 *** |\ \ \ \ Merge: MERGE_PARENTS
1469 *** | | | | | Author: A U Thor <author@example.com>
1470 *** | | | | |
1471 *** | | | | | Merge branch 'side'
1472 *** | | | | |
1473 *** | * | | | commit COMMIT_OBJECT_NAME
1474 *** | | |_|/ Author: A U Thor <author@example.com>
1475 *** | |/| |
1476 *** | | | | side-2
1477 *** | | | | ---
1478 *** | | | | 2 | 1 +
1479 *** | | | | 1 file changed, 1 insertion(+)
1480 *** | | | |
1481 *** | | | | diff --git a/2 b/2
1482 *** | | | | new file mode 100644
1483 *** | | | | index BEFORE..AFTER
1484 *** | | | | --- /dev/null
1485 *** | | | | +++ b/2
1486 *** | | | | @@ -0,0 +1 @@
1487 *** | | | | +2
1488 *** | | | |
1489 *** | * | | commit COMMIT_OBJECT_NAME
1490 *** | | | | Author: A U Thor <author@example.com>
1491 *** | | | |
1492 *** | | | | side-1
1493 *** | | | | ---
1494 *** | | | | 1 | 1 +
1495 *** | | | | 1 file changed, 1 insertion(+)
1496 *** | | | |
1497 *** | | | | diff --git a/1 b/1
1498 *** | | | | new file mode 100644
1499 *** | | | | index BEFORE..AFTER
1500 *** | | | | --- /dev/null
1501 *** | | | | +++ b/1
1502 *** | | | | @@ -0,0 +1 @@
1503 *** | | | | +1
1504 *** | | | |
1505 *** * | | | commit COMMIT_OBJECT_NAME
1506 *** | | | | Author: A U Thor <author@example.com>
1507 *** | | | |
1508 *** | | | | Second
1509 *** | | | | ---
1510 *** | | | | one | 1 +
1511 *** | | | | 1 file changed, 1 insertion(+)
1512 *** | | | |
1513 *** | | | | diff --git a/one b/one
1514 *** | | | | new file mode 100644
1515 *** | | | | index BEFORE..AFTER
1516 *** | | | | --- /dev/null
1517 *** | | | | +++ b/one
1518 *** | | | | @@ -0,0 +1 @@
1519 *** | | | | +case
1520 *** | | | |
1521 *** * | | | commit COMMIT_OBJECT_NAME
1522 *** | |_|/ Author: A U Thor <author@example.com>
1523 *** |/| |
1524 *** | | | sixth
1525 *** | | | ---
1526 *** | | | a/two | 1 -
1527 *** | | | 1 file changed, 1 deletion(-)
1528 *** | | |
1529 *** | | | diff --git a/a/two b/a/two
1530 *** | | | deleted file mode 100644
1531 *** | | | index BEFORE..AFTER
1532 *** | | | --- a/a/two
1533 *** | | | +++ /dev/null
1534 *** | | | @@ -1 +0,0 @@
1535 *** | | | -ni
1536 *** | | |
1537 *** * | | commit COMMIT_OBJECT_NAME
1538 *** | | | Author: A U Thor <author@example.com>
1539 *** | | |
1540 *** | | | fifth
1541 *** | | | ---
1542 *** | | | a/two | 1 +
1543 *** | | | 1 file changed, 1 insertion(+)
1544 *** | | |
1545 *** | | | diff --git a/a/two b/a/two
1546 *** | | | new file mode 100644
1547 *** | | | index BEFORE..AFTER
1548 *** | | | --- /dev/null
1549 *** | | | +++ b/a/two
1550 *** | | | @@ -0,0 +1 @@
1551 *** | | | +ni
1552 *** | | |
1553 *** * | | commit COMMIT_OBJECT_NAME
1554 *** |/ / Author: A U Thor <author@example.com>
1555 *** | |
1556 *** | | fourth
1557 *** | | ---
1558 *** | | ein | 1 +
1559 *** | | 1 file changed, 1 insertion(+)
1560 *** | |
1561 *** | | diff --git a/ein b/ein
1562 *** | | new file mode 100644
1563 *** | | index BEFORE..AFTER
1564 *** | | --- /dev/null
1565 *** | | +++ b/ein
1566 *** | | @@ -0,0 +1 @@
1567 *** | | +ichi
1568 *** | |
1569 *** * | commit COMMIT_OBJECT_NAME
1570 *** |/ Author: A U Thor <author@example.com>
1571 *** |
1572 *** | third
1573 *** | ---
1574 *** | ichi | 1 +
1575 *** | one | 1 -
1576 *** | 2 files changed, 1 insertion(+), 1 deletion(-)
1577 *** |
1578 *** | diff --git a/ichi b/ichi
1579 *** | new file mode 100644
1580 *** | index BEFORE..AFTER
1581 *** | --- /dev/null
1582 *** | +++ b/ichi
1583 *** | @@ -0,0 +1 @@
1584 *** | +ichi
1585 *** | diff --git a/one b/one
1586 *** | deleted file mode 100644
1587 *** | index BEFORE..AFTER
1588 *** | --- a/one
1589 *** | +++ /dev/null
1590 *** | @@ -1 +0,0 @@
1591 *** | -ichi
1592 *** |
1593 *** * commit COMMIT_OBJECT_NAME
1594 *** | Author: A U Thor <author@example.com>
1595 *** |
1596 *** | second
1597 *** | ---
1598 *** | one | 2 +-
1599 *** | 1 file changed, 1 insertion(+), 1 deletion(-)
1600 *** |
1601 *** | diff --git a/one b/one
1602 *** | index BEFORE..AFTER 100644
1603 *** | --- a/one
1604 *** | +++ b/one
1605 *** | @@ -1 +1 @@
1606 *** | -one
1607 *** | +ichi
1608 *** |
1609 *** * commit COMMIT_OBJECT_NAME
1610 *** Author: A U Thor <author@example.com>
1612 *** initial
1613 *** ---
1614 *** one | 1 +
1615 *** 1 file changed, 1 insertion(+)
1617 *** diff --git a/one b/one
1618 *** new file mode 100644
1619 *** index BEFORE..AFTER
1620 *** --- /dev/null
1621 *** +++ b/one
1622 *** @@ -0,0 +1 @@
1623 *** +one
1626 test_expect_success 'log --line-prefix="*** " --graph with diff and stats' '
1627 lib_test_cmp_short_graph --line-prefix="*** " --no-renames --stat -p
1630 cat >expect <<-\EOF
1631 * reach
1633 | A reach.t
1634 * Merge branch 'tangle'
1635 * Merge branch 'side'
1637 | * side-2
1639 | A 2
1640 * Second
1642 | A one
1643 * sixth
1645 D a/two
1648 test_expect_success 'log --graph with --name-status' '
1649 test_cmp_graph --name-status tangle..reach
1652 cat >expect <<-\EOF
1653 * reach
1655 | reach.t
1656 * Merge branch 'tangle'
1657 * Merge branch 'side'
1659 | * side-2
1662 * Second
1664 | one
1665 * sixth
1667 a/two
1670 test_expect_success 'log --graph with --name-only' '
1671 test_cmp_graph --name-only tangle..reach
1674 test_expect_success 'dotdot is a parent directory' '
1675 mkdir -p a/b &&
1676 ( echo sixth && echo fifth ) >expect &&
1677 ( cd a/b && git log --format=%s .. ) >actual &&
1678 test_cmp expect actual
1681 test_expect_success GPG 'setup signed branch' '
1682 test_when_finished "git reset --hard && git checkout main" &&
1683 git checkout -b signed main &&
1684 echo foo >foo &&
1685 git add foo &&
1686 git commit -S -m signed_commit
1689 test_expect_success GPG 'setup signed branch with subkey' '
1690 test_when_finished "git reset --hard && git checkout main" &&
1691 git checkout -b signed-subkey main &&
1692 echo foo >foo &&
1693 git add foo &&
1694 git commit -SB7227189 -m signed_commit
1697 test_expect_success GPGSM 'setup signed branch x509' '
1698 test_when_finished "git reset --hard && git checkout main" &&
1699 git checkout -b signed-x509 main &&
1700 echo foo >foo &&
1701 git add foo &&
1702 test_config gpg.format x509 &&
1703 test_config user.signingkey $GIT_COMMITTER_EMAIL &&
1704 git commit -S -m signed_commit
1707 test_expect_success GPGSSH 'setup sshkey signed branch' '
1708 test_config gpg.format ssh &&
1709 test_config user.signingkey "${GPGSSH_KEY_PRIMARY}" &&
1710 test_when_finished "git reset --hard && git checkout main" &&
1711 git checkout -b signed-ssh main &&
1712 echo foo >foo &&
1713 git add foo &&
1714 git commit -S -m signed_commit
1717 test_expect_success GPGSSH,GPGSSH_VERIFYTIME 'create signed commits with keys having defined lifetimes' '
1718 test_config gpg.format ssh &&
1719 touch file &&
1720 git add file &&
1722 echo expired >file && test_tick && git commit -a -m expired -S"${GPGSSH_KEY_EXPIRED}" &&
1723 git tag expired-signed &&
1725 echo notyetvalid >file && test_tick && git commit -a -m notyetvalid -S"${GPGSSH_KEY_NOTYETVALID}" &&
1726 git tag notyetvalid-signed &&
1728 echo timeboxedvalid >file && test_tick && git commit -a -m timeboxedvalid -S"${GPGSSH_KEY_TIMEBOXEDVALID}" &&
1729 git tag timeboxedvalid-signed &&
1731 echo timeboxedinvalid >file && test_tick && git commit -a -m timeboxedinvalid -S"${GPGSSH_KEY_TIMEBOXEDINVALID}" &&
1732 git tag timeboxedinvalid-signed
1735 test_expect_success GPGSM 'log x509 fingerprint' '
1736 echo "F8BF62E0693D0694816377099909C779FA23FD65 | " >expect &&
1737 git log -n1 --format="%GF | %GP" signed-x509 >actual &&
1738 test_cmp expect actual
1741 test_expect_success GPGSM 'log OpenPGP fingerprint' '
1742 echo "D4BE22311AD3131E5EDA29A461092E85B7227189" > expect &&
1743 git log -n1 --format="%GP" signed-subkey >actual &&
1744 test_cmp expect actual
1747 test_expect_success GPGSSH 'log ssh key fingerprint' '
1748 test_config gpg.ssh.allowedSignersFile "${GPGSSH_ALLOWED_SIGNERS}" &&
1749 ssh-keygen -lf "${GPGSSH_KEY_PRIMARY}" | awk "{print \$2\" | \"}" >expect &&
1750 git log -n1 --format="%GF | %GP" signed-ssh >actual &&
1751 test_cmp expect actual
1754 test_expect_success GPG 'log --graph --show-signature' '
1755 git log --graph --show-signature -n1 signed >actual &&
1756 grep "^| gpg: Signature made" actual &&
1757 grep "^| gpg: Good signature" actual
1760 test_expect_success GPGSM 'log --graph --show-signature x509' '
1761 git log --graph --show-signature -n1 signed-x509 >actual &&
1762 grep "^| gpgsm: Signature made" actual &&
1763 grep "^| gpgsm: Good signature" actual
1766 test_expect_success GPGSSH 'log --graph --show-signature ssh' '
1767 test_config gpg.ssh.allowedSignersFile "${GPGSSH_ALLOWED_SIGNERS}" &&
1768 git log --graph --show-signature -n1 signed-ssh >actual &&
1769 grep "${GOOD_SIGNATURE_TRUSTED}" actual
1772 test_expect_success GPGSSH,GPGSSH_VERIFYTIME 'log shows failure on expired signature key' '
1773 test_config gpg.ssh.allowedSignersFile "${GPGSSH_ALLOWED_SIGNERS}" &&
1774 git log --graph --show-signature -n1 expired-signed >actual &&
1775 ! grep "${GPGSSH_GOOD_SIGNATURE_TRUSTED}" actual
1778 test_expect_success GPGSSH,GPGSSH_VERIFYTIME 'log shows failure on not yet valid signature key' '
1779 test_config gpg.ssh.allowedSignersFile "${GPGSSH_ALLOWED_SIGNERS}" &&
1780 git log --graph --show-signature -n1 notyetvalid-signed >actual &&
1781 ! grep "${GPGSSH_GOOD_SIGNATURE_TRUSTED}" actual
1784 test_expect_success GPGSSH,GPGSSH_VERIFYTIME 'log show success with commit date and key validity matching' '
1785 test_config gpg.ssh.allowedSignersFile "${GPGSSH_ALLOWED_SIGNERS}" &&
1786 git log --graph --show-signature -n1 timeboxedvalid-signed >actual &&
1787 grep "${GPGSSH_GOOD_SIGNATURE_TRUSTED}" actual &&
1788 ! grep "${GPGSSH_BAD_SIGNATURE}" actual
1791 test_expect_success GPGSSH,GPGSSH_VERIFYTIME 'log shows failure with commit date outside of key validity' '
1792 test_config gpg.ssh.allowedSignersFile "${GPGSSH_ALLOWED_SIGNERS}" &&
1793 git log --graph --show-signature -n1 timeboxedinvalid-signed >actual &&
1794 ! grep "${GPGSSH_GOOD_SIGNATURE_TRUSTED}" actual
1797 test_expect_success GPG 'log --graph --show-signature for merged tag' '
1798 test_when_finished "git reset --hard && git checkout main" &&
1799 git checkout -b plain main &&
1800 echo aaa >bar &&
1801 git add bar &&
1802 git commit -m bar_commit &&
1803 git checkout -b tagged main &&
1804 echo bbb >baz &&
1805 git add baz &&
1806 git commit -m baz_commit &&
1807 git tag -s -m signed_tag_msg signed_tag &&
1808 git checkout plain &&
1809 git merge --no-ff -m msg signed_tag &&
1810 git log --graph --show-signature -n1 plain >actual &&
1811 grep "^|\\\ merged tag" actual &&
1812 grep "^| | gpg: Signature made" actual &&
1813 grep "^| | gpg: Good signature" actual
1816 test_expect_success GPG 'log --graph --show-signature for merged tag in shallow clone' '
1817 test_when_finished "git reset --hard && git checkout main" &&
1818 git checkout -b plain-shallow main &&
1819 echo aaa >bar &&
1820 git add bar &&
1821 git commit -m bar_commit &&
1822 git checkout --detach main &&
1823 echo bbb >baz &&
1824 git add baz &&
1825 git commit -m baz_commit &&
1826 git tag -s -m signed_tag_msg signed_tag_shallow &&
1827 hash=$(git rev-parse HEAD) &&
1828 git checkout plain-shallow &&
1829 git merge --no-ff -m msg signed_tag_shallow &&
1830 git clone --depth 1 --no-local . shallow &&
1831 test_when_finished "rm -rf shallow" &&
1832 git -C shallow log --graph --show-signature -n1 plain-shallow >actual &&
1833 grep "tag signed_tag_shallow names a non-parent $hash" actual
1836 test_expect_success GPG 'log --graph --show-signature for merged tag with missing key' '
1837 test_when_finished "git reset --hard && git checkout main" &&
1838 git checkout -b plain-nokey main &&
1839 echo aaa >bar &&
1840 git add bar &&
1841 git commit -m bar_commit &&
1842 git checkout -b tagged-nokey main &&
1843 echo bbb >baz &&
1844 git add baz &&
1845 git commit -m baz_commit &&
1846 git tag -s -m signed_tag_msg signed_tag_nokey &&
1847 git checkout plain-nokey &&
1848 git merge --no-ff -m msg signed_tag_nokey &&
1849 GNUPGHOME=. git log --graph --show-signature -n1 plain-nokey >actual &&
1850 grep "^|\\\ merged tag" actual &&
1851 grep "^| | gpg: Signature made" actual &&
1852 grep -E "^| | gpg: Can'"'"'t check signature: (public key not found|No public key)" actual
1855 test_expect_success GPG 'log --graph --show-signature for merged tag with bad signature' '
1856 test_when_finished "git reset --hard && git checkout main" &&
1857 git checkout -b plain-bad main &&
1858 echo aaa >bar &&
1859 git add bar &&
1860 git commit -m bar_commit &&
1861 git checkout -b tagged-bad main &&
1862 echo bbb >baz &&
1863 git add baz &&
1864 git commit -m baz_commit &&
1865 git tag -s -m signed_tag_msg signed_tag_bad &&
1866 git cat-file tag signed_tag_bad >raw &&
1867 sed -e "s/signed_tag_msg/forged/" raw >forged &&
1868 git hash-object -w -t tag forged >forged.tag &&
1869 git checkout plain-bad &&
1870 git merge --no-ff -m msg "$(cat forged.tag)" &&
1871 git log --graph --show-signature -n1 plain-bad >actual &&
1872 grep "^|\\\ merged tag" actual &&
1873 grep "^| | gpg: Signature made" actual &&
1874 grep "^| | gpg: BAD signature from" actual
1877 test_expect_success GPG 'log --show-signature for merged tag with GPG failure' '
1878 test_when_finished "git reset --hard && git checkout main" &&
1879 git checkout -b plain-fail main &&
1880 echo aaa >bar &&
1881 git add bar &&
1882 git commit -m bar_commit &&
1883 git checkout -b tagged-fail main &&
1884 echo bbb >baz &&
1885 git add baz &&
1886 git commit -m baz_commit &&
1887 git tag -s -m signed_tag_msg signed_tag_fail &&
1888 git checkout plain-fail &&
1889 git merge --no-ff -m msg signed_tag_fail &&
1890 TMPDIR="$(pwd)/bogus" git log --show-signature -n1 plain-fail >actual &&
1891 grep "^merged tag" actual &&
1892 grep "^No signature" actual &&
1893 ! grep "^gpg: Signature made" actual
1896 test_expect_success GPGSM 'log --graph --show-signature for merged tag x509' '
1897 test_when_finished "git reset --hard && git checkout main" &&
1898 test_config gpg.format x509 &&
1899 test_config user.signingkey $GIT_COMMITTER_EMAIL &&
1900 git checkout -b plain-x509 main &&
1901 echo aaa >bar &&
1902 git add bar &&
1903 git commit -m bar_commit &&
1904 git checkout -b tagged-x509 main &&
1905 echo bbb >baz &&
1906 git add baz &&
1907 git commit -m baz_commit &&
1908 git tag -s -m signed_tag_msg signed_tag_x509 &&
1909 git checkout plain-x509 &&
1910 git merge --no-ff -m msg signed_tag_x509 &&
1911 git log --graph --show-signature -n1 plain-x509 >actual &&
1912 grep "^|\\\ merged tag" actual &&
1913 grep "^| | gpgsm: Signature made" actual &&
1914 grep "^| | gpgsm: Good signature" actual
1917 test_expect_success GPGSM 'log --graph --show-signature for merged tag x509 missing key' '
1918 test_when_finished "git reset --hard && git checkout main" &&
1919 test_config gpg.format x509 &&
1920 test_config user.signingkey $GIT_COMMITTER_EMAIL &&
1921 git checkout -b plain-x509-nokey main &&
1922 echo aaa >bar &&
1923 git add bar &&
1924 git commit -m bar_commit &&
1925 git checkout -b tagged-x509-nokey main &&
1926 echo bbb >baz &&
1927 git add baz &&
1928 git commit -m baz_commit &&
1929 git tag -s -m signed_tag_msg signed_tag_x509_nokey &&
1930 git checkout plain-x509-nokey &&
1931 git merge --no-ff -m msg signed_tag_x509_nokey &&
1932 GNUPGHOME=. git log --graph --show-signature -n1 plain-x509-nokey >actual &&
1933 grep "^|\\\ merged tag" actual &&
1934 grep "^| | gpgsm: certificate not found" actual
1937 test_expect_success GPGSM 'log --graph --show-signature for merged tag x509 bad signature' '
1938 test_when_finished "git reset --hard && git checkout main" &&
1939 test_config gpg.format x509 &&
1940 test_config user.signingkey $GIT_COMMITTER_EMAIL &&
1941 git checkout -b plain-x509-bad main &&
1942 echo aaa >bar &&
1943 git add bar &&
1944 git commit -m bar_commit &&
1945 git checkout -b tagged-x509-bad main &&
1946 echo bbb >baz &&
1947 git add baz &&
1948 git commit -m baz_commit &&
1949 git tag -s -m signed_tag_msg signed_tag_x509_bad &&
1950 git cat-file tag signed_tag_x509_bad >raw &&
1951 sed -e "s/signed_tag_msg/forged/" raw >forged &&
1952 git hash-object -w -t tag forged >forged.tag &&
1953 git checkout plain-x509-bad &&
1954 git merge --no-ff -m msg "$(cat forged.tag)" &&
1955 git log --graph --show-signature -n1 plain-x509-bad >actual &&
1956 grep "^|\\\ merged tag" actual &&
1957 grep "^| | gpgsm: Signature made" actual &&
1958 grep "^| | gpgsm: invalid signature" actual
1962 test_expect_success GPG '--no-show-signature overrides --show-signature' '
1963 git log -1 --show-signature --no-show-signature signed >actual &&
1964 ! grep "^gpg:" actual
1967 test_expect_success GPG 'log.showsignature=true behaves like --show-signature' '
1968 test_config log.showsignature true &&
1969 git log -1 signed >actual &&
1970 grep "gpg: Signature made" actual &&
1971 grep "gpg: Good signature" actual
1974 test_expect_success GPG '--no-show-signature overrides log.showsignature=true' '
1975 test_config log.showsignature true &&
1976 git log -1 --no-show-signature signed >actual &&
1977 ! grep "^gpg:" actual
1980 test_expect_success GPG '--show-signature overrides log.showsignature=false' '
1981 test_config log.showsignature false &&
1982 git log -1 --show-signature signed >actual &&
1983 grep "gpg: Signature made" actual &&
1984 grep "gpg: Good signature" actual
1987 test_expect_success 'log --graph --no-walk is forbidden' '
1988 test_must_fail git log --graph --no-walk
1991 test_expect_success 'log on empty repo fails' '
1992 git init empty &&
1993 test_when_finished "rm -rf empty" &&
1994 test_must_fail git -C empty log 2>stderr &&
1995 test_i18ngrep does.not.have.any.commits stderr
1998 test_expect_success REFFILES 'log diagnoses bogus HEAD hash' '
1999 git init empty &&
2000 test_when_finished "rm -rf empty" &&
2001 echo 1234abcd >empty/.git/refs/heads/main &&
2002 test_must_fail git -C empty log 2>stderr &&
2003 test_i18ngrep broken stderr
2006 test_expect_success 'log diagnoses bogus HEAD symref' '
2007 git init empty &&
2008 git --git-dir empty/.git symbolic-ref HEAD refs/heads/invalid.lock &&
2009 test_must_fail git -C empty log 2>stderr &&
2010 test_i18ngrep broken stderr &&
2011 test_must_fail git -C empty log --default totally-bogus 2>stderr &&
2012 test_i18ngrep broken stderr
2015 test_expect_success 'log does not default to HEAD when rev input is given' '
2016 git log --branches=does-not-exist >actual &&
2017 test_must_be_empty actual
2020 test_expect_success 'do not default to HEAD with ignored object on cmdline' '
2021 git log --ignore-missing $ZERO_OID >actual &&
2022 test_must_be_empty actual
2025 test_expect_success 'do not default to HEAD with ignored object on stdin' '
2026 echo $ZERO_OID | git log --ignore-missing --stdin >actual &&
2027 test_must_be_empty actual
2030 test_expect_success 'set up --source tests' '
2031 git checkout --orphan source-a &&
2032 test_commit one &&
2033 test_commit two &&
2034 git checkout -b source-b HEAD^ &&
2035 test_commit three
2038 test_expect_success 'log --source paints branch names' '
2039 cat >expect <<-EOF &&
2040 $(git rev-parse --short :/three) source-b three
2041 $(git rev-parse --short :/two ) source-a two
2042 $(git rev-parse --short :/one ) source-b one
2044 git log --oneline --source source-a source-b >actual &&
2045 test_cmp expect actual
2048 test_expect_success 'log --source paints tag names' '
2049 git tag -m tagged source-tag &&
2050 cat >expect <<-EOF &&
2051 $(git rev-parse --short :/three) source-tag three
2052 $(git rev-parse --short :/two ) source-a two
2053 $(git rev-parse --short :/one ) source-tag one
2055 git log --oneline --source source-tag source-a >actual &&
2056 test_cmp expect actual
2059 test_expect_success 'log --source paints symmetric ranges' '
2060 cat >expect <<-EOF &&
2061 $(git rev-parse --short :/three) source-b three
2062 $(git rev-parse --short :/two ) source-a two
2064 git log --oneline --source source-a...source-b >actual &&
2065 test_cmp expect actual
2068 test_expect_success '--exclude-promisor-objects does not BUG-crash' '
2069 test_must_fail git log --exclude-promisor-objects source-a
2072 test_expect_success 'log --decorate includes all levels of tag annotated tags' '
2073 git checkout -b branch &&
2074 git commit --allow-empty -m "new commit" &&
2075 git tag lightweight HEAD &&
2076 git tag -m annotated annotated HEAD &&
2077 git tag -m double-0 double-0 HEAD &&
2078 git tag -m double-1 double-1 double-0 &&
2079 cat >expect <<-\EOF &&
2080 HEAD -> branch, tag: lightweight, tag: double-1, tag: double-0, tag: annotated
2082 git log -1 --format="%D" >actual &&
2083 test_cmp expect actual
2086 test_expect_success 'log --end-of-options' '
2087 git update-ref refs/heads/--source HEAD &&
2088 git log --end-of-options --source >actual &&
2089 git log >expect &&
2090 test_cmp expect actual
2093 test_expect_success 'set up commits with different authors' '
2094 git checkout --orphan authors &&
2095 test_commit --author "Jim <jim@example.com>" jim_1 &&
2096 test_commit --author "Val <val@example.com>" val_1 &&
2097 test_commit --author "Val <val@example.com>" val_2 &&
2098 test_commit --author "Jim <jim@example.com>" jim_2 &&
2099 test_commit --author "Val <val@example.com>" val_3 &&
2100 test_commit --author "Jim <jim@example.com>" jim_3
2103 test_expect_success 'log --invert-grep --grep --author' '
2104 cat >expect <<-\EOF &&
2105 val_3
2106 val_1
2108 git log --format=%s --author=Val --grep 2 --invert-grep >actual &&
2109 test_cmp expect actual
2112 test_done