3 test_description
='git log'
6 .
"$TEST_DIRECTORY/lib-gpg.sh"
7 .
"$TEST_DIRECTORY/lib-terminal.sh"
9 test_expect_success setup
'
14 git commit -m initial &&
19 git commit -m second &&
23 git commit -m third &&
28 git commit -m fourth &&
34 git commit -m fifth &&
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
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
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 &&
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) &&
173 verbose test "$actual" = "$expect"
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
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
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' '
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
233 test_expect_success
'log --invert-grep --grep' '
235 git -c grep.patternType=fixed log --pretty="tformat:%s" --invert-grep --grep=th --grep=Sec >actual &&
236 test_cmp expect actual &&
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 &&
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 &&
247 if test_have_prereq PCRE
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 &&
258 git -c grep.patternType=fixed log --pretty="tformat:%s" --invert-grep -i --grep=th --grep=Sec >actual &&
259 test_cmp expect actual &&
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 &&
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 &&
270 if test_have_prereq PCRE
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 &&
294 git log -1 --pretty="tformat:%s" --grep=sec -i >actual &&
295 test_cmp expect actual &&
298 git -c grep.patternType=basic log -1 --pretty="tformat:%s" --grep=s[e]c -i >actual &&
299 test_cmp expect actual &&
302 git -c grep.patternType=extended log -1 --pretty="tformat:%s" --grep=s[e]c -i >actual &&
303 test_cmp expect actual &&
306 if test_have_prereq PCRE
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 &&
329 # In PCRE \d in [\d] is like saying "0-9", and matches the 2
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.
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
'log with various grep.patternType configurations & command-lines' '
356 git init 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
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
394 git -c grep.patternType=perl log --pretty=tformat:%s \
395 --grep="[\d]\|" >actual.perl &&
396 test_cmp expect.perl actual.perl
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
408 git log --pretty=tformat:%s -P \
409 --grep="[\d]\|" >actual.perl.short-arg
411 test_must_fail git log -P \
414 test_cmp expect.fixed actual.fixed.short-arg &&
415 test_cmp expect.extended actual.extended.short-arg &&
416 if test_have_prereq PCRE
418 test_cmp expect.perl actual.perl.short-arg
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
429 git log --pretty=tformat:%s --perl-regexp \
430 --grep="[\d]\|" >actual.perl.long-arg &&
431 test_cmp expect.perl actual.perl.long-arg
433 test_must_fail git log --perl-regexp \
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
452 test_expect_success
'simple log --graph' '
453 git log --graph --pretty=tformat:%s >actual &&
454 test_cmp expect actual
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 &&
481 * Merge branch
'side'
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
502 | | |
* Merge branch
'side'
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
>
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 &&
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
>
566 |
* commit tags
/side-1
567 | | Author
: A U Thor
<author@example.com
>
572 | | Author
: A U Thor
<author@example.com
>
577 | | Author
: A U Thor
<author@example.com
>
582 | | Author
: A U Thor
<author@example.com
>
587 |
/ Author
: A U Thor
<author@example.com
>
591 * commit tags
/side-1~
1
592 | Author
: A U Thor
<author@example.com
>
596 * commit tags
/side-1~
2
597 | Author
: A U Thor
<author@example.com
>
601 * commit tags
/side-1~
3
602 Author
: A U Thor
<author@example.com
>
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 &&
619 git checkout master &&
621 git checkout -b 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 &&
640 *-. \ Merge tags
'octopus-a' and
'octopus-b'
650 * Merge branch
'tangle'
652 |
* Merge branch
'side' (early part
) into tangle
654 |
* \ Merge branch
'master' (early part
) into tangle
657 * | | | Merge branch
'side'
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 &&
742 Merge-tags-octopus-a-and-octopus-b
744 octopus-b (octopus-b)
745 octopus-a (octopus-a)
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 &&
756 Merge-tags-octopus-a-and-octopus-b
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 &&
770 Merge-tags-octopus-a-and-octopus-b
772 octopus-b (octopus-b)
773 octopus-a (octopus-a)
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)
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)
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
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
'log.decorate config parsing' '
841 git log --oneline --decorate=full >expect.full &&
842 git log --oneline --decorate=short >expect.short &&
844 test_config log.decorate full &&
845 test_config log.mailmap true &&
846 git log --oneline >actual &&
847 test_cmp expect.full actual &&
848 git log --oneline --decorate=short >actual &&
849 test_cmp expect.short actual
852 test_expect_success TTY
'log output on a TTY' '
853 git log --color --oneline --decorate >expect.short &&
855 test_terminal git log --oneline >actual &&
856 test_cmp expect.short actual
859 test_expect_success
'reflog is expected format' '
860 git log -g --abbrev-commit --pretty=oneline >expect &&
861 git reflog >actual &&
862 test_cmp expect actual
865 test_expect_success
'whatchanged is expected format' '
866 git log --no-merges --raw >expect &&
867 git whatchanged >actual &&
868 test_cmp expect actual
871 test_expect_success
'log.abbrevCommit configuration' '
872 git log --abbrev-commit >expect.log.abbrev &&
873 git log --no-abbrev-commit >expect.log.full &&
874 git log --pretty=raw >expect.log.raw &&
875 git reflog --abbrev-commit >expect.reflog.abbrev &&
876 git reflog --no-abbrev-commit >expect.reflog.full &&
877 git whatchanged --abbrev-commit >expect.whatchanged.abbrev &&
878 git whatchanged --no-abbrev-commit >expect.whatchanged.full &&
880 test_config log.abbrevCommit true &&
883 test_cmp expect.log.abbrev actual &&
884 git log --no-abbrev-commit >actual &&
885 test_cmp expect.log.full actual &&
887 git log --pretty=raw >actual &&
888 test_cmp expect.log.raw actual &&
890 git reflog >actual &&
891 test_cmp expect.reflog.abbrev actual &&
892 git reflog --no-abbrev-commit >actual &&
893 test_cmp expect.reflog.full actual &&
895 git whatchanged >actual &&
896 test_cmp expect.whatchanged.abbrev actual &&
897 git whatchanged --no-abbrev-commit >actual &&
898 test_cmp expect.whatchanged.full actual
901 test_expect_success
'show added path under "--follow -M"' '
902 # This tests for a regression introduced in v1.7.2-rc0~103^2~2
903 test_create_repo regression &&
906 test_commit needs-another-commit &&
907 test_commit foo.bar &&
908 git log -M --follow -p foo.bar.t &&
909 git log -M --follow --stat foo.bar.t &&
910 git log -M --follow --name-only foo.bar.t
914 test_expect_success
'git log -c --follow' '
915 test_create_repo follow-c &&
918 test_commit initial file original &&
920 test_commit rename file2 original &&
921 git reset --hard initial &&
922 test_commit modify file foo &&
923 git merge -m merge rename &&
924 git log -c --follow file2
929 * commit COMMIT_OBJECT_NAME
930 |\ Merge
: MERGE_PARENTS
931 | | Author
: A U Thor
<author@example.com
>
933 | | Merge HEADS DESCRIPTION
935 |
* commit COMMIT_OBJECT_NAME
936 | | Author
: A U Thor
<author@example.com
>
941 | |
1 file changed
, 1 insertion
(+)
943 | |
diff --git a
/reach.t b
/reach.t
944 | | new
file mode
100644
945 | | index
0000000.
.10c9591
952 *-. \ commit COMMIT_OBJECT_NAME
953 |\ \ \ Merge
: MERGE_PARENTS
954 | | | | Author
: A U Thor
<author@example.com
>
956 | | | | Merge HEADS DESCRIPTION
958 | |
* | commit COMMIT_OBJECT_NAME
959 | | |
/ Author
: A U Thor
<author@example.com
>
963 | | | octopus-b.t |
1 +
964 | | |
1 file changed
, 1 insertion
(+)
966 | | |
diff --git a
/octopus-b.t b
/octopus-b.t
967 | | | new
file mode
100644
968 | | | index
0000000..d5fcad0
970 | | |
+++ b
/octopus-b.t
974 |
* | commit COMMIT_OBJECT_NAME
975 | |
/ Author
: A U Thor
<author@example.com
>
979 | | octopus-a.t |
1 +
980 | |
1 file changed
, 1 insertion
(+)
982 | |
diff --git a
/octopus-a.t b
/octopus-a.t
983 | | new
file mode
100644
984 | | index
0000000.
.11ee015
986 | |
+++ b
/octopus-a.t
990 * | commit COMMIT_OBJECT_NAME
991 |
/ Author
: A U Thor
<author@example.com
>
996 |
1 file changed
, 1 insertion
(+)
998 |
diff --git a
/seventh.t b
/seventh.t
999 | new
file mode
100644
1000 | index
0000000.
.9744ffc
1006 * commit COMMIT_OBJECT_NAME
1007 |\ Merge
: MERGE_PARENTS
1008 | | Author
: A U Thor
<author@example.com
>
1010 | | Merge branch
'tangle'
1012 |
* commit COMMIT_OBJECT_NAME
1013 | |\ Merge
: MERGE_PARENTS
1014 | | | Author
: A U Thor
<author@example.com
>
1016 | | | Merge branch
'side' (early part
) into tangle
1018 |
* | commit COMMIT_OBJECT_NAME
1019 | |\ \ Merge
: MERGE_PARENTS
1020 | | | | Author
: A U Thor
<author@example.com
>
1022 | | | | Merge branch
'master' (early part
) into tangle
1024 |
* | | commit COMMIT_OBJECT_NAME
1025 | | | | Author
: A U Thor
<author@example.com
>
1029 | | | | tangle-a |
1 +
1030 | | | |
1 file changed
, 1 insertion
(+)
1032 | | | |
diff --git a
/tangle-a b
/tangle-a
1033 | | | | new
file mode
100644
1034 | | | | index
0000000.
.7898192
1035 | | | |
--- /dev
/null
1036 | | | |
+++ b
/tangle-a
1037 | | | | @@
-0,0 +1 @@
1040 * | | | commit COMMIT_OBJECT_NAME
1041 |\ \ \ \ Merge
: MERGE_PARENTS
1042 | | | | | Author
: A U Thor
<author@example.com
>
1044 | | | | | Merge branch
'side'
1046 |
* | | | commit COMMIT_OBJECT_NAME
1047 | | |_|
/ Author
: A U Thor
<author@example.com
>
1052 | | | |
1 file changed
, 1 insertion
(+)
1054 | | | |
diff --git a
/2 b
/2
1055 | | | | new
file mode
100644
1056 | | | | index
0000000.
.0cfbf08
1057 | | | |
--- /dev
/null
1059 | | | | @@
-0,0 +1 @@
1062 |
* | | commit COMMIT_OBJECT_NAME
1063 | | | | Author
: A U Thor
<author@example.com
>
1068 | | | |
1 file changed
, 1 insertion
(+)
1070 | | | |
diff --git a
/1 b
/1
1071 | | | | new
file mode
100644
1072 | | | | index
0000000..d00491f
1073 | | | |
--- /dev
/null
1075 | | | | @@
-0,0 +1 @@
1078 * | | | commit COMMIT_OBJECT_NAME
1079 | | | | Author
: A U Thor
<author@example.com
>
1084 | | | |
1 file changed
, 1 insertion
(+)
1086 | | | |
diff --git a
/one b
/one
1087 | | | | new
file mode
100644
1088 | | | | index
0000000.
.9a33383
1089 | | | |
--- /dev
/null
1091 | | | | @@
-0,0 +1 @@
1094 * | | | commit COMMIT_OBJECT_NAME
1095 | |_|
/ Author
: A U Thor
<author@example.com
>
1100 | | |
1 file changed
, 1 deletion
(-)
1102 | | |
diff --git a
/a
/two b
/a
/two
1103 | | | deleted
file mode
100644
1104 | | | index
9245af5.
.0000000
1110 * | | commit COMMIT_OBJECT_NAME
1111 | | | Author
: A U Thor
<author@example.com
>
1116 | | |
1 file changed
, 1 insertion
(+)
1118 | | |
diff --git a
/a
/two b
/a
/two
1119 | | | new
file mode
100644
1120 | | | index
0000000.
.9245af5
1126 * | | commit COMMIT_OBJECT_NAME
1127 |
/ / Author
: A U Thor
<author@example.com
>
1132 | |
1 file changed
, 1 insertion
(+)
1134 | |
diff --git a
/ein b
/ein
1135 | | new
file mode
100644
1136 | | index
0000000.
.9d7e69f
1142 * | commit COMMIT_OBJECT_NAME
1143 |
/ Author
: A U Thor
<author@example.com
>
1149 |
2 files changed
, 1 insertion
(+), 1 deletion
(-)
1151 |
diff --git a
/ichi b
/ichi
1152 | new
file mode
100644
1153 | index
0000000.
.9d7e69f
1158 |
diff --git a
/one b
/one
1159 | deleted
file mode
100644
1160 | index
9d7e69f.
.0000000
1166 * commit COMMIT_OBJECT_NAME
1167 | Author
: A U Thor
<author@example.com
>
1172 |
1 file changed
, 1 insertion
(+), 1 deletion
(-)
1174 |
diff --git a
/one b
/one
1175 | index
5626abf.
.9d7e69f
100644
1182 * commit COMMIT_OBJECT_NAME
1183 Author
: A U Thor
<author@example.com
>
1188 1 file changed
, 1 insertion
(+)
1190 diff --git a
/one b
/one
1191 new
file mode
100644
1192 index
0000000.
.5626abf
1199 sanitize_output
() {
1201 -e 's/commit [0-9a-f]*$/commit COMMIT_OBJECT_NAME/' \
1202 -e 's/Merge: [ 0-9a-f]*$/Merge: MERGE_PARENTS/' \
1203 -e 's/Merge tag.*/Merge HEADS DESCRIPTION/' \
1204 -e 's/Merge commit.*/Merge HEADS DESCRIPTION/' \
1205 -e 's/, 0 deletions(-)//' \
1206 -e 's/, 0 insertions(+)//' \
1207 -e 's/ 1 files changed, / 1 file changed, /' \
1208 -e 's/, 1 deletions(-)/, 1 deletion(-)/' \
1209 -e 's/, 1 insertions(+)/, 1 insertion(+)/'
1212 test_expect_success
'log --graph with diff and stats' '
1213 git log --no-renames --graph --pretty=short --stat -p >actual &&
1214 sanitize_output >actual.sanitized <actual &&
1215 test_i18ncmp expect actual.sanitized
1219 *** * commit COMMIT_OBJECT_NAME
1220 *** |\ Merge
: MERGE_PARENTS
1221 *** | | Author
: A U Thor
<author@example.com
>
1223 *** | | Merge HEADS DESCRIPTION
1225 *** |
* commit COMMIT_OBJECT_NAME
1226 *** | | Author
: A U Thor
<author@example.com
>
1230 *** | | reach.t |
1 +
1231 *** | |
1 file changed
, 1 insertion
(+)
1233 *** | |
diff --git a
/reach.t b
/reach.t
1234 *** | | new
file mode
100644
1235 *** | | index
0000000.
.10c9591
1236 *** | |
--- /dev
/null
1237 *** | |
+++ b
/reach.t
1238 *** | | @@
-0,0 +1 @@
1242 *** *-. \ commit COMMIT_OBJECT_NAME
1243 *** |\ \ \ Merge
: MERGE_PARENTS
1244 *** | | | | Author
: A U Thor
<author@example.com
>
1246 *** | | | | Merge HEADS DESCRIPTION
1248 *** | |
* | commit COMMIT_OBJECT_NAME
1249 *** | | |
/ Author
: A U Thor
<author@example.com
>
1253 *** | | | octopus-b.t |
1 +
1254 *** | | |
1 file changed
, 1 insertion
(+)
1256 *** | | |
diff --git a
/octopus-b.t b
/octopus-b.t
1257 *** | | | new
file mode
100644
1258 *** | | | index
0000000..d5fcad0
1259 *** | | |
--- /dev
/null
1260 *** | | |
+++ b
/octopus-b.t
1261 *** | | | @@
-0,0 +1 @@
1262 *** | | |
+octopus-b
1264 *** |
* | commit COMMIT_OBJECT_NAME
1265 *** | |
/ Author
: A U Thor
<author@example.com
>
1269 *** | | octopus-a.t |
1 +
1270 *** | |
1 file changed
, 1 insertion
(+)
1272 *** | |
diff --git a
/octopus-a.t b
/octopus-a.t
1273 *** | | new
file mode
100644
1274 *** | | index
0000000.
.11ee015
1275 *** | |
--- /dev
/null
1276 *** | |
+++ b
/octopus-a.t
1277 *** | | @@
-0,0 +1 @@
1280 *** * | commit COMMIT_OBJECT_NAME
1281 *** |
/ Author
: A U Thor
<author@example.com
>
1285 *** | seventh.t |
1 +
1286 *** |
1 file changed
, 1 insertion
(+)
1288 *** |
diff --git a
/seventh.t b
/seventh.t
1289 *** | new
file mode
100644
1290 *** | index
0000000.
.9744ffc
1292 *** |
+++ b
/seventh.t
1296 *** * commit COMMIT_OBJECT_NAME
1297 *** |\ Merge
: MERGE_PARENTS
1298 *** | | Author
: A U Thor
<author@example.com
>
1300 *** | | Merge branch
'tangle'
1302 *** |
* commit COMMIT_OBJECT_NAME
1303 *** | |\ Merge
: MERGE_PARENTS
1304 *** | | | Author
: A U Thor
<author@example.com
>
1306 *** | | | Merge branch
'side' (early part
) into tangle
1308 *** |
* | commit COMMIT_OBJECT_NAME
1309 *** | |\ \ Merge
: MERGE_PARENTS
1310 *** | | | | Author
: A U Thor
<author@example.com
>
1312 *** | | | | Merge branch
'master' (early part
) into tangle
1314 *** |
* | | commit COMMIT_OBJECT_NAME
1315 *** | | | | Author
: A U Thor
<author@example.com
>
1317 *** | | | | tangle-a
1319 *** | | | | tangle-a |
1 +
1320 *** | | | |
1 file changed
, 1 insertion
(+)
1322 *** | | | |
diff --git a
/tangle-a b
/tangle-a
1323 *** | | | | new
file mode
100644
1324 *** | | | | index
0000000.
.7898192
1325 *** | | | |
--- /dev
/null
1326 *** | | | |
+++ b
/tangle-a
1327 *** | | | | @@
-0,0 +1 @@
1330 *** * | | | commit COMMIT_OBJECT_NAME
1331 *** |\ \ \ \ Merge
: MERGE_PARENTS
1332 *** | | | | | Author
: A U Thor
<author@example.com
>
1334 *** | | | | | Merge branch
'side'
1336 *** |
* | | | commit COMMIT_OBJECT_NAME
1337 *** | | |_|
/ Author
: A U Thor
<author@example.com
>
1342 *** | | | |
1 file changed
, 1 insertion
(+)
1344 *** | | | |
diff --git a
/2 b
/2
1345 *** | | | | new
file mode
100644
1346 *** | | | | index
0000000.
.0cfbf08
1347 *** | | | |
--- /dev
/null
1349 *** | | | | @@
-0,0 +1 @@
1352 *** |
* | | commit COMMIT_OBJECT_NAME
1353 *** | | | | Author
: A U Thor
<author@example.com
>
1358 *** | | | |
1 file changed
, 1 insertion
(+)
1360 *** | | | |
diff --git a
/1 b
/1
1361 *** | | | | new
file mode
100644
1362 *** | | | | index
0000000..d00491f
1363 *** | | | |
--- /dev
/null
1365 *** | | | | @@
-0,0 +1 @@
1368 *** * | | | commit COMMIT_OBJECT_NAME
1369 *** | | | | Author
: A U Thor
<author@example.com
>
1373 *** | | | | one |
1 +
1374 *** | | | |
1 file changed
, 1 insertion
(+)
1376 *** | | | |
diff --git a
/one b
/one
1377 *** | | | | new
file mode
100644
1378 *** | | | | index
0000000.
.9a33383
1379 *** | | | |
--- /dev
/null
1380 *** | | | |
+++ b
/one
1381 *** | | | | @@
-0,0 +1 @@
1384 *** * | | | commit COMMIT_OBJECT_NAME
1385 *** | |_|
/ Author
: A U Thor
<author@example.com
>
1389 *** | | | a
/two |
1 -
1390 *** | | |
1 file changed
, 1 deletion
(-)
1392 *** | | |
diff --git a
/a
/two b
/a
/two
1393 *** | | | deleted
file mode
100644
1394 *** | | | index
9245af5.
.0000000
1395 *** | | |
--- a
/a
/two
1396 *** | | |
+++ /dev
/null
1397 *** | | | @@
-1 +0,0 @@
1400 *** * | | commit COMMIT_OBJECT_NAME
1401 *** | | | Author
: A U Thor
<author@example.com
>
1405 *** | | | a
/two |
1 +
1406 *** | | |
1 file changed
, 1 insertion
(+)
1408 *** | | |
diff --git a
/a
/two b
/a
/two
1409 *** | | | new
file mode
100644
1410 *** | | | index
0000000.
.9245af5
1411 *** | | |
--- /dev
/null
1412 *** | | |
+++ b
/a
/two
1413 *** | | | @@
-0,0 +1 @@
1416 *** * | | commit COMMIT_OBJECT_NAME
1417 *** |
/ / Author
: A U Thor
<author@example.com
>
1422 *** | |
1 file changed
, 1 insertion
(+)
1424 *** | |
diff --git a
/ein b
/ein
1425 *** | | new
file mode
100644
1426 *** | | index
0000000.
.9d7e69f
1427 *** | |
--- /dev
/null
1429 *** | | @@
-0,0 +1 @@
1432 *** * | commit COMMIT_OBJECT_NAME
1433 *** |
/ Author
: A U Thor
<author@example.com
>
1439 *** |
2 files changed
, 1 insertion
(+), 1 deletion
(-)
1441 *** |
diff --git a
/ichi b
/ichi
1442 *** | new
file mode
100644
1443 *** | index
0000000.
.9d7e69f
1448 *** |
diff --git a
/one b
/one
1449 *** | deleted
file mode
100644
1450 *** | index
9d7e69f.
.0000000
1456 *** * commit COMMIT_OBJECT_NAME
1457 *** | Author
: A U Thor
<author@example.com
>
1462 *** |
1 file changed
, 1 insertion
(+), 1 deletion
(-)
1464 *** |
diff --git a
/one b
/one
1465 *** | index
5626abf.
.9d7e69f
100644
1472 *** * commit COMMIT_OBJECT_NAME
1473 *** Author
: A U Thor
<author@example.com
>
1478 *** 1 file changed
, 1 insertion
(+)
1480 *** diff --git a
/one b
/one
1481 *** new
file mode
100644
1482 *** index
0000000.
.5626abf
1489 test_expect_success
'log --line-prefix="*** " --graph with diff and stats' '
1490 git log --line-prefix="*** " --no-renames --graph --pretty=short --stat -p >actual &&
1491 sanitize_output >actual.sanitized <actual &&
1492 test_i18ncmp expect actual.sanitized
1499 * Merge branch 'tangle'
1500 * Merge branch 'side'
1513 test_expect_success 'log --graph with --name-status' '
1514 git log --graph --format=%s --name-status tangle..reach >actual &&
1515 sanitize_output <actual >actual.sanitized &&
1516 test_cmp expect actual.sanitized
1523 * Merge branch 'tangle'
1524 * Merge branch 'side'
1537 test_expect_success 'log --graph with --name-only' '
1538 git log --graph --format=%s --name-only tangle..reach >actual &&
1539 sanitize_output <actual >actual.sanitized &&
1540 test_cmp expect actual.sanitized
1543 test_expect_success 'dotdot is a parent directory' '
1545 ( echo sixth && echo fifth ) >expect &&
1546 ( cd a/b && git log --format=%s .. ) >actual &&
1547 test_cmp expect actual
1550 test_expect_success GPG 'setup signed branch' '
1551 test_when_finished "git reset --hard && git checkout master" &&
1552 git checkout -b signed master &&
1555 git commit -S -m signed_commit
1558 test_expect_success GPG 'log --graph --show-signature' '
1559 git log --graph --show-signature -n1 signed >actual &&
1560 grep "^| gpg: Signature made" actual &&
1561 grep "^| gpg: Good signature" actual
1564 test_expect_success GPG 'log --graph --show-signature for merged tag' '
1565 test_when_finished "git reset --hard && git checkout master" &&
1566 git checkout -b plain master &&
1569 git commit -m bar_commit &&
1570 git checkout -b tagged master &&
1573 git commit -m baz_commit &&
1574 git tag -s -m signed_tag_msg signed_tag &&
1575 git checkout plain &&
1576 git merge --no-ff -m msg signed_tag &&
1577 git log --graph --show-signature -n1 plain >actual &&
1578 grep "^|\\\ merged tag" actual &&
1579 grep "^| | gpg: Signature made" actual &&
1580 grep "^| | gpg: Good signature" actual
1583 test_expect_success GPG '--no-show-signature overrides --show-signature' '
1584 git log -1 --show-signature --no-show-signature signed >actual &&
1585 ! grep "^gpg:" actual
1588 test_expect_success GPG 'log.showsignature=true behaves like --show-signature' '
1589 test_config log.showsignature true &&
1590 git log -1 signed >actual &&
1591 grep "gpg: Signature made" actual &&
1592 grep "gpg: Good signature" actual
1595 test_expect_success GPG '--no-show-signature overrides log.showsignature=true' '
1596 test_config log.showsignature true &&
1597 git log -1 --no-show-signature signed >actual &&
1598 ! grep "^gpg:" actual
1601 test_expect_success GPG '--show-signature overrides log.showsignature=false' '
1602 test_config log.showsignature false &&
1603 git log -1 --show-signature signed >actual &&
1604 grep "gpg: Signature made" actual &&
1605 grep "gpg: Good signature" actual
1608 test_expect_success 'log --graph --no-walk is forbidden' '
1609 test_must_fail git log --graph --no-walk
1612 test_expect_success 'log diagnoses bogus HEAD' '
1614 test_must_fail git -C empty log 2>stderr &&
1615 test_i18ngrep does.not.have.any.commits stderr &&
1616 echo 1234abcd >empty/.git/refs/heads/master &&
1617 test_must_fail git -C empty log 2>stderr &&
1618 test_i18ngrep broken stderr &&
1619 echo "ref: refs/heads/invalid.lock" >empty/.git/HEAD &&
1620 test_must_fail git -C empty log 2>stderr &&
1621 test_i18ngrep broken stderr &&
1622 test_must_fail git -C empty log --default totally-bogus 2>stderr &&
1623 test_i18ngrep broken stderr
1626 test_expect_success 'log does not default to HEAD when rev input is given' '
1627 git log --branches=does-not-exist >actual &&
1628 test_must_be_empty actual
1631 test_expect_success 'set up --source tests' '
1632 git checkout --orphan source-a &&
1635 git checkout -b source-b HEAD^ &&
1639 test_expect_success 'log --source paints branch names' '
1640 cat >expect <<-\EOF &&
1641 09e12a9 source-b three
1642 8e393e1 source-a two
1643 1ac6c77 source-b one
1645 git log --oneline --source source-a source-b >actual &&
1646 test_cmp expect actual
1649 test_expect_success 'log --source paints tag names' '
1650 git tag -m tagged source-tag &&
1651 cat >expect <<-\EOF &&
1652 09e12a9 source-tag three
1653 8e393e1 source-a two
1654 1ac6c77 source-tag one
1656 git log --oneline --source source-tag source-a >actual &&
1657 test_cmp expect actual
1660 test_expect_success 'log --source paints symmetric ranges' '
1661 cat >expect <<-\EOF &&
1662 09e12a9 source-b three
1663 8e393e1 source-a two
1665 git log --oneline --source source-a...source-b >actual &&
1666 test_cmp expect actual