Merge branch 'jc/exclusion-doc'
[alt-git.git] / t / t3005-ls-files-relative.sh
blob377869432e9d0227c51836cedca8893394bb63e9
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 new_line='
12 sq=\'
14 test_expect_success 'prepare' '
15 : >never-mind-me &&
16 git add never-mind-me &&
17 mkdir top &&
19 cd top &&
20 mkdir sub &&
21 x="x xa xbc xdef xghij xklmno" &&
22 y=$(echo "$x" | tr x y) &&
23 touch $x &&
24 touch $y &&
25 cd sub &&
26 git add ../x*
30 test_expect_success 'ls-files with mixed levels' '
32 cd top/sub &&
33 cat >expect <<-EOF &&
34 ../../never-mind-me
35 ../x
36 EOF
37 git ls-files $(cat expect) >actual &&
38 test_cmp expect actual
42 test_expect_success 'ls-files -c' '
44 cd top/sub &&
45 for f in ../y*
47 echo "error: pathspec $sq$f$sq did not match any file(s) known to git."
48 done >expect.err &&
49 echo "Did you forget to ${sq}git add${sq}?" >>expect.err &&
50 ls ../x* >expect.out &&
51 test_must_fail git ls-files -c --error-unmatch ../[xy]* >actual.out 2>actual.err &&
52 test_cmp expect.out actual.out &&
53 test_cmp expect.err actual.err
57 test_expect_success 'ls-files -o' '
59 cd top/sub &&
60 for f in ../x*
62 echo "error: pathspec $sq$f$sq did not match any file(s) known to git."
63 done >expect.err &&
64 echo "Did you forget to ${sq}git add${sq}?" >>expect.err &&
65 ls ../y* >expect.out &&
66 test_must_fail git ls-files -o --error-unmatch ../[xy]* >actual.out 2>actual.err &&
67 test_cmp expect.out actual.out &&
68 test_cmp expect.err actual.err
72 test_done