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