330
331
test_expect_success 'various ways to misspell --dirstat' '
332
test_must_fail git show --dirstat10 &&
333
- test_must_fail git show -X=20
333
+ test_must_fail git show --dirstat10,files &&
334
+ test_must_fail git show -X=20 &&
335
+ test_must_fail git show -X=20,cumulative
336
'
337
338
test_expect_success 'vanilla --dirstat' '
353
test_cmp expect_diff_dirstat_CC actual_diff_dirstat_CC
354
'
355
356
+test_expect_success 'explicit defaults: --dirstat=changes,noncumulative,3' '
357
+ git diff --dirstat=changes,noncumulative,3 HEAD^..HEAD >actual_diff_dirstat &&
358
+ test_cmp expect_diff_dirstat actual_diff_dirstat &&
359
+ git diff --dirstat=changes,noncumulative,3 -M HEAD^..HEAD >actual_diff_dirstat_M &&
360
+ test_cmp expect_diff_dirstat_M actual_diff_dirstat_M &&
361
+ git diff --dirstat=changes,noncumulative,3 -C -C HEAD^..HEAD >actual_diff_dirstat_CC &&
362
+ test_cmp expect_diff_dirstat_CC actual_diff_dirstat_CC
363
+'
364
+
365
+test_expect_success 'explicit defaults: -Xchanges,noncumulative,3' '
366
+ git diff -Xchanges,noncumulative,3 HEAD^..HEAD >actual_diff_dirstat &&
367
+ test_cmp expect_diff_dirstat actual_diff_dirstat &&
368
+ git diff -Xchanges,noncumulative,3 -M HEAD^..HEAD >actual_diff_dirstat_M &&
369
+ test_cmp expect_diff_dirstat_M actual_diff_dirstat_M &&
370
+ git diff -Xchanges,noncumulative,3 -C -C HEAD^..HEAD >actual_diff_dirstat_CC &&
371
+ test_cmp expect_diff_dirstat_CC actual_diff_dirstat_CC
372
+'
373
+
374
+test_expect_success 'later options override earlier options:' '
375
+ git diff --dirstat=files,10,cumulative,changes,noncumulative,3 HEAD^..HEAD >actual_diff_dirstat &&
376
+ test_cmp expect_diff_dirstat actual_diff_dirstat &&
377
+ git diff --dirstat=files,10,cumulative,changes,noncumulative,3 -M HEAD^..HEAD >actual_diff_dirstat_M &&
378
+ test_cmp expect_diff_dirstat_M actual_diff_dirstat_M &&
379
+ git diff --dirstat=files,10,cumulative,changes,noncumulative,3 -C -C HEAD^..HEAD >actual_diff_dirstat_CC &&
380
+ test_cmp expect_diff_dirstat_CC actual_diff_dirstat_CC
381
+ git diff --dirstat=files --dirstat=10 --dirstat=cumulative --dirstat=changes --dirstat=noncumulative -X3 HEAD^..HEAD >actual_diff_dirstat &&
382
+ test_cmp expect_diff_dirstat actual_diff_dirstat &&
383
+ git diff --dirstat=files --dirstat=10 --dirstat=cumulative --dirstat=changes --dirstat=noncumulative -X3 -M HEAD^..HEAD >actual_diff_dirstat_M &&
384
+ test_cmp expect_diff_dirstat_M actual_diff_dirstat_M &&
385
+ git diff --dirstat=files --dirstat=10 --dirstat=cumulative --dirstat=changes --dirstat=noncumulative -X3 -C -C HEAD^..HEAD >actual_diff_dirstat_CC &&
386
+ test_cmp expect_diff_dirstat_CC actual_diff_dirstat_CC
387
+'
388
+
389
cat <<EOF >expect_diff_dirstat
390
2.1% changed/
391
10.8% dst/copy/changed/
489
test_cmp expect_diff_dirstat_CC actual_diff_dirstat_CC
490
'
491
492
+test_expect_success '--dirstat=0,cumulative' '
493
+ git diff --dirstat=0,cumulative HEAD^..HEAD >actual_diff_dirstat &&
494
+ test_cmp expect_diff_dirstat actual_diff_dirstat &&
495
+ git diff --dirstat=0,cumulative -M HEAD^..HEAD >actual_diff_dirstat_M &&
496
+ test_cmp expect_diff_dirstat_M actual_diff_dirstat_M &&
497
+ git diff --dirstat=0,cumulative -C -C HEAD^..HEAD >actual_diff_dirstat_CC &&
498
+ test_cmp expect_diff_dirstat_CC actual_diff_dirstat_CC
499
+'
500
+
501
+test_expect_success '-X0,cumulative' '
502
+ git diff -X0,cumulative HEAD^..HEAD >actual_diff_dirstat &&
503
+ test_cmp expect_diff_dirstat actual_diff_dirstat &&
504
+ git diff -X0,cumulative -M HEAD^..HEAD >actual_diff_dirstat_M &&
505
+ test_cmp expect_diff_dirstat_M actual_diff_dirstat_M &&
506
+ git diff -X0,cumulative -C -C HEAD^..HEAD >actual_diff_dirstat_CC &&
507
+ test_cmp expect_diff_dirstat_CC actual_diff_dirstat_CC
508
+'
509
+
510
cat <<EOF >expect_diff_dirstat
511
9.0% changed/
512
9.0% dst/copy/changed/
549
test_cmp expect_diff_dirstat_CC actual_diff_dirstat_CC
550
'
551
552
+test_expect_success '--dirstat=files' '
553
+ git diff --dirstat=files HEAD^..HEAD >actual_diff_dirstat &&
554
+ test_cmp expect_diff_dirstat actual_diff_dirstat &&
555
+ git diff --dirstat=files -M HEAD^..HEAD >actual_diff_dirstat_M &&
556
+ test_cmp expect_diff_dirstat_M actual_diff_dirstat_M &&
557
+ git diff --dirstat=files -C -C HEAD^..HEAD >actual_diff_dirstat_CC &&
558
+ test_cmp expect_diff_dirstat_CC actual_diff_dirstat_CC
559
+'
560
+
561
cat <<EOF >expect_diff_dirstat
562
27.2% dst/copy/
563
27.2% dst/move/
592
test_cmp expect_diff_dirstat_CC actual_diff_dirstat_CC
593
'
594
595
+test_expect_success '--dirstat=files,10' '
596
+ git diff --dirstat=files,10 HEAD^..HEAD >actual_diff_dirstat &&
597
+ test_cmp expect_diff_dirstat actual_diff_dirstat &&
598
+ git diff --dirstat=files,10 -M HEAD^..HEAD >actual_diff_dirstat_M &&
599
+ test_cmp expect_diff_dirstat_M actual_diff_dirstat_M &&
600
+ git diff --dirstat=files,10 -C -C HEAD^..HEAD >actual_diff_dirstat_CC &&
601
+ test_cmp expect_diff_dirstat_CC actual_diff_dirstat_CC
602
+'
603
+
604
cat <<EOF >expect_diff_dirstat
605
9.0% changed/
606
9.0% dst/copy/changed/
653
test_cmp expect_diff_dirstat_CC actual_diff_dirstat_CC
654
'
655
656
+test_expect_success '--dirstat=files,cumulative' '
657
+ git diff --dirstat=files,cumulative HEAD^..HEAD >actual_diff_dirstat &&
658
+ test_cmp expect_diff_dirstat actual_diff_dirstat &&
659
+ git diff --dirstat=files,cumulative -M HEAD^..HEAD >actual_diff_dirstat_M &&
660
+ test_cmp expect_diff_dirstat_M actual_diff_dirstat_M &&
661
+ git diff --dirstat=files,cumulative -C -C HEAD^..HEAD >actual_diff_dirstat_CC &&
662
+ test_cmp expect_diff_dirstat_CC actual_diff_dirstat_CC
663
+'
664
+
665
+cat <<EOF >expect_diff_dirstat
666
+ 27.2% dst/copy/
667
+ 27.2% dst/move/
668
+ 54.5% dst/
669
+ 27.2% src/move/
670
+EOF
671
+
672
+cat <<EOF >expect_diff_dirstat_M
673
+ 14.2% changed/
674
+ 14.2% dst/copy/changed/
675
+ 14.2% dst/copy/rearranged/
676
+ 14.2% dst/copy/unchanged/
677
+ 42.8% dst/copy/
678
+ 14.2% dst/move/changed/
679
+ 14.2% dst/move/rearranged/
680
+ 28.5% dst/move/
681
+ 71.4% dst/
682
+ 14.2% rearranged/
683
+EOF
684
+
685
+cat <<EOF >expect_diff_dirstat_CC
686
+ 16.6% changed/
687
+ 16.6% dst/copy/changed/
688
+ 16.6% dst/copy/rearranged/
689
+ 33.3% dst/copy/
690
+ 16.6% dst/move/changed/
691
+ 16.6% dst/move/rearranged/
692
+ 33.3% dst/move/
693
+ 66.6% dst/
694
+ 16.6% rearranged/
695
+EOF
696
+
697
+test_expect_success '--dirstat=files,cumulative,10' '
698
+ git diff --dirstat=files,cumulative,10 HEAD^..HEAD >actual_diff_dirstat &&
699
+ test_cmp expect_diff_dirstat actual_diff_dirstat &&
700
+ git diff --dirstat=files,cumulative,10 -M HEAD^..HEAD >actual_diff_dirstat_M &&
701
+ test_cmp expect_diff_dirstat_M actual_diff_dirstat_M &&
702
+ git diff --dirstat=files,cumulative,10 -C -C HEAD^..HEAD >actual_diff_dirstat_CC &&
703
+ test_cmp expect_diff_dirstat_CC actual_diff_dirstat_CC
704
+'
705
+
706
test_done