Interested in helping open source friends on HP-UX?
[git/mjg.git] / t / t4053-diff-no-index.sh
blob2ab3c487340569d7f2f8164776907ef30df2d415
1 #!/bin/sh
3 test_description='diff --no-index'
5 . ./test-lib.sh
7 test_expect_success 'setup' '
8 mkdir a &&
9 mkdir b &&
10 echo 1 >a/1 &&
11 echo 2 >a/2 &&
12 git init repo &&
13 echo 1 >repo/a &&
14 mkdir -p non/git &&
15 echo 1 >non/git/a &&
16 echo 1 >non/git/b
19 test_expect_success 'git diff --no-index directories' '
20 git diff --no-index a b >cnt
21 test $? = 1 && test_line_count = 14 cnt
24 test_expect_success 'git diff --no-index relative path outside repo' '
26 cd 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' '
34 cd repo &&
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' '
42 cd repo &&
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 &&
51 cd non/git &&
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_done