3 test_description='diff --no-index'
7 test_expect_success 'setup' '
19 test_expect_success 'git diff --no-index directories' '
20 test_expect_code 1 git diff --no-index a b >cnt &&
21 test_line_count = 14 cnt
24 test_expect_success 'git diff --no-index relative path outside repo' '
27 test_expect_code 0 git diff --no-index a ../non/git/a &&
28 test_expect_code 0 git diff --no-index ../non/git/a ../non/git/b
32 test_expect_success 'git diff --no-index with broken index' '
35 echo broken >.git/index &&
36 git diff --no-index a ../non/git/a
40 test_expect_success 'git diff outside repo with broken index' '
43 git diff ../non/git/a ../non/git/b
47 test_expect_success 'git diff --no-index executed outside repo gives correct error message' '
49 GIT_CEILING_DIRECTORIES=$TRASH_DIRECTORY/non &&
50 export GIT_CEILING_DIRECTORIES &&
52 test_must_fail git diff --no-index a 2>actual.err &&
53 echo "usage: git diff --no-index <path> <path>" >expect.err &&
54 test_cmp expect.err actual.err
58 test_expect_success 'diff D F and diff F D' '
62 echo non-repo >../non/git/a &&
64 echo sub-repo >sub/a &&
66 test_must_fail git diff --no-index sub/a ../non/git/a >expect &&
67 test_must_fail git diff --no-index sub/a ../non/git/ >actual &&
68 test_cmp expect actual &&
70 test_must_fail git diff --no-index a ../non/git/a >expect &&
71 test_must_fail git diff --no-index a ../non/git/ >actual &&
72 test_cmp expect actual &&
74 test_must_fail git diff --no-index ../non/git/a a >expect &&
75 test_must_fail git diff --no-index ../non/git a >actual &&
76 test_cmp expect actual
80 test_expect_success 'turning a file into a directory' '
86 printf "D\td/sub\nA\te/sub/file\n" >expect &&
87 test_must_fail git diff --no-index --name-status d e >actual &&
88 test_cmp expect actual