Fourth batch
[git/raj.git] / t / t3005-ls-files-relative.sh
blob2ec69a8a266fa2438f960ef7d63d6517bbe61b78
1 #!/bin/sh
3 test_description='ls-files tests with relative paths
5 This test runs git ls-files with various relative path arguments.
8 . ./test-lib.sh
10 test_expect_success 'prepare' '
11 : >never-mind-me &&
12 git add never-mind-me &&
13 mkdir top &&
15 cd top &&
16 mkdir sub &&
17 x="x xa xbc xdef xghij xklmno" &&
18 y=$(echo "$x" | tr x y) &&
19 touch $x &&
20 touch $y &&
21 cd sub &&
22 git add ../x*
26 test_expect_success 'ls-files with mixed levels' '
28 cd top/sub &&
29 cat >expect <<-EOF &&
30 ../../never-mind-me
31 ../x
32 EOF
33 git ls-files $(cat expect) >actual &&
34 test_cmp expect actual
38 test_expect_success 'ls-files -c' '
40 cd top/sub &&
41 for f in ../y*
43 echo "error: pathspec $SQ$f$SQ did not match any file(s) known to git"
44 done >expect.err &&
45 echo "Did you forget to ${SQ}git add${SQ}?" >>expect.err &&
46 ls ../x* >expect.out &&
47 test_must_fail git ls-files -c --error-unmatch ../[xy]* >actual.out 2>actual.err &&
48 test_cmp expect.out actual.out &&
49 test_i18ncmp expect.err actual.err
53 test_expect_success 'ls-files -o' '
55 cd top/sub &&
56 for f in ../x*
58 echo "error: pathspec $SQ$f$SQ did not match any file(s) known to git"
59 done >expect.err &&
60 echo "Did you forget to ${SQ}git add${SQ}?" >>expect.err &&
61 ls ../y* >expect.out &&
62 test_must_fail git ls-files -o --error-unmatch ../[xy]* >actual.out 2>actual.err &&
63 test_cmp expect.out actual.out &&
64 test_i18ncmp expect.err actual.err
68 test_done