Start the 2.46 cycle
[git/gitster.git] / t / t3003-ls-files-exclude.sh
blob7933dff9b3849181b4c168096d166f1054a2a374
1 #!/bin/sh
3 test_description='ls-files --exclude does not affect index files'
5 TEST_PASSES_SANITIZE_LEAK=true
6 . ./test-lib.sh
8 test_expect_success 'create repo with file' '
9 echo content >file &&
10 git add file &&
11 git commit -m file &&
12 echo modification >file
15 check_output() {
16 test_expect_success "ls-files output contains file ($1)" "
17 echo '$2' >expect &&
18 git ls-files --exclude-standard --$1 >output &&
19 test_cmp expect output
23 check_all_output() {
24 check_output 'cached' 'file'
25 check_output 'modified' 'file'
28 check_all_output
29 test_expect_success 'add file to gitignore' '
30 echo file >.gitignore
32 check_all_output
34 test_expect_success 'ls-files -i -c lists only tracked-but-ignored files' '
35 echo content >other-file &&
36 git add other-file &&
37 echo file >expect &&
38 git ls-files -i -c --exclude-standard >output &&
39 test_cmp expect output
42 test_done