]>
Commit | Line | Data |
---|---|---|
0faf2da7 AL |
1 | #!/bin/sh |
2 | ||
3 | test_description='git log' | |
4 | ||
5 | . ./test-lib.sh | |
6 | ||
7 | test_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 |
40 | printf "sixth\nfifth\nfourth\nthird\nsecond\ninitial" > expect |
41 | test_expect_success 'pretty' ' | |
42 | ||
43 | git log --pretty="format:%s" > actual && | |
44 | test_cmp expect actual | |
45 | ' | |
46 | ||
47 | printf "sixth\nfifth\nfourth\nthird\nsecond\ninitial\n" > expect | |
48 | test_expect_success 'pretty (tformat)' ' | |
49 | ||
50 | git log --pretty="tformat:%s" > actual && | |
51 | test_cmp expect actual | |
52 | ' | |
53 | ||
54 | test_expect_success 'pretty (shortcut)' ' | |
55 | ||
56 | git log --pretty="%s" > actual && | |
57 | test_cmp expect actual | |
58 | ' | |
59 | ||
60 | test_expect_success 'format' ' | |
61 | ||
62 | git log --format="%s" > actual && | |
63 | test_cmp expect actual | |
64 | ' | |
65 | ||
37bb5d74 RS |
66 | cat > expect << EOF |
67 | This is | |
68 | the sixth | |
69 | commit. | |
70 | This is | |
71 | the fifth | |
72 | commit. | |
73 | EOF | |
74 | ||
75 | test_expect_success 'format %w(12,1,2)' ' | |
76 | ||
77 | git log -2 --format="%w(12,1,2)This is the %s commit." > actual && | |
78 | test_cmp expect actual | |
79 | ' | |
80 | ||
81 | test_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 |
87 | cat > expect << EOF |
88 | 804a787 sixth | |
89 | 394ef78 fifth | |
90 | 5d31159 fourth | |
91 | 2fbe8c0 third | |
92 | f7dab8e second | |
93 | 3a2fdcb initial | |
94 | EOF | |
95 | test_expect_success 'oneline' ' | |
96 | ||
97 | git log --oneline > actual && | |
98 | test_cmp expect actual | |
99 | ' | |
100 | ||
0faf2da7 AL |
101 | test_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 | ||
111 | test_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 | ||
123 | test_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 | ||
135 | test_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 | ||
147 | test_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 | ||
159 | test_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 |
171 | cat > expect << EOF |
172 | 804a787 sixth | |
173 | 394ef78 fifth | |
174 | 5d31159 fourth | |
175 | EOF | |
176 | test_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 |
181 | test_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 |
186 | cat > expect << EOF |
187 | 5d31159 fourth | |
188 | 804a787 sixth | |
189 | 394ef78 fifth | |
190 | EOF | |
ca92e59e MZ |
191 | test_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 |
196 | test_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 |
201 | test_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 | ||
208 | test_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 |
214 | test_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 |
221 | test_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 | ||
227 | test_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 | |
289e1623 TR |
233 | cat > expect <<EOF |
234 | * Second | |
235 | * sixth | |
236 | * fifth | |
237 | * fourth | |
238 | * third | |
239 | * second | |
240 | * initial | |
241 | EOF | |
242 | ||
243 | test_expect_success 'simple log --graph' ' | |
244 | git log --graph --pretty=tformat:%s >actual && | |
245 | test_cmp expect actual | |
246 | ' | |
247 | ||
248 | test_expect_success 'set up merge history' ' | |
249 | git checkout -b side HEAD~4 && | |
250 | test_commit side-1 1 1 && | |
251 | test_commit side-2 2 2 && | |
252 | git checkout master && | |
253 | git merge side | |
254 | ' | |
255 | ||
256 | cat > expect <<\EOF | |
257 | * Merge branch 'side' | |
258 | |\ | |
259 | | * side-2 | |
260 | | * side-1 | |
261 | * | Second | |
262 | * | sixth | |
263 | * | fifth | |
264 | * | fourth | |
265 | |/ | |
266 | * third | |
267 | * second | |
268 | * initial | |
269 | EOF | |
270 | ||
271 | test_expect_success 'log --graph with merge' ' | |
272 | git log --graph --date-order --pretty=tformat:%s | | |
9524cf29 | 273 | sed "s/ *\$//" >actual && |
289e1623 TR |
274 | test_cmp expect actual |
275 | ' | |
276 | ||
277 | cat > expect <<\EOF | |
278 | * commit master | |
279 | |\ Merge: A B | |
280 | | | Author: A U Thor <author@example.com> | |
281 | | | | |
282 | | | Merge branch 'side' | |
283 | | | | |
284 | | * commit side | |
285 | | | Author: A U Thor <author@example.com> | |
286 | | | | |
287 | | | side-2 | |
288 | | | | |
289 | | * commit tags/side-1 | |
290 | | | Author: A U Thor <author@example.com> | |
291 | | | | |
292 | | | side-1 | |
293 | | | | |
294 | * | commit master~1 | |
295 | | | Author: A U Thor <author@example.com> | |
296 | | | | |
297 | | | Second | |
298 | | | | |
299 | * | commit master~2 | |
300 | | | Author: A U Thor <author@example.com> | |
301 | | | | |
302 | | | sixth | |
303 | | | | |
304 | * | commit master~3 | |
305 | | | Author: A U Thor <author@example.com> | |
306 | | | | |
307 | | | fifth | |
308 | | | | |
309 | * | commit master~4 | |
310 | |/ Author: A U Thor <author@example.com> | |
311 | | | |
312 | | fourth | |
313 | | | |
314 | * commit tags/side-1~1 | |
315 | | Author: A U Thor <author@example.com> | |
316 | | | |
317 | | third | |
318 | | | |
319 | * commit tags/side-1~2 | |
320 | | Author: A U Thor <author@example.com> | |
321 | | | |
322 | | second | |
323 | | | |
324 | * commit tags/side-1~3 | |
325 | Author: A U Thor <author@example.com> | |
326 | ||
327 | initial | |
328 | EOF | |
329 | ||
330 | test_expect_success 'log --graph with full output' ' | |
331 | git log --graph --date-order --pretty=short | | |
332 | git name-rev --name-only --stdin | | |
9524cf29 | 333 | sed "s/Merge:.*/Merge: A B/;s/ *\$//" >actual && |
289e1623 TR |
334 | test_cmp expect actual |
335 | ' | |
336 | ||
337 | test_expect_success 'set up more tangled history' ' | |
338 | git checkout -b tangle HEAD~6 && | |
339 | test_commit tangle-a tangle-a a && | |
340 | git merge master~3 && | |
341 | git merge side~1 && | |
342 | git checkout master && | |
7b1d6269 AC |
343 | git merge tangle && |
344 | git checkout -b reach && | |
345 | test_commit reach && | |
346 | git checkout master && | |
347 | git checkout -b octopus-a && | |
348 | test_commit octopus-a && | |
349 | git checkout master && | |
350 | git checkout -b octopus-b && | |
351 | test_commit octopus-b && | |
352 | git checkout master && | |
353 | test_commit seventh && | |
a48fcd83 | 354 | git merge octopus-a octopus-b && |
7b1d6269 | 355 | git merge reach |
289e1623 TR |
356 | ' |
357 | ||
358 | cat > expect <<\EOF | |
57b58db7 | 359 | * Merge tag 'reach' |
7b1d6269 AC |
360 | |\ |
361 | | \ | |
362 | | \ | |
57b58db7 | 363 | *-. \ Merge tags 'octopus-a' and 'octopus-b' |
7b1d6269 AC |
364 | |\ \ \ |
365 | * | | | seventh | |
366 | | | * | octopus-b | |
367 | | |/ / | |
368 | |/| | | |
369 | | * | octopus-a | |
370 | |/ / | |
371 | | * reach | |
372 | |/ | |
289e1623 TR |
373 | * Merge branch 'tangle' |
374 | |\ | |
375 | | * Merge branch 'side' (early part) into tangle | |
376 | | |\ | |
377 | | * \ Merge branch 'master' (early part) into tangle | |
378 | | |\ \ | |
379 | | * | | tangle-a | |
380 | * | | | Merge branch 'side' | |
381 | |\ \ \ \ | |
382 | | * | | | side-2 | |
eaf158f8 | 383 | | | |_|/ |
289e1623 TR |
384 | | |/| | |
385 | | * | | side-1 | |
386 | * | | | Second | |
387 | * | | | sixth | |
eaf158f8 | 388 | | |_|/ |
289e1623 TR |
389 | |/| | |
390 | * | | fifth | |
391 | * | | fourth | |
392 | |/ / | |
393 | * | third | |
394 | |/ | |
395 | * second | |
396 | * initial | |
397 | EOF | |
398 | ||
95110d75 | 399 | test_expect_success 'log --graph with merge' ' |
289e1623 | 400 | git log --graph --date-order --pretty=tformat:%s | |
9524cf29 | 401 | sed "s/ *\$//" >actual && |
289e1623 TR |
402 | test_cmp expect actual |
403 | ' | |
404 | ||
8a3d203b | 405 | test_expect_success 'log.decorate configuration' ' |
5a57bc6b | 406 | test_might_fail git config --unset-all log.decorate && |
8a3d203b | 407 | |
4f62c2bc JH |
408 | git log --oneline >expect.none && |
409 | git log --oneline --decorate >expect.short && | |
410 | git log --oneline --decorate=full >expect.full && | |
8a3d203b JH |
411 | |
412 | echo "[log] decorate" >>.git/config && | |
635530a2 | 413 | git log --oneline >actual && |
4f62c2bc | 414 | test_cmp expect.short actual && |
8a3d203b JH |
415 | |
416 | git config --unset-all log.decorate && | |
417 | git config log.decorate true && | |
4f62c2bc | 418 | git log --oneline >actual && |
8a3d203b | 419 | test_cmp expect.short actual && |
4f62c2bc | 420 | git log --oneline --decorate=full >actual && |
8a3d203b | 421 | test_cmp expect.full actual && |
4f62c2bc | 422 | git log --oneline --decorate=no >actual && |
8a3d203b JH |
423 | test_cmp expect.none actual && |
424 | ||
425 | git config --unset-all log.decorate && | |
426 | git config log.decorate no && | |
4f62c2bc | 427 | git log --oneline >actual && |
8a3d203b | 428 | test_cmp expect.none actual && |
4f62c2bc | 429 | git log --oneline --decorate >actual && |
8a3d203b | 430 | test_cmp expect.short actual && |
4f62c2bc | 431 | git log --oneline --decorate=full >actual && |
8a3d203b JH |
432 | test_cmp expect.full actual && |
433 | ||
b2be2f6a JK |
434 | git config --unset-all log.decorate && |
435 | git config log.decorate 1 && | |
436 | git log --oneline >actual && | |
437 | test_cmp expect.short actual && | |
438 | git log --oneline --decorate=full >actual && | |
439 | test_cmp expect.full actual && | |
440 | git log --oneline --decorate=no >actual && | |
441 | test_cmp expect.none actual && | |
442 | ||
8a3d203b JH |
443 | git config --unset-all log.decorate && |
444 | git config log.decorate short && | |
4f62c2bc | 445 | git log --oneline >actual && |
8a3d203b | 446 | test_cmp expect.short actual && |
4f62c2bc | 447 | git log --oneline --no-decorate >actual && |
8a3d203b | 448 | test_cmp expect.none actual && |
4f62c2bc | 449 | git log --oneline --decorate=full >actual && |
8a3d203b JH |
450 | test_cmp expect.full actual && |
451 | ||
452 | git config --unset-all log.decorate && | |
453 | git config log.decorate full && | |
4f62c2bc | 454 | git log --oneline >actual && |
8a3d203b | 455 | test_cmp expect.full actual && |
4f62c2bc | 456 | git log --oneline --no-decorate >actual && |
8a3d203b | 457 | test_cmp expect.none actual && |
4f62c2bc | 458 | git log --oneline --decorate >actual && |
8a3d203b JH |
459 | test_cmp expect.short actual |
460 | ||
0c47695a JS |
461 | git config --unset-all log.decorate && |
462 | git log --pretty=raw >expect.raw && | |
463 | git config log.decorate full && | |
464 | git log --pretty=raw >actual && | |
465 | test_cmp expect.raw actual | |
466 | ||
467 | ' | |
468 | ||
469 | test_expect_success 'reflog is expected format' ' | |
470 | test_might_fail git config --remove-section log && | |
471 | git log -g --abbrev-commit --pretty=oneline >expect && | |
472 | git reflog >actual && | |
473 | test_cmp expect actual | |
474 | ' | |
475 | ||
476 | test_expect_success 'whatchanged is expected format' ' | |
477 | git log --no-merges --raw >expect && | |
478 | git whatchanged >actual && | |
479 | test_cmp expect actual | |
480 | ' | |
481 | ||
482 | test_expect_success 'log.abbrevCommit configuration' ' | |
483 | test_when_finished "git config --unset log.abbrevCommit" && | |
484 | ||
485 | test_might_fail git config --unset log.abbrevCommit && | |
486 | ||
487 | git log --abbrev-commit >expect.log.abbrev && | |
488 | git log --no-abbrev-commit >expect.log.full && | |
489 | git log --pretty=raw >expect.log.raw && | |
490 | git reflog --abbrev-commit >expect.reflog.abbrev && | |
491 | git reflog --no-abbrev-commit >expect.reflog.full && | |
492 | git whatchanged --abbrev-commit >expect.whatchanged.abbrev && | |
493 | git whatchanged --no-abbrev-commit >expect.whatchanged.full && | |
494 | ||
495 | git config log.abbrevCommit true && | |
496 | ||
497 | git log >actual && | |
498 | test_cmp expect.log.abbrev actual && | |
499 | git log --no-abbrev-commit >actual && | |
500 | test_cmp expect.log.full actual && | |
501 | ||
502 | git log --pretty=raw >actual && | |
503 | test_cmp expect.log.raw actual && | |
504 | ||
505 | git reflog >actual && | |
506 | test_cmp expect.reflog.abbrev actual && | |
507 | git reflog --no-abbrev-commit >actual && | |
508 | test_cmp expect.reflog.full actual && | |
509 | ||
510 | git whatchanged >actual && | |
511 | test_cmp expect.whatchanged.abbrev actual && | |
512 | git whatchanged --no-abbrev-commit >actual && | |
513 | test_cmp expect.whatchanged.full actual | |
8a3d203b JH |
514 | ' |
515 | ||
65113121 ÆAB |
516 | test_expect_success 'show added path under "--follow -M"' ' |
517 | # This tests for a regression introduced in v1.7.2-rc0~103^2~2 | |
518 | test_create_repo regression && | |
519 | ( | |
520 | cd regression && | |
521 | test_commit needs-another-commit && | |
522 | test_commit foo.bar && | |
523 | git log -M --follow -p foo.bar.t && | |
524 | git log -M --follow --stat foo.bar.t && | |
525 | git log -M --follow --name-only foo.bar.t | |
526 | ) | |
527 | ' | |
c65233fe | 528 | |
e2c59667 LP |
529 | cat >expect <<\EOF |
530 | * commit COMMIT_OBJECT_NAME | |
531 | |\ Merge: MERGE_PARENTS | |
532 | | | Author: A U Thor <author@example.com> | |
533 | | | | |
534 | | | Merge HEADS DESCRIPTION | |
535 | | | | |
536 | | * commit COMMIT_OBJECT_NAME | |
537 | | | Author: A U Thor <author@example.com> | |
538 | | | | |
539 | | | reach | |
540 | | | --- | |
dc801e71 | 541 | | | reach.t | 1 + |
e2c59667 LP |
542 | | | 1 file changed, 1 insertion(+) |
543 | | | | |
544 | | | diff --git a/reach.t b/reach.t | |
545 | | | new file mode 100644 | |
546 | | | index 0000000..10c9591 | |
547 | | | --- /dev/null | |
548 | | | +++ b/reach.t | |
549 | | | @@ -0,0 +1 @@ | |
550 | | | +reach | |
551 | | | | |
552 | | \ | |
553 | *-. \ commit COMMIT_OBJECT_NAME | |
554 | |\ \ \ Merge: MERGE_PARENTS | |
555 | | | | | Author: A U Thor <author@example.com> | |
556 | | | | | | |
557 | | | | | Merge HEADS DESCRIPTION | |
558 | | | | | | |
559 | | | * | commit COMMIT_OBJECT_NAME | |
560 | | | |/ Author: A U Thor <author@example.com> | |
561 | | | | | |
562 | | | | octopus-b | |
563 | | | | --- | |
dc801e71 | 564 | | | | octopus-b.t | 1 + |
e2c59667 LP |
565 | | | | 1 file changed, 1 insertion(+) |
566 | | | | | |
567 | | | | diff --git a/octopus-b.t b/octopus-b.t | |
568 | | | | new file mode 100644 | |
569 | | | | index 0000000..d5fcad0 | |
570 | | | | --- /dev/null | |
571 | | | | +++ b/octopus-b.t | |
572 | | | | @@ -0,0 +1 @@ | |
573 | | | | +octopus-b | |
574 | | | | | |
575 | | * | commit COMMIT_OBJECT_NAME | |
576 | | |/ Author: A U Thor <author@example.com> | |
577 | | | | |
578 | | | octopus-a | |
579 | | | --- | |
dc801e71 | 580 | | | octopus-a.t | 1 + |
e2c59667 LP |
581 | | | 1 file changed, 1 insertion(+) |
582 | | | | |
583 | | | diff --git a/octopus-a.t b/octopus-a.t | |
584 | | | new file mode 100644 | |
585 | | | index 0000000..11ee015 | |
586 | | | --- /dev/null | |
587 | | | +++ b/octopus-a.t | |
588 | | | @@ -0,0 +1 @@ | |
589 | | | +octopus-a | |
590 | | | | |
591 | * | commit COMMIT_OBJECT_NAME | |
592 | |/ Author: A U Thor <author@example.com> | |
593 | | | |
594 | | seventh | |
595 | | --- | |
dc801e71 | 596 | | seventh.t | 1 + |
e2c59667 LP |
597 | | 1 file changed, 1 insertion(+) |
598 | | | |
599 | | diff --git a/seventh.t b/seventh.t | |
600 | | new file mode 100644 | |
601 | | index 0000000..9744ffc | |
602 | | --- /dev/null | |
603 | | +++ b/seventh.t | |
604 | | @@ -0,0 +1 @@ | |
605 | | +seventh | |
606 | | | |
607 | * commit COMMIT_OBJECT_NAME | |
608 | |\ Merge: MERGE_PARENTS | |
609 | | | Author: A U Thor <author@example.com> | |
610 | | | | |
611 | | | Merge branch 'tangle' | |
612 | | | | |
613 | | * commit COMMIT_OBJECT_NAME | |
614 | | |\ Merge: MERGE_PARENTS | |
615 | | | | Author: A U Thor <author@example.com> | |
616 | | | | | |
617 | | | | Merge branch 'side' (early part) into tangle | |
618 | | | | | |
619 | | * | commit COMMIT_OBJECT_NAME | |
620 | | |\ \ Merge: MERGE_PARENTS | |
621 | | | | | Author: A U Thor <author@example.com> | |
622 | | | | | | |
623 | | | | | Merge branch 'master' (early part) into tangle | |
624 | | | | | | |
625 | | * | | commit COMMIT_OBJECT_NAME | |
626 | | | | | Author: A U Thor <author@example.com> | |
627 | | | | | | |
628 | | | | | tangle-a | |
629 | | | | | --- | |
dc801e71 | 630 | | | | | tangle-a | 1 + |
e2c59667 LP |
631 | | | | | 1 file changed, 1 insertion(+) |
632 | | | | | | |
633 | | | | | diff --git a/tangle-a b/tangle-a | |
634 | | | | | new file mode 100644 | |
635 | | | | | index 0000000..7898192 | |
636 | | | | | --- /dev/null | |
637 | | | | | +++ b/tangle-a | |
638 | | | | | @@ -0,0 +1 @@ | |
639 | | | | | +a | |
640 | | | | | | |
641 | * | | | commit COMMIT_OBJECT_NAME | |
642 | |\ \ \ \ Merge: MERGE_PARENTS | |
643 | | | | | | Author: A U Thor <author@example.com> | |
644 | | | | | | | |
645 | | | | | | Merge branch 'side' | |
646 | | | | | | | |
647 | | * | | | commit COMMIT_OBJECT_NAME | |
648 | | | |_|/ Author: A U Thor <author@example.com> | |
649 | | |/| | | |
650 | | | | | side-2 | |
651 | | | | | --- | |
dc801e71 | 652 | | | | | 2 | 1 + |
e2c59667 LP |
653 | | | | | 1 file changed, 1 insertion(+) |
654 | | | | | | |
655 | | | | | diff --git a/2 b/2 | |
656 | | | | | new file mode 100644 | |
657 | | | | | index 0000000..0cfbf08 | |
658 | | | | | --- /dev/null | |
659 | | | | | +++ b/2 | |
660 | | | | | @@ -0,0 +1 @@ | |
661 | | | | | +2 | |
662 | | | | | | |
663 | | * | | commit COMMIT_OBJECT_NAME | |
664 | | | | | Author: A U Thor <author@example.com> | |
665 | | | | | | |
666 | | | | | side-1 | |
667 | | | | | --- | |
dc801e71 | 668 | | | | | 1 | 1 + |
e2c59667 LP |
669 | | | | | 1 file changed, 1 insertion(+) |
670 | | | | | | |
671 | | | | | diff --git a/1 b/1 | |
672 | | | | | new file mode 100644 | |
673 | | | | | index 0000000..d00491f | |
674 | | | | | --- /dev/null | |
675 | | | | | +++ b/1 | |
676 | | | | | @@ -0,0 +1 @@ | |
677 | | | | | +1 | |
678 | | | | | | |
679 | * | | | commit COMMIT_OBJECT_NAME | |
680 | | | | | Author: A U Thor <author@example.com> | |
681 | | | | | | |
682 | | | | | Second | |
683 | | | | | --- | |
dc801e71 | 684 | | | | | one | 1 + |
e2c59667 LP |
685 | | | | | 1 file changed, 1 insertion(+) |
686 | | | | | | |
687 | | | | | diff --git a/one b/one | |
688 | | | | | new file mode 100644 | |
689 | | | | | index 0000000..9a33383 | |
690 | | | | | --- /dev/null | |
691 | | | | | +++ b/one | |
692 | | | | | @@ -0,0 +1 @@ | |
693 | | | | | +case | |
694 | | | | | | |
695 | * | | | commit COMMIT_OBJECT_NAME | |
696 | | |_|/ Author: A U Thor <author@example.com> | |
697 | |/| | | |
698 | | | | sixth | |
699 | | | | --- | |
dc801e71 | 700 | | | | a/two | 1 - |
e2c59667 LP |
701 | | | | 1 file changed, 1 deletion(-) |
702 | | | | | |
703 | | | | diff --git a/a/two b/a/two | |
704 | | | | deleted file mode 100644 | |
705 | | | | index 9245af5..0000000 | |
706 | | | | --- a/a/two | |
707 | | | | +++ /dev/null | |
708 | | | | @@ -1 +0,0 @@ | |
709 | | | | -ni | |
710 | | | | | |
711 | * | | commit COMMIT_OBJECT_NAME | |
712 | | | | Author: A U Thor <author@example.com> | |
713 | | | | | |
714 | | | | fifth | |
715 | | | | --- | |
dc801e71 | 716 | | | | a/two | 1 + |
e2c59667 LP |
717 | | | | 1 file changed, 1 insertion(+) |
718 | | | | | |
719 | | | | diff --git a/a/two b/a/two | |
720 | | | | new file mode 100644 | |
721 | | | | index 0000000..9245af5 | |
722 | | | | --- /dev/null | |
723 | | | | +++ b/a/two | |
724 | | | | @@ -0,0 +1 @@ | |
725 | | | | +ni | |
726 | | | | | |
727 | * | | commit COMMIT_OBJECT_NAME | |
728 | |/ / Author: A U Thor <author@example.com> | |
729 | | | | |
730 | | | fourth | |
731 | | | --- | |
dc801e71 | 732 | | | ein | 1 + |
e2c59667 LP |
733 | | | 1 file changed, 1 insertion(+) |
734 | | | | |
735 | | | diff --git a/ein b/ein | |
736 | | | new file mode 100644 | |
737 | | | index 0000000..9d7e69f | |
738 | | | --- /dev/null | |
739 | | | +++ b/ein | |
740 | | | @@ -0,0 +1 @@ | |
741 | | | +ichi | |
742 | | | | |
743 | * | commit COMMIT_OBJECT_NAME | |
744 | |/ Author: A U Thor <author@example.com> | |
745 | | | |
746 | | third | |
747 | | --- | |
dc801e71 ZJS |
748 | | ichi | 1 + |
749 | | one | 1 - | |
e2c59667 LP |
750 | | 2 files changed, 1 insertion(+), 1 deletion(-) |
751 | | | |
752 | | diff --git a/ichi b/ichi | |
753 | | new file mode 100644 | |
754 | | index 0000000..9d7e69f | |
755 | | --- /dev/null | |
756 | | +++ b/ichi | |
757 | | @@ -0,0 +1 @@ | |
758 | | +ichi | |
759 | | diff --git a/one b/one | |
760 | | deleted file mode 100644 | |
761 | | index 9d7e69f..0000000 | |
762 | | --- a/one | |
763 | | +++ /dev/null | |
764 | | @@ -1 +0,0 @@ | |
765 | | -ichi | |
766 | | | |
767 | * commit COMMIT_OBJECT_NAME | |
768 | | Author: A U Thor <author@example.com> | |
769 | | | |
770 | | second | |
771 | | --- | |
dc801e71 | 772 | | one | 2 +- |
e2c59667 LP |
773 | | 1 file changed, 1 insertion(+), 1 deletion(-) |
774 | | | |
775 | | diff --git a/one b/one | |
776 | | index 5626abf..9d7e69f 100644 | |
777 | | --- a/one | |
778 | | +++ b/one | |
779 | | @@ -1 +1 @@ | |
780 | | -one | |
781 | | +ichi | |
782 | | | |
783 | * commit COMMIT_OBJECT_NAME | |
784 | Author: A U Thor <author@example.com> | |
785 | ||
786 | initial | |
787 | --- | |
dc801e71 | 788 | one | 1 + |
e2c59667 LP |
789 | 1 file changed, 1 insertion(+) |
790 | ||
791 | diff --git a/one b/one | |
792 | new file mode 100644 | |
793 | index 0000000..5626abf | |
794 | --- /dev/null | |
795 | +++ b/one | |
796 | @@ -0,0 +1 @@ | |
797 | +one | |
798 | EOF | |
799 | ||
800 | sanitize_output () { | |
801 | sed -e 's/ *$//' \ | |
802 | -e 's/commit [0-9a-f]*$/commit COMMIT_OBJECT_NAME/' \ | |
803 | -e 's/Merge: [ 0-9a-f]*$/Merge: MERGE_PARENTS/' \ | |
804 | -e 's/Merge tag.*/Merge HEADS DESCRIPTION/' \ | |
805 | -e 's/Merge commit.*/Merge HEADS DESCRIPTION/' \ | |
806 | -e 's/, 0 deletions(-)//' \ | |
807 | -e 's/, 0 insertions(+)//' \ | |
808 | -e 's/ 1 files changed, / 1 file changed, /' \ | |
809 | -e 's/, 1 deletions(-)/, 1 deletion(-)/' \ | |
810 | -e 's/, 1 insertions(+)/, 1 insertion(+)/' | |
811 | } | |
812 | ||
813 | test_expect_success 'log --graph with diff and stats' ' | |
814 | git log --graph --pretty=short --stat -p >actual && | |
815 | sanitize_output >actual.sanitized <actual && | |
b354f11b | 816 | test_i18ncmp expect actual.sanitized |
e2c59667 LP |
817 | ' |
818 | ||
003c84f6 JH |
819 | test_expect_success 'dotdot is a parent directory' ' |
820 | mkdir -p a/b && | |
821 | ( echo sixth && echo fifth ) >expect && | |
822 | ( cd a/b && git log --format=%s .. ) >actual && | |
823 | test_cmp expect actual | |
824 | ' | |
825 | ||
65113121 | 826 | test_done |