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