git p4 test: clean up the p4d cleanup functions
[gitweb.git] / t / t4049-diff-stat-count.sh
index 70ee0736813fd4db389f996080bfdb28515ffc8b..a34121740a4ab58e8abd16b3a00df5f44d2f1648 100755 (executable)
@@ -13,38 +13,37 @@ test_expect_success 'setup' '
        git commit -m initial
 '
 
-test_expect_success 'limit output to 2 (simple)' '
+test_expect_success 'mode-only change show as a 0-line change' '
        git reset --hard &&
-       chmod +x c d &&
+       test_chmod +x b d &&
        echo a >a &&
-       echo b >b &&
-       cat >expect <<-\EOF
+       echo c >c &&
+       cat >expect <<-\EOF &&
         a | 1 +
-        b | 1 +
+        b | 0
         ...
         4 files changed, 2 insertions(+)
        EOF
-       git diff --stat --stat-count=2 >actual &&
+       git diff --stat --stat-count=2 HEAD >actual &&
        test_i18ncmp expect actual
 '
 
 test_expect_success 'binary changes do not count in lines' '
        git reset --hard &&
-       chmod +x c d &&
        echo a >a &&
-       echo b >b &&
+       echo c >c &&
        cat "$TEST_DIRECTORY"/test-binary-1.png >d &&
-       cat >expect <<-\EOF
+       cat >expect <<-\EOF &&
         a | 1 +
-        b | 1 +
+        c | 1 +
         ...
-        4 files changed, 2 insertions(+)
+        3 files changed, 2 insertions(+)
        EOF
        git diff --stat --stat-count=2 >actual &&
        test_i18ncmp expect actual
 '
 
-test_expect_failure 'exclude unmerged entries from total file count' '
+test_expect_success 'exclude unmerged entries from total file count' '
        git reset --hard &&
        echo a >a &&
        echo b >b &&
@@ -56,12 +55,11 @@ test_expect_failure 'exclude unmerged entries from total file count' '
        done |
        git update-index --index-info &&
        echo d >d &&
-       chmod +x c d &&
-       cat >expect <<-\EOF
+       cat >expect <<-\EOF &&
         a | 1 +
         b | 1 +
         ...
-        4 files changed, 3 insertions(+)
+        3 files changed, 3 insertions(+)
        EOF
        git diff --stat --stat-count=2 >actual &&
        test_i18ncmp expect actual