builtin-am: check for valid committer ident
[gitweb.git] / t / t4053-diff-no-index.sh
index 2ab3c487340569d7f2f8164776907ef30df2d415..6eb83211b593ecea798eba3790b9c76fc7d3aa60 100755 (executable)
@@ -17,8 +17,8 @@ test_expect_success 'setup' '
 '
 
 test_expect_success 'git diff --no-index directories' '
-       git diff --no-index a b >cnt
-       test $? = 1 && test_line_count = 14 cnt
+       test_expect_code 1 git diff --no-index a b >cnt &&
+       test_line_count = 14 cnt
 '
 
 test_expect_success 'git diff --no-index relative path outside repo' '
@@ -55,4 +55,38 @@ test_expect_success 'git diff --no-index executed outside repo gives correct err
        )
 '
 
+test_expect_success 'diff D F and diff F D' '
+       (
+               cd repo &&
+               echo in-repo >a &&
+               echo non-repo >../non/git/a &&
+               mkdir sub &&
+               echo sub-repo >sub/a &&
+
+               test_must_fail git diff --no-index sub/a ../non/git/a >expect &&
+               test_must_fail git diff --no-index sub/a ../non/git/ >actual &&
+               test_cmp expect actual &&
+
+               test_must_fail git diff --no-index a ../non/git/a >expect &&
+               test_must_fail git diff --no-index a ../non/git/ >actual &&
+               test_cmp expect actual &&
+
+               test_must_fail git diff --no-index ../non/git/a a >expect &&
+               test_must_fail git diff --no-index ../non/git a >actual &&
+               test_cmp expect actual
+       )
+'
+
+test_expect_success 'turning a file into a directory' '
+       (
+               cd non/git &&
+               mkdir d e e/sub &&
+               echo 1 >d/sub &&
+               echo 2 >e/sub/file &&
+               printf "D\td/sub\nA\te/sub/file\n" >expect &&
+               test_must_fail git diff --no-index --name-status d e >actual &&
+               test_cmp expect actual
+       )
+'
+
 test_done