summaryrefslogtreecommitdiff
path: root/t/t4047-diff-dirstat.sh
diff options
context:
space:
mode:
authorJohan Herland <johan@herland.net>2011-04-29 11:36:19 +0200
committerJunio C Hamano <gitster@pobox.com>2011-04-29 11:20:03 -0700
commit2d17495196d0dceb0ff492aa97bfff33ef1baa18 (patch)
tree010da01ffd0d5101ba2d3689553f07165302e3a7 /t/t4047-diff-dirstat.sh
parent333f3fb0c5307fed170cae336ab3c056f4d6ca1c (diff)
downloadgit-2d17495196d0dceb0ff492aa97bfff33ef1baa18.tar.gz
Add config variable for specifying default --dirstat behavior
The new diff.dirstat config variable takes the same arguments as '--dirstat=<args>', and specifies the default arguments for --dirstat. The config is obviously overridden by --dirstat arguments passed on the command line. When not specified, the --dirstat defaults are 'changes,noncumulative,3'. The patch also adds several tests verifying the interaction between the diff.dirstat config variable, and the --dirstat command line option. Improved-by: Junio C Hamano <gitster@pobox.com> Signed-off-by: Johan Herland <johan@herland.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t4047-diff-dirstat.sh')
-rwxr-xr-xt/t4047-diff-dirstat.sh72
1 files changed, 72 insertions, 0 deletions
diff --git a/t/t4047-diff-dirstat.sh b/t/t4047-diff-dirstat.sh
index d0ed62c0dd..c1b3697bf7 100755
--- a/t/t4047-diff-dirstat.sh
+++ b/t/t4047-diff-dirstat.sh
@@ -386,6 +386,15 @@ test_expect_success 'later options override earlier options:' '
test_cmp expect_diff_dirstat_CC actual_diff_dirstat_CC
'
+test_expect_success 'non-defaults in config overridden by explicit defaults on command line' '
+ git -c diff.dirstat=files,cumulative,50 diff --dirstat=changes,noncumulative,3 HEAD^..HEAD >actual_diff_dirstat &&
+ test_cmp expect_diff_dirstat actual_diff_dirstat &&
+ git -c diff.dirstat=files,cumulative,50 diff --dirstat=changes,noncumulative,3 -M HEAD^..HEAD >actual_diff_dirstat_M &&
+ test_cmp expect_diff_dirstat_M actual_diff_dirstat_M &&
+ git -c diff.dirstat=files,cumulative,50 diff --dirstat=changes,noncumulative,3 -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/
@@ -437,6 +446,15 @@ test_expect_success '-X0' '
test_cmp expect_diff_dirstat_CC actual_diff_dirstat_CC
'
+test_expect_success 'diff.dirstat=0' '
+ git -c diff.dirstat=0 diff --dirstat HEAD^..HEAD >actual_diff_dirstat &&
+ test_cmp expect_diff_dirstat actual_diff_dirstat &&
+ git -c diff.dirstat=0 diff --dirstat -M HEAD^..HEAD >actual_diff_dirstat_M &&
+ test_cmp expect_diff_dirstat_M actual_diff_dirstat_M &&
+ git -c diff.dirstat=0 diff --dirstat -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/
@@ -507,6 +525,24 @@ test_expect_success '-X0,cumulative' '
test_cmp expect_diff_dirstat_CC actual_diff_dirstat_CC
'
+test_expect_success 'diff.dirstat=0,cumulative' '
+ git -c diff.dirstat=0,cumulative diff --dirstat HEAD^..HEAD >actual_diff_dirstat &&
+ test_cmp expect_diff_dirstat actual_diff_dirstat &&
+ git -c diff.dirstat=0,cumulative diff --dirstat -M HEAD^..HEAD >actual_diff_dirstat_M &&
+ test_cmp expect_diff_dirstat_M actual_diff_dirstat_M &&
+ git -c diff.dirstat=0,cumulative diff --dirstat -C -C HEAD^..HEAD >actual_diff_dirstat_CC &&
+ test_cmp expect_diff_dirstat_CC actual_diff_dirstat_CC
+'
+
+test_expect_success 'diff.dirstat=0 & --dirstat=cumulative' '
+ git -c diff.dirstat=0 diff --dirstat=cumulative HEAD^..HEAD >actual_diff_dirstat &&
+ test_cmp expect_diff_dirstat actual_diff_dirstat &&
+ git -c diff.dirstat=0 diff --dirstat=cumulative -M HEAD^..HEAD >actual_diff_dirstat_M &&
+ test_cmp expect_diff_dirstat_M actual_diff_dirstat_M &&
+ git -c diff.dirstat=0 diff --dirstat=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/
@@ -558,6 +594,15 @@ test_expect_success '--dirstat=files' '
test_cmp expect_diff_dirstat_CC actual_diff_dirstat_CC
'
+test_expect_success 'diff.dirstat=files' '
+ git -c diff.dirstat=files diff --dirstat HEAD^..HEAD >actual_diff_dirstat &&
+ test_cmp expect_diff_dirstat actual_diff_dirstat &&
+ git -c diff.dirstat=files diff --dirstat -M HEAD^..HEAD >actual_diff_dirstat_M &&
+ test_cmp expect_diff_dirstat_M actual_diff_dirstat_M &&
+ git -c diff.dirstat=files diff --dirstat -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/
@@ -601,6 +646,15 @@ test_expect_success '--dirstat=files,10' '
test_cmp expect_diff_dirstat_CC actual_diff_dirstat_CC
'
+test_expect_success 'diff.dirstat=10,files' '
+ git -c diff.dirstat=10,files diff --dirstat HEAD^..HEAD >actual_diff_dirstat &&
+ test_cmp expect_diff_dirstat actual_diff_dirstat &&
+ git -c diff.dirstat=10,files diff --dirstat -M HEAD^..HEAD >actual_diff_dirstat_M &&
+ test_cmp expect_diff_dirstat_M actual_diff_dirstat_M &&
+ git -c diff.dirstat=10,files diff --dirstat -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/
@@ -662,6 +716,15 @@ test_expect_success '--dirstat=files,cumulative' '
test_cmp expect_diff_dirstat_CC actual_diff_dirstat_CC
'
+test_expect_success 'diff.dirstat=cumulative,files' '
+ git -c diff.dirstat=cumulative,files diff --dirstat HEAD^..HEAD >actual_diff_dirstat &&
+ test_cmp expect_diff_dirstat actual_diff_dirstat &&
+ git -c diff.dirstat=cumulative,files diff --dirstat -M HEAD^..HEAD >actual_diff_dirstat_M &&
+ test_cmp expect_diff_dirstat_M actual_diff_dirstat_M &&
+ git -c diff.dirstat=cumulative,files diff --dirstat -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/
@@ -703,4 +766,13 @@ test_expect_success '--dirstat=files,cumulative,10' '
test_cmp expect_diff_dirstat_CC actual_diff_dirstat_CC
'
+test_expect_success 'diff.dirstat=10,cumulative,files' '
+ git -c diff.dirstat=10,cumulative,files diff --dirstat HEAD^..HEAD >actual_diff_dirstat &&
+ test_cmp expect_diff_dirstat actual_diff_dirstat &&
+ git -c diff.dirstat=10,cumulative,files diff --dirstat -M HEAD^..HEAD >actual_diff_dirstat_M &&
+ test_cmp expect_diff_dirstat_M actual_diff_dirstat_M &&
+ git -c diff.dirstat=10,cumulative,files diff --dirstat -C -C HEAD^..HEAD >actual_diff_dirstat_CC &&
+ test_cmp expect_diff_dirstat_CC actual_diff_dirstat_CC
+'
+
test_done