]> git.ipfire.org Git - thirdparty/git.git/blame - t/t4202-log.sh
dir.c: unify is_excluded and is_path_excluded APIs
[thirdparty/git.git] / t / t4202-log.sh
CommitLineData
0faf2da7
AL
1#!/bin/sh
2
3test_description='git log'
4
5. ./test-lib.sh
6
7test_expect_success setup '
8
9 echo one >one &&
10 git add one &&
11 test_tick &&
12 git commit -m initial &&
13
14 echo ichi >one &&
15 git add one &&
16 test_tick &&
17 git commit -m second &&
18
d9305089 19 git mv one ichi &&
0faf2da7
AL
20 test_tick &&
21 git commit -m third &&
22
d9305089
AL
23 cp ichi ein &&
24 git add ein &&
0faf2da7
AL
25 test_tick &&
26 git commit -m fourth &&
27
d9305089
AL
28 mkdir a &&
29 echo ni >a/two &&
30 git add a/two &&
31 test_tick &&
32 git commit -m fifth &&
33
34 git rm a/two &&
0faf2da7 35 test_tick &&
d9305089 36 git commit -m sixth
0faf2da7
AL
37
38'
39
bb93afd5
FC
40printf "sixth\nfifth\nfourth\nthird\nsecond\ninitial" > expect
41test_expect_success 'pretty' '
42
43 git log --pretty="format:%s" > actual &&
44 test_cmp expect actual
45'
46
47printf "sixth\nfifth\nfourth\nthird\nsecond\ninitial\n" > expect
48test_expect_success 'pretty (tformat)' '
49
50 git log --pretty="tformat:%s" > actual &&
51 test_cmp expect actual
52'
53
54test_expect_success 'pretty (shortcut)' '
55
56 git log --pretty="%s" > actual &&
57 test_cmp expect actual
58'
59
60test_expect_success 'format' '
61
62 git log --format="%s" > actual &&
63 test_cmp expect actual
64'
65
37bb5d74
RS
66cat > expect << EOF
67 This is
68 the sixth
69 commit.
70 This is
71 the fifth
72 commit.
73EOF
74
14e1a4e1 75test_expect_success 'format %w(11,1,2)' '
37bb5d74 76
14e1a4e1 77 git log -2 --format="%w(11,1,2)This is the %s commit." > actual &&
37bb5d74
RS
78 test_cmp expect actual
79'
80
81test_expect_success 'format %w(,1,2)' '
82
83 git log -2 --format="%w(,1,2)This is%nthe %s%ncommit." > actual &&
84 test_cmp expect actual
85'
86
bb93afd5
FC
87cat > expect << EOF
88804a787 sixth
89394ef78 fifth
905d31159 fourth
912fbe8c0 third
92f7dab8e second
933a2fdcb initial
94EOF
95test_expect_success 'oneline' '
96
97 git log --oneline > actual &&
98 test_cmp expect actual
99'
100
0faf2da7
AL
101test_expect_success 'diff-filter=A' '
102
dea007fb
MM
103 git log --pretty="format:%s" --diff-filter=A HEAD > actual &&
104 git log --pretty="format:%s" --diff-filter A HEAD > actual-separate &&
105 printf "fifth\nfourth\nthird\ninitial" > expect &&
106 test_cmp expect actual &&
107 test_cmp expect actual-separate
0faf2da7
AL
108
109'
110
111test_expect_success 'diff-filter=M' '
112
113 actual=$(git log --pretty="format:%s" --diff-filter=M HEAD) &&
114 expect=$(echo second) &&
115 test "$actual" = "$expect" || {
116 echo Oops
117 echo "Actual: $actual"
118 false
119 }
120
121'
122
123test_expect_success 'diff-filter=D' '
124
125 actual=$(git log --pretty="format:%s" --diff-filter=D HEAD) &&
d9305089
AL
126 expect=$(echo sixth ; echo third) &&
127 test "$actual" = "$expect" || {
128 echo Oops
129 echo "Actual: $actual"
130 false
131 }
132
133'
134
135test_expect_success 'diff-filter=R' '
136
137 actual=$(git log -M --pretty="format:%s" --diff-filter=R HEAD) &&
138 expect=$(echo third) &&
139 test "$actual" = "$expect" || {
140 echo Oops
141 echo "Actual: $actual"
142 false
143 }
144
145'
146
147test_expect_success 'diff-filter=C' '
148
149 actual=$(git log -C -C --pretty="format:%s" --diff-filter=C HEAD) &&
150 expect=$(echo fourth) &&
151 test "$actual" = "$expect" || {
152 echo Oops
153 echo "Actual: $actual"
154 false
155 }
156
157'
158
159test_expect_success 'git log --follow' '
160
161 actual=$(git log --follow --pretty="format:%s" ichi) &&
162 expect=$(echo third ; echo second ; echo initial) &&
0faf2da7
AL
163 test "$actual" = "$expect" || {
164 echo Oops
165 echo "Actual: $actual"
166 false
167 }
168
169'
170
d5cee0f7
MG
171cat > expect << EOF
172804a787 sixth
173394ef78 fifth
1745d31159 fourth
175EOF
176test_expect_success 'git log --no-walk <commits> sorts by commit time' '
177 git log --no-walk --oneline 5d31159 804a787 394ef78 > actual &&
178 test_cmp expect actual
179'
180
ca92e59e
MZ
181test_expect_success 'git log --no-walk=sorted <commits> sorts by commit time' '
182 git log --no-walk=sorted --oneline 5d31159 804a787 394ef78 > actual &&
183 test_cmp expect actual
184'
185
d5cee0f7
MG
186cat > expect << EOF
1875d31159 fourth
188804a787 sixth
189394ef78 fifth
190EOF
ca92e59e
MZ
191test_expect_success 'git log --no-walk=unsorted <commits> leaves list of commits as given' '
192 git log --no-walk=unsorted --oneline 5d31159 804a787 394ef78 > actual &&
193 test_cmp expect actual
194'
195
d5cee0f7
MG
196test_expect_success 'git show <commits> leaves list of commits as given' '
197 git show --oneline -s 5d31159 804a787 394ef78 > actual &&
198 test_cmp expect actual
199'
200
0843acfd
JK
201test_expect_success 'setup case sensitivity tests' '
202 echo case >one &&
203 test_tick &&
a48fcd83 204 git add one &&
0843acfd
JK
205 git commit -a -m Second
206'
207
208test_expect_success 'log --grep' '
209 echo second >expect &&
210 git log -1 --pretty="tformat:%s" --grep=sec >actual &&
211 test_cmp expect actual
212'
0faf2da7 213
7d7b86f7
MM
214test_expect_success 'log --grep option parsing' '
215 echo second >expect &&
216 git log -1 --pretty="tformat:%s" --grep sec >actual &&
217 test_cmp expect actual &&
218 test_must_fail git log -1 --pretty="tformat:%s" --grep
219'
220
0843acfd
JK
221test_expect_success 'log -i --grep' '
222 echo Second >expect &&
223 git log -1 --pretty="tformat:%s" -i --grep=sec >actual &&
224 test_cmp expect actual
225'
226
227test_expect_success 'log --grep -i' '
228 echo Second >expect &&
229 git log -1 --pretty="tformat:%s" --grep=sec -i >actual &&
230 test_cmp expect actual
231'
0faf2da7 232
34a4ae55
JH
233test_expect_success 'log -F -E --grep=<ere> uses ere' '
234 echo second >expect &&
235 git log -1 --pretty="tformat:%s" -F -E --grep=s.c.nd >actual &&
236 test_cmp expect actual
237'
238
289e1623
TR
239cat > expect <<EOF
240* Second
241* sixth
242* fifth
243* fourth
244* third
245* second
246* initial
247EOF
248
249test_expect_success 'simple log --graph' '
250 git log --graph --pretty=tformat:%s >actual &&
251 test_cmp expect actual
252'
253
254test_expect_success 'set up merge history' '
255 git checkout -b side HEAD~4 &&
256 test_commit side-1 1 1 &&
257 test_commit side-2 2 2 &&
258 git checkout master &&
259 git merge side
260'
261
262cat > expect <<\EOF
263* Merge branch 'side'
264|\
265| * side-2
266| * side-1
267* | Second
268* | sixth
269* | fifth
270* | fourth
271|/
272* third
273* second
274* initial
275EOF
276
277test_expect_success 'log --graph with merge' '
278 git log --graph --date-order --pretty=tformat:%s |
9524cf29 279 sed "s/ *\$//" >actual &&
289e1623
TR
280 test_cmp expect actual
281'
282
656197ad
MK
283test_expect_success 'log --raw --graph -m with merge' '
284 git log --raw --graph --oneline -m master | head -n 500 >actual &&
285 grep "initial" actual
286'
287
288test_expect_success 'diff-tree --graph' '
289 git diff-tree --graph master^ | head -n 500 >actual &&
290 grep "one" actual
291'
292
289e1623
TR
293cat > expect <<\EOF
294* commit master
295|\ Merge: A B
296| | Author: A U Thor <author@example.com>
297| |
298| | Merge branch 'side'
299| |
300| * commit side
301| | Author: A U Thor <author@example.com>
302| |
303| | side-2
304| |
305| * commit tags/side-1
306| | Author: A U Thor <author@example.com>
307| |
308| | side-1
309| |
310* | commit master~1
311| | Author: A U Thor <author@example.com>
312| |
313| | Second
314| |
315* | commit master~2
316| | Author: A U Thor <author@example.com>
317| |
318| | sixth
319| |
320* | commit master~3
321| | Author: A U Thor <author@example.com>
322| |
323| | fifth
324| |
325* | commit master~4
326|/ Author: A U Thor <author@example.com>
327|
328| fourth
329|
330* commit tags/side-1~1
331| Author: A U Thor <author@example.com>
332|
333| third
334|
335* commit tags/side-1~2
336| Author: A U Thor <author@example.com>
337|
338| second
339|
340* commit tags/side-1~3
341 Author: A U Thor <author@example.com>
342
343 initial
344EOF
345
346test_expect_success 'log --graph with full output' '
347 git log --graph --date-order --pretty=short |
348 git name-rev --name-only --stdin |
9524cf29 349 sed "s/Merge:.*/Merge: A B/;s/ *\$//" >actual &&
289e1623
TR
350 test_cmp expect actual
351'
352
353test_expect_success 'set up more tangled history' '
354 git checkout -b tangle HEAD~6 &&
355 test_commit tangle-a tangle-a a &&
356 git merge master~3 &&
357 git merge side~1 &&
358 git checkout master &&
7b1d6269
AC
359 git merge tangle &&
360 git checkout -b reach &&
361 test_commit reach &&
362 git checkout master &&
363 git checkout -b octopus-a &&
364 test_commit octopus-a &&
365 git checkout master &&
366 git checkout -b octopus-b &&
367 test_commit octopus-b &&
368 git checkout master &&
369 test_commit seventh &&
a48fcd83 370 git merge octopus-a octopus-b &&
7b1d6269 371 git merge reach
289e1623
TR
372'
373
374cat > expect <<\EOF
57b58db7 375* Merge tag 'reach'
7b1d6269
AC
376|\
377| \
378| \
57b58db7 379*-. \ Merge tags 'octopus-a' and 'octopus-b'
7b1d6269
AC
380|\ \ \
381* | | | seventh
382| | * | octopus-b
383| |/ /
384|/| |
385| * | octopus-a
386|/ /
387| * reach
388|/
289e1623
TR
389* Merge branch 'tangle'
390|\
391| * Merge branch 'side' (early part) into tangle
392| |\
393| * \ Merge branch 'master' (early part) into tangle
394| |\ \
395| * | | tangle-a
396* | | | Merge branch 'side'
397|\ \ \ \
398| * | | | side-2
eaf158f8 399| | |_|/
289e1623
TR
400| |/| |
401| * | | side-1
402* | | | Second
403* | | | sixth
eaf158f8 404| |_|/
289e1623
TR
405|/| |
406* | | fifth
407* | | fourth
408|/ /
409* | third
410|/
411* second
412* initial
413EOF
414
95110d75 415test_expect_success 'log --graph with merge' '
289e1623 416 git log --graph --date-order --pretty=tformat:%s |
9524cf29 417 sed "s/ *\$//" >actual &&
289e1623
TR
418 test_cmp expect actual
419'
420
8a3d203b 421test_expect_success 'log.decorate configuration' '
4f62c2bc
JH
422 git log --oneline >expect.none &&
423 git log --oneline --decorate >expect.short &&
424 git log --oneline --decorate=full >expect.full &&
8a3d203b
JH
425
426 echo "[log] decorate" >>.git/config &&
635530a2 427 git log --oneline >actual &&
4f62c2bc 428 test_cmp expect.short actual &&
8a3d203b 429
90e76b70 430 test_config log.decorate true &&
4f62c2bc 431 git log --oneline >actual &&
8a3d203b 432 test_cmp expect.short actual &&
4f62c2bc 433 git log --oneline --decorate=full >actual &&
8a3d203b 434 test_cmp expect.full actual &&
4f62c2bc 435 git log --oneline --decorate=no >actual &&
8a3d203b
JH
436 test_cmp expect.none actual &&
437
90e76b70 438 test_config log.decorate no &&
4f62c2bc 439 git log --oneline >actual &&
8a3d203b 440 test_cmp expect.none actual &&
4f62c2bc 441 git log --oneline --decorate >actual &&
8a3d203b 442 test_cmp expect.short actual &&
4f62c2bc 443 git log --oneline --decorate=full >actual &&
8a3d203b
JH
444 test_cmp expect.full actual &&
445
90e76b70 446 test_config log.decorate 1 &&
b2be2f6a
JK
447 git log --oneline >actual &&
448 test_cmp expect.short actual &&
449 git log --oneline --decorate=full >actual &&
450 test_cmp expect.full actual &&
451 git log --oneline --decorate=no >actual &&
452 test_cmp expect.none actual &&
453
90e76b70 454 test_config log.decorate short &&
4f62c2bc 455 git log --oneline >actual &&
8a3d203b 456 test_cmp expect.short actual &&
4f62c2bc 457 git log --oneline --no-decorate >actual &&
8a3d203b 458 test_cmp expect.none actual &&
4f62c2bc 459 git log --oneline --decorate=full >actual &&
8a3d203b
JH
460 test_cmp expect.full actual &&
461
90e76b70 462 test_config log.decorate full &&
4f62c2bc 463 git log --oneline >actual &&
8a3d203b 464 test_cmp expect.full actual &&
4f62c2bc 465 git log --oneline --no-decorate >actual &&
8a3d203b 466 test_cmp expect.none actual &&
4f62c2bc 467 git log --oneline --decorate >actual &&
8a3d203b
JH
468 test_cmp expect.short actual
469
90e76b70 470 test_unconfig log.decorate &&
0c47695a 471 git log --pretty=raw >expect.raw &&
90e76b70 472 test_config log.decorate full &&
0c47695a
JS
473 git log --pretty=raw >actual &&
474 test_cmp expect.raw actual
475
476'
477
478test_expect_success 'reflog is expected format' '
0c47695a
JS
479 git log -g --abbrev-commit --pretty=oneline >expect &&
480 git reflog >actual &&
481 test_cmp expect actual
482'
483
484test_expect_success 'whatchanged is expected format' '
485 git log --no-merges --raw >expect &&
486 git whatchanged >actual &&
487 test_cmp expect actual
488'
489
490test_expect_success 'log.abbrevCommit configuration' '
0c47695a
JS
491 git log --abbrev-commit >expect.log.abbrev &&
492 git log --no-abbrev-commit >expect.log.full &&
493 git log --pretty=raw >expect.log.raw &&
494 git reflog --abbrev-commit >expect.reflog.abbrev &&
495 git reflog --no-abbrev-commit >expect.reflog.full &&
496 git whatchanged --abbrev-commit >expect.whatchanged.abbrev &&
497 git whatchanged --no-abbrev-commit >expect.whatchanged.full &&
498
90e76b70 499 test_config log.abbrevCommit true &&
0c47695a
JS
500
501 git log >actual &&
502 test_cmp expect.log.abbrev actual &&
503 git log --no-abbrev-commit >actual &&
504 test_cmp expect.log.full actual &&
505
506 git log --pretty=raw >actual &&
507 test_cmp expect.log.raw actual &&
508
509 git reflog >actual &&
510 test_cmp expect.reflog.abbrev actual &&
511 git reflog --no-abbrev-commit >actual &&
512 test_cmp expect.reflog.full actual &&
513
514 git whatchanged >actual &&
515 test_cmp expect.whatchanged.abbrev actual &&
516 git whatchanged --no-abbrev-commit >actual &&
517 test_cmp expect.whatchanged.full actual
8a3d203b
JH
518'
519
65113121
ÆAB
520test_expect_success 'show added path under "--follow -M"' '
521 # This tests for a regression introduced in v1.7.2-rc0~103^2~2
522 test_create_repo regression &&
523 (
524 cd regression &&
525 test_commit needs-another-commit &&
526 test_commit foo.bar &&
527 git log -M --follow -p foo.bar.t &&
528 git log -M --follow --stat foo.bar.t &&
529 git log -M --follow --name-only foo.bar.t
530 )
531'
c65233fe 532
e2c59667
LP
533cat >expect <<\EOF
534* commit COMMIT_OBJECT_NAME
535|\ Merge: MERGE_PARENTS
536| | Author: A U Thor <author@example.com>
537| |
538| | Merge HEADS DESCRIPTION
539| |
540| * commit COMMIT_OBJECT_NAME
541| | Author: A U Thor <author@example.com>
542| |
543| | reach
544| | ---
dc801e71 545| | reach.t | 1 +
e2c59667
LP
546| | 1 file changed, 1 insertion(+)
547| |
548| | diff --git a/reach.t b/reach.t
549| | new file mode 100644
550| | index 0000000..10c9591
551| | --- /dev/null
552| | +++ b/reach.t
553| | @@ -0,0 +1 @@
554| | +reach
555| |
556| \
557*-. \ commit COMMIT_OBJECT_NAME
558|\ \ \ Merge: MERGE_PARENTS
559| | | | Author: A U Thor <author@example.com>
560| | | |
561| | | | Merge HEADS DESCRIPTION
562| | | |
563| | * | commit COMMIT_OBJECT_NAME
564| | |/ Author: A U Thor <author@example.com>
565| | |
566| | | octopus-b
567| | | ---
dc801e71 568| | | octopus-b.t | 1 +
e2c59667
LP
569| | | 1 file changed, 1 insertion(+)
570| | |
571| | | diff --git a/octopus-b.t b/octopus-b.t
572| | | new file mode 100644
573| | | index 0000000..d5fcad0
574| | | --- /dev/null
575| | | +++ b/octopus-b.t
576| | | @@ -0,0 +1 @@
577| | | +octopus-b
578| | |
579| * | commit COMMIT_OBJECT_NAME
580| |/ Author: A U Thor <author@example.com>
581| |
582| | octopus-a
583| | ---
dc801e71 584| | octopus-a.t | 1 +
e2c59667
LP
585| | 1 file changed, 1 insertion(+)
586| |
587| | diff --git a/octopus-a.t b/octopus-a.t
588| | new file mode 100644
589| | index 0000000..11ee015
590| | --- /dev/null
591| | +++ b/octopus-a.t
592| | @@ -0,0 +1 @@
593| | +octopus-a
594| |
595* | commit COMMIT_OBJECT_NAME
596|/ Author: A U Thor <author@example.com>
597|
598| seventh
599| ---
dc801e71 600| seventh.t | 1 +
e2c59667
LP
601| 1 file changed, 1 insertion(+)
602|
603| diff --git a/seventh.t b/seventh.t
604| new file mode 100644
605| index 0000000..9744ffc
606| --- /dev/null
607| +++ b/seventh.t
608| @@ -0,0 +1 @@
609| +seventh
610|
611* commit COMMIT_OBJECT_NAME
612|\ Merge: MERGE_PARENTS
613| | Author: A U Thor <author@example.com>
614| |
615| | Merge branch 'tangle'
616| |
617| * commit COMMIT_OBJECT_NAME
618| |\ Merge: MERGE_PARENTS
619| | | Author: A U Thor <author@example.com>
620| | |
621| | | Merge branch 'side' (early part) into tangle
622| | |
623| * | commit COMMIT_OBJECT_NAME
624| |\ \ Merge: MERGE_PARENTS
625| | | | Author: A U Thor <author@example.com>
626| | | |
627| | | | Merge branch 'master' (early part) into tangle
628| | | |
629| * | | commit COMMIT_OBJECT_NAME
630| | | | Author: A U Thor <author@example.com>
631| | | |
632| | | | tangle-a
633| | | | ---
dc801e71 634| | | | tangle-a | 1 +
e2c59667
LP
635| | | | 1 file changed, 1 insertion(+)
636| | | |
637| | | | diff --git a/tangle-a b/tangle-a
638| | | | new file mode 100644
639| | | | index 0000000..7898192
640| | | | --- /dev/null
641| | | | +++ b/tangle-a
642| | | | @@ -0,0 +1 @@
643| | | | +a
644| | | |
645* | | | commit COMMIT_OBJECT_NAME
646|\ \ \ \ Merge: MERGE_PARENTS
647| | | | | Author: A U Thor <author@example.com>
648| | | | |
649| | | | | Merge branch 'side'
650| | | | |
651| * | | | commit COMMIT_OBJECT_NAME
652| | |_|/ Author: A U Thor <author@example.com>
653| |/| |
654| | | | side-2
655| | | | ---
dc801e71 656| | | | 2 | 1 +
e2c59667
LP
657| | | | 1 file changed, 1 insertion(+)
658| | | |
659| | | | diff --git a/2 b/2
660| | | | new file mode 100644
661| | | | index 0000000..0cfbf08
662| | | | --- /dev/null
663| | | | +++ b/2
664| | | | @@ -0,0 +1 @@
665| | | | +2
666| | | |
667| * | | commit COMMIT_OBJECT_NAME
668| | | | Author: A U Thor <author@example.com>
669| | | |
670| | | | side-1
671| | | | ---
dc801e71 672| | | | 1 | 1 +
e2c59667
LP
673| | | | 1 file changed, 1 insertion(+)
674| | | |
675| | | | diff --git a/1 b/1
676| | | | new file mode 100644
677| | | | index 0000000..d00491f
678| | | | --- /dev/null
679| | | | +++ b/1
680| | | | @@ -0,0 +1 @@
681| | | | +1
682| | | |
683* | | | commit COMMIT_OBJECT_NAME
684| | | | Author: A U Thor <author@example.com>
685| | | |
686| | | | Second
687| | | | ---
dc801e71 688| | | | one | 1 +
e2c59667
LP
689| | | | 1 file changed, 1 insertion(+)
690| | | |
691| | | | diff --git a/one b/one
692| | | | new file mode 100644
693| | | | index 0000000..9a33383
694| | | | --- /dev/null
695| | | | +++ b/one
696| | | | @@ -0,0 +1 @@
697| | | | +case
698| | | |
699* | | | commit COMMIT_OBJECT_NAME
700| |_|/ Author: A U Thor <author@example.com>
701|/| |
702| | | sixth
703| | | ---
dc801e71 704| | | a/two | 1 -
e2c59667
LP
705| | | 1 file changed, 1 deletion(-)
706| | |
707| | | diff --git a/a/two b/a/two
708| | | deleted file mode 100644
709| | | index 9245af5..0000000
710| | | --- a/a/two
711| | | +++ /dev/null
712| | | @@ -1 +0,0 @@
713| | | -ni
714| | |
715* | | commit COMMIT_OBJECT_NAME
716| | | Author: A U Thor <author@example.com>
717| | |
718| | | fifth
719| | | ---
dc801e71 720| | | a/two | 1 +
e2c59667
LP
721| | | 1 file changed, 1 insertion(+)
722| | |
723| | | diff --git a/a/two b/a/two
724| | | new file mode 100644
725| | | index 0000000..9245af5
726| | | --- /dev/null
727| | | +++ b/a/two
728| | | @@ -0,0 +1 @@
729| | | +ni
730| | |
731* | | commit COMMIT_OBJECT_NAME
732|/ / Author: A U Thor <author@example.com>
733| |
734| | fourth
735| | ---
dc801e71 736| | ein | 1 +
e2c59667
LP
737| | 1 file changed, 1 insertion(+)
738| |
739| | diff --git a/ein b/ein
740| | new file mode 100644
741| | index 0000000..9d7e69f
742| | --- /dev/null
743| | +++ b/ein
744| | @@ -0,0 +1 @@
745| | +ichi
746| |
747* | commit COMMIT_OBJECT_NAME
748|/ Author: A U Thor <author@example.com>
749|
750| third
751| ---
dc801e71
ZJS
752| ichi | 1 +
753| one | 1 -
e2c59667
LP
754| 2 files changed, 1 insertion(+), 1 deletion(-)
755|
756| diff --git a/ichi b/ichi
757| new file mode 100644
758| index 0000000..9d7e69f
759| --- /dev/null
760| +++ b/ichi
761| @@ -0,0 +1 @@
762| +ichi
763| diff --git a/one b/one
764| deleted file mode 100644
765| index 9d7e69f..0000000
766| --- a/one
767| +++ /dev/null
768| @@ -1 +0,0 @@
769| -ichi
770|
771* commit COMMIT_OBJECT_NAME
772| Author: A U Thor <author@example.com>
773|
774| second
775| ---
dc801e71 776| one | 2 +-
e2c59667
LP
777| 1 file changed, 1 insertion(+), 1 deletion(-)
778|
779| diff --git a/one b/one
780| index 5626abf..9d7e69f 100644
781| --- a/one
782| +++ b/one
783| @@ -1 +1 @@
784| -one
785| +ichi
786|
787* commit COMMIT_OBJECT_NAME
788 Author: A U Thor <author@example.com>
789
790 initial
791 ---
dc801e71 792 one | 1 +
e2c59667
LP
793 1 file changed, 1 insertion(+)
794
795 diff --git a/one b/one
796 new file mode 100644
797 index 0000000..5626abf
798 --- /dev/null
799 +++ b/one
800 @@ -0,0 +1 @@
801 +one
802EOF
803
804sanitize_output () {
805 sed -e 's/ *$//' \
806 -e 's/commit [0-9a-f]*$/commit COMMIT_OBJECT_NAME/' \
807 -e 's/Merge: [ 0-9a-f]*$/Merge: MERGE_PARENTS/' \
808 -e 's/Merge tag.*/Merge HEADS DESCRIPTION/' \
809 -e 's/Merge commit.*/Merge HEADS DESCRIPTION/' \
810 -e 's/, 0 deletions(-)//' \
811 -e 's/, 0 insertions(+)//' \
812 -e 's/ 1 files changed, / 1 file changed, /' \
813 -e 's/, 1 deletions(-)/, 1 deletion(-)/' \
814 -e 's/, 1 insertions(+)/, 1 insertion(+)/'
815}
816
817test_expect_success 'log --graph with diff and stats' '
818 git log --graph --pretty=short --stat -p >actual &&
819 sanitize_output >actual.sanitized <actual &&
b354f11b 820 test_i18ncmp expect actual.sanitized
e2c59667
LP
821'
822
003c84f6
JH
823test_expect_success 'dotdot is a parent directory' '
824 mkdir -p a/b &&
825 ( echo sixth && echo fifth ) >expect &&
826 ( cd a/b && git log --format=%s .. ) >actual &&
827 test_cmp expect actual
828'
829
65113121 830test_done