]> git.ipfire.org Git - thirdparty/git.git/blame - t/t3002-ls-files-dashpath.sh
Merge branch 'jt/reftable-geometric-compaction'
[thirdparty/git.git] / t / t3002-ls-files-dashpath.sh
CommitLineData
500b97e4
FK
1#!/bin/sh
2#
3# Copyright (c) 2005 Junio C Hamano
4#
5
5be60078 6test_description='git ls-files test (-- to terminate the path list).
500b97e4 7
5be60078 8This test runs git ls-files --others with the following on the
500b97e4
FK
9filesystem.
10
11 path0 - a file
12 -foo - a file with a funny name.
13 -- - another file with a funny name.
14'
0b3481c9
ÆAB
15
16TEST_PASSES_SANITIZE_LEAK=true
500b97e4
FK
17. ./test-lib.sh
18
18337d40
LL
19test_expect_success 'setup' '
20 echo frotz >path0 &&
500b97e4 21 echo frotz >./-foo &&
18337d40
LL
22 echo frotz >./--
23'
500b97e4 24
18337d40
LL
25test_expect_success 'git ls-files without path restriction.' '
26 test_when_finished "rm -f expect" &&
27 git ls-files --others >output &&
28 cat >expect <<-\EOF &&
29 --
30 -foo
31 output
32 path0
33 EOF
34 test_cmp output expect
500b97e4
FK
35'
36
18337d40
LL
37test_expect_success 'git ls-files with path restriction.' '
38 test_when_finished "rm -f expect" &&
39 git ls-files --others path0 >output &&
40 cat >expect <<-\EOF &&
41 path0
42 EOF
43 test_cmp output expect
500b97e4
FK
44'
45
18337d40
LL
46test_expect_success 'git ls-files with path restriction with --.' '
47 test_when_finished "rm -f expect" &&
48 git ls-files --others -- path0 >output &&
49 cat >expect <<-\EOF &&
50 path0
51 EOF
52 test_cmp output expect
500b97e4
FK
53'
54
18337d40
LL
55test_expect_success 'git ls-files with path restriction with -- --.' '
56 test_when_finished "rm -f expect" &&
57 git ls-files --others -- -- >output &&
58 cat >expect <<-\EOF &&
59 --
60 EOF
61 test_cmp output expect
500b97e4
FK
62'
63
18337d40
LL
64test_expect_success 'git ls-files with no path restriction.' '
65 test_when_finished "rm -f expect" &&
66 git ls-files --others -- >output &&
67 cat >expect <<-\EOF &&
68 --
69 -foo
70 output
71 path0
72 EOF
73 test_cmp output expect
74
500b97e4
FK
75'
76
77test_done