]> git.ipfire.org Git - thirdparty/git.git/blame - t/t3005-ls-files-relative.sh
Start the 2.46 cycle
[thirdparty/git.git] / t / t3005-ls-files-relative.sh
CommitLineData
0f64bfa9
CB
1#!/bin/sh
2
3test_description='ls-files tests with relative paths
4
5This test runs git ls-files with various relative path arguments.
6'
7
eab4ac6a 8TEST_PASSES_SANITIZE_LEAK=true
0f64bfa9
CB
9. ./test-lib.sh
10
0f64bfa9
CB
11test_expect_success 'prepare' '
12 : >never-mind-me &&
13 git add never-mind-me &&
14 mkdir top &&
15 (
16 cd top &&
17 mkdir sub &&
18 x="x xa xbc xdef xghij xklmno" &&
19 y=$(echo "$x" | tr x y) &&
20 touch $x &&
21 touch $y &&
22 cd sub &&
23 git add ../x*
24 )
25'
26
27test_expect_success 'ls-files with mixed levels' '
28 (
29 cd top/sub &&
30 cat >expect <<-EOF &&
31 ../../never-mind-me
32 ../x
33 EOF
34 git ls-files $(cat expect) >actual &&
35 test_cmp expect actual
36 )
37'
38
39test_expect_success 'ls-files -c' '
40 (
41 cd top/sub &&
efe26b9e 42 printf "error: pathspec $SQ%s$SQ did not match any file(s) known to git\n" ../y* >expect.err &&
bd482d6e 43 echo "Did you forget to ${SQ}git add${SQ}?" >>expect.err &&
385ceec1
JS
44 ls ../x* >expect.out &&
45 test_must_fail git ls-files -c --error-unmatch ../[xy]* >actual.out 2>actual.err &&
46 test_cmp expect.out actual.out &&
1108cea7 47 test_cmp expect.err actual.err
0f64bfa9
CB
48 )
49'
50
51test_expect_success 'ls-files -o' '
52 (
53 cd top/sub &&
efe26b9e 54 printf "error: pathspec $SQ%s$SQ did not match any file(s) known to git\n" ../x* >expect.err &&
bd482d6e 55 echo "Did you forget to ${SQ}git add${SQ}?" >>expect.err &&
385ceec1
JS
56 ls ../y* >expect.out &&
57 test_must_fail git ls-files -o --error-unmatch ../[xy]* >actual.out 2>actual.err &&
58 test_cmp expect.out actual.out &&
1108cea7 59 test_cmp expect.err actual.err
0f64bfa9
CB
60 )
61'
62
63test_done