ls-files: rework exclude patterns.
[git/git.git] / t / t3001-ls-files-others-exclude.sh
CommitLineData
f87f9497
JH
1#!/bin/sh
2#
3# Copyright (c) 2005 Junio C Hamano
4#
5
6test_description='git-ls-files --others --exclude
7
8This test runs git-ls-files --others and tests --exclude patterns.
9'
10
11. ./test-lib.sh
12
13rm -fr one three
14for dir in . one one/two three
15do
16 mkdir -p $dir &&
17 for i in 1 2 3 4 5
18 do
19 >$dir/a.$i
20 done
21done
22
23cat >expect <<EOF
24a.2
25a.4
26a.5
27one/a.3
28one/a.4
29one/a.5
30one/two/a.3
31one/two/a.5
32three/a.2
33three/a.3
34three/a.4
35three/a.5
36EOF
37
38echo '.gitignore
39output
40expect
41.gitignore
42' >.git/ignore
43
44echo '*.1
45/*.3' >.gitignore
46echo '*.2
47two/*.4' >one/.gitignore
48
49test_expect_success \
50 'git-ls-files --others --exclude.' \
51 'git-ls-files --others \
52 --exclude-per-directory=.gitignore \
53 --exclude-from=.git/ignore \
54 >output &&
55 diff -u expect output'