@ -330,7 +330,9 @@ EOF
@@ -330,7 +330,9 @@ EOF
test_expect_success 'various ways to misspell --dirstat' '
test_must_fail git show --dirstat10 &&
test_must_fail git show -X=20
test_must_fail git show --dirstat10,files &&
test_must_fail git show -X=20 &&
test_must_fail git show -X=20,cumulative
'
test_expect_success 'vanilla --dirstat' '
@ -351,6 +353,39 @@ test_expect_success 'vanilla -X' '
@@ -351,6 +353,39 @@ test_expect_success 'vanilla -X' '
test_cmp expect_diff_dirstat_CC actual_diff_dirstat_CC
'
test_expect_success 'explicit defaults: --dirstat=changes,noncumulative,3' '
git diff --dirstat=changes,noncumulative,3 HEAD^..HEAD >actual_diff_dirstat &&
test_cmp expect_diff_dirstat actual_diff_dirstat &&
git diff --dirstat=changes,noncumulative,3 -M HEAD^..HEAD >actual_diff_dirstat_M &&
test_cmp expect_diff_dirstat_M actual_diff_dirstat_M &&
git diff --dirstat=changes,noncumulative,3 -C -C HEAD^..HEAD >actual_diff_dirstat_CC &&
test_cmp expect_diff_dirstat_CC actual_diff_dirstat_CC
'
test_expect_success 'explicit defaults: -Xchanges,noncumulative,3' '
git diff -Xchanges,noncumulative,3 HEAD^..HEAD >actual_diff_dirstat &&
test_cmp expect_diff_dirstat actual_diff_dirstat &&
git diff -Xchanges,noncumulative,3 -M HEAD^..HEAD >actual_diff_dirstat_M &&
test_cmp expect_diff_dirstat_M actual_diff_dirstat_M &&
git diff -Xchanges,noncumulative,3 -C -C HEAD^..HEAD >actual_diff_dirstat_CC &&
test_cmp expect_diff_dirstat_CC actual_diff_dirstat_CC
'
test_expect_success 'later options override earlier options:' '
git diff --dirstat=files,10,cumulative,changes,noncumulative,3 HEAD^..HEAD >actual_diff_dirstat &&
test_cmp expect_diff_dirstat actual_diff_dirstat &&
git diff --dirstat=files,10,cumulative,changes,noncumulative,3 -M HEAD^..HEAD >actual_diff_dirstat_M &&
test_cmp expect_diff_dirstat_M actual_diff_dirstat_M &&
git diff --dirstat=files,10,cumulative,changes,noncumulative,3 -C -C HEAD^..HEAD >actual_diff_dirstat_CC &&
test_cmp expect_diff_dirstat_CC actual_diff_dirstat_CC
git diff --dirstat=files --dirstat=10 --dirstat=cumulative --dirstat=changes --dirstat=noncumulative -X3 HEAD^..HEAD >actual_diff_dirstat &&
test_cmp expect_diff_dirstat actual_diff_dirstat &&
git diff --dirstat=files --dirstat=10 --dirstat=cumulative --dirstat=changes --dirstat=noncumulative -X3 -M HEAD^..HEAD >actual_diff_dirstat_M &&
test_cmp expect_diff_dirstat_M actual_diff_dirstat_M &&
git diff --dirstat=files --dirstat=10 --dirstat=cumulative --dirstat=changes --dirstat=noncumulative -X3 -C -C HEAD^..HEAD >actual_diff_dirstat_CC &&
test_cmp expect_diff_dirstat_CC actual_diff_dirstat_CC
'
cat <<EOF >expect_diff_dirstat
2.1% changed/
10.8% dst/copy/changed/
@ -454,6 +489,24 @@ test_expect_success '--dirstat=0 --cumulative' '
@@ -454,6 +489,24 @@ test_expect_success '--dirstat=0 --cumulative' '
test_cmp expect_diff_dirstat_CC actual_diff_dirstat_CC
'
test_expect_success '--dirstat=0,cumulative' '
git diff --dirstat=0,cumulative HEAD^..HEAD >actual_diff_dirstat &&
test_cmp expect_diff_dirstat actual_diff_dirstat &&
git diff --dirstat=0,cumulative -M HEAD^..HEAD >actual_diff_dirstat_M &&
test_cmp expect_diff_dirstat_M actual_diff_dirstat_M &&
git diff --dirstat=0,cumulative -C -C HEAD^..HEAD >actual_diff_dirstat_CC &&
test_cmp expect_diff_dirstat_CC actual_diff_dirstat_CC
'
test_expect_success '-X0,cumulative' '
git diff -X0,cumulative HEAD^..HEAD >actual_diff_dirstat &&
test_cmp expect_diff_dirstat actual_diff_dirstat &&
git diff -X0,cumulative -M HEAD^..HEAD >actual_diff_dirstat_M &&
test_cmp expect_diff_dirstat_M actual_diff_dirstat_M &&
git diff -X0,cumulative -C -C HEAD^..HEAD >actual_diff_dirstat_CC &&
test_cmp expect_diff_dirstat_CC actual_diff_dirstat_CC
'
cat <<EOF >expect_diff_dirstat
9.0% changed/
9.0% dst/copy/changed/
@ -496,6 +549,15 @@ test_expect_success '--dirstat-by-file' '
@@ -496,6 +549,15 @@ test_expect_success '--dirstat-by-file' '
test_cmp expect_diff_dirstat_CC actual_diff_dirstat_CC
'
test_expect_success '--dirstat=files' '
git diff --dirstat=files HEAD^..HEAD >actual_diff_dirstat &&
test_cmp expect_diff_dirstat actual_diff_dirstat &&
git diff --dirstat=files -M HEAD^..HEAD >actual_diff_dirstat_M &&
test_cmp expect_diff_dirstat_M actual_diff_dirstat_M &&
git diff --dirstat=files -C -C HEAD^..HEAD >actual_diff_dirstat_CC &&
test_cmp expect_diff_dirstat_CC actual_diff_dirstat_CC
'
cat <<EOF >expect_diff_dirstat
27.2% dst/copy/
27.2% dst/move/
@ -530,6 +592,15 @@ test_expect_success '--dirstat-by-file=10' '
@@ -530,6 +592,15 @@ test_expect_success '--dirstat-by-file=10' '
test_cmp expect_diff_dirstat_CC actual_diff_dirstat_CC
'
test_expect_success '--dirstat=files,10' '
git diff --dirstat=files,10 HEAD^..HEAD >actual_diff_dirstat &&
test_cmp expect_diff_dirstat actual_diff_dirstat &&
git diff --dirstat=files,10 -M HEAD^..HEAD >actual_diff_dirstat_M &&
test_cmp expect_diff_dirstat_M actual_diff_dirstat_M &&
git diff --dirstat=files,10 -C -C HEAD^..HEAD >actual_diff_dirstat_CC &&
test_cmp expect_diff_dirstat_CC actual_diff_dirstat_CC
'
cat <<EOF >expect_diff_dirstat
9.0% changed/
9.0% dst/copy/changed/
@ -582,4 +653,54 @@ test_expect_success '--dirstat-by-file --cumulative' '
@@ -582,4 +653,54 @@ test_expect_success '--dirstat-by-file --cumulative' '
test_cmp expect_diff_dirstat_CC actual_diff_dirstat_CC
'
test_expect_success '--dirstat=files,cumulative' '
git diff --dirstat=files,cumulative HEAD^..HEAD >actual_diff_dirstat &&
test_cmp expect_diff_dirstat actual_diff_dirstat &&
git diff --dirstat=files,cumulative -M HEAD^..HEAD >actual_diff_dirstat_M &&
test_cmp expect_diff_dirstat_M actual_diff_dirstat_M &&
git diff --dirstat=files,cumulative -C -C HEAD^..HEAD >actual_diff_dirstat_CC &&
test_cmp expect_diff_dirstat_CC actual_diff_dirstat_CC
'
cat <<EOF >expect_diff_dirstat
27.2% dst/copy/
27.2% dst/move/
54.5% dst/
27.2% src/move/
EOF
cat <<EOF >expect_diff_dirstat_M
14.2% changed/
14.2% dst/copy/changed/
14.2% dst/copy/rearranged/
14.2% dst/copy/unchanged/
42.8% dst/copy/
14.2% dst/move/changed/
14.2% dst/move/rearranged/
28.5% dst/move/
71.4% dst/
14.2% rearranged/
EOF
cat <<EOF >expect_diff_dirstat_CC
16.6% changed/
16.6% dst/copy/changed/
16.6% dst/copy/rearranged/
33.3% dst/copy/
16.6% dst/move/changed/
16.6% dst/move/rearranged/
33.3% dst/move/
66.6% dst/
16.6% rearranged/
EOF
test_expect_success '--dirstat=files,cumulative,10' '
git diff --dirstat=files,cumulative,10 HEAD^..HEAD >actual_diff_dirstat &&
test_cmp expect_diff_dirstat actual_diff_dirstat &&
git diff --dirstat=files,cumulative,10 -M HEAD^..HEAD >actual_diff_dirstat_M &&
test_cmp expect_diff_dirstat_M actual_diff_dirstat_M &&
git diff --dirstat=files,cumulative,10 -C -C HEAD^..HEAD >actual_diff_dirstat_CC &&
test_cmp expect_diff_dirstat_CC actual_diff_dirstat_CC
'
test_done