interplane.Get Omega
Read in your language

git

[Ported from github.com/git/git] Sync with Git 2.56.1

Brought by drakestapleton

branch master Branches Tags History

git / t / t3002-ls-files-dashpath.sh

78 lines · 1551 bytes Raw Blame History
1#!/bin/sh
2#
3# Copyright (c) 2005 Junio C Hamano
4#
5
6test_description='git ls-files test (-- to terminate the path list).
7
8This test runs git ls-files --others with the following on the
9filesystem.
10
11 path0 - a file
12 -foo - a file with a funny name.
13 -- - another file with a funny name.
14'
15
16. ./test-lib.sh
17
18test_expect_success 'setup' '
19 echo frotz >path0 &&
20 echo frotz >./-foo &&
21 echo frotz >./--
22'
23
24test_expect_success 'git ls-files without path restriction.' '
25 test_when_finished "rm -f expect" &&
26 git ls-files --others >output &&
27 test_filter_gitconfig output &&
28 cat >expect <<-\EOF &&
29 --
30 -foo
31 output
32 path0
33 EOF
34 test_cmp output expect
35'
36
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
44'
45
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
53'
54
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
62'
63
64test_expect_success 'git ls-files with no path restriction.' '
65 test_when_finished "rm -f expect" &&
66 git ls-files --others -- >output &&
67 test_filter_gitconfig output &&
68 cat >expect <<-\EOF &&
69 --
70 -foo
71 output
72 path0
73 EOF
74 test_cmp output expect
75
76'
77
78test_done