3 test_description
='diff --dirstat tests'
6 # set up two commits where the second commit has these files
7 # (10 lines in each file):
9 # unchanged/text (unchanged from 1st commit)
10 # changed/text (changed 1st line)
11 # rearranged/text (swapped 1st and 2nd line)
12 # dst/copy/unchanged/text (copied from src/copy/unchanged/text, unchanged)
13 # dst/copy/changed/text (copied from src/copy/changed/text, changed)
14 # dst/copy/rearranged/text (copied from src/copy/rearranged/text, rearranged)
15 # dst/move/unchanged/text (moved from src/move/unchanged/text, unchanged)
16 # dst/move/changed/text (moved from src/move/changed/text, changed)
17 # dst/move/rearranged/text (moved from src/move/rearranged/text, rearranged)
19 test_expect_success
'setup' '
25 mkdir src/copy/unchanged &&
26 mkdir src/copy/changed &&
27 mkdir src/copy/rearranged &&
29 mkdir src/move/unchanged &&
30 mkdir src/move/changed &&
31 mkdir src/move/rearranged &&
32 cat <<EOF >unchanged/text &&
44 cat <<EOF >changed/text &&
56 cat <<EOF >rearranged/text &&
68 cat <<EOF >src/copy/unchanged/text &&
69 copy unchanged line #0
70 copy unchanged line #1
71 copy unchanged line #2
72 copy unchanged line #3
73 copy unchanged line #4
74 copy unchanged line #5
75 copy unchanged line #6
76 copy unchanged line #7
77 copy unchanged line #8
78 copy unchanged line #9
80 cat <<EOF >src/copy/changed/text &&
92 cat <<EOF >src/copy/rearranged/text &&
93 copy rearranged line #0
94 copy rearranged line #1
95 copy rearranged line #2
96 copy rearranged line #3
97 copy rearranged line #4
98 copy rearranged line #5
99 copy rearranged line #6
100 copy rearranged line #7
101 copy rearranged line #8
102 copy rearranged line #9
104 cat <<EOF >src/move/unchanged/text &&
105 move unchanged line #0
106 move unchanged line #1
107 move unchanged line #2
108 move unchanged line #3
109 move unchanged line #4
110 move unchanged line #5
111 move unchanged line #6
112 move unchanged line #7
113 move unchanged line #8
114 move unchanged line #9
116 cat <<EOF >src/move/changed/text &&
128 cat <<EOF >src/move/rearranged/text &&
129 move rearranged line #0
130 move rearranged line #1
131 move rearranged line #2
132 move rearranged line #3
133 move rearranged line #4
134 move rearranged line #5
135 move rearranged line #6
136 move rearranged line #7
137 move rearranged line #8
138 move rearranged line #9
141 git commit -m "initial" &&
144 mkdir dst/copy/unchanged &&
145 mkdir dst/copy/changed &&
146 mkdir dst/copy/rearranged &&
148 mkdir dst/move/unchanged &&
149 mkdir dst/move/changed &&
150 mkdir dst/move/rearranged &&
151 cat <<EOF >changed/text &&
152 CHANGED XXXXXXX line #0
163 cat <<EOF >rearranged/text &&
175 cat <<EOF >dst/copy/unchanged/text &&
176 copy unchanged line #0
177 copy unchanged line #1
178 copy unchanged line #2
179 copy unchanged line #3
180 copy unchanged line #4
181 copy unchanged line #5
182 copy unchanged line #6
183 copy unchanged line #7
184 copy unchanged line #8
185 copy unchanged line #9
187 cat <<EOF >dst/copy/changed/text &&
188 copy XXXCHANGED line #0
199 cat <<EOF >dst/copy/rearranged/text &&
200 copy rearranged line #1
201 copy rearranged line #0
202 copy rearranged line #2
203 copy rearranged line #3
204 copy rearranged line #4
205 copy rearranged line #5
206 copy rearranged line #6
207 copy rearranged line #7
208 copy rearranged line #8
209 copy rearranged line #9
211 cat <<EOF >dst/move/unchanged/text &&
212 move unchanged line #0
213 move unchanged line #1
214 move unchanged line #2
215 move unchanged line #3
216 move unchanged line #4
217 move unchanged line #5
218 move unchanged line #6
219 move unchanged line #7
220 move unchanged line #8
221 move unchanged line #9
223 cat <<EOF >dst/move/changed/text &&
224 move XXXCHANGED line #0
235 cat <<EOF >dst/move/rearranged/text &&
236 move rearranged line #1
237 move rearranged line #0
238 move rearranged line #2
239 move rearranged line #3
240 move rearranged line #4
241 move rearranged line #5
242 move rearranged line #6
243 move rearranged line #7
244 move rearranged line #8
245 move rearranged line #9
248 git rm -r src/move/unchanged &&
249 git rm -r src/move/changed &&
250 git rm -r src/move/rearranged &&
251 git commit -m "changes"
254 cat <<EOF >expect_diff_stat
256 10 0 dst/copy/changed/text
257 10 0 dst/copy/rearranged/text
258 10 0 dst/copy/unchanged/text
259 10 0 dst/move/changed/text
260 10 0 dst/move/rearranged/text
261 10 0 dst/move/unchanged/text
263 0 10 src/move/changed/text
264 0 10 src/move/rearranged/text
265 0 10 src/move/unchanged/text
268 cat <<EOF >expect_diff_stat_M
270 10 0 dst/copy/changed/text
271 10 0 dst/copy/rearranged/text
272 10 0 dst/copy/unchanged/text
273 1 1 {src => dst}/move/changed/text
274 1 1 {src => dst}/move/rearranged/text
275 0 0 {src => dst}/move/unchanged/text
279 cat <<EOF >expect_diff_stat_CC
281 1 1 {src => dst}/copy/changed/text
282 1 1 {src => dst}/copy/rearranged/text
283 0 0 {src => dst}/copy/unchanged/text
284 1 1 {src => dst}/move/changed/text
285 1 1 {src => dst}/move/rearranged/text
286 0 0 {src => dst}/move/unchanged/text
290 test_expect_success
'sanity check setup (--numstat)' '
291 git diff --numstat HEAD^..HEAD >actual_diff_stat &&
292 test_cmp expect_diff_stat actual_diff_stat &&
293 git diff --numstat -M HEAD^..HEAD >actual_diff_stat_M &&
294 test_cmp expect_diff_stat_M actual_diff_stat_M &&
295 git diff --numstat -C -C HEAD^..HEAD >actual_diff_stat_CC &&
296 test_cmp expect_diff_stat_CC actual_diff_stat_CC
299 # changed/text and rearranged/text falls below default 3% threshold
300 cat <<EOF >expect_diff_dirstat
301 10.8% dst/copy/changed/
302 10.8% dst/copy/rearranged/
303 10.8% dst/copy/unchanged/
304 10.8% dst/move/changed/
305 10.8% dst/move/rearranged/
306 10.8% dst/move/unchanged/
307 10.8% src/move/changed/
308 10.8% src/move/rearranged/
309 10.8% src/move/unchanged/
312 # rearranged/text falls below default 3% threshold
313 cat <<EOF >expect_diff_dirstat_M
315 29.3% dst/copy/changed/
316 29.3% dst/copy/rearranged/
317 29.3% dst/copy/unchanged/
318 5.8% dst/move/changed/
321 # rearranged/text falls below default 3% threshold
322 cat <<EOF >expect_diff_dirstat_CC
324 32.6% dst/copy/changed/
325 32.6% dst/move/changed/
328 test_expect_success
'various ways to misspell --dirstat' '
329 test_must_fail git show --dirstat10 &&
330 test_must_fail git show --dirstat10,files &&
331 test_must_fail git show -X=20 &&
332 test_must_fail git show -X=20,cumulative
335 test_expect_success
'vanilla --dirstat' '
336 git diff --dirstat HEAD^..HEAD >actual_diff_dirstat &&
337 test_cmp expect_diff_dirstat actual_diff_dirstat &&
338 git diff --dirstat -M HEAD^..HEAD >actual_diff_dirstat_M &&
339 test_cmp expect_diff_dirstat_M actual_diff_dirstat_M &&
340 git diff --dirstat -C -C HEAD^..HEAD >actual_diff_dirstat_CC &&
341 test_cmp expect_diff_dirstat_CC actual_diff_dirstat_CC
344 test_expect_success
'vanilla -X' '
345 git diff -X HEAD^..HEAD >actual_diff_dirstat &&
346 test_cmp expect_diff_dirstat actual_diff_dirstat &&
347 git diff -X -M HEAD^..HEAD >actual_diff_dirstat_M &&
348 test_cmp expect_diff_dirstat_M actual_diff_dirstat_M &&
349 git diff -X -C -C HEAD^..HEAD >actual_diff_dirstat_CC &&
350 test_cmp expect_diff_dirstat_CC actual_diff_dirstat_CC
353 test_expect_success
'explicit defaults: --dirstat=changes,noncumulative,3' '
354 git diff --dirstat=changes,noncumulative,3 HEAD^..HEAD >actual_diff_dirstat &&
355 test_cmp expect_diff_dirstat actual_diff_dirstat &&
356 git diff --dirstat=changes,noncumulative,3 -M HEAD^..HEAD >actual_diff_dirstat_M &&
357 test_cmp expect_diff_dirstat_M actual_diff_dirstat_M &&
358 git diff --dirstat=changes,noncumulative,3 -C -C HEAD^..HEAD >actual_diff_dirstat_CC &&
359 test_cmp expect_diff_dirstat_CC actual_diff_dirstat_CC
362 test_expect_success
'explicit defaults: -Xchanges,noncumulative,3' '
363 git diff -Xchanges,noncumulative,3 HEAD^..HEAD >actual_diff_dirstat &&
364 test_cmp expect_diff_dirstat actual_diff_dirstat &&
365 git diff -Xchanges,noncumulative,3 -M HEAD^..HEAD >actual_diff_dirstat_M &&
366 test_cmp expect_diff_dirstat_M actual_diff_dirstat_M &&
367 git diff -Xchanges,noncumulative,3 -C -C HEAD^..HEAD >actual_diff_dirstat_CC &&
368 test_cmp expect_diff_dirstat_CC actual_diff_dirstat_CC
371 test_expect_success
'later options override earlier options:' '
372 git diff --dirstat=files,10,cumulative,changes,noncumulative,3 HEAD^..HEAD >actual_diff_dirstat &&
373 test_cmp expect_diff_dirstat actual_diff_dirstat &&
374 git diff --dirstat=files,10,cumulative,changes,noncumulative,3 -M HEAD^..HEAD >actual_diff_dirstat_M &&
375 test_cmp expect_diff_dirstat_M actual_diff_dirstat_M &&
376 git diff --dirstat=files,10,cumulative,changes,noncumulative,3 -C -C HEAD^..HEAD >actual_diff_dirstat_CC &&
377 test_cmp expect_diff_dirstat_CC actual_diff_dirstat_CC
378 git diff --dirstat=files --dirstat=10 --dirstat=cumulative --dirstat=changes --dirstat=noncumulative -X3 HEAD^..HEAD >actual_diff_dirstat &&
379 test_cmp expect_diff_dirstat actual_diff_dirstat &&
380 git diff --dirstat=files --dirstat=10 --dirstat=cumulative --dirstat=changes --dirstat=noncumulative -X3 -M HEAD^..HEAD >actual_diff_dirstat_M &&
381 test_cmp expect_diff_dirstat_M actual_diff_dirstat_M &&
382 git diff --dirstat=files --dirstat=10 --dirstat=cumulative --dirstat=changes --dirstat=noncumulative -X3 -C -C HEAD^..HEAD >actual_diff_dirstat_CC &&
383 test_cmp expect_diff_dirstat_CC actual_diff_dirstat_CC
386 test_expect_success
'non-defaults in config overridden by explicit defaults on command line' '
387 git -c diff.dirstat=files,cumulative,50 diff --dirstat=changes,noncumulative,3 HEAD^..HEAD >actual_diff_dirstat &&
388 test_cmp expect_diff_dirstat actual_diff_dirstat &&
389 git -c diff.dirstat=files,cumulative,50 diff --dirstat=changes,noncumulative,3 -M HEAD^..HEAD >actual_diff_dirstat_M &&
390 test_cmp expect_diff_dirstat_M actual_diff_dirstat_M &&
391 git -c diff.dirstat=files,cumulative,50 diff --dirstat=changes,noncumulative,3 -C -C HEAD^..HEAD >actual_diff_dirstat_CC &&
392 test_cmp expect_diff_dirstat_CC actual_diff_dirstat_CC
395 cat <<EOF >expect_diff_dirstat
397 10.8% dst/copy/changed/
398 10.8% dst/copy/rearranged/
399 10.8% dst/copy/unchanged/
400 10.8% dst/move/changed/
401 10.8% dst/move/rearranged/
402 10.8% dst/move/unchanged/
404 10.8% src/move/changed/
405 10.8% src/move/rearranged/
406 10.8% src/move/unchanged/
409 cat <<EOF >expect_diff_dirstat_M
411 29.3% dst/copy/changed/
412 29.3% dst/copy/rearranged/
413 29.3% dst/copy/unchanged/
414 5.8% dst/move/changed/
415 0.1% dst/move/rearranged/
419 cat <<EOF >expect_diff_dirstat_CC
421 32.6% dst/copy/changed/
422 0.6% dst/copy/rearranged/
423 32.6% dst/move/changed/
424 0.6% dst/move/rearranged/
428 test_expect_success
'--dirstat=0' '
429 git diff --dirstat=0 HEAD^..HEAD >actual_diff_dirstat &&
430 test_cmp expect_diff_dirstat actual_diff_dirstat &&
431 git diff --dirstat=0 -M HEAD^..HEAD >actual_diff_dirstat_M &&
432 test_cmp expect_diff_dirstat_M actual_diff_dirstat_M &&
433 git diff --dirstat=0 -C -C HEAD^..HEAD >actual_diff_dirstat_CC &&
434 test_cmp expect_diff_dirstat_CC actual_diff_dirstat_CC
437 test_expect_success
'-X0' '
438 git diff -X0 HEAD^..HEAD >actual_diff_dirstat &&
439 test_cmp expect_diff_dirstat actual_diff_dirstat &&
440 git diff -X0 -M HEAD^..HEAD >actual_diff_dirstat_M &&
441 test_cmp expect_diff_dirstat_M actual_diff_dirstat_M &&
442 git diff -X0 -C -C HEAD^..HEAD >actual_diff_dirstat_CC &&
443 test_cmp expect_diff_dirstat_CC actual_diff_dirstat_CC
446 test_expect_success
'diff.dirstat=0' '
447 git -c diff.dirstat=0 diff --dirstat HEAD^..HEAD >actual_diff_dirstat &&
448 test_cmp expect_diff_dirstat actual_diff_dirstat &&
449 git -c diff.dirstat=0 diff --dirstat -M HEAD^..HEAD >actual_diff_dirstat_M &&
450 test_cmp expect_diff_dirstat_M actual_diff_dirstat_M &&
451 git -c diff.dirstat=0 diff --dirstat -C -C HEAD^..HEAD >actual_diff_dirstat_CC &&
452 test_cmp expect_diff_dirstat_CC actual_diff_dirstat_CC
455 cat <<EOF >expect_diff_dirstat
457 10.8% dst/copy/changed/
458 10.8% dst/copy/rearranged/
459 10.8% dst/copy/unchanged/
461 10.8% dst/move/changed/
462 10.8% dst/move/rearranged/
463 10.8% dst/move/unchanged/
467 10.8% src/move/changed/
468 10.8% src/move/rearranged/
469 10.8% src/move/unchanged/
473 cat <<EOF >expect_diff_dirstat_M
475 29.3% dst/copy/changed/
476 29.3% dst/copy/rearranged/
477 29.3% dst/copy/unchanged/
479 5.8% dst/move/changed/
480 0.1% dst/move/rearranged/
486 cat <<EOF >expect_diff_dirstat_CC
488 32.6% dst/copy/changed/
489 0.6% dst/copy/rearranged/
491 32.6% dst/move/changed/
492 0.6% dst/move/rearranged/
498 test_expect_success
'--dirstat=0 --cumulative' '
499 git diff --dirstat=0 --cumulative HEAD^..HEAD >actual_diff_dirstat &&
500 test_cmp expect_diff_dirstat actual_diff_dirstat &&
501 git diff --dirstat=0 --cumulative -M HEAD^..HEAD >actual_diff_dirstat_M &&
502 test_cmp expect_diff_dirstat_M actual_diff_dirstat_M &&
503 git diff --dirstat=0 --cumulative -C -C HEAD^..HEAD >actual_diff_dirstat_CC &&
504 test_cmp expect_diff_dirstat_CC actual_diff_dirstat_CC
507 test_expect_success
'--dirstat=0,cumulative' '
508 git diff --dirstat=0,cumulative HEAD^..HEAD >actual_diff_dirstat &&
509 test_cmp expect_diff_dirstat actual_diff_dirstat &&
510 git diff --dirstat=0,cumulative -M HEAD^..HEAD >actual_diff_dirstat_M &&
511 test_cmp expect_diff_dirstat_M actual_diff_dirstat_M &&
512 git diff --dirstat=0,cumulative -C -C HEAD^..HEAD >actual_diff_dirstat_CC &&
513 test_cmp expect_diff_dirstat_CC actual_diff_dirstat_CC
516 test_expect_success
'-X0,cumulative' '
517 git diff -X0,cumulative HEAD^..HEAD >actual_diff_dirstat &&
518 test_cmp expect_diff_dirstat actual_diff_dirstat &&
519 git diff -X0,cumulative -M HEAD^..HEAD >actual_diff_dirstat_M &&
520 test_cmp expect_diff_dirstat_M actual_diff_dirstat_M &&
521 git diff -X0,cumulative -C -C HEAD^..HEAD >actual_diff_dirstat_CC &&
522 test_cmp expect_diff_dirstat_CC actual_diff_dirstat_CC
525 test_expect_success
'diff.dirstat=0,cumulative' '
526 git -c diff.dirstat=0,cumulative diff --dirstat HEAD^..HEAD >actual_diff_dirstat &&
527 test_cmp expect_diff_dirstat actual_diff_dirstat &&
528 git -c diff.dirstat=0,cumulative diff --dirstat -M HEAD^..HEAD >actual_diff_dirstat_M &&
529 test_cmp expect_diff_dirstat_M actual_diff_dirstat_M &&
530 git -c diff.dirstat=0,cumulative diff --dirstat -C -C HEAD^..HEAD >actual_diff_dirstat_CC &&
531 test_cmp expect_diff_dirstat_CC actual_diff_dirstat_CC
534 test_expect_success
'diff.dirstat=0 & --dirstat=cumulative' '
535 git -c diff.dirstat=0 diff --dirstat=cumulative HEAD^..HEAD >actual_diff_dirstat &&
536 test_cmp expect_diff_dirstat actual_diff_dirstat &&
537 git -c diff.dirstat=0 diff --dirstat=cumulative -M HEAD^..HEAD >actual_diff_dirstat_M &&
538 test_cmp expect_diff_dirstat_M actual_diff_dirstat_M &&
539 git -c diff.dirstat=0 diff --dirstat=cumulative -C -C HEAD^..HEAD >actual_diff_dirstat_CC &&
540 test_cmp expect_diff_dirstat_CC actual_diff_dirstat_CC
543 cat <<EOF >expect_diff_dirstat
545 9.0% dst/copy/changed/
546 9.0% dst/copy/rearranged/
547 9.0% dst/copy/unchanged/
548 9.0% dst/move/changed/
549 9.0% dst/move/rearranged/
550 9.0% dst/move/unchanged/
552 9.0% src/move/changed/
553 9.0% src/move/rearranged/
554 9.0% src/move/unchanged/
557 cat <<EOF >expect_diff_dirstat_M
559 14.2% dst/copy/changed/
560 14.2% dst/copy/rearranged/
561 14.2% dst/copy/unchanged/
562 14.2% dst/move/changed/
563 14.2% dst/move/rearranged/
567 cat <<EOF >expect_diff_dirstat_CC
569 16.6% dst/copy/changed/
570 16.6% dst/copy/rearranged/
571 16.6% dst/move/changed/
572 16.6% dst/move/rearranged/
576 test_expect_success
'--dirstat-by-file' '
577 git diff --dirstat-by-file HEAD^..HEAD >actual_diff_dirstat &&
578 test_cmp expect_diff_dirstat actual_diff_dirstat &&
579 git diff --dirstat-by-file -M HEAD^..HEAD >actual_diff_dirstat_M &&
580 test_cmp expect_diff_dirstat_M actual_diff_dirstat_M &&
581 git diff --dirstat-by-file -C -C HEAD^..HEAD >actual_diff_dirstat_CC &&
582 test_cmp expect_diff_dirstat_CC actual_diff_dirstat_CC
585 test_expect_success
'--dirstat=files' '
586 git diff --dirstat=files HEAD^..HEAD >actual_diff_dirstat &&
587 test_cmp expect_diff_dirstat actual_diff_dirstat &&
588 git diff --dirstat=files -M HEAD^..HEAD >actual_diff_dirstat_M &&
589 test_cmp expect_diff_dirstat_M actual_diff_dirstat_M &&
590 git diff --dirstat=files -C -C HEAD^..HEAD >actual_diff_dirstat_CC &&
591 test_cmp expect_diff_dirstat_CC actual_diff_dirstat_CC
594 test_expect_success
'diff.dirstat=files' '
595 git -c diff.dirstat=files diff --dirstat HEAD^..HEAD >actual_diff_dirstat &&
596 test_cmp expect_diff_dirstat actual_diff_dirstat &&
597 git -c diff.dirstat=files diff --dirstat -M HEAD^..HEAD >actual_diff_dirstat_M &&
598 test_cmp expect_diff_dirstat_M actual_diff_dirstat_M &&
599 git -c diff.dirstat=files diff --dirstat -C -C HEAD^..HEAD >actual_diff_dirstat_CC &&
600 test_cmp expect_diff_dirstat_CC actual_diff_dirstat_CC
603 cat <<EOF >expect_diff_dirstat
609 cat <<EOF >expect_diff_dirstat_M
611 14.2% dst/copy/changed/
612 14.2% dst/copy/rearranged/
613 14.2% dst/copy/unchanged/
614 14.2% dst/move/changed/
615 14.2% dst/move/rearranged/
619 cat <<EOF >expect_diff_dirstat_CC
621 16.6% dst/copy/changed/
622 16.6% dst/copy/rearranged/
623 16.6% dst/move/changed/
624 16.6% dst/move/rearranged/
628 test_expect_success
'--dirstat-by-file=10' '
629 git diff --dirstat-by-file=10 HEAD^..HEAD >actual_diff_dirstat &&
630 test_cmp expect_diff_dirstat actual_diff_dirstat &&
631 git diff --dirstat-by-file=10 -M HEAD^..HEAD >actual_diff_dirstat_M &&
632 test_cmp expect_diff_dirstat_M actual_diff_dirstat_M &&
633 git diff --dirstat-by-file=10 -C -C HEAD^..HEAD >actual_diff_dirstat_CC &&
634 test_cmp expect_diff_dirstat_CC actual_diff_dirstat_CC
637 test_expect_success
'--dirstat=files,10' '
638 git diff --dirstat=files,10 HEAD^..HEAD >actual_diff_dirstat &&
639 test_cmp expect_diff_dirstat actual_diff_dirstat &&
640 git diff --dirstat=files,10 -M HEAD^..HEAD >actual_diff_dirstat_M &&
641 test_cmp expect_diff_dirstat_M actual_diff_dirstat_M &&
642 git diff --dirstat=files,10 -C -C HEAD^..HEAD >actual_diff_dirstat_CC &&
643 test_cmp expect_diff_dirstat_CC actual_diff_dirstat_CC
646 test_expect_success
'diff.dirstat=10,files' '
647 git -c diff.dirstat=10,files diff --dirstat HEAD^..HEAD >actual_diff_dirstat &&
648 test_cmp expect_diff_dirstat actual_diff_dirstat &&
649 git -c diff.dirstat=10,files diff --dirstat -M HEAD^..HEAD >actual_diff_dirstat_M &&
650 test_cmp expect_diff_dirstat_M actual_diff_dirstat_M &&
651 git -c diff.dirstat=10,files diff --dirstat -C -C HEAD^..HEAD >actual_diff_dirstat_CC &&
652 test_cmp expect_diff_dirstat_CC actual_diff_dirstat_CC
655 cat <<EOF >expect_diff_dirstat
657 9.0% dst/copy/changed/
658 9.0% dst/copy/rearranged/
659 9.0% dst/copy/unchanged/
661 9.0% dst/move/changed/
662 9.0% dst/move/rearranged/
663 9.0% dst/move/unchanged/
667 9.0% src/move/changed/
668 9.0% src/move/rearranged/
669 9.0% src/move/unchanged/
673 cat <<EOF >expect_diff_dirstat_M
675 14.2% dst/copy/changed/
676 14.2% dst/copy/rearranged/
677 14.2% dst/copy/unchanged/
679 14.2% dst/move/changed/
680 14.2% dst/move/rearranged/
686 cat <<EOF >expect_diff_dirstat_CC
688 16.6% dst/copy/changed/
689 16.6% dst/copy/rearranged/
691 16.6% dst/move/changed/
692 16.6% dst/move/rearranged/
698 test_expect_success
'--dirstat-by-file --cumulative' '
699 git diff --dirstat-by-file --cumulative HEAD^..HEAD >actual_diff_dirstat &&
700 test_cmp expect_diff_dirstat actual_diff_dirstat &&
701 git diff --dirstat-by-file --cumulative -M HEAD^..HEAD >actual_diff_dirstat_M &&
702 test_cmp expect_diff_dirstat_M actual_diff_dirstat_M &&
703 git diff --dirstat-by-file --cumulative -C -C HEAD^..HEAD >actual_diff_dirstat_CC &&
704 test_cmp expect_diff_dirstat_CC actual_diff_dirstat_CC
707 test_expect_success
'--dirstat=files,cumulative' '
708 git diff --dirstat=files,cumulative HEAD^..HEAD >actual_diff_dirstat &&
709 test_cmp expect_diff_dirstat actual_diff_dirstat &&
710 git diff --dirstat=files,cumulative -M HEAD^..HEAD >actual_diff_dirstat_M &&
711 test_cmp expect_diff_dirstat_M actual_diff_dirstat_M &&
712 git diff --dirstat=files,cumulative -C -C HEAD^..HEAD >actual_diff_dirstat_CC &&
713 test_cmp expect_diff_dirstat_CC actual_diff_dirstat_CC
716 test_expect_success
'diff.dirstat=cumulative,files' '
717 git -c diff.dirstat=cumulative,files diff --dirstat HEAD^..HEAD >actual_diff_dirstat &&
718 test_cmp expect_diff_dirstat actual_diff_dirstat &&
719 git -c diff.dirstat=cumulative,files diff --dirstat -M HEAD^..HEAD >actual_diff_dirstat_M &&
720 test_cmp expect_diff_dirstat_M actual_diff_dirstat_M &&
721 git -c diff.dirstat=cumulative,files diff --dirstat -C -C HEAD^..HEAD >actual_diff_dirstat_CC &&
722 test_cmp expect_diff_dirstat_CC actual_diff_dirstat_CC
725 cat <<EOF >expect_diff_dirstat
732 cat <<EOF >expect_diff_dirstat_M
734 14.2% dst/copy/changed/
735 14.2% dst/copy/rearranged/
736 14.2% dst/copy/unchanged/
738 14.2% dst/move/changed/
739 14.2% dst/move/rearranged/
745 cat <<EOF >expect_diff_dirstat_CC
747 16.6% dst/copy/changed/
748 16.6% dst/copy/rearranged/
750 16.6% dst/move/changed/
751 16.6% dst/move/rearranged/
757 test_expect_success
'--dirstat=files,cumulative,10' '
758 git diff --dirstat=files,cumulative,10 HEAD^..HEAD >actual_diff_dirstat &&
759 test_cmp expect_diff_dirstat actual_diff_dirstat &&
760 git diff --dirstat=files,cumulative,10 -M HEAD^..HEAD >actual_diff_dirstat_M &&
761 test_cmp expect_diff_dirstat_M actual_diff_dirstat_M &&
762 git diff --dirstat=files,cumulative,10 -C -C HEAD^..HEAD >actual_diff_dirstat_CC &&
763 test_cmp expect_diff_dirstat_CC actual_diff_dirstat_CC
766 test_expect_success
'diff.dirstat=10,cumulative,files' '
767 git -c diff.dirstat=10,cumulative,files diff --dirstat HEAD^..HEAD >actual_diff_dirstat &&
768 test_cmp expect_diff_dirstat actual_diff_dirstat &&
769 git -c diff.dirstat=10,cumulative,files diff --dirstat -M HEAD^..HEAD >actual_diff_dirstat_M &&
770 test_cmp expect_diff_dirstat_M actual_diff_dirstat_M &&
771 git -c diff.dirstat=10,cumulative,files diff --dirstat -C -C HEAD^..HEAD >actual_diff_dirstat_CC &&
772 test_cmp expect_diff_dirstat_CC actual_diff_dirstat_CC
775 cat <<EOF >expect_diff_dirstat
782 cat <<EOF >expect_diff_dirstat_M
788 cat <<EOF >expect_diff_dirstat_CC
794 test_expect_success
'--dirstat=files,cumulative,16.7' '
795 git diff --dirstat=files,cumulative,16.7 HEAD^..HEAD >actual_diff_dirstat &&
796 test_cmp expect_diff_dirstat actual_diff_dirstat &&
797 git diff --dirstat=files,cumulative,16.7 -M HEAD^..HEAD >actual_diff_dirstat_M &&
798 test_cmp expect_diff_dirstat_M actual_diff_dirstat_M &&
799 git diff --dirstat=files,cumulative,16.7 -C -C HEAD^..HEAD >actual_diff_dirstat_CC &&
800 test_cmp expect_diff_dirstat_CC actual_diff_dirstat_CC
803 test_expect_success
'diff.dirstat=16.7,cumulative,files' '
804 git -c diff.dirstat=16.7,cumulative,files diff --dirstat HEAD^..HEAD >actual_diff_dirstat &&
805 test_cmp expect_diff_dirstat actual_diff_dirstat &&
806 git -c diff.dirstat=16.7,cumulative,files diff --dirstat -M HEAD^..HEAD >actual_diff_dirstat_M &&
807 test_cmp expect_diff_dirstat_M actual_diff_dirstat_M &&
808 git -c diff.dirstat=16.7,cumulative,files diff --dirstat -C -C HEAD^..HEAD >actual_diff_dirstat_CC &&
809 test_cmp expect_diff_dirstat_CC actual_diff_dirstat_CC
812 test_expect_success
'diff.dirstat=16.70,cumulative,files' '
813 git -c diff.dirstat=16.70,cumulative,files diff --dirstat HEAD^..HEAD >actual_diff_dirstat &&
814 test_cmp expect_diff_dirstat actual_diff_dirstat &&
815 git -c diff.dirstat=16.70,cumulative,files diff --dirstat -M HEAD^..HEAD >actual_diff_dirstat_M &&
816 test_cmp expect_diff_dirstat_M actual_diff_dirstat_M &&
817 git -c diff.dirstat=16.70,cumulative,files diff --dirstat -C -C HEAD^..HEAD >actual_diff_dirstat_CC &&
818 test_cmp expect_diff_dirstat_CC actual_diff_dirstat_CC
821 test_expect_success
'--dirstat=files,cumulative,27.2' '
822 git diff --dirstat=files,cumulative,27.2 HEAD^..HEAD >actual_diff_dirstat &&
823 test_cmp expect_diff_dirstat actual_diff_dirstat &&
824 git diff --dirstat=files,cumulative,27.2 -M HEAD^..HEAD >actual_diff_dirstat_M &&
825 test_cmp expect_diff_dirstat_M actual_diff_dirstat_M &&
826 git diff --dirstat=files,cumulative,27.2 -C -C HEAD^..HEAD >actual_diff_dirstat_CC &&
827 test_cmp expect_diff_dirstat_CC actual_diff_dirstat_CC
830 test_expect_success
'--dirstat=files,cumulative,27.09' '
831 git diff --dirstat=files,cumulative,27.09 HEAD^..HEAD >actual_diff_dirstat &&
832 test_cmp expect_diff_dirstat actual_diff_dirstat &&
833 git diff --dirstat=files,cumulative,27.09 -M HEAD^..HEAD >actual_diff_dirstat_M &&
834 test_cmp expect_diff_dirstat_M actual_diff_dirstat_M &&
835 git diff --dirstat=files,cumulative,27.09 -C -C HEAD^..HEAD >actual_diff_dirstat_CC &&
836 test_cmp expect_diff_dirstat_CC actual_diff_dirstat_CC
839 cat <<EOF >expect_diff_dirstat
840 10.6% dst/copy/changed/
841 10.6% dst/copy/rearranged/
842 10.6% dst/copy/unchanged/
843 10.6% dst/move/changed/
844 10.6% dst/move/rearranged/
845 10.6% dst/move/unchanged/
846 10.6% src/move/changed/
847 10.6% src/move/rearranged/
848 10.6% src/move/unchanged/
851 cat <<EOF >expect_diff_dirstat_M
853 26.3% dst/copy/changed/
854 26.3% dst/copy/rearranged/
855 26.3% dst/copy/unchanged/
856 5.2% dst/move/changed/
857 5.2% dst/move/rearranged/
861 cat <<EOF >expect_diff_dirstat_CC
863 16.6% dst/copy/changed/
864 16.6% dst/copy/rearranged/
865 16.6% dst/move/changed/
866 16.6% dst/move/rearranged/
870 test_expect_success
'--dirstat=lines' '
871 git diff --dirstat=lines HEAD^..HEAD >actual_diff_dirstat &&
872 test_cmp expect_diff_dirstat actual_diff_dirstat &&
873 git diff --dirstat=lines -M HEAD^..HEAD >actual_diff_dirstat_M &&
874 test_cmp expect_diff_dirstat_M actual_diff_dirstat_M &&
875 git diff --dirstat=lines -C -C HEAD^..HEAD >actual_diff_dirstat_CC &&
876 test_cmp expect_diff_dirstat_CC actual_diff_dirstat_CC
879 test_expect_success
'diff.dirstat=lines' '
880 git -c diff.dirstat=lines diff --dirstat HEAD^..HEAD >actual_diff_dirstat &&
881 test_cmp expect_diff_dirstat actual_diff_dirstat &&
882 git -c diff.dirstat=lines diff --dirstat -M HEAD^..HEAD >actual_diff_dirstat_M &&
883 test_cmp expect_diff_dirstat_M actual_diff_dirstat_M &&
884 git -c diff.dirstat=lines diff --dirstat -C -C HEAD^..HEAD >actual_diff_dirstat_CC &&
885 test_cmp expect_diff_dirstat_CC actual_diff_dirstat_CC
888 cat <<EOF >expect_diff_dirstat
890 10.6% dst/copy/changed/
891 10.6% dst/copy/rearranged/
892 10.6% dst/copy/unchanged/
893 10.6% dst/move/changed/
894 10.6% dst/move/rearranged/
895 10.6% dst/move/unchanged/
897 10.6% src/move/changed/
898 10.6% src/move/rearranged/
899 10.6% src/move/unchanged/
902 cat <<EOF >expect_diff_dirstat_M
904 26.3% dst/copy/changed/
905 26.3% dst/copy/rearranged/
906 26.3% dst/copy/unchanged/
907 5.2% dst/move/changed/
908 5.2% dst/move/rearranged/
912 cat <<EOF >expect_diff_dirstat_CC
914 16.6% dst/copy/changed/
915 16.6% dst/copy/rearranged/
916 16.6% dst/move/changed/
917 16.6% dst/move/rearranged/
921 test_expect_success
'--dirstat=lines,0' '
922 git diff --dirstat=lines,0 HEAD^..HEAD >actual_diff_dirstat &&
923 test_cmp expect_diff_dirstat actual_diff_dirstat &&
924 git diff --dirstat=lines,0 -M HEAD^..HEAD >actual_diff_dirstat_M &&
925 test_cmp expect_diff_dirstat_M actual_diff_dirstat_M &&
926 git diff --dirstat=lines,0 -C -C HEAD^..HEAD >actual_diff_dirstat_CC &&
927 test_cmp expect_diff_dirstat_CC actual_diff_dirstat_CC
930 test_expect_success
'diff.dirstat=0,lines' '
931 git -c diff.dirstat=0,lines diff --dirstat HEAD^..HEAD >actual_diff_dirstat &&
932 test_cmp expect_diff_dirstat actual_diff_dirstat &&
933 git -c diff.dirstat=0,lines diff --dirstat -M HEAD^..HEAD >actual_diff_dirstat_M &&
934 test_cmp expect_diff_dirstat_M actual_diff_dirstat_M &&
935 git -c diff.dirstat=0,lines diff --dirstat -C -C HEAD^..HEAD >actual_diff_dirstat_CC &&
936 test_cmp expect_diff_dirstat_CC actual_diff_dirstat_CC
939 test_expect_success
'--dirstat=future_param,lines,0 should fail loudly' '
940 test_must_fail git diff --dirstat=future_param,lines,0 HEAD^..HEAD >actual_diff_dirstat 2>actual_error &&
941 test_debug "cat actual_error" &&
942 test_cmp /dev/null actual_diff_dirstat &&
943 test_i18ngrep -q "future_param" actual_error &&
944 test_i18ngrep -q "\--dirstat" actual_error
947 test_expect_success
'--dirstat=dummy1,cumulative,2dummy should report both unrecognized parameters' '
948 test_must_fail git diff --dirstat=dummy1,cumulative,2dummy HEAD^..HEAD >actual_diff_dirstat 2>actual_error &&
949 test_debug "cat actual_error" &&
950 test_cmp /dev/null actual_diff_dirstat &&
951 test_i18ngrep -q "dummy1" actual_error &&
952 test_i18ngrep -q "2dummy" actual_error &&
953 test_i18ngrep -q "\--dirstat" actual_error
956 test_expect_success
'diff.dirstat=future_param,0,lines should warn, but still work' '
957 git -c diff.dirstat=future_param,0,lines diff --dirstat HEAD^..HEAD >actual_diff_dirstat 2>actual_error &&
958 test_debug "cat actual_error" &&
959 test_cmp expect_diff_dirstat actual_diff_dirstat &&
960 test_i18ngrep -q "future_param" actual_error &&
961 test_i18ngrep -q "diff\\.dirstat" actual_error &&
963 git -c diff.dirstat=future_param,0,lines diff --dirstat -M HEAD^..HEAD >actual_diff_dirstat_M 2>actual_error &&
964 test_debug "cat actual_error" &&
965 test_cmp expect_diff_dirstat_M actual_diff_dirstat_M &&
966 test_i18ngrep -q "future_param" actual_error &&
967 test_i18ngrep -q "diff\\.dirstat" actual_error &&
969 git -c diff.dirstat=future_param,0,lines diff --dirstat -C -C HEAD^..HEAD >actual_diff_dirstat_CC 2>actual_error &&
970 test_debug "cat actual_error" &&
971 test_cmp expect_diff_dirstat_CC actual_diff_dirstat_CC &&
972 test_i18ngrep -q "future_param" actual_error &&
973 test_i18ngrep -q "diff\\.dirstat" actual_error