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' '
344 git -c grep.patterntype=fixed \
345 log -1 --pretty=tformat:%s --grep=s.c.nd >actual &&
346 test_cmp expect actual
349 test_expect_success
'log with grep.patternType configuration and command line' '
350 echo second >expect &&
351 git -c grep.patterntype=fixed \
352 log -1 --pretty=tformat:%s --basic-regexp --grep=s.c.nd >actual &&
353 test_cmp expect actual
356 test_expect_success
'log with various grep.patternType configurations & command-lines' '
357 git init pattern-type &&
360 test_commit 1 file A &&
362 # The tagname is overridden here because creating a
363 # tag called "(1|2)" as test_commit would otherwise
364 # implicitly do would fail on e.g. MINGW.
365 test_commit "(1|2)" file B 2 &&
367 echo "(1|2)" >expect.fixed &&
368 cp expect.fixed expect.basic &&
369 cp expect.fixed expect.extended &&
370 cp expect.fixed expect.perl &&
372 # A strcmp-like match with fixed.
373 git -c grep.patternType=fixed log --pretty=tformat:%s \
374 --grep="(1|2)" >actual.fixed &&
376 # POSIX basic matches (, | and ) literally.
377 git -c grep.patternType=basic log --pretty=tformat:%s \
378 --grep="(.|.)" >actual.basic &&
380 # POSIX extended needs to have | escaped to match it
381 # literally, whereas under basic this is the same as
382 # (|2), i.e. it would also match "1". This test checks
383 # for extended by asserting that it is not matching
384 # what basic would match.
385 git -c grep.patternType=extended log --pretty=tformat:%s \
386 --grep="\|2" >actual.extended &&
387 if test_have_prereq PCRE
389 # Only PCRE would match [\d]\| with only
390 # "(1|2)" due to [\d]. POSIX basic would match
391 # both it and "1" since similarly to the
392 # extended match above it is the same as
393 # \([\d]\|\). POSIX extended would
395 git -c grep.patternType=perl log --pretty=tformat:%s \
396 --grep="[\d]\|" >actual.perl &&
397 test_cmp expect.perl actual.perl
399 test_cmp expect.fixed actual.fixed &&
400 test_cmp expect.basic actual.basic &&
401 test_cmp expect.extended actual.extended &&
403 git log --pretty=tformat:%s -F \
404 --grep="(1|2)" >actual.fixed.short-arg &&
405 git log --pretty=tformat:%s -E \
406 --grep="\|2" >actual.extended.short-arg &&
407 test_cmp expect.fixed actual.fixed.short-arg &&
408 test_cmp expect.extended actual.extended.short-arg &&
410 git log --pretty=tformat:%s --fixed-strings \
411 --grep="(1|2)" >actual.fixed.long-arg &&
412 git log --pretty=tformat:%s --basic-regexp \
413 --grep="(.|.)" >actual.basic.long-arg &&
414 git log --pretty=tformat:%s --extended-regexp \
415 --grep="\|2" >actual.extended.long-arg &&
416 if test_have_prereq PCRE
418 git log --pretty=tformat:%s --perl-regexp \
419 --grep="[\d]\|" >actual.perl.long-arg &&
420 test_cmp expect.perl actual.perl.long-arg
422 test_must_fail git log --perl-regexp \
425 test_cmp expect.fixed actual.fixed.long-arg &&
426 test_cmp expect.basic actual.basic.long-arg &&
427 test_cmp expect.extended actual.extended.long-arg
441 test_expect_success
'simple log --graph' '
442 git log --graph --pretty=tformat:%s >actual &&
443 test_cmp expect actual
456 test_expect_success
'simple log --graph --line-prefix="123 "' '
457 git log --graph --line-prefix="123 " --pretty=tformat:%s >actual &&
458 test_cmp expect actual
461 test_expect_success
'set up merge history' '
462 git checkout -b side HEAD~4 &&
463 test_commit side-1 1 1 &&
464 test_commit side-2 2 2 &&
465 git checkout master &&
470 * Merge branch
'side'
484 test_expect_success
'log --graph with merge' '
485 git log --graph --date-order --pretty=tformat:%s |
486 sed "s/ *\$//" >actual &&
487 test_cmp expect actual
491 | | |
* Merge branch
'side'
505 test_expect_success
'log --graph --line-prefix="| | | " with merge' '
506 git log --line-prefix="| | | " --graph --date-order --pretty=tformat:%s |
507 sed "s/ *\$//" >actual &&
508 test_cmp expect actual
511 cat > expect.colors
<<\EOF
512 * Merge branch
'side'
513 <BLUE
>|
<RESET
><CYAN
>\
<RESET
>
514 <BLUE
>|
<RESET
> * side-2
515 <BLUE
>|
<RESET
> * side-1
516 * <CYAN
>|
<RESET
> Second
517 * <CYAN
>|
<RESET
> sixth
518 * <CYAN
>|
<RESET
> fifth
519 * <CYAN
>|
<RESET
> fourth
520 <CYAN
>|
<RESET
><CYAN
>/<RESET
>
526 test_expect_success
'log --graph with merge with log.graphColors' '
527 test_config log.graphColors " blue,invalid-color, cyan, red , " &&
528 git log --color=always --graph --date-order --pretty=tformat:%s |
529 test_decode_color | sed "s/ *\$//" >actual &&
530 test_cmp expect.colors actual
533 test_expect_success
'log --raw --graph -m with merge' '
534 git log --raw --graph --oneline -m master | head -n 500 >actual &&
535 grep "initial" actual
538 test_expect_success
'diff-tree --graph' '
539 git diff-tree --graph master^ | head -n 500 >actual &&
546 | | Author
: A U Thor
<author@example.com
>
548 | | Merge branch
'side'
551 | | Author
: A U Thor
<author@example.com
>
555 |
* commit tags
/side-1
556 | | Author
: A U Thor
<author@example.com
>
561 | | Author
: A U Thor
<author@example.com
>
566 | | Author
: A U Thor
<author@example.com
>
571 | | Author
: A U Thor
<author@example.com
>
576 |
/ Author
: A U Thor
<author@example.com
>
580 * commit tags
/side-1~
1
581 | Author
: A U Thor
<author@example.com
>
585 * commit tags
/side-1~
2
586 | Author
: A U Thor
<author@example.com
>
590 * commit tags
/side-1~
3
591 Author
: A U Thor
<author@example.com
>
596 test_expect_success
'log --graph with full output' '
597 git log --graph --date-order --pretty=short |
598 git name-rev --name-only --stdin |
599 sed "s/Merge:.*/Merge: A B/;s/ *\$//" >actual &&
600 test_cmp expect actual
603 test_expect_success
'set up more tangled history' '
604 git checkout -b tangle HEAD~6 &&
605 test_commit tangle-a tangle-a a &&
606 git merge master~3 &&
608 git checkout master &&
610 git checkout -b reach &&
612 git checkout master &&
613 git checkout -b octopus-a &&
614 test_commit octopus-a &&
615 git checkout master &&
616 git checkout -b octopus-b &&
617 test_commit octopus-b &&
618 git checkout master &&
619 test_commit seventh &&
620 git merge octopus-a octopus-b &&
629 *-. \ Merge tags
'octopus-a' and
'octopus-b'
639 * Merge branch
'tangle'
641 |
* Merge branch
'side' (early part
) into tangle
643 |
* \ Merge branch
'master' (early part
) into tangle
646 * | | | Merge branch
'side'
665 test_expect_success
'log --graph with merge' '
666 git log --graph --date-order --pretty=tformat:%s |
667 sed "s/ *\$//" >actual &&
668 test_cmp expect actual
671 test_expect_success
'log.decorate configuration' '
672 git log --oneline --no-decorate >expect.none &&
673 git log --oneline --decorate >expect.short &&
674 git log --oneline --decorate=full >expect.full &&
676 echo "[log] decorate" >>.git/config &&
677 git log --oneline >actual &&
678 test_cmp expect.short actual &&
680 test_config log.decorate true &&
681 git log --oneline >actual &&
682 test_cmp expect.short actual &&
683 git log --oneline --decorate=full >actual &&
684 test_cmp expect.full actual &&
685 git log --oneline --decorate=no >actual &&
686 test_cmp expect.none actual &&
688 test_config log.decorate no &&
689 git log --oneline >actual &&
690 test_cmp expect.none actual &&
691 git log --oneline --decorate >actual &&
692 test_cmp expect.short actual &&
693 git log --oneline --decorate=full >actual &&
694 test_cmp expect.full actual &&
696 test_config log.decorate 1 &&
697 git log --oneline >actual &&
698 test_cmp expect.short actual &&
699 git log --oneline --decorate=full >actual &&
700 test_cmp expect.full actual &&
701 git log --oneline --decorate=no >actual &&
702 test_cmp expect.none actual &&
704 test_config log.decorate short &&
705 git log --oneline >actual &&
706 test_cmp expect.short actual &&
707 git log --oneline --no-decorate >actual &&
708 test_cmp expect.none actual &&
709 git log --oneline --decorate=full >actual &&
710 test_cmp expect.full actual &&
712 test_config log.decorate full &&
713 git log --oneline >actual &&
714 test_cmp expect.full actual &&
715 git log --oneline --no-decorate >actual &&
716 test_cmp expect.none actual &&
717 git log --oneline --decorate >actual &&
718 test_cmp expect.short actual &&
720 test_unconfig log.decorate &&
721 git log --pretty=raw >expect.raw &&
722 test_config log.decorate full &&
723 git log --pretty=raw >actual &&
724 test_cmp expect.raw actual
728 test_expect_success TTY
'log output on a TTY' '
729 git log --oneline --decorate >expect.short &&
731 test_terminal git log --oneline >actual &&
732 test_cmp expect.short actual
735 test_expect_success
'reflog is expected format' '
736 git log -g --abbrev-commit --pretty=oneline >expect &&
737 git reflog >actual &&
738 test_cmp expect actual
741 test_expect_success
'whatchanged is expected format' '
742 git log --no-merges --raw >expect &&
743 git whatchanged >actual &&
744 test_cmp expect actual
747 test_expect_success
'log.abbrevCommit configuration' '
748 git log --abbrev-commit >expect.log.abbrev &&
749 git log --no-abbrev-commit >expect.log.full &&
750 git log --pretty=raw >expect.log.raw &&
751 git reflog --abbrev-commit >expect.reflog.abbrev &&
752 git reflog --no-abbrev-commit >expect.reflog.full &&
753 git whatchanged --abbrev-commit >expect.whatchanged.abbrev &&
754 git whatchanged --no-abbrev-commit >expect.whatchanged.full &&
756 test_config log.abbrevCommit true &&
759 test_cmp expect.log.abbrev actual &&
760 git log --no-abbrev-commit >actual &&
761 test_cmp expect.log.full actual &&
763 git log --pretty=raw >actual &&
764 test_cmp expect.log.raw actual &&
766 git reflog >actual &&
767 test_cmp expect.reflog.abbrev actual &&
768 git reflog --no-abbrev-commit >actual &&
769 test_cmp expect.reflog.full actual &&
771 git whatchanged >actual &&
772 test_cmp expect.whatchanged.abbrev actual &&
773 git whatchanged --no-abbrev-commit >actual &&
774 test_cmp expect.whatchanged.full actual
777 test_expect_success
'show added path under "--follow -M"' '
778 # This tests for a regression introduced in v1.7.2-rc0~103^2~2
779 test_create_repo regression &&
782 test_commit needs-another-commit &&
783 test_commit foo.bar &&
784 git log -M --follow -p foo.bar.t &&
785 git log -M --follow --stat foo.bar.t &&
786 git log -M --follow --name-only foo.bar.t
790 test_expect_success
'git log -c --follow' '
791 test_create_repo follow-c &&
794 test_commit initial file original &&
796 test_commit rename file2 original &&
797 git reset --hard initial &&
798 test_commit modify file foo &&
799 git merge -m merge rename &&
800 git log -c --follow file2
805 * commit COMMIT_OBJECT_NAME
806 |\ Merge
: MERGE_PARENTS
807 | | Author
: A U Thor
<author@example.com
>
809 | | Merge HEADS DESCRIPTION
811 |
* commit COMMIT_OBJECT_NAME
812 | | Author
: A U Thor
<author@example.com
>
817 | |
1 file changed
, 1 insertion
(+)
819 | |
diff --git a
/reach.t b
/reach.t
820 | | new
file mode
100644
821 | | index
0000000.
.10c9591
828 *-. \ commit COMMIT_OBJECT_NAME
829 |\ \ \ Merge
: MERGE_PARENTS
830 | | | | Author
: A U Thor
<author@example.com
>
832 | | | | Merge HEADS DESCRIPTION
834 | |
* | commit COMMIT_OBJECT_NAME
835 | | |
/ Author
: A U Thor
<author@example.com
>
839 | | | octopus-b.t |
1 +
840 | | |
1 file changed
, 1 insertion
(+)
842 | | |
diff --git a
/octopus-b.t b
/octopus-b.t
843 | | | new
file mode
100644
844 | | | index
0000000..d5fcad0
846 | | |
+++ b
/octopus-b.t
850 |
* | commit COMMIT_OBJECT_NAME
851 | |
/ Author
: A U Thor
<author@example.com
>
855 | | octopus-a.t |
1 +
856 | |
1 file changed
, 1 insertion
(+)
858 | |
diff --git a
/octopus-a.t b
/octopus-a.t
859 | | new
file mode
100644
860 | | index
0000000.
.11ee015
862 | |
+++ b
/octopus-a.t
866 * | commit COMMIT_OBJECT_NAME
867 |
/ Author
: A U Thor
<author@example.com
>
872 |
1 file changed
, 1 insertion
(+)
874 |
diff --git a
/seventh.t b
/seventh.t
875 | new
file mode
100644
876 | index
0000000.
.9744ffc
882 * commit COMMIT_OBJECT_NAME
883 |\ Merge
: MERGE_PARENTS
884 | | Author
: A U Thor
<author@example.com
>
886 | | Merge branch
'tangle'
888 |
* commit COMMIT_OBJECT_NAME
889 | |\ Merge
: MERGE_PARENTS
890 | | | Author
: A U Thor
<author@example.com
>
892 | | | Merge branch
'side' (early part
) into tangle
894 |
* | commit COMMIT_OBJECT_NAME
895 | |\ \ Merge
: MERGE_PARENTS
896 | | | | Author
: A U Thor
<author@example.com
>
898 | | | | Merge branch
'master' (early part
) into tangle
900 |
* | | commit COMMIT_OBJECT_NAME
901 | | | | Author
: A U Thor
<author@example.com
>
905 | | | | tangle-a |
1 +
906 | | | |
1 file changed
, 1 insertion
(+)
908 | | | |
diff --git a
/tangle-a b
/tangle-a
909 | | | | new
file mode
100644
910 | | | | index
0000000.
.7898192
911 | | | |
--- /dev
/null
912 | | | |
+++ b
/tangle-a
913 | | | | @@
-0,0 +1 @@
916 * | | | commit COMMIT_OBJECT_NAME
917 |\ \ \ \ Merge
: MERGE_PARENTS
918 | | | | | Author
: A U Thor
<author@example.com
>
920 | | | | | Merge branch
'side'
922 |
* | | | commit COMMIT_OBJECT_NAME
923 | | |_|
/ Author
: A U Thor
<author@example.com
>
928 | | | |
1 file changed
, 1 insertion
(+)
930 | | | |
diff --git a
/2 b
/2
931 | | | | new
file mode
100644
932 | | | | index
0000000.
.0cfbf08
933 | | | |
--- /dev
/null
935 | | | | @@
-0,0 +1 @@
938 |
* | | commit COMMIT_OBJECT_NAME
939 | | | | Author
: A U Thor
<author@example.com
>
944 | | | |
1 file changed
, 1 insertion
(+)
946 | | | |
diff --git a
/1 b
/1
947 | | | | new
file mode
100644
948 | | | | index
0000000..d00491f
949 | | | |
--- /dev
/null
951 | | | | @@
-0,0 +1 @@
954 * | | | commit COMMIT_OBJECT_NAME
955 | | | | Author
: A U Thor
<author@example.com
>
960 | | | |
1 file changed
, 1 insertion
(+)
962 | | | |
diff --git a
/one b
/one
963 | | | | new
file mode
100644
964 | | | | index
0000000.
.9a33383
965 | | | |
--- /dev
/null
967 | | | | @@
-0,0 +1 @@
970 * | | | commit COMMIT_OBJECT_NAME
971 | |_|
/ Author
: A U Thor
<author@example.com
>
976 | | |
1 file changed
, 1 deletion
(-)
978 | | |
diff --git a
/a
/two b
/a
/two
979 | | | deleted
file mode
100644
980 | | | index
9245af5.
.0000000
986 * | | commit COMMIT_OBJECT_NAME
987 | | | Author
: A U Thor
<author@example.com
>
992 | | |
1 file changed
, 1 insertion
(+)
994 | | |
diff --git a
/a
/two b
/a
/two
995 | | | new
file mode
100644
996 | | | index
0000000.
.9245af5
1002 * | | commit COMMIT_OBJECT_NAME
1003 |
/ / Author
: A U Thor
<author@example.com
>
1008 | |
1 file changed
, 1 insertion
(+)
1010 | |
diff --git a
/ein b
/ein
1011 | | new
file mode
100644
1012 | | index
0000000.
.9d7e69f
1018 * | commit COMMIT_OBJECT_NAME
1019 |
/ Author
: A U Thor
<author@example.com
>
1025 |
2 files changed
, 1 insertion
(+), 1 deletion
(-)
1027 |
diff --git a
/ichi b
/ichi
1028 | new
file mode
100644
1029 | index
0000000.
.9d7e69f
1034 |
diff --git a
/one b
/one
1035 | deleted
file mode
100644
1036 | index
9d7e69f.
.0000000
1042 * commit COMMIT_OBJECT_NAME
1043 | Author
: A U Thor
<author@example.com
>
1048 |
1 file changed
, 1 insertion
(+), 1 deletion
(-)
1050 |
diff --git a
/one b
/one
1051 | index
5626abf.
.9d7e69f
100644
1058 * commit COMMIT_OBJECT_NAME
1059 Author
: A U Thor
<author@example.com
>
1064 1 file changed
, 1 insertion
(+)
1066 diff --git a
/one b
/one
1067 new
file mode
100644
1068 index
0000000.
.5626abf
1075 sanitize_output
() {
1077 -e 's/commit [0-9a-f]*$/commit COMMIT_OBJECT_NAME/' \
1078 -e 's/Merge: [ 0-9a-f]*$/Merge: MERGE_PARENTS/' \
1079 -e 's/Merge tag.*/Merge HEADS DESCRIPTION/' \
1080 -e 's/Merge commit.*/Merge HEADS DESCRIPTION/' \
1081 -e 's/, 0 deletions(-)//' \
1082 -e 's/, 0 insertions(+)//' \
1083 -e 's/ 1 files changed, / 1 file changed, /' \
1084 -e 's/, 1 deletions(-)/, 1 deletion(-)/' \
1085 -e 's/, 1 insertions(+)/, 1 insertion(+)/'
1088 test_expect_success
'log --graph with diff and stats' '
1089 git log --no-renames --graph --pretty=short --stat -p >actual &&
1090 sanitize_output >actual.sanitized <actual &&
1091 test_i18ncmp expect actual.sanitized
1095 *** * commit COMMIT_OBJECT_NAME
1096 *** |\ Merge
: MERGE_PARENTS
1097 *** | | Author
: A U Thor
<author@example.com
>
1099 *** | | Merge HEADS DESCRIPTION
1101 *** |
* commit COMMIT_OBJECT_NAME
1102 *** | | Author
: A U Thor
<author@example.com
>
1106 *** | | reach.t |
1 +
1107 *** | |
1 file changed
, 1 insertion
(+)
1109 *** | |
diff --git a
/reach.t b
/reach.t
1110 *** | | new
file mode
100644
1111 *** | | index
0000000.
.10c9591
1112 *** | |
--- /dev
/null
1113 *** | |
+++ b
/reach.t
1114 *** | | @@
-0,0 +1 @@
1118 *** *-. \ commit COMMIT_OBJECT_NAME
1119 *** |\ \ \ Merge
: MERGE_PARENTS
1120 *** | | | | Author
: A U Thor
<author@example.com
>
1122 *** | | | | Merge HEADS DESCRIPTION
1124 *** | |
* | commit COMMIT_OBJECT_NAME
1125 *** | | |
/ Author
: A U Thor
<author@example.com
>
1129 *** | | | octopus-b.t |
1 +
1130 *** | | |
1 file changed
, 1 insertion
(+)
1132 *** | | |
diff --git a
/octopus-b.t b
/octopus-b.t
1133 *** | | | new
file mode
100644
1134 *** | | | index
0000000..d5fcad0
1135 *** | | |
--- /dev
/null
1136 *** | | |
+++ b
/octopus-b.t
1137 *** | | | @@
-0,0 +1 @@
1138 *** | | |
+octopus-b
1140 *** |
* | commit COMMIT_OBJECT_NAME
1141 *** | |
/ Author
: A U Thor
<author@example.com
>
1145 *** | | octopus-a.t |
1 +
1146 *** | |
1 file changed
, 1 insertion
(+)
1148 *** | |
diff --git a
/octopus-a.t b
/octopus-a.t
1149 *** | | new
file mode
100644
1150 *** | | index
0000000.
.11ee015
1151 *** | |
--- /dev
/null
1152 *** | |
+++ b
/octopus-a.t
1153 *** | | @@
-0,0 +1 @@
1156 *** * | commit COMMIT_OBJECT_NAME
1157 *** |
/ Author
: A U Thor
<author@example.com
>
1161 *** | seventh.t |
1 +
1162 *** |
1 file changed
, 1 insertion
(+)
1164 *** |
diff --git a
/seventh.t b
/seventh.t
1165 *** | new
file mode
100644
1166 *** | index
0000000.
.9744ffc
1168 *** |
+++ b
/seventh.t
1172 *** * commit COMMIT_OBJECT_NAME
1173 *** |\ Merge
: MERGE_PARENTS
1174 *** | | Author
: A U Thor
<author@example.com
>
1176 *** | | Merge branch
'tangle'
1178 *** |
* commit COMMIT_OBJECT_NAME
1179 *** | |\ Merge
: MERGE_PARENTS
1180 *** | | | Author
: A U Thor
<author@example.com
>
1182 *** | | | Merge branch
'side' (early part
) into tangle
1184 *** |
* | commit COMMIT_OBJECT_NAME
1185 *** | |\ \ Merge
: MERGE_PARENTS
1186 *** | | | | Author
: A U Thor
<author@example.com
>
1188 *** | | | | Merge branch
'master' (early part
) into tangle
1190 *** |
* | | commit COMMIT_OBJECT_NAME
1191 *** | | | | Author
: A U Thor
<author@example.com
>
1193 *** | | | | tangle-a
1195 *** | | | | tangle-a |
1 +
1196 *** | | | |
1 file changed
, 1 insertion
(+)
1198 *** | | | |
diff --git a
/tangle-a b
/tangle-a
1199 *** | | | | new
file mode
100644
1200 *** | | | | index
0000000.
.7898192
1201 *** | | | |
--- /dev
/null
1202 *** | | | |
+++ b
/tangle-a
1203 *** | | | | @@
-0,0 +1 @@
1206 *** * | | | commit COMMIT_OBJECT_NAME
1207 *** |\ \ \ \ Merge
: MERGE_PARENTS
1208 *** | | | | | Author
: A U Thor
<author@example.com
>
1210 *** | | | | | Merge branch
'side'
1212 *** |
* | | | commit COMMIT_OBJECT_NAME
1213 *** | | |_|
/ Author
: A U Thor
<author@example.com
>
1218 *** | | | |
1 file changed
, 1 insertion
(+)
1220 *** | | | |
diff --git a
/2 b
/2
1221 *** | | | | new
file mode
100644
1222 *** | | | | index
0000000.
.0cfbf08
1223 *** | | | |
--- /dev
/null
1225 *** | | | | @@
-0,0 +1 @@
1228 *** |
* | | commit COMMIT_OBJECT_NAME
1229 *** | | | | Author
: A U Thor
<author@example.com
>
1234 *** | | | |
1 file changed
, 1 insertion
(+)
1236 *** | | | |
diff --git a
/1 b
/1
1237 *** | | | | new
file mode
100644
1238 *** | | | | index
0000000..d00491f
1239 *** | | | |
--- /dev
/null
1241 *** | | | | @@
-0,0 +1 @@
1244 *** * | | | commit COMMIT_OBJECT_NAME
1245 *** | | | | Author
: A U Thor
<author@example.com
>
1249 *** | | | | one |
1 +
1250 *** | | | |
1 file changed
, 1 insertion
(+)
1252 *** | | | |
diff --git a
/one b
/one
1253 *** | | | | new
file mode
100644
1254 *** | | | | index
0000000.
.9a33383
1255 *** | | | |
--- /dev
/null
1256 *** | | | |
+++ b
/one
1257 *** | | | | @@
-0,0 +1 @@
1260 *** * | | | commit COMMIT_OBJECT_NAME
1261 *** | |_|
/ Author
: A U Thor
<author@example.com
>
1265 *** | | | a
/two |
1 -
1266 *** | | |
1 file changed
, 1 deletion
(-)
1268 *** | | |
diff --git a
/a
/two b
/a
/two
1269 *** | | | deleted
file mode
100644
1270 *** | | | index
9245af5.
.0000000
1271 *** | | |
--- a
/a
/two
1272 *** | | |
+++ /dev
/null
1273 *** | | | @@
-1 +0,0 @@
1276 *** * | | commit COMMIT_OBJECT_NAME
1277 *** | | | Author
: A U Thor
<author@example.com
>
1281 *** | | | a
/two |
1 +
1282 *** | | |
1 file changed
, 1 insertion
(+)
1284 *** | | |
diff --git a
/a
/two b
/a
/two
1285 *** | | | new
file mode
100644
1286 *** | | | index
0000000.
.9245af5
1287 *** | | |
--- /dev
/null
1288 *** | | |
+++ b
/a
/two
1289 *** | | | @@
-0,0 +1 @@
1292 *** * | | commit COMMIT_OBJECT_NAME
1293 *** |
/ / Author
: A U Thor
<author@example.com
>
1298 *** | |
1 file changed
, 1 insertion
(+)
1300 *** | |
diff --git a
/ein b
/ein
1301 *** | | new
file mode
100644
1302 *** | | index
0000000.
.9d7e69f
1303 *** | |
--- /dev
/null
1305 *** | | @@
-0,0 +1 @@
1308 *** * | commit COMMIT_OBJECT_NAME
1309 *** |
/ Author
: A U Thor
<author@example.com
>
1315 *** |
2 files changed
, 1 insertion
(+), 1 deletion
(-)
1317 *** |
diff --git a
/ichi b
/ichi
1318 *** | new
file mode
100644
1319 *** | index
0000000.
.9d7e69f
1324 *** |
diff --git a
/one b
/one
1325 *** | deleted
file mode
100644
1326 *** | index
9d7e69f.
.0000000
1332 *** * commit COMMIT_OBJECT_NAME
1333 *** | Author
: A U Thor
<author@example.com
>
1338 *** |
1 file changed
, 1 insertion
(+), 1 deletion
(-)
1340 *** |
diff --git a
/one b
/one
1341 *** | index
5626abf.
.9d7e69f
100644
1348 *** * commit COMMIT_OBJECT_NAME
1349 *** Author
: A U Thor
<author@example.com
>
1354 *** 1 file changed
, 1 insertion
(+)
1356 *** diff --git a
/one b
/one
1357 *** new
file mode
100644
1358 *** index
0000000.
.5626abf
1365 test_expect_success
'log --line-prefix="*** " --graph with diff and stats' '
1366 git log --line-prefix="*** " --no-renames --graph --pretty=short --stat -p >actual &&
1367 sanitize_output >actual.sanitized <actual &&
1368 test_i18ncmp expect actual.sanitized
1375 * Merge branch 'tangle'
1376 * Merge branch 'side'
1389 test_expect_success 'log --graph with --name-status' '
1390 git log --graph --format=%s --name-status tangle..reach >actual &&
1391 sanitize_output <actual >actual.sanitized &&
1392 test_cmp expect actual.sanitized
1399 * Merge branch 'tangle'
1400 * Merge branch 'side'
1413 test_expect_success 'log --graph with --name-only' '
1414 git log --graph --format=%s --name-only tangle..reach >actual &&
1415 sanitize_output <actual >actual.sanitized &&
1416 test_cmp expect actual.sanitized
1419 test_expect_success 'dotdot is a parent directory' '
1421 ( echo sixth && echo fifth ) >expect &&
1422 ( cd a/b && git log --format=%s .. ) >actual &&
1423 test_cmp expect actual
1426 test_expect_success GPG 'setup signed branch' '
1427 test_when_finished "git reset --hard && git checkout master" &&
1428 git checkout -b signed master &&
1431 git commit -S -m signed_commit
1434 test_expect_success GPG 'log --graph --show-signature' '
1435 git log --graph --show-signature -n1 signed >actual &&
1436 grep "^| gpg: Signature made" actual &&
1437 grep "^| gpg: Good signature" actual
1440 test_expect_success GPG 'log --graph --show-signature for merged tag' '
1441 test_when_finished "git reset --hard && git checkout master" &&
1442 git checkout -b plain master &&
1445 git commit -m bar_commit &&
1446 git checkout -b tagged master &&
1449 git commit -m baz_commit &&
1450 git tag -s -m signed_tag_msg signed_tag &&
1451 git checkout plain &&
1452 git merge --no-ff -m msg signed_tag &&
1453 git log --graph --show-signature -n1 plain >actual &&
1454 grep "^|\\\ merged tag" actual &&
1455 grep "^| | gpg: Signature made" actual &&
1456 grep "^| | gpg: Good signature" actual
1459 test_expect_success GPG '--no-show-signature overrides --show-signature' '
1460 git log -1 --show-signature --no-show-signature signed >actual &&
1461 ! grep "^gpg:" actual
1464 test_expect_success GPG 'log.showsignature=true behaves like --show-signature' '
1465 test_config log.showsignature true &&
1466 git log -1 signed >actual &&
1467 grep "gpg: Signature made" actual &&
1468 grep "gpg: Good signature" actual
1471 test_expect_success GPG '--no-show-signature overrides log.showsignature=true' '
1472 test_config log.showsignature true &&
1473 git log -1 --no-show-signature signed >actual &&
1474 ! grep "^gpg:" actual
1477 test_expect_success GPG '--show-signature overrides log.showsignature=false' '
1478 test_config log.showsignature false &&
1479 git log -1 --show-signature signed >actual &&
1480 grep "gpg: Signature made" actual &&
1481 grep "gpg: Good signature" actual
1484 test_expect_success 'log --graph --no-walk is forbidden' '
1485 test_must_fail git log --graph --no-walk
1488 test_expect_success 'log diagnoses bogus HEAD' '
1490 test_must_fail git -C empty log 2>stderr &&
1491 test_i18ngrep does.not.have.any.commits stderr &&
1492 echo 1234abcd >empty/.git/refs/heads/master &&
1493 test_must_fail git -C empty log 2>stderr &&
1494 test_i18ngrep broken stderr &&
1495 echo "ref: refs/heads/invalid.lock" >empty/.git/HEAD &&
1496 test_must_fail git -C empty log 2>stderr &&
1497 test_i18ngrep broken stderr &&
1498 test_must_fail git -C empty log --default totally-bogus 2>stderr &&
1499 test_i18ngrep broken stderr
1502 test_expect_success 'set up --source tests' '
1503 git checkout --orphan source-a &&
1506 git checkout -b source-b HEAD^ &&
1510 test_expect_success 'log --source paints branch names' '
1511 cat >expect <<-\EOF &&
1512 09e12a9 source-b three
1513 8e393e1 source-a two
1514 1ac6c77 source-b one
1516 git log --oneline --source source-a source-b >actual &&
1517 test_cmp expect actual
1520 test_expect_success 'log --source paints tag names' '
1521 git tag -m tagged source-tag &&
1522 cat >expect <<-\EOF &&
1523 09e12a9 source-tag three
1524 8e393e1 source-a two
1525 1ac6c77 source-tag one
1527 git log --oneline --source source-tag source-a >actual &&
1528 test_cmp expect actual