]> git.ipfire.org Git - thirdparty/git.git/blob - t/t3009-ls-files-others-nonsubmodule.sh
The third batch
[thirdparty/git.git] / t / t3009-ls-files-others-nonsubmodule.sh
1 #!/bin/sh
2
3 test_description='test git ls-files --others with non-submodule repositories
4
5 This test runs git ls-files --others with the following working tree:
6
7 nonrepo-no-files/
8 plain directory with no files
9 nonrepo-untracked-file/
10 plain directory with an untracked file
11 repo-no-commit-no-files/
12 git repository without a commit or a file
13 repo-no-commit-untracked-file/
14 git repository without a commit but with an untracked file
15 repo-with-commit-no-files/
16 git repository with a commit and no untracked files
17 repo-with-commit-untracked-file/
18 git repository with a commit and an untracked file
19 '
20
21 TEST_PASSES_SANITIZE_LEAK=true
22 . ./test-lib.sh
23
24 test_expect_success 'setup: directories' '
25 mkdir nonrepo-no-files/ &&
26 mkdir nonrepo-untracked-file &&
27 : >nonrepo-untracked-file/untracked &&
28 git init repo-no-commit-no-files &&
29 git init repo-no-commit-untracked-file &&
30 : >repo-no-commit-untracked-file/untracked &&
31 git init repo-with-commit-no-files &&
32 git -C repo-with-commit-no-files commit --allow-empty -mmsg &&
33 git init repo-with-commit-untracked-file &&
34 test_commit -C repo-with-commit-untracked-file msg &&
35 : >repo-with-commit-untracked-file/untracked
36 '
37
38 test_expect_success 'ls-files --others handles untracked git repositories' '
39 git ls-files -o >output &&
40 cat >expect <<-EOF &&
41 nonrepo-untracked-file/untracked
42 output
43 repo-no-commit-no-files/
44 repo-no-commit-untracked-file/
45 repo-with-commit-no-files/
46 repo-with-commit-untracked-file/
47 EOF
48 test_cmp expect output
49 '
50
51 test_done