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 if test_have_prereq PCRE
409 git log --pretty=tformat:%s -P \
410 --grep="[\d]\|" >actual.perl.short-arg
412 test_must_fail git log -P \
415 test_cmp expect.fixed actual.fixed.short-arg &&
416 test_cmp expect.extended actual.extended.short-arg &&
417 if test_have_prereq PCRE
419 test_cmp expect.perl actual.perl.short-arg
422 git log --pretty=tformat:%s --fixed-strings \
423 --grep="(1|2)" >actual.fixed.long-arg &&
424 git log --pretty=tformat:%s --basic-regexp \
425 --grep="(.|.)" >actual.basic.long-arg &&
426 git log --pretty=tformat:%s --extended-regexp \
427 --grep="\|2" >actual.extended.long-arg &&
428 if test_have_prereq PCRE
430 git log --pretty=tformat:%s --perl-regexp \
431 --grep="[\d]\|" >actual.perl.long-arg &&
432 test_cmp expect.perl actual.perl.long-arg
434 test_must_fail git log --perl-regexp \
437 test_cmp expect.fixed actual.fixed.long-arg &&
438 test_cmp expect.basic actual.basic.long-arg &&
439 test_cmp expect.extended actual.extended.long-arg
453 test_expect_success
'simple log --graph' '
454 git log --graph --pretty=tformat:%s >actual &&
455 test_cmp expect actual
468 test_expect_success
'simple log --graph --line-prefix="123 "' '
469 git log --graph --line-prefix="123 " --pretty=tformat:%s >actual &&
470 test_cmp expect actual
473 test_expect_success
'set up merge history' '
474 git checkout -b side HEAD~4 &&
475 test_commit side-1 1 1 &&
476 test_commit side-2 2 2 &&
477 git checkout master &&
482 * Merge branch
'side'
496 test_expect_success
'log --graph with merge' '
497 git log --graph --date-order --pretty=tformat:%s |
498 sed "s/ *\$//" >actual &&
499 test_cmp expect actual
503 | | |
* Merge branch
'side'
517 test_expect_success
'log --graph --line-prefix="| | | " with merge' '
518 git log --line-prefix="| | | " --graph --date-order --pretty=tformat:%s |
519 sed "s/ *\$//" >actual &&
520 test_cmp expect actual
523 cat > expect.colors
<<\EOF
524 * Merge branch
'side'
525 <BLUE
>|
<RESET
><CYAN
>\
<RESET
>
526 <BLUE
>|
<RESET
> * side-2
527 <BLUE
>|
<RESET
> * side-1
528 * <CYAN
>|
<RESET
> Second
529 * <CYAN
>|
<RESET
> sixth
530 * <CYAN
>|
<RESET
> fifth
531 * <CYAN
>|
<RESET
> fourth
532 <CYAN
>|
<RESET
><CYAN
>/<RESET
>
538 test_expect_success
'log --graph with merge with log.graphColors' '
539 test_config log.graphColors " blue,invalid-color, cyan, red , " &&
540 git log --color=always --graph --date-order --pretty=tformat:%s |
541 test_decode_color | sed "s/ *\$//" >actual &&
542 test_cmp expect.colors actual
545 test_expect_success
'log --raw --graph -m with merge' '
546 git log --raw --graph --oneline -m master | head -n 500 >actual &&
547 grep "initial" actual
550 test_expect_success
'diff-tree --graph' '
551 git diff-tree --graph master^ | head -n 500 >actual &&
558 | | Author
: A U Thor
<author@example.com
>
560 | | Merge branch
'side'
563 | | Author
: A U Thor
<author@example.com
>
567 |
* commit tags
/side-1
568 | | Author
: A U Thor
<author@example.com
>
573 | | Author
: A U Thor
<author@example.com
>
578 | | Author
: A U Thor
<author@example.com
>
583 | | Author
: A U Thor
<author@example.com
>
588 |
/ Author
: A U Thor
<author@example.com
>
592 * commit tags
/side-1~
1
593 | Author
: A U Thor
<author@example.com
>
597 * commit tags
/side-1~
2
598 | Author
: A U Thor
<author@example.com
>
602 * commit tags
/side-1~
3
603 Author
: A U Thor
<author@example.com
>
608 test_expect_success
'log --graph with full output' '
609 git log --graph --date-order --pretty=short |
610 git name-rev --name-only --stdin |
611 sed "s/Merge:.*/Merge: A B/;s/ *\$//" >actual &&
612 test_cmp expect actual
615 test_expect_success
'set up more tangled history' '
616 git checkout -b tangle HEAD~6 &&
617 test_commit tangle-a tangle-a a &&
618 git merge master~3 &&
620 git checkout master &&
622 git checkout -b reach &&
624 git checkout master &&
625 git checkout -b octopus-a &&
626 test_commit octopus-a &&
627 git checkout master &&
628 git checkout -b octopus-b &&
629 test_commit octopus-b &&
630 git checkout master &&
631 test_commit seventh &&
632 git merge octopus-a octopus-b &&
641 *-. \ Merge tags
'octopus-a' and
'octopus-b'
651 * Merge branch
'tangle'
653 |
* Merge branch
'side' (early part
) into tangle
655 |
* \ Merge branch
'master' (early part
) into tangle
658 * | | | Merge branch
'side'
677 test_expect_success
'log --graph with merge' '
678 git log --graph --date-order --pretty=tformat:%s |
679 sed "s/ *\$//" >actual &&
680 test_cmp expect actual
683 test_expect_success
'log.decorate configuration' '
684 git log --oneline --no-decorate >expect.none &&
685 git log --oneline --decorate >expect.short &&
686 git log --oneline --decorate=full >expect.full &&
688 echo "[log] decorate" >>.git/config &&
689 git log --oneline >actual &&
690 test_cmp expect.short actual &&
692 test_config log.decorate true &&
693 git log --oneline >actual &&
694 test_cmp expect.short actual &&
695 git log --oneline --decorate=full >actual &&
696 test_cmp expect.full actual &&
697 git log --oneline --decorate=no >actual &&
698 test_cmp expect.none actual &&
700 test_config log.decorate no &&
701 git log --oneline >actual &&
702 test_cmp expect.none actual &&
703 git log --oneline --decorate >actual &&
704 test_cmp expect.short actual &&
705 git log --oneline --decorate=full >actual &&
706 test_cmp expect.full actual &&
708 test_config log.decorate 1 &&
709 git log --oneline >actual &&
710 test_cmp expect.short actual &&
711 git log --oneline --decorate=full >actual &&
712 test_cmp expect.full actual &&
713 git log --oneline --decorate=no >actual &&
714 test_cmp expect.none actual &&
716 test_config log.decorate short &&
717 git log --oneline >actual &&
718 test_cmp expect.short actual &&
719 git log --oneline --no-decorate >actual &&
720 test_cmp expect.none actual &&
721 git log --oneline --decorate=full >actual &&
722 test_cmp expect.full actual &&
724 test_config log.decorate full &&
725 git log --oneline >actual &&
726 test_cmp expect.full actual &&
727 git log --oneline --no-decorate >actual &&
728 test_cmp expect.none actual &&
729 git log --oneline --decorate >actual &&
730 test_cmp expect.short actual &&
732 test_unconfig log.decorate &&
733 git log --pretty=raw >expect.raw &&
734 test_config log.decorate full &&
735 git log --pretty=raw >actual &&
736 test_cmp expect.raw actual
740 test_expect_success TTY
'log output on a TTY' '
741 git log --oneline --decorate >expect.short &&
743 test_terminal git log --oneline >actual &&
744 test_cmp expect.short actual
747 test_expect_success
'reflog is expected format' '
748 git log -g --abbrev-commit --pretty=oneline >expect &&
749 git reflog >actual &&
750 test_cmp expect actual
753 test_expect_success
'whatchanged is expected format' '
754 git log --no-merges --raw >expect &&
755 git whatchanged >actual &&
756 test_cmp expect actual
759 test_expect_success
'log.abbrevCommit configuration' '
760 git log --abbrev-commit >expect.log.abbrev &&
761 git log --no-abbrev-commit >expect.log.full &&
762 git log --pretty=raw >expect.log.raw &&
763 git reflog --abbrev-commit >expect.reflog.abbrev &&
764 git reflog --no-abbrev-commit >expect.reflog.full &&
765 git whatchanged --abbrev-commit >expect.whatchanged.abbrev &&
766 git whatchanged --no-abbrev-commit >expect.whatchanged.full &&
768 test_config log.abbrevCommit true &&
771 test_cmp expect.log.abbrev actual &&
772 git log --no-abbrev-commit >actual &&
773 test_cmp expect.log.full actual &&
775 git log --pretty=raw >actual &&
776 test_cmp expect.log.raw actual &&
778 git reflog >actual &&
779 test_cmp expect.reflog.abbrev actual &&
780 git reflog --no-abbrev-commit >actual &&
781 test_cmp expect.reflog.full actual &&
783 git whatchanged >actual &&
784 test_cmp expect.whatchanged.abbrev actual &&
785 git whatchanged --no-abbrev-commit >actual &&
786 test_cmp expect.whatchanged.full actual
789 test_expect_success
'show added path under "--follow -M"' '
790 # This tests for a regression introduced in v1.7.2-rc0~103^2~2
791 test_create_repo regression &&
794 test_commit needs-another-commit &&
795 test_commit foo.bar &&
796 git log -M --follow -p foo.bar.t &&
797 git log -M --follow --stat foo.bar.t &&
798 git log -M --follow --name-only foo.bar.t
802 test_expect_success
'git log -c --follow' '
803 test_create_repo follow-c &&
806 test_commit initial file original &&
808 test_commit rename file2 original &&
809 git reset --hard initial &&
810 test_commit modify file foo &&
811 git merge -m merge rename &&
812 git log -c --follow file2
817 * commit COMMIT_OBJECT_NAME
818 |\ Merge
: MERGE_PARENTS
819 | | Author
: A U Thor
<author@example.com
>
821 | | Merge HEADS DESCRIPTION
823 |
* commit COMMIT_OBJECT_NAME
824 | | Author
: A U Thor
<author@example.com
>
829 | |
1 file changed
, 1 insertion
(+)
831 | |
diff --git a
/reach.t b
/reach.t
832 | | new
file mode
100644
833 | | index
0000000.
.10c9591
840 *-. \ commit COMMIT_OBJECT_NAME
841 |\ \ \ Merge
: MERGE_PARENTS
842 | | | | Author
: A U Thor
<author@example.com
>
844 | | | | Merge HEADS DESCRIPTION
846 | |
* | commit COMMIT_OBJECT_NAME
847 | | |
/ Author
: A U Thor
<author@example.com
>
851 | | | octopus-b.t |
1 +
852 | | |
1 file changed
, 1 insertion
(+)
854 | | |
diff --git a
/octopus-b.t b
/octopus-b.t
855 | | | new
file mode
100644
856 | | | index
0000000..d5fcad0
858 | | |
+++ b
/octopus-b.t
862 |
* | commit COMMIT_OBJECT_NAME
863 | |
/ Author
: A U Thor
<author@example.com
>
867 | | octopus-a.t |
1 +
868 | |
1 file changed
, 1 insertion
(+)
870 | |
diff --git a
/octopus-a.t b
/octopus-a.t
871 | | new
file mode
100644
872 | | index
0000000.
.11ee015
874 | |
+++ b
/octopus-a.t
878 * | commit COMMIT_OBJECT_NAME
879 |
/ Author
: A U Thor
<author@example.com
>
884 |
1 file changed
, 1 insertion
(+)
886 |
diff --git a
/seventh.t b
/seventh.t
887 | new
file mode
100644
888 | index
0000000.
.9744ffc
894 * commit COMMIT_OBJECT_NAME
895 |\ Merge
: MERGE_PARENTS
896 | | Author
: A U Thor
<author@example.com
>
898 | | Merge branch
'tangle'
900 |
* commit COMMIT_OBJECT_NAME
901 | |\ Merge
: MERGE_PARENTS
902 | | | Author
: A U Thor
<author@example.com
>
904 | | | Merge branch
'side' (early part
) into tangle
906 |
* | commit COMMIT_OBJECT_NAME
907 | |\ \ Merge
: MERGE_PARENTS
908 | | | | Author
: A U Thor
<author@example.com
>
910 | | | | Merge branch
'master' (early part
) into tangle
912 |
* | | commit COMMIT_OBJECT_NAME
913 | | | | Author
: A U Thor
<author@example.com
>
917 | | | | tangle-a |
1 +
918 | | | |
1 file changed
, 1 insertion
(+)
920 | | | |
diff --git a
/tangle-a b
/tangle-a
921 | | | | new
file mode
100644
922 | | | | index
0000000.
.7898192
923 | | | |
--- /dev
/null
924 | | | |
+++ b
/tangle-a
925 | | | | @@
-0,0 +1 @@
928 * | | | commit COMMIT_OBJECT_NAME
929 |\ \ \ \ Merge
: MERGE_PARENTS
930 | | | | | Author
: A U Thor
<author@example.com
>
932 | | | | | Merge branch
'side'
934 |
* | | | commit COMMIT_OBJECT_NAME
935 | | |_|
/ Author
: A U Thor
<author@example.com
>
940 | | | |
1 file changed
, 1 insertion
(+)
942 | | | |
diff --git a
/2 b
/2
943 | | | | new
file mode
100644
944 | | | | index
0000000.
.0cfbf08
945 | | | |
--- /dev
/null
947 | | | | @@
-0,0 +1 @@
950 |
* | | commit COMMIT_OBJECT_NAME
951 | | | | Author
: A U Thor
<author@example.com
>
956 | | | |
1 file changed
, 1 insertion
(+)
958 | | | |
diff --git a
/1 b
/1
959 | | | | new
file mode
100644
960 | | | | index
0000000..d00491f
961 | | | |
--- /dev
/null
963 | | | | @@
-0,0 +1 @@
966 * | | | commit COMMIT_OBJECT_NAME
967 | | | | Author
: A U Thor
<author@example.com
>
972 | | | |
1 file changed
, 1 insertion
(+)
974 | | | |
diff --git a
/one b
/one
975 | | | | new
file mode
100644
976 | | | | index
0000000.
.9a33383
977 | | | |
--- /dev
/null
979 | | | | @@
-0,0 +1 @@
982 * | | | commit COMMIT_OBJECT_NAME
983 | |_|
/ Author
: A U Thor
<author@example.com
>
988 | | |
1 file changed
, 1 deletion
(-)
990 | | |
diff --git a
/a
/two b
/a
/two
991 | | | deleted
file mode
100644
992 | | | index
9245af5.
.0000000
998 * | | commit COMMIT_OBJECT_NAME
999 | | | Author
: A U Thor
<author@example.com
>
1004 | | |
1 file changed
, 1 insertion
(+)
1006 | | |
diff --git a
/a
/two b
/a
/two
1007 | | | new
file mode
100644
1008 | | | index
0000000.
.9245af5
1014 * | | commit COMMIT_OBJECT_NAME
1015 |
/ / Author
: A U Thor
<author@example.com
>
1020 | |
1 file changed
, 1 insertion
(+)
1022 | |
diff --git a
/ein b
/ein
1023 | | new
file mode
100644
1024 | | index
0000000.
.9d7e69f
1030 * | commit COMMIT_OBJECT_NAME
1031 |
/ Author
: A U Thor
<author@example.com
>
1037 |
2 files changed
, 1 insertion
(+), 1 deletion
(-)
1039 |
diff --git a
/ichi b
/ichi
1040 | new
file mode
100644
1041 | index
0000000.
.9d7e69f
1046 |
diff --git a
/one b
/one
1047 | deleted
file mode
100644
1048 | index
9d7e69f.
.0000000
1054 * commit COMMIT_OBJECT_NAME
1055 | Author
: A U Thor
<author@example.com
>
1060 |
1 file changed
, 1 insertion
(+), 1 deletion
(-)
1062 |
diff --git a
/one b
/one
1063 | index
5626abf.
.9d7e69f
100644
1070 * commit COMMIT_OBJECT_NAME
1071 Author
: A U Thor
<author@example.com
>
1076 1 file changed
, 1 insertion
(+)
1078 diff --git a
/one b
/one
1079 new
file mode
100644
1080 index
0000000.
.5626abf
1087 sanitize_output
() {
1089 -e 's/commit [0-9a-f]*$/commit COMMIT_OBJECT_NAME/' \
1090 -e 's/Merge: [ 0-9a-f]*$/Merge: MERGE_PARENTS/' \
1091 -e 's/Merge tag.*/Merge HEADS DESCRIPTION/' \
1092 -e 's/Merge commit.*/Merge HEADS DESCRIPTION/' \
1093 -e 's/, 0 deletions(-)//' \
1094 -e 's/, 0 insertions(+)//' \
1095 -e 's/ 1 files changed, / 1 file changed, /' \
1096 -e 's/, 1 deletions(-)/, 1 deletion(-)/' \
1097 -e 's/, 1 insertions(+)/, 1 insertion(+)/'
1100 test_expect_success
'log --graph with diff and stats' '
1101 git log --no-renames --graph --pretty=short --stat -p >actual &&
1102 sanitize_output >actual.sanitized <actual &&
1103 test_i18ncmp expect actual.sanitized
1107 *** * commit COMMIT_OBJECT_NAME
1108 *** |\ Merge
: MERGE_PARENTS
1109 *** | | Author
: A U Thor
<author@example.com
>
1111 *** | | Merge HEADS DESCRIPTION
1113 *** |
* commit COMMIT_OBJECT_NAME
1114 *** | | Author
: A U Thor
<author@example.com
>
1118 *** | | reach.t |
1 +
1119 *** | |
1 file changed
, 1 insertion
(+)
1121 *** | |
diff --git a
/reach.t b
/reach.t
1122 *** | | new
file mode
100644
1123 *** | | index
0000000.
.10c9591
1124 *** | |
--- /dev
/null
1125 *** | |
+++ b
/reach.t
1126 *** | | @@
-0,0 +1 @@
1130 *** *-. \ commit COMMIT_OBJECT_NAME
1131 *** |\ \ \ Merge
: MERGE_PARENTS
1132 *** | | | | Author
: A U Thor
<author@example.com
>
1134 *** | | | | Merge HEADS DESCRIPTION
1136 *** | |
* | commit COMMIT_OBJECT_NAME
1137 *** | | |
/ Author
: A U Thor
<author@example.com
>
1141 *** | | | octopus-b.t |
1 +
1142 *** | | |
1 file changed
, 1 insertion
(+)
1144 *** | | |
diff --git a
/octopus-b.t b
/octopus-b.t
1145 *** | | | new
file mode
100644
1146 *** | | | index
0000000..d5fcad0
1147 *** | | |
--- /dev
/null
1148 *** | | |
+++ b
/octopus-b.t
1149 *** | | | @@
-0,0 +1 @@
1150 *** | | |
+octopus-b
1152 *** |
* | commit COMMIT_OBJECT_NAME
1153 *** | |
/ Author
: A U Thor
<author@example.com
>
1157 *** | | octopus-a.t |
1 +
1158 *** | |
1 file changed
, 1 insertion
(+)
1160 *** | |
diff --git a
/octopus-a.t b
/octopus-a.t
1161 *** | | new
file mode
100644
1162 *** | | index
0000000.
.11ee015
1163 *** | |
--- /dev
/null
1164 *** | |
+++ b
/octopus-a.t
1165 *** | | @@
-0,0 +1 @@
1168 *** * | commit COMMIT_OBJECT_NAME
1169 *** |
/ Author
: A U Thor
<author@example.com
>
1173 *** | seventh.t |
1 +
1174 *** |
1 file changed
, 1 insertion
(+)
1176 *** |
diff --git a
/seventh.t b
/seventh.t
1177 *** | new
file mode
100644
1178 *** | index
0000000.
.9744ffc
1180 *** |
+++ b
/seventh.t
1184 *** * commit COMMIT_OBJECT_NAME
1185 *** |\ Merge
: MERGE_PARENTS
1186 *** | | Author
: A U Thor
<author@example.com
>
1188 *** | | Merge branch
'tangle'
1190 *** |
* commit COMMIT_OBJECT_NAME
1191 *** | |\ Merge
: MERGE_PARENTS
1192 *** | | | Author
: A U Thor
<author@example.com
>
1194 *** | | | Merge branch
'side' (early part
) into tangle
1196 *** |
* | commit COMMIT_OBJECT_NAME
1197 *** | |\ \ Merge
: MERGE_PARENTS
1198 *** | | | | Author
: A U Thor
<author@example.com
>
1200 *** | | | | Merge branch
'master' (early part
) into tangle
1202 *** |
* | | commit COMMIT_OBJECT_NAME
1203 *** | | | | Author
: A U Thor
<author@example.com
>
1205 *** | | | | tangle-a
1207 *** | | | | tangle-a |
1 +
1208 *** | | | |
1 file changed
, 1 insertion
(+)
1210 *** | | | |
diff --git a
/tangle-a b
/tangle-a
1211 *** | | | | new
file mode
100644
1212 *** | | | | index
0000000.
.7898192
1213 *** | | | |
--- /dev
/null
1214 *** | | | |
+++ b
/tangle-a
1215 *** | | | | @@
-0,0 +1 @@
1218 *** * | | | commit COMMIT_OBJECT_NAME
1219 *** |\ \ \ \ Merge
: MERGE_PARENTS
1220 *** | | | | | Author
: A U Thor
<author@example.com
>
1222 *** | | | | | Merge branch
'side'
1224 *** |
* | | | commit COMMIT_OBJECT_NAME
1225 *** | | |_|
/ Author
: A U Thor
<author@example.com
>
1230 *** | | | |
1 file changed
, 1 insertion
(+)
1232 *** | | | |
diff --git a
/2 b
/2
1233 *** | | | | new
file mode
100644
1234 *** | | | | index
0000000.
.0cfbf08
1235 *** | | | |
--- /dev
/null
1237 *** | | | | @@
-0,0 +1 @@
1240 *** |
* | | commit COMMIT_OBJECT_NAME
1241 *** | | | | Author
: A U Thor
<author@example.com
>
1246 *** | | | |
1 file changed
, 1 insertion
(+)
1248 *** | | | |
diff --git a
/1 b
/1
1249 *** | | | | new
file mode
100644
1250 *** | | | | index
0000000..d00491f
1251 *** | | | |
--- /dev
/null
1253 *** | | | | @@
-0,0 +1 @@
1256 *** * | | | commit COMMIT_OBJECT_NAME
1257 *** | | | | Author
: A U Thor
<author@example.com
>
1261 *** | | | | one |
1 +
1262 *** | | | |
1 file changed
, 1 insertion
(+)
1264 *** | | | |
diff --git a
/one b
/one
1265 *** | | | | new
file mode
100644
1266 *** | | | | index
0000000.
.9a33383
1267 *** | | | |
--- /dev
/null
1268 *** | | | |
+++ b
/one
1269 *** | | | | @@
-0,0 +1 @@
1272 *** * | | | commit COMMIT_OBJECT_NAME
1273 *** | |_|
/ Author
: A U Thor
<author@example.com
>
1277 *** | | | a
/two |
1 -
1278 *** | | |
1 file changed
, 1 deletion
(-)
1280 *** | | |
diff --git a
/a
/two b
/a
/two
1281 *** | | | deleted
file mode
100644
1282 *** | | | index
9245af5.
.0000000
1283 *** | | |
--- a
/a
/two
1284 *** | | |
+++ /dev
/null
1285 *** | | | @@
-1 +0,0 @@
1288 *** * | | commit COMMIT_OBJECT_NAME
1289 *** | | | Author
: A U Thor
<author@example.com
>
1293 *** | | | a
/two |
1 +
1294 *** | | |
1 file changed
, 1 insertion
(+)
1296 *** | | |
diff --git a
/a
/two b
/a
/two
1297 *** | | | new
file mode
100644
1298 *** | | | index
0000000.
.9245af5
1299 *** | | |
--- /dev
/null
1300 *** | | |
+++ b
/a
/two
1301 *** | | | @@
-0,0 +1 @@
1304 *** * | | commit COMMIT_OBJECT_NAME
1305 *** |
/ / Author
: A U Thor
<author@example.com
>
1310 *** | |
1 file changed
, 1 insertion
(+)
1312 *** | |
diff --git a
/ein b
/ein
1313 *** | | new
file mode
100644
1314 *** | | index
0000000.
.9d7e69f
1315 *** | |
--- /dev
/null
1317 *** | | @@
-0,0 +1 @@
1320 *** * | commit COMMIT_OBJECT_NAME
1321 *** |
/ Author
: A U Thor
<author@example.com
>
1327 *** |
2 files changed
, 1 insertion
(+), 1 deletion
(-)
1329 *** |
diff --git a
/ichi b
/ichi
1330 *** | new
file mode
100644
1331 *** | index
0000000.
.9d7e69f
1336 *** |
diff --git a
/one b
/one
1337 *** | deleted
file mode
100644
1338 *** | index
9d7e69f.
.0000000
1344 *** * commit COMMIT_OBJECT_NAME
1345 *** | Author
: A U Thor
<author@example.com
>
1350 *** |
1 file changed
, 1 insertion
(+), 1 deletion
(-)
1352 *** |
diff --git a
/one b
/one
1353 *** | index
5626abf.
.9d7e69f
100644
1360 *** * commit COMMIT_OBJECT_NAME
1361 *** Author
: A U Thor
<author@example.com
>
1366 *** 1 file changed
, 1 insertion
(+)
1368 *** diff --git a
/one b
/one
1369 *** new
file mode
100644
1370 *** index
0000000.
.5626abf
1377 test_expect_success
'log --line-prefix="*** " --graph with diff and stats' '
1378 git log --line-prefix="*** " --no-renames --graph --pretty=short --stat -p >actual &&
1379 sanitize_output >actual.sanitized <actual &&
1380 test_i18ncmp expect actual.sanitized
1387 * Merge branch 'tangle'
1388 * Merge branch 'side'
1401 test_expect_success 'log --graph with --name-status' '
1402 git log --graph --format=%s --name-status tangle..reach >actual &&
1403 sanitize_output <actual >actual.sanitized &&
1404 test_cmp expect actual.sanitized
1411 * Merge branch 'tangle'
1412 * Merge branch 'side'
1425 test_expect_success 'log --graph with --name-only' '
1426 git log --graph --format=%s --name-only tangle..reach >actual &&
1427 sanitize_output <actual >actual.sanitized &&
1428 test_cmp expect actual.sanitized
1431 test_expect_success 'dotdot is a parent directory' '
1433 ( echo sixth && echo fifth ) >expect &&
1434 ( cd a/b && git log --format=%s .. ) >actual &&
1435 test_cmp expect actual
1438 test_expect_success GPG 'setup signed branch' '
1439 test_when_finished "git reset --hard && git checkout master" &&
1440 git checkout -b signed master &&
1443 git commit -S -m signed_commit
1446 test_expect_success GPG 'log --graph --show-signature' '
1447 git log --graph --show-signature -n1 signed >actual &&
1448 grep "^| gpg: Signature made" actual &&
1449 grep "^| gpg: Good signature" actual
1452 test_expect_success GPG 'log --graph --show-signature for merged tag' '
1453 test_when_finished "git reset --hard && git checkout master" &&
1454 git checkout -b plain master &&
1457 git commit -m bar_commit &&
1458 git checkout -b tagged master &&
1461 git commit -m baz_commit &&
1462 git tag -s -m signed_tag_msg signed_tag &&
1463 git checkout plain &&
1464 git merge --no-ff -m msg signed_tag &&
1465 git log --graph --show-signature -n1 plain >actual &&
1466 grep "^|\\\ merged tag" actual &&
1467 grep "^| | gpg: Signature made" actual &&
1468 grep "^| | gpg: Good signature" actual
1471 test_expect_success GPG '--no-show-signature overrides --show-signature' '
1472 git log -1 --show-signature --no-show-signature signed >actual &&
1473 ! grep "^gpg:" actual
1476 test_expect_success GPG 'log.showsignature=true behaves like --show-signature' '
1477 test_config log.showsignature true &&
1478 git log -1 signed >actual &&
1479 grep "gpg: Signature made" actual &&
1480 grep "gpg: Good signature" actual
1483 test_expect_success GPG '--no-show-signature overrides log.showsignature=true' '
1484 test_config log.showsignature true &&
1485 git log -1 --no-show-signature signed >actual &&
1486 ! grep "^gpg:" actual
1489 test_expect_success GPG '--show-signature overrides log.showsignature=false' '
1490 test_config log.showsignature false &&
1491 git log -1 --show-signature signed >actual &&
1492 grep "gpg: Signature made" actual &&
1493 grep "gpg: Good signature" actual
1496 test_expect_success 'log --graph --no-walk is forbidden' '
1497 test_must_fail git log --graph --no-walk
1500 test_expect_success 'log diagnoses bogus HEAD' '
1502 test_must_fail git -C empty log 2>stderr &&
1503 test_i18ngrep does.not.have.any.commits stderr &&
1504 echo 1234abcd >empty/.git/refs/heads/master &&
1505 test_must_fail git -C empty log 2>stderr &&
1506 test_i18ngrep broken stderr &&
1507 echo "ref: refs/heads/invalid.lock" >empty/.git/HEAD &&
1508 test_must_fail git -C empty log 2>stderr &&
1509 test_i18ngrep broken stderr &&
1510 test_must_fail git -C empty log --default totally-bogus 2>stderr &&
1511 test_i18ngrep broken stderr
1514 test_expect_success 'set up --source tests' '
1515 git checkout --orphan source-a &&
1518 git checkout -b source-b HEAD^ &&
1522 test_expect_success 'log --source paints branch names' '
1523 cat >expect <<-\EOF &&
1524 09e12a9 source-b three
1525 8e393e1 source-a two
1526 1ac6c77 source-b one
1528 git log --oneline --source source-a source-b >actual &&
1529 test_cmp expect actual
1532 test_expect_success 'log --source paints tag names' '
1533 git tag -m tagged source-tag &&
1534 cat >expect <<-\EOF &&
1535 09e12a9 source-tag three
1536 8e393e1 source-a two
1537 1ac6c77 source-tag one
1539 git log --oneline --source source-tag source-a >actual &&
1540 test_cmp expect actual