]>
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" |
940a911f | 7 | . "$TEST_DIRECTORY/lib-terminal.sh" |
989eea95 AK |
8 | . "$TEST_DIRECTORY/lib-log-graph.sh" |
9 | ||
10 | test_cmp_graph () { | |
11 | lib_test_cmp_graph --format=%s "$@" | |
12 | } | |
0faf2da7 AL |
13 | |
14 | test_expect_success setup ' | |
15 | ||
16 | echo one >one && | |
17 | git add one && | |
18 | test_tick && | |
19 | git commit -m initial && | |
20 | ||
21 | echo ichi >one && | |
22 | git add one && | |
23 | test_tick && | |
24 | git commit -m second && | |
25 | ||
d9305089 | 26 | git mv one ichi && |
0faf2da7 AL |
27 | test_tick && |
28 | git commit -m third && | |
29 | ||
d9305089 AL |
30 | cp ichi ein && |
31 | git add ein && | |
0faf2da7 AL |
32 | test_tick && |
33 | git commit -m fourth && | |
34 | ||
d9305089 AL |
35 | mkdir a && |
36 | echo ni >a/two && | |
37 | git add a/two && | |
38 | test_tick && | |
39 | git commit -m fifth && | |
40 | ||
41 | git rm a/two && | |
0faf2da7 | 42 | test_tick && |
d9305089 | 43 | git commit -m sixth |
0faf2da7 AL |
44 | |
45 | ' | |
46 | ||
bb93afd5 FC |
47 | printf "sixth\nfifth\nfourth\nthird\nsecond\ninitial" > expect |
48 | test_expect_success 'pretty' ' | |
49 | ||
50 | git log --pretty="format:%s" > actual && | |
51 | test_cmp expect actual | |
52 | ' | |
53 | ||
54 | printf "sixth\nfifth\nfourth\nthird\nsecond\ninitial\n" > expect | |
55 | test_expect_success 'pretty (tformat)' ' | |
56 | ||
57 | git log --pretty="tformat:%s" > actual && | |
58 | test_cmp expect actual | |
59 | ' | |
60 | ||
61 | test_expect_success 'pretty (shortcut)' ' | |
62 | ||
63 | git log --pretty="%s" > actual && | |
64 | test_cmp expect actual | |
65 | ' | |
66 | ||
67 | test_expect_success 'format' ' | |
68 | ||
69 | git log --format="%s" > actual && | |
70 | test_cmp expect actual | |
71 | ' | |
72 | ||
37bb5d74 RS |
73 | cat > expect << EOF |
74 | This is | |
75 | the sixth | |
76 | commit. | |
77 | This is | |
78 | the fifth | |
79 | commit. | |
80 | EOF | |
81 | ||
14e1a4e1 | 82 | test_expect_success 'format %w(11,1,2)' ' |
37bb5d74 | 83 | |
14e1a4e1 | 84 | git log -2 --format="%w(11,1,2)This is the %s commit." > actual && |
37bb5d74 RS |
85 | test_cmp expect actual |
86 | ' | |
87 | ||
88 | test_expect_success 'format %w(,1,2)' ' | |
89 | ||
90 | git log -2 --format="%w(,1,2)This is%nthe %s%ncommit." > actual && | |
91 | test_cmp expect actual | |
92 | ' | |
93 | ||
bb93afd5 | 94 | cat > expect << EOF |
cb78f4f0 | 95 | $(git rev-parse --short :/sixth ) sixth |
96 | $(git rev-parse --short :/fifth ) fifth | |
97 | $(git rev-parse --short :/fourth ) fourth | |
98 | $(git rev-parse --short :/third ) third | |
99 | $(git rev-parse --short :/second ) second | |
100 | $(git rev-parse --short :/initial) initial | |
bb93afd5 FC |
101 | EOF |
102 | test_expect_success 'oneline' ' | |
103 | ||
104 | git log --oneline > actual && | |
105 | test_cmp expect actual | |
106 | ' | |
107 | ||
0faf2da7 AL |
108 | test_expect_success 'diff-filter=A' ' |
109 | ||
5404c116 MM |
110 | git log --no-renames --pretty="format:%s" --diff-filter=A HEAD > actual && |
111 | git log --no-renames --pretty="format:%s" --diff-filter A HEAD > actual-separate && | |
dea007fb MM |
112 | printf "fifth\nfourth\nthird\ninitial" > expect && |
113 | test_cmp expect actual && | |
114 | test_cmp expect actual-separate | |
0faf2da7 AL |
115 | |
116 | ' | |
117 | ||
118 | test_expect_success 'diff-filter=M' ' | |
119 | ||
120 | actual=$(git log --pretty="format:%s" --diff-filter=M HEAD) && | |
121 | expect=$(echo second) && | |
a167ece0 | 122 | verbose test "$actual" = "$expect" |
0faf2da7 AL |
123 | |
124 | ' | |
125 | ||
126 | test_expect_success 'diff-filter=D' ' | |
127 | ||
5404c116 | 128 | actual=$(git log --no-renames --pretty="format:%s" --diff-filter=D HEAD) && |
d9305089 | 129 | expect=$(echo sixth ; echo third) && |
a167ece0 | 130 | verbose test "$actual" = "$expect" |
d9305089 AL |
131 | |
132 | ' | |
133 | ||
134 | test_expect_success 'diff-filter=R' ' | |
135 | ||
136 | actual=$(git log -M --pretty="format:%s" --diff-filter=R HEAD) && | |
137 | expect=$(echo third) && | |
a167ece0 | 138 | verbose test "$actual" = "$expect" |
d9305089 AL |
139 | |
140 | ' | |
141 | ||
142 | test_expect_success 'diff-filter=C' ' | |
143 | ||
144 | actual=$(git log -C -C --pretty="format:%s" --diff-filter=C HEAD) && | |
145 | expect=$(echo fourth) && | |
a167ece0 | 146 | verbose test "$actual" = "$expect" |
d9305089 AL |
147 | |
148 | ' | |
149 | ||
150 | test_expect_success 'git log --follow' ' | |
151 | ||
152 | actual=$(git log --follow --pretty="format:%s" ichi) && | |
153 | expect=$(echo third ; echo second ; echo initial) && | |
a167ece0 | 154 | verbose test "$actual" = "$expect" |
076c9837 DT |
155 | ' |
156 | ||
157 | test_expect_success 'git config log.follow works like --follow' ' | |
158 | test_config log.follow true && | |
159 | actual=$(git log --pretty="format:%s" ichi) && | |
160 | expect=$(echo third ; echo second ; echo initial) && | |
161 | verbose test "$actual" = "$expect" | |
162 | ' | |
0faf2da7 | 163 | |
076c9837 DT |
164 | test_expect_success 'git config log.follow does not die with multiple paths' ' |
165 | test_config log.follow true && | |
166 | git log --pretty="format:%s" ichi ein | |
167 | ' | |
168 | ||
169 | test_expect_success 'git config log.follow does not die with no paths' ' | |
170 | test_config log.follow true && | |
171 | git log -- | |
172 | ' | |
173 | ||
174 | test_expect_success 'git config log.follow is overridden by --no-follow' ' | |
175 | test_config log.follow true && | |
176 | actual=$(git log --no-follow --pretty="format:%s" ichi) && | |
177 | expect="third" && | |
178 | verbose test "$actual" = "$expect" | |
0faf2da7 AL |
179 | ' |
180 | ||
cb78f4f0 | 181 | # Note that these commits are intentionally listed out of order. |
182 | last_three="$(git rev-parse :/fourth :/sixth :/fifth)" | |
d5cee0f7 | 183 | cat > expect << EOF |
cb78f4f0 | 184 | $(git rev-parse --short :/sixth ) sixth |
185 | $(git rev-parse --short :/fifth ) fifth | |
186 | $(git rev-parse --short :/fourth) fourth | |
d5cee0f7 MG |
187 | EOF |
188 | test_expect_success 'git log --no-walk <commits> sorts by commit time' ' | |
cb78f4f0 | 189 | git log --no-walk --oneline $last_three > actual && |
d5cee0f7 MG |
190 | test_cmp expect actual |
191 | ' | |
192 | ||
ca92e59e | 193 | test_expect_success 'git log --no-walk=sorted <commits> sorts by commit time' ' |
cb78f4f0 | 194 | git log --no-walk=sorted --oneline $last_three > actual && |
ca92e59e MZ |
195 | test_cmp expect actual |
196 | ' | |
197 | ||
660e113c | 198 | cat > expect << EOF |
cb78f4f0 | 199 | === $(git rev-parse --short :/sixth ) sixth |
200 | === $(git rev-parse --short :/fifth ) fifth | |
201 | === $(git rev-parse --short :/fourth) fourth | |
660e113c JK |
202 | EOF |
203 | test_expect_success 'git log --line-prefix="=== " --no-walk <commits> sorts by commit time' ' | |
cb78f4f0 | 204 | git log --line-prefix="=== " --no-walk --oneline $last_three > actual && |
660e113c JK |
205 | test_cmp expect actual |
206 | ' | |
207 | ||
d5cee0f7 | 208 | cat > expect << EOF |
cb78f4f0 | 209 | $(git rev-parse --short :/fourth) fourth |
210 | $(git rev-parse --short :/sixth ) sixth | |
211 | $(git rev-parse --short :/fifth ) fifth | |
d5cee0f7 | 212 | EOF |
ca92e59e | 213 | test_expect_success 'git log --no-walk=unsorted <commits> leaves list of commits as given' ' |
cb78f4f0 | 214 | git log --no-walk=unsorted --oneline $last_three > actual && |
ca92e59e MZ |
215 | test_cmp expect actual |
216 | ' | |
217 | ||
d5cee0f7 | 218 | test_expect_success 'git show <commits> leaves list of commits as given' ' |
cb78f4f0 | 219 | git show --oneline -s $last_three > actual && |
d5cee0f7 MG |
220 | test_cmp expect actual |
221 | ' | |
222 | ||
0843acfd JK |
223 | test_expect_success 'setup case sensitivity tests' ' |
224 | echo case >one && | |
225 | test_tick && | |
a48fcd83 | 226 | git add one && |
0843acfd JK |
227 | git commit -a -m Second |
228 | ' | |
229 | ||
230 | test_expect_success 'log --grep' ' | |
231 | echo second >expect && | |
232 | git log -1 --pretty="tformat:%s" --grep=sec >actual && | |
22dfa8a2 CJ |
233 | test_cmp expect actual |
234 | ' | |
235 | ||
236 | cat > expect << EOF | |
237 | second | |
238 | initial | |
239 | EOF | |
240 | test_expect_success 'log --invert-grep --grep' ' | |
9e3cbc59 ÆAB |
241 | # Fixed |
242 | git -c grep.patternType=fixed log --pretty="tformat:%s" --invert-grep --grep=th --grep=Sec >actual && | |
243 | test_cmp expect actual && | |
244 | ||
245 | # POSIX basic | |
246 | git -c grep.patternType=basic log --pretty="tformat:%s" --invert-grep --grep=t[h] --grep=S[e]c >actual && | |
247 | test_cmp expect actual && | |
248 | ||
249 | # POSIX extended | |
250 | git -c grep.patternType=basic log --pretty="tformat:%s" --invert-grep --grep=t[h] --grep=S[e]c >actual && | |
251 | test_cmp expect actual && | |
252 | ||
253 | # PCRE | |
254 | if test_have_prereq PCRE | |
255 | then | |
256 | git -c grep.patternType=perl log --pretty="tformat:%s" --invert-grep --grep=t[h] --grep=S[e]c >actual && | |
257 | test_cmp expect actual | |
258 | fi | |
22dfa8a2 CJ |
259 | ' |
260 | ||
261 | test_expect_success 'log --invert-grep --grep -i' ' | |
262 | echo initial >expect && | |
9e3cbc59 ÆAB |
263 | |
264 | # Fixed | |
265 | git -c grep.patternType=fixed log --pretty="tformat:%s" --invert-grep -i --grep=th --grep=Sec >actual && | |
266 | test_cmp expect actual && | |
267 | ||
268 | # POSIX basic | |
269 | git -c grep.patternType=basic log --pretty="tformat:%s" --invert-grep -i --grep=t[h] --grep=S[e]c >actual && | |
270 | test_cmp expect actual && | |
271 | ||
272 | # POSIX extended | |
273 | git -c grep.patternType=extended log --pretty="tformat:%s" --invert-grep -i --grep=t[h] --grep=S[e]c >actual && | |
274 | test_cmp expect actual && | |
275 | ||
276 | # PCRE | |
277 | if test_have_prereq PCRE | |
278 | then | |
279 | git -c grep.patternType=perl log --pretty="tformat:%s" --invert-grep -i --grep=t[h] --grep=S[e]c >actual && | |
280 | test_cmp expect actual | |
281 | fi | |
0843acfd | 282 | ' |
0faf2da7 | 283 | |
7d7b86f7 MM |
284 | test_expect_success 'log --grep option parsing' ' |
285 | echo second >expect && | |
286 | git log -1 --pretty="tformat:%s" --grep sec >actual && | |
287 | test_cmp expect actual && | |
288 | test_must_fail git log -1 --pretty="tformat:%s" --grep | |
289 | ' | |
290 | ||
0843acfd JK |
291 | test_expect_success 'log -i --grep' ' |
292 | echo Second >expect && | |
293 | git log -1 --pretty="tformat:%s" -i --grep=sec >actual && | |
294 | test_cmp expect actual | |
295 | ' | |
296 | ||
297 | test_expect_success 'log --grep -i' ' | |
298 | echo Second >expect && | |
9e3cbc59 ÆAB |
299 | |
300 | # Fixed | |
0843acfd | 301 | git log -1 --pretty="tformat:%s" --grep=sec -i >actual && |
9e3cbc59 ÆAB |
302 | test_cmp expect actual && |
303 | ||
304 | # POSIX basic | |
305 | git -c grep.patternType=basic log -1 --pretty="tformat:%s" --grep=s[e]c -i >actual && | |
306 | test_cmp expect actual && | |
307 | ||
308 | # POSIX extended | |
309 | git -c grep.patternType=extended log -1 --pretty="tformat:%s" --grep=s[e]c -i >actual && | |
310 | test_cmp expect actual && | |
311 | ||
312 | # PCRE | |
313 | if test_have_prereq PCRE | |
314 | then | |
315 | git -c grep.patternType=perl log -1 --pretty="tformat:%s" --grep=s[e]c -i >actual && | |
316 | test_cmp expect actual | |
317 | fi | |
0843acfd | 318 | ' |
0faf2da7 | 319 | |
34a4ae55 JH |
320 | test_expect_success 'log -F -E --grep=<ere> uses ere' ' |
321 | echo second >expect && | |
9df46763 ÆAB |
322 | # basic would need \(s\) to do the same |
323 | git log -1 --pretty="tformat:%s" -F -E --grep="(s).c.nd" >actual && | |
324 | test_cmp expect actual | |
325 | ' | |
326 | ||
327 | test_expect_success PCRE 'log -F -E --perl-regexp --grep=<pcre> uses PCRE' ' | |
328 | test_when_finished "rm -rf num_commits" && | |
329 | git init num_commits && | |
330 | ( | |
331 | cd num_commits && | |
332 | test_commit 1d && | |
333 | test_commit 2e | |
334 | ) && | |
335 | ||
336 | # In PCRE \d in [\d] is like saying "0-9", and matches the 2 | |
337 | # in 2e... | |
338 | echo 2e >expect && | |
339 | git -C num_commits log -1 --pretty="tformat:%s" -F -E --perl-regexp --grep="[\d]" >actual && | |
340 | test_cmp expect actual && | |
341 | ||
342 | # ...in POSIX basic and extended it is the same as [d], | |
343 | # i.e. "d", which matches 1d, but does not match 2e. | |
344 | echo 1d >expect && | |
345 | git -C num_commits log -1 --pretty="tformat:%s" -F -E --grep="[\d]" >actual && | |
34a4ae55 JH |
346 | test_cmp expect actual |
347 | ' | |
348 | ||
8465541e | 349 | test_expect_success 'log with grep.patternType configuration' ' |
8465541e JH |
350 | git -c grep.patterntype=fixed \ |
351 | log -1 --pretty=tformat:%s --grep=s.c.nd >actual && | |
d3c6751b | 352 | test_must_be_empty actual |
8465541e JH |
353 | ' |
354 | ||
355 | test_expect_success 'log with grep.patternType configuration and command line' ' | |
356 | echo second >expect && | |
357 | git -c grep.patterntype=fixed \ | |
358 | log -1 --pretty=tformat:%s --basic-regexp --grep=s.c.nd >actual && | |
359 | test_cmp expect actual | |
360 | ' | |
361 | ||
dfe1a17d | 362 | test_expect_success !FAIL_PREREQS 'log with various grep.patternType configurations & command-lines' ' |
9df46763 ÆAB |
363 | git init pattern-type && |
364 | ( | |
365 | cd pattern-type && | |
366 | test_commit 1 file A && | |
367 | ||
368 | # The tagname is overridden here because creating a | |
369 | # tag called "(1|2)" as test_commit would otherwise | |
370 | # implicitly do would fail on e.g. MINGW. | |
371 | test_commit "(1|2)" file B 2 && | |
372 | ||
373 | echo "(1|2)" >expect.fixed && | |
374 | cp expect.fixed expect.basic && | |
375 | cp expect.fixed expect.extended && | |
376 | cp expect.fixed expect.perl && | |
377 | ||
378 | # A strcmp-like match with fixed. | |
379 | git -c grep.patternType=fixed log --pretty=tformat:%s \ | |
380 | --grep="(1|2)" >actual.fixed && | |
381 | ||
382 | # POSIX basic matches (, | and ) literally. | |
383 | git -c grep.patternType=basic log --pretty=tformat:%s \ | |
384 | --grep="(.|.)" >actual.basic && | |
385 | ||
386 | # POSIX extended needs to have | escaped to match it | |
387 | # literally, whereas under basic this is the same as | |
388 | # (|2), i.e. it would also match "1". This test checks | |
389 | # for extended by asserting that it is not matching | |
390 | # what basic would match. | |
391 | git -c grep.patternType=extended log --pretty=tformat:%s \ | |
392 | --grep="\|2" >actual.extended && | |
393 | if test_have_prereq PCRE | |
394 | then | |
395 | # Only PCRE would match [\d]\| with only | |
396 | # "(1|2)" due to [\d]. POSIX basic would match | |
397 | # both it and "1" since similarly to the | |
398 | # extended match above it is the same as | |
399 | # \([\d]\|\). POSIX extended would | |
400 | # match neither. | |
401 | git -c grep.patternType=perl log --pretty=tformat:%s \ | |
402 | --grep="[\d]\|" >actual.perl && | |
403 | test_cmp expect.perl actual.perl | |
404 | fi && | |
405 | test_cmp expect.fixed actual.fixed && | |
406 | test_cmp expect.basic actual.basic && | |
407 | test_cmp expect.extended actual.extended && | |
408 | ||
409 | git log --pretty=tformat:%s -F \ | |
410 | --grep="(1|2)" >actual.fixed.short-arg && | |
411 | git log --pretty=tformat:%s -E \ | |
412 | --grep="\|2" >actual.extended.short-arg && | |
7531a2dd ÆAB |
413 | if test_have_prereq PCRE |
414 | then | |
415 | git log --pretty=tformat:%s -P \ | |
416 | --grep="[\d]\|" >actual.perl.short-arg | |
417 | else | |
418 | test_must_fail git log -P \ | |
419 | --grep="[\d]\|" | |
420 | fi && | |
9df46763 ÆAB |
421 | test_cmp expect.fixed actual.fixed.short-arg && |
422 | test_cmp expect.extended actual.extended.short-arg && | |
7531a2dd ÆAB |
423 | if test_have_prereq PCRE |
424 | then | |
425 | test_cmp expect.perl actual.perl.short-arg | |
426 | fi && | |
9df46763 ÆAB |
427 | |
428 | git log --pretty=tformat:%s --fixed-strings \ | |
429 | --grep="(1|2)" >actual.fixed.long-arg && | |
430 | git log --pretty=tformat:%s --basic-regexp \ | |
431 | --grep="(.|.)" >actual.basic.long-arg && | |
432 | git log --pretty=tformat:%s --extended-regexp \ | |
433 | --grep="\|2" >actual.extended.long-arg && | |
434 | if test_have_prereq PCRE | |
435 | then | |
436 | git log --pretty=tformat:%s --perl-regexp \ | |
437 | --grep="[\d]\|" >actual.perl.long-arg && | |
438 | test_cmp expect.perl actual.perl.long-arg | |
9001c192 ÆAB |
439 | else |
440 | test_must_fail git log --perl-regexp \ | |
441 | --grep="[\d]\|" | |
9df46763 ÆAB |
442 | fi && |
443 | test_cmp expect.fixed actual.fixed.long-arg && | |
444 | test_cmp expect.basic actual.basic.long-arg && | |
445 | test_cmp expect.extended actual.extended.long-arg | |
446 | ) | |
447 | ' | |
448 | ||
289e1623 TR |
449 | cat > expect <<EOF |
450 | * Second | |
451 | * sixth | |
452 | * fifth | |
453 | * fourth | |
454 | * third | |
455 | * second | |
456 | * initial | |
457 | EOF | |
458 | ||
459 | test_expect_success 'simple log --graph' ' | |
989eea95 | 460 | test_cmp_graph |
289e1623 TR |
461 | ' |
462 | ||
660e113c JK |
463 | cat > expect <<EOF |
464 | 123 * Second | |
465 | 123 * sixth | |
466 | 123 * fifth | |
467 | 123 * fourth | |
468 | 123 * third | |
469 | 123 * second | |
470 | 123 * initial | |
471 | EOF | |
472 | ||
473 | test_expect_success 'simple log --graph --line-prefix="123 "' ' | |
989eea95 | 474 | test_cmp_graph --line-prefix="123 " |
660e113c JK |
475 | ' |
476 | ||
289e1623 TR |
477 | test_expect_success 'set up merge history' ' |
478 | git checkout -b side HEAD~4 && | |
479 | test_commit side-1 1 1 && | |
480 | test_commit side-2 2 2 && | |
481 | git checkout master && | |
482 | git merge side | |
483 | ' | |
484 | ||
485 | cat > expect <<\EOF | |
486 | * Merge branch 'side' | |
487 | |\ | |
488 | | * side-2 | |
489 | | * side-1 | |
490 | * | Second | |
491 | * | sixth | |
492 | * | fifth | |
493 | * | fourth | |
494 | |/ | |
495 | * third | |
496 | * second | |
497 | * initial | |
498 | EOF | |
499 | ||
500 | test_expect_success 'log --graph with merge' ' | |
989eea95 | 501 | test_cmp_graph --date-order |
289e1623 TR |
502 | ' |
503 | ||
660e113c JK |
504 | cat > expect <<\EOF |
505 | | | | * Merge branch 'side' | |
506 | | | | |\ | |
507 | | | | | * side-2 | |
508 | | | | | * side-1 | |
509 | | | | * | Second | |
510 | | | | * | sixth | |
511 | | | | * | fifth | |
512 | | | | * | fourth | |
513 | | | | |/ | |
514 | | | | * third | |
515 | | | | * second | |
516 | | | | * initial | |
517 | EOF | |
518 | ||
519 | test_expect_success 'log --graph --line-prefix="| | | " with merge' ' | |
989eea95 | 520 | test_cmp_graph --line-prefix="| | | " --date-order |
660e113c JK |
521 | ' |
522 | ||
73c727d6 NTND |
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> | |
533 | * third | |
534 | * second | |
535 | * initial | |
536 | EOF | |
537 | ||
538 | test_expect_success 'log --graph with merge with log.graphColors' ' | |
55cccf4b | 539 | test_config log.graphColors " blue,invalid-color, cyan, red , " && |
ffe00557 | 540 | lib_test_cmp_colored_graph --date-order --format=%s |
73c727d6 NTND |
541 | ' |
542 | ||
656197ad MK |
543 | test_expect_success 'log --raw --graph -m with merge' ' |
544 | git log --raw --graph --oneline -m master | head -n 500 >actual && | |
545 | grep "initial" actual | |
546 | ' | |
547 | ||
548 | test_expect_success 'diff-tree --graph' ' | |
549 | git diff-tree --graph master^ | head -n 500 >actual && | |
550 | grep "one" actual | |
551 | ' | |
552 | ||
289e1623 TR |
553 | cat > expect <<\EOF |
554 | * commit master | |
555 | |\ Merge: A B | |
556 | | | Author: A U Thor <author@example.com> | |
557 | | | | |
558 | | | Merge branch 'side' | |
559 | | | | |
ef1e7406 | 560 | | * commit tags/side-2 |
289e1623 TR |
561 | | | Author: A U Thor <author@example.com> |
562 | | | | |
563 | | | side-2 | |
564 | | | | |
565 | | * commit tags/side-1 | |
566 | | | Author: A U Thor <author@example.com> | |
567 | | | | |
568 | | | side-1 | |
569 | | | | |
570 | * | commit master~1 | |
571 | | | Author: A U Thor <author@example.com> | |
572 | | | | |
573 | | | Second | |
574 | | | | |
575 | * | commit master~2 | |
576 | | | Author: A U Thor <author@example.com> | |
577 | | | | |
578 | | | sixth | |
579 | | | | |
580 | * | commit master~3 | |
581 | | | Author: A U Thor <author@example.com> | |
582 | | | | |
583 | | | fifth | |
584 | | | | |
585 | * | commit master~4 | |
586 | |/ Author: A U Thor <author@example.com> | |
587 | | | |
588 | | fourth | |
589 | | | |
590 | * commit tags/side-1~1 | |
591 | | Author: A U Thor <author@example.com> | |
592 | | | |
593 | | third | |
594 | | | |
595 | * commit tags/side-1~2 | |
596 | | Author: A U Thor <author@example.com> | |
597 | | | |
598 | | second | |
599 | | | |
600 | * commit tags/side-1~3 | |
601 | Author: A U Thor <author@example.com> | |
602 | ||
603 | initial | |
604 | EOF | |
605 | ||
606 | test_expect_success 'log --graph with full output' ' | |
607 | git log --graph --date-order --pretty=short | | |
608 | git name-rev --name-only --stdin | | |
9524cf29 | 609 | sed "s/Merge:.*/Merge: A B/;s/ *\$//" >actual && |
289e1623 TR |
610 | test_cmp expect actual |
611 | ' | |
612 | ||
613 | test_expect_success 'set up more tangled history' ' | |
614 | git checkout -b tangle HEAD~6 && | |
615 | test_commit tangle-a tangle-a a && | |
616 | git merge master~3 && | |
617 | git merge side~1 && | |
618 | git checkout master && | |
7b1d6269 AC |
619 | git merge tangle && |
620 | git checkout -b reach && | |
621 | test_commit reach && | |
622 | git checkout master && | |
623 | git checkout -b octopus-a && | |
624 | test_commit octopus-a && | |
625 | git checkout master && | |
626 | git checkout -b octopus-b && | |
627 | test_commit octopus-b && | |
628 | git checkout master && | |
629 | test_commit seventh && | |
a48fcd83 | 630 | git merge octopus-a octopus-b && |
7b1d6269 | 631 | git merge reach |
289e1623 TR |
632 | ' |
633 | ||
634 | cat > expect <<\EOF | |
57b58db7 | 635 | * Merge tag 'reach' |
7b1d6269 AC |
636 | |\ |
637 | | \ | |
638 | | \ | |
57b58db7 | 639 | *-. \ Merge tags 'octopus-a' and 'octopus-b' |
7b1d6269 AC |
640 | |\ \ \ |
641 | * | | | seventh | |
642 | | | * | octopus-b | |
643 | | |/ / | |
644 | |/| | | |
645 | | * | octopus-a | |
646 | |/ / | |
647 | | * reach | |
648 | |/ | |
289e1623 TR |
649 | * Merge branch 'tangle' |
650 | |\ | |
651 | | * Merge branch 'side' (early part) into tangle | |
652 | | |\ | |
653 | | * \ Merge branch 'master' (early part) into tangle | |
654 | | |\ \ | |
655 | | * | | tangle-a | |
656 | * | | | Merge branch 'side' | |
657 | |\ \ \ \ | |
658 | | * | | | side-2 | |
eaf158f8 | 659 | | | |_|/ |
289e1623 TR |
660 | | |/| | |
661 | | * | | side-1 | |
662 | * | | | Second | |
663 | * | | | sixth | |
eaf158f8 | 664 | | |_|/ |
289e1623 TR |
665 | |/| | |
666 | * | | fifth | |
667 | * | | fourth | |
668 | |/ / | |
479db18b | 669 | * / third |
289e1623 TR |
670 | |/ |
671 | * second | |
672 | * initial | |
673 | EOF | |
674 | ||
95110d75 | 675 | test_expect_success 'log --graph with merge' ' |
989eea95 | 676 | test_cmp_graph --date-order |
289e1623 TR |
677 | ' |
678 | ||
8a3d203b | 679 | test_expect_success 'log.decorate configuration' ' |
940a911f | 680 | git log --oneline --no-decorate >expect.none && |
4f62c2bc JH |
681 | git log --oneline --decorate >expect.short && |
682 | git log --oneline --decorate=full >expect.full && | |
8a3d203b JH |
683 | |
684 | echo "[log] decorate" >>.git/config && | |
635530a2 | 685 | git log --oneline >actual && |
4f62c2bc | 686 | test_cmp expect.short actual && |
8a3d203b | 687 | |
90e76b70 | 688 | test_config log.decorate true && |
4f62c2bc | 689 | git log --oneline >actual && |
8a3d203b | 690 | test_cmp expect.short actual && |
4f62c2bc | 691 | git log --oneline --decorate=full >actual && |
8a3d203b | 692 | test_cmp expect.full actual && |
4f62c2bc | 693 | git log --oneline --decorate=no >actual && |
8a3d203b JH |
694 | test_cmp expect.none actual && |
695 | ||
90e76b70 | 696 | test_config log.decorate no && |
4f62c2bc | 697 | git log --oneline >actual && |
8a3d203b | 698 | test_cmp expect.none actual && |
4f62c2bc | 699 | git log --oneline --decorate >actual && |
8a3d203b | 700 | test_cmp expect.short actual && |
4f62c2bc | 701 | git log --oneline --decorate=full >actual && |
8a3d203b JH |
702 | test_cmp expect.full actual && |
703 | ||
90e76b70 | 704 | test_config log.decorate 1 && |
b2be2f6a JK |
705 | git log --oneline >actual && |
706 | test_cmp expect.short actual && | |
707 | git log --oneline --decorate=full >actual && | |
708 | test_cmp expect.full actual && | |
709 | git log --oneline --decorate=no >actual && | |
710 | test_cmp expect.none actual && | |
711 | ||
90e76b70 | 712 | test_config log.decorate short && |
4f62c2bc | 713 | git log --oneline >actual && |
8a3d203b | 714 | test_cmp expect.short actual && |
4f62c2bc | 715 | git log --oneline --no-decorate >actual && |
8a3d203b | 716 | test_cmp expect.none actual && |
4f62c2bc | 717 | git log --oneline --decorate=full >actual && |
8a3d203b JH |
718 | test_cmp expect.full actual && |
719 | ||
90e76b70 | 720 | test_config log.decorate full && |
4f62c2bc | 721 | git log --oneline >actual && |
8a3d203b | 722 | test_cmp expect.full actual && |
4f62c2bc | 723 | git log --oneline --no-decorate >actual && |
8a3d203b | 724 | test_cmp expect.none actual && |
4f62c2bc | 725 | git log --oneline --decorate >actual && |
8fb26872 | 726 | test_cmp expect.short actual && |
8a3d203b | 727 | |
90e76b70 | 728 | test_unconfig log.decorate && |
0c47695a | 729 | git log --pretty=raw >expect.raw && |
90e76b70 | 730 | test_config log.decorate full && |
0c47695a JS |
731 | git log --pretty=raw >actual && |
732 | test_cmp expect.raw actual | |
733 | ||
734 | ' | |
735 | ||
65516f58 RA |
736 | test_expect_success 'decorate-refs with glob' ' |
737 | cat >expect.decorate <<-\EOF && | |
738 | Merge-tag-reach | |
739 | Merge-tags-octopus-a-and-octopus-b | |
740 | seventh | |
741 | octopus-b (octopus-b) | |
742 | octopus-a (octopus-a) | |
743 | reach | |
744 | EOF | |
745 | git log -n6 --decorate=short --pretty="tformat:%f%d" \ | |
746 | --decorate-refs="heads/octopus*" >actual && | |
747 | test_cmp expect.decorate actual | |
748 | ' | |
749 | ||
750 | test_expect_success 'decorate-refs without globs' ' | |
751 | cat >expect.decorate <<-\EOF && | |
752 | Merge-tag-reach | |
753 | Merge-tags-octopus-a-and-octopus-b | |
754 | seventh | |
755 | octopus-b | |
756 | octopus-a | |
757 | reach (tag: reach) | |
758 | EOF | |
759 | git log -n6 --decorate=short --pretty="tformat:%f%d" \ | |
760 | --decorate-refs="tags/reach" >actual && | |
761 | test_cmp expect.decorate actual | |
762 | ' | |
763 | ||
764 | test_expect_success 'multiple decorate-refs' ' | |
765 | cat >expect.decorate <<-\EOF && | |
766 | Merge-tag-reach | |
767 | Merge-tags-octopus-a-and-octopus-b | |
768 | seventh | |
769 | octopus-b (octopus-b) | |
770 | octopus-a (octopus-a) | |
771 | reach (tag: reach) | |
772 | EOF | |
773 | git log -n6 --decorate=short --pretty="tformat:%f%d" \ | |
774 | --decorate-refs="heads/octopus*" \ | |
775 | --decorate-refs="tags/reach" >actual && | |
776 | test_cmp expect.decorate actual | |
777 | ' | |
778 | ||
779 | test_expect_success 'decorate-refs-exclude with glob' ' | |
780 | cat >expect.decorate <<-\EOF && | |
781 | Merge-tag-reach (HEAD -> master) | |
782 | Merge-tags-octopus-a-and-octopus-b | |
783 | seventh (tag: seventh) | |
784 | octopus-b (tag: octopus-b) | |
785 | octopus-a (tag: octopus-a) | |
786 | reach (tag: reach, reach) | |
787 | EOF | |
788 | git log -n6 --decorate=short --pretty="tformat:%f%d" \ | |
789 | --decorate-refs-exclude="heads/octopus*" >actual && | |
790 | test_cmp expect.decorate actual | |
791 | ' | |
792 | ||
793 | test_expect_success 'decorate-refs-exclude without globs' ' | |
794 | cat >expect.decorate <<-\EOF && | |
795 | Merge-tag-reach (HEAD -> master) | |
796 | Merge-tags-octopus-a-and-octopus-b | |
797 | seventh (tag: seventh) | |
798 | octopus-b (tag: octopus-b, octopus-b) | |
799 | octopus-a (tag: octopus-a, octopus-a) | |
800 | reach (reach) | |
801 | EOF | |
802 | git log -n6 --decorate=short --pretty="tformat:%f%d" \ | |
803 | --decorate-refs-exclude="tags/reach" >actual && | |
804 | test_cmp expect.decorate actual | |
805 | ' | |
806 | ||
807 | test_expect_success 'multiple decorate-refs-exclude' ' | |
808 | cat >expect.decorate <<-\EOF && | |
809 | Merge-tag-reach (HEAD -> master) | |
810 | Merge-tags-octopus-a-and-octopus-b | |
811 | seventh (tag: seventh) | |
812 | octopus-b (tag: octopus-b) | |
813 | octopus-a (tag: octopus-a) | |
814 | reach (reach) | |
815 | EOF | |
816 | git log -n6 --decorate=short --pretty="tformat:%f%d" \ | |
817 | --decorate-refs-exclude="heads/octopus*" \ | |
818 | --decorate-refs-exclude="tags/reach" >actual && | |
819 | test_cmp expect.decorate actual | |
820 | ' | |
821 | ||
822 | test_expect_success 'decorate-refs and decorate-refs-exclude' ' | |
823 | cat >expect.decorate <<-\EOF && | |
824 | Merge-tag-reach (master) | |
825 | Merge-tags-octopus-a-and-octopus-b | |
826 | seventh | |
827 | octopus-b | |
828 | octopus-a | |
829 | reach (reach) | |
830 | EOF | |
831 | git log -n6 --decorate=short --pretty="tformat:%f%d" \ | |
832 | --decorate-refs="heads/*" \ | |
833 | --decorate-refs-exclude="heads/oc*" >actual && | |
834 | test_cmp expect.decorate actual | |
835 | ' | |
836 | ||
0cc7380d | 837 | test_expect_success 'decorate-refs-exclude and simplify-by-decoration' ' |
b4ecbcf6 RS |
838 | cat >expect.decorate <<-\EOF && |
839 | Merge-tag-reach (HEAD -> master) | |
840 | reach (tag: reach, reach) | |
841 | seventh (tag: seventh) | |
842 | Merge-branch-tangle | |
843 | Merge-branch-side-early-part-into-tangle (tangle) | |
844 | tangle-a (tag: tangle-a) | |
845 | EOF | |
846 | git log -n6 --decorate=short --pretty="tformat:%f%d" \ | |
847 | --decorate-refs-exclude="*octopus*" \ | |
848 | --simplify-by-decoration >actual && | |
849 | test_cmp expect.decorate actual | |
850 | ' | |
851 | ||
c74271aa | 852 | test_expect_success 'log.decorate config parsing' ' |
853 | git log --oneline --decorate=full >expect.full && | |
854 | git log --oneline --decorate=short >expect.short && | |
855 | ||
856 | test_config log.decorate full && | |
857 | test_config log.mailmap true && | |
858 | git log --oneline >actual && | |
859 | test_cmp expect.full actual && | |
860 | git log --oneline --decorate=short >actual && | |
861 | test_cmp expect.short actual | |
862 | ' | |
863 | ||
940a911f | 864 | test_expect_success TTY 'log output on a TTY' ' |
e433749d | 865 | git log --color --oneline --decorate >expect.short && |
940a911f AH |
866 | |
867 | test_terminal git log --oneline >actual && | |
868 | test_cmp expect.short actual | |
869 | ' | |
870 | ||
0c47695a | 871 | test_expect_success 'reflog is expected format' ' |
0c47695a JS |
872 | git log -g --abbrev-commit --pretty=oneline >expect && |
873 | git reflog >actual && | |
874 | test_cmp expect actual | |
875 | ' | |
876 | ||
877 | test_expect_success 'whatchanged is expected format' ' | |
878 | git log --no-merges --raw >expect && | |
879 | git whatchanged >actual && | |
880 | test_cmp expect actual | |
881 | ' | |
882 | ||
883 | test_expect_success 'log.abbrevCommit configuration' ' | |
0c47695a JS |
884 | git log --abbrev-commit >expect.log.abbrev && |
885 | git log --no-abbrev-commit >expect.log.full && | |
886 | git log --pretty=raw >expect.log.raw && | |
887 | git reflog --abbrev-commit >expect.reflog.abbrev && | |
888 | git reflog --no-abbrev-commit >expect.reflog.full && | |
889 | git whatchanged --abbrev-commit >expect.whatchanged.abbrev && | |
890 | git whatchanged --no-abbrev-commit >expect.whatchanged.full && | |
891 | ||
90e76b70 | 892 | test_config log.abbrevCommit true && |
0c47695a JS |
893 | |
894 | git log >actual && | |
895 | test_cmp expect.log.abbrev actual && | |
896 | git log --no-abbrev-commit >actual && | |
897 | test_cmp expect.log.full actual && | |
898 | ||
899 | git log --pretty=raw >actual && | |
900 | test_cmp expect.log.raw actual && | |
901 | ||
902 | git reflog >actual && | |
903 | test_cmp expect.reflog.abbrev actual && | |
904 | git reflog --no-abbrev-commit >actual && | |
905 | test_cmp expect.reflog.full actual && | |
906 | ||
907 | git whatchanged >actual && | |
908 | test_cmp expect.whatchanged.abbrev actual && | |
909 | git whatchanged --no-abbrev-commit >actual && | |
910 | test_cmp expect.whatchanged.full actual | |
8a3d203b JH |
911 | ' |
912 | ||
65113121 ÆAB |
913 | test_expect_success 'show added path under "--follow -M"' ' |
914 | # This tests for a regression introduced in v1.7.2-rc0~103^2~2 | |
915 | test_create_repo regression && | |
916 | ( | |
917 | cd regression && | |
918 | test_commit needs-another-commit && | |
919 | test_commit foo.bar && | |
920 | git log -M --follow -p foo.bar.t && | |
921 | git log -M --follow --stat foo.bar.t && | |
922 | git log -M --follow --name-only foo.bar.t | |
923 | ) | |
924 | ' | |
c65233fe | 925 | |
46ec510a CB |
926 | test_expect_success 'git log -c --follow' ' |
927 | test_create_repo follow-c && | |
928 | ( | |
929 | cd follow-c && | |
930 | test_commit initial file original && | |
931 | git rm file && | |
932 | test_commit rename file2 original && | |
933 | git reset --hard initial && | |
934 | test_commit modify file foo && | |
935 | git merge -m merge rename && | |
936 | git log -c --follow file2 | |
937 | ) | |
938 | ' | |
939 | ||
e2c59667 LP |
940 | cat >expect <<\EOF |
941 | * commit COMMIT_OBJECT_NAME | |
942 | |\ Merge: MERGE_PARENTS | |
943 | | | Author: A U Thor <author@example.com> | |
944 | | | | |
945 | | | Merge HEADS DESCRIPTION | |
946 | | | | |
947 | | * commit COMMIT_OBJECT_NAME | |
948 | | | Author: A U Thor <author@example.com> | |
949 | | | | |
950 | | | reach | |
951 | | | --- | |
dc801e71 | 952 | | | reach.t | 1 + |
e2c59667 LP |
953 | | | 1 file changed, 1 insertion(+) |
954 | | | | |
955 | | | diff --git a/reach.t b/reach.t | |
956 | | | new file mode 100644 | |
cb78f4f0 | 957 | | | index BEFORE..AFTER |
e2c59667 LP |
958 | | | --- /dev/null |
959 | | | +++ b/reach.t | |
960 | | | @@ -0,0 +1 @@ | |
961 | | | +reach | |
962 | | | | |
963 | | \ | |
964 | *-. \ commit COMMIT_OBJECT_NAME | |
965 | |\ \ \ Merge: MERGE_PARENTS | |
966 | | | | | Author: A U Thor <author@example.com> | |
967 | | | | | | |
968 | | | | | Merge HEADS DESCRIPTION | |
969 | | | | | | |
970 | | | * | commit COMMIT_OBJECT_NAME | |
971 | | | |/ Author: A U Thor <author@example.com> | |
972 | | | | | |
973 | | | | octopus-b | |
974 | | | | --- | |
dc801e71 | 975 | | | | octopus-b.t | 1 + |
e2c59667 LP |
976 | | | | 1 file changed, 1 insertion(+) |
977 | | | | | |
978 | | | | diff --git a/octopus-b.t b/octopus-b.t | |
979 | | | | new file mode 100644 | |
cb78f4f0 | 980 | | | | index BEFORE..AFTER |
e2c59667 LP |
981 | | | | --- /dev/null |
982 | | | | +++ b/octopus-b.t | |
983 | | | | @@ -0,0 +1 @@ | |
984 | | | | +octopus-b | |
985 | | | | | |
986 | | * | commit COMMIT_OBJECT_NAME | |
987 | | |/ Author: A U Thor <author@example.com> | |
988 | | | | |
989 | | | octopus-a | |
990 | | | --- | |
dc801e71 | 991 | | | octopus-a.t | 1 + |
e2c59667 LP |
992 | | | 1 file changed, 1 insertion(+) |
993 | | | | |
994 | | | diff --git a/octopus-a.t b/octopus-a.t | |
995 | | | new file mode 100644 | |
cb78f4f0 | 996 | | | index BEFORE..AFTER |
e2c59667 LP |
997 | | | --- /dev/null |
998 | | | +++ b/octopus-a.t | |
999 | | | @@ -0,0 +1 @@ | |
1000 | | | +octopus-a | |
1001 | | | | |
1002 | * | commit COMMIT_OBJECT_NAME | |
1003 | |/ Author: A U Thor <author@example.com> | |
1004 | | | |
1005 | | seventh | |
1006 | | --- | |
dc801e71 | 1007 | | seventh.t | 1 + |
e2c59667 LP |
1008 | | 1 file changed, 1 insertion(+) |
1009 | | | |
1010 | | diff --git a/seventh.t b/seventh.t | |
1011 | | new file mode 100644 | |
cb78f4f0 | 1012 | | index BEFORE..AFTER |
e2c59667 LP |
1013 | | --- /dev/null |
1014 | | +++ b/seventh.t | |
1015 | | @@ -0,0 +1 @@ | |
1016 | | +seventh | |
1017 | | | |
1018 | * commit COMMIT_OBJECT_NAME | |
1019 | |\ Merge: MERGE_PARENTS | |
1020 | | | Author: A U Thor <author@example.com> | |
1021 | | | | |
1022 | | | Merge branch 'tangle' | |
1023 | | | | |
1024 | | * commit COMMIT_OBJECT_NAME | |
1025 | | |\ Merge: MERGE_PARENTS | |
1026 | | | | Author: A U Thor <author@example.com> | |
1027 | | | | | |
1028 | | | | Merge branch 'side' (early part) into tangle | |
1029 | | | | | |
1030 | | * | commit COMMIT_OBJECT_NAME | |
1031 | | |\ \ Merge: MERGE_PARENTS | |
1032 | | | | | Author: A U Thor <author@example.com> | |
1033 | | | | | | |
1034 | | | | | Merge branch 'master' (early part) into tangle | |
1035 | | | | | | |
1036 | | * | | commit COMMIT_OBJECT_NAME | |
1037 | | | | | Author: A U Thor <author@example.com> | |
1038 | | | | | | |
1039 | | | | | tangle-a | |
1040 | | | | | --- | |
dc801e71 | 1041 | | | | | tangle-a | 1 + |
e2c59667 LP |
1042 | | | | | 1 file changed, 1 insertion(+) |
1043 | | | | | | |
1044 | | | | | diff --git a/tangle-a b/tangle-a | |
1045 | | | | | new file mode 100644 | |
cb78f4f0 | 1046 | | | | | index BEFORE..AFTER |
e2c59667 LP |
1047 | | | | | --- /dev/null |
1048 | | | | | +++ b/tangle-a | |
1049 | | | | | @@ -0,0 +1 @@ | |
1050 | | | | | +a | |
1051 | | | | | | |
1052 | * | | | commit COMMIT_OBJECT_NAME | |
1053 | |\ \ \ \ Merge: MERGE_PARENTS | |
1054 | | | | | | Author: A U Thor <author@example.com> | |
1055 | | | | | | | |
1056 | | | | | | Merge branch 'side' | |
1057 | | | | | | | |
1058 | | * | | | commit COMMIT_OBJECT_NAME | |
1059 | | | |_|/ Author: A U Thor <author@example.com> | |
1060 | | |/| | | |
1061 | | | | | side-2 | |
1062 | | | | | --- | |
dc801e71 | 1063 | | | | | 2 | 1 + |
e2c59667 LP |
1064 | | | | | 1 file changed, 1 insertion(+) |
1065 | | | | | | |
1066 | | | | | diff --git a/2 b/2 | |
1067 | | | | | new file mode 100644 | |
cb78f4f0 | 1068 | | | | | index BEFORE..AFTER |
e2c59667 LP |
1069 | | | | | --- /dev/null |
1070 | | | | | +++ b/2 | |
1071 | | | | | @@ -0,0 +1 @@ | |
1072 | | | | | +2 | |
1073 | | | | | | |
1074 | | * | | commit COMMIT_OBJECT_NAME | |
1075 | | | | | Author: A U Thor <author@example.com> | |
1076 | | | | | | |
1077 | | | | | side-1 | |
1078 | | | | | --- | |
dc801e71 | 1079 | | | | | 1 | 1 + |
e2c59667 LP |
1080 | | | | | 1 file changed, 1 insertion(+) |
1081 | | | | | | |
1082 | | | | | diff --git a/1 b/1 | |
1083 | | | | | new file mode 100644 | |
cb78f4f0 | 1084 | | | | | index BEFORE..AFTER |
e2c59667 LP |
1085 | | | | | --- /dev/null |
1086 | | | | | +++ b/1 | |
1087 | | | | | @@ -0,0 +1 @@ | |
1088 | | | | | +1 | |
1089 | | | | | | |
1090 | * | | | commit COMMIT_OBJECT_NAME | |
1091 | | | | | Author: A U Thor <author@example.com> | |
1092 | | | | | | |
1093 | | | | | Second | |
1094 | | | | | --- | |
dc801e71 | 1095 | | | | | one | 1 + |
e2c59667 LP |
1096 | | | | | 1 file changed, 1 insertion(+) |
1097 | | | | | | |
1098 | | | | | diff --git a/one b/one | |
1099 | | | | | new file mode 100644 | |
cb78f4f0 | 1100 | | | | | index BEFORE..AFTER |
e2c59667 LP |
1101 | | | | | --- /dev/null |
1102 | | | | | +++ b/one | |
1103 | | | | | @@ -0,0 +1 @@ | |
1104 | | | | | +case | |
1105 | | | | | | |
1106 | * | | | commit COMMIT_OBJECT_NAME | |
1107 | | |_|/ Author: A U Thor <author@example.com> | |
1108 | |/| | | |
1109 | | | | sixth | |
1110 | | | | --- | |
dc801e71 | 1111 | | | | a/two | 1 - |
e2c59667 LP |
1112 | | | | 1 file changed, 1 deletion(-) |
1113 | | | | | |
1114 | | | | diff --git a/a/two b/a/two | |
1115 | | | | deleted file mode 100644 | |
cb78f4f0 | 1116 | | | | index BEFORE..AFTER |
e2c59667 LP |
1117 | | | | --- a/a/two |
1118 | | | | +++ /dev/null | |
1119 | | | | @@ -1 +0,0 @@ | |
1120 | | | | -ni | |
1121 | | | | | |
1122 | * | | commit COMMIT_OBJECT_NAME | |
1123 | | | | Author: A U Thor <author@example.com> | |
1124 | | | | | |
1125 | | | | fifth | |
1126 | | | | --- | |
dc801e71 | 1127 | | | | a/two | 1 + |
e2c59667 LP |
1128 | | | | 1 file changed, 1 insertion(+) |
1129 | | | | | |
1130 | | | | diff --git a/a/two b/a/two | |
1131 | | | | new file mode 100644 | |
cb78f4f0 | 1132 | | | | index BEFORE..AFTER |
e2c59667 LP |
1133 | | | | --- /dev/null |
1134 | | | | +++ b/a/two | |
1135 | | | | @@ -0,0 +1 @@ | |
1136 | | | | +ni | |
1137 | | | | | |
1138 | * | | commit COMMIT_OBJECT_NAME | |
1139 | |/ / Author: A U Thor <author@example.com> | |
1140 | | | | |
1141 | | | fourth | |
1142 | | | --- | |
dc801e71 | 1143 | | | ein | 1 + |
e2c59667 LP |
1144 | | | 1 file changed, 1 insertion(+) |
1145 | | | | |
1146 | | | diff --git a/ein b/ein | |
1147 | | | new file mode 100644 | |
cb78f4f0 | 1148 | | | index BEFORE..AFTER |
e2c59667 LP |
1149 | | | --- /dev/null |
1150 | | | +++ b/ein | |
1151 | | | @@ -0,0 +1 @@ | |
1152 | | | +ichi | |
1153 | | | | |
1154 | * | commit COMMIT_OBJECT_NAME | |
1155 | |/ Author: A U Thor <author@example.com> | |
1156 | | | |
1157 | | third | |
1158 | | --- | |
dc801e71 ZJS |
1159 | | ichi | 1 + |
1160 | | one | 1 - | |
e2c59667 LP |
1161 | | 2 files changed, 1 insertion(+), 1 deletion(-) |
1162 | | | |
1163 | | diff --git a/ichi b/ichi | |
1164 | | new file mode 100644 | |
cb78f4f0 | 1165 | | index BEFORE..AFTER |
e2c59667 LP |
1166 | | --- /dev/null |
1167 | | +++ b/ichi | |
1168 | | @@ -0,0 +1 @@ | |
1169 | | +ichi | |
1170 | | diff --git a/one b/one | |
1171 | | deleted file mode 100644 | |
cb78f4f0 | 1172 | | index BEFORE..AFTER |
e2c59667 LP |
1173 | | --- a/one |
1174 | | +++ /dev/null | |
1175 | | @@ -1 +0,0 @@ | |
1176 | | -ichi | |
1177 | | | |
1178 | * commit COMMIT_OBJECT_NAME | |
1179 | | Author: A U Thor <author@example.com> | |
1180 | | | |
1181 | | second | |
1182 | | --- | |
dc801e71 | 1183 | | one | 2 +- |
e2c59667 LP |
1184 | | 1 file changed, 1 insertion(+), 1 deletion(-) |
1185 | | | |
1186 | | diff --git a/one b/one | |
cb78f4f0 | 1187 | | index BEFORE..AFTER 100644 |
e2c59667 LP |
1188 | | --- a/one |
1189 | | +++ b/one | |
1190 | | @@ -1 +1 @@ | |
1191 | | -one | |
1192 | | +ichi | |
1193 | | | |
1194 | * commit COMMIT_OBJECT_NAME | |
1195 | Author: A U Thor <author@example.com> | |
1196 | ||
1197 | initial | |
1198 | --- | |
dc801e71 | 1199 | one | 1 + |
e2c59667 LP |
1200 | 1 file changed, 1 insertion(+) |
1201 | ||
1202 | diff --git a/one b/one | |
1203 | new file mode 100644 | |
cb78f4f0 | 1204 | index BEFORE..AFTER |
e2c59667 LP |
1205 | --- /dev/null |
1206 | +++ b/one | |
1207 | @@ -0,0 +1 @@ | |
1208 | +one | |
1209 | EOF | |
1210 | ||
e2c59667 | 1211 | test_expect_success 'log --graph with diff and stats' ' |
989eea95 | 1212 | lib_test_cmp_short_graph --no-renames --stat -p |
e2c59667 LP |
1213 | ' |
1214 | ||
660e113c JK |
1215 | cat >expect <<\EOF |
1216 | *** * commit COMMIT_OBJECT_NAME | |
1217 | *** |\ Merge: MERGE_PARENTS | |
1218 | *** | | Author: A U Thor <author@example.com> | |
1219 | *** | | | |
1220 | *** | | Merge HEADS DESCRIPTION | |
1221 | *** | | | |
1222 | *** | * commit COMMIT_OBJECT_NAME | |
1223 | *** | | Author: A U Thor <author@example.com> | |
1224 | *** | | | |
1225 | *** | | reach | |
1226 | *** | | --- | |
1227 | *** | | reach.t | 1 + | |
1228 | *** | | 1 file changed, 1 insertion(+) | |
1229 | *** | | | |
1230 | *** | | diff --git a/reach.t b/reach.t | |
1231 | *** | | new file mode 100644 | |
cb78f4f0 | 1232 | *** | | index BEFORE..AFTER |
660e113c JK |
1233 | *** | | --- /dev/null |
1234 | *** | | +++ b/reach.t | |
1235 | *** | | @@ -0,0 +1 @@ | |
1236 | *** | | +reach | |
1237 | *** | | | |
1238 | *** | \ | |
1239 | *** *-. \ commit COMMIT_OBJECT_NAME | |
1240 | *** |\ \ \ Merge: MERGE_PARENTS | |
1241 | *** | | | | Author: A U Thor <author@example.com> | |
1242 | *** | | | | | |
1243 | *** | | | | Merge HEADS DESCRIPTION | |
1244 | *** | | | | | |
1245 | *** | | * | commit COMMIT_OBJECT_NAME | |
1246 | *** | | |/ Author: A U Thor <author@example.com> | |
1247 | *** | | | | |
1248 | *** | | | octopus-b | |
1249 | *** | | | --- | |
1250 | *** | | | octopus-b.t | 1 + | |
1251 | *** | | | 1 file changed, 1 insertion(+) | |
1252 | *** | | | | |
1253 | *** | | | diff --git a/octopus-b.t b/octopus-b.t | |
1254 | *** | | | new file mode 100644 | |
cb78f4f0 | 1255 | *** | | | index BEFORE..AFTER |
660e113c JK |
1256 | *** | | | --- /dev/null |
1257 | *** | | | +++ b/octopus-b.t | |
1258 | *** | | | @@ -0,0 +1 @@ | |
1259 | *** | | | +octopus-b | |
1260 | *** | | | | |
1261 | *** | * | commit COMMIT_OBJECT_NAME | |
1262 | *** | |/ Author: A U Thor <author@example.com> | |
1263 | *** | | | |
1264 | *** | | octopus-a | |
1265 | *** | | --- | |
1266 | *** | | octopus-a.t | 1 + | |
1267 | *** | | 1 file changed, 1 insertion(+) | |
1268 | *** | | | |
1269 | *** | | diff --git a/octopus-a.t b/octopus-a.t | |
1270 | *** | | new file mode 100644 | |
cb78f4f0 | 1271 | *** | | index BEFORE..AFTER |
660e113c JK |
1272 | *** | | --- /dev/null |
1273 | *** | | +++ b/octopus-a.t | |
1274 | *** | | @@ -0,0 +1 @@ | |
1275 | *** | | +octopus-a | |
1276 | *** | | | |
1277 | *** * | commit COMMIT_OBJECT_NAME | |
1278 | *** |/ Author: A U Thor <author@example.com> | |
1279 | *** | | |
1280 | *** | seventh | |
1281 | *** | --- | |
1282 | *** | seventh.t | 1 + | |
1283 | *** | 1 file changed, 1 insertion(+) | |
1284 | *** | | |
1285 | *** | diff --git a/seventh.t b/seventh.t | |
1286 | *** | new file mode 100644 | |
cb78f4f0 | 1287 | *** | index BEFORE..AFTER |
660e113c JK |
1288 | *** | --- /dev/null |
1289 | *** | +++ b/seventh.t | |
1290 | *** | @@ -0,0 +1 @@ | |
1291 | *** | +seventh | |
1292 | *** | | |
1293 | *** * commit COMMIT_OBJECT_NAME | |
1294 | *** |\ Merge: MERGE_PARENTS | |
1295 | *** | | Author: A U Thor <author@example.com> | |
1296 | *** | | | |
1297 | *** | | Merge branch 'tangle' | |
1298 | *** | | | |
1299 | *** | * commit COMMIT_OBJECT_NAME | |
1300 | *** | |\ Merge: MERGE_PARENTS | |
1301 | *** | | | Author: A U Thor <author@example.com> | |
1302 | *** | | | | |
1303 | *** | | | Merge branch 'side' (early part) into tangle | |
1304 | *** | | | | |
1305 | *** | * | commit COMMIT_OBJECT_NAME | |
1306 | *** | |\ \ Merge: MERGE_PARENTS | |
1307 | *** | | | | Author: A U Thor <author@example.com> | |
1308 | *** | | | | | |
1309 | *** | | | | Merge branch 'master' (early part) into tangle | |
1310 | *** | | | | | |
1311 | *** | * | | commit COMMIT_OBJECT_NAME | |
1312 | *** | | | | Author: A U Thor <author@example.com> | |
1313 | *** | | | | | |
1314 | *** | | | | tangle-a | |
1315 | *** | | | | --- | |
1316 | *** | | | | tangle-a | 1 + | |
1317 | *** | | | | 1 file changed, 1 insertion(+) | |
1318 | *** | | | | | |
1319 | *** | | | | diff --git a/tangle-a b/tangle-a | |
1320 | *** | | | | new file mode 100644 | |
cb78f4f0 | 1321 | *** | | | | index BEFORE..AFTER |
660e113c JK |
1322 | *** | | | | --- /dev/null |
1323 | *** | | | | +++ b/tangle-a | |
1324 | *** | | | | @@ -0,0 +1 @@ | |
1325 | *** | | | | +a | |
1326 | *** | | | | | |
1327 | *** * | | | commit COMMIT_OBJECT_NAME | |
1328 | *** |\ \ \ \ Merge: MERGE_PARENTS | |
1329 | *** | | | | | Author: A U Thor <author@example.com> | |
1330 | *** | | | | | | |
1331 | *** | | | | | Merge branch 'side' | |
1332 | *** | | | | | | |
1333 | *** | * | | | commit COMMIT_OBJECT_NAME | |
1334 | *** | | |_|/ Author: A U Thor <author@example.com> | |
1335 | *** | |/| | | |
1336 | *** | | | | side-2 | |
1337 | *** | | | | --- | |
1338 | *** | | | | 2 | 1 + | |
1339 | *** | | | | 1 file changed, 1 insertion(+) | |
1340 | *** | | | | | |
1341 | *** | | | | diff --git a/2 b/2 | |
1342 | *** | | | | new file mode 100644 | |
cb78f4f0 | 1343 | *** | | | | index BEFORE..AFTER |
660e113c JK |
1344 | *** | | | | --- /dev/null |
1345 | *** | | | | +++ b/2 | |
1346 | *** | | | | @@ -0,0 +1 @@ | |
1347 | *** | | | | +2 | |
1348 | *** | | | | | |
1349 | *** | * | | commit COMMIT_OBJECT_NAME | |
1350 | *** | | | | Author: A U Thor <author@example.com> | |
1351 | *** | | | | | |
1352 | *** | | | | side-1 | |
1353 | *** | | | | --- | |
1354 | *** | | | | 1 | 1 + | |
1355 | *** | | | | 1 file changed, 1 insertion(+) | |
1356 | *** | | | | | |
1357 | *** | | | | diff --git a/1 b/1 | |
1358 | *** | | | | new file mode 100644 | |
cb78f4f0 | 1359 | *** | | | | index BEFORE..AFTER |
660e113c JK |
1360 | *** | | | | --- /dev/null |
1361 | *** | | | | +++ b/1 | |
1362 | *** | | | | @@ -0,0 +1 @@ | |
1363 | *** | | | | +1 | |
1364 | *** | | | | | |
1365 | *** * | | | commit COMMIT_OBJECT_NAME | |
1366 | *** | | | | Author: A U Thor <author@example.com> | |
1367 | *** | | | | | |
1368 | *** | | | | Second | |
1369 | *** | | | | --- | |
1370 | *** | | | | one | 1 + | |
1371 | *** | | | | 1 file changed, 1 insertion(+) | |
1372 | *** | | | | | |
1373 | *** | | | | diff --git a/one b/one | |
1374 | *** | | | | new file mode 100644 | |
cb78f4f0 | 1375 | *** | | | | index BEFORE..AFTER |
660e113c JK |
1376 | *** | | | | --- /dev/null |
1377 | *** | | | | +++ b/one | |
1378 | *** | | | | @@ -0,0 +1 @@ | |
1379 | *** | | | | +case | |
1380 | *** | | | | | |
1381 | *** * | | | commit COMMIT_OBJECT_NAME | |
1382 | *** | |_|/ Author: A U Thor <author@example.com> | |
1383 | *** |/| | | |
1384 | *** | | | sixth | |
1385 | *** | | | --- | |
1386 | *** | | | a/two | 1 - | |
1387 | *** | | | 1 file changed, 1 deletion(-) | |
1388 | *** | | | | |
1389 | *** | | | diff --git a/a/two b/a/two | |
1390 | *** | | | deleted file mode 100644 | |
cb78f4f0 | 1391 | *** | | | index BEFORE..AFTER |
660e113c JK |
1392 | *** | | | --- a/a/two |
1393 | *** | | | +++ /dev/null | |
1394 | *** | | | @@ -1 +0,0 @@ | |
1395 | *** | | | -ni | |
1396 | *** | | | | |
1397 | *** * | | commit COMMIT_OBJECT_NAME | |
1398 | *** | | | Author: A U Thor <author@example.com> | |
1399 | *** | | | | |
1400 | *** | | | fifth | |
1401 | *** | | | --- | |
1402 | *** | | | a/two | 1 + | |
1403 | *** | | | 1 file changed, 1 insertion(+) | |
1404 | *** | | | | |
1405 | *** | | | diff --git a/a/two b/a/two | |
1406 | *** | | | new file mode 100644 | |
cb78f4f0 | 1407 | *** | | | index BEFORE..AFTER |
660e113c JK |
1408 | *** | | | --- /dev/null |
1409 | *** | | | +++ b/a/two | |
1410 | *** | | | @@ -0,0 +1 @@ | |
1411 | *** | | | +ni | |
1412 | *** | | | | |
1413 | *** * | | commit COMMIT_OBJECT_NAME | |
1414 | *** |/ / Author: A U Thor <author@example.com> | |
1415 | *** | | | |
1416 | *** | | fourth | |
1417 | *** | | --- | |
1418 | *** | | ein | 1 + | |
1419 | *** | | 1 file changed, 1 insertion(+) | |
1420 | *** | | | |
1421 | *** | | diff --git a/ein b/ein | |
1422 | *** | | new file mode 100644 | |
cb78f4f0 | 1423 | *** | | index BEFORE..AFTER |
660e113c JK |
1424 | *** | | --- /dev/null |
1425 | *** | | +++ b/ein | |
1426 | *** | | @@ -0,0 +1 @@ | |
1427 | *** | | +ichi | |
1428 | *** | | | |
1429 | *** * | commit COMMIT_OBJECT_NAME | |
1430 | *** |/ Author: A U Thor <author@example.com> | |
1431 | *** | | |
1432 | *** | third | |
1433 | *** | --- | |
1434 | *** | ichi | 1 + | |
1435 | *** | one | 1 - | |
1436 | *** | 2 files changed, 1 insertion(+), 1 deletion(-) | |
1437 | *** | | |
1438 | *** | diff --git a/ichi b/ichi | |
1439 | *** | new file mode 100644 | |
cb78f4f0 | 1440 | *** | index BEFORE..AFTER |
660e113c JK |
1441 | *** | --- /dev/null |
1442 | *** | +++ b/ichi | |
1443 | *** | @@ -0,0 +1 @@ | |
1444 | *** | +ichi | |
1445 | *** | diff --git a/one b/one | |
1446 | *** | deleted file mode 100644 | |
cb78f4f0 | 1447 | *** | index BEFORE..AFTER |
660e113c JK |
1448 | *** | --- a/one |
1449 | *** | +++ /dev/null | |
1450 | *** | @@ -1 +0,0 @@ | |
1451 | *** | -ichi | |
1452 | *** | | |
1453 | *** * commit COMMIT_OBJECT_NAME | |
1454 | *** | Author: A U Thor <author@example.com> | |
1455 | *** | | |
1456 | *** | second | |
1457 | *** | --- | |
1458 | *** | one | 2 +- | |
1459 | *** | 1 file changed, 1 insertion(+), 1 deletion(-) | |
1460 | *** | | |
1461 | *** | diff --git a/one b/one | |
cb78f4f0 | 1462 | *** | index BEFORE..AFTER 100644 |
660e113c JK |
1463 | *** | --- a/one |
1464 | *** | +++ b/one | |
1465 | *** | @@ -1 +1 @@ | |
1466 | *** | -one | |
1467 | *** | +ichi | |
1468 | *** | | |
1469 | *** * commit COMMIT_OBJECT_NAME | |
1470 | *** Author: A U Thor <author@example.com> | |
1471 | *** | |
1472 | *** initial | |
1473 | *** --- | |
1474 | *** one | 1 + | |
1475 | *** 1 file changed, 1 insertion(+) | |
1476 | *** | |
1477 | *** diff --git a/one b/one | |
1478 | *** new file mode 100644 | |
cb78f4f0 | 1479 | *** index BEFORE..AFTER |
660e113c JK |
1480 | *** --- /dev/null |
1481 | *** +++ b/one | |
1482 | *** @@ -0,0 +1 @@ | |
1483 | *** +one | |
1484 | EOF | |
1485 | ||
1486 | test_expect_success 'log --line-prefix="*** " --graph with diff and stats' ' | |
989eea95 | 1487 | lib_test_cmp_short_graph --line-prefix="*** " --no-renames --stat -p |
660e113c JK |
1488 | ' |
1489 | ||
f5022b5f JK |
1490 | cat >expect <<-\EOF |
1491 | * reach | |
1492 | | | |
1493 | | A reach.t | |
1494 | * Merge branch 'tangle' | |
1495 | * Merge branch 'side' | |
1496 | |\ | |
1497 | | * side-2 | |
1498 | | | |
1499 | | A 2 | |
1500 | * Second | |
1501 | | | |
1502 | | A one | |
1503 | * sixth | |
1504 | ||
1505 | D a/two | |
1506 | EOF | |
1507 | ||
1508 | test_expect_success 'log --graph with --name-status' ' | |
989eea95 | 1509 | test_cmp_graph --name-status tangle..reach |
f5022b5f JK |
1510 | ' |
1511 | ||
1512 | cat >expect <<-\EOF | |
1513 | * reach | |
1514 | | | |
1515 | | reach.t | |
1516 | * Merge branch 'tangle' | |
1517 | * Merge branch 'side' | |
1518 | |\ | |
1519 | | * side-2 | |
1520 | | | |
1521 | | 2 | |
1522 | * Second | |
1523 | | | |
1524 | | one | |
1525 | * sixth | |
1526 | ||
1527 | a/two | |
1528 | EOF | |
1529 | ||
1530 | test_expect_success 'log --graph with --name-only' ' | |
989eea95 | 1531 | test_cmp_graph --name-only tangle..reach |
f5022b5f JK |
1532 | ' |
1533 | ||
003c84f6 JH |
1534 | test_expect_success 'dotdot is a parent directory' ' |
1535 | mkdir -p a/b && | |
1536 | ( echo sixth && echo fifth ) >expect && | |
1537 | ( cd a/b && git log --format=%s .. ) >actual && | |
1538 | test_cmp expect actual | |
1539 | ' | |
1540 | ||
aefc81ad | 1541 | test_expect_success GPG 'setup signed branch' ' |
cf3983d1 ZK |
1542 | test_when_finished "git reset --hard && git checkout master" && |
1543 | git checkout -b signed master && | |
1544 | echo foo >foo && | |
1545 | git add foo && | |
aefc81ad MJ |
1546 | git commit -S -m signed_commit |
1547 | ' | |
1548 | ||
67a6ea63 HJI |
1549 | test_expect_success GPG 'setup signed branch with subkey' ' |
1550 | test_when_finished "git reset --hard && git checkout master" && | |
1551 | git checkout -b signed-subkey master && | |
1552 | echo foo >foo && | |
1553 | git add foo && | |
1554 | git commit -SB7227189 -m signed_commit | |
1555 | ' | |
1556 | ||
53fc9993 HS |
1557 | test_expect_success GPGSM 'setup signed branch x509' ' |
1558 | test_when_finished "git reset --hard && git checkout master" && | |
1559 | git checkout -b signed-x509 master && | |
1560 | echo foo >foo && | |
1561 | git add foo && | |
1562 | test_config gpg.format x509 && | |
1563 | test_config user.signingkey $GIT_COMMITTER_EMAIL && | |
1564 | git commit -S -m signed_commit | |
1565 | ' | |
1566 | ||
67a6ea63 HJI |
1567 | test_expect_success GPGSM 'log x509 fingerprint' ' |
1568 | echo "F8BF62E0693D0694816377099909C779FA23FD65 | " >expect && | |
1569 | git log -n1 --format="%GF | %GP" signed-x509 >actual && | |
1570 | test_cmp expect actual | |
1571 | ' | |
1572 | ||
1573 | test_expect_success GPGSM 'log OpenPGP fingerprint' ' | |
1574 | echo "D4BE22311AD3131E5EDA29A461092E85B7227189" > expect && | |
1575 | git log -n1 --format="%GP" signed-subkey >actual && | |
1576 | test_cmp expect actual | |
1577 | ' | |
1578 | ||
aefc81ad | 1579 | test_expect_success GPG 'log --graph --show-signature' ' |
cf3983d1 ZK |
1580 | git log --graph --show-signature -n1 signed >actual && |
1581 | grep "^| gpg: Signature made" actual && | |
1582 | grep "^| gpg: Good signature" actual | |
1583 | ' | |
1584 | ||
53fc9993 HS |
1585 | test_expect_success GPGSM 'log --graph --show-signature x509' ' |
1586 | git log --graph --show-signature -n1 signed-x509 >actual && | |
1587 | grep "^| gpgsm: Signature made" actual && | |
1588 | grep "^| gpgsm: Good signature" actual | |
1589 | ' | |
1590 | ||
cf3983d1 ZK |
1591 | test_expect_success GPG 'log --graph --show-signature for merged tag' ' |
1592 | test_when_finished "git reset --hard && git checkout master" && | |
1593 | git checkout -b plain master && | |
1594 | echo aaa >bar && | |
1595 | git add bar && | |
1596 | git commit -m bar_commit && | |
1597 | git checkout -b tagged master && | |
1598 | echo bbb >baz && | |
1599 | git add baz && | |
1600 | git commit -m baz_commit && | |
1601 | git tag -s -m signed_tag_msg signed_tag && | |
1602 | git checkout plain && | |
1603 | git merge --no-ff -m msg signed_tag && | |
1604 | git log --graph --show-signature -n1 plain >actual && | |
1605 | grep "^|\\\ merged tag" actual && | |
1606 | grep "^| | gpg: Signature made" actual && | |
1607 | grep "^| | gpg: Good signature" actual | |
1608 | ' | |
1609 | ||
237a2817 HD |
1610 | test_expect_success GPG 'log --graph --show-signature for merged tag in shallow clone' ' |
1611 | test_when_finished "git reset --hard && git checkout master" && | |
1612 | git checkout -b plain-shallow master && | |
1613 | echo aaa >bar && | |
1614 | git add bar && | |
1615 | git commit -m bar_commit && | |
1616 | git checkout --detach master && | |
1617 | echo bbb >baz && | |
1618 | git add baz && | |
1619 | git commit -m baz_commit && | |
1620 | git tag -s -m signed_tag_msg signed_tag_shallow && | |
1621 | hash=$(git rev-parse HEAD) && | |
1622 | git checkout plain-shallow && | |
1623 | git merge --no-ff -m msg signed_tag_shallow && | |
1624 | git clone --depth 1 --no-local . shallow && | |
1625 | test_when_finished "rm -rf shallow" && | |
1626 | git -C shallow log --graph --show-signature -n1 plain-shallow >actual && | |
1627 | grep "tag signed_tag_shallow names a non-parent $hash" actual | |
1628 | ' | |
1629 | ||
f1e3df31 HJI |
1630 | test_expect_success GPG 'log --graph --show-signature for merged tag with missing key' ' |
1631 | test_when_finished "git reset --hard && git checkout master" && | |
1632 | git checkout -b plain-nokey master && | |
1633 | echo aaa >bar && | |
1634 | git add bar && | |
1635 | git commit -m bar_commit && | |
1636 | git checkout -b tagged-nokey master && | |
1637 | echo bbb >baz && | |
1638 | git add baz && | |
1639 | git commit -m baz_commit && | |
1640 | git tag -s -m signed_tag_msg signed_tag_nokey && | |
1641 | git checkout plain-nokey && | |
1642 | git merge --no-ff -m msg signed_tag_nokey && | |
1643 | GNUPGHOME=. git log --graph --show-signature -n1 plain-nokey >actual && | |
1644 | grep "^|\\\ merged tag" actual && | |
1645 | grep "^| | gpg: Signature made" actual && | |
1646 | grep "^| | gpg: Can'"'"'t check signature: \(public key not found\|No public key\)" actual | |
1647 | ' | |
1648 | ||
1649 | test_expect_success GPG 'log --graph --show-signature for merged tag with bad signature' ' | |
1650 | test_when_finished "git reset --hard && git checkout master" && | |
1651 | git checkout -b plain-bad master && | |
1652 | echo aaa >bar && | |
1653 | git add bar && | |
1654 | git commit -m bar_commit && | |
1655 | git checkout -b tagged-bad master && | |
1656 | echo bbb >baz && | |
1657 | git add baz && | |
1658 | git commit -m baz_commit && | |
1659 | git tag -s -m signed_tag_msg signed_tag_bad && | |
1660 | git cat-file tag signed_tag_bad >raw && | |
1661 | sed -e "s/signed_tag_msg/forged/" raw >forged && | |
1662 | git hash-object -w -t tag forged >forged.tag && | |
1663 | git checkout plain-bad && | |
1664 | git merge --no-ff -m msg "$(cat forged.tag)" && | |
1665 | git log --graph --show-signature -n1 plain-bad >actual && | |
1666 | grep "^|\\\ merged tag" actual && | |
1667 | grep "^| | gpg: Signature made" actual && | |
1668 | grep "^| | gpg: BAD signature from" actual | |
1669 | ' | |
1670 | ||
1671 | test_expect_success GPG 'log --show-signature for merged tag with GPG failure' ' | |
1672 | test_when_finished "git reset --hard && git checkout master" && | |
1673 | git checkout -b plain-fail master && | |
1674 | echo aaa >bar && | |
1675 | git add bar && | |
1676 | git commit -m bar_commit && | |
1677 | git checkout -b tagged-fail master && | |
1678 | echo bbb >baz && | |
1679 | git add baz && | |
1680 | git commit -m baz_commit && | |
1681 | git tag -s -m signed_tag_msg signed_tag_fail && | |
1682 | git checkout plain-fail && | |
1683 | git merge --no-ff -m msg signed_tag_fail && | |
1684 | TMPDIR="$(pwd)/bogus" git log --show-signature -n1 plain-fail >actual && | |
1685 | grep "^merged tag" actual && | |
1686 | grep "^No signature" actual && | |
1687 | ! grep "^gpg: Signature made" actual | |
1688 | ' | |
1689 | ||
53fc9993 HS |
1690 | test_expect_success GPGSM 'log --graph --show-signature for merged tag x509' ' |
1691 | test_when_finished "git reset --hard && git checkout master" && | |
1692 | test_config gpg.format x509 && | |
1693 | test_config user.signingkey $GIT_COMMITTER_EMAIL && | |
1694 | git checkout -b plain-x509 master && | |
1695 | echo aaa >bar && | |
1696 | git add bar && | |
1697 | git commit -m bar_commit && | |
1698 | git checkout -b tagged-x509 master && | |
1699 | echo bbb >baz && | |
1700 | git add baz && | |
1701 | git commit -m baz_commit && | |
1702 | git tag -s -m signed_tag_msg signed_tag_x509 && | |
1703 | git checkout plain-x509 && | |
1704 | git merge --no-ff -m msg signed_tag_x509 && | |
1705 | git log --graph --show-signature -n1 plain-x509 >actual && | |
1706 | grep "^|\\\ merged tag" actual && | |
1707 | grep "^| | gpgsm: Signature made" actual && | |
1708 | grep "^| | gpgsm: Good signature" actual | |
1709 | ' | |
1710 | ||
f1e3df31 HJI |
1711 | test_expect_success GPGSM 'log --graph --show-signature for merged tag x509 missing key' ' |
1712 | test_when_finished "git reset --hard && git checkout master" && | |
1713 | test_config gpg.format x509 && | |
1714 | test_config user.signingkey $GIT_COMMITTER_EMAIL && | |
1715 | git checkout -b plain-x509-nokey master && | |
1716 | echo aaa >bar && | |
1717 | git add bar && | |
1718 | git commit -m bar_commit && | |
1719 | git checkout -b tagged-x509-nokey master && | |
1720 | echo bbb >baz && | |
1721 | git add baz && | |
1722 | git commit -m baz_commit && | |
1723 | git tag -s -m signed_tag_msg signed_tag_x509_nokey && | |
1724 | git checkout plain-x509-nokey && | |
1725 | git merge --no-ff -m msg signed_tag_x509_nokey && | |
1726 | GNUPGHOME=. git log --graph --show-signature -n1 plain-x509-nokey >actual && | |
1727 | grep "^|\\\ merged tag" actual && | |
1728 | grep "^| | gpgsm: certificate not found" actual | |
1729 | ' | |
1730 | ||
1731 | test_expect_success GPGSM 'log --graph --show-signature for merged tag x509 bad signature' ' | |
1732 | test_when_finished "git reset --hard && git checkout master" && | |
1733 | test_config gpg.format x509 && | |
1734 | test_config user.signingkey $GIT_COMMITTER_EMAIL && | |
1735 | git checkout -b plain-x509-bad master && | |
1736 | echo aaa >bar && | |
1737 | git add bar && | |
1738 | git commit -m bar_commit && | |
1739 | git checkout -b tagged-x509-bad master && | |
1740 | echo bbb >baz && | |
1741 | git add baz && | |
1742 | git commit -m baz_commit && | |
1743 | git tag -s -m signed_tag_msg signed_tag_x509_bad && | |
1744 | git cat-file tag signed_tag_x509_bad >raw && | |
1745 | sed -e "s/signed_tag_msg/forged/" raw >forged && | |
1746 | git hash-object -w -t tag forged >forged.tag && | |
1747 | git checkout plain-x509-bad && | |
1748 | git merge --no-ff -m msg "$(cat forged.tag)" && | |
1749 | git log --graph --show-signature -n1 plain-x509-bad >actual && | |
1750 | grep "^|\\\ merged tag" actual && | |
1751 | grep "^| | gpgsm: Signature made" actual && | |
1752 | grep "^| | gpgsm: invalid signature" actual | |
1753 | ' | |
1754 | ||
1755 | ||
aa379999 MJ |
1756 | test_expect_success GPG '--no-show-signature overrides --show-signature' ' |
1757 | git log -1 --show-signature --no-show-signature signed >actual && | |
1758 | ! grep "^gpg:" actual | |
1759 | ' | |
1760 | ||
fce04c3c MJ |
1761 | test_expect_success GPG 'log.showsignature=true behaves like --show-signature' ' |
1762 | test_config log.showsignature true && | |
1763 | git log -1 signed >actual && | |
1764 | grep "gpg: Signature made" actual && | |
1765 | grep "gpg: Good signature" actual | |
1766 | ' | |
1767 | ||
1768 | test_expect_success GPG '--no-show-signature overrides log.showsignature=true' ' | |
1769 | test_config log.showsignature true && | |
1770 | git log -1 --no-show-signature signed >actual && | |
1771 | ! grep "^gpg:" actual | |
1772 | ' | |
1773 | ||
1774 | test_expect_success GPG '--show-signature overrides log.showsignature=false' ' | |
1775 | test_config log.showsignature false && | |
1776 | git log -1 --show-signature signed >actual && | |
1777 | grep "gpg: Signature made" actual && | |
1778 | grep "gpg: Good signature" actual | |
1779 | ' | |
1780 | ||
695985f4 DJ |
1781 | test_expect_success 'log --graph --no-walk is forbidden' ' |
1782 | test_must_fail git log --graph --no-walk | |
1783 | ' | |
1784 | ||
ce113604 JK |
1785 | test_expect_success 'log diagnoses bogus HEAD' ' |
1786 | git init empty && | |
1787 | test_must_fail git -C empty log 2>stderr && | |
1788 | test_i18ngrep does.not.have.any.commits stderr && | |
1789 | echo 1234abcd >empty/.git/refs/heads/master && | |
1790 | test_must_fail git -C empty log 2>stderr && | |
1791 | test_i18ngrep broken stderr && | |
1792 | echo "ref: refs/heads/invalid.lock" >empty/.git/HEAD && | |
1793 | test_must_fail git -C empty log 2>stderr && | |
1794 | test_i18ngrep broken stderr && | |
1795 | test_must_fail git -C empty log --default totally-bogus 2>stderr && | |
1796 | test_i18ngrep broken stderr | |
1797 | ' | |
1798 | ||
5d34d1ac | 1799 | test_expect_success 'log does not default to HEAD when rev input is given' ' |
5d34d1ac | 1800 | git log --branches=does-not-exist >actual && |
d3c6751b | 1801 | test_must_be_empty actual |
5d34d1ac JK |
1802 | ' |
1803 | ||
728350b7 JK |
1804 | test_expect_success 'set up --source tests' ' |
1805 | git checkout --orphan source-a && | |
1806 | test_commit one && | |
1807 | test_commit two && | |
1808 | git checkout -b source-b HEAD^ && | |
1809 | test_commit three | |
1810 | ' | |
1811 | ||
1812 | test_expect_success 'log --source paints branch names' ' | |
cb78f4f0 | 1813 | cat >expect <<-EOF && |
1814 | $(git rev-parse --short :/three) source-b three | |
1815 | $(git rev-parse --short :/two ) source-a two | |
1816 | $(git rev-parse --short :/one ) source-b one | |
728350b7 JK |
1817 | EOF |
1818 | git log --oneline --source source-a source-b >actual && | |
1819 | test_cmp expect actual | |
1820 | ' | |
1821 | ||
1822 | test_expect_success 'log --source paints tag names' ' | |
1823 | git tag -m tagged source-tag && | |
cb78f4f0 | 1824 | cat >expect <<-EOF && |
1825 | $(git rev-parse --short :/three) source-tag three | |
1826 | $(git rev-parse --short :/two ) source-a two | |
1827 | $(git rev-parse --short :/one ) source-tag one | |
728350b7 JK |
1828 | EOF |
1829 | git log --oneline --source source-tag source-a >actual && | |
1830 | test_cmp expect actual | |
1831 | ' | |
1832 | ||
ed79b2cf | 1833 | test_expect_success 'log --source paints symmetric ranges' ' |
cb78f4f0 | 1834 | cat >expect <<-EOF && |
1835 | $(git rev-parse --short :/three) source-b three | |
1836 | $(git rev-parse --short :/two ) source-a two | |
ed79b2cf JK |
1837 | EOF |
1838 | git log --oneline --source source-a...source-b >actual && | |
1839 | test_cmp expect actual | |
1840 | ' | |
1841 | ||
669b1d2a MD |
1842 | test_expect_success '--exclude-promisor-objects does not BUG-crash' ' |
1843 | test_must_fail git log --exclude-promisor-objects source-a | |
1844 | ' | |
1845 | ||
51b4594b JK |
1846 | test_expect_success 'log --end-of-options' ' |
1847 | git update-ref refs/heads/--source HEAD && | |
1848 | git log --end-of-options --source >actual && | |
1849 | git log >expect && | |
1850 | test_cmp expect actual | |
1851 | ' | |
1852 | ||
65113121 | 1853 | test_done |